MediaWiki  REL1_23
JavaScriptContent.php
Go to the documentation of this file.
00001 <?php
00033 class JavaScriptContent extends TextContent {
00034 
00038     public function __construct( $text ) {
00039         parent::__construct( $text, CONTENT_MODEL_JAVASCRIPT );
00040     }
00041 
00052     public function preSaveTransform( Title $title, User $user, ParserOptions $popts ) {
00053         global $wgParser;
00054         // @todo Make pre-save transformation optional for script pages
00055         // See bug #32858
00056 
00057         $text = $this->getNativeData();
00058         $pst = $wgParser->preSaveTransform( $text, $title, $user, $popts );
00059 
00060         return new JavaScriptContent( $pst );
00061     }
00062 
00066     protected function getHtml() {
00067         $html = "";
00068         $html .= "<pre class=\"mw-code mw-js\" dir=\"ltr\">\n";
00069         $html .= $this->getHighlightHtml();
00070         $html .= "\n</pre>\n";
00071 
00072         return $html;
00073     }
00074 
00075 }