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