MediaWiki
REL1_24
|
Content object for wiki text pages. More...
Public Member Functions | |
__construct ($text) | |
addSectionHeader ($header) | |
Returns a new WikitextContent object with the given section heading prepended. | |
getRedirectTarget () | |
Implement redirect extraction for wikitext. | |
getSection ($sectionId) | |
getTextForSummary ($maxlength=250) | |
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) | |
This implementation calls $word->match() on the this TextContent object's text. | |
preloadTransform (Title $title, ParserOptions $popts, $params=array()) | |
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 ($sectionId, Content $with, $sectionTitle= '') | |
updateRedirect (Title $target) | |
This implementation replaces the first link on the page with the given new target if this Content object is a redirect. | |
Protected Member Functions | |
fillParserOutput (Title $title, $revId, ParserOptions $options, $generateHtml, ParserOutput &$output) | |
Returns a ParserOutput object resulting from parsing the content's text using $wgParser. | |
getHtml () | |
getRedirectTargetAndText () | |
Extract the redirect target and the remaining text on the page. | |
Private Attributes | |
$redirectTargetAndText = null |
Content object for wiki text pages.
Definition at line 33 of file WikitextContent.php.
WikitextContent::__construct | ( | $ | modelId | ) |
string | $modelId |
Reimplemented from AbstractContent.
Definition at line 36 of file WikitextContent.php.
WikitextContent::addSectionHeader | ( | $ | header | ) |
Returns a new WikitextContent object with the given section heading prepended.
string | $header |
Reimplemented from AbstractContent.
Definition at line 123 of file WikitextContent.php.
References TextContent\getNativeData(), and wfMessage().
WikitextContent::fillParserOutput | ( | Title $ | title, |
$ | revId, | ||
ParserOptions $ | options, | ||
$ | generateHtml, | ||
ParserOutput &$ | output | ||
) | [protected] |
Returns a ParserOutput object resulting from parsing the content's text using $wgParser.
Title | $title | |
int | $revId | Revision to pass to the parser (default: null) |
ParserOptions | $options | (default: null) |
bool | $generateHtml | (default: true) |
ParserOutput | &$output | ParserOutput representing the HTML form of the text, may be manipulated or replaced. |
Reimplemented from TextContent.
Definition at line 332 of file WikitextContent.php.
References $generateHtml, $revId, $wgParser, ParserOutput\addLink(), ParserOutput\addModuleStyles(), false, Title\getPageLanguage(), AbstractContent\getRedirectChain(), Article\getRedirectHeaderHtml(), getRedirectTargetAndText(), ParserOutput\getText(), global, list, and ParserOutput\setText().
WikitextContent::getHtml | ( | ) | [protected] |
MWException |
Reimplemented from TextContent.
Definition at line 358 of file WikitextContent.php.
Implement redirect extraction for wikitext.
Reimplemented from AbstractContent.
Definition at line 230 of file WikitextContent.php.
References $title, getRedirectTargetAndText(), and list.
WikitextContent::getRedirectTargetAndText | ( | ) | [protected] |
Extract the redirect target and the remaining text on the page.
Definition at line 180 of file WikitextContent.php.
References array(), MagicWord\get(), TextContent\getNativeData(), global, Title\isValidRedirectTarget(), and Title\newFromText().
Referenced by fillParserOutput(), and getRedirectTarget().
WikitextContent::getSection | ( | $ | sectionId | ) |
string | number | $sectionId |
Reimplemented from AbstractContent.
Definition at line 47 of file WikitextContent.php.
References $wgParser, TextContent\getNativeData(), and global.
WikitextContent::getTextForSummary | ( | $ | maxlength = 250 | ) |
int | $maxlength |
Reimplemented from TextContent.
Definition at line 310 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.
bool | $hasLinks | If it is known whether this content contains links, provide this information here, to avoid redundant parsing to find out (default: null). |
Title | $title | Optional title, defaults to the title from the current main request. |
Definition at line 274 of file WikitextContent.php.
References empty, RequestContext\getMain(), TextContent\getNativeData(), AbstractContent\getParserOutput(), global, and AbstractContent\isRedirect().
WikitextContent::matchMagicWord | ( | MagicWord $ | word | ) |
This implementation calls $word->match() on the this TextContent object's text.
MagicWord | $word |
Reimplemented from AbstractContent.
Definition at line 374 of file WikitextContent.php.
References TextContent\getNativeData(), and MagicWord\match().
WikitextContent::preloadTransform | ( | Title $ | title, |
ParserOptions $ | popts, | ||
$ | params = array() |
||
) |
Returns a Content object with preload transformations applied (or this object if no transformations apply).
Title | $title | |
ParserOptions | $popts | |
array | $params |
Reimplemented from AbstractContent.
Definition at line 162 of file WikitextContent.php.
References $params, $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().
Title | $title | |
User | $user | |
ParserOptions | $popts |
Reimplemented from TextContent.
Definition at line 142 of file WikitextContent.php.
References $wgParser, TextContent\getNativeData(), and global.
WikitextContent::replaceSection | ( | $ | sectionId, |
Content $ | with, | ||
$ | sectionTitle = '' |
||
) |
string | number | null | bool | $sectionId | |
Content | $with | |
string | $sectionTitle |
MWException |
Reimplemented from AbstractContent.
Definition at line 70 of file WikitextContent.php.
References $wgParser, array(), TextContent\copy(), AbstractContent\getModel(), Content\getModel(), Content\getNativeData(), TextContent\getNativeData(), global, wfMessage(), wfProfileIn(), wfProfileOut(), and wfRunHooks().
WikitextContent::updateRedirect | ( | Title $ | target | ) |
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.
Title | $target |
Reimplemented from AbstractContent.
Definition at line 248 of file WikitextContent.php.
References Title\getFullText(), TextContent\getNativeData(), and AbstractContent\isRedirect().
WikitextContent::$redirectTargetAndText = null [private] |
Definition at line 34 of file WikitextContent.php.