|
MediaWiki
master
|
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. More... | |
| getRedirectTarget () | |
| Implement redirect extraction for wikitext. More... | |
| 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. More... | |
| matchMagicWord (MagicWord $word) | |
| This implementation calls $word->match() on the this TextContent object's text. More... | |
| preloadTransform (Title $title, ParserOptions $popts, $params=[]) | |
| Returns a Content object with preload transformations applied (or this object if no transformations apply). More... | |
| preSaveTransform (Title $title, User $user, ParserOptions $popts) | |
| Returns a Content object with pre-save transformations applied using Parser::preSaveTransform(). More... | |
| 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. More... | |
Public Member Functions inherited from TextContent | |
| __construct ($text, $model_id=CONTENT_MODEL_TEXT) | |
| convert ($toModel, $lossy= '') | |
| This implementation provides lossless conversion between content models based on TextContent. More... | |
| copy () | |
| diff (Content $that, Language $lang=null) | |
| Diff this content object with another content object. More... | |
| getNativeData () | |
| Returns the text represented by this Content object, as a string. More... | |
| getSize () | |
| Returns the text's size in bytes. More... | |
| getTextForSearchIndex () | |
| Returns the text represented by this Content object, as a string. More... | |
| getTextForSummary ($maxlength=250) | |
| Returns a textual representation of the content suitable for use in edit summaries and log messages. More... | |
| getWikitextForTransclusion () | |
| Returns attempts to convert this content object to wikitext, and then returns the text string. More... | |
| isCountable ($hasLinks=null) | |
| Returns true if this content is not a redirect, and $wgArticleCountMethod is "any". More... | |
| preSaveTransform (Title $title, User $user, ParserOptions $popts) | |
| Returns a Content object with pre-save transformations applied. More... | |
Public Member Functions inherited from AbstractContent | |
| __construct ($modelId=null) | |
| addSectionHeader ($header) | |
| convert ($toModel, $lossy= '') | |
| This base implementation calls the hook ConvertContent to enable custom conversions. More... | |
| equals (Content $that=null) | |
| getContentHandler () | |
| getDefaultFormat () | |
| getDeletionUpdates (WikiPage $page, ParserOutput $parserOutput=null) | |
| getModel () | |
| getParserOutput (Title $title, $revId=null, ParserOptions $options=null, $generateHtml=true) | |
| Returns a ParserOutput object containing information derived from this content. More... | |
| getRedirectChain () | |
| getRedirectTarget () | |
| Subclasses that implement redirects should override this. More... | |
| 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. More... | |
| getSection ($sectionId) | |
| getSupportedFormats () | |
| getUltimateRedirectTarget () | |
| isEmpty () | |
| isRedirect () | |
| isSupportedFormat ($format) | |
| isValid () | |
| Subclasses may override this to implement (light weight) validation. More... | |
| matchMagicWord (MagicWord $word) | |
| This default implementation always returns false. More... | |
| preloadTransform (Title $title, ParserOptions $popts, $params=[]) | |
| prepareSave (WikiPage $page, $flags, $parentRevId, User $user) | |
| preSaveTransform (Title $title, User $user, ParserOptions $popts) | |
| replaceSection ($sectionId, Content $with, $sectionTitle= '') | |
| serialize ($format=null) | |
| updateRedirect (Title $target) | |
| This default implementation always returns $this. More... | |
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. More... | |
| getHtml () | |
| getRedirectTargetAndText () | |
| Extract the redirect target and the remaining text on the page. More... | |
Protected Member Functions inherited from TextContent | |
| fillParserOutput (Title $title, $revId, ParserOptions $options, $generateHtml, ParserOutput &$output) | |
| Fills the provided ParserOutput object with information derived from the content. More... | |
| getHighlightHtml () | |
| Generates an HTML version of the content, for display. More... | |
| getHtml () | |
| Generates an HTML version of the content, for display. More... | |
Protected Member Functions inherited from AbstractContent | |
| checkFormat ($format) | |
| checkModelID ($modelId) | |
| fillParserOutput (Title $title, $revId, ParserOptions $options, $generateHtml, ParserOutput &$output) | |
| Fills the provided ParserOutput with information derived from the content. More... | |
Private Attributes | |
| $redirectTargetAndText = null | |
Additional Inherited Members | |
Protected Attributes inherited from AbstractContent | |
| $model_id | |
| Name of the content model this Content object represents. More... | |
Content object for wiki text pages.
Definition at line 33 of file WikitextContent.php.
| WikitextContent::__construct | ( | $text | ) |
Definition at line 36 of file WikitextContent.php.
References CONTENT_MODEL_WIKITEXT.
| WikitextContent::addSectionHeader | ( | $header | ) |
Returns a new WikitextContent object with the given section heading prepended.
| string | $header |
Implements Content.
Definition at line 117 of file WikitextContent.php.
References TextContent\getNativeData(), and wfMessage().
|
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. |
Definition at line 325 of file WikitextContent.php.
References $generateHtml, $revId, $wgParser, ParserOutput\addLink(), ParserOutput\addModuleStyles(), false, Title\getPageLanguage(), ParserOutput\getRawText(), AbstractContent\getRedirectChain(), Article\getRedirectHeaderHtml(), getRedirectTargetAndText(), global, list, and ParserOutput\setText().
|
protected |
| MWException |
Definition at line 351 of file WikitextContent.php.
| WikitextContent::getRedirectTarget | ( | ) |
Implement redirect extraction for wikitext.
Implements Content.
Definition at line 224 of file WikitextContent.php.
References $title, getRedirectTargetAndText(), and list.
|
protected |
Extract the redirect target and the remaining text on the page.
Definition at line 174 of file WikitextContent.php.
References $redirectTargetAndText, $title, false, MagicWord\get(), TextContent\getNativeData(), global, and Title\newFromText().
Referenced by fillParserOutput(), and getRedirectTarget().
| WikitextContent::getSection | ( | $sectionId | ) |
| string | number | $sectionId |
Implements Content.
Definition at line 47 of file WikitextContent.php.
References $wgParser, TextContent\getNativeData(), and global.
| WikitextContent::getTextForSummary | ( | $maxlength = 250 | ) |
| int | $maxlength |
Implements Content.
Definition at line 303 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 268 of file WikitextContent.php.
References $context, $title, $wgArticleCountMethod, 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 |
Implements Content.
Definition at line 367 of file WikitextContent.php.
References TextContent\getNativeData(), 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 |
Implements Content.
Definition at line 156 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 |
Implements Content.
Definition at line 136 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 |
Implements Content.
Definition at line 70 of file WikitextContent.php.
References $wgParser, TextContent\copy(), AbstractContent\getModel(), Content\getModel(), Content\getNativeData(), TextContent\getNativeData(), global, Hooks\run(), 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 |
Implements Content.
Definition at line 242 of file WikitextContent.php.
References Title\getFullText(), TextContent\getNativeData(), and AbstractContent\isRedirect().
|
private |
Definition at line 34 of file WikitextContent.php.
Referenced by getRedirectTargetAndText().