MediaWiki  1.30.0
Xml Class Reference

Module of static functions for generating XML. More...

Static Public Member Functions

static attrib ( $name, $present=true)
 Internal function for use in checkboxes and radio buttons and such. More...
 
static buildForm ( $fields, $submitLabel=null, $submitAttribs=[])
 Generate a form (without the opening form element). More...
 
static buildTable ( $rows, $attribs=[], $headers=null)
 Build a table of data. More...
 
static buildTableRow ( $attribs, $cells)
 Build a row for a table. More...
 
static check ( $name, $checked=false, $attribs=[])
 Convenience function to build an HTML checkbox. More...
 
static checkLabel ( $label, $name, $id, $checked=false, $attribs=[])
 Convenience function to build an HTML checkbox with a label. More...
 
static closeElement ( $element)
 Shortcut to close an XML element. More...
 
static dateMenu ( $year, $month)
 
static element ( $element, $attribs=null, $contents='', $allowShortTag=true)
 Format an XML element with given attributes and, optionally, text content. More...
 
static elementClean ( $element, $attribs=[], $contents='')
 Format an XML element as with self::element(), but run text through the $wgContLang->normalize() validator first to ensure that no invalid UTF-8 is passed. More...
 
static encodeJsCall ( $name, $args, $pretty=false)
 Create a call to a JavaScript function. More...
 
static encodeJsVar ( $value, $pretty=false)
 Encode a variable of arbitrary type to JavaScript. More...
 
static escapeTagsOnly ( $in)
 Replace " > and < with their respective HTML entities ( ", >, <) More...
 
static expandAttributes ( $attribs)
 Given an array of ('attributename' => 'value'), it generates the code to set the XML attributes : attributename="value". More...
 
static fieldset ( $legend=false, $content=false, $attribs=[])
 Shortcut for creating fieldsets. More...
 
static input ( $name, $size=false, $value=false, $attribs=[])
 Convenience function to build an HTML text input field. More...
 
static inputLabel ( $label, $name, $id, $size=false, $value=false, $attribs=[])
 Convenience function to build an HTML text input field with a label. More...
 
static inputLabelSep ( $label, $name, $id, $size=false, $value=false, $attribs=[])
 Same as Xml::inputLabel() but return input and label in an array. More...
 
static isWellFormedXmlFragment ( $text)
 Check if a string is a well-formed XML fragment. More...
 
static label ( $label, $id, $attribs=[])
 Convenience function to build an HTML form label. More...
 
static languageSelector ( $selected, $customisedOnly=true, $inLanguage=null, $overrideAttrs=[], Message $msg=null)
 Construct a language selector appropriate for use in a form or preferences. More...
 
static listDropDown ( $name='', $list='', $other='', $selected='', $class='', $tabindex=null)
 Build a drop-down box from a textual list. More...
 
static listDropDownOptions ( $list, $params=[])
 Build options for a drop-down box from a textual list. More...
 
static listDropDownOptionsOoui ( $options)
 Convert options for a drop-down box into a format accepted by OOUI\DropdownInputWidget etc. More...
 
static monthSelector ( $selected='', $allmonths=null, $id='month')
 Create a date selector. More...
 
static openElement ( $element, $attribs=null)
 This opens an XML element. More...
 
static option ( $text, $value=null, $selected=false, $attribs=[])
 Convenience function to build an HTML drop-down list item. More...
 
static password ( $name, $size=false, $value=false, $attribs=[])
 Convenience function to build an HTML password input field. More...
 
static radio ( $name, $value, $checked=false, $attribs=[])
 Convenience function to build an HTML radio button. More...
 
static radioLabel ( $label, $name, $value, $id, $checked=false, $attribs=[])
 Convenience function to build an HTML radio button with a label. More...
 
static span ( $text, $class, $attribs=[])
 Shortcut to make a span element. More...
 
static submitButton ( $value, $attribs=[])
 Convenience function to build an HTML submit button When $wgUseMediaWikiUIEverywhere is true it will default to a progressive button. More...
 
static tags ( $element, $attribs=null, $contents)
 Same as Xml::element(), but does not escape contents. More...
 
static textarea ( $name, $content, $cols=40, $rows=5, $attribs=[])
 Shortcut for creating textareas. More...
 
static wrapClass ( $text, $class, $tag='span', $attribs=[])
 Shortcut to make a specific element with a class attribute. More...
 

Static Private Member Functions

static isWellFormed ( $text)
 Check if a string is well-formed XML. More...
 

Detailed Description

Module of static functions for generating XML.

Definition at line 26 of file Xml.php.

Member Function Documentation

◆ attrib()

static Xml::attrib (   $name,
  $present = true 
)
static

Internal function for use in checkboxes and radio buttons and such.

Parameters
string$name
bool$present
Returns
array

Definition at line 312 of file Xml.php.

References $name.

◆ buildForm()

static Xml::buildForm (   $fields,
  $submitLabel = null,
  $submitAttribs = [] 
)
static

Generate a form (without the opening form element).

Output optionally includes a submit button.

Parameters
array$fieldsAssociative array, key is the name of a message that contains a description for the field, value is an HTML string containing the appropriate input.
string$submitLabelThe name of a message containing a label for the submit button.
array$submitAttribsThe attributes to add to the submit button
Returns
string HTML form.

Definition at line 765 of file Xml.php.

References $input, as, closeElement(), openElement(), submitButton(), tags(), text, and wfMessage().

◆ buildTable()

static Xml::buildTable (   $rows,
  $attribs = [],
  $headers = null 
)
static

Build a table of data.

Parameters
array$rowsAn array of arrays of strings, each to be a row in a table
array$attribsAn array of attributes to apply to the table tag [optional]
array$headersAn array of strings to use as table headers [optional]
Returns
string

Definition at line 804 of file Xml.php.

References $attribs, $header, $rows, $s, as, buildTableRow(), closeElement(), element(), and openElement().

◆ buildTableRow()

static Xml::buildTableRow (   $attribs,
  $cells 
)
static

Build a row for a table.

Parameters
array$attribsAn array of attributes to apply to the tr tag
array$cellsAn array of strings to put in
Returns
string

Definition at line 843 of file Xml.php.

References $attribs, $s, as, closeElement(), element(), and openElement().

Referenced by buildTable().

◆ check()

static Xml::check (   $name,
  $checked = false,
  $attribs = [] 
)
static

Convenience function to build an HTML checkbox.

Parameters
string$nameValue of the name attribute
bool$checkedWhether the checkbox is checked or not
array$attribsArray other attributes
Returns
string HTML

Definition at line 323 of file Xml.php.

References $attribs, $name, and element().

Referenced by checkLabel(), SpecialUndelete\formatFileRow(), SpecialUndelete\formatRevisionRow(), WebInstaller\getCheckBox(), EditPage\getCheckboxes(), SpecialRecentChangesLinked\getExtraOptions(), HTMLCheckField\getInputHTML(), HTMLMultiSelectField\getOneCheckbox(), HTMLCheckMatrix\getOneCheckbox(), LogEventsList\getShowHideLinks(), HistoryPager\historyLine(), SpecialNuke\listForm(), and SpecialInterwiki\showForm().

◆ checkLabel()

◆ closeElement()

static Xml::closeElement (   $element)
static

Shortcut to close an XML element.

Parameters
string$elementElement name
Returns
string

Definition at line 118 of file Xml.php.

Referenced by AllMessagesTablePager\buildForm(), ProtectionForm\buildForm(), buildForm(), buildTable(), buildTableRow(), checkLabel(), SpecialRecentChanges\doHeader(), SpecialWatchlist\doHeader(), SpecialRenameuser\execute(), SpecialStatistics\execute(), SpecialListGroupRights\execute(), QueryPage\execute(), SiteExporter\exportSite(), SiteExporter\exportSites(), fieldset(), SpecialStatistics\formatRowHeader(), InputBox\getCommentForm(), InputBox\getCreateForm(), SpecialStatistics\getEditStats(), SpecialVersion\getExtensionCredits(), SpecialContributions\getForm(), InputBox\getMoveForm(), SpecialStatistics\getPageStats(), InputBox\getSearchForm(), InputBox\getSearchForm2(), MysqlInstaller\getSettingsForm(), SpecialVersion\getSkinCredits(), SpecialStatistics\getUserStats(), UserrightsPage\groupCheckboxes(), SpecialWhatLinksHere\listEnd(), SpecialPrefixindex\namespacePrefixForm(), ImagePage\openShowImage(), SpecialListGroupRights\outputNamespaceProtectionInfo(), SpecialWatchlist\setTopText(), EditPage\showEditForm(), UserrightsPage\showEditUserGroupsForm(), SpecialEditTags\showForm(), FileDeleteForm\showForm(), SpecialImport\showForm(), SpecialRevisionDelete\showForm(), SpecialMergeHistory\showHistory(), SpecialWhatLinksHere\showIndirectLinks(), SpecialGadgets\showMainForm(), SpecialMergeHistory\showMergeForm(), SpecialProtectedpages\showOptions(), SpecialUndelete\showRevision(), SpecialVersion\softwareInformation(), XmlTest\testCloseElement(), ImagePage\view(), and SpecialWhatLinksHere\whatlinkshereForm().

◆ dateMenu()

static Xml::dateMenu (   $year,
  $month 
)
static
Parameters
int$year
int$month
Returns
string Formatted HTML

Definition at line 167 of file Xml.php.

References MWTimestamp\getInstance(), Html\input(), label(), monthSelector(), text, and wfMessage().

Referenced by HistoryAction\onView(), LogEventsList\showOptions(), and XmlTest\testDateMenu().

◆ element()

static Xml::element (   $element,
  $attribs = null,
  $contents = '',
  $allowShortTag = true 
)
static

Format an XML element with given attributes and, optionally, text content.

Element and attribute names are assumed to be ready for literal inclusion. Strings are assumed to not contain XML-illegal characters; special characters (<, >, &) are escaped but illegals are not touched.

Parameters
string$elementElement name
array$attribsName=>value pairs. Values will be escaped.
string$contentsNull to make an open tag only; '' for a contentless closed tag (default)
bool$allowShortTagWhether '' in $contents will result in a contentless closed tag
Returns
string

Definition at line 39 of file Xml.php.

References $attribs, $out, and expandAttributes().

Referenced by ImageHistoryList\beginImageHistoryList(), SpecialEditTags\buildCheckBoxes(), ProtectionForm\buildForm(), buildTable(), buildTableRow(), XmlDumpWriter\caseSetting(), check(), Article\confirmDelete(), Preferences\datetimePreferences(), XmlDumpWriter\dbname(), Article\delete(), HistoryPager\diffButtons(), Article\doDelete(), SpecialWatchlist\doHeader(), SpecialTags\doTagRow(), WikiEditorHooks\editPageShowEditFormFields(), elementClean(), SpecialRenameuser\execute(), SpecialListGroupRights\execute(), SiteExporter\exportSite(), fieldset(), ImageListPager\formatValue(), XmlDumpWriter\generator(), SpecialVersion\getExtensionCredits(), QuestyCaptcha\getFormInformation(), SimpleCaptcha\getFormInformation(), SpecialVersion\getMediaWikiCredits(), Skin\getNewtalks(), InputBox\getSearchForm(), InputBox\getSearchForm2(), SpecialVersion\getSkinCredits(), UserrightsPage\groupCheckboxes(), XmlDumpWriter\homelink(), ImageHistoryList\imageHistoryLine(), input(), ChangesList\insertDateHeader(), label(), MediaWiki\Widget\Search\SearchFormWidget\makeSearchLink(), SpecialPrefixindex\namespacePrefixForm(), XmlDumpWriter\namespaces(), XmlDumpWriter\openPage(), XmlDumpWriter\openStream(), Licenses\outputOption(), SpecialChangeContentModel\postText(), radio(), EnhancedChangesList\recentChangesBlock(), ImageMap\render(), InputBox\render(), EditPage\showEditForm(), UserrightsPage\showEditUserGroupsForm(), FileDeleteForm\showForm(), SpecialUndelete\showHistory(), SpecialRenameuser\showLogExtract(), ProtectionForm\showLogExtract(), SpecialPageLanguage\showLogFragment(), MovePageForm\showLogFragment(), UserrightsPage\showLogFragment(), SpecialMergeHistory\showMergeForm(), SpecialProtectedpages\showOptions(), SpecialProtectedtitles\showOptions(), SpecialUndelete\showRevision(), XmlDumpWriter\sitename(), SpecialVersion\softwareInformation(), span(), XmlTest\testElementAttributes(), XmlTest\testElementEmpty(), XmlTest\testElementEscaping(), XmlTest\testElementOpen(), textarea(), ThumbnailImage\toHtml(), Preferences\validateSignature(), ImagePage\view(), XmlDumpWriter\writeContributor(), XmlDumpWriter\writeLogItem(), XmlDumpWriter\writeRevision(), XmlDumpWriter\writeTimestamp(), and XmlDumpWriter\writeUpload().

◆ elementClean()

static Xml::elementClean (   $element,
  $attribs = [],
  $contents = '' 
)
static

Format an XML element as with self::element(), but run text through the $wgContLang->normalize() validator first to ensure that no invalid UTF-8 is passed.

Parameters
string$element
array$attribsName=>value pairs. Values will be escaped.
string$contentsNull to make an open tag only; '' for a contentless closed tag (default)
Returns
string

Definition at line 91 of file Xml.php.

References $attribs, $wgContLang, element(), and global.

Referenced by XmlDumpWriter\openPage(), XmlDumpWriter\writeContributor(), XmlDumpWriter\writeLogItem(), XmlDumpWriter\writeRevision(), and XmlDumpWriter\writeUpload().

◆ encodeJsCall()

static Xml::encodeJsCall (   $name,
  $args,
  $pretty = false 
)
static

Create a call to a JavaScript function.

The supplied arguments will be encoded using Xml::encodeJsVar().

Since
1.17
Parameters
string$nameThe name of the function to call, or a JavaScript expression which evaluates to a function object which is called.
array$argsThe arguments to pass to the function.
bool$prettyIf true, add non-significant whitespace to improve readability.
Returns
string|bool String if successful; false upon failure

Definition at line 677 of file Xml.php.

References $args, as, and encodeJsVar().

Referenced by OutputPage\getBottomScripts(), ResourceLoaderModule\getDeprecationInformation(), EditPage\getEditToolbar(), ResourceLoaderClientHtml\getHeadHtml(), ResourceLoaderSyntaxHighlightVisualEditorModule\getScript(), ResourceLoaderJqueryMsgModule\getScript(), ResourceLoaderUserDefaultsModule\getScript(), ResourceLoaderSpecialCharacterDataModule\getScript(), ResourceLoaderLanguageNamesModule\getScript(), ResourceLoaderUserOptionsModule\getScript(), ResourceLoaderLanguageDataModule\getScript(), ResourceLoaderUserTokensModule\getScript(), GadgetHooks\makeLegacyWarning(), ResourceLoaderClientHtml\makeLoad(), and JavaScriptContentHandler\makeRedirectContent().

◆ encodeJsVar()

static Xml::encodeJsVar (   $value,
  $pretty = false 
)
static

Encode a variable of arbitrary type to JavaScript.

If the value is an XmlJsCode object, pass through the object's value verbatim.

Note
Only use this function for generating JavaScript code. If generating output for a proper JSON parser, just call FormatJson::encode() directly.
Parameters
mixed$valueThe value being encoded. Can be any type except a resource.
bool$prettyIf true, add non-significant whitespace to improve readability.
Returns
string|bool String if successful; false upon failure

Definition at line 659 of file Xml.php.

References $value, FormatJson\encode(), and FormatJson\UTF8_OK.

Referenced by encodeJsCall(), SpecialJavaScriptTest\exportQUnit(), ReCaptcha\getFormInformation(), HTMLReCaptchaField\getInputHTML(), XmlTest\testEncodeJsVarArray(), XmlTest\testEncodeJsVarBoolean(), XmlTest\testEncodeJsVarFloat(), XmlTest\testEncodeJsVarFloatString(), XmlTest\testEncodeJsVarInt(), XmlTest\testEncodeJsVarIntString(), XmlTest\testEncodeJsVarNull(), XmlTest\testEncodeJsVarObject(), and ResourceLoaderModule\validateScriptFile().

◆ escapeTagsOnly()

static Xml::escapeTagsOnly (   $in)
static

Replace " > and < with their respective HTML entities ( ", >, <)

Parameters
string$inText that might contain HTML tags.
Returns
string Escaped string

Definition at line 747 of file Xml.php.

Referenced by XmlTest\testEscapeTagsOnly().

◆ expandAttributes()

static Xml::expandAttributes (   $attribs)
static

Given an array of ('attributename' => 'value'), it generates the code to set the XML attributes : attributename="value".

The values are passed to Sanitizer::encodeAttribute. Returns null or empty string if no attributes given.

Parameters
array | null$attribsArray of attributes for an XML element
Exceptions
MWException
Returns
null|string

Definition at line 67 of file Xml.php.

References $attribs, $name, $out, and as.

Referenced by element(), VectorTemplate\execute(), openElement(), XmlTest\testExpandAttributes(), XmlTest\testExpandAttributesException(), and Linker\tooltip().

◆ fieldset()

static Xml::fieldset (   $legend = false,
  $content = false,
  $attribs = [] 
)
static

Shortcut for creating fieldsets.

Parameters
string | bool$legendLegend of the fieldset. If evaluates to false, legend is not added.
string$contentPre-escaped content for the fieldset. If false, only open fieldset is returned.
array$attribsAny attributes to fieldset-element.
Returns
string

Definition at line 609 of file Xml.php.

References $attribs, $s, closeElement(), element(), and openElement().

Referenced by AllMessagesTablePager\buildForm(), SpecialRecentChanges\doHeader(), SpecialWhatLinksHere\getFilterPanel(), SpecialContributions\getForm(), HTMLFormFieldCloner\getInputHTMLForKey(), HistoryAction\onView(), SpecialInterwiki\showForm(), SpecialEditTags\showForm(), SpecialImport\showForm(), SpecialRevisionDelete\showForm(), LogEventsList\showOptions(), UserrightsPage\switchForm(), XmlTest\testFieldset(), SpecialWhatLinksHere\whatlinkshereForm(), HTMLForm\wrapFieldSetSection(), and HTMLForm\wrapForm().

◆ input()

◆ inputLabel()

static Xml::inputLabel (   $label,
  $name,
  $id,
  $size = false,
  $value = false,
  $attribs = [] 
)
static

Convenience function to build an HTML text input field with a label.

Parameters
string$labelText of the label
string$nameValue of the name attribute
string$idId of the input
int | bool$sizeValue of the size attribute
string | bool$valueValue of the value attribute
array$attribsOther attributes
Returns
string HTML

Definition at line 380 of file Xml.php.

References $attribs, $input, $name, $value, inputLabelSep(), and list.

Referenced by LogEventsList\getExtraInputs(), LogEventsList\getTitleInput(), LogEventsList\getUserInput(), SpecialNuke\listForm(), UserrightsPage\switchForm(), and SpecialWhatLinksHere\whatlinkshereForm().

◆ inputLabelSep()

static Xml::inputLabelSep (   $label,
  $name,
  $id,
  $size = false,
  $value = false,
  $attribs = [] 
)
static

Same as Xml::inputLabel() but return input and label in an array.

Parameters
string$label
string$name
string$id
int | bool$size
string | bool$value
array$attribs
Returns
array

Definition at line 399 of file Xml.php.

References $attribs, $name, $value, input(), and label().

Referenced by SpecialRecentChanges\categoryFilterForm(), and inputLabel().

◆ isWellFormed()

static Xml::isWellFormed (   $text)
staticprivate

Check if a string is well-formed XML.

Must include the surrounding tag. This function is a DoS vector if an attacker can define entities in $text.

Parameters
string$textString to test.
Returns
bool
Todo:
Error position reporting return

Definition at line 702 of file Xml.php.

References $parser.

Referenced by isWellFormedXmlFragment().

◆ isWellFormedXmlFragment()

static Xml::isWellFormedXmlFragment (   $text)
static

Check if a string is a well-formed XML fragment.

Wraps fragment in an \<html\> bit and doctype, so it can be a fragment and can use HTML named entities.

Parameters
string$text
Returns
bool

Definition at line 730 of file Xml.php.

References $html, and isWellFormed().

◆ label()

◆ languageSelector()

static Xml::languageSelector (   $selected,
  $customisedOnly = true,
  $inLanguage = null,
  $overrideAttrs = [],
Message  $msg = null 
)
static

Construct a language selector appropriate for use in a form or preferences.

Parameters
string$selectedThe language code of the selected language
bool$customisedOnlyIf true only languages which have some content are listed
string$inLanguageThe ISO code of the language to display the select list in (optional)
array$overrideAttrsOverride the attributes of the select tag (since 1.20)
Message | null$msgLabel message key (since 1.20)
Returns
array Array containing 2 items: label HTML and select list HTML

Definition at line 204 of file Xml.php.

References $code, $languages, $name, $options, $wgLanguageCode, as, Language\fetchLanguageNames(), global, label(), option(), and wfMessage().

Referenced by AllMessagesTablePager\buildForm(), and XmlTest\testLanguageSelector().

◆ listDropDown()

static Xml::listDropDown (   $name = '',
  $list = '',
  $other = '',
  $selected = '',
  $class = '',
  $tabindex = null 
)
static

Build a drop-down box from a textual list.

This is a wrapper for Xml::listDropDownOptions() plus the XmlSelect class.

Parameters
string$nameName and id for the drop-down
string$listCorrectly formatted text (newline delimited) to be used to generate the options.
string$otherText for the "Other reasons" option
string$selectedOption which should be pre-selected
string$classCSS classes for the drop-down
int$tabindexValue of the tabindex attribute
Returns
string

Definition at line 508 of file Xml.php.

References $name, $options, $tabindex, and listDropDownOptions().

Referenced by ProtectionForm\buildForm(), FileDeleteForm\showForm(), SpecialRevisionDelete\showForm(), and XmlTest\testListDropDown().

◆ listDropDownOptions()

static Xml::listDropDownOptions (   $list,
  $params = [] 
)
static

Build options for a drop-down box from a textual list.

The result of this function can be passed to XmlSelect::addOptions() (to render a plain <select> dropdown box) or to Xml::listDropDownOptionsOoui() and then OOUI\DropdownInputWidget() (to render a pretty one).

Parameters
string$listCorrectly formatted text (newline delimited) to be used to generate the options.
array$paramsExtra parameters
string$params,['other']If set, add an option with this as text and a value of 'other'
Returns
array Array keys are textual labels, values are internal values

Definition at line 539 of file Xml.php.

References $opt, $options, $params, $value, and as.

Referenced by Article\confirmDelete(), HTMLFormField\getOptions(), listDropDown(), and XmlTest\testListDropDownOptions().

◆ listDropDownOptionsOoui()

static Xml::listDropDownOptionsOoui (   $options)
static

Convert options for a drop-down box into a format accepted by OOUI\DropdownInputWidget etc.

TODO Find a better home for this function.

Parameters
array$optionsOptions, as returned e.g. by Xml::listDropDownOptions()
Returns
array

Definition at line 581 of file Xml.php.

References $options, $value, as, and string.

Referenced by Article\confirmDelete(), HTMLFormField\getOptionsOOUI(), and XmlTest\testListDropDownOptionsOoui().

◆ monthSelector()

static Xml::monthSelector (   $selected = '',
  $allmonths = null,
  $id = 'month' 
)
static

Create a date selector.

Parameters
string$selectedThe month which should be selected, default ''.
string$allmonthsValue of a special item denoting all month. Null to not include (default).
string$idElement identifier
Returns
string Html string containing the month selector

Definition at line 144 of file Xml.php.

References $options, $wgLang, global, and wfMessage().

Referenced by dateMenu().

◆ openElement()

static Xml::openElement (   $element,
  $attribs = null 
)
static

This opens an XML element.

Parameters
string$elementName of the element
array$attribsArray of attributes, see Xml::expandAttributes()
Returns
string

Definition at line 109 of file Xml.php.

References $attribs, and expandAttributes().

Referenced by ImageHistoryList\beginImageHistoryList(), AllMessagesTablePager\buildForm(), ProtectionForm\buildForm(), buildForm(), buildTable(), buildTableRow(), checkLabel(), EditPage\displayPreviewArea(), SpecialRecentChanges\doHeader(), SpecialWatchlist\doHeader(), SpecialRenameuser\execute(), SpecialStatistics\execute(), SpecialListGroupRights\execute(), QueryPage\execute(), SiteExporter\exportSite(), SiteExporter\exportSites(), fieldset(), AllMessagesTablePager\formatRow(), SpecialStatistics\formatRowHeader(), InputBox\getCommentForm(), InputBox\getCreateForm(), SpecialStatistics\getEditStats(), SpecialVersion\getExtensionCredits(), InputBox\getMoveForm(), SpecialStatistics\getPageStats(), InputBox\getSearchForm(), InputBox\getSearchForm2(), MysqlInstaller\getSettingsForm(), SpecialVersion\getSkinCredits(), AllMessagesTablePager\getStartBody(), SpecialStatistics\getUserStats(), UserrightsPage\groupCheckboxes(), SpecialNuke\listForm(), SpecialWhatLinksHere\listItem(), SpecialWhatLinksHere\listStart(), SpecialPrefixindex\namespacePrefixForm(), ImagePage\openShowImage(), SpecialListGroupRights\outputNamespaceProtectionInfo(), MediaWiki\Widget\Search\SearchFormWidget\render(), SpecialWatchlist\setTopText(), EditPage\showEditForm(), UserrightsPage\showEditUserGroupsForm(), SpecialUndelete\showFileConfirmationForm(), SpecialEditTags\showForm(), FileDeleteForm\showForm(), SpecialImport\showForm(), SpecialRevisionDelete\showForm(), SpecialMergeHistory\showHistory(), LogEventsList\showLogExtract(), SpecialGadgets\showMainForm(), SpecialMergeHistory\showMergeForm(), Article\showMissingArticle(), SpecialProtectedpages\showOptions(), SpecialUndelete\showRevision(), SpecialVersion\softwareInformation(), tags(), XmlTest\testOpenElement(), TraditionalImageGallery\toHTML(), SpecialRevisionDelete\tryShowFile(), ImagePage\view(), and SpecialWhatLinksHere\whatlinkshereForm().

◆ option()

static Xml::option (   $text,
  $value = null,
  $selected = false,
  $attribs = [] 
)
static

Convenience function to build an HTML drop-down list item.

Parameters
string$textText for this item. Will be HTML escaped
string$valueForm submission value; if empty, use text
bool$selectedIf true, will be the default selected item
array$attribsOptional additional HTML attributes
Returns
string HTML

Definition at line 484 of file Xml.php.

References $attribs, $value, and Html\element().

Referenced by ImagePage\doRenderLangOpt(), XmlSelect\formatOptions(), SpecialProtectedtitles\getLevelMenu(), SpecialProtectedpages\getLevelMenu(), SpecialProtectedpages\getTypeMenu(), languageSelector(), ImagePage\openShowImage(), and SpecialImport\showForm().

◆ password()

static Xml::password (   $name,
  $size = false,
  $value = false,
  $attribs = [] 
)
static

Convenience function to build an HTML password input field.

Parameters
string$nameValue of the name attribute
int$sizeValue of the size attribute
mixed$valueValue of the value attribute
array$attribsOther attributes
Returns
string HTML

Definition at line 297 of file Xml.php.

References $attribs, $name, $value, and input().

◆ radio()

static Xml::radio (   $name,
  $value,
  $checked = false,
  $attribs = [] 
)
static

Convenience function to build an HTML radio button.

Parameters
string$nameValue of the name attribute
string$valueValue of the value attribute
bool$checkedWhether the checkbox is checked or not
array$attribsOther attributes
Returns
string HTML

Definition at line 341 of file Xml.php.

References $attribs, $name, $value, and element().

Referenced by SpecialRevisionDelete\buildCheckBoxes(), HTMLRadioField\formatOptions(), SpecialMergeHistory\formatRevisionRow(), WebInstaller\getRadioElements(), and radioLabel().

◆ radioLabel()

static Xml::radioLabel (   $label,
  $name,
  $value,
  $id,
  $checked = false,
  $attribs = [] 
)
static

Convenience function to build an HTML radio button with a label.

Parameters
string$label
string$name
string$value
string$id
bool$checked
array$attribs
Returns
string HTML

Definition at line 444 of file Xml.php.

References $attribs, $name, $value, label(), and radio().

Referenced by AllMessagesTablePager\buildForm(), WebInstallerDBConnect\execute(), SpecialContributions\getForm(), HTMLSizeFilterField\getInputHTML(), SpecialImport\getMappingFormPart(), and SpecialProtectedpages\getSizeLimit().

◆ span()

static Xml::span (   $text,
  $class,
  $attribs = [] 
)
static

Shortcut to make a span element.

Parameters
string$textContent of the element, will be escaped
string$classClass name of the span element
array$attribsOther attributes
Returns
string

Definition at line 250 of file Xml.php.

References $attribs, and element().

◆ submitButton()

◆ tags()

static Xml::tags (   $element,
  $attribs = null,
  $contents 
)
static

Same as Xml::element(), but does not escape contents.

Handy when the content you have is already valid xml.

Parameters
string$elementElement name
array$attribsArray of attributes
string$contentsContent of the element
Returns
string

Definition at line 131 of file Xml.php.

References $attribs, and openElement().

Referenced by SpecialRevisionDelete\buildCheckBoxes(), buildForm(), ImportReporter\close(), SpecialRecentChanges\doHeader(), SpecialTags\doTagRow(), SpecialUndelete\formatRevisionRow(), AllMessagesTablePager\formatRow(), SpecialStatistics\formatRowHeader(), ChangeTags\formatSummaryRow(), PreferencesForm\getButtons(), EditPage\getCheckboxes(), SpecialStatistics\getEditStats(), SpecialContributions\getForm(), ChangeTagsRevisionItem\getHTML(), ChangeTagsLogItem\getHTML(), RevDelRevisionItem\getHTML(), SpecialProtectedtitles\getLevelMenu(), SpecialProtectedpages\getLevelMenu(), SpecialStatistics\getPageStats(), GadgetHooks\getPreferences(), WebInstaller\getRadioElements(), HistoryPager\getStartBody(), EditPage\getSummaryInput(), EditPage\getSummaryPreview(), SpecialProtectedpages\getTypeMenu(), SpecialStatistics\getUserStats(), UserrightsPage\groupCheckboxes(), HistoryPager\historyLine(), WebInstaller\label(), MediaTransformOutput\linkWrap(), SpecialNuke\listForm(), SpecialWhatLinksHere\listItem(), ImagePage\openShowImage(), MediaWiki\Widget\Search\SearchFormWidget\profileTabsHtml(), InputBox\render(), Linker\revDeleteLink(), Linker\revDeleteLinkDisabled(), MediaWiki\Widget\Search\SearchFormWidget\shortDialogHtml(), SpecialRevisionDelete\showForm(), LogEventsList\showOptions(), SpecialTags\showTagList(), wrapClass(), PreferencesForm\wrapForm(), and TableDiffFormatter\wrapLine().

◆ textarea()

static Xml::textarea (   $name,
  $content,
  $cols = 40,
  $rows = 5,
  $attribs = [] 
)
static

Shortcut for creating textareas.

Parameters
string$nameThe 'name' for the textarea
string$contentContent for the textarea
int$colsThe number of columns for the textarea
int$rowsThe number of rows for the textarea
array$attribsAny other attributes for the textarea
Returns
string

Definition at line 635 of file Xml.php.

References $attribs, $name, $rows, element(), and Html\getTextInputAttributes().

Referenced by WebInstaller\getTextArea(), SpecialExpandTemplates\makeOutput(), XmlTest\testTextareaAttribs(), and XmlTest\testTextareaNoContent().

◆ wrapClass()

static Xml::wrapClass (   $text,
  $class,
  $tag = 'span',
  $attribs = [] 
)
static

Shortcut to make a specific element with a class attribute.

Parameters
string$textContent of the element, will be escaped
string$classClass name of the span element
string$tagElement name
array$attribsOther attributes
Returns
string

Definition at line 262 of file Xml.php.

References $attribs, and tags().

Referenced by SpecialWhatLinksHere\listItem().


The documentation for this class was generated from the following file: