abstract class TextContentHandler extends ContentHandler {
public function __construct( $modelName, $formats ) {
- super::__construct( $modelName, $formats );
+ parent::__construct( $modelName, $formats );
}
public function serialize( Content $content, Title $title, $format = null ) {
class WikitextContentHandler extends TextContentHandler {
public function __construct( $modelName = CONTENT_MODEL_WIKITEXT ) {
- super::__construct( $modelName, array( 'application/x-wikitext' ) ); #FIXME: mime
+ parent::__construct( $modelName, array( 'application/x-wikitext' ) ); #FIXME: mime
}
public function unserialize( $text, Title $title, $format = null ) {
class JavaScriptContentHandler extends TextContentHandler {
public function __construct( $modelName = CONTENT_MODEL_WIKITEXT ) {
- super::__construct( $modelName, array( 'text/javascript' ) );
+ parent::__construct( $modelName, array( 'text/javascript' ) );
}
public function unserialize( $text, Title $title, $format = null ) {
class CssContentHandler extends TextContentHandler {
public function __construct( $modelName = CONTENT_MODEL_WIKITEXT ) {
- super::__construct( $modelName, array( 'text/css' ) );
+ parent::__construct( $modelName, array( 'text/css' ) );
}
public function unserialize( $text, Title $title, $format = null ) {
$text = $this->textbox1; // do not try to merge here!
} elseif ( $this->isConflict ) {
# Attempt merge
- if ( $this->mergeChangesInto( $text ) ) {
+ if ( $this->mergeChangesInto( $text ) ) { #FIXME: use ContentHandler
// Successful merge! Maybe we should tell the user the good news?
$this->isConflict = false;
wfDebug( __METHOD__ . ": Suppressing edit conflict, successful merge.\n" );
$handler = $this->getContentHandler();
$format = $this->getContentFormat();
+ $title = $this->getTitle();
if( is_null( $this->mText ) ) {
// Load text on demand:
$this->mText = $this->loadText();
}
- $this->mContent = $handler->unserialize( $this->mText, $format );
+ $this->mContent = $handler->unserialize( $this->mText, $title, $format );
}
return $this->mContent;
public function getContentHandler() {
if ( !$this->mContentHandler ) {
- $m = $this->getModelName();
- $this->mContentHandler = ContentHandler::getForModelName( $m );
+ $title = $this->getTitle();
+
+ if ( $title ) $model = $title->getContentModelName();
+ else $model = CONTENT_MODEL_WIKITEXT;
+
+ $this->mContentHandler = ContentHandler::getForModelName( $model );
#XXX: do we need to verify that mContentHandler supports mContentFormat?
# otherwise, a fixed content format may cause problems on insert.