MediaWiki
REL1_22
|
Base implementation for content objects. More...
Public Member Functions | |
__construct ($modelId=null) | |
addSectionHeader ($header) | |
convert ($toModel, $lossy= '') | |
equals (Content $that=null) | |
getContentHandler () | |
getDefaultFormat () | |
getDeletionUpdates (WikiPage $page, ParserOutput $parserOutput=null) | |
getModel () | |
getRedirectChain () | |
getRedirectTarget () | |
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. | |
getSection ($sectionId) | |
getSupportedFormats () | |
getUltimateRedirectTarget () | |
isEmpty () | |
isRedirect () | |
isSupportedFormat ($format) | |
isValid () | |
matchMagicWord (MagicWord $word) | |
This default implementation always returns false. | |
preloadTransform (Title $title, ParserOptions $popts) | |
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) | |
Protected Member Functions | |
checkFormat ($format) | |
Throws an MWException if $this->isSupportedFormat( $format ) does not return true. | |
checkModelID ($modelId) | |
Throws an MWException if $model_id is not the id of the content model supported by this Content object. | |
Protected Attributes | |
string | $model_id |
Name of the content model this Content object represents. |
Base implementation for content objects.
Definition at line 34 of file AbstractContent.php.
AbstractContent::__construct | ( | $ | modelId = null | ) |
string | null | $modelId |
Reimplemented in RevisionTestModifyableContent, DummyContentForTesting, WikitextContent, CssContent, and JavaScriptContent.
Definition at line 50 of file AbstractContent.php.
AbstractContent::addSectionHeader | ( | $ | header | ) |
Implements Content.
Reimplemented in WikitextContent.
Definition at line 356 of file AbstractContent.php.
AbstractContent::checkFormat | ( | $ | format | ) | [protected] |
Throws an MWException if $this->isSupportedFormat( $format ) does not return true.
string | $format |
MWException |
Definition at line 136 of file AbstractContent.php.
AbstractContent::checkModelID | ( | $ | modelId | ) | [protected] |
Throws an MWException if $model_id is not the id of the content model supported by this Content object.
string | $modelId | The model to check |
MWException |
Definition at line 73 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 | the desired content model, use the CONTENT_MODEL_XXX flags. |
string | $lossy | flag, set to "lossy" to allow lossy conversion. If lossy conversion is not allowed, full round-trip conversion is expected to work without losing information. |
Implements Content.
Reimplemented in TextContent.
Definition at line 431 of file AbstractContent.php.
AbstractContent::equals | ( | Content $ | that = null | ) |
Content | null | $that |
Implements Content.
Definition at line 189 of file AbstractContent.php.
Implements Content.
Definition at line 88 of file AbstractContent.php.
Referenced by TextContent\getParserOutput(), and WikitextContent\getParserOutput().
Implements Content.
Definition at line 97 of file AbstractContent.php.
AbstractContent::getDeletionUpdates | ( | WikiPage $ | page, |
ParserOutput $ | parserOutput = null |
||
) |
$page | WikiPage the deleted page |
$parserOutput | null|ParserOutput optional parser output object for efficient access to meta-information about the content object. Provide if you have one handy. |
Implements Content.
Definition at line 395 of file AbstractContent.php.
Implements Content.
Definition at line 59 of file AbstractContent.php.
Referenced by TextContent\getParserOutput(), and WikitextContent\replaceSection().
Implements Content.
Definition at line 249 of file AbstractContent.php.
Implements Content.
Reimplemented in WikitextContent.
Definition at line 283 of file AbstractContent.php.
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 The context for determining the necessary updates |
$old | Content|null An optional Content object representing the previous content, i.e. the content being replaced by this Content object. |
$recursive | boolean Whether to include recursive updates (default: false). |
$parserOutput | ParserOutput|null Optional ParserOutput object. Provide if you have one handy, to avoid re-parsing of the content. |
Implements Content.
Definition at line 233 of file AbstractContent.php.
AbstractContent::getSection | ( | $ | sectionId | ) |
Implements Content.
Reimplemented in WikitextContent.
Definition at line 329 of file AbstractContent.php.
Implements Content.
Definition at line 106 of file AbstractContent.php.
Implements Content.
Definition at line 293 of file AbstractContent.php.
Implements Content.
Definition at line 165 of file AbstractContent.php.
Implements Content.
Definition at line 305 of file AbstractContent.php.
Referenced by TextContent\isCountable(), WikitextContent\isCountable(), and WikitextContent\updateRedirect().
AbstractContent::isSupportedFormat | ( | $ | format | ) |
string | $format |
Implements Content.
Definition at line 119 of file AbstractContent.php.
Implements Content.
Definition at line 176 of file AbstractContent.php.
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 414 of file AbstractContent.php.
AbstractContent::preloadTransform | ( | Title $ | title, |
ParserOptions $ | popts | ||
) |
Implements Content.
Reimplemented in WikitextContent.
Definition at line 365 of file AbstractContent.php.
AbstractContent::prepareSave | ( | WikiPage $ | page, |
$ | flags, | ||
$ | baseRevId, | ||
User $ | user | ||
) |
Implements Content.
Definition at line 374 of file AbstractContent.php.
AbstractContent::preSaveTransform | ( | Title $ | title, |
User $ | user, | ||
ParserOptions $ | popts | ||
) |
Implements Content.
Reimplemented in TextContent, WikitextContent, CssContent, and JavaScriptContent.
Definition at line 347 of file AbstractContent.php.
AbstractContent::replaceSection | ( | $ | section, |
Content $ | with, | ||
$ | sectionTitle = '' |
||
) |
Implements Content.
Reimplemented in WikitextContent.
Definition at line 338 of file AbstractContent.php.
AbstractContent::serialize | ( | $ | format = null | ) |
string | null | $format |
Implements Content.
Reimplemented in DummyContentForTesting.
Definition at line 154 of file AbstractContent.php.
AbstractContent::updateRedirect | ( | Title $ | target | ) |
This default implementation always returns $this.
Title | $target |
Implements Content.
Reimplemented in WikitextContent.
Definition at line 320 of file AbstractContent.php.
string AbstractContent::$model_id [protected] |
Name of the content model this Content object represents.
Use with CONTENT_MODEL_XXX constants
$model_id
Definition at line 43 of file AbstractContent.php.
Referenced by TextContent\__construct().