MediaWiki  1.23.3
Html.php
Go to the documentation of this file.
1 <?php
50 class Html {
51  // List of void elements from HTML5, section 8.1.2 as of 2011-08-12
52  private static $voidElements = array(
53  'area',
54  'base',
55  'br',
56  'col',
57  'command',
58  'embed',
59  'hr',
60  'img',
61  'input',
62  'keygen',
63  'link',
64  'meta',
65  'param',
66  'source',
67  'track',
68  'wbr',
69  );
70 
71  // Boolean attributes, which may have the value omitted entirely. Manually
72  // collected from the HTML5 spec as of 2011-08-12.
73  private static $boolAttribs = array(
74  'async',
75  'autofocus',
76  'autoplay',
77  'checked',
78  'controls',
79  'default',
80  'defer',
81  'disabled',
82  'formnovalidate',
83  'hidden',
84  'ismap',
85  'itemscope',
86  'loop',
87  'multiple',
88  'muted',
89  'novalidate',
90  'open',
91  'pubdate',
92  'readonly',
93  'required',
94  'reversed',
95  'scoped',
96  'seamless',
97  'selected',
98  'truespeed',
99  'typemustmatch',
100  // HTML5 Microdata
101  'itemscope',
102  );
103 
124  public static function rawElement( $element, $attribs = array(), $contents = '' ) {
125  global $wgWellFormedXml;
126  $start = self::openElement( $element, $attribs );
127  if ( in_array( $element, self::$voidElements ) ) {
128  if ( $wgWellFormedXml ) {
129  // Silly XML.
130  return substr( $start, 0, -1 ) . ' />';
131  }
132  return $start;
133  } else {
134  return "$start$contents" . self::closeElement( $element );
135  }
136  }
137 
148  public static function element( $element, $attribs = array(), $contents = '' ) {
149  return self::rawElement( $element, $attribs, strtr( $contents, array(
150  // There's no point in escaping quotes, >, etc. in the contents of
151  // elements.
152  '&' => '&amp;',
153  '<' => '&lt;'
154  ) ) );
155  }
156 
166  public static function openElement( $element, $attribs = array() ) {
167  global $wgWellFormedXml;
169  // This is not required in HTML5, but let's do it anyway, for
170  // consistency and better compression.
171  $element = strtolower( $element );
172 
173  // In text/html, initial <html> and <head> tags can be omitted under
174  // pretty much any sane circumstances, if they have no attributes. See:
175  // <http://www.whatwg.org/html/syntax.html#optional-tags>
176  if ( !$wgWellFormedXml && !$attribs
177  && in_array( $element, array( 'html', 'head' ) ) ) {
178  return '';
179  }
180 
181  // Remove invalid input types
182  if ( $element == 'input' ) {
183  $validTypes = array(
184  'hidden',
185  'text',
186  'password',
187  'checkbox',
188  'radio',
189  'file',
190  'submit',
191  'image',
192  'reset',
193  'button',
194 
195  // HTML input types
196  'datetime',
197  'datetime-local',
198  'date',
199  'month',
200  'time',
201  'week',
202  'number',
203  'range',
204  'email',
205  'url',
206  'search',
207  'tel',
208  'color',
209  );
210  if ( isset( $attribs['type'] )
211  && !in_array( $attribs['type'], $validTypes ) ) {
212  unset( $attribs['type'] );
213  }
214  }
215 
216  // According to standard the default type for <button> elements is "submit".
217  // Depending on compatibility mode IE might use "button", instead.
218  // We enforce the standard "submit".
219  if ( $element == 'button' && !isset( $attribs['type'] ) ) {
220  $attribs['type'] = 'submit';
221  }
222 
223  return "<$element" . self::expandAttributes(
224  self::dropDefaults( $element, $attribs ) ) . '>';
225  }
226 
235  public static function closeElement( $element ) {
236  global $wgWellFormedXml;
237 
238  $element = strtolower( $element );
239 
240  // Reference:
241  // http://www.whatwg.org/html/syntax.html#optional-tags
242  if ( !$wgWellFormedXml && in_array( $element, array(
243  'html',
244  'head',
245  'body',
246  'li',
247  'dt',
248  'dd',
249  'tr',
250  'td',
251  'th',
252  ) ) ) {
253  return '';
254  }
255  return "</$element>";
256  }
257 
275  private static function dropDefaults( $element, $attribs ) {
276 
277  // Whenever altering this array, please provide a covering test case
278  // in HtmlTest::provideElementsWithAttributesHavingDefaultValues
279  static $attribDefaults = array(
280  'area' => array( 'shape' => 'rect' ),
281  'button' => array(
282  'formaction' => 'GET',
283  'formenctype' => 'application/x-www-form-urlencoded',
284  ),
285  'canvas' => array(
286  'height' => '150',
287  'width' => '300',
288  ),
289  'command' => array( 'type' => 'command' ),
290  'form' => array(
291  'action' => 'GET',
292  'autocomplete' => 'on',
293  'enctype' => 'application/x-www-form-urlencoded',
294  ),
295  'input' => array(
296  'formaction' => 'GET',
297  'type' => 'text',
298  ),
299  'keygen' => array( 'keytype' => 'rsa' ),
300  'link' => array( 'media' => 'all' ),
301  'menu' => array( 'type' => 'list' ),
302  // Note: the use of text/javascript here instead of other JavaScript
303  // MIME types follows the HTML5 spec.
304  'script' => array( 'type' => 'text/javascript' ),
305  'style' => array(
306  'media' => 'all',
307  'type' => 'text/css',
308  ),
309  'textarea' => array( 'wrap' => 'soft' ),
310  );
311 
312  $element = strtolower( $element );
313 
314  foreach ( $attribs as $attrib => $value ) {
315  $lcattrib = strtolower( $attrib );
316  if ( is_array( $value ) ) {
317  $value = implode( ' ', $value );
318  } else {
319  $value = strval( $value );
320  }
321 
322  // Simple checks using $attribDefaults
323  if ( isset( $attribDefaults[$element][$lcattrib] ) &&
324  $attribDefaults[$element][$lcattrib] == $value ) {
325  unset( $attribs[$attrib] );
326  }
327 
328  if ( $lcattrib == 'class' && $value == '' ) {
329  unset( $attribs[$attrib] );
330  }
331  }
332 
333  // More subtle checks
334  if ( $element === 'link' && isset( $attribs['type'] )
335  && strval( $attribs['type'] ) == 'text/css' ) {
336  unset( $attribs['type'] );
337  }
338  if ( $element === 'input' ) {
339  $type = isset( $attribs['type'] ) ? $attribs['type'] : null;
340  $value = isset( $attribs['value'] ) ? $attribs['value'] : null;
341  if ( $type === 'checkbox' || $type === 'radio' ) {
342  // The default value for checkboxes and radio buttons is 'on'
343  // not ''. By stripping value="" we break radio boxes that
344  // actually wants empty values.
345  if ( $value === 'on' ) {
346  unset( $attribs['value'] );
347  }
348  } elseif ( $type === 'submit' ) {
349  // The default value for submit appears to be "Submit" but
350  // let's not bother stripping out localized text that matches
351  // that.
352  } else {
353  // The default value for nearly every other field type is ''
354  // The 'range' and 'color' types use different defaults but
355  // stripping a value="" does not hurt them.
356  if ( $value === '' ) {
357  unset( $attribs['value'] );
358  }
359  }
360  }
361  if ( $element === 'select' && isset( $attribs['size'] ) ) {
362  if ( in_array( 'multiple', $attribs )
363  || ( isset( $attribs['multiple'] ) && $attribs['multiple'] !== false )
364  ) {
365  // A multi-select
366  if ( strval( $attribs['size'] ) == '4' ) {
367  unset( $attribs['size'] );
368  }
369  } else {
370  // Single select
371  if ( strval( $attribs['size'] ) == '1' ) {
372  unset( $attribs['size'] );
373  }
374  }
375  }
376 
377  return $attribs;
378  }
379 
419  public static function expandAttributes( $attribs ) {
420  global $wgWellFormedXml;
421 
422  $ret = '';
424  foreach ( $attribs as $key => $value ) {
425  // Support intuitive array( 'checked' => true/false ) form
426  if ( $value === false || is_null( $value ) ) {
427  continue;
428  }
429 
430  // For boolean attributes, support array( 'foo' ) instead of
431  // requiring array( 'foo' => 'meaningless' ).
432  if ( is_int( $key )
433  && in_array( strtolower( $value ), self::$boolAttribs ) ) {
434  $key = $value;
435  }
436 
437  // Not technically required in HTML5 but we'd like consistency
438  // and better compression anyway.
439  $key = strtolower( $key );
440 
441  // Bug 23769: Blacklist all form validation attributes for now. Current
442  // (June 2010) WebKit has no UI, so the form just refuses to submit
443  // without telling the user why, which is much worse than failing
444  // server-side validation. Opera is the only other implementation at
445  // this time, and has ugly UI, so just kill the feature entirely until
446  // we have at least one good implementation.
447 
448  // As the default value of "1" for "step" rejects decimal
449  // numbers to be entered in 'type="number"' fields, allow
450  // the special case 'step="any"'.
451 
452  if ( in_array( $key, array( 'max', 'min', 'pattern', 'required' ) )
453  || $key === 'step' && $value !== 'any' ) {
454  continue;
455  }
456 
457  // http://www.w3.org/TR/html401/index/attributes.html ("space-separated")
458  // http://www.w3.org/TR/html5/index.html#attributes-1 ("space-separated")
459  $spaceSeparatedListAttributes = array(
460  'class', // html4, html5
461  'accesskey', // as of html5, multiple space-separated values allowed
462  // html4-spec doesn't document rel= as space-separated
463  // but has been used like that and is now documented as such
464  // in the html5-spec.
465  'rel',
466  );
467 
468  // Specific features for attributes that allow a list of space-separated values
469  if ( in_array( $key, $spaceSeparatedListAttributes ) ) {
470  // Apply some normalization and remove duplicates
471 
472  // Convert into correct array. Array can contain space-separated
473  // values. Implode/explode to get those into the main array as well.
474  if ( is_array( $value ) ) {
475  // If input wasn't an array, we can skip this step
476  $newValue = array();
477  foreach ( $value as $k => $v ) {
478  if ( is_string( $v ) ) {
479  // String values should be normal `array( 'foo' )`
480  // Just append them
481  if ( !isset( $value[$v] ) ) {
482  // As a special case don't set 'foo' if a
483  // separate 'foo' => true/false exists in the array
484  // keys should be authoritative
485  $newValue[] = $v;
486  }
487  } elseif ( $v ) {
488  // If the value is truthy but not a string this is likely
489  // an array( 'foo' => true ), falsy values don't add strings
490  $newValue[] = $k;
491  }
492  }
493  $value = implode( ' ', $newValue );
494  }
495  $value = explode( ' ', $value );
496 
497  // Normalize spacing by fixing up cases where people used
498  // more than 1 space and/or a trailing/leading space
499  $value = array_diff( $value, array( '', ' ' ) );
500 
501  // Remove duplicates and create the string
502  $value = implode( ' ', array_unique( $value ) );
503  }
504 
505  // See the "Attributes" section in the HTML syntax part of HTML5,
506  // 9.1.2.3 as of 2009-08-10. Most attributes can have quotation
507  // marks omitted, but not all. (Although a literal " is not
508  // permitted, we don't check for that, since it will be escaped
509  // anyway.)
510  #
511  // See also research done on further characters that need to be
512  // escaped: http://code.google.com/p/html5lib/issues/detail?id=93
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 ) ) {
518  $quote = '"';
519  } else {
520  $quote = '';
521  }
522 
523  if ( in_array( $key, self::$boolAttribs ) ) {
524  // In HTML5, we can leave the value empty. If we don't need
525  // well-formed XML, we can omit the = entirely.
526  if ( !$wgWellFormedXml ) {
527  $ret .= " $key";
528  } else {
529  $ret .= " $key=\"\"";
530  }
531  } else {
532  // Apparently we need to entity-encode \n, \r, \t, although the
533  // spec doesn't mention that. Since we're doing strtr() anyway,
534  // and we don't need <> escaped here, we may as well not call
535  // htmlspecialchars().
536  // @todo FIXME: Verify that we actually need to
537  // escape \n\r\t here, and explain why, exactly.
538  #
539  // We could call Sanitizer::encodeAttribute() for this, but we
540  // don't because we're stubborn and like our marginal savings on
541  // byte size from not having to encode unnecessary quotes.
542  $map = array(
543  '&' => '&amp;',
544  '"' => '&quot;',
545  "\n" => '&#10;',
546  "\r" => '&#13;',
547  "\t" => '&#9;'
548  );
549  if ( $wgWellFormedXml ) {
550  // This is allowed per spec: <http://www.w3.org/TR/xml/#NT-AttValue>
551  // But reportedly it breaks some XML tools?
552  // @todo FIXME: Is this really true?
553  $map['<'] = '&lt;';
554  }
555  $ret .= " $key=$quote" . strtr( $value, $map ) . $quote;
556  }
557  }
558  return $ret;
559  }
560 
570  public static function inlineScript( $contents ) {
571  global $wgWellFormedXml;
572 
573  $attrs = array();
574 
575  if ( $wgWellFormedXml && preg_match( '/[<&]/', $contents ) ) {
576  $contents = "/*<![CDATA[*/$contents/*]]>*/";
577  }
578 
579  return self::rawElement( 'script', $attrs, $contents );
580  }
581 
589  public static function linkedScript( $url ) {
590  $attrs = array( 'src' => $url );
591 
592  return self::element( 'script', $attrs );
593  }
594 
604  public static function inlineStyle( $contents, $media = 'all' ) {
605  global $wgWellFormedXml;
606 
607  if ( $wgWellFormedXml && preg_match( '/[<&]/', $contents ) ) {
608  $contents = "/*<![CDATA[*/$contents/*]]>*/";
609  }
610 
611  return self::rawElement( 'style', array(
612  'type' => 'text/css',
613  'media' => $media,
614  ), $contents );
615  }
616 
625  public static function linkedStyle( $url, $media = 'all' ) {
626  return self::element( 'link', array(
627  'rel' => 'stylesheet',
628  'href' => $url,
629  'type' => 'text/css',
630  'media' => $media,
631  ) );
632  }
633 
645  public static function input( $name, $value = '', $type = 'text', $attribs = array() ) {
646  $attribs['type'] = $type;
647  $attribs['value'] = $value;
648  $attribs['name'] = $name;
649 
650  return self::element( 'input', $attribs );
651  }
652 
662  public static function hidden( $name, $value, $attribs = array() ) {
663  return self::input( $name, $value, 'hidden', $attribs );
664  }
665 
678  public static function textarea( $name, $value = '', $attribs = array() ) {
679  $attribs['name'] = $name;
680 
681  if ( substr( $value, 0, 1 ) == "\n" ) {
682  // Workaround for bug 12130: browsers eat the initial newline
683  // assuming that it's just for show, but they do keep the later
684  // newlines, which we may want to preserve during editing.
685  // Prepending a single newline
686  $spacedValue = "\n" . $value;
687  } else {
688  $spacedValue = $value;
689  }
690  return self::element( 'textarea', $attribs, $spacedValue );
691  }
692 
707  public static function namespaceSelector( array $params = array(), array $selectAttribs = array() ) {
709 
710  ksort( $selectAttribs );
711 
712  // Is a namespace selected?
713  if ( isset( $params['selected'] ) ) {
714  // If string only contains digits, convert to clean int. Selected could also
715  // be "all" or "" etc. which needs to be left untouched.
716  // PHP is_numeric() has issues with large strings, PHP ctype_digit has other issues
717  // and returns false for already clean ints. Use regex instead..
718  if ( preg_match( '/^\d+$/', $params['selected'] ) ) {
719  $params['selected'] = intval( $params['selected'] );
720  }
721  // else: leaves it untouched for later processing
722  } else {
723  $params['selected'] = '';
724  }
725 
726  if ( !isset( $params['exclude'] ) || !is_array( $params['exclude'] ) ) {
727  $params['exclude'] = array();
728  }
729  if ( !isset( $params['disable'] ) || !is_array( $params['disable'] ) ) {
730  $params['disable'] = array();
731  }
732 
733  // Associative array between option-values and option-labels
734  $options = array();
735 
736  if ( isset( $params['all'] ) ) {
737  // add an option that would let the user select all namespaces.
738  // Value is provided by user, the name shown is localized for the user.
739  $options[$params['all']] = wfMessage( 'namespacesall' )->text();
740  }
741  // Add all namespaces as options (in the content language)
742  $options += $wgContLang->getFormattedNamespaces();
743 
744  // Convert $options to HTML and filter out namespaces below 0
745  $optionsHtml = array();
746  foreach ( $options as $nsId => $nsName ) {
747  if ( $nsId < NS_MAIN || in_array( $nsId, $params['exclude'] ) ) {
748  continue;
749  }
750  if ( $nsId === NS_MAIN ) {
751  // For other namespaces use use the namespace prefix as label, but for
752  // main we don't use "" but the user message describing it (e.g. "(Main)" or "(Article)")
753  $nsName = wfMessage( 'blanknamespace' )->text();
754  } elseif ( is_int( $nsId ) ) {
755  $nsName = $wgContLang->convertNamespace( $nsId );
756  }
757  $optionsHtml[] = Html::element(
758  'option', array(
759  'disabled' => in_array( $nsId, $params['disable'] ),
760  'value' => $nsId,
761  'selected' => $nsId === $params['selected'],
762  ), $nsName
763  );
764  }
765 
766  if ( !array_key_exists( 'id', $selectAttribs ) ) {
767  $selectAttribs['id'] = 'namespace';
768  }
769 
770  if ( !array_key_exists( 'name', $selectAttribs ) ) {
771  $selectAttribs['name'] = 'namespace';
772  }
773 
774  $ret = '';
775  if ( isset( $params['label'] ) ) {
776  $ret .= Html::element(
777  'label', array(
778  'for' => isset( $selectAttribs['id'] ) ? $selectAttribs['id'] : null,
779  ), $params['label']
780  ) . '&#160;';
781  }
782 
783  // Wrap options in a <select>
784  $ret .= Html::openElement( 'select', $selectAttribs )
785  . "\n"
786  . implode( "\n", $optionsHtml )
787  . "\n"
788  . Html::closeElement( 'select' );
789 
790  return $ret;
791  }
792 
801  public static function htmlHeader( $attribs = array() ) {
802  $ret = '';
803 
804  global $wgHtml5Version, $wgMimeType, $wgXhtmlNamespaces;
805 
806  $isXHTML = self::isXmlMimeType( $wgMimeType );
807 
808  if ( $isXHTML ) { // XHTML5
809  // XML mimetyped markup should have an xml header.
810  // However a DOCTYPE is not needed.
811  $ret .= "<?xml version=\"1.0\" encoding=\"UTF-8\" ?" . ">\n";
812 
813  // Add the standard xmlns
814  $attribs['xmlns'] = 'http://www.w3.org/1999/xhtml';
815 
816  // And support custom namespaces
817  foreach ( $wgXhtmlNamespaces as $tag => $ns ) {
818  $attribs["xmlns:$tag"] = $ns;
819  }
820  } else { // HTML5
821  // DOCTYPE
822  $ret .= "<!DOCTYPE html>\n";
823  }
824 
825  if ( $wgHtml5Version ) {
826  $attribs['version'] = $wgHtml5Version;
827  }
828 
829  $html = Html::openElement( 'html', $attribs );
830 
831  if ( $html ) {
832  $html .= "\n";
833  }
834 
835  $ret .= $html;
836 
837  return $ret;
838  }
839 
846  public static function isXmlMimeType( $mimetype ) {
847  # http://www.whatwg.org/html/infrastructure.html#xml-mime-type
848  # * text/xml
849  # * application/xml
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 );
852  }
853 
865  static function infoBox( $text, $icon, $alt, $class = false, $useStylePath = true ) {
866  global $wgStylePath;
867 
868  if ( $useStylePath ) {
869  $icon = $wgStylePath . '/common/images/' . $icon;
870  }
871 
872  $s = Html::openElement( 'div', array( 'class' => "mw-infobox $class" ) );
873 
874  $s .= Html::openElement( 'div', array( 'class' => 'mw-infobox-left' ) ) .
875  Html::element( 'img',
876  array(
877  'src' => $icon,
878  'alt' => $alt,
879  )
880  ) .
881  Html::closeElement( 'div' );
882 
883  $s .= Html::openElement( 'div', array( 'class' => 'mw-infobox-right' ) ) .
884  $text .
885  Html::closeElement( 'div' );
886  $s .= Html::element( 'div', array( 'style' => 'clear: left;' ), ' ' );
887 
888  $s .= Html::closeElement( 'div' );
889 
890  $s .= Html::element( 'div', array( 'style' => 'clear: left;' ), ' ' );
891 
892  return $s;
893  }
894 
903  static function srcSet( $urls ) {
904  $candidates = array();
905  foreach ( $urls as $density => $url ) {
906  // Image candidate syntax per current whatwg live spec, 2012-09-23:
907  // http://www.whatwg.org/html/embedded-content-1.html#attr-img-srcset
908  $candidates[] = "{$url} {$density}x";
909  }
910  return implode( ", ", $candidates );
911  }
912 }
Html\srcSet
static srcSet( $urls)
Generate a srcset attribute value from an array mapping pixel densities to URLs.
Definition: Html.php:903
php
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
Definition: skin.txt:62
Html\htmlHeader
static htmlHeader( $attribs=array())
Constructs the opening html-tag with necessary doctypes depending on global variables.
Definition: Html.php:801
$html
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
Definition: hooks.txt:1530
Html\textarea
static textarea( $name, $value='', $attribs=array())
Convenience function to produce a <textarea> element.
Definition: Html.php:678
Html\dropDefaults
static dropDefaults( $element, $attribs)
Given an element name and an associative array of element attributes, return an array that is functio...
Definition: Html.php:275
$ret
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
Definition: hooks.txt:1530
Html\expandAttributes
static expandAttributes( $attribs)
Given an associative array of element attributes, generate a string to stick after the element name i...
Definition: Html.php:419
$params
$params
Definition: styleTest.css.php:40
$s
$s
Definition: mergeMessageFileList.php:156
Html\hidden
static hidden( $name, $value, $attribs=array())
Convenience function to produce an input element with type=hidden.
Definition: Html.php:662
$wgContLang
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
Definition: design.txt:56
Html\inlineScript
static inlineScript( $contents)
Output a "<script>" tag with the given contents.
Definition: Html.php:570
NS_MAIN
const NS_MAIN
Definition: Defines.php:79
Html\closeElement
static closeElement( $element)
Returns "</$element>", except if $wgWellFormedXml is off, in which case it returns the empty string w...
Definition: Html.php:235
Html\isXmlMimeType
static isXmlMimeType( $mimetype)
Determines if the given mime type is xml.
Definition: Html.php:846
Html\openElement
static openElement( $element, $attribs=array())
Identical to rawElement(), but has no third parameter and omits the end tag (and the self-closing '/'...
Definition: Html.php:166
Html\element
static element( $element, $attribs=array(), $contents='')
Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).
Definition: Html.php:148
Html\linkedScript
static linkedScript( $url)
Output a "<script>" tag linking to the given URL, e.g., "<script src=foo.js></script>".
Definition: Html.php:589
wfMessage
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 "&lt
array
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
Html\$voidElements
static $voidElements
Definition: Html.php:52
global
when a variable name is used in a it is silently declared as a new masking the global
Definition: design.txt:93
Html\$boolAttribs
static $boolAttribs
Definition: Html.php:73
Html\infoBox
static infoBox( $text, $icon, $alt, $class=false, $useStylePath=true)
Get HTML for an info box with an icon.
Definition: Html.php:865
Html\input
static input( $name, $value='', $type='text', $attribs=array())
Convenience function to produce an "<input>" element.
Definition: Html.php:645
$options
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
Definition: hooks.txt:1530
$name
Allows to change the fields on the form that will be generated $name
Definition: hooks.txt:336
$value
$value
Definition: styleTest.css.php:45
Html\inlineStyle
static inlineStyle( $contents, $media='all')
Output a "<style>" tag with the given contents for the given media type (if any).
Definition: Html.php:604
Html\linkedStyle
static linkedStyle( $url, $media='all')
Output a "<link rel=stylesheet>" linking to the given URL for the given media type (if any).
Definition: Html.php:625
as
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
Definition: distributors.txt:9
Html\namespaceSelector
static namespaceSelector(array $params=array(), array $selectAttribs=array())
Build a drop-down box for selecting a namespace.
Definition: Html.php:707
Html\rawElement
static rawElement( $element, $attribs=array(), $contents='')
Returns an HTML element in a string.
Definition: Html.php:124
$attribs
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
Definition: hooks.txt:1530
Html
This class is a collection of static functions that serve two purposes:
Definition: Html.php:50
$type
$type
Definition: testCompression.php:46