43 private $redirectTarget =
false;
51 parent::__construct( $text, $modelId );
74 if ( $this->redirectTarget !==
false ) {
75 return $this->redirectTarget;
77 $this->redirectTarget =
null;
79 if ( strpos( $text,
'/* #REDIRECT */' ) === 0 ) {
82 $text = str_replace(
'\u0026',
'&', $text );
84 if ( preg_match(
'/title=(.*?)&action=raw/', $text,
$matches ) ) {
85 $title = Title::newFromText( urldecode(
$matches[1] ) );
90 '@phan-var JavaScriptContent $expected';
91 if ( $expected->getText() === $text ) {
92 $this->redirectTarget = $title;
98 return $this->redirectTarget;
103class_alias( JavaScriptContent::class,
'JavaScriptContent' );
const CONTENT_MODEL_JAVASCRIPT
Content for JavaScript pages.
__construct( $text, $modelId=CONTENT_MODEL_JAVASCRIPT)
updateRedirect(Title $target)
If this page is a redirect, return the content if it should redirect to $target instead.
Content object implementation for representing flat text.
getText()
Returns the text represented by this Content object, as a string.