MediaWiki  REL1_23
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).
string[]$formats List for supported serialization formats (typically as MIME types)

Reimplemented from ContentHandler.

Definition at line 34 of file TextContentHandler.php.


Member Function Documentation

Creates an empty TextContent object.

Since:
1.21
Returns:
Content A new TextContent object with empty text.

Reimplemented from ContentHandler.

Reimplemented in RevisionTestModifyableContentHandler, CssContentHandler, JavaScriptContentHandler, and WikitextContentHandler.

Definition at line 118 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:
Content | string$oldContentThe page's previous content.
Content | string$myContentOne of the page's conflicting contents.
Content | string$yourContentOne of the page's conflicting contents.
Returns:
Content|bool

Reimplemented from ContentHandler.

Definition at line 69 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:
Content$content
string$formatThe serialization format to check
Returns:
mixed

Reimplemented from ContentHandler.

Definition at line 48 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:
string$textSerialized form of the content
string$formatThe format used for serialization
Returns:
Content The TextContent object wrapping $text

Reimplemented from ContentHandler.

Reimplemented in RevisionTestModifyableContentHandler, CssContentHandler, JavaScriptContentHandler, and WikitextContentHandler.

Definition at line 105 of file TextContentHandler.php.

References ContentHandler\checkFormat().

Referenced by merge3().


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