*
* Created on Sep 19, 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
* @file
*/
-if ( !defined( 'MEDIAWIKI' ) ) {
- // Eclipse helper - will be ignored in production
- require_once( 'ApiFormatBase.php' );
-}
-
/**
* API XML output formatter
* @ingroup API
/**
* This method takes an array and converts it to XML.
+ *
* There are several noteworthy cases:
*
- * If array contains a key '_element', then the code assumes that ALL other keys are not important and replaces them with the value['_element'].
- * Example: name='root', value = array( '_element'=>'page', 'x', 'y', 'z') creates <root> <page>x</page> <page>y</page> <page>z</page> </root>
+ * If array contains a key '_element', then the code assumes that ALL
+ * other keys are not important and replaces them with the
+ * value['_element'].
+ *
+ * @par Example:
+ * @verbatim
+ * name='root', value = array( '_element'=>'page', 'x', 'y', 'z')
+ * @endverbatim
+ * creates:
+ * @verbatim
+ * <root> <page>x</page> <page>y</page> <page>z</page> </root>
+ * @endverbatim
+ *
+ * If any of the array's element key is '*', then the code treats all
+ * other key->value pairs as attributes, and the value['*'] as the
+ * element's content.
+ *
+ * @par Example:
+ * @verbatim
+ * name='root', value = array( '*'=>'text', 'lang'=>'en', 'id'=>10)
+ * @endverbatim
+ * creates:
+ * @verbatim
+ * <root lang='en' id='10'>text</root>
+ * @endverbatim
*
- * If any of the array's element key is '*', then the code treats all other key->value pairs as attributes, and the value['*'] as the element's content.
- * Example: name='root', value = array( '*'=>'text', 'lang'=>'en', 'id'=>10) creates <root lang='en' id='10'>text</root>
+ * Finally neither key is found, all keys become element names, and values
+ * become element content.
*
- * If neither key is found, all keys become element names, and values become element content.
- * The method is recursive, so the same rules apply to any sub-arrays.
+ * @note The method is recursive, so the same rules apply to any
+ * sub-arrays.
*
* @param $elemName
* @param $elemValue
$this->setWarning( 'Stylesheet should have .xsl extension.' );
return;
}
- $this->printText( '<?xml-stylesheet href="' . $nt->escapeLocalURL( 'action=raw' ) . '" type="text/xsl" ?>' );
+ $this->printText( '<?xml-stylesheet href="' . htmlspecialchars( $nt->getLocalURL( 'action=raw' ) ) . '" type="text/xsl" ?>' );
}
public function getAllowedParams() {
public function getParamDescription() {
return array(
'xmldoublequote' => 'If specified, double quotes all attributes and content',
- 'xslt' => 'If specified, adds <xslt> as stylesheet',
+ 'xslt' => 'If specified, adds <xslt> as stylesheet. This should be a wiki page '
+ . 'in the MediaWiki namespace whose page name ends with ".xsl"',
'includexmlnamespace' => 'If specified, adds an XML namespace'
);
}