[ Index ]

PHP Cross Reference of MediaWiki-1.24.0

title

Body

[close]

/includes/content/ -> TextContent.php (summary)

Content object implementation for representing flat text. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

Author: Daniel Kinzler
File Size: 305 lines (9 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

TextContent:: (14 methods):
  __construct()
  copy()
  getTextForSummary()
  getSize()
  isCountable()
  getNativeData()
  getTextForSearchIndex()
  getWikitextForTransclusion()
  preSaveTransform()
  diff()
  fillParserOutput()
  getHtml()
  getHighlightHtml()
  convert()


Class: TextContent  - X-Ref

Content object implementation for representing flat text.

TextContent instances are immutable

__construct( $text, $model_id = CONTENT_MODEL_TEXT )   X-Ref

param: string $text
param: string $model_id

copy()   X-Ref

return: Content $this

getTextForSummary( $maxlength = 250 )   X-Ref
No description

getSize()   X-Ref
Returns the text's size in bytes.

return: int

isCountable( $hasLinks = null )   X-Ref
Returns true if this content is not a redirect, and $wgArticleCountMethod
is "any".

param: bool $hasLinks If it is known whether this content contains links,
return: bool

getNativeData()   X-Ref
Returns the text represented by this Content object, as a string.

return: string The raw text.

getTextForSearchIndex()   X-Ref
Returns the text represented by this Content object, as a string.

return: string The raw text.

getWikitextForTransclusion()   X-Ref
Returns attempts to convert this content object to wikitext,
and then returns the text string. The conversion may be lossy.

return: string|bool The raw text, or false if the conversion failed.

preSaveTransform( Title $title, User $user, ParserOptions $popts )   X-Ref
Returns a Content object with pre-save transformations applied.
This implementation just trims trailing whitespace.

param: Title $title
param: User $user
param: ParserOptions $popts
return: Content

diff( Content $that, Language $lang = null )   X-Ref
Diff this content object with another content object.

param: Content $that The other content object to compare this content object to.
param: Language $lang The language object to use for text segmentation.
return: Diff A diff representing the changes that would have to be

fillParserOutput( Title $title, $revId,ParserOptions $options, $generateHtml, ParserOutput &$output)   X-Ref
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().

param: Title $title Context title for parsing
param: int $revId Revision ID (for {{REVISIONID}})
param: ParserOptions $options Parser options
param: bool $generateHtml Whether or not to generate HTML
param: ParserOutput $output The output object to fill (reference).

getHtml()   X-Ref
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().

return: string An HTML representation of the content

getHighlightHtml()   X-Ref
Generates an HTML version of the content, for display.

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

return: string An HTML representation of the content

convert( $toModel, $lossy = '' )   X-Ref
This implementation provides lossless conversion between content models based
on TextContent.

param: string $toModel The desired content model, use the CONTENT_MODEL_XXX flags.
param: string $lossy Flag, set to "lossy" to allow lossy conversion. If lossy conversion is not
return: Content|bool A content object with the content model $toModel, or false if that



Generated: Fri Nov 28 14:03:12 2014 Cross-referenced by PHPXref 0.7.1