wiki.techinc.nl/includes/content/JavaScriptContent.php
daniel 7db9491d89 set mediawiki version number
Change-Id: I3479776bd3bb25c4d75d07e62ede2ad989025c5b
2012-10-05 15:03:24 +02:00

40 lines
No EOL
929 B
PHP

<?php
/**
* @since 1.21
*/
class JavaScriptContent extends TextContent {
public function __construct( $text ) {
parent::__construct( $text, CONTENT_MODEL_JAVASCRIPT );
}
/**
* Returns a Content object with pre-save transformations applied using
* Parser::preSaveTransform().
*
* @param Title $title
* @param User $user
* @param ParserOptions $popts
* @return Content
*/
public function preSaveTransform( Title $title, User $user, ParserOptions $popts ) {
global $wgParser;
// @todo: make pre-save transformation optional for script pages
// See bug #32858
$text = $this->getNativeData();
$pst = $wgParser->preSaveTransform( $text, $title, $user, $popts );
return new JavaScriptContent( $pst );
}
protected function getHtml( ) {
$html = "";
$html .= "<pre class=\"mw-code mw-js\" dir=\"ltr\">\n";
$html .= $this->getHighlightHtml( );
$html .= "\n</pre>\n";
return $html;
}
}