13 parent::setUpBeforeClass();
17 '<?xml version="1.0"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" />'
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' ] ],
static factory(Title $title)
Create a WikiPage object of the appropriate class for the given title.
processing should stop and the error should be shown to the user * false
const META_TYPE
Key for the 'type' metadata item.
const META_PRESERVE_KEYS
Key for the 'preserve keys' metadata item.
static newFromText($text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
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
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
Content object for wiki text pages.
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
const META_INDEXED_TAG_NAME
Key for the 'indexed tag name' metadata item.
const META_SUBELEMENTS
Key for the 'subelements' metadata item.
const META_BC_BOOLS
Key for the 'BC bools' metadata item.
const META_CONTENT
Key for the 'content' metadata item.
const META_BC_SUBELEMENTS
Key for the 'BC subelements' metadata item.
do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty its values are the globals values before the output is cached $page
const META_KVP_KEY_NAME
Key for the metadata item whose value specifies the name used for the kvp key in the alternative outp...