49 return JavaScriptContent::class;
67 return new $class(
'/* #REDIRECT */' . Html::encodeJsCall(
'mw.loader.load', [ $url ] ) );
79 if ( $shouldCallDeprecatedMethod ) {
86 '@phan-var JavascriptContent $content';
90 $services = MediaWikiServices::getInstance();
91 if ( !$services->getUserOptionsLookup()->getBoolOption( $pstParams->
getUser(),
'pst-cssjs' ) ) {
93 $parserOptions = clone $parserOptions;
94 $parserOptions->setPreSaveTransform(
false );
98 $pst = $services->getParserFactory()->getInstance()->preSaveTransform(
106 return new $contentClass( $pst );
130 $textModelsToParse = MediaWikiServices::getInstance()->getMainConfig()->get(
131 MainConfigNames::TextModelsToParse );
132 '@phan-var JavaScriptContent $content';
133 if ( in_array(
$content->getModel(), $textModelsToParse ) ) {
135 $output = MediaWikiServices::getInstance()->getParserFactory()->getInstance()
139 WikiPage::makeParserOptionsFromTitleAndModel(
152 $html = Html::element(
154 [
'class' =>
'mw-code mw-js',
'dir' =>
'ltr' ],
const CONTENT_FORMAT_JAVASCRIPT
For JS pages.
const CONTENT_MODEL_JAVASCRIPT
Content handler for code content such as CSS, JavaScript, JSON, etc.
shouldCallDeprecatedContentTransformMethod(Content $content, $params)
Check if we need to provide content overrides deprecated Content method.
callDeprecatedContentPST(Content $content, PreSaveTransformParams $params)
Provided content overrides deprecated Content::preSaveTransform, call it and return.
Content handler for JavaScript pages.
__construct( $modelId=CONTENT_MODEL_JAVASCRIPT)
fillParserOutput(Content $content, ContentParseParams $cpoParams, ParserOutput &$output)
Fills the provided ParserOutput object with information derived from the content.
preSaveTransform(Content $content, PreSaveTransformParams $pstParams)
Returns a $content object with pre-save transformations applied (or the same object if no transformat...
makeRedirectContent(Title $destination, $text='')
Create a redirect that is also valid JavaScript.
supportsRedirects()
Returns true if this content model supports redirects.
A class containing constants representing the names of configuration variables.
Rendered output of a wiki page, as parsed from wikitext.
clearWrapperDivClass()
Clears the CSS class to use for the wrapping div, effectively disabling the wrapper div until addWrap...
setText( $text)
Set the text of the ParserOutput.
Base interface for representing page content.