private $mRootElemName = 'api';
public static $namespace = 'http://www.mediawiki.org/xml/api/';
private $mDoubleQuote = false;
+ private $mIncludeNamespace = false;
private $mXslt = null;
public function __construct( $main, $format ) {
public function execute() {
$params = $this->extractRequestParams();
$this->mDoubleQuote = $params['xmldoublequote'];
+ $this->mIncludeNamespace = $params['includexmlnamespace'];
$this->mXslt = $params['xslt'];
$this->printText( '<?xml version="1.0"?>' );
if ( !is_null( $this->mXslt ) ) {
$this->addXslt();
}
-
- // If the result data already contains an 'xmlns' namespace added
- // for custom XML output types, it will override the one for the
- // generic API results.
- // This allows API output of other XML types like Atom, RSS, RSD.
- $data = $this->getResultData() + array( 'xmlns' => self::$namespace );
+ if ( $this->mIncludeNamespace ) {
+ // If the result data already contains an 'xmlns' namespace added
+ // for custom XML output types, it will override the one for the
+ // generic API results.
+ // This allows API output of other XML types like Atom, RSS, RSD.
+ $data = $this->getResultData() + array( 'xmlns' => self::$namespace );
+ } else {
+ $data = $this->getResultData();
+ }
$this->printText(
self::recXmlPrint( $this->mRootElemName,
return array(
'xmldoublequote' => false,
'xslt' => null,
+ 'includexmlnamespace' => false,
);
}
return array(
'xmldoublequote' => 'If specified, double quotes all attributes and content',
'xslt' => 'If specified, adds <xslt> as stylesheet',
+ 'includexmlnamespace' => 'If specified, adds an XML namespace'
);
}
# Get size in bytes
$info['size'] = filesize( $path );
+ wfDebug("XXX $path $ext {$info[file-mime]} {$info[mime]} {$info[major_mime]} {$info[minor_mime]} {$info[media_type]} {$info[size]}\n");
# Height, width and metadata
$handler = MediaHandler::getHandler( $info['mime'] );
if ( $handler ) {
$tempImage = (object)array();
$info['metadata'] = $handler->getMetadata( $tempImage, $path );
$gis = $handler->getImageSize( $tempImage, $path, $info['metadata'] );
+ wfDebug("XXX $path has handler, metadata is {$info[metadata]}\n");
} else {
$gis = false;
$info['metadata'] = '';
+ wfDebug("XXX $path no handler, no metadata\n");
}
$info['sha1'] = self::sha1Base36( $path );