Merge "Consistently follow conventions for documenting parameters"
[lhc/web/wiklou.git] / includes / Linker.php
index e4222e3..5bb9230 100644 (file)
@@ -199,7 +199,7 @@ class Linker {
                        return "<!-- ERROR -->$html";
                }
 
-               if( is_string( $query ) ) {
+               if ( is_string( $query ) ) {
                        // some functions withing core using this still hand over query strings
                        wfDeprecated( __METHOD__ . ' with parameter $query as string (should be array)', '1.20' );
                        $query = wfCgiToArray( $query );
@@ -238,7 +238,7 @@ class Linker {
                # Note: we want the href attribute first, for prettiness.
                $attribs = array( 'href' => self::linkUrl( $target, $query, $options ) );
                if ( in_array( 'forcearticlepath', $options ) && $oldquery ) {
-                       $attribs['href'] = wfAppendQuery( $attribs['href'], wfArrayToCgi( $oldquery ) );
+                       $attribs['href'] = wfAppendQuery( $attribs['href'], $oldquery );
                }
 
                $attribs = array_merge(
@@ -644,7 +644,7 @@ class Linker {
                        # If a thumbnail width has not been provided, it is set
                        # to the default user option as specified in Language*.php
                        if ( $fp['align'] == '' ) {
-                               if( $parser instanceof Parser ) {
+                               if ( $parser instanceof Parser ) {
                                        $fp['align'] = $parser->getTargetLanguage()->alignEnd();
                                } else {
                                        # backwards compatibility, remove with makeImageLink2()
@@ -786,10 +786,18 @@ class Linker {
                $hp =& $handlerParams;
 
                $page = isset( $hp['page'] ) ? $hp['page'] : false;
-               if ( !isset( $fp['align'] ) ) $fp['align'] = 'right';
-               if ( !isset( $fp['alt'] ) ) $fp['alt'] = '';
-               if ( !isset( $fp['title'] ) ) $fp['title'] = '';
-               if ( !isset( $fp['caption'] ) ) $fp['caption'] = '';
+               if ( !isset( $fp['align'] ) ) {
+                       $fp['align'] = 'right';
+               }
+               if ( !isset( $fp['alt'] ) ) {
+                       $fp['alt'] = '';
+               }
+               if ( !isset( $fp['title'] ) ) {
+                       $fp['title'] = '';
+               }
+               if ( !isset( $fp['caption'] ) ) {
+                       $fp['caption'] = '';
+               }
 
                if ( empty( $hp['width'] ) ) {
                        // Reduce width for upright images when parameter 'upright' is used
@@ -840,7 +848,7 @@ class Linker {
                # zoom icon still needs it, so we make a unique query for it. See bug 14771
                $url = $title->getLocalURL( $query );
                if ( $page ) {
-                       $url = wfAppendQuery( $url, 'page=' . urlencode( $page ) );
+                       $url = wfAppendQuery( $url, array( 'page' => $page ) );
                }
                if ( $manualthumb &&
                     !isset( $fp['link-title'] ) &&
@@ -970,12 +978,13 @@ class Linker {
        protected static function getUploadUrl( $destFile, $query = '' ) {
                global $wgUploadMissingFileUrl, $wgUploadNavigationUrl;
                $q = 'wpDestFile=' . $destFile->getPartialURL();
-               if ( $query != '' )
+               if ( $query != '' ) {
                        $q .= '&' . $query;
+               }
 
                if ( $wgUploadMissingFileUrl ) {
                        return wfAppendQuery( $wgUploadMissingFileUrl, $q );
-               } elseif( $wgUploadNavigationUrl ) {
+               } elseif ( $wgUploadNavigationUrl ) {
                        return wfAppendQuery( $wgUploadNavigationUrl, $q );
                } else {
                        $upload = SpecialPage::getTitleFor( 'Upload' );
@@ -1450,8 +1459,9 @@ class Linker {
                                $trail = "";
                        }
                        $linkRegexp = '/\[\[(.*?)\]\]' . preg_quote( $trail, '/' ) . '/';
-                       if ( isset( $match[1][0] ) && $match[1][0] == ':' )
+                       if ( isset( $match[1][0] ) && $match[1][0] == ':' ) {
                                $match[1] = substr( $match[1], 1 );
+                       }
                        list( $inside, $trail ) = self::splitTrail( $trail );
 
                        $linkText = $text;
@@ -1678,10 +1688,10 @@ class Linker {
                $lang = wfGetLangObj( $lang );
                $title = wfMessage( 'toc' )->inLanguage( $lang )->escaped();
 
-               return '<table id="toc" class="toc"><tr><td>'
+               return '<div id="toc" class="toc">'
                        . '<div id="toctitle"><h2>' . $title . "</h2></div>\n"
                        . $toc
-                       . "</ul>\n</td></tr></table>\n";
+                       . "</ul>\n</div>\n";
        }
 
        /**
@@ -1695,13 +1705,14 @@ class Linker {
                $toc = '';
                $lastLevel = 0;
                foreach ( $tree as $section ) {
-                       if ( $section['toclevel'] > $lastLevel )
+                       if ( $section['toclevel'] > $lastLevel ) {
                                $toc .= self::tocIndent();
-                       elseif ( $section['toclevel'] < $lastLevel )
+                       } elseif ( $section['toclevel'] < $lastLevel ) {
                                $toc .= self::tocUnindent(
                                        $lastLevel - $section['toclevel'] );
-                       else
+                       } else {
                                $toc .= self::tocLineEnd();
+                       }
 
                        $toc .= self::tocLine( $section['anchor'],
                                $section['line'], $section['number'],
@@ -1729,8 +1740,8 @@ class Linker {
         */
        public static function makeHeadline( $level, $attribs, $anchor, $html, $link, $legacyAnchor = false ) {
                $ret = "<h$level$attribs"
+                       . "<span class=\"mw-headline\" id=\"$anchor\">$html</span>"
                        . $link
-                       . " <span class=\"mw-headline\" id=\"$anchor\">$html</span>"
                        . "</h$level>";
                if ( $legacyAnchor !== false ) {
                        $ret = "<div id=\"$legacyAnchor\"></div>$ret";
@@ -1895,21 +1906,21 @@ class Linker {
                }
 
                $disableRollbackEditCount = false;
-               if( $wgMiserMode ) {
-                       foreach( $disableRollbackEditCountSpecialPage as $specialPage ) {
-                               if( $context->getTitle()->isSpecial( $specialPage ) ) {
+               if ( $wgMiserMode ) {
+                       foreach ( $disableRollbackEditCountSpecialPage as $specialPage ) {
+                               if ( $context->getTitle()->isSpecial( $specialPage ) ) {
                                        $disableRollbackEditCount = true;
                                        break;
                                }
                        }
                }
 
-               if( !$disableRollbackEditCount && is_int( $wgShowRollbackEditCount ) && $wgShowRollbackEditCount > 0 ) {
+               if ( !$disableRollbackEditCount && is_int( $wgShowRollbackEditCount ) && $wgShowRollbackEditCount > 0 ) {
                        if ( !is_numeric( $editCount ) ) {
                                $editCount = self::getRollbackEditCount( $rev, false );
                        }
 
-                       if( $editCount > $wgShowRollbackEditCount ) {
+                       if ( $editCount > $wgShowRollbackEditCount ) {
                                $editCount_output = $context->msg( 'rollbacklinkcount-morethan' )->numParams( $wgShowRollbackEditCount )->parse();
                        } else {
                                $editCount_output = $context->msg( 'rollbacklinkcount' )->numParams( $editCount )->parse();