X-Git-Url: https://git.cyclocoop.org/?a=blobdiff_plain;ds=sidebyside;f=includes%2FLinker.php;h=408538b7d241807317a9ee7cacba478a48da8549;hb=d6cf07fac52fc9c4c1ccdd1d6b2f730993031c59;hp=0f4516575ddacf696d62e34461c9c3876886507d;hpb=5abe15bb9daa6197544087688d73ba11eb7fa801;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Linker.php b/includes/Linker.php index 0f4516575d..408538b7d2 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -1075,6 +1075,9 @@ class Linker { public static function userLink( $userId, $userName, $altUserName = false ) { if ( $userId == 0 ) { $page = SpecialPage::getTitleFor( 'Contributions', $userName ); + if ( $altUserName === false ) { + $altUserName = IP::prettifyIP( $userName ); + } } else { $page = Title::makeTitle( NS_USER, $userName ); } @@ -1113,8 +1116,11 @@ class Linker { // check if the user has an edit $attribs = array(); if ( $redContribsWhenNoEdits ) { - $count = !is_null( $edits ) ? $edits : User::edits( $userId ); - if ( $count == 0 ) { + if ( intval( $edits ) === 0 && $edits !== 0 ) { + $user = User::newFromId( $userId ); + $edits = $user->getEditCount(); + } + if ( $edits === 0 ) { $attribs['class'] = 'new'; } } @@ -1370,7 +1376,18 @@ class Linker { self::$commentContextTitle = $title; self::$commentLocal = $local; $html = preg_replace_callback( - '/\[\[:?(.*?)(\|(.*?))*\]\]([^[]*)/', + '/ + \[\[ + :? # ignore optional leading colon + ([^\]|]+) # 1. link target; page names cannot include ] or | + (?:\| + # 2. a pipe-separated substring; only the last is captured + # Stop matching at | and ]] without relying on backtracking. + ((?:]?[^\]|])*+) + )* + \]\] + ([^[]*) # 3. link trail (the text up until the next link) + /x', array( 'Linker', 'formatLinksInCommentCallback' ), $comment ); self::$commentContextTitle = null; @@ -1396,8 +1413,8 @@ class Linker { } # Handle link renaming [[foo|text]] will show link as "text" - if ( $match[3] != "" ) { - $text = $match[3]; + if ( $match[2] != "" ) { + $text = $match[2]; } else { $text = $match[1]; } @@ -1412,7 +1429,7 @@ class Linker { } } else { # Other kind of link - if ( preg_match( $wgContLang->linkTrail(), $match[4], $submatch ) ) { + if ( preg_match( $wgContLang->linkTrail(), $match[3], $submatch ) ) { $trail = $submatch[1]; } else { $trail = ""; @@ -1761,7 +1778,7 @@ class Linker { */ public static function buildRollbackLink( $rev, IContextSource $context = null ) { global $wgShowRollbackEditCount, $wgMiserMode; - + // To config which pages are effected by miser mode $disableRollbackEditCountSpecialPage = array( 'Recentchanges', 'Watchlist' ); @@ -1896,7 +1913,11 @@ class Linker { array( 'action' => 'edit' ) ); } - $outText .= '