Go to the documentation of this file.
123 if ( in_array( $element, self::$voidElements ) ) {
125 return substr( $start, 0, -1 ) .
'/>';
163 $element = strtolower( $element );
166 if ( $element ==
'input' ) {
195 && !in_array(
$attribs[
'type'], $validTypes ) ) {
203 if ( $element ==
'button' && !isset(
$attribs[
'type'] ) ) {
208 self::dropDefaults( $element,
$attribs ) ) .
'>';
219 $element = strtolower( $element );
221 return "</$element>";
245 static $attribDefaults =
array(
246 'area' =>
array(
'shape' =>
'rect' ),
248 'formaction' =>
'GET',
249 'formenctype' =>
'application/x-www-form-urlencoded',
255 'command' =>
array(
'type' =>
'command' ),
258 'autocomplete' =>
'on',
259 'enctype' =>
'application/x-www-form-urlencoded',
262 'formaction' =>
'GET',
265 'keygen' =>
array(
'keytype' =>
'rsa' ),
266 'link' =>
array(
'media' =>
'all' ),
267 'menu' =>
array(
'type' =>
'list' ),
270 'script' =>
array(
'type' =>
'text/javascript' ),
273 'type' =>
'text/css',
275 'textarea' =>
array(
'wrap' =>
'soft' ),
278 $element = strtolower( $element );
281 $lcattrib = strtolower( $attrib );
282 if ( is_array(
$value ) ) {
289 if ( isset( $attribDefaults[$element][$lcattrib] ) &&
290 $attribDefaults[$element][$lcattrib] ==
$value ) {
294 if ( $lcattrib ==
'class' &&
$value ==
'' ) {
300 if ( $element ===
'link' && isset(
$attribs[
'type'] )
301 && strval(
$attribs[
'type'] ) ==
'text/css' ) {
304 if ( $element ===
'input' ) {
307 if (
$type ===
'checkbox' ||
$type ===
'radio' ) {
314 } elseif (
$type ===
'submit' ) {
327 if ( $element ===
'select' && isset(
$attribs[
'size'] ) ) {
328 if ( in_array(
'multiple',
$attribs )
332 if ( strval(
$attribs[
'size'] ) ==
'4' ) {
337 if ( strval(
$attribs[
'size'] ) ==
'1' ) {
395 && in_array( strtolower(
$value ), self::$boolAttribs ) ) {
401 $key = strtolower( $key );
414 if ( in_array( $key,
array(
'max',
'min',
'pattern',
'required' ) )
415 || $key ===
'step' &&
$value !==
'any' ) {
421 $spaceSeparatedListAttributes =
array(
431 if ( in_array( $key, $spaceSeparatedListAttributes ) ) {
436 if ( is_array(
$value ) ) {
440 if ( is_string( $v ) ) {
443 if ( !isset(
$value[$v] ) ) {
455 $value = implode(
' ', $newValue );
469 if ( in_array( $key, self::$boolAttribs ) ) {
470 $ret .=
" $key=\"\"";
494 $ret .=
" $key=$quote" . strtr(
$value, $map ) . $quote;
512 if ( preg_match(
'/[<&]/', $contents ) ) {
513 $contents =
"/*<![CDATA[*/$contents/*]]>*/";
527 $attrs =
array(
'src' => $url );
545 $contents = strtr( $contents,
array(
549 ']]>' =>
'\5D\5D\3E '
552 if ( preg_match(
'/[<&]/', $contents ) ) {
553 $contents =
"/*<![CDATA[*/$contents/*]]>*/";
557 'type' =>
'text/css',
572 'rel' =>
'stylesheet',
574 'type' =>
'text/css',
626 if ( substr(
$value, 0, 1 ) ==
"\n" ) {
631 $spacedValue =
"\n" .
$value;
655 ksort( $selectAttribs );
658 if ( isset(
$params[
'selected'] ) ) {
663 if ( preg_match(
'/^\d+$/',
$params[
'selected'] ) ) {
671 if ( !isset(
$params[
'exclude'] ) || !is_array(
$params[
'exclude'] ) ) {
674 if ( !isset(
$params[
'disable'] ) || !is_array(
$params[
'disable'] ) ) {
681 if ( isset(
$params[
'all'] ) ) {
690 $optionsHtml =
array();
698 $nsName =
wfMessage(
'blanknamespace' )->text();
699 } elseif ( is_int( $nsId ) ) {
704 'disabled' => in_array( $nsId,
$params[
'disable'] ),
706 'selected' => $nsId ===
$params[
'selected'],
711 if ( !array_key_exists(
'id', $selectAttribs ) ) {
712 $selectAttribs[
'id'] =
'namespace';
715 if ( !array_key_exists(
'name', $selectAttribs ) ) {
716 $selectAttribs[
'name'] =
'namespace';
720 if ( isset(
$params[
'label'] ) ) {
723 'for' => isset( $selectAttribs[
'id'] ) ? $selectAttribs[
'id'] :
null,
731 . implode(
"\n", $optionsHtml )
749 global $wgHtml5Version, $wgMimeType, $wgXhtmlNamespaces;
756 $ret .=
"<?xml version=\"1.0\" encoding=\"UTF-8\" ?" .
">\n";
759 $attribs[
'xmlns'] =
'http://www.w3.org/1999/xhtml';
762 foreach ( $wgXhtmlNamespaces
as $tag => $ns ) {
767 $ret .=
"<!DOCTYPE html>\n";
770 if ( $wgHtml5Version ) {
771 $attribs[
'version'] = $wgHtml5Version;
792 # http://www.whatwg.org/html/infrastructure.html#xml-mime-type
795 # * Any mimetype with a subtype ending in +xml (this implicitly includes application/xhtml+xml)
796 return (
bool)preg_match(
'!^(text|application)/xml$|^.+/.+\+xml$!', $mimetype );
810 static function infoBox( $text, $icon, $alt, $class =
false, $useStylePath =
true ) {
813 if ( $useStylePath ) {
814 $icon = $wgStylePath .
'/common/images/' . $icon;
849 $candidates =
array();
850 foreach ( $urls
as $density => $url ) {
853 $candidates[] =
"{$url} {$density}x";
855 return implode(
", ", $candidates );
static srcSet( $urls)
Generate a srcset attribute value from an array mapping pixel densities to URLs.
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
static htmlHeader( $attribs=array())
Constructs the opening html-tag with necessary doctypes depending on global variables.
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 & $html
static textarea( $name, $value='', $attribs=array())
Convenience function to produce a <textarea> element.
static dropDefaults( $element, $attribs)
Given an element name and an associative array of element attributes, return an array that is functio...
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 & $ret
static expandAttributes( $attribs)
Given an associative array of element attributes, generate a string to stick after the element name i...
static hidden( $name, $value, $attribs=array())
Convenience function to produce an input element with type=hidden.
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as and the content language as $wgContLang
static inlineScript( $contents)
Output a "<script>" tag with the given contents.
static closeElement( $element)
Returns "</$element>".
static isXmlMimeType( $mimetype)
Determines if the given mime type is xml.
static openElement( $element, $attribs=array())
Identical to rawElement(), but has no third parameter and omits the end tag (and the self-closing '/'...
static element( $element, $attribs=array(), $contents='')
Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).
static linkedScript( $url)
Output a "<script>" tag linking to the given URL, e.g., "<script src=foo.js></script>".
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 "<
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
when a variable name is used in a it is silently declared as a new masking the global
static infoBox( $text, $icon, $alt, $class=false, $useStylePath=true)
Get HTML for an info box with an icon.
static input( $name, $value='', $type='text', $attribs=array())
Convenience function to produce an "<input>" 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 & $options
Allows to change the fields on the form that will be generated $name
static inlineStyle( $contents, $media='all')
Output a "<style>" tag with the given contents for the given media type (if any).
static linkedStyle( $url, $media='all')
Output a "<link rel=stylesheet>" linking to the given URL for the given media type (if any).
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
static namespaceSelector(array $params=array(), array $selectAttribs=array())
Build a drop-down box for selecting a namespace.
static rawElement( $element, $attribs=array(), $contents='')
Returns an HTML element in a string.
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 & $attribs
This class is a collection of static functions that serve two purposes: