Merge "Refactored Special:ActiveUsers queries to remove filesort/temp table."
[lhc/web/wiklou.git] / includes / Html.php
index 60be863..cb082a1 100644 (file)
@@ -126,11 +126,11 @@ class Html {
         * content model.  If $wgWellFormedXml is false, then a few bytes will be
         * shaved off the HTML output as well.
         *
-        * @param $element string The element's name, e.g., 'a'
-        * @param $attribs array  Associative array of attributes, e.g., array(
+        * @param string $element The element's name, e.g., 'a'
+        * @param array $attribs  Associative array of attributes, e.g., array(
         *   'href' => 'http://www.mediawiki.org/' ). See expandAttributes() for
         *   further documentation.
-        * @param $contents string The raw HTML contents of the element: *not*
+        * @param string $contents The raw HTML contents of the element: *not*
         *   escaped!
         * @return string Raw HTML
         */
@@ -207,7 +207,7 @@ class Html {
                        );
 
                        // Allow more input types in HTML5 mode
-                       if( $wgHtml5 ) {
+                       if ( $wgHtml5 ) {
                                $validTypes = array_merge( $validTypes, array(
                                        'datetime',
                                        'datetime-local',
@@ -250,7 +250,7 @@ class Html {
         * it returns the empty string when that's guaranteed to be safe.
         *
         * @since 1.17
-        * @param $element string Name of the element, e.g., 'a'
+        * @param string $element Name of the element, e.g., 'a'
         * @return string A closing tag, if required
         */
        public static function closeElement( $element ) {
@@ -287,8 +287,8 @@ class Html {
         * only guarantees that the output array should be functionally identical
         * to the input array (currently per the HTML 5 draft as of 2009-09-06).
         *
-        * @param $element string Name of the element, e.g., 'a'
-        * @param $attribs array  Associative array of attributes, e.g., array(
+        * @param string $element Name of the element, e.g., 'a'
+        * @param array $attribs  Associative array of attributes, e.g., array(
         *   'href' => 'http://www.mediawiki.org/' ).  See expandAttributes() for
         *   further documentation.
         * @return array An array of attributes functionally identical to $attribs
@@ -340,7 +340,7 @@ class Html {
 
                foreach ( $attribs as $attrib => $value ) {
                        $lcattrib = strtolower( $attrib );
-                       if( is_array( $value ) ) {
+                       if ( is_array( $value ) ) {
                                $value = implode( ' ', $value );
                        } else {
                                $value = strval( $value );
@@ -435,7 +435,7 @@ class Html {
         *     // gives '<em class="bar quux"></em>'
         * @endcode
         *
-        * @param $attribs array Associative array of attributes, e.g., array(
+        * @param array $attribs Associative array of attributes, e.g., array(
         *   'href' => 'http://www.mediawiki.org/' ).  Values will be HTML-escaped.
         *   A value of false means to omit the attribute.  For boolean attributes,
         *   you can omit the key, e.g., array( 'checked' ) instead of
@@ -500,7 +500,7 @@ class Html {
                        if ( in_array( $key, $spaceSeparatedListAttributes ) ) {
                                // Apply some normalization and remove duplicates
 
-                               // Convert into correct array. Array can contain space-seperated
+                               // Convert into correct array. Array can contain space-separated
                                // values. Implode/explode to get those into the main array as well.
                                if ( is_array( $value ) ) {
                                        // If input wasn't an array, we can skip this step
@@ -512,7 +512,7 @@ class Html {
                                                        if ( !isset( $value[$v] ) ) {
                                                                // As a special case don't set 'foo' if a
                                                                // separate 'foo' => true/false exists in the array
-                                                               // keys should be authoritive
+                                                               // keys should be authoritative
                                                                $newValue[] = $v;
                                                        }
                                                } elseif ( $v ) {
@@ -598,7 +598,7 @@ class Html {
         * @todo do some useful escaping as well, like if $contents contains
         * literal "</script>" or (for XML) literal "]]>".
         *
-        * @param $contents string JavaScript
+        * @param string $contents JavaScript
         * @return string Raw HTML
         */
        public static function inlineScript( $contents ) {
@@ -641,7 +641,7 @@ class Html {
         * (if any).  TODO: do some useful escaping as well, like if $contents
         * contains literal "</style>" (admittedly unlikely).
         *
-        * @param $contents string CSS
+        * @param string $contents CSS
         * @param $media mixed A media type string, like 'screen'
         * @return string Raw HTML
         */
@@ -683,7 +683,7 @@ class Html {
         * @param $name    string name attribute
         * @param $value   mixed  value attribute
         * @param $type    string type attribute
-        * @param $attribs array  Associative array of miscellaneous extra
+        * @param array $attribs  Associative array of miscellaneous extra
         *   attributes, passed to Html::element()
         * @return string Raw HTML
         */
@@ -700,7 +700,7 @@ class Html {
         *
         * @param $name    string name attribute
         * @param $value   string value attribute
-        * @param $attribs array  Associative array of miscellaneous extra
+        * @param array $attribs  Associative array of miscellaneous extra
         *   attributes, passed to Html::element()
         * @return string Raw HTML
         */
@@ -718,7 +718,7 @@ class Html {
         *
         * @param $name    string name attribute
         * @param $value   string value attribute
-        * @param $attribs array  Associative array of miscellaneous extra
+        * @param array $attribs  Associative array of miscellaneous extra
         *   attributes, passed to Html::element()
         * @return string Raw HTML
         */
@@ -757,7 +757,7 @@ class Html {
         * - label: text for label to add before the field
         * - exclude: [optional] Array of namespace ids to exclude
         * - disable: [optional] Array of namespace ids for which the option should be disabled in the selector
-        * @param $selectAttribs array HTML attributes for the generated select element.
+        * @param array $selectAttribs HTML attributes for the generated select element.
         * - id:   [optional], default: 'namespace'
         * - name: [optional], default: 'namespace'
         * @return string HTML code to select a namespace.
@@ -796,7 +796,7 @@ class Html {
                        // Value is provided by user, the name shown is localized for the user.
                        $options[$params['all']] = wfMessage( 'namespacesall' )->text();
                }
-               // Add all namespaces as options (in the content langauge)
+               // Add all namespaces as options (in the content language)
                $options += $wgContLang->getFormattedNamespaces();
 
                // Convert $options to HTML and filter out namespaces below 0
@@ -807,7 +807,7 @@ class Html {
                        }
                        if ( $nsId === NS_MAIN ) {
                                // For other namespaces use use the namespace prefix as label, but for
-                               // main we don't use "" but the user message descripting it (e.g. "(Main)" or "(Article)")
+                               // main we don't use "" but the user message describing it (e.g. "(Main)" or "(Article)")
                                $nsName = wfMessage( 'blanknamespace' )->text();
                        } elseif ( is_int( $nsId ) ) {
                                $nsName = $wgContLang->convertNamespace( $nsId );
@@ -852,7 +852,7 @@ class Html {
         * Constructs the opening html-tag with necessary doctypes depending on
         * global variables.
         *
-        * @param $attribs array  Associative array of miscellaneous extra
+        * @param array $attribs  Associative array of miscellaneous extra
         *   attributes, passed to Html::element() of html tag.
         * @return string  Raw HTML
         */
@@ -914,10 +914,10 @@ class Html {
        /**
         * Get HTML for an info box with an icon.
         *
-        * @param $text String: wikitext, get this with wfMessage()->plain()
-        * @param $icon String: icon name, file in skins/common/images
-        * @param $alt String: alternate text for the icon
-        * @param $class String: additional class name to add to the wrapper div
+        * @param string $text wikitext, get this with wfMessage()->plain()
+        * @param string $icon icon name, file in skins/common/images
+        * @param string $alt alternate text for the icon
+        * @param string $class additional class name to add to the wrapper div
         * @param $useStylePath
         *
         * @return string
@@ -926,22 +926,22 @@ class Html {
                global $wgStylePath;
 
                if ( $useStylePath ) {
-                       $icon = $wgStylePath.'/common/images/'.$icon;
+                       $icon = $wgStylePath . '/common/images/' . $icon;
                }
 
                $s = Html::openElement( 'div', array( 'class' => "mw-infobox $class" ) );
 
-               $s .= Html::openElement( 'div', array( 'class' => 'mw-infobox-left' ) ).
+               $s .= Html::openElement( 'div', array( 'class' => 'mw-infobox-left' ) ) .
                                Html::element( 'img',
                                        array(
                                                'src' => $icon,
                                                'alt' => $alt,
                                        )
-                               ).
+                               ) .
                                Html::closeElement( 'div' );
 
-               $s .= Html::openElement( 'div', array( 'class' => 'mw-infobox-right' ) ).
-                               $text.
+               $s .= Html::openElement( 'div', array( 'class' => 'mw-infobox-right' ) ) .
+                               $text .
                                Html::closeElement( 'div' );
                $s .= Html::element( 'div', array( 'style' => 'clear: left;' ), ' ' );
 
@@ -962,7 +962,7 @@ class Html {
         */
        static function srcSet( $urls ) {
                $candidates = array();
-               foreach( $urls as $density => $url ) {
+               foreach ( $urls as $density => $url ) {
                        // Image candidate syntax per current whatwg live spec, 2012-09-23:
                        // http://www.whatwg.org/specs/web-apps/current-work/multipage/embedded-content-1.html#attr-img-srcset
                        $candidates[] = "{$url} {$density}x";