54 return JavaScriptContent::class;
75 $redirectContent =
'/* #REDIRECT */mw.loader.load('
76 . json_encode(
$url, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE )
78 return new $class( $redirectContent );
85 '@phan-var JavascriptContent $content';
90 if ( !$services->getUserOptionsLookup()->getBoolOption( $pstParams->
getUser(),
'pst-cssjs' ) ) {
92 $parserOptions = clone $parserOptions;
93 $parserOptions->setPreSaveTransform(
false );
96 $text = $content->getText();
97 $pst = $services->getParserFactory()->getInstance()->preSaveTransform(
105 return new $contentClass( $pst );
131 '@phan-var JavaScriptContent $content';
132 if ( in_array( $content->
getModel(), $textModelsToParse ) ) {
138 WikiPage::makeParserOptionsFromTitleAndModel(
153 [
'class' =>
'mw-code mw-js',
'dir' =>
'ltr' ],
154 "\n" . $content->getText() .
"\n"
168class_alias( JavaScriptContentHandler::class,
'JavaScriptContentHandler' );
const CONTENT_FORMAT_JAVASCRIPT
For JS pages.
const CONTENT_MODEL_JAVASCRIPT
Content handler for code content such as CSS, JavaScript, JSON, etc.
Content handler for JavaScript pages.
makeRedirectContent(Title $destination, $text='')
Create a redirect that is also valid JavaScript.
supportsRedirects()
Returns true if this content model supports redirects.
preSaveTransform(Content $content, PreSaveTransformParams $pstParams)
Returns a $content object with pre-save transformations applied (or the same object if no transformat...
__construct( $modelId=CONTENT_MODEL_JAVASCRIPT)
fillParserOutput(Content $content, ContentParseParams $cpoParams, ParserOutput &$output)
Fills the provided ParserOutput object with information derived from the content.
A class containing constants representing the names of configuration variables.
const TextModelsToParse
Name constant for the TextModelsToParse setting, for use with Config::get()
Base representation for an editable wiki page.
Base interface for representing page content.
getModel()
Returns the ID of the content model used by this Content object.