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