MediaWiki  1.23.12
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  // we may as well not call htmlspecialchars().
535  // @todo FIXME: Verify that we actually need to
536  // escape \n\r\t here, and explain why, exactly.
537  #
538  // We could call Sanitizer::encodeAttribute() for this, but we
539  // don't because we're stubborn and like our marginal savings on
540  // byte size from not having to encode unnecessary quotes.
541  // The only difference between this transform and the one by
542  // Sanitizer::encodeAttribute() is '<' is only encoded here if
543  // $wgWellFormedXml is set, and ' is not encoded.
544  $map = array(
545  '&' => '&amp;',
546  '"' => '&quot;',
547  '>' => '&gt;',
548  "\n" => '&#10;',
549  "\r" => '&#13;',
550  "\t" => '&#9;'
551  );
552  if ( $wgWellFormedXml ) {
553  // This is allowed per spec: <http://www.w3.org/TR/xml/#NT-AttValue>
554  // But reportedly it breaks some XML tools?
555  // @todo FIXME: Is this really true?
556  $map['<'] = '&lt;';
557  }
558  $ret .= " $key=$quote" . strtr( $value, $map ) . $quote;
559  }
560  }
561  return $ret;
562  }
563 
573  public static function inlineScript( $contents ) {
574  global $wgWellFormedXml;
575 
576  $attrs = array();
577 
578  if ( $wgWellFormedXml && preg_match( '/[<&]/', $contents ) ) {
579  $contents = "/*<![CDATA[*/$contents/*]]>*/";
580  }
581 
582  return self::rawElement( 'script', $attrs, $contents );
583  }
584 
592  public static function linkedScript( $url ) {
593  $attrs = array( 'src' => $url );
594 
595  return self::element( 'script', $attrs );
596  }
597 
607  public static function inlineStyle( $contents, $media = 'all' ) {
608  global $wgWellFormedXml;
609 
610  if ( $wgWellFormedXml && preg_match( '/[<&]/', $contents ) ) {
611  $contents = "/*<![CDATA[*/$contents/*]]>*/";
612  }
613 
614  return self::rawElement( 'style', array(
615  'type' => 'text/css',
616  'media' => $media,
617  ), $contents );
618  }
619 
628  public static function linkedStyle( $url, $media = 'all' ) {
629  return self::element( 'link', array(
630  'rel' => 'stylesheet',
631  'href' => $url,
632  'type' => 'text/css',
633  'media' => $media,
634  ) );
635  }
636 
648  public static function input( $name, $value = '', $type = 'text', $attribs = array() ) {
649  $attribs['type'] = $type;
650  $attribs['value'] = $value;
651  $attribs['name'] = $name;
652 
653  return self::element( 'input', $attribs );
654  }
655 
665  public static function hidden( $name, $value, $attribs = array() ) {
666  return self::input( $name, $value, 'hidden', $attribs );
667  }
668 
681  public static function textarea( $name, $value = '', $attribs = array() ) {
682  $attribs['name'] = $name;
683 
684  if ( substr( $value, 0, 1 ) == "\n" ) {
685  // Workaround for bug 12130: browsers eat the initial newline
686  // assuming that it's just for show, but they do keep the later
687  // newlines, which we may want to preserve during editing.
688  // Prepending a single newline
689  $spacedValue = "\n" . $value;
690  } else {
691  $spacedValue = $value;
692  }
693  return self::element( 'textarea', $attribs, $spacedValue );
694  }
695 
710  public static function namespaceSelector( array $params = array(), array $selectAttribs = array() ) {
712 
713  ksort( $selectAttribs );
714 
715  // Is a namespace selected?
716  if ( isset( $params['selected'] ) ) {
717  // If string only contains digits, convert to clean int. Selected could also
718  // be "all" or "" etc. which needs to be left untouched.
719  // PHP is_numeric() has issues with large strings, PHP ctype_digit has other issues
720  // and returns false for already clean ints. Use regex instead..
721  if ( preg_match( '/^\d+$/', $params['selected'] ) ) {
722  $params['selected'] = intval( $params['selected'] );
723  }
724  // else: leaves it untouched for later processing
725  } else {
726  $params['selected'] = '';
727  }
728 
729  if ( !isset( $params['exclude'] ) || !is_array( $params['exclude'] ) ) {
730  $params['exclude'] = array();
731  }
732  if ( !isset( $params['disable'] ) || !is_array( $params['disable'] ) ) {
733  $params['disable'] = array();
734  }
735 
736  // Associative array between option-values and option-labels
737  $options = array();
738 
739  if ( isset( $params['all'] ) ) {
740  // add an option that would let the user select all namespaces.
741  // Value is provided by user, the name shown is localized for the user.
742  $options[$params['all']] = wfMessage( 'namespacesall' )->text();
743  }
744  // Add all namespaces as options (in the content language)
745  $options += $wgContLang->getFormattedNamespaces();
746 
747  // Convert $options to HTML and filter out namespaces below 0
748  $optionsHtml = array();
749  foreach ( $options as $nsId => $nsName ) {
750  if ( $nsId < NS_MAIN || in_array( $nsId, $params['exclude'] ) ) {
751  continue;
752  }
753  if ( $nsId === NS_MAIN ) {
754  // For other namespaces use use the namespace prefix as label, but for
755  // main we don't use "" but the user message describing it (e.g. "(Main)" or "(Article)")
756  $nsName = wfMessage( 'blanknamespace' )->text();
757  } elseif ( is_int( $nsId ) ) {
758  $nsName = $wgContLang->convertNamespace( $nsId );
759  }
760  $optionsHtml[] = Html::element(
761  'option', array(
762  'disabled' => in_array( $nsId, $params['disable'] ),
763  'value' => $nsId,
764  'selected' => $nsId === $params['selected'],
765  ), $nsName
766  );
767  }
768 
769  if ( !array_key_exists( 'id', $selectAttribs ) ) {
770  $selectAttribs['id'] = 'namespace';
771  }
772 
773  if ( !array_key_exists( 'name', $selectAttribs ) ) {
774  $selectAttribs['name'] = 'namespace';
775  }
776 
777  $ret = '';
778  if ( isset( $params['label'] ) ) {
779  $ret .= Html::element(
780  'label', array(
781  'for' => isset( $selectAttribs['id'] ) ? $selectAttribs['id'] : null,
782  ), $params['label']
783  ) . '&#160;';
784  }
785 
786  // Wrap options in a <select>
787  $ret .= Html::openElement( 'select', $selectAttribs )
788  . "\n"
789  . implode( "\n", $optionsHtml )
790  . "\n"
791  . Html::closeElement( 'select' );
792 
793  return $ret;
794  }
795 
804  public static function htmlHeader( $attribs = array() ) {
805  $ret = '';
806 
807  global $wgHtml5Version, $wgMimeType, $wgXhtmlNamespaces;
808 
809  $isXHTML = self::isXmlMimeType( $wgMimeType );
810 
811  if ( $isXHTML ) { // XHTML5
812  // XML mimetyped markup should have an xml header.
813  // However a DOCTYPE is not needed.
814  $ret .= "<?xml version=\"1.0\" encoding=\"UTF-8\" ?" . ">\n";
815 
816  // Add the standard xmlns
817  $attribs['xmlns'] = 'http://www.w3.org/1999/xhtml';
818 
819  // And support custom namespaces
820  foreach ( $wgXhtmlNamespaces as $tag => $ns ) {
821  $attribs["xmlns:$tag"] = $ns;
822  }
823  } else { // HTML5
824  // DOCTYPE
825  $ret .= "<!DOCTYPE html>\n";
826  }
827 
828  if ( $wgHtml5Version ) {
829  $attribs['version'] = $wgHtml5Version;
830  }
831 
832  $html = Html::openElement( 'html', $attribs );
833 
834  if ( $html ) {
835  $html .= "\n";
836  }
837 
838  $ret .= $html;
839 
840  return $ret;
841  }
842 
849  public static function isXmlMimeType( $mimetype ) {
850  # http://www.whatwg.org/html/infrastructure.html#xml-mime-type
851  # * text/xml
852  # * application/xml
853  # * Any mimetype with a subtype ending in +xml (this implicitly includes application/xhtml+xml)
854  return (bool)preg_match( '!^(text|application)/xml$|^.+/.+\+xml$!', $mimetype );
855  }
856 
868  static function infoBox( $text, $icon, $alt, $class = false, $useStylePath = true ) {
869  global $wgStylePath;
870 
871  if ( $useStylePath ) {
872  $icon = $wgStylePath . '/common/images/' . $icon;
873  }
874 
875  $s = Html::openElement( 'div', array( 'class' => "mw-infobox $class" ) );
876 
877  $s .= Html::openElement( 'div', array( 'class' => 'mw-infobox-left' ) ) .
878  Html::element( 'img',
879  array(
880  'src' => $icon,
881  'alt' => $alt,
882  )
883  ) .
884  Html::closeElement( 'div' );
885 
886  $s .= Html::openElement( 'div', array( 'class' => 'mw-infobox-right' ) ) .
887  $text .
888  Html::closeElement( 'div' );
889  $s .= Html::element( 'div', array( 'style' => 'clear: left;' ), ' ' );
890 
891  $s .= Html::closeElement( 'div' );
892 
893  $s .= Html::element( 'div', array( 'style' => 'clear: left;' ), ' ' );
894 
895  return $s;
896  }
897 
906  static function srcSet( $urls ) {
907  $candidates = array();
908  foreach ( $urls as $density => $url ) {
909  // Image candidate syntax per current whatwg live spec, 2012-09-23:
910  // http://www.whatwg.org/html/embedded-content-1.html#attr-img-srcset
911  $candidates[] = "{$url} {$density}x";
912  }
913  return implode( ", ", $candidates );
914  }
915 }
Html\srcSet
static srcSet( $urls)
Generate a srcset attribute value from an array mapping pixel densities to URLs.
Definition: Html.php:906
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:804
$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:681
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:665
$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:573
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:849
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:592
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:868
Html\input
static input( $name, $value='', $type='text', $attribs=array())
Convenience function to produce an "<input>" element.
Definition: Html.php:648
$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:607
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:628
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:710
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