MediaWiki master
JavaScriptContent Class Reference

Content for JavaScript pages. More...

Inherits TextContent.

Collaboration diagram for JavaScriptContent:

Public Member Functions

 __construct ( $text, $modelId=CONTENT_MODEL_JAVASCRIPT)
 
 getRedirectTarget ()
 
 updateRedirect (Title $target)
 If this page is a redirect, return the content if it should redirect to $target instead.
 
- Public Member Functions inherited from TextContent
 convert ( $toModel, $lossy='')
 This implementation provides lossless conversion between content models based on TextContent.
 
 copy ()
 
 diff (Content $that, Language $lang=null)
 Diff this content object with another content object.
 
 getNativeData ()
 Returns the text represented by this Content object, as a string.
 
 getSize ()
 Returns the text's size in bytes.
 
 getText ()
 Returns the text represented by this Content object, as a string.
 
 getTextForSearchIndex ()
 Returns the text represented by this Content object, as a string.
 
 getTextForSummary ( $maxlength=250)
 
 getWikitextForTransclusion ()
 Returns attempts to convert this content object to wikitext, and then returns the text string.
 
 isCountable ( $hasLinks=null)
 Returns true if this content is not a redirect, and $wgArticleCountMethod is "any".
 
- Public Member Functions inherited from AbstractContent
 __construct ( $modelId=null)
 
 addSectionHeader ( $header)
 
 equals (Content $that=null)
 Decides whether two Content objects are equal.
 
 getContentHandler ()
 
 getDefaultFormat ()
 
 getModel ()
 
 getSection ( $sectionId)
 
 getSupportedFormats ()
 
 isEmpty ()
 
 isRedirect ()
 
 isSupportedFormat ( $format)
 
 isValid ()
 Subclasses may override this to implement (light weight) validation.
 
 matchMagicWord (MagicWord $word)
 This default implementation always returns false.
 
 replaceSection ( $sectionId, Content $with, $sectionTitle='')
 
 serialize ( $format=null)
 

Additional Inherited Members

- Static Public Member Functions inherited from TextContent
static normalizeLineEndings ( $text)
 Do a "\\r\\n" -> "\\n" and "\\r" -> "\\n" transformation as well as trim trailing whitespace.
 
- Protected Member Functions inherited from AbstractContent
 checkFormat ( $format)
 
 checkModelID ( $modelId)
 
 equalsInternal (Content $that)
 Checks whether $that is logically equal to this Content object.
 
 getContentHandlerFactory ()
 
- Protected Attributes inherited from TextContent
string $mText
 
- Protected Attributes inherited from AbstractContent
string $model_id
 Name of the content model this Content object represents.
 

Detailed Description

Content for JavaScript pages.

Stability: newable

Definition at line 36 of file JavaScriptContent.php.

Constructor & Destructor Documentation

◆ __construct()

JavaScriptContent::__construct ( $text,
$modelId = CONTENT_MODEL_JAVASCRIPT )
Stability: stable
to call
Parameters
string$textJavaScript code.
string$modelIdthe content model name

Reimplemented from TextContent.

Definition at line 48 of file JavaScriptContent.php.

Member Function Documentation

◆ getRedirectTarget()

JavaScriptContent::getRedirectTarget ( )
Returns
Title|null

Reimplemented from AbstractContent.

Definition at line 71 of file JavaScriptContent.php.

References $matches, AbstractContent\getContentHandler(), and TextContent\getText().

◆ updateRedirect()

JavaScriptContent::updateRedirect ( Title $target)

If this page is a redirect, return the content if it should redirect to $target instead.

Parameters
Title$target
Returns
JavaScriptContent

Reimplemented from AbstractContent.

Definition at line 59 of file JavaScriptContent.php.

References AbstractContent\getContentHandler(), and AbstractContent\isRedirect().


The documentation for this class was generated from the following file: