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

Public Member Functions

 __construct ($text, $model_id=CONTENT_MODEL_TEXT)
 
 copy ()
 
 getTextForSummary ($maxlength=250)
 
 getSize ()
 
 isCountable ($hasLinks=null)
 
 getNativeData ()
 
 getTextForSearchIndex ()
 
 getWikitextForTransclusion ()
 
 preSaveTransform (Title $title, User $user, ParserOptions $popts)
 
 diff (Content $that, Language $lang=null)
 
 convert ($toModel, $lossy= '')
 
- Public Member Functions inherited from AbstractContent
 __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)
 

Protected Member Functions

 fillParserOutput (Title $title, $revId, ParserOptions $options, $generateHtml, ParserOutput &$output)
 
 getHtml ()
 
 getHighlightHtml ()
 
- Protected Member Functions inherited from AbstractContent
 checkModelID ($modelId)
 
 checkFormat ($format)
 
 fillParserOutput (Title $title, $revId, ParserOptions $options, $generateHtml, ParserOutput &$output)
 

Additional Inherited Members

- Protected Attributes inherited from AbstractContent
 $model_id
 

Detailed Description

Content object implementation for representing flat text.

TextContent instances are immutable

Constructor & Destructor Documentation

TextContent::__construct (   $text,
  $model_id = CONTENT_MODEL_TEXT 
)
Parameters
string$text
string$model_id
Exceptions
MWException

Member Function Documentation

TextContent::convert (   $toModel,
  $lossy = '' 
)

This implementation provides lossless conversion between content models based on TextContent.

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.
See Also
Content::convert()

Implements Content.

TextContent::copy ( )
Note
Mutable subclasses MUST override this to return a copy!
Returns
Content $this

Implements Content.

TextContent::diff ( Content  $that,
Language  $lang = null 
)

Diff this content object with another content object.

Since
1.21
Parameters
Content$thatThe other content object to compare this content object to.
Language$langThe language object to use for text segmentation. If not given, $wgContentLang is used.
Returns
Diff A diff representing the changes that would have to be made to this content object to make it equal to $that.
TextContent::fillParserOutput ( Title  $title,
  $revId,
ParserOptions  $options,
  $generateHtml,
ParserOutput $output 
)
protected

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

For content models listed in $wgTextModelsToParse, this method will call the MediaWiki wikitext parser on the text to extract any (wikitext) links, magic words, etc.

Subclasses may override this to provide custom content processing. For custom HTML generation alone, it is sufficient to override getHtml().

Parameters
Title$titleContext title for parsing
int$revIdRevision ID (for {{REVISIONID}})
ParserOptions$optionsParser options
bool$generateHtmlWhether or not to generate HTML
ParserOutput$outputThe output object to fill (reference).
TextContent::getHighlightHtml ( )
protected

Generates an HTML version of the content, for display.

This default implementation returns an HTML-escaped version of the raw text content.

Note
The functionality of this method should really be implemented in getHtml(), and subclasses should override getHtml() if needed. getHighlightHtml() is kept around for backward compatibility with extensions that already override it.
Deprecated:
since 1.24. Use getHtml() instead. In particular, subclasses overriding getHighlightHtml() should override getHtml() instead.
Returns
string An HTML representation of the content
TextContent::getHtml ( )
protected

Generates an HTML version of the content, for display. Used by fillParserOutput() to provide HTML for the ParserOutput object.

Subclasses may override this to provide a custom HTML rendering. If further information is to be derived from the content (such as categories), the fillParserOutput() method can be overridden instead.

For backwards-compatibility, this default implementation just calls getHighlightHtml().

Returns
string An HTML representation of the content
TextContent::getNativeData ( )

Returns the text represented by this Content object, as a string.

Returns
string The raw text.

Implements Content.

TextContent::getSize ( )

Returns the text's size in bytes.

Returns
int

Implements Content.

TextContent::getTextForSearchIndex ( )

Returns the text represented by this Content object, as a string.

Returns
string The raw text.

Implements Content.

TextContent::getTextForSummary (   $maxLength = 250)

Returns a textual representation of the content suitable for use in edit summaries and log messages.

Since
1.21
Parameters
int$maxLengthMaximum length of the summary text.
Returns
string The summary text.

Implements Content.

TextContent::getWikitextForTransclusion ( )

Returns attempts to convert this content object to wikitext, and then returns the text string. The conversion may be lossy.

Note
this allows any text-based content to be transcluded as if it was wikitext.
Returns
string|bool The raw text, or false if the conversion failed.

Implements Content.

TextContent::isCountable (   $hasLinks = null)

Returns true if this content is not a redirect, and $wgArticleCountMethod is "any".

Parameters
bool | null$hasLinksIf it is known whether this content contains links, provide this information here, to avoid redundant parsing to find out.
Returns
bool

Implements Content.

TextContent::preSaveTransform ( Title  $title,
User  $user,
ParserOptions  $popts 
)

Returns a Content object with pre-save transformations applied. This implementation just trims trailing whitespace.

Parameters
Title$title
User$user
ParserOptions$popts
Returns
Content

Implements Content.


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