MediaWiki  REL1_22
WikitextContent Class Reference

Content object for wiki text pages. More...

Inheritance diagram for WikitextContent:
Collaboration diagram for WikitextContent:

List of all members.

Public Member Functions

 __construct ($text)
 addSectionHeader ($header)
 Returns a new WikitextContent object with the given section heading prepended.
 getParserOutput (Title $title, $revId=null, ParserOptions $options=null, $generateHtml=true)
 Returns a ParserOutput object resulting from parsing the content's text using $wgParser.
 getRedirectTarget ()
 Implement redirect extraction for wikitext.
 getSection ($section)
 getTextForSummary ($maxlength=250)
 Returns a textual representation of the content suitable for use in edit summaries and log messages.
 isCountable ($hasLinks=null, Title $title=null)
 Returns true if this content is not a redirect, and this content's text is countable according to the criteria defined by $wgArticleCountMethod.
 matchMagicWord (MagicWord $word)
 preloadTransform (Title $title, ParserOptions $popts)
 Returns a Content object with preload transformations applied (or this object if no transformations apply).
 preSaveTransform (Title $title, User $user, ParserOptions $popts)
 Returns a Content object with pre-save transformations applied using Parser::preSaveTransform().
 replaceSection ($section, Content $with, $sectionTitle= '')
 updateRedirect (Title $target)

Protected Member Functions

 getHtml ()
 Generates an HTML version of the content, for display.

Detailed Description

Content object for wiki text pages.

Definition at line 33 of file WikitextContent.php.


Constructor & Destructor Documentation

Parameters:
string | null$modelId
Since:
1.21

Reimplemented from AbstractContent.

Definition at line 35 of file WikitextContent.php.


Member Function Documentation

Returns a new WikitextContent object with the given section heading prepended.

Parameters:
$headerstring
Returns:
Content

Reimplemented from AbstractContent.

Definition at line 106 of file WikitextContent.php.

References TextContent\getNativeData(), and wfMessage().

WikitextContent::getHtml ( ) [protected]

Generates an HTML version of the content, for display.

Used by getParserOutput() to construct a ParserOutput object.

This default implementation just calls getHighlightHtml(). Content models that have another mapping to HTML (as is the case for markup languages like wikitext) should override this method to generate the appropriate HTML.

Returns:
string An HTML representation of the content

Reimplemented from TextContent.

Definition at line 304 of file WikitextContent.php.

WikitextContent::getParserOutput ( Title title,
revId = null,
ParserOptions options = null,
generateHtml = true 
)

Returns a ParserOutput object resulting from parsing the content's text using $wgParser.

Since:
1.21
Parameters:
$titleTitle
int$revIdRevision to pass to the parser (default: null)
$optionsParserOptions (default: null)
bool$generateHtml(default: false)

Reimplemented from TextContent.

Definition at line 289 of file WikitextContent.php.

References $options, $wgParser, AbstractContent\getContentHandler(), TextContent\getNativeData(), and global.

Referenced by isCountable().

Implement redirect extraction for wikitext.

Returns:
null|Title
Note:
: migrated here from Title::newFromRedirectInternal()
See also:
Content::getRedirectTarget
AbstractContent::getRedirectTarget

Reimplemented from AbstractContent.

Definition at line 161 of file WikitextContent.php.

References $title, array(), MagicWord\get(), TextContent\getNativeData(), global, and Title\newFromText().

See also:
Content::getSection()

Reimplemented from AbstractContent.

Definition at line 42 of file WikitextContent.php.

References $section, $wgParser, TextContent\getNativeData(), and global.

WikitextContent::getTextForSummary ( maxLength = 250)

Returns a textual representation of the content suitable for use in edit summaries and log messages.

Since:
1.21
Parameters:
int$maxLengthMaximum length of the summary text
Returns:
string The summary text

Reimplemented from TextContent.

Definition at line 264 of file WikitextContent.php.

WikitextContent::isCountable ( hasLinks = null,
Title title = null 
)

Returns true if this content is not a redirect, and this content's text is countable according to the criteria defined by $wgArticleCountMethod.

Parameters:
bool$hasLinksif it is known whether this content contains links, provide this information here, to avoid redundant parsing to find out (default: null).
$titleTitle: (default: null)

Definition at line 232 of file WikitextContent.php.

References $title, empty, RequestContext\getMain(), TextContent\getNativeData(), getParserOutput(), global, and AbstractContent\isRedirect().

See also:
Content::matchMagicWord()

This implementation calls $word->match() on the this TextContent object's text.

Parameters:
MagicWord$word
Returns:
bool whether this Content object matches the given magic word.

Reimplemented from AbstractContent.

Definition at line 320 of file WikitextContent.php.

References TextContent\getNativeData(), and MagicWord\match().

Returns a Content object with preload transformations applied (or this object if no transformations apply).

Parameters:
$titleTitle
$poptsParserOptions
Returns:
Content

Reimplemented from AbstractContent.

Definition at line 142 of file WikitextContent.php.

References $wgParser, TextContent\getNativeData(), and global.

WikitextContent::preSaveTransform ( Title title,
User user,
ParserOptions popts 
)

Returns a Content object with pre-save transformations applied using Parser::preSaveTransform().

Parameters:
$titleTitle
$userUser
$poptsParserOptions
Returns:
Content

Reimplemented from TextContent.

Definition at line 124 of file WikitextContent.php.

References $wgParser, TextContent\getNativeData(), and global.

See also:
Content::updateRedirect()

This implementation replaces the first link on the page with the given new target if this Content object is a redirect. Otherwise, this method returns $this.

Since:
1.21
Parameters:
Title$target
Returns:
Content a new Content object with the updated redirect (or $this if this Content object isn't a redirect)

Reimplemented from AbstractContent.

Definition at line 204 of file WikitextContent.php.

References Title\getFullText(), TextContent\getNativeData(), and AbstractContent\isRedirect().


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