MediaWiki  REL1_22
TextContentHandler Class Reference

Base content handler implementation for flat text contents. More...

Inheritance diagram for TextContentHandler:
Collaboration diagram for TextContentHandler:

List of all members.

Public Member Functions

 __construct ($modelId=CONTENT_MODEL_TEXT, $formats=array(CONTENT_FORMAT_TEXT))
 Constructor, initializing the ContentHandler instance with its model ID and a list of supported formats.
 makeEmptyContent ()
 Creates an empty TextContent object.
 merge3 (Content $oldContent, Content $myContent, Content $yourContent)
 Attempts to merge differences between three versions.
 serializeContent (Content $content, $format=null)
 Returns the content's text as-is.
 unserializeContent ($text, $format=null)
 Unserializes a Content object of the type supported by this ContentHandler.

Detailed Description

Base content handler implementation for flat text contents.

Definition at line 31 of file TextContentHandler.php.


Constructor & Destructor Documentation

Constructor, initializing the ContentHandler instance with its model ID and a list of supported formats.

Values for the parameters are typically provided as literals by subclass's constructors.

Parameters:
string$modelId(use CONTENT_MODEL_XXX constants).
array$formatsList for supported serialization formats (typically as MIME types)

Reimplemented from ContentHandler.

Definition at line 33 of file TextContentHandler.php.


Member Function Documentation

Creates an empty TextContent object.

Since:
1.21
Returns:
Content

Reimplemented from ContentHandler.

Reimplemented in RevisionTestModifyableContentHandler, WikitextContentHandler, CssContentHandler, and JavaScriptContentHandler.

Definition at line 112 of file TextContentHandler.php.

Referenced by merge3().

TextContentHandler::merge3 ( Content oldContent,
Content myContent,
Content yourContent 
)

Attempts to merge differences between three versions.

Returns a new Content object for a clean merge and false for failure or a conflict.

All three Content objects passed as parameters must have the same content model.

This text-based implementation uses wfMerge().

Parameters:
$oldContentContent|string String
$myContentContent|string String
$yourContentContent|string String
Returns:
Content|Bool

Reimplemented from ContentHandler.

Definition at line 64 of file TextContentHandler.php.

References $ok, $result, ContentHandler\checkModelID(), ContentHandler\getDefaultFormat(), Content\getModel(), makeEmptyContent(), serializeContent(), unserializeContent(), and wfMerge().

TextContentHandler::serializeContent ( Content content,
format = null 
)

Returns the content's text as-is.

Parameters:
$contentContent
$formatstring|null
Returns:
mixed

Reimplemented from ContentHandler.

Definition at line 44 of file TextContentHandler.php.

References ContentHandler\checkFormat(), and Content\getNativeData().

Referenced by merge3().

TextContentHandler::unserializeContent ( text,
format = null 
)

Unserializes a Content object of the type supported by this ContentHandler.

Since:
1.21
Parameters:
$textstring serialized form of the content
$formatnull|String the format used for serialization
Returns:
Content the TextContent object wrapping $text

Reimplemented from ContentHandler.

Reimplemented in RevisionTestModifyableContentHandler, WikitextContentHandler, CssContentHandler, and JavaScriptContentHandler.

Definition at line 99 of file TextContentHandler.php.

References ContentHandler\checkFormat().

Referenced by merge3().


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