MediaWiki
1.23.2
|
Content object implementation for representing flat text. More...
Public Member Functions | |
__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... | |
getParserOutput (Title $title, $revId=null, ParserOptions $options=null, $generateHtml=true) | |
Returns a generic ParserOutput object, wrapping the HTML returned by getHtml(). 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) | |
equals (Content $that=null) | |
getContentHandler () | |
getDefaultFormat () | |
getDeletionUpdates (WikiPage $page, ParserOutput $parserOutput=null) | |
getModel () | |
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=array()) | |
prepareSave (WikiPage $page, $flags, $baseRevId, User $user) | |
replaceSection ( $section, Content $with, $sectionTitle='') | |
serialize ( $format=null) | |
updateRedirect (Title $target) | |
This default implementation always returns $this. More... | |
Protected Member Functions | |
getHighlightHtml () | |
Generates a syntax-highlighted version of the content, as HTML. More... | |
getHtml () | |
Generates an HTML version of the content, for display. More... | |
Protected Member Functions inherited from AbstractContent | |
checkFormat ( $format) | |
checkModelID ( $modelId) | |
Additional Inherited Members | |
Protected Attributes inherited from AbstractContent | |
string | $model_id |
Name of the content model this Content object represents. More... | |
Content object implementation for representing flat text.
TextContent instances are immutable
Definition at line 35 of file TextContent.php.
TextContent::__construct | ( | $text, | |
$model_id = CONTENT_MODEL_TEXT |
|||
) |
string | $text | |
string | $model_id |
Definition at line 41 of file TextContent.php.
References AbstractContent\$model_id, and wfWarn().
TextContent::convert | ( | $toModel, | |
$lossy = '' |
|||
) |
This implementation provides lossless conversion between content models based on TextContent.
string | $toModel | |
string | $lossy |
Reimplemented from AbstractContent.
Definition at line 279 of file TextContent.php.
References ContentHandler\getForModelID(), and getNativeData().
Referenced by getWikitextForTransclusion().
TextContent::copy | ( | ) |
Implements Content.
Reimplemented in RevisionTestModifyableContent.
Definition at line 63 of file TextContent.php.
Referenced by WikitextContent\replaceSection().
Diff this content object with another content object.
Content | $that | The other content object to compare this content object to. |
Language | $lang | The language object to use for text segmentation. If not given, $wgContentLang is used. |
Definition at line 181 of file TextContent.php.
References $wgContLang, AbstractContent\checkModelID(), Content\getModel(), Content\getNativeData(), getNativeData(), and global.
|
protected |
Generates a syntax-highlighted version of the content, as HTML.
Used by the default implementation of getHtml().
Definition at line 263 of file TextContent.php.
References getNativeData().
Referenced by JavaScriptContent\getHtml(), CssContent\getHtml(), and 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.
Reimplemented in WikitextContent, CssContent, and JavaScriptContent.
Definition at line 253 of file TextContent.php.
References getHighlightHtml().
Referenced by getParserOutput().
TextContent::getNativeData | ( | ) |
Returns the text represented by this Content object, as a string.
Implements Content.
Definition at line 118 of file TextContent.php.
Referenced by WikitextContent\addSectionHeader(), convert(), diff(), getHighlightHtml(), getParserOutput(), WikitextContent\getParserOutput(), WikitextContent\getRedirectTarget(), WikitextContent\getSection(), getSize(), getTextForSearchIndex(), getTextForSummary(), WikitextContent\isCountable(), WikitextContent\matchMagicWord(), WikitextContent\preloadTransform(), JavaScriptContent\preSaveTransform(), CssContent\preSaveTransform(), WikitextContent\preSaveTransform(), preSaveTransform(), WikitextContent\replaceSection(), and WikitextContent\updateRedirect().
TextContent::getParserOutput | ( | Title | $title, |
$revId = null , |
|||
ParserOptions | $options = null , |
||
$generateHtml = true |
|||
) |
Returns a generic ParserOutput object, wrapping the HTML returned by getHtml().
Title | $title | Context title for parsing |
int | $revId | Revision ID (for {{REVISIONID}}) |
ParserOptions | $options | Parser options |
bool | $generateHtml | Whether or not to generate HTML |
Implements Content.
Reimplemented in WikitextContent.
Definition at line 215 of file TextContent.php.
References $html, $options, $wgParser, AbstractContent\getContentHandler(), getHtml(), AbstractContent\getModel(), getNativeData(), and global.
TextContent::getSize | ( | ) |
returns the text's size in bytes.
Implements Content.
Definition at line 84 of file TextContent.php.
References getNativeData().
TextContent::getTextForSearchIndex | ( | ) |
Returns the text represented by this Content object, as a string.
Implements Content.
Definition at line 129 of file TextContent.php.
References getNativeData().
TextContent::getTextForSummary | ( | $maxLength = 250 | ) |
Returns a textual representation of the content suitable for use in edit summaries and log messages.
int | $maxLength | Maximum length of the summary text. |
Implements Content.
Reimplemented in WikitextContent.
Definition at line 67 of file TextContent.php.
References $wgContLang, getNativeData(), and global.
TextContent::getWikitextForTransclusion | ( | ) |
Returns attempts to convert this content object to wikitext, and then returns the text string.
The conversion may be lossy.
Implements Content.
Definition at line 141 of file TextContent.php.
References CONTENT_MODEL_WIKITEXT, and convert().
TextContent::isCountable | ( | $hasLinks = null | ) |
Returns true if this content is not a redirect, and $wgArticleCountMethod is "any".
bool | $hasLinks | If it is known whether this content contains links, provide this information here, to avoid redundant parsing to find out. |
Implements Content.
Definition at line 99 of file TextContent.php.
References global, and AbstractContent\isRedirect().
TextContent::preSaveTransform | ( | Title | $title, |
User | $user, | ||
ParserOptions | $popts | ||
) |
Returns a Content object with pre-save transformations applied.
This implementation just trims trailing whitespace.
Title | $title | |
User | $user | |
ParserOptions | $popts |
Reimplemented from AbstractContent.
Reimplemented in WikitextContent, CssContent, and JavaScriptContent.
Definition at line 161 of file TextContent.php.
References getNativeData().