Go to the documentation of this file.
127 if ( in_array( $element, self::$voidElements ) ) {
128 if ( $wgWellFormedXml ) {
130 return substr( $start, 0, -1 ) .
' />';
171 $element = strtolower( $element );
177 && in_array( $element,
array(
'html',
'head' ) ) ) {
182 if ( $element ==
'input' ) {
211 && !in_array(
$attribs[
'type'], $validTypes ) ) {
219 if ( $element ==
'button' && !isset(
$attribs[
'type'] ) ) {
224 self::dropDefaults( $element,
$attribs ) ) .
'>';
238 $element = strtolower( $element );
242 if ( !$wgWellFormedXml && in_array( $element,
array(
255 return "</$element>";
279 static $attribDefaults =
array(
280 'area' =>
array(
'shape' =>
'rect' ),
282 'formaction' =>
'GET',
283 'formenctype' =>
'application/x-www-form-urlencoded',
289 'command' =>
array(
'type' =>
'command' ),
292 'autocomplete' =>
'on',
293 'enctype' =>
'application/x-www-form-urlencoded',
296 'formaction' =>
'GET',
299 'keygen' =>
array(
'keytype' =>
'rsa' ),
300 'link' =>
array(
'media' =>
'all' ),
301 'menu' =>
array(
'type' =>
'list' ),
304 'script' =>
array(
'type' =>
'text/javascript' ),
307 'type' =>
'text/css',
309 'textarea' =>
array(
'wrap' =>
'soft' ),
312 $element = strtolower( $element );
315 $lcattrib = strtolower( $attrib );
316 if ( is_array(
$value ) ) {
323 if ( isset( $attribDefaults[$element][$lcattrib] ) &&
324 $attribDefaults[$element][$lcattrib] ==
$value ) {
328 if ( $lcattrib ==
'class' &&
$value ==
'' ) {
334 if ( $element ===
'link' && isset(
$attribs[
'type'] )
335 && strval(
$attribs[
'type'] ) ==
'text/css' ) {
338 if ( $element ===
'input' ) {
341 if (
$type ===
'checkbox' ||
$type ===
'radio' ) {
348 } elseif (
$type ===
'submit' ) {
361 if ( $element ===
'select' && isset(
$attribs[
'size'] ) ) {
362 if ( in_array(
'multiple',
$attribs )
366 if ( strval(
$attribs[
'size'] ) ==
'4' ) {
371 if ( strval(
$attribs[
'size'] ) ==
'1' ) {
433 && in_array( strtolower(
$value ), self::$boolAttribs ) ) {
439 $key = strtolower( $key );
452 if ( in_array( $key,
array(
'max',
'min',
'pattern',
'required' ) )
453 || $key ===
'step' &&
$value !==
'any' ) {
459 $spaceSeparatedListAttributes =
array(
469 if ( in_array( $key, $spaceSeparatedListAttributes ) ) {
474 if ( is_array(
$value ) ) {
478 if ( is_string( $v ) ) {
481 if ( !isset(
$value[$v] ) ) {
493 $value = implode(
' ', $newValue );
513 $badChars =
"\\x00- '=<>`/\x{00a0}\x{1680}\x{180e}\x{180F}\x{2000}\x{2001}"
514 .
"\x{2002}\x{2003}\x{2004}\x{2005}\x{2006}\x{2007}\x{2008}\x{2009}"
515 .
"\x{200A}\x{2028}\x{2029}\x{202F}\x{205F}\x{3000}";
516 if ( $wgWellFormedXml ||
$value ===
''
517 || preg_match(
"![$badChars]!u",
$value ) ) {
523 if ( in_array( $key, self::$boolAttribs ) ) {
526 if ( !$wgWellFormedXml ) {
529 $ret .=
" $key=\"\"";
549 if ( $wgWellFormedXml ) {
555 $ret .=
" $key=$quote" . strtr(
$value, $map ) . $quote;
575 if ( $wgWellFormedXml && preg_match(
'/[<&]/', $contents ) ) {
576 $contents =
"/*<![CDATA[*/$contents/*]]>*/";
590 $attrs =
array(
'src' => $url );
607 if ( $wgWellFormedXml && preg_match(
'/[<&]/', $contents ) ) {
608 $contents =
"/*<![CDATA[*/$contents/*]]>*/";
612 'type' =>
'text/css',
627 'rel' =>
'stylesheet',
629 'type' =>
'text/css',
681 if ( substr(
$value, 0, 1 ) ==
"\n" ) {
686 $spacedValue =
"\n" .
$value;
710 ksort( $selectAttribs );
713 if ( isset(
$params[
'selected'] ) ) {
718 if ( preg_match(
'/^\d+$/',
$params[
'selected'] ) ) {
726 if ( !isset(
$params[
'exclude'] ) || !is_array(
$params[
'exclude'] ) ) {
729 if ( !isset(
$params[
'disable'] ) || !is_array(
$params[
'disable'] ) ) {
736 if ( isset(
$params[
'all'] ) ) {
745 $optionsHtml =
array();
753 $nsName =
wfMessage(
'blanknamespace' )->text();
754 } elseif ( is_int( $nsId ) ) {
759 'disabled' => in_array( $nsId,
$params[
'disable'] ),
761 'selected' => $nsId ===
$params[
'selected'],
766 if ( !array_key_exists(
'id', $selectAttribs ) ) {
767 $selectAttribs[
'id'] =
'namespace';
770 if ( !array_key_exists(
'name', $selectAttribs ) ) {
771 $selectAttribs[
'name'] =
'namespace';
775 if ( isset(
$params[
'label'] ) ) {
778 'for' => isset( $selectAttribs[
'id'] ) ? $selectAttribs[
'id'] :
null,
786 . implode(
"\n", $optionsHtml )
804 global $wgHtml5Version, $wgMimeType, $wgXhtmlNamespaces;
811 $ret .=
"<?xml version=\"1.0\" encoding=\"UTF-8\" ?" .
">\n";
814 $attribs[
'xmlns'] =
'http://www.w3.org/1999/xhtml';
817 foreach ( $wgXhtmlNamespaces
as $tag => $ns ) {
822 $ret .=
"<!DOCTYPE html>\n";
825 if ( $wgHtml5Version ) {
826 $attribs[
'version'] = $wgHtml5Version;
847 # http://www.whatwg.org/html/infrastructure.html#xml-mime-type
850 # * Any mimetype with a subtype ending in +xml (this implicitly includes application/xhtml+xml)
851 return (
bool)preg_match(
'!^(text|application)/xml$|^.+/.+\+xml$!', $mimetype );
865 static function infoBox( $text, $icon, $alt, $class =
false, $useStylePath =
true ) {
868 if ( $useStylePath ) {
869 $icon = $wgStylePath .
'/common/images/' . $icon;
904 $candidates =
array();
905 foreach ( $urls
as $density => $url ) {
908 $candidates[] =
"{$url} {$density}x";
910 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>", except if $wgWellFormedXml is off, in which case it returns the empty string w...
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: