47 return JavaScriptContent::class;
65 return new $class(
'/* #REDIRECT */' . Xml::encodeJsCall(
'mw.loader.load', [ $url ] ) );
77 if ( $shouldCallDeprecatedMethod ) {
84 '@phan-var JavascriptContent $content';
88 $services = MediaWikiServices::getInstance();
89 if ( !$services->getUserOptionsLookup()->getBoolOption( $pstParams->
getUser(),
'pst-cssjs' ) ) {
91 $parserOptions = clone $parserOptions;
92 $parserOptions->setPreSaveTransform(
false );
96 $pst = $services->getParserFactory()->getInstance()->preSaveTransform(
104 return new $contentClass( $pst );
128 $textModelsToParse = MediaWikiServices::getInstance()->getMainConfig()->get(
129 MainConfigNames::TextModelsToParse );
130 '@phan-var JavaScriptContent $content';
131 if ( in_array(
$content->getModel(), $textModelsToParse ) ) {
133 $output = MediaWikiServices::getInstance()->getParserFactory()->getInstance()
137 WikiPage::makeParserOptionsFromTitleAndModel(
150 $html = Html::element(
152 [
'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.
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.
Represents a title within MediaWiki.
getFullURL( $query='', $query2=false, $proto=PROTO_RELATIVE)
Get a real URL referring to this title, with interwiki link and fragment.
Base interface for content objects.