MediaWiki  1.23.14
JavaScriptContent.php
Go to the documentation of this file.
1 <?php
34 
38  public function __construct( $text ) {
39  parent::__construct( $text, CONTENT_MODEL_JAVASCRIPT );
40  }
41 
52  public function preSaveTransform( Title $title, User $user, ParserOptions $popts ) {
54  // @todo Make pre-save transformation optional for script pages
55  // See bug #32858
56 
57  $text = $this->getNativeData();
58  $pst = $wgParser->preSaveTransform( $text, $title, $user, $popts );
59 
60  return new JavaScriptContent( $pst );
61  }
62 
66  protected function getHtml() {
67  $html = "";
68  $html .= "<pre class=\"mw-code mw-js\" dir=\"ltr\">\n";
69  $html .= $this->getHighlightHtml();
70  $html .= "\n</pre>\n";
71 
72  return $html;
73  }
74 
75 }
ParserOptions
Set options of the Parser.
Definition: ParserOptions.php:31
php
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
$html
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses & $html
Definition: hooks.txt:1530
JavaScriptContent\preSaveTransform
preSaveTransform(Title $title, User $user, ParserOptions $popts)
Returns a Content object with pre-save transformations applied using Parser::preSaveTransform().
Definition: JavaScriptContent.php:52
JavaScriptContent\__construct
__construct( $text)
Definition: JavaScriptContent.php:38
TextContent\getHighlightHtml
getHighlightHtml()
Generates a syntax-highlighted version of the content, as HTML.
Definition: TextContent.php:263
global
when a variable name is used in a it is silently declared as a new masking the global
Definition: design.txt:93
JavaScriptContent
Content for JavaScript pages.
Definition: JavaScriptContent.php:33
$title
presenting them properly to the user as errors is done by the caller $title
Definition: hooks.txt:1324
JavaScriptContent\getHtml
getHtml()
Definition: JavaScriptContent.php:66
$user
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a account $user
Definition: hooks.txt:237
TextContent
Content object implementation for representing flat text.
Definition: TextContent.php:35
Title
Represents a title within MediaWiki.
Definition: Title.php:35
$wgParser
$wgParser
Definition: Setup.php:587
CONTENT_MODEL_JAVASCRIPT
const CONTENT_MODEL_JAVASCRIPT
Definition: Defines.php:284
User
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
Definition: User.php:59
TextContent\getNativeData
getNativeData()
Returns the text represented by this Content object, as a string.
Definition: TextContent.php:118