- $name=$this->mTitle->getText();
- $pos=strrpos($name,".")+1;
- header ( "Content-type: application/external-editor; charset=".$this->mCharset );
- if(!isset($this->mMode)) {
- $type="Edit text";
- $url=$this->mTitle->getFullURL("action=edit&internaledit=true");
- # *.wiki file extension is used by some editors for syntax
+ header( 'Content-type: application/x-external-editor; charset=utf-8' );
+ header( 'Cache-control: no-cache' );
+
+ # $type can be "Edit text", "Edit file" or "Diff text" at the moment
+ # See the protocol specifications at [[m:Help:External editors/Tech]] for
+ # details.
+ if( $this->mode == "file" ) {
+ $type = "Edit file";
+ $image = wfLocalFile( $this->title );
+ $url = $image->getCanonicalURL();
+ $extension = $image->getExtension();
+ } else {
+ $type = "Edit text";
+ $url = $this->title->getCanonicalURL(
+ array( 'action' => 'edit', 'internaledit' => 'true' ) );
+ # *.wiki file extension is used by some editors for syntax