Merge "rdbms: add trace to getLagFromPtHeartbeat() log entries"
[lhc/web/wiklou.git] / includes / Linker.php
index 7eda21b..731317e 100644 (file)
@@ -227,7 +227,7 @@ class Linker {
         */
        private static function fnamePart( $url ) {
                $basename = strrchr( $url, '/' );
-               if ( false === $basename ) {
+               if ( $basename === false ) {
                        $basename = $url;
                } else {
                        $basename = substr( $basename, 1 );
@@ -334,7 +334,7 @@ class Linker {
 
                $prefix = $postfix = '';
 
-               if ( 'center' == $frameParams['align'] ) {
+               if ( $frameParams['align'] == 'center' ) {
                        $prefix = '<div class="center">';
                        $postfix = '</div>';
                        $frameParams['align'] = 'none';
@@ -916,7 +916,7 @@ class Linker {
                $userId, $userText, $redContribsWhenNoEdits = false, $flags = 0, $edits = null
        ) {
                global $wgUser, $wgDisableAnonTalk, $wgLang;
-               $talkable = !( $wgDisableAnonTalk && 0 == $userId );
+               $talkable = !( $wgDisableAnonTalk && $userId == 0 );
                $blockable = !( $flags & self::TOOL_LINKS_NOBLOCK );
                $addEmailLink = $flags & self::TOOL_LINKS_EMAIL && $userId;
 
@@ -1151,7 +1151,6 @@ class Linker {
                                );
 
                                if ( $comment === null ) {
-                                       $link = '';
                                        if ( $title ) {
                                                $section = $auto;
                                                # Remove links that a user may have manually put in the autosummary
@@ -1160,6 +1159,10 @@ class Linker {
                                                $section = str_replace( '[[', '', $section );
                                                $section = str_replace( ']]', '', $section );
 
+                                               // We don't want any links in the auto text to be linked, but we still
+                                               // want to show any [[ ]]
+                                               $sectionText = str_replace( '[[', '&#91;[', $auto );
+
                                                $section = substr( Parser::guessSectionNameFromStrippedText( $section ), 1 );
                                                if ( $local ) {
                                                        $sectionTitle = Title::makeTitleSafe( NS_MAIN, '', $section );
@@ -1168,12 +1171,10 @@ class Linker {
                                                                $title->getDBkey(), $section );
                                                }
                                                if ( $sectionTitle ) {
-                                                       $link = Linker::makeCommentLink(
-                                                               $sectionTitle, $wgLang->getArrow() . $auto, $wikiId, 'noclasses'
+                                                       $auto = Linker::makeCommentLink(
+                                                               $sectionTitle, $wgLang->getArrow() . $wgLang->getDirMark() . $sectionText,
+                                                               $wikiId, 'noclasses'
                                                        );
-                                                       $auto = '';
-                                               } else {
-                                                       $link = '';
                                                }
                                        }
                                        if ( $pre ) {
@@ -1188,7 +1189,7 @@ class Linker {
                                                $auto = '<span dir="auto"><span class="autocomment">' . $auto . '</span>';
                                                $append .= '</span>';
                                        }
-                                       $comment = $pre . $link . $wgLang->getDirMark() . $auto;
+                                       $comment = $pre . $auto;
                                }
                                return $comment;
                        },