MediaWiki
master
|
00001 <?php 00002 00026 class JavaScriptContent extends TextContent { 00027 public function __construct( $text ) { 00028 parent::__construct( $text, CONTENT_MODEL_JAVASCRIPT ); 00029 } 00030 00040 public function preSaveTransform( Title $title, User $user, ParserOptions $popts ) { 00041 global $wgParser; 00042 // @todo: make pre-save transformation optional for script pages 00043 // See bug #32858 00044 00045 $text = $this->getNativeData(); 00046 $pst = $wgParser->preSaveTransform( $text, $title, $user, $popts ); 00047 00048 return new JavaScriptContent( $pst ); 00049 } 00050 00051 00052 protected function getHtml( ) { 00053 $html = ""; 00054 $html .= "<pre class=\"mw-code mw-js\" dir=\"ltr\">\n"; 00055 $html .= $this->getHighlightHtml( ); 00056 $html .= "\n</pre>\n"; 00057 00058 return $html; 00059 } 00060 }