MediaWiki
1.23.2
|
Base implementation for content objects. More...
Public Member Functions | |
__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 () | |
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) | |
preSaveTransform (Title $title, User $user, ParserOptions $popts) | |
replaceSection ( $section, Content $with, $sectionTitle='') | |
serialize ( $format=null) | |
updateRedirect (Title $target) | |
This default implementation always returns $this. More... | |
Public Member Functions inherited from Content | |
copy () | |
Return a copy of this Content object. More... | |
getNativeData () | |
Returns native representation of the data. More... | |
getParserOutput (Title $title, $revId=null, ParserOptions $options=null, $generateHtml=true) | |
Parse the Content object and generate a ParserOutput from the result. More... | |
getSize () | |
Returns the content's nominal size in bogo-bytes. More... | |
getTextForSearchIndex () | |
getTextForSummary ( $maxLength=250) | |
Returns a textual representation of the content suitable for use in edit summaries and log messages. More... | |
getWikitextForTransclusion () | |
isCountable ( $hasLinks=null) | |
Returns true if this content is countable as a "real" wiki page, provided that it's also in a countable location (e.g. More... | |
Protected Member Functions | |
checkFormat ( $format) | |
checkModelID ( $modelId) | |
Protected Attributes | |
string | $model_id |
Name of the content model this Content object represents. More... | |
Base implementation for content objects.
Definition at line 34 of file AbstractContent.php.
AbstractContent::__construct | ( | $modelId = null | ) |
string | $modelId |
Reimplemented in RevisionTestModifyableContent, CssContent, JavaScriptContent, WikitextContent, and DummyContentForTesting.
Definition at line 49 of file AbstractContent.php.
AbstractContent::addSectionHeader | ( | $header | ) |
Implements Content.
Reimplemented in WikitextContent.
Definition at line 366 of file AbstractContent.php.
|
protected |
string | $format | The serialization format to check. |
MWException | If the format is not supported by this content handler. |
Definition at line 131 of file AbstractContent.php.
References getModel(), and isSupportedFormat().
|
protected |
string | $modelId | The model to check |
MWException | If the provided ID is not the ID of the content model supported by this Content object. |
Definition at line 70 of file AbstractContent.php.
Referenced by TextContent\diff().
AbstractContent::convert | ( | $toModel, | |
$lossy = '' |
|||
) |
This base implementation calls the hook ConvertContent to enable custom conversions.
Subclasses may override this to implement conversion for "their" content model.
string | $toModel | |
string | $lossy |
Implements Content.
Reimplemented in TextContent.
Definition at line 439 of file AbstractContent.php.
References array(), getModel(), and wfRunHooks().
AbstractContent::equals | ( | Content | $that = null | ) |
Content | $that |
Implements Content.
Definition at line 186 of file AbstractContent.php.
References getModel(), and Content\getNativeData().
AbstractContent::getContentHandler | ( | ) |
Implements Content.
Definition at line 85 of file AbstractContent.php.
References ContentHandler\getForContent().
Referenced by getDefaultFormat(), TextContent\getParserOutput(), WikitextContent\getParserOutput(), getSupportedFormats(), isSupportedFormat(), and serialize().
AbstractContent::getDefaultFormat | ( | ) |
Implements Content.
Definition at line 94 of file AbstractContent.php.
References getContentHandler().
AbstractContent::getDeletionUpdates | ( | WikiPage | $page, |
ParserOutput | $parserOutput = null |
||
) |
WikiPage | $page | |
ParserOutput | $parserOutput |
Implements Content.
Definition at line 406 of file AbstractContent.php.
References array().
AbstractContent::getModel | ( | ) |
Implements Content.
Definition at line 58 of file AbstractContent.php.
References $model_id.
Referenced by checkFormat(), convert(), equals(), TextContent\getParserOutput(), and WikitextContent\replaceSection().
AbstractContent::getRedirectChain | ( | ) |
Implements Content.
Definition at line 241 of file AbstractContent.php.
References $title, $titles, array(), WikiPage\factory(), getRedirectTarget(), global, and Title\isValidRedirectTarget().
Referenced by getUltimateRedirectTarget().
AbstractContent::getRedirectTarget | ( | ) |
Subclasses that implement redirects should override this.
Implements Content.
Reimplemented in WikitextContent.
Definition at line 280 of file AbstractContent.php.
Referenced by getRedirectChain(), and isRedirect().
AbstractContent::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.
This default implementation calls $this->getParserOutput( $content, $title, null, null, false ), and then calls getSecondaryDataUpdates( $title, $recursive ) on the resulting ParserOutput object.
Subclasses may override this to determine the secondary data updates more efficiently, preferably without the need to generate a parser output object.
Title | $title | |
Content | $old | |
bool | $recursive | |
ParserOutput | $parserOutput |
Implements Content.
Definition at line 225 of file AbstractContent.php.
References $title, and Content\getParserOutput().
AbstractContent::getSection | ( | $sectionId | ) |
Implements Content.
Reimplemented in WikitextContent.
Definition at line 333 of file AbstractContent.php.
AbstractContent::getSupportedFormats | ( | ) |
Implements Content.
Definition at line 103 of file AbstractContent.php.
References getContentHandler().
AbstractContent::getUltimateRedirectTarget | ( | ) |
Implements Content.
Definition at line 293 of file AbstractContent.php.
References $titles, and getRedirectChain().
AbstractContent::isEmpty | ( | ) |
Implements Content.
Definition at line 160 of file AbstractContent.php.
References Content\getSize().
AbstractContent::isRedirect | ( | ) |
Implements Content.
Definition at line 306 of file AbstractContent.php.
References getRedirectTarget().
Referenced by TextContent\isCountable(), WikitextContent\isCountable(), and WikitextContent\updateRedirect().
AbstractContent::isSupportedFormat | ( | $format | ) |
string | $format |
Implements Content.
Definition at line 116 of file AbstractContent.php.
References getContentHandler().
Referenced by checkFormat().
AbstractContent::isValid | ( | ) |
Subclasses may override this to implement (light weight) validation.
Implements Content.
Definition at line 173 of file AbstractContent.php.
Referenced by prepareSave().
AbstractContent::matchMagicWord | ( | MagicWord | $word | ) |
This default implementation always returns false.
Subclasses may override this to supply matching logic.
MagicWord | $word |
Implements Content.
Reimplemented in WikitextContent.
Definition at line 424 of file AbstractContent.php.
AbstractContent::preloadTransform | ( | Title | $title, |
ParserOptions | $popts, | ||
$params = array() |
|||
) |
Implements Content.
Reimplemented in WikitextContent.
Definition at line 377 of file AbstractContent.php.
Implements Content.
Definition at line 388 of file AbstractContent.php.
References isValid(), Status\newFatal(), and Status\newGood().
AbstractContent::preSaveTransform | ( | Title | $title, |
User | $user, | ||
ParserOptions | $popts | ||
) |
Implements Content.
Reimplemented in TextContent, WikitextContent, CssContent, and JavaScriptContent.
Definition at line 355 of file AbstractContent.php.
AbstractContent::replaceSection | ( | $section, | |
Content | $with, | ||
$sectionTitle = '' |
|||
) |
Implements Content.
Reimplemented in WikitextContent.
Definition at line 344 of file AbstractContent.php.
AbstractContent::serialize | ( | $format = null | ) |
string | $format |
Implements Content.
Reimplemented in DummyContentForTesting.
Definition at line 149 of file AbstractContent.php.
References getContentHandler().
AbstractContent::updateRedirect | ( | Title | $target | ) |
This default implementation always returns $this.
Subclasses that implement redirects should override this.
Title | $target |
Implements Content.
Reimplemented in WikitextContent.
Definition at line 322 of file AbstractContent.php.
|
protected |
Name of the content model this Content object represents.
Use with CONTENT_MODEL_XXX constants
$model_id
Definition at line 42 of file AbstractContent.php.
Referenced by TextContent\__construct(), and getModel().