X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2FHtml.php;h=3986a7b100c05bca66f0d697e695bb8dc6e46eba;hb=bbffc62c58972a34ee617ce135e37ec936272341;hp=e778c72ee780201412c8d382c0c7a8cfc0ffe35e;hpb=969cec9322dcccf369fdb9334e98ec741d7d600e;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Html.php b/includes/Html.php index e778c72ee7..3986a7b100 100644 --- a/includes/Html.php +++ b/includes/Html.php @@ -101,6 +101,19 @@ class Html { 'itemscope', ); + private static $HTMLFiveOnlyAttribs = array( + 'autocomplete', + 'autofocus', + 'max', + 'min', + 'multiple', + 'pattern', + 'placeholder', + 'required', + 'step', + 'spellcheck', + ); + /** * Returns an HTML element in a string. The major advantage here over * manually typing out the HTML is that it will escape all attribute @@ -363,20 +376,22 @@ class Html { * 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. - * @example Numerical array - * + * + * @par Numerical array + * @code * Html::element( 'em', array( * 'class' => array( 'foo', 'bar' ) * ) ); * // gives '' - * - * @example Associative array - * + * @endcode + * + * @par Associative array + * @code * Html::element( 'em', array( * 'class' => array( 'foo', 'bar', 'foo' => false, 'quux' => true ) * ) ); * // gives '' - * + * @endcode * * @param $attribs array Associative array of attributes, e.g., array( * 'href' => 'http://www.mediawiki.org/' ). Values will be HTML-escaped. @@ -408,18 +423,8 @@ class Html { $key = strtolower( $key ); # Here we're blacklisting some HTML5-only attributes... - if ( !$wgHtml5 && in_array( $key, array( - 'autocomplete', - 'autofocus', - 'max', - 'min', - 'multiple', - 'pattern', - 'placeholder', - 'required', - 'step', - 'spellcheck', - ) ) ) { + if ( !$wgHtml5 && in_array( $key, self::$HTMLFiveOnlyAttribs ) + ) { continue; } @@ -696,6 +701,95 @@ class Html { } return self::element( 'textarea', $attribs, $spacedValue ); } + /** + * Build a drop-down box for selecting a namespace + * + * @param $params array: + * - selected: [optional] Id of namespace which should be pre-selected + * - all: [optional] Value of item for "all namespaces". If null or unset, no