Go to the documentation of this file.
8 protected function setUp() {
12 $langObj->setNamespaces(
array(
24 9 =>
'MediaWiki_talk',
26 11 =>
'Template_talk',
33 'wgWellFormedXml' =>
true,
42 'Converting a null list of attributes'
45 'Converting an empty list of attributes'
53 $this->setExpectedException(
'MWException' );
64 'Opening element with no attributes'
75 'Terminated empty element'
84 '<input name="name" value="0" />',
86 'Input with a value of 0 (bug 23797)'
95 '<element>hello <there> you & you</element>',
96 Xml::element(
'element',
null,
'hello <there> you & you' ),
97 'Element with no attributes and content that needs escaping'
106 'replace " > and < with their HTML entitites'
115 '<element key="value" <>="<>">',
117 'Element attributes, keys are not escaped'
128 'openElement() shortcut'
136 $this->assertEquals(
'</element>',
Xml::closeElement(
'element' ),
'closeElement() shortcut' );
143 $curYear = intval( gmdate(
'Y' ) );
144 $prevYear = $curYear - 1;
146 $curMonth = intval( gmdate(
'n' ) );
148 $nextMonth = $curMonth + 1;
149 if ( $nextMonth == 13 ) {
154 '<label for="year">From year (and earlier):</label> <input id="year" maxlength="4" size="7" type="number" value="2011" name="year" /> <label for="month">From month (and earlier):</label> <select id="month" name="month" class="mw-month-selector"><option value="-1">all</option>' .
"\n" .
155 '<option value="1">January</option>' .
"\n" .
156 '<option value="2" selected="">February</option>' .
"\n" .
157 '<option value="3">March</option>' .
"\n" .
158 '<option value="4">April</option>' .
"\n" .
159 '<option value="5">May</option>' .
"\n" .
160 '<option value="6">June</option>' .
"\n" .
161 '<option value="7">July</option>' .
"\n" .
162 '<option value="8">August</option>' .
"\n" .
163 '<option value="9">September</option>' .
"\n" .
164 '<option value="10">October</option>' .
"\n" .
165 '<option value="11">November</option>' .
"\n" .
166 '<option value="12">December</option></select>',
168 "Date menu for february 2011"
171 '<label for="year">From year (and earlier):</label> <input id="year" maxlength="4" size="7" type="number" value="2011" name="year" /> <label for="month">From month (and earlier):</label> <select id="month" name="month" class="mw-month-selector"><option value="-1">all</option>' .
"\n" .
172 '<option value="1">January</option>' .
"\n" .
173 '<option value="2">February</option>' .
"\n" .
174 '<option value="3">March</option>' .
"\n" .
175 '<option value="4">April</option>' .
"\n" .
176 '<option value="5">May</option>' .
"\n" .
177 '<option value="6">June</option>' .
"\n" .
178 '<option value="7">July</option>' .
"\n" .
179 '<option value="8">August</option>' .
"\n" .
180 '<option value="9">September</option>' .
"\n" .
181 '<option value="10">October</option>' .
"\n" .
182 '<option value="11">November</option>' .
"\n" .
183 '<option value="12">December</option></select>',
185 "Date menu with negative month for 'All'"
190 "Date menu year is the current one when not specified"
193 $wantedYear = $nextMonth == 1 ? $curYear : $prevYear;
197 "Date menu next month is 11 months ago"
201 '<label for="year">From year (and earlier):</label> <input id="year" maxlength="4" size="7" type="number" name="year" /> <label for="month">From month (and earlier):</label> <select id="month" name="month" class="mw-month-selector"><option value="-1">all</option>' .
"\n" .
202 '<option value="1">January</option>' .
"\n" .
203 '<option value="2">February</option>' .
"\n" .
204 '<option value="3">March</option>' .
"\n" .
205 '<option value="4">April</option>' .
"\n" .
206 '<option value="5">May</option>' .
"\n" .
207 '<option value="6">June</option>' .
"\n" .
208 '<option value="7">July</option>' .
"\n" .
209 '<option value="8">August</option>' .
"\n" .
210 '<option value="9">September</option>' .
"\n" .
211 '<option value="10">October</option>' .
"\n" .
212 '<option value="11">November</option>' .
"\n" .
213 '<option value="12">December</option></select>',
215 "Date menu with neither year or month"
224 '<textarea name="name" id="name" cols="40" rows="5"></textarea>',
226 'textarea() with not content'
235 '<textarea name="name" id="name" cols="20" rows="10"><txt></textarea>',
237 'textarea() with custom attribs'
246 '<label for="id">name</label>',
248 'label() with no attribs'
257 '<label for="id">name</label>',
259 'label() can not be given a generated attribute'
262 '<label for="id" class="nice">name</label>',
264 'label() can get a class attribute'
267 '<label for="id" title="nice tooltip">name</label>',
269 'label() can get a title attribute'
272 '<label for="id" class="nice" title="nice tooltip">name</label>',
276 'title' =>
'nice tooltip',
277 'anotherattr' =>
'value',
280 'label() skip all attributes but "class" and "title"'
291 '<label for="testlang">Language:</label>',
303 'escapeJsString() with special characters'
314 'encodeJsVar() with boolean'
325 'encodeJsVar() with null'
336 'encodeJsVar() with array'
341 'encodeJsVar() with associative array'
352 'encodeJsVar() with object'
363 'encodeJsVar() with int'
374 'encodeJsVar() with float'
385 'encodeJsVar() with int-like string'
396 'encodeJsVar() with float-like string'
testElementInputCanHaveAValueOfZero()
@covers Xml::input
testEncodeJsVarBoolean()
@covers Xml::encodeJsVar
testLabelAttributeCanOnlyBeClassOrTitle()
@covers Xml::label
static escapeJsString( $string)
Returns an escaped string suitable for inclusion in a string literal for JavaScript source code.
static expandAttributes( $attribs)
Given an array of ('attributename' => 'value'), it generates the code to set the XML attributes : att...
testCloseElement()
@covers Xml::closeElement
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
testEncodeJsVarFloatString()
@covers Xml::encodeJsVar
testEncodeJsVarInt()
@covers Xml::encodeJsVar
testTextareaNoContent()
@covers Xml::textarea
testLabelCreation()
@covers Xml::label
testEscapeJsStringSpecialChars()
@covers Xml::escapeJsString
testTextareaAttribs()
@covers Xml::textarea
static languageSelector( $selected, $customisedOnly=true, $inLanguage=null, $overrideAttrs=array(), Message $msg=null)
Construct a language selector appropriate for use in a form or preferences.
static openElement( $element, $attribs=null)
This opens an XML element.
static encodeJsVar( $value, $pretty=false)
Encode a variable of arbitrary type to JavaScript.
testExpandAttributesException()
@covers Xml::expandAttributes
testExpandAttributes()
@covers Xml::expandAttributes
testElementEscaping()
@covers Xml::element
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 an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses after processing after in associative array form externallinks including delete and has completed for all link tables default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a set this to the key of the message First element is the message additional optional elements are parameters for the key that are processed with wfMessage() -> params() ->parseAsBlock() - offset Set to overwrite offset parameter in $wgRequest set to '' to unset offset - wrap String Wrap the message in html(usually something like "<
static element( $element, $attribs=null, $contents='', $allowShortTag=true)
Format an XML element with given attributes and, optionally, text content.
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
testLanguageSelector()
@covers Xml::languageSelector
testOpenElement()
@covers Xml::openElement
testElementOpen()
@covers Xml::element
testEncodeJsVarFloat()
@covers Xml::encodeJsVar
static textarea( $name, $content, $cols=40, $rows=5, $attribs=array())
Shortcut for creating textareas.
testElementAttributes()
@covers Xml::element
testEncodeJsVarIntString()
@covers Xml::encodeJsVar
static closeElement( $element)
Shortcut to close an XML element.
static dateMenu( $year, $month)
testDateMenu()
@covers Xml::dateMenu
testEscapeTagsOnly()
@covers Xml::escapeTagsOnly
testElementEmpty()
@covers Xml::element
static factory( $code)
Get a cached or new language object for a given language code.
static input( $name, $size=false, $value=false, $attribs=array())
Convenience function to build an HTML text input field.
static label( $label, $id, $attribs=array())
Convenience function to build an HTML form label.
testEncodeJsVarNull()
@covers Xml::encodeJsVar
static escapeTagsOnly( $in)
Replace " > and < with their respective HTML entities ( ", >, <)
testEncodeJsVarArray()
@covers Xml::encodeJsVar
testEncodeJsVarObject()
@covers Xml::encodeJsVar