X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fcontent%2FTextContentHandler.php;h=ffe1acbd202963ea835e1bb565dde7690284951e;hb=80f9a57e7c91fb0b31fb31ca7502b8dbc30339c2;hp=b728d312cac262b3d2ef14ef11d0f8f98e90b6f3;hpb=5086bae49ce3615885099e4a2922536406f52a69;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/content/TextContentHandler.php b/includes/content/TextContentHandler.php index b728d312ca..ffe1acbd20 100644 --- a/includes/content/TextContentHandler.php +++ b/includes/content/TextContentHandler.php @@ -60,9 +60,9 @@ class TextContentHandler extends ContentHandler { * * This text-based implementation uses wfMerge(). * - * @param Content|string $oldContent The page's previous content. - * @param Content|string $myContent One of the page's conflicting contents. - * @param Content|string $yourContent One of the page's conflicting contents. + * @param Content $oldContent The page's previous content. + * @param Content $myContent One of the page's conflicting contents. + * @param Content $yourContent One of the page's conflicting contents. * * @return Content|bool */ @@ -92,6 +92,19 @@ class TextContentHandler extends ContentHandler { return $mergedContent; } + /** + * Returns the name of the associated Content class, to + * be used when creating new objects. Override expected + * by subclasses. + * + * @since 1.24 + * + * @return string + */ + protected function getContentClass() { + return 'TextContent'; + } + /** * Unserializes a Content object of the type supported by this ContentHandler. * @@ -105,7 +118,8 @@ class TextContentHandler extends ContentHandler { public function unserializeContent( $text, $format = null ) { $this->checkFormat( $format ); - return new TextContent( $text ); + $class = $this->getContentClass(); + return new $class( $text ); } /** @@ -116,7 +130,8 @@ class TextContentHandler extends ContentHandler { * @return Content A new TextContent object with empty text. */ public function makeEmptyContent() { - return new TextContent( '' ); + $class = $this->getContentClass(); + return new $class( '' ); } }