MediaWiki  REL1_23
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= '')
 This base implementation calls the hook ConvertContent to enable custom conversions.
 equals (Content $that=null)
 getContentHandler ()
 getDefaultFormat ()
 getDeletionUpdates (WikiPage $page, ParserOutput $parserOutput=null)
 getModel ()
 getRedirectChain ()
 getRedirectTarget ()
 Subclasses that implement redirects should override this.
 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 ()
 Subclasses may override this to implement (light weight) validation.
 matchMagicWord (MagicWord $word)
 This default implementation always returns false.
 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.

Protected Member Functions

 checkFormat ($format)
 checkModelID ($modelId)

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$modelId
Since:
1.21

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

Definition at line 49 of file AbstractContent.php.


Member Function Documentation

Since:
1.21
Returns:
Content $this
See also:
Content::addSectionHeader

Implements Content.

Reimplemented in WikitextContent.

Definition at line 366 of file AbstractContent.php.

AbstractContent::checkFormat ( format) [protected]
Since:
1.21
Parameters:
string$formatThe serialization format to check.
Exceptions:
MWExceptionIf the format is not supported by this content handler.

Definition at line 131 of file AbstractContent.php.

AbstractContent::checkModelID ( modelId) [protected]
Since:
1.21
Parameters:
string$modelIdThe model to check
Exceptions:
MWExceptionIf 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.

Parameters:
string$toModel
string$lossy
Returns:
Content|bool
See also:
Content::convert()

Implements Content.

Reimplemented in TextContent.

Definition at line 439 of file AbstractContent.php.

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

Implements Content.

Definition at line 186 of file AbstractContent.php.

Since:
1.21
See also:
Content::getDefaultFormat

Implements Content.

Definition at line 94 of file AbstractContent.php.

AbstractContent::getDeletionUpdates ( WikiPage page,
ParserOutput parserOutput = null 
)
Since:
1.21
Parameters:
WikiPage$page
ParserOutput$parserOutput
Returns:
LinksDeletionUpdate[]
See also:
Content::getDeletionUpdates

Implements Content.

Definition at line 406 of file AbstractContent.php.

Since:
1.21
See also:
Content::getModel

Implements Content.

Definition at line 58 of file AbstractContent.php.

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

Since:
1.21
Returns:
Title[]|null
See also:
Content::getRedirectChain

Implements Content.

Definition at line 241 of file AbstractContent.php.

Subclasses that implement redirects should override this.

Since:
1.21
Returns:
null
See also:
Content::getRedirectTarget

Implements Content.

Reimplemented in WikitextContent.

Definition at line 280 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.

Since:
1.21
Parameters:
Title$title
Content$old
bool$recursive
ParserOutput$parserOutput
Returns:
DataUpdate[]
See also:
Content::getSecondaryDataUpdates()

Implements Content.

Definition at line 225 of file AbstractContent.php.

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

Implements Content.

Reimplemented in WikitextContent.

Definition at line 333 of file AbstractContent.php.

Since:
1.21
See also:
Content::getSupportedFormats

Implements Content.

Definition at line 103 of file AbstractContent.php.

Note:
Migrated here from Title::newFromRedirectRecurse.
Since:
1.21
Returns:
Title|null
See also:
Content::getUltimateRedirectTarget

Implements Content.

Definition at line 293 of file AbstractContent.php.

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

Implements Content.

Definition at line 160 of file AbstractContent.php.

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

Implements Content.

Definition at line 116 of file AbstractContent.php.

Subclasses may override this to implement (light weight) validation.

Since:
1.21
Returns:
bool Always true.
See also:
Content::isValid

Implements Content.

Definition at line 173 of file AbstractContent.php.

This default implementation always returns false.

Subclasses may override this to supply matching logic.

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

Implements Content.

Reimplemented in WikitextContent.

Definition at line 424 of file AbstractContent.php.

AbstractContent::preloadTransform ( Title title,
ParserOptions popts,
params = array() 
)
Since:
1.21
Returns:
Content $this
See also:
Content::preloadTransform

Implements Content.

Reimplemented in WikitextContent.

Definition at line 377 of file AbstractContent.php.

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

Implements Content.

Definition at line 388 of file AbstractContent.php.

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

Implements Content.

Reimplemented in TextContent, WikitextContent, CssContent, and JavaScriptContent.

Definition at line 355 of file AbstractContent.php.

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

Implements Content.

Reimplemented in WikitextContent.

Definition at line 344 of file AbstractContent.php.

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

Implements Content.

Reimplemented in DummyContentForTesting.

Definition at line 149 of file AbstractContent.php.

This default implementation always returns $this.

Subclasses that implement redirects should override this.

Since:
1.21
Parameters:
Title$target
Returns:
Content $this
See also:
Content::updateRedirect

Implements Content.

Reimplemented in WikitextContent.

Definition at line 322 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 42 of file AbstractContent.php.

Referenced by TextContent\__construct().


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