MediaWiki
REL1_24
|
Base content handler implementation for flat text contents. More...
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. | |
Protected Member Functions | |
getContentClass () | |
Returns the name of the associated Content class, to be used when creating new objects. |
Base content handler implementation for flat text contents.
Definition at line 31 of file TextContentHandler.php.
TextContentHandler::__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.
Values for the parameters are typically provided as literals by subclass's constructors.
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.
TextContentHandler::getContentClass | ( | ) | [protected] |
Returns the name of the associated Content class, to be used when creating new objects.
Override expected by subclasses.
Reimplemented in CodeContentHandler, CssContentHandler, JavaScriptContentHandler, WikitextContentHandler, and JsonContentHandler.
Definition at line 104 of file TextContentHandler.php.
Referenced by makeEmptyContent(), and unserializeContent().
Creates an empty TextContent object.
Reimplemented from ContentHandler.
Reimplemented in RevisionTestModifyableContentHandler.
Definition at line 132 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().
Content | $oldContent | The page's previous content. |
Content | $myContent | One of the page's conflicting contents. |
Content | $yourContent | One of the page's conflicting contents. |
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.
Content | $content | |
string | $format | The serialization format to check |
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.
string | $text | Serialized form of the content |
string | $format | The format used for serialization |
Reimplemented from ContentHandler.
Reimplemented in RevisionTestModifyableContentHandler.
Definition at line 118 of file TextContentHandler.php.
References ContentHandler\checkFormat(), and getContentClass().
Referenced by merge3().