MediaWiki 1.42.1
|
Content object for wiki text pages. More...
Inherits TextContent.
Public Member Functions | |
__construct ( $text) | |
addSectionHeader ( $header) | |
Returns a new WikitextContent object with the given section heading prepended. | |
getContentHandler () | |
getPreSaveTransformFlags () | |
Records flags set by preSaveTransform. | |
getRedirectTarget () | |
Implement redirect extraction for wikitext. | |
getRedirectTargetAndText () | |
Extract the redirect target and the remaining text on the page. | |
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. | |
replaceSection ( $sectionId, Content $with, $sectionTitle='') | |
setPreSaveTransformFlags (array $flags) | |
Records flags set by preSaveTransform. | |
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) | |
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. | |
getDefaultFormat () | |
getModel () | |
getSupportedFormats () | |
isEmpty () | |
isRedirect () | |
isSupportedFormat ( $format) | |
isValid () | |
Subclasses may override this to implement (light weight) validation. | |
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. | |
Content object for wiki text pages.
Definition at line 41 of file WikitextContent.php.
WikitextContent::__construct | ( | $text | ) |
string | $text |
Reimplemented from AbstractContent.
Definition at line 53 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 133 of file WikitextContent.php.
References $header, TextContent\getText(), and wfMessage().
WikitextContent::getContentHandler | ( | ) |
Reimplemented from AbstractContent.
Definition at line 287 of file WikitextContent.php.
References getContentHandler().
Referenced by getContentHandler(), getRedirectTarget(), and getRedirectTargetAndText().
WikitextContent::getPreSaveTransformFlags | ( | ) |
Records flags set by preSaveTransform.
Definition at line 283 of file WikitextContent.php.
WikitextContent::getRedirectTarget | ( | ) |
Implement redirect extraction for wikitext.
Reimplemented from AbstractContent.
Definition at line 165 of file WikitextContent.php.
References getContentHandler().
WikitextContent::getRedirectTargetAndText | ( | ) |
Extract the redirect target and the remaining text on the page.
Definition at line 149 of file WikitextContent.php.
References getContentHandler(), and wfDeprecated().
WikitextContent::getSection | ( | $sectionId | ) |
string | int | $sectionId |
Reimplemented from AbstractContent.
Definition at line 64 of file WikitextContent.php.
References TextContent\getText().
WikitextContent::getTextForSummary | ( | $maxlength = 250 | ) |
int | $maxlength |
Reimplemented from TextContent.
Definition at line 245 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 213 of file WikitextContent.php.
References 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 265 of file WikitextContent.php.
References TextContent\getText(), and MediaWiki\Parser\MagicWord\match().
WikitextContent::replaceSection | ( | $sectionId, | |
Content | $with, | ||
$sectionTitle = '' ) |
string | int | null | false | $sectionId | |
Content | $with | New section content, must have the same content model as $this. |
string | $sectionTitle |
Reimplemented from AbstractContent.
Definition at line 84 of file WikitextContent.php.
References TextContent\copy(), AbstractContent\getModel(), Content\getModel(), TextContent\getText(), and wfMessage().
WikitextContent::setPreSaveTransformFlags | ( | array | $flags | ) |
Records flags set by preSaveTransform.
string[] | $flags |
Definition at line 274 of file WikitextContent.php.
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 187 of file WikitextContent.php.
References MediaWiki\Title\Title\getFullText(), and AbstractContent\isRedirect().