MediaWiki  master
TextContentHandler Class Reference

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

Inheritance diagram for TextContentHandler:
Collaboration diagram for TextContentHandler:

Public Member Functions

 __construct ($modelId=CONTENT_MODEL_TEXT, $formats=[CONTENT_FORMAT_TEXT])
 
 getFieldsForSearchIndex (SearchEngine $engine)
 
 makeEmptyContent ()
 Creates an empty TextContent object. More...
 
 merge3 (Content $oldContent, Content $myContent, Content $yourContent)
 Attempts to merge differences between three versions. More...
 
 serializeContent (Content $content, $format=null)
 Returns the content's text as-is. More...
 
 supportsDirectEditing ()
 
 unserializeContent ($text, $format=null)
 Unserializes a Content object of the type supported by this ContentHandler. More...
 

Protected Member Functions

 getContentClass ()
 Returns the name of the associated Content class, to be used when creating new objects. More...
 

Detailed Description

Base content handler implementation for flat text contents.

Definition at line 31 of file TextContentHandler.php.

Constructor & Destructor Documentation

TextContentHandler::__construct (   $modelId = CONTENT_MODEL_TEXT,
  $formats = CONTENT_FORMAT_TEXT ] 
)

Definition at line 34 of file TextContentHandler.php.

Member Function Documentation

TextContentHandler::getContentClass ( )
protected

Returns the name of the associated Content class, to be used when creating new objects.

Override expected by subclasses.

Since
1.24
Returns
string

Definition at line 103 of file TextContentHandler.php.

Referenced by makeEmptyContent(), and unserializeContent().

TextContentHandler::getFieldsForSearchIndex ( SearchEngine  $engine)
TextContentHandler::makeEmptyContent ( )

Creates an empty TextContent object.

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

Definition at line 131 of file TextContentHandler.php.

References getContentClass().

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

Definition at line 68 of file TextContentHandler.php.

References 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

Definition at line 47 of file TextContentHandler.php.

References Content\getNativeData().

Referenced by merge3().

TextContentHandler::supportsDirectEditing ( )
See Also
ContentHandler::supportsDirectEditing
Returns
bool Default is true for TextContent and derivatives.

Definition at line 141 of file TextContentHandler.php.

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

Definition at line 117 of file TextContentHandler.php.

References getContentClass().

Referenced by merge3().


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