BlueSpice MediaWiki master
 All Classes Namespaces Files Functions Variables Groups Pages
AbstractContent Class Reference
Inheritance diagram for AbstractContent:
Collaboration diagram for AbstractContent:

Public Member Functions

 __construct ($modelId=null)
 
 getModel ()
 
 getContentHandler ()
 
 getDefaultFormat ()
 
 getSupportedFormats ()
 
 isSupportedFormat ($format)
 
 serialize ($format=null)
 
 isEmpty ()
 
 isValid ()
 
 equals (Content $that=null)
 
 getSecondaryDataUpdates (Title $title, Content $old=null, $recursive=true, ParserOutput $parserOutput=null)
 
 getRedirectChain ()
 
 getRedirectTarget ()
 
 getUltimateRedirectTarget ()
 
 isRedirect ()
 
 updateRedirect (Title $target)
 
 getSection ($sectionId)
 
 replaceSection ($sectionId, Content $with, $sectionTitle= '')
 
 preSaveTransform (Title $title, User $user, ParserOptions $popts)
 
 addSectionHeader ($header)
 
 preloadTransform (Title $title, ParserOptions $popts, $params=[])
 
 prepareSave (WikiPage $page, $flags, $parentRevId, User $user)
 
 getDeletionUpdates (WikiPage $page, ParserOutput $parserOutput=null)
 
 matchMagicWord (MagicWord $word)
 
 convert ($toModel, $lossy= '')
 
 getParserOutput (Title $title, $revId=null, ParserOptions $options=null, $generateHtml=true)
 
- Public Member Functions inherited from Content
 getTextForSearchIndex ()
 
 getWikitextForTransclusion ()
 
 getTextForSummary ($maxLength=250)
 
 getNativeData ()
 
 getSize ()
 
 copy ()
 
 isCountable ($hasLinks=null)
 

Protected Member Functions

 checkModelID ($modelId)
 
 checkFormat ($format)
 
 fillParserOutput (Title $title, $revId, ParserOptions $options, $generateHtml, ParserOutput &$output)
 

Protected Attributes

 $model_id
 

Detailed Description

Base implementation for content objects.

Constructor & Destructor Documentation

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

Member Function Documentation

AbstractContent::addSectionHeader (   $header)
Since
1.21
Parameters
string$header
Returns
Content $this
See Also
Content::addSectionHeader

Implements Content.

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.
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.
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.

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

Implements Content.

AbstractContent::fillParserOutput ( Title  $title,
  $revId,
ParserOptions  $options,
  $generateHtml,
ParserOutput $output 
)
protected

Fills the provided ParserOutput with information derived from the content. Unless $generateHtml was false, this includes an HTML representation of the content.

This is called by getParserOutput() after consulting the ContentGetParserOutput hook. Subclasses are expected to override this method (or getParserOutput(), if need be). Subclasses of TextContent should generally override getHtml() instead.

This placeholder implementation always throws an exception.

Since
1.24
Parameters
Title$titleContext title for parsing
int | null$revIdRevision ID (for {{REVISIONID}})
ParserOptions$options
bool$generateHtmlWhether or not to generate HTML
ParserOutput&$outputThe output object to fill (reference).
Exceptions
MWException
AbstractContent::getContentHandler ( )
Since
1.21
See Also
Content::getContentHandler
Returns
ContentHandler

Implements Content.

AbstractContent::getDefaultFormat ( )
Since
1.21
See Also
Content::getDefaultFormat
Returns
string

Implements Content.

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

Implements Content.

AbstractContent::getModel ( )
Since
1.21
See Also
Content::getModel
Returns
string

Implements Content.

AbstractContent::getParserOutput ( Title  $title,
  $revId = null,
ParserOptions  $options = null,
  $generateHtml = true 
)

Returns a ParserOutput object containing information derived from this content. Most importantly, unless $generateHtml was false, the return value contains an HTML representation of the content.

Subclasses that want to control the parser output may override this, but it is preferred to override fillParserOutput() instead.

Subclasses that override getParserOutput() itself should take care to call the ContentGetParserOutput hook.

Since
1.24
Parameters
Title$titleContext title for parsing
int | null$revIdRevision ID (for {{REVISIONID}})
ParserOptions | null$options
bool$generateHtmlWhether or not to generate HTML
Returns
ParserOutput Containing information derived from this content.

Implements Content.

AbstractContent::getRedirectChain ( )
Since
1.21
Returns
Title[]|null
See Also
Content::getRedirectChain

Implements Content.

AbstractContent::getRedirectTarget ( )

Subclasses that implement redirects should override this.

Since
1.21
Returns
Title|null
See Also
Content::getRedirectTarget

Implements Content.

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 returns a LinksUpdate object and calls the SecondaryDataUpdates hook.

Subclasses may override this to determine the secondary data updates more efficiently, preferably without the need to generate a parser output object. They should however make sure to call SecondaryDataUpdates to give extensions a chance to inject additional updates.

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

Implements Content.

AbstractContent::getSection (   $sectionId)
Since
1.21
Parameters
string | int$sectionId
Returns
null
See Also
Content::getSection

Implements Content.

AbstractContent::getSupportedFormats ( )
Since
1.21
See Also
Content::getSupportedFormats
Returns
string[]

Implements Content.

AbstractContent::getUltimateRedirectTarget ( )
Note
Migrated here from Title::newFromRedirectRecurse.
Since
1.21
Returns
Title|null
See Also
Content::getUltimateRedirectTarget

Implements Content.

AbstractContent::isEmpty ( )
Since
1.21
Returns
bool
See Also
Content::isEmpty

Implements Content.

AbstractContent::isRedirect ( )
Since
1.21
Returns
bool
See Also
Content::isRedirect

Implements Content.

AbstractContent::isSupportedFormat (   $format)
Since
1.21
Parameters
string$format
Returns
bool
See Also
Content::isSupportedFormat

Implements Content.

AbstractContent::isValid ( )

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

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

Implements Content.

AbstractContent::matchMagicWord ( MagicWord  $word)

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.

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

Implements Content.

AbstractContent::prepareSave ( WikiPage  $page,
  $flags,
  $parentRevId,
User  $user 
)
Since
1.21
Parameters
WikiPage$page
int$flags
int$parentRevId
User$user
Returns
Status
See Also
Content::prepareSave

Implements Content.

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

Implements Content.

AbstractContent::replaceSection (   $sectionId,
Content  $with,
  $sectionTitle = '' 
)
Since
1.21
Parameters
string | int | null | bool$sectionId
Content$with
string$sectionTitle
Returns
null
See Also
Content::replaceSection

Implements Content.

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

Implements Content.

AbstractContent::updateRedirect ( Title  $target)

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.

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

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