MediaWiki  REL1_21
JavaScriptContent.php
Go to the documentation of this file.
00001 <?php
00033 class JavaScriptContent extends TextContent {
00034         public function __construct( $text ) {
00035                 parent::__construct( $text, CONTENT_MODEL_JAVASCRIPT );
00036         }
00037 
00047         public function preSaveTransform( Title $title, User $user, ParserOptions $popts ) {
00048                 global $wgParser;
00049                 // @todo: make pre-save transformation optional for script pages
00050                 // See bug #32858
00051 
00052                 $text = $this->getNativeData();
00053                 $pst = $wgParser->preSaveTransform( $text, $title, $user, $popts );
00054 
00055                 return new JavaScriptContent( $pst );
00056         }
00057 
00058         protected function getHtml() {
00059                 $html = "";
00060                 $html .= "<pre class=\"mw-code mw-js\" dir=\"ltr\">\n";
00061                 $html .= $this->getHighlightHtml();
00062                 $html .= "\n</pre>\n";
00063 
00064                 return $html;
00065         }
00066 }