|
MediaWiki REL1_35
|
Content object for wiki text pages. More...


Public Member Functions | |
| __construct ( $text) | |
| Stable to call. | |
| 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=[]) | |
| 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. | |
Public Member Functions inherited from TextContent | |
| __construct ( $text, $model_id=CONTENT_MODEL_TEXT) | |
| Stable to call. | |
| 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. | |
| 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 | |
| equals (Content $that=null) | |
| Decides whether two Content objects are equal. | |
| getContentHandler () | |
| getDefaultFormat () | |
| getDeletionUpdates (WikiPage $page, ParserOutput $parserOutput=null) | |
| Stable to override. | |
| getModel () | |
| getParserOutput (Title $title, $revId=null, ParserOptions $options=null, $generateHtml=true) | |
| Returns a ParserOutput object containing information derived from this content. | |
| getRedirectChain () | |
| getSecondaryDataUpdates (Title $title, Content $old=null, $recursive=true, ParserOutput $parserOutput=null) | |
| Returns a list of DataUpdate objects for recording information about this Content in some secondary data store. | |
| getSupportedFormats () | |
| getUltimateRedirectTarget () | |
| isEmpty () | |
| Stable to override. | |
| isRedirect () | |
| isSupportedFormat ( $format) | |
| isValid () | |
| Subclasses may override this to implement (light weight) validation. | |
| prepareSave (WikiPage $page, $flags, $parentRevId, User $user) | |
| Stable to override. | |
| serialize ( $format=null) | |
| Stable to override. | |
Protected Member Functions | |
| fillParserOutput (Title $title, $revId, ParserOptions $options, $generateHtml, ParserOutput &$output) | |
| Returns a ParserOutput object resulting from parsing the content's text using the global Parser service. | |
| getHtml () | |
| getRedirectTargetAndText () | |
| Extract the redirect target and the remaining text on the page. | |
Protected Member Functions inherited from AbstractContent | |
| checkFormat ( $format) | |
| checkModelID ( $modelId) | |
| equalsInternal (Content $that) | |
| Checks whether $that is logically equal to this Content object. | |
| getContentHandlerFactory () | |
Private Attributes | |
| bool | $hadSignature = false |
| Tracks if the parser set the user-signature flag when creating this content, which would make it expire faster in ApiStashEdit. | |
| string null | $previousParseStackTrace = null |
| Stack trace of the previous parse. | |
| $redirectTargetAndText = 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 Attributes inherited from TextContent | |
| string | $mText |
Protected Attributes inherited from AbstractContent | |
| string | $model_id |
| Name of the content model this Content object represents. | |
| WikitextContent::__construct | ( | $text | ) |
Stable to call.
| string | $text |
Reimplemented from AbstractContent.
Definition at line 56 of file WikitextContent.php.
References CONTENT_MODEL_WIKITEXT.
| WikitextContent::addSectionHeader | ( | $header | ) |
Returns a new WikitextContent object with the given section heading prepended.
| string | $header |
Reimplemented from AbstractContent.
Definition at line 136 of file WikitextContent.php.
References $header, TextContent\getText(), and wfMessage().
|
protected |
Returns a ParserOutput object resulting from parsing the content's text using the global Parser service.
| Title | $title | |
| int | null | $revId | ID of the revision being rendered. See Parser::parse() for the ramifications. (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 347 of file WikitextContent.php.
References $title, ParserOutput\addLink(), ParserOutput\addModuleStyles(), ParserOutput\getRawText(), AbstractContent\getRedirectChain(), getRedirectTargetAndText(), ParserOptions\optionsHash(), ParserOutput\setFlag(), and ParserOutput\setText().
|
protected |
| MWException |
Reimplemented from TextContent.
Definition at line 399 of file WikitextContent.php.
| WikitextContent::getRedirectTarget | ( | ) |
Implement redirect extraction for wikitext.
Reimplemented from AbstractContent.
Definition at line 251 of file WikitextContent.php.
References $title, and getRedirectTargetAndText().
|
protected |
Extract the redirect target and the remaining text on the page.
Definition at line 201 of file WikitextContent.php.
References $redirectTargetAndText, $title, $wgMaxRedirects, TextContent\getText(), and Title\isValidRedirectTarget().
Referenced by fillParserOutput(), and getRedirectTarget().
| WikitextContent::getSection | ( | $sectionId | ) |
| string | int | $sectionId |
Reimplemented from AbstractContent.
Definition at line 67 of file WikitextContent.php.
References TextContent\getText().
| WikitextContent::getTextForSummary | ( | $maxlength = 250 | ) |
| int | $maxlength |
Reimplemented from TextContent.
Definition at line 324 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 | null | $hasLinks | If it is known whether this content contains links, provide this information here, to avoid redundant parsing to find out (default: null). |
| Title | null | $title | Optional title, defaults to the title from the current main request. |
Definition at line 295 of file WikitextContent.php.
References $title, $wgArticleCountMethod, AbstractContent\getParserOutput(), 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 415 of file WikitextContent.php.
References TextContent\getText(), and MagicWord\match().
| WikitextContent::preloadTransform | ( | Title | $title, |
| ParserOptions | $popts, | ||
$params = [] |
|||
| ) |
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 184 of file WikitextContent.php.
References $title, and TextContent\getText().
| 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 155 of file WikitextContent.php.
References $title, and TextContent\getText().
| WikitextContent::replaceSection | ( | $sectionId, | |
| Content | $with, | ||
$sectionTitle = '' |
|||
| ) |
| string | int | null | bool | $sectionId | |
| Content | $with | |
| string | $sectionTitle |
| MWException |
Reimplemented from AbstractContent.
Definition at line 89 of file WikitextContent.php.
References TextContent\copy(), AbstractContent\getModel(), Content\getModel(), TextContent\getText(), Content\replaceSection(), and wfMessage().
| 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 269 of file WikitextContent.php.
References Title\getFullText(), and AbstractContent\isRedirect().
|
private |
Tracks if the parser set the user-signature flag when creating this content, which would make it expire faster in ApiStashEdit.
Definition at line 44 of file WikitextContent.php.
|
private |
Stack trace of the previous parse.
Definition at line 49 of file WikitextContent.php.
|
private |
Definition at line 38 of file WikitextContent.php.
Referenced by getRedirectTargetAndText().