*
* Created on Sep 7, 2006
*
- * Copyright © 2006 Yuri Astrakhan <Firstname><Lastname>@gmail.com
+ * Copyright © 2006 Yuri Astrakhan "<Firstname><Lastname>@gmail.com"
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
$this->token = $params['token'];
if ( !empty( $params['contentformat'] ) ) {
- $n = ContentHandler::getContentFormatID( $params['contentformat'] );
-
- if ( is_int( $n ) ) {
- $this->contentFormat = $n;
- } else {
- $this->dieUsage( "Unknown format " . $params['contentformat'], 'badformat' );
- }
+ $this->contentFormat = $params['contentformat'];
}
// Possible indexes used
} else {
$this->setWarning( "Conversion to XML is supported for wikitext only, " .
$title->getPrefixedDBkey() .
- " uses content model #" . $content->getModel() .
- " (" . ContentHandler::getContentModelName( $content->getModel() ). ")" );
+ " uses content model " . $content->getModel() . ")" );
}
}
} else {
$this->setWarning( "Template expansion is supported for wikitext only, " .
$title->getPrefixedDBkey() .
- " uses content model #" . $content->getModel() .
- " (" . ContentHandler::getContentModelName( $content->getModel() ). ")" );
+ " uses content model " . $content->getModel() . ")" );
$text = false;
}
if ( !$content->isSupportedFormat( $format ) ) {
$model = $content->getModel();
- $formatName = ContentHandler::getContentFormatMimeType( $format );
- $modelName = ContentHandler::getContentModelName( $model );
$name = $title->getPrefixedDBkey();
- $this->dieUsage( "The requested format #{$this->contentFormat} ($formatName) is not supported for content model #$model ($modelName) used by $name", 'badformat' );
+ $this->dieUsage( "The requested format {$this->contentFormat} is not supported for content model $model used by $name", 'badformat' );
}
$text = $content->serialize( $format );
- $vals['contentformat'] = ContentHandler::getContentFormatMimeType( $format );
+ $vals['contentformat'] = $format;
}
if ( $text !== false ) {
$model = $title->getContentModel();
if ( $this->contentFormat && !ContentHandler::getForModelID( $model )->isSupportedFormat( $this->contentFormat ) ) {
- $formatName = ContentHandler::getContentFormatMimeType( $this->contentFormat );
- $modelName = ContentHandler::getContentModelName( $model );
$name = $title->getPrefixedDBkey();
- $this->dieUsage( "The requested format #{$this->contentFormat} ($formatName) is not supported for content model #$model ($modelName) used by $name", 'badformat' );
+ $this->dieUsage( "The requested format {$this->contentFormat} is not supported for content model $model used by $name", 'badformat' );
}
$difftocontent = ContentHandler::makeContent( $this->difftotext, $title, $model, $this->contentFormat );
'diffto' => null,
'difftotext' => null,
'contentformat' => array(
- ApiBase::PARAM_TYPE => array_values( $GLOBALS[ 'wgContentFormatMimeTypes' ] ),
+ ApiBase::PARAM_TYPE => ContentHandler::getAllContentFormats(),
ApiBase::PARAM_DFLT => null
),
);