MediaWiki  REL1_22
AbstractContent Class Reference

Base implementation for content objects. More...

Inheritance diagram for AbstractContent:
Collaboration diagram for AbstractContent:

List of all members.

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.

Detailed Description

Base implementation for content objects.

Definition at line 34 of file AbstractContent.php.


Constructor & Destructor Documentation

AbstractContent::__construct ( modelId = null)
Parameters:
string | null$modelId
Since:
1.21

Reimplemented in RevisionTestModifyableContent, DummyContentForTesting, WikitextContent, CssContent, and JavaScriptContent.

Definition at line 50 of file AbstractContent.php.


Member Function Documentation

See also:
Content::addSectionHeader
Since:
1.21

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.

Since:
1.21
Parameters:
string$format
Exceptions:
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.

Since:
1.21
Parameters:
string$modelIdThe model to check
Exceptions:
MWException

Definition at line 73 of file AbstractContent.php.

Referenced by TextContent\diff().

AbstractContent::convert ( toModel,
lossy = '' 
)
See also:
Content::convert()

This base implementation calls the hook ConvertContent to enable custom conversions. Subclasses may override this to implement conversion for "their" content model.

Parameters:
string$toModelthe desired content model, use the CONTENT_MODEL_XXX flags.
string$lossyflag, set to "lossy" to allow lossy conversion. If lossy conversion is not allowed, full round-trip conversion is expected to work without losing information.
Returns:
Content|bool A content object with the content model $toModel, or false if that conversion is not supported.

Implements Content.

Reimplemented in TextContent.

Definition at line 431 of file AbstractContent.php.

AbstractContent::equals ( Content that = null)
See also:
Content::equals
Since:
1.21
Parameters:
Content | null$that
Returns:
boolean

Implements Content.

Definition at line 189 of file AbstractContent.php.

See also:
Content::getDefaultFormat
Since:
1.21

Implements Content.

Definition at line 97 of file AbstractContent.php.

AbstractContent::getDeletionUpdates ( WikiPage page,
ParserOutput parserOutput = null 
)
See also:
Content::getDeletionUpdates
Since:
1.21
Parameters:
$pageWikiPage the deleted page
$parserOutputnull|ParserOutput optional parser output object for efficient access to meta-information about the content object. Provide if you have one handy.
Returns:
array A list of DataUpdate instances that will clean up the database after deletion.

Implements Content.

Definition at line 395 of file AbstractContent.php.

See also:
Content::getModel
Since:
1.21

Implements Content.

Definition at line 59 of file AbstractContent.php.

Referenced by TextContent\getParserOutput(), and WikitextContent\replaceSection().

See also:
Content::getRedirectChain
Since:
1.21

Implements Content.

Definition at line 249 of file AbstractContent.php.

See also:
Content::getRedirectTarget
Since:
1.21

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.

See also:
Content::getSecondaryDataUpdates()
Parameters:
$titleTitle The context for determining the necessary updates
$oldContent|null An optional Content object representing the previous content, i.e. the content being replaced by this Content object.
$recursiveboolean Whether to include recursive updates (default: false).
$parserOutputParserOutput|null Optional ParserOutput object. Provide if you have one handy, to avoid re-parsing of the content.
Returns:
Array. A list of DataUpdate objects for putting information about this content object somewhere.
Since:
1.21

Implements Content.

Definition at line 233 of file AbstractContent.php.

AbstractContent::getSection ( sectionId)
See also:
Content::getSection
Since:
1.21

Implements Content.

Reimplemented in WikitextContent.

Definition at line 329 of file AbstractContent.php.

See also:
Content::getSupportedFormats
Since:
1.21

Implements Content.

Definition at line 106 of file AbstractContent.php.

See also:
Content::getUltimateRedirectTarget
Note:
: migrated here from Title::newFromRedirectRecurse
Since:
1.21

Implements Content.

Definition at line 293 of file AbstractContent.php.

See also:
Content::isEmpty
Since:
1.21
Returns:
boolean

Implements Content.

Definition at line 165 of file AbstractContent.php.

See also:
Content::isSupportedFormat
Parameters:
string$format
Since:
1.21
Returns:
boolean

Implements Content.

Definition at line 119 of file AbstractContent.php.

See also:
Content::isValid
Since:
1.21
Returns:
boolean

Implements Content.

Definition at line 176 of file AbstractContent.php.

This default implementation always returns false.

Subclasses may override this to supply matching logic.

See also:
Content::matchMagicWord
Since:
1.21
Parameters:
MagicWord$word
Returns:
bool

Implements Content.

Reimplemented in WikitextContent.

Definition at line 414 of file AbstractContent.php.

See also:
Content::preloadTransform
Since:
1.21

Implements Content.

Reimplemented in WikitextContent.

Definition at line 365 of file AbstractContent.php.

AbstractContent::prepareSave ( WikiPage page,
flags,
baseRevId,
User user 
)
See also:
Content::prepareSave
Since:
1.21

Implements Content.

Definition at line 374 of file AbstractContent.php.

AbstractContent::preSaveTransform ( Title title,
User user,
ParserOptions popts 
)
See also:
Content::preSaveTransform
Since:
1.21

Implements Content.

Reimplemented in TextContent, WikitextContent, CssContent, and JavaScriptContent.

Definition at line 347 of file AbstractContent.php.

AbstractContent::replaceSection ( section,
Content with,
sectionTitle = '' 
)
See also:
Content::replaceSection
Since:
1.21

Implements Content.

Reimplemented in WikitextContent.

Definition at line 338 of file AbstractContent.php.

AbstractContent::serialize ( format = null)
See also:
Content::serialize
Parameters:
string | null$format
Since:
1.21
Returns:
string

Implements Content.

Reimplemented in DummyContentForTesting.

Definition at line 154 of file AbstractContent.php.

See also:
Content::updateRedirect

This default implementation always returns $this.

Parameters:
Title$target
Since:
1.21
Returns:
Content $this

Implements Content.

Reimplemented in WikitextContent.

Definition at line 320 of file AbstractContent.php.


Member Data Documentation

string AbstractContent::$model_id [protected]

Name of the content model this Content object represents.

Use with CONTENT_MODEL_XXX constants

Since:
1.21

$model_id

Definition at line 43 of file AbstractContent.php.

Referenced by TextContent\__construct().


The documentation for this class was generated from the following file: