Avoid sending spammy @X xhprof entries over UDP
[lhc/web/wiklou.git] / includes / content / TextContentHandler.php
index 0c9ee37..ffe1acb 100644 (file)
@@ -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( '' );
        }
 
 }