13 parent::setUpBeforeClass();
14 $page = WikiPage::factory( Title::newFromText(
'MediaWiki:ApiFormatXmlTest.xsl' ) );
17 '<?xml version="1.0"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" />'
20 $page = WikiPage::factory( Title::newFromText(
'MediaWiki:ApiFormatXmlTest' ) );
22 $page = WikiPage::factory( Title::newFromText(
'ApiFormatXmlTest' ) );
30 [ [
null,
'a' => null ],
'<?xml version="1.0"?><api><_v _idx="0" /></api>' ],
31 [ [
true,
'a' =>
true ],
'<?xml version="1.0"?><api a=""><_v _idx="0">true</_v></api>' ],
32 [ [
false,
'a' =>
false ],
'<?xml version="1.0"?><api><_v _idx="0">false</_v></api>' ],
34 '<?xml version="1.0"?><api a=""><_v _idx="0">1</_v></api>' ],
36 '<?xml version="1.0"?><api><_v _idx="0"></_v></api>' ],
37 [ [ 42,
'a' => 42 ],
'<?xml version="1.0"?><api a="42"><_v _idx="0">42</_v></api>' ],
38 [ [ 42.5,
'a' => 42.5 ],
'<?xml version="1.0"?><api a="42.5"><_v _idx="0">42.5</_v></api>' ],
39 [ [ 1e42,
'a' => 1e42 ],
'<?xml version="1.0"?><api a="1.0E+42"><_v _idx="0">1.0E+42</_v></api>' ],
40 [ [
'foo',
'a' =>
'foo' ],
'<?xml version="1.0"?><api a="foo"><_v _idx="0">foo</_v></api>' ],
41 [ [
'fóo',
'a' =>
'fóo' ],
'<?xml version="1.0"?><api a="fóo"><_v _idx="0">fóo</_v></api>' ],
44 [ [ [] ],
'<?xml version="1.0"?><api><_v /></api>' ],
45 [ [ [
'x' => 1 ] ],
'<?xml version="1.0"?><api><_v x="1" /></api>' ],
46 [ [ [ 2 => 1 ] ],
'<?xml version="1.0"?><api><_v><_v _idx="2">1</_v></_v></api>' ],
47 [ [ (
object)[] ],
'<?xml version="1.0"?><api><_v /></api>' ],
48 [ [ [ 1,
ApiResult::META_TYPE =>
'assoc' ] ],
'<?xml version="1.0"?><api><_v><_v _idx="0">1</_v></_v></api>' ],
49 [ [ [
'x' => 1,
ApiResult::META_TYPE =>
'array' ] ],
'<?xml version="1.0"?><api><_v><_v>1</_v></_v></api>' ],
51 '<?xml version="1.0"?><api><_v><_v _name="x" xml:space="preserve">1</_v><_v _name="y"><z xml:space="preserve">1</z></_v></_v></api>' ],
53 '<?xml version="1.0"?><api><_v><i key="x" xml:space="preserve">1</i></_v></api>' ],
55 '<?xml version="1.0"?><api><_v><_v key="x" xml:space="preserve">1</_v></_v></api>' ],
56 [ [ [
'x' => 1,
ApiResult::META_TYPE =>
'BCarray' ] ],
'<?xml version="1.0"?><api><_v x="1" /></api>' ],
57 [ [ [
'a',
'b',
ApiResult::META_TYPE =>
'BCassoc' ] ],
'<?xml version="1.0"?><api><_v><_v _idx="0">a</_v><_v _idx="1">b</_v></_v></api>' ],
61 '<?xml version="1.0"?><api xml:space="preserve">foo</api>' ],
65 '<?xml version="1.0"?><api><itn>foo</itn><itn>bar</itn></api>' ],
68 [ [
'a' => 1,
's' => 1,
'_subelements' => [
's' ] ],
69 '<?xml version="1.0"?><api a="1"><s xml:space="preserve">1</s></api>' ],
73 '<?xml version="1.0"?><api a="1" xml:space="preserve">foo</api>' ],
75 '<?xml version="1.0"?><api><s /><content xml:space="preserve">foo</content></api>' ],
83 '<?xml version="1.0"?><api><s xml:space="preserve">1</s><content xml:space="preserve">foo</content></api>'
88 '<?xml version="1.0"?><api><foo xml:space="preserve">foo</foo></api>' ],
91 [ [
'foo.bar' => 1 ],
'<?xml version="1.0"?><api foo.bar="1" />' ],
92 [ [
'' => 1 ],
'<?xml version="1.0"?><api _="1" />' ],
93 [ [
'foo bar' => 1 ],
'<?xml version="1.0"?><api _foo.20.bar="1" />' ],
94 [ [
'foo:bar' => 1 ],
'<?xml version="1.0"?><api _foo.3A.bar="1" />' ],
95 [ [
'foo%.bar' => 1 ],
'<?xml version="1.0"?><api _foo.25..2E.bar="1" />' ],
96 [ [
'4foo' => 1,
'foo4' => 1 ],
'<?xml version="1.0"?><api _4foo="1" foo4="1" />' ],
97 [ [
"foo\xe3\x80\x80bar" => 1 ],
'<?xml version="1.0"?><api _foo.3000.bar="1" />' ],
99 '<?xml version="1.0"?><api foo:bar="1" />' ],
101 '<?xml version="1.0"?><api><_foo.20.bar>a</_foo.20.bar><_foo.20.bar>b</_foo.20.bar></api>' ],
104 [ [
'x' =>
'foo' ],
'<?xml version="1.0"?><api x="foo" xmlns="http://www.mediawiki.org/xml/api/" />',
105 [
'includexmlnamespace' => 1 ] ],
108 [ [],
'<?xml version="1.0"?><api><warnings><xml xml:space="preserve">Invalid or non-existent stylesheet specified.</xml></warnings></api>',
109 [
'xslt' =>
'DoesNotExist' ] ],
110 [ [],
'<?xml version="1.0"?><api><warnings><xml xml:space="preserve">Stylesheet should be in the MediaWiki namespace.</xml></warnings></api>',
111 [
'xslt' =>
'ApiFormatXmlTest' ] ],
112 [ [],
'<?xml version="1.0"?><api><warnings><xml xml:space="preserve">Stylesheet should have ".xsl" extension.</xml></warnings></api>',
113 [
'xslt' =>
'MediaWiki:ApiFormatXmlTest' ] ],
115 '<?xml version="1.0"?><?xml-stylesheet href="' .
116 htmlspecialchars( Title::newFromText(
'MediaWiki:ApiFormatXmlTest.xsl' )->getLocalURL(
'action=raw' ) ) .
117 '" type="text/xsl" ?><api />',
118 [
'xslt' =>
'MediaWiki:ApiFormatXmlTest.xsl' ] ],
const META_TYPE
Key for the 'type' metadata item.
const META_SUBELEMENTS
Key for the 'subelements' metadata item.
const META_BC_BOOLS
Key for the 'BC bools' metadata item.
const META_PRESERVE_KEYS
Key for the 'preserve keys' metadata item.
const META_CONTENT
Key for the 'content' metadata item.
const META_KVP_KEY_NAME
Key for the metadata item whose value specifies the name used for the kvp key in the alternative outp...
const META_BC_SUBELEMENTS
Key for the 'BC subelements' metadata item.
const META_INDEXED_TAG_NAME
Key for the 'indexed tag name' metadata item.
Content object for wiki text pages.
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return true
processing should stop and the error should be shown to the user * false
globals will be eliminated from MediaWiki replaced by an application object which would be passed to constructors Whether that would be an convenient solution remains to be but certainly PHP makes such object oriented programming models easier than they were in previous versions For the time being MediaWiki programmers will have to work in an environment with some global context At the time of globals were initialised on startup by MediaWiki of these were configuration which are documented in DefaultSettings php There is no comprehensive documentation for the remaining however some of the most important ones are listed below They are typically initialised either in index php or in Setup php For a description of the see design txt $wgTitle Title object created from the request URL $wgOut OutputPage object for HTTP response $wgUser User object for the user associated with the current request $wgLang Language object selected by user preferences $wgContLang Language object associated with the wiki being viewed $wgParser Parser object Parser extensions register their hooks here $wgRequest WebRequest object