3 * License: Public domain
5 * @author Erik Moeller <moeller@scireview.de>
9 * Support for external editors to modify both text and files
10 * in external applications. It works as follows: MediaWiki
11 * sends a meta-file with the MIME type 'application/x-external-editor'
12 * to the client. The user has to associate that MIME type with
13 * a helper application (a reference implementation in Perl
14 * can be found in extensions/ee), which will launch the editor,
15 * and save the modified data back to the server.
21 function __construct( $article, $mode ) {
22 global $wgInputEncoding;
23 $this->mArticle
=& $article;
24 $this->mTitle
=& $article->mTitle
;
25 $this->mCharset
= $wgInputEncoding;
30 global $wgOut, $wgScript, $wgScriptPath, $wgServer, $wgLang;
32 $name=$this->mTitle
->getText();
33 $pos=strrpos($name,".")+
1;
34 header ( "Content-type: application/x-external-editor; charset=".$this->mCharset
);
35 header( "Cache-control: no-cache" );
37 # $type can be "Edit text", "Edit file" or "Diff text" at the moment
38 # See the protocol specifications at [[m:Help:External editors/Tech]] for
40 if(!isset($this->mMode
)) {
42 $url=$this->mTitle
->getFullURL("action=edit&internaledit=true");
43 # *.wiki file extension is used by some editors for syntax
44 # highlighting, so we follow that convention
46 } elseif($this->mMode
=="file") {
48 $image = wfLocalFile( $this->mTitle
);
49 $url = $image->getFullURL();
50 $extension=substr($name, $pos);
52 $special=$wgLang->getNsText(NS_SPECIAL
);
57 Script={$wgServer}{$wgScript}
60 Special namespace=$special