MediaWiki
1.34.4
|
This class is a collection of static functions that serve two purposes: More...
Static Public Member Functions | |
static | buttonAttributes (array $attrs, array $modifiers=[]) |
Modifies a set of attributes meant for button elements and apply a set of default attributes when $wgUseMediaWikiUIEverywhere enabled. More... | |
static | check ( $name, $checked=false, array $attribs=[]) |
Convenience function to produce a checkbox (input element with type=checkbox) More... | |
static | closeElement ( $element) |
Returns "</$element>". More... | |
static | element ( $element, $attribs=[], $contents='') |
Identical to rawElement(), but HTML-escapes $contents (like Xml::element()). More... | |
static | errorBox ( $html, $heading='', $className='') |
Return an error box. More... | |
static | expandAttributes (array $attribs) |
Given an associative array of element attributes, generate a string to stick after the element name in HTML output. More... | |
static | getTextInputAttributes (array $attrs) |
Modifies a set of attributes meant for text input elements and apply a set of default attributes. More... | |
static | hidden ( $name, $value, array $attribs=[]) |
Convenience function to produce an input element with type=hidden. More... | |
static | htmlHeader (array $attribs=[]) |
Constructs the opening html-tag with necessary doctypes depending on global variables. More... | |
static | infoBox ( $rawHtml, $icon, $alt, $class='') |
Get HTML for an information message box with an icon. More... | |
static | inlineScript ( $contents, $nonce=null) |
Output an HTML script tag with the given contents. More... | |
static | inlineStyle ( $contents, $media='all', $attribs=[]) |
Output a "<style>" tag with the given contents for the given media type (if any). More... | |
static | input ( $name, $value='', $type='text', array $attribs=[]) |
Convenience function to produce an "<input>" element. More... | |
static | isXmlMimeType ( $mimetype) |
Determines if the given MIME type is xml. More... | |
static | label ( $label, $id, array $attribs=[]) |
Convenience function for generating a label for inputs. More... | |
static | linkButton ( $text, array $attrs, array $modifiers=[]) |
Returns an HTML link element in a string styled as a button (when $wgUseMediaWikiUIEverywhere is enabled). More... | |
static | linkedScript ( $url, $nonce=null) |
Output a "<script>" tag linking to the given URL, e.g., "<script src=foo.js></script>". More... | |
static | linkedStyle ( $url, $media='all') |
Output a "<link rel=stylesheet>" linking to the given URL for the given media type (if any). More... | |
static | namespaceSelector (array $params=[], array $selectAttribs=[]) |
Build a drop-down box for selecting a namespace. More... | |
static | namespaceSelectorOptions (array $params=[]) |
Helper for Html::namespaceSelector(). More... | |
static | openElement ( $element, $attribs=[]) |
Identical to rawElement(), but has no third parameter and omits the end tag (and the self-closing '/' in XML mode for empty elements). More... | |
static | radio ( $name, $checked=false, array $attribs=[]) |
Convenience function to produce a radio button (input element with type=radio) More... | |
static | rawElement ( $element, $attribs=[], $contents='') |
Returns an HTML element in a string. More... | |
static | srcSet (array $urls) |
Generate a srcset attribute value. More... | |
static | submitButton ( $contents, array $attrs, array $modifiers=[]) |
Returns an HTML link element in a string styled as a button (when $wgUseMediaWikiUIEverywhere is enabled). More... | |
static | successBox ( $html, $className='') |
Return a success box. More... | |
static | textarea ( $name, $value='', array $attribs=[]) |
Convenience function to produce a <textarea> element. More... | |
static | warningBox ( $html, $className='') |
Return a warning box. More... | |
Static Private Member Functions | |
static | dropDefaults ( $element, array $attribs) |
Given an element name and an associative array of element attributes, return an array that is functionally identical to the input array, but possibly smaller. More... | |
static | messageBox ( $html, $className, $heading='') |
Return the HTML for a message box. More... | |
Static Private Attributes | |
static | $boolAttribs |
static | $voidElements |
This class is a collection of static functions that serve two purposes:
1) Implement any algorithms specified by HTML5, or other HTML specifications, in a convenient and self-contained way.
2) Allow HTML elements to be conveniently and safely generated, like the current Xml class but a) less confused (Xml supports HTML-specific things, but only sometimes!) and b) not necessarily confined to XML-compatible output.
There are two important configuration options this class uses:
$wgMimeType: If this is set to an xml MIME type then output should be valid XHTML5.
This class is meant to be confined to utility functions that are called from trusted code paths. It does not do enforcement of policy like not allowing elements.
|
static |
Modifies a set of attributes meant for button elements and apply a set of default attributes when $wgUseMediaWikiUIEverywhere enabled.
array | $attrs | HTML attributes in an associative array |
string[] | $modifiers | classes to add to the button |
Definition at line 110 of file Html.php.
References $wgUseMediaWikiUIEverywhere.
Referenced by input().
|
static |
Convenience function to produce a checkbox (input element with type=checkbox)
string | $name | Name attribute |
bool | $checked | Whether the checkbox is checked or not |
array | $attribs | Array of additional attributes |
Definition at line 688 of file Html.php.
References input().
Referenced by SpecialWatchlist\showHideCheck().
|
static |
Returns "</$element>".
string | $element | Name of the element, e.g., 'a' |
Definition at line 315 of file Html.php.
Referenced by CategoryViewer\columnList(), SpecialContributions\contributionsSub(), TimelessTemplate\execute(), SpecialCategories\execute(), MonoBookTemplate\execute(), SpecialListGrants\execute(), SpecialTrackingCategories\execute(), Scribunto_LuaEngine\formatHtmlLogs(), Scribunto_LuaSandboxEngine\formatLimitData(), SpecialGadgetUsage\formatResult(), TablePager\formatRow(), AllMessagesTablePager\formatRow(), SpecialLog\getActionButtons(), TimelessTemplate\getAfterContent(), SpecialChangeCredentials\getAuthForm(), TimelessTemplate\getCatList(), PostgresInstaller\getConnectForm(), MysqlInstaller\getConnectForm(), TimelessTemplate\getContentSub(), SpecialVersion\getCreditsForExtension(), AllMessagesTablePager\getEndBody(), SpecialVersion\getEntryPointInfo(), SpecialVersion\getExternalLibraries(), BaseTemplate\getFooter(), FancyCaptcha\getFormInformation(), ApiHelp\getHelpInternal(), HTMLFancyCaptchaField\getInputHTML(), DatabaseInstaller\getInstallUserBox(), TimelessTemplate\getLogo(), HTMLMultiSelectField\getOneCheckbox(), HTMLCheckMatrix\getOneCheckboxHTML(), TimelessTemplate\getPortlet(), MonoBookTemplate\getPortlet(), EditPage\getPreviewLimitReport(), TimelessTemplate\getSearch(), MonoBookTemplate\getSimpleFooter(), CategoryTree\getTag(), TimelessTemplate\getUserLinks(), DatabaseInstaller\getWebUserBox(), SpecialVersion\getWgHooks(), OutputPage\headElement(), HistoryPager\historyLine(), ImagePage\imageLinks(), infoBox(), ChangesList\insertLogEntry(), ChangesListSpecialPage\makeLegend(), SpecialInterwiki\makeTable(), ApiMain\modifyHelp(), namespaceSelector(), ConfirmEditHooks\onAlternateEditPreview(), TitleBlacklistHooks\onValidateBlacklist(), SpecialVersion\openExtType(), WebInstallerOutput\outputFooter(), SpecialSpecialpages\outputPageList(), SpecialGadgetUsage\outputResults(), SpecialMediaStatistics\outputTableEnd(), SpecialGadgetUsage\outputTableEnd(), SpecialGadgetUsage\outputTableStart(), SyntaxHighlight\parserHook(), rawElement(), SpecialAllPages\showChunk(), SpecialExpandTemplates\showHtmlPreview(), SpecialGadgets\showMainForm(), SpecialPrefixindex\showPrefixChunk(), SpecialChangeCredentials\showSubpageList(), and UserrightsPage\switchForm().
|
staticprivate |
Given an element name and an associative array of element attributes, return an array that is functionally identical to the input array, but possibly smaller.
In particular, attributes might be stripped if they are given their default values.
This method is not guaranteed to remove all redundant attributes, only some common ones and some others selected arbitrarily at random. It only guarantees that the output array should be functionally identical to the input array (currently per the HTML 5 draft as of 2009-09-06).
string | $element | Name of the element, e.g., 'a' |
array | $attribs | Associative array of attributes, e.g., [ 'href' => 'https://www.mediawiki.org/' ]. See expandAttributes() for further documentation. |
Definition at line 338 of file Html.php.
References $type.
|
static |
Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).
string | $element | Name of the element, e.g., 'a' |
array | $attribs | Associative array of attributes, e.g., [ 'href' => 'https://www.mediawiki.org/' ]. See expandAttributes() for further documentation. |
string | $contents |
Definition at line 231 of file Html.php.
References rawElement().
Referenced by OutputPage\addElement(), MediaWiki\Extension\OATHAuth\Special\OATHManage\addHeading(), JsonContent\arrayTable(), OutputPage\buildExemptModules(), ListToggle\checkboxLink(), ApiFormatBase\closePrinter(), Revision\RevisionRenderer\combineSlotOutput(), SimpleCaptcha\confirmEditMerged(), MWDebug\deprecated(), SpecialRecentChanges\doHeader(), SpecialWatchlist\doHeader(), TimelessTemplate\execute(), WebInstallerOptions\execute(), WebInstallerDBConnect\execute(), MonoBookTemplate\execute(), SpecialListGrants\execute(), SpecialPreferences\execute(), SpecialVersion\execute(), UserrightsPage\execute(), OutputPage\feedLink(), Parser\finalizeHeadings(), ChangesList\flag(), Scribunto_LuaEngine\formatHtmlLogs(), Scribunto_LuaSandboxEngine\formatLimitData(), PageQueryPage\formatResult(), SpecialFewestRevisions\formatResult(), SpecialMostLinkedCategories\formatResult(), SpecialMostCategories\formatResult(), SpecialMostInterwikis\formatResult(), SpecialMostLinkedTemplates\formatResult(), SpecialMostLinked\formatResult(), SpecialUnwatchedPages\formatResult(), SpecialShortPages\formatResult(), SpecialGadgetUsage\formatResult(), SpecialPagesWithProp\formatResult(), SpecialProtectedtitles\formatRow(), AllMessagesTablePager\formatRow(), SpecialNewpages\formatRow(), ProtectedPagesPager\formatValue(), SpecialLog\getActionButtons(), SpecialChangeCredentials\getAuthForm(), VFormHTMLForm\getButtons(), HTMLForm\getButtons(), WebInstallerOptions\getCCChooser(), WebInstallerOptions\getCCDoneBox(), BaseTemplate\getClear(), PostgresInstaller\getConnectForm(), MysqlInstaller\getConnectForm(), SpecialVersion\getCreditsForExtension(), UploadForm\getDescriptionSection(), MediaWiki\Extension\OATHAuth\HTMLForm\TOTPEnableForm\getDescriptors(), FeedUtils\getDiffLink(), TablePager\getEmptyBody(), SpecialVersion\getEntryPointInfo(), SpecialVersion\getExternalLibraries(), LoginSignupSpecialPage\getFieldDefinitions(), ReCaptchaNoCaptcha\getFormInformation(), MediaWiki\Extensions\ConfirmEdit\hCaptcha\HCaptcha\getFormInformation(), QuestyCaptcha\getFormInformation(), FancyCaptcha\getFormInformation(), TimelessTemplate\getHeaderHack(), OutputPage\getHeadLinksArray(), ApiHelp\getHelpInternal(), HTMLFancyCaptchaField\getInputHTML(), HTMLReCaptchaNoCaptchaField\getInputHTML(), MediaWiki\Extensions\ConfirmEdit\hCaptcha\HTMLHCaptchaField\getInputHTML(), HTMLButtonField\getInputHTML(), HTMLCheckMatrix\getInputHTML(), DatabaseInstaller\getInstallUserBox(), UploadSourceField\getLabelHtml(), EnhancedChangesList\getLineData(), RevDelFileItem\getLink(), TimelessTemplate\getLogoImage(), MonoBookTemplate\getMobileNavigationIcon(), HTMLCheckMatrix\getOneCheckboxHTML(), WebInstaller\getPageListItem(), SpecialVersion\getParserTags(), MediaWiki\Block\DatabaseBlock\getRedactedName(), HistoryPager\getRevisionButton(), TimelessTemplate\getSidebarChunk(), DifferenceEngine\getSlotHeader(), TablePager\getStartBody(), ParserOutput\getText(), TimelessTemplate\getUserLinks(), SpecialVersion\getVersionLinkedGit(), DatabaseInstaller\getWebUserBox(), SpecialVersion\getWgHooks(), OutputPage\headElement(), ImageHistoryList\imageHistoryLine(), infoBox(), input(), ScribuntoHooks\invokeHook(), label(), linkButton(), linkedScript(), linkedStyle(), Linker\makeBrokenImageLinkObj(), Linker\makeExternalImage(), Skin\makeFooterIcon(), InfoAction\makeHeader(), ChangesListSpecialPage\makeLegend(), WebInstaller\makeLinkItem(), SpecialBookSources\makeListItem(), ResourceLoaderClientHtml\makeLoad(), LogFormatter\makePageLink(), WebInstallerOptions\makeScreenshotsLink(), BaseTemplate\makeSearchButton(), BaseTemplate\makeSearchInput(), SpecialInterwiki\makeTable(), messageBox(), ApiMain\modifyHelp(), namespaceSelector(), MediaWiki\Navigation\PrevNextNavigationRenderer\numLink(), Language\numLink(), JsonContent\objectRow(), JsonContent\objectTable(), ConfirmEditHooks\onAlternateEditPreview(), TitleBlacklistHooks\onValidateBlacklist(), InfoAction\onView(), SpecialVersion\openExtType(), Xml\option(), SpecialMediaStatistics\outputMediaType(), SpecialListGroupRights\outputNamespaceProtectionInfo(), SpecialGadgetUsage\outputResults(), SpecialGadgetUsage\outputTableStart(), InfoAction\pageInfo(), SyntaxHighlight\plainCodeWrap(), VectorTemplate\renderNavigation(), CategoryTree\renderNodeInfo(), MWExceptionRenderer\reportHTML(), ImportReporter\reportNotice(), MWExceptionRenderer\reportOutageHTML(), JsonContent\rootValueTable(), ApiScribuntoConsole\runConsole(), ChangesList\showCharacterDifference(), SpecialAllPages\showChunk(), DifferenceEngine\showDiffPage(), SpecialImport\showForm(), SpecialReplaceText\showForm(), SpecialUndelete\showHistory(), SpecialBlockList\showList(), SpecialUndelete\showList(), SpecialGadgets\showMainForm(), SpecialPrefixindex\showPrefixChunk(), McrUndoAction\showPreview(), SpecialChangeCredentials\showSubpageList(), SpecialUploadStash\showUploads(), WebInstaller\startPageWrapper(), submitButton(), Xml\submitButton(), textarea(), Linker\tocLine(), Linker\tocList(), ImagePage\uploadLinksBox(), and JsonContent\valueCell().
|
static |
Return an error box.
string | $html | of contents of error box |
string | $heading | (optional) |
string | $className | (optional) corresponding to box |
Definition at line 739 of file Html.php.
References messageBox().
Referenced by SpecialRecentChangesLinked\doMainQuery(), MWException\getHTML(), WebInstaller\showError(), MovePageForm\showForm(), SpecialSearch\showResults(), and WebInstaller\showStatusBox().
|
static |
Given an associative array of element attributes, generate a string to stick after the element name in HTML output.
Like [ 'href' => 'https://www.mediawiki.org/' ] becomes something like ' href="https://www.mediawiki.org"'. Again, this is like Xml::expandAttributes(), but it implements some HTML-specific logic.
Attributes that can contain space-separated lists ('class', 'accesskey' and 'rel') array values are allowed as well, which will automagically be normalized and converted to a space-separated string. In addition to a numerical array, the attribute value may also be an associative array. See the example below for how that works.
array | $attribs | Associative array of attributes, e.g., [ 'href' => 'https://www.mediawiki.org/' ]. Values will be HTML-escaped. A value of false or null means to omit the attribute. For boolean attributes, you can omit the key, e.g., [ 'checked' ] instead of [ 'checked' => 'checked' ] or such. |
MWException | If an attribute that doesn't allow lists is set to an array |
Definition at line 480 of file Html.php.
References Sanitizer\encodeAttribute().
Referenced by LanguageConverter\autoConvert(), EnhancedChangesList\getLineData(), openElement(), and Cite\refArg().
|
static |
Modifies a set of attributes meant for text input elements and apply a set of default attributes.
Removes size attribute when $wgUseMediaWikiUIEverywhere enabled.
array | $attrs | An attribute array. |
Definition at line 137 of file Html.php.
References $wgUseMediaWikiUIEverywhere.
Referenced by Xml\input(), input(), and Xml\textarea().
|
static |
Convenience function to produce an input element with type=hidden.
string | $name | Name attribute |
string | $value | Value attribute |
array | $attribs | Associative array of miscellaneous extra attributes, passed to Html::element() |
Definition at line 802 of file Html.php.
References input().
Referenced by SpecialEditTags\buildCheckBoxes(), ProtectionForm\buildForm(), Article\confirmDelete(), MediaWiki\Preferences\DefaultPreferencesFactory\datetimePreferences(), SpecialRecentChanges\doHeader(), SpecialWatchlist\doHeader(), ImagePage\doRenderLangOpt(), WebInstallerPage\endForm(), WebInstallerOptions\execute(), WebInstallerLanguage\execute(), SpecialRenameuser\execute(), SpecialLog\getActionButtons(), InputBox\getCommentForm(), InputBox\getCreateForm(), MathCaptcha\getFormInformation(), TablePager\getHiddenFields(), HTMLForm\getHiddenFields(), HTMLFormFieldCloner\getInputHTMLForKey(), HTMLFormFieldCloner\getInputOOUIForKey(), InputBox\getMoveForm(), TimelessTemplate\getSearch(), MonoBookTemplate\getSearchBox(), InputBox\getSearchForm(), HistoryPager\getStartBody(), UserrightsPage\groupCheckboxes(), SpecialNuke\listForm(), ImagePage\openShowImage(), SpecialReplaceText\pageListForm(), MediaWiki\Widget\Search\SearchFormWidget\powerSearchBox(), VectorTemplate\renderNavigation(), SpecialWatchlist\setTopText(), MediaWiki\Widget\Search\SearchFormWidget\shortDialogHtml(), EditPage\showEditForm(), UserrightsPage\showEditUserGroupsForm(), MovePageForm\showForm(), SpecialEditTags\showForm(), FileDeleteForm\showForm(), SpecialImport\showForm(), SpecialRevisionDelete\showForm(), SpecialReplaceText\showForm(), EditPage\showFormAfterText(), EditPage\showFormBeforeText(), SpecialMergeHistory\showHistory(), SpecialUndelete\showHistory(), SpecialMergeHistory\showMergeForm(), SpecialUndelete\showSearchForm(), UserrightsPage\switchForm(), and SpecialWhatLinksHere\whatlinkshereForm().
|
static |
Constructs the opening html-tag with necessary doctypes depending on global variables.
array | $attribs | Associative array of miscellaneous extra attributes, passed to Html::element() of html tag. |
Definition at line 965 of file Html.php.
References $wgHtml5Version, $wgMimeType, $wgXhtmlNamespaces, isXmlMimeType(), and openElement().
Referenced by OutputPage\headElement(), WebInstallerOutput\outputHeader(), and WebInstallerOutput\outputShortHeader().
|
static |
Get HTML for an information message box with an icon.
Definition at line 1021 of file Html.php.
References $s, closeElement(), element(), and openElement().
Referenced by WebInstaller\getInfoBox().
|
static |
Output an HTML script tag with the given contents.
It is unsupported for the contents to contain the sequence <script
or </script
(case-insensitive). This ensures the script can be terminated easily and consistently. It is the responsibility of the caller to avoid such character sequence by escaping or avoiding it. If found at run-time, the contents are replaced with a comment, and a warning is logged server-side.
string | $contents | JavaScript |
string | null | $nonce | Nonce for CSP header, from OutputPage::getCSPNonce() |
Definition at line 572 of file Html.php.
References RequestContext\getMain(), ContentSecurityPolicy\isNonceRequired(), rawElement(), wfLogWarning(), and wfWarn().
Referenced by OutputPage\addInlineScript(), WebInstallerOptions\execute(), and ResourceLoaderClientHtml\getHeadHtml().
|
static |
Output a "<style>" tag with the given contents for the given media type (if any).
TODO: do some useful escaping as well, like if $contents contains literal "</style>" (admittedly unlikely).
string | $contents | CSS |
string | $media | A media type string, like 'screen' |
array | $attribs | (since 1.31) Associative array of attributes, e.g., [ 'href' => 'https://www.mediawiki.org/' ]. See expandAttributes() for further documentation. |
Definition at line 619 of file Html.php.
References rawElement().
Referenced by OutputPage\addInlineStyle(), and ResourceLoaderClientHtml\makeLoad().
|
static |
Convenience function to produce an "<input>" element.
This supports the new HTML5 input types and attributes.
string | $name | Name attribute |
string | $value | Value attribute |
string | $type | Type attribute |
array | $attribs | Associative array of miscellaneous extra attributes, passed to Html::element() |
Definition at line 667 of file Html.php.
References $type, buttonAttributes(), element(), and getTextInputAttributes().
Referenced by check(), Xml\dateMenu(), MathCaptcha\getFormInformation(), HTMLSelectOrOtherField\getInputHTML(), HTMLSelectAndOtherField\getInputHTML(), HTMLFormFieldWithButton\getInputHTML(), HTMLTextField\getInputHTML(), hidden(), radio(), and SpecialImport\showForm().
|
static |
Determines if the given MIME type is xml.
string | $mimetype | MIME type |
Definition at line 1003 of file Html.php.
Referenced by OutputPage\headElement(), and htmlHeader().
|
static |
Convenience function for generating a label for inputs.
string | $label | Contents of the label |
string | $id | ID of the element being labeled |
array | $attribs | Additional attributes |
Definition at line 786 of file Html.php.
References element().
Referenced by Linker\tocList().
|
static |
Returns an HTML link element in a string styled as a button (when $wgUseMediaWikiUIEverywhere is enabled).
string | $text | The text of the element. Will be escaped (not raw HTML) |
array | $attrs | Associative array of attributes, e.g., [ 'href' => 'https://www.mediawiki.org/' ]. See expandAttributes() for further documentation. |
string[] | $modifiers | classes to add to the button |
Definition at line 165 of file Html.php.
References element().
Referenced by EditPage\showStandardInputs().
|
static |
Output a "<script>" tag linking to the given URL, e.g., "<script src=foo.js></script>".
string | $url | |
string | null | $nonce | Nonce for CSP header, from OutputPage::getCSPNonce() |
Definition at line 596 of file Html.php.
References element(), RequestContext\getMain(), ContentSecurityPolicy\isNonceRequired(), and wfWarn().
Referenced by OutputPage\addScriptFile(), WebInstallerOutput\getJQuery(), OutputPage\headElement(), WebInstallerOutput\outputHeader(), WebInstallerOutput\outputShortHeader(), and SpecialJavaScriptTest\plainQUnit().
|
static |
Output a "<link rel=stylesheet>" linking to the given URL for the given media type (if any).
string | $url | |
string | $media | A media type string, like 'screen' |
Definition at line 648 of file Html.php.
References element().
Referenced by WebInstallerOutput\getCssUrl(), ResourceLoaderClientHtml\makeLoad(), and OutputPage\styleLink().
|
staticprivate |
Return the HTML for a message box.
string | $html | of contents of box |
string | array | $className | corresponding to box |
string | $heading | (optional) |
Definition at line 711 of file Html.php.
References element(), and rawElement().
Referenced by errorBox(), successBox(), and warningBox().
|
static |
Build a drop-down box for selecting a namespace.
array | $params | Params to set.
|
array | $selectAttribs | HTML attributes for the generated select element.
|
Definition at line 892 of file Html.php.
References closeElement(), element(), namespaceSelectorOptions(), and openElement().
Referenced by SpecialWatchlist\doHeader(), HTMLSelectNamespace\getInputHTML(), SpecialImport\getMappingFormPart(), SpecialRecentChanges\namespaceFilterForm(), and SpecialWhatLinksHere\whatlinkshereForm().
|
static |
Helper for Html::namespaceSelector().
array | $params | See Html::namespaceSelector() |
Definition at line 838 of file Html.php.
References $lang, $wgLang, NS_MAIN, and wfMessage().
Referenced by MediaWiki\Widget\NamespaceInputWidget\getNamespaceDropdownOptions(), and namespaceSelector().
|
static |
Identical to rawElement(), but has no third parameter and omits the end tag (and the self-closing '/' in XML mode for empty elements).
string | $element | Name of the element, e.g., 'a' |
array | $attribs | Associative array of attributes, e.g., [ 'href' => 'https://www.mediawiki.org/' ]. See expandAttributes() for further documentation. |
Definition at line 251 of file Html.php.
References expandAttributes(), and wfWarn().
Referenced by DifferenceEngine\addHeader(), CategoryViewer\columnList(), SpecialContributions\contributionsSub(), TimelessTemplate\execute(), WebInstallerDBConnect\execute(), SpecialCategories\execute(), MonoBookTemplate\execute(), SpecialListGrants\execute(), SpecialTrackingCategories\execute(), Scribunto_LuaEngine\formatHtmlLogs(), Scribunto_LuaSandboxEngine\formatLimitData(), SpecialGadgetUsage\formatResult(), TablePager\formatRow(), AllMessagesTablePager\formatRow(), SpecialLog\getActionButtons(), TimelessTemplate\getAfterContent(), SpecialChangeCredentials\getAuthForm(), TimelessTemplate\getCatList(), PostgresInstaller\getConnectForm(), MysqlInstaller\getConnectForm(), TimelessTemplate\getContentSub(), SpecialVersion\getCreditsForExtension(), SpecialVersion\getEntryPointInfo(), SpecialVersion\getExternalLibraries(), BaseTemplate\getFooter(), FancyCaptcha\getFormInformation(), ApiHelp\getHelpInternal(), CategoryViewer\getHTML(), HTMLFancyCaptchaField\getInputHTML(), DatabaseInstaller\getInstallUserBox(), TimelessTemplate\getLogo(), HTMLMultiSelectField\getOneCheckbox(), HTMLCheckMatrix\getOneCheckboxHTML(), TimelessTemplate\getPortlet(), MonoBookTemplate\getPortlet(), EditPage\getPreviewLimitReport(), TimelessTemplate\getSearch(), MonoBookTemplate\getSimpleFooter(), TablePager\getStartBody(), HistoryPager\getStartBody(), CategoryTree\getTag(), TimelessTemplate\getUserLinks(), DatabaseInstaller\getWebUserBox(), SpecialVersion\getWgHooks(), OutputPage\headElement(), HistoryPager\historyLine(), htmlHeader(), ImagePage\imageLinks(), infoBox(), ChangesList\insertLogEntry(), ChangesListSpecialPage\makeLegend(), SpecialInterwiki\makeTable(), ApiMain\modifyHelp(), namespaceSelector(), ConfirmEditHooks\onAlternateEditPreview(), TitleBlacklistHooks\onValidateBlacklist(), SpecialVersion\openExtType(), WebInstallerOutput\outputHeader(), SpecialSpecialpages\outputPageList(), SpecialGadgetUsage\outputResults(), SpecialGadgetUsage\outputTableStart(), SpecialMediaStatistics\outputTableStart(), SyntaxHighlight\parserHook(), rawElement(), EnhancedChangesList\recentChangesBlockLine(), SpecialAllPages\showChunk(), EditPage\showEditForm(), SpecialExpandTemplates\showHtmlPreview(), SpecialGadgets\showMainForm(), SpecialPrefixindex\showPrefixChunk(), SpecialChangeCredentials\showSubpageList(), WebInstallerPage\startForm(), UserrightsPage\switchForm(), Linker\tocLine(), and Linker\tocList().
|
static |
|
static |
Returns an HTML element in a string.
The major advantage here over manually typing out the HTML is that it will escape all attribute values.
This is quite similar to Xml::tags(), but it implements some useful HTML-specific logic. For instance, there is no $allowShortTag parameter: the closing tag is magically omitted if $element has an empty content model.
string | $element | The element's name, e.g., 'a' |
array | $attribs | Associative array of attributes, e.g., [ 'href' => 'https://www.mediawiki.org/' ]. See expandAttributes() for further documentation. |
string | $contents | The raw HTML contents of the element: not escaped! |
Definition at line 209 of file Html.php.
References closeElement(), and openElement().
Referenced by OutputPage\addHelpLink(), InfoAction\addRow(), InfoAction\addTable(), SpecialBlock\alterForm(), JsonContent\arrayRow(), JsonContent\arrayTable(), MediaWiki\Linker\LinkRenderer\buildAElement(), ChangeTags\buildTagFilterSelector(), SpecialEditWatchlist\buildTools(), ApiFormatBase\closePrinter(), Revision\RevisionRenderer\combineSlotOutput(), SpecialContributions\contributionsSub(), MediaWiki\Extension\OATHAuth\HTMLForm\TOTPEnableForm\createResourceList(), MWDebug\deprecated(), EditPage\displayPreviewArea(), SpecialRecentChanges\doHeader(), SpecialWatchlist\doHeader(), ImagePage\doRenderLangOpt(), element(), TimelessTemplate\execute(), SpecialRenameuser\execute(), SpecialApiHelp\execute(), SpecialActiveUsers\execute(), MonoBookTemplate\execute(), SpecialListGrants\execute(), SpecialListUsers\execute(), SpecialPreferences\execute(), SpecialListGroupRights\execute(), SpecialPasswordPolicies\execute(), DisabledSpecialPage\execute(), UserrightsPage\execute(), ScribuntoContent\fillParserOutput(), UnknownContent\fillParserOutput(), FormatMetadata\flattenArrayReal(), MediaWiki\Widget\Search\InterwikiSearchResultSetWidget\footerHtml(), SpecialNewpages\form(), TemplatesOnThisPageFormatter\format(), OldChangesList\formatChangeLine(), HTMLFormField\formatErrors(), HTMLForm\formatErrors(), Scribunto_LuaEngine\formatHtmlLogs(), Scribunto_LuaSandboxEngine\formatLimitData(), CategoryViewer\formatList(), HTMLMultiSelectField\formatOptions(), HTMLRadioField\formatOptions(), XmlSelect\formatOptions(), SpecialMergeHistory\formatRevisionRow(), DeletedContribsPager\formatRevisionRow(), SpecialProtectedtitles\formatRow(), CategoryPager\formatRow(), SpecialStatistics\formatRow(), TablePager\formatRow(), UsersPager\formatRow(), ActiveUsersPager\formatRow(), DeletedContribsPager\formatRow(), AllMessagesTablePager\formatRow(), SpecialNewpages\formatRow(), ContribsPager\formatRow(), OOUIHTMLForm\formatSection(), HTMLForm\formatSection(), BlockListPager\formatValue(), ProtectedPagesPager\formatValue(), BaseTemplate\getAfterPortlet(), MonoBookTemplate\getBox(), OOUIHTMLForm\getButtons(), VFormHTMLForm\getButtons(), HTMLForm\getButtons(), Skin\getCachedNotice(), Skin\getCategories(), TimelessTemplate\getCatList(), WebInstaller\getCheckBox(), TimelessTemplate\getContentBlock(), EditPage\getContentObject(), SpecialVersion\getCreditsForExtension(), HistoryAction\getDescription(), UnsupportedSlotDiffRenderer\getDiff(), EnhancedChangesList\getDiffHistLinks(), HTMLFormField\getDiv(), Title\getEditNotices(), TablePager\getEmptyBody(), SpecialVersion\getEntryPointInfo(), HTMLForm\getErrorsOrWarnings(), MediaWiki\EditPage\TextConflictHelper\getExplainHeader(), SpecialVersion\getExternalLibraries(), LoginSignupSpecialPage\getFieldDefinitions(), BaseTemplate\getFooter(), FancyCaptcha\getFormInformation(), TimelessTemplate\getHeaderHack(), ApiHelp\getHelpInternal(), HTMLFormField\getHelpTextHtmlDiv(), HTMLFormField\getHelpTextHtmlTable(), ChangesList\getHighlightsContainerDiv(), ListToggle\getHTML(), XmlSelect\getHTML(), MonoBookTemplate\getIfExists(), BaseTemplate\getIndicators(), HTMLCheckField\getInputHTML(), HTMLFancyCaptchaField\getInputHTML(), HTMLButtonField\getInputHTML(), HTMLCheckMatrix\getInputHTML(), Licenses\getInputHTML(), HTMLFormFieldCloner\getInputHTML(), HTMLFormFieldCloner\getInputHTMLForKey(), HTMLFormFieldCloner\getInputOOUI(), HTMLFormFieldCloner\getInputOOUIForKey(), UploadSourceField\getLabelHtml(), HTMLFancyCaptchaField\getLabelHtml(), HTMLFormField\getLabelHtml(), TablePager\getLimitForm(), TimelessTemplate\getLogo(), EnhancedChangesList\getLogText(), ContribsPager\getNavigationBar(), LoginSignupSpecialPage\getPageHtml(), SpecialVersion\getParserFunctionHooks(), SpecialVersion\getParserTags(), TimelessTemplate\getPortlet(), MonoBookTemplate\getPortlet(), EditPage\getPreviewLimitReport(), EditPage\getPreviewText(), LogFormatter\getRestrictedElement(), BlockListPager\getRestrictionListHTML(), DifferenceEngine\getRevisionHeader(), Scribunto_LuaError\getScriptTraceHtml(), TimelessTemplate\getSearch(), MonoBookTemplate\getSearchBox(), TimelessTemplate\getSidebarChunk(), MonoBookTemplate\getSimpleFooter(), TimelessTemplate\getSiteNotices(), DifferenceEngine\getSlotHeader(), TablePager\getStartBody(), SpecialMediaStatistics\getTableHeaderRow(), HTMLCheckMatrix\getTableRow(), HTMLFormField\getTableRow(), ParserOutput\getText(), Skin\getUndeleteLink(), TimelessTemplate\getUserLinks(), MediaWiki\Widget\Search\SimpleSearchResultSetWidget\headerHtml(), HistoryPager\historyLine(), CoreTagHooks\html(), ImageHistoryList\imageHistoryLine(), ImagePage\imageLinks(), Poem\indentVerse(), inlineScript(), inlineStyle(), ChangesList\insertDiffHist(), LogEventsList\logLine(), WebInstaller\makeDownloadLinkHtml(), Linker\makeExternalLink(), Skin\makeFooterIcon(), InfoAction\makeHeader(), Linker\makeImageLink(), ChangesListSpecialPage\makeLegend(), BaseTemplate\makeLink(), VectorTemplate\makeLink(), WebInstaller\makeLinkItem(), SpecialBookSources\makeListItem(), BaseTemplate\makeListItem(), ResourceLoaderClientHtml\makeLoad(), Linker\makeMediaLinkFile(), ImagePage\makeMetadataTable(), BaseTemplate\makeSearchButton(), ImagePage\makeSizeLink(), SpecialInterwiki\makeTable(), EditPage\makeTemplatesOnThisPageList(), Linker\makeThumbLink2(), messageBox(), ApiMain\modifyHelp(), SpecialRecentChanges\namespaceFilterForm(), JsonContent\objectRow(), JsonContent\objectTable(), ConfirmEditHooks\onAlternateEditPreview(), CreditsAction\onView(), SpecialVersion\openExtType(), ImagePage\openShowImage(), SpecialRecentChanges\optionsPanel(), SpecialListGroupRights\outputNamespaceProtectionInfo(), SpecialRecentChangesLinked\outputNoResults(), SpecialSpecialpages\outputPageList(), SpecialMediaStatistics\outputTableRow(), SpecialMediaStatistics\outputTableStart(), InfoAction\pageInfo(), SyntaxHighlight\parserHook(), SyntaxHighlight\plainCodeWrap(), Cite\plainError(), SpecialBlock\postText(), CoreTagHooks\pre(), SkinTemplate\prepareQuickTemplate(), SpecialBlock\preText(), EnhancedChangesList\recentChangesBlockLine(), OldChangesList\recentChangesLine(), Cite\referencesFormat(), DateFormatter\reformat(), MediaWiki\Widget\Search\InterwikiSearchResultWidget\render(), MediaWiki\Widget\Search\InterwikiSearchResultSetWidget\render(), Poem\renderPoem(), JsonContent\rootValueTable(), SpecialNewFiles\setTopText(), SpecialRecentChanges\setTopText(), SpecialWatchlist\setTopText(), SpecialAllPages\showChunk(), DifferenceEngine\showDiffPage(), EditPage\showEditForm(), SpecialWatchlist\showHideCheck(), OutputPage\showLagWarning(), SpecialAutoblockList\showList(), SpecialBlockList\showList(), SpecialUndelete\showList(), LogEventsList\showLogExtract(), SpecialGadgets\showMainForm(), LogEventsList\showOptions(), SpecialPrefixindex\showPrefixChunk(), McrUndoAction\showPreview(), SpecialChangeCredentials\showSubpageList(), SpecialAutoblockList\showTotal(), SpecialUploadStash\showUploads(), SpecialUpload\showViewDeletedLinks(), LogFormatter\styleRestricedElement(), Linker\tocLine(), ImagePage\uploadLinksBox(), Linker\userLink(), Linker\userToolLinks(), JsonContent\valueCell(), Cite\warning(), ApiHelp\wrap(), VFormHTMLForm\wrapForm(), HTMLForm\wrapForm(), and SkinTemplate\wrapHTML().
|
static |
Generate a srcset attribute value.
Generates a srcset attribute value from an array mapping pixel densities to URLs. A trailing 'x' in pixel density values is optional.
string[] | $urls |
Definition at line 1068 of file Html.php.
References $urls.
Referenced by ThumbnailImage\toHtml().
|
static |
Returns an HTML link element in a string styled as a button (when $wgUseMediaWikiUIEverywhere is enabled).
string | $contents | The raw HTML contents of the element: not escaped! |
array | $attrs | Associative array of attributes, e.g., [ 'href' => 'https://www.mediawiki.org/' ]. See expandAttributes() for further documentation. |
string[] | $modifiers | classes to add to the button |
Definition at line 185 of file Html.php.
References element().
Referenced by HistoryPager\submitButton().
|
static |
Return a success box.
string | $html | of contents of box |
string | $className | (optional) corresponding to box |
Definition at line 751 of file Html.php.
References messageBox().
Referenced by SpecialResetTokens\onSuccess().
|
static |
Convenience function to produce a <textarea> element.
This supports leaving out the cols= and rows= which Xml requires and are required by HTML4/XHTML but not required by HTML5.
string | $name | Name attribute |
string | $value | Value attribute |
array | $attribs | Associative array of miscellaneous extra attributes, passed to Html::element() |
Definition at line 818 of file Html.php.
References element().
Referenced by MediaWiki\EditPage\TextConflictHelper\getEditConflictMainTextBox(), HTMLTextAreaField\getInputHTML(), MediaWiki\EditPage\TextConflictHelper\showEditFormTextAfterFooters(), and EditPage\showTextbox().
|
static |
Return a warning box.
string | $html | of contents of box |
string | $className | (optional) corresponding to box |
Definition at line 726 of file Html.php.
References messageBox().
Referenced by WebInstallerOptions\execute(), WebInstallerRestart\execute(), SkinFallbackTemplate\execute(), DatabaseInstaller\getWebUserBox(), EditPage\showHeader(), SpecialSearch\showResults(), and WebInstaller\showStatusBox().
|
staticprivate |
|
staticprivate |