X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2FChangesList.php;h=451f2da5949e473a285155c1064beeedb7d58f8d;hb=797e52dd0534ee102240cb78eb71fcce95a3153e;hp=e98fcac4526f3200043833c254b1d19f0115fbdc;hpb=db3e3bcb4825b663fb4075d94645633fe03b218e;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/ChangesList.php b/includes/ChangesList.php index e98fcac452..451f2da594 100644 --- a/includes/ChangesList.php +++ b/includes/ChangesList.php @@ -30,7 +30,7 @@ */ class RCCacheEntry extends RecentChange { var $secureName, $link; - var $curlink , $difflink, $lastlink, $usertalklink, $versionlink; + var $curlink, $difflink, $lastlink, $usertalklink, $versionlink; var $userlink, $timestamp, $watched; /** @@ -80,7 +80,7 @@ class ChangesList extends ContextSource { * This first argument used to be an User object. * * @deprecated in 1.18; use newFromContext() instead - * @param $unused string|User Unused + * @param string|User $unused Unused * @return ChangesList|EnhancedChangesList|OldChangesList derivative */ public static function newFromUser( $unused ) { @@ -130,13 +130,13 @@ class ChangesList extends ContextSource { /** * Returns the appropriate flags for new page, minor change and patrolling - * @param $flags Array Associative array of 'flag' => Bool - * @param $nothing String to use for empty space + * @param array $flags Associative array of 'flag' => Bool + * @param string $nothing to use for empty space * @return String */ protected function recentChangesFlags( $flags, $nothing = ' ' ) { $f = ''; - foreach( array( 'newpage', 'minor', 'bot', 'unpatrolled' ) as $flag ){ + foreach( array( 'newpage', 'minor', 'bot', 'unpatrolled' ) as $flag ) { $f .= isset( $flags[$flag] ) && $flags[$flag] ? self::flag( $flag ) : $nothing; @@ -150,7 +150,7 @@ class ChangesList extends ContextSource { * unpatrolled edit. By default in English it will contain "N", "m", "b", * "!" respectively, plus it will have an appropriate title and class. * - * @param $flag String: 'newpage', 'unpatrolled', 'minor', or 'bot' + * @param string $flag 'newpage', 'unpatrolled', 'minor', or 'bot' * @return String: Raw HTML */ public static function flag( $flag ) { @@ -217,7 +217,7 @@ class ChangesList extends ContextSource { $lang = $context->getLanguage(); $code = $lang->getCode(); static $fastCharDiff = array(); - if ( !isset($fastCharDiff[$code]) ) { + if ( !isset( $fastCharDiff[$code] ) ) { $fastCharDiff[$code] = $wgMiserMode || $context->msg( 'rc-change-size' )->plain() === '$1'; } @@ -287,7 +287,7 @@ class ChangesList extends ContextSource { } /** - * @param $s string HTML to update + * @param string $s HTML to update * @param $rc_timestamp mixed */ public function insertDateHeader( &$s, $rc_timestamp ) { @@ -304,7 +304,7 @@ class ChangesList extends ContextSource { } /** - * @param $s string HTML to update + * @param string $s HTML to update * @param $title Title * @param $logtype string */ @@ -315,7 +315,7 @@ class ChangesList extends ContextSource { } /** - * @param $s string HTML to update + * @param string $s HTML to update * @param $rc RecentChange * @param $unpatrolled */ @@ -328,7 +328,7 @@ class ChangesList extends ContextSource { } else { $query = array( 'curid' => $rc->mAttribs['rc_cur_id'], - 'diff' => $rc->mAttribs['rc_this_oldid'], + 'diff' => $rc->mAttribs['rc_this_oldid'], 'oldid' => $rc->mAttribs['rc_last_oldid'] ); @@ -358,7 +358,7 @@ class ChangesList extends ContextSource { } /** - * @param $s string HTML to update + * @param string $s HTML to update * @param $rc RecentChange * @param $unpatrolled * @param $watched @@ -378,7 +378,7 @@ class ChangesList extends ContextSource { array( 'class' => 'mw-changeslist-title' ), $params ); - if( $this->isDeleted($rc,Revision::DELETED_TEXT) ) { + if( $this->isDeleted( $rc, Revision::DELETED_TEXT ) ) { $articlelink = '' . $articlelink . ''; } # To allow for boldening pages watched by this user @@ -387,7 +387,7 @@ class ChangesList extends ContextSource { $articlelink .= $this->getLanguage()->getDirMark(); wfRunHooks( 'ChangesListInsertArticleLink', - array(&$this, &$articlelink, &$s, &$rc, $unpatrolled, $watched) ); + array( &$this, &$articlelink, &$s, &$rc, $unpatrolled, $watched ) ); $s .= " $articlelink"; } @@ -407,7 +407,7 @@ class ChangesList extends ContextSource { /** * Insert time timestamp string from $rc into $s * - * @param $s string HTML to update + * @param string $s HTML to update * @param $rc RecentChange */ public function insertTimestamp( &$s, $rc ) { @@ -534,14 +534,14 @@ class ChangesList extends ContextSource { $page = $rc->getTitle(); /** Check for rollback and edit permissions, disallow special pages, and only * show a link on the top-most revision */ - if ( $this->getUser()->isAllowed('rollback') && $rc->mAttribs['page_latest'] == $rc->mAttribs['rc_this_oldid'] ) + if ( $this->getUser()->isAllowed( 'rollback' ) && $rc->mAttribs['page_latest'] == $rc->mAttribs['rc_this_oldid'] ) { $rev = new Revision( array( - 'title' => $page, - 'id' => $rc->mAttribs['rc_this_oldid'], - 'user' => $rc->mAttribs['rc_user'], + 'title' => $page, + 'id' => $rc->mAttribs['rc_this_oldid'], + 'user' => $rc->mAttribs['rc_user'], 'user_text' => $rc->mAttribs['rc_user_text'], - 'deleted' => $rc->mAttribs['rc_deleted'] + 'deleted' => $rc->mAttribs['rc_deleted'] ) ); $s .= ' '.Linker::generateRollback( $rev, $this->getContext() ); } @@ -554,10 +554,10 @@ class ChangesList extends ContextSource { * @param $classes */ public function insertTags( &$s, &$rc, &$classes ) { - if ( empty($rc->mAttribs['ts_tags']) ) + if ( empty( $rc->mAttribs['ts_tags'] ) ) return; - list($tagSummary, $newClasses) = ChangeTags::formatSummaryRow( $rc->mAttribs['ts_tags'], 'changeslist' ); + list( $tagSummary, $newClasses ) = ChangeTags::formatSummaryRow( $rc->mAttribs['ts_tags'], 'changeslist' ); $classes = array_merge( $classes, $newClasses ); $s .= ' ' . $tagSummary; } @@ -579,7 +579,6 @@ class ChangesList extends ContextSource { } } - /** * Generate a list of changes using the good old system (no javascript) */ @@ -588,8 +587,8 @@ class OldChangesList extends ChangesList { * Format a line using the old system (aka without any javascript). * * @param $rc RecentChange, passed by reference - * @param $watched Bool (default false) - * @param $linenumber Int (default null) + * @param bool $watched (default false) + * @param int $linenumber (default null) * * @return string|bool */ @@ -679,7 +678,7 @@ class OldChangesList extends ChangesList { } if( $this->watchlist ) { - $classes[] = Sanitizer::escapeClass( 'watchlist-'.$rc->mAttribs['rc_namespace'].'-'.$rc->mAttribs['rc_title'] ); + $classes[] = Sanitizer::escapeClass( 'watchlist-' . $rc->mAttribs['rc_namespace'] . '-' . $rc->mAttribs['rc_title'] ); } if ( !wfRunHooks( 'OldChangesListRecentChangesLine', array( &$this, &$s, $rc, &$classes ) ) ) { @@ -688,11 +687,10 @@ class OldChangesList extends ChangesList { } wfProfileOut( __METHOD__ ); - return "$dateheader
  • ".$s."
  • \n"; + return "$dateheader
  • " . $s . "
  • \n"; } } - /** * Generate a list of changes using an Enhanced system (uses javascript). */ @@ -822,7 +820,7 @@ class EnhancedChangesList extends ChangesList { $lastLink = $this->message['last']; } else { $lastLink = Linker::linkKnown( $rc->getTitle(), $this->message['last'], - array(), $curIdEq + array('diff' => $thisOldid, 'oldid' => $lastOldid) + $rcIdQuery ); + array(), $curIdEq + array( 'diff' => $thisOldid, 'oldid' => $lastOldid ) + $rcIdQuery ); } # Make user links @@ -834,7 +832,7 @@ class EnhancedChangesList extends ChangesList { } $rc->lastlink = $lastLink; - $rc->curlink = $curLink; + $rc->curlink = $curLink; $rc->difflink = $diffLink; # Put accumulated information into the cache, for later display @@ -843,10 +841,10 @@ class EnhancedChangesList extends ChangesList { $secureName = $title->getPrefixedDBkey(); if( $type == RC_MOVE || $type == RC_MOVE_OVER_REDIRECT ) { # Use an @ character to prevent collision with page names - $this->rc_cache['@@' . ($this->rcMoveIndex++)] = array($rc); + $this->rc_cache['@@' . ($this->rcMoveIndex++)] = array( $rc ); } else { # Logs are grouped by type - if( $type == RC_LOG ){ + if( $type == RC_LOG ) { $secureName = SpecialPage::getTitleFor( 'Log', $logType )->getPrefixedDBkey(); } if( !isset( $this->rc_cache[$secureName] ) ) { @@ -964,7 +962,7 @@ class EnhancedChangesList extends ChangesList { ) ); # Timestamp - $r .= ' '.$block[0]->timestamp.' '; + $r .= ' ' . $block[0]->timestamp . ' '; # Article link if( $namehidden ) { @@ -979,7 +977,7 @@ class EnhancedChangesList extends ChangesList { $queryParams['curid'] = $curId; # Changes message - $n = count($block); + $n = count( $block ); static $nchanges = array(); if ( !isset( $nchanges[$n] ) ) { $nchanges[$n] = $this->msg( 'nchanges' )->numParams( $n )->escaped(); @@ -1034,7 +1032,7 @@ class EnhancedChangesList extends ChangesList { # Character difference (does not apply if only log items) if( $wgRCShowChangedSize && !$allLogs ) { $last = 0; - $first = count($block) - 1; + $first = count( $block ) - 1; # Some events (like logs) have an "empty" size, so we need to skip those... while( $last < $first && $block[$last]->mAttribs['rc_new_len'] === null ) { $last++; @@ -1053,7 +1051,7 @@ class EnhancedChangesList extends ChangesList { } $r .= $users; - $r .= $this->numberofWatchingusers($block[0]->numberofWatchingusers); + $r .= $this->numberofWatchingusers( $block[0]->numberofWatchingusers ); # Sub-entries foreach( $block as $rcObj ) { @@ -1081,7 +1079,7 @@ class EnhancedChangesList extends ChangesList { $link = $rcObj->timestamp; # Revision link } elseif( !ChangesList::userCan( $rcObj, Revision::DELETED_TEXT, $this->getUser() ) ) { - $link = ''.$rcObj->timestamp.' '; + $link = '' . $rcObj->timestamp . ' '; } else { if ( $rcObj->unpatrolled && $type == RC_NEW) { $params['rcid'] = $rcObj->mAttribs['rc_id']; @@ -1094,7 +1092,7 @@ class EnhancedChangesList extends ChangesList { $params ); if( $this->isDeleted( $rcObj, Revision::DELETED_TEXT ) ) { - $link = ''.$link.' '; + $link = '' . $link . ' '; } } $r .= $link . ''; @@ -1139,12 +1137,12 @@ class EnhancedChangesList extends ChangesList { /** * Generate HTML for an arrow or placeholder graphic - * @param $dir String: one of '', 'd', 'l', 'r' - * @param $alt String: text - * @param $title String: text + * @param string $dir one of '', 'd', 'l', 'r' + * @param string $alt text + * @param string $title text * @return String: HTML "" tag */ - protected function arrow( $dir, $alt='', $title='' ) { + protected function arrow( $dir, $alt = '', $title = '' ) { global $wgStylePath; $encUrl = htmlspecialchars( $wgStylePath . '/common/images/Arr_' . $dir . '.png' ); $encAlt = htmlspecialchars( $alt ); @@ -1218,7 +1216,7 @@ class EnhancedChangesList extends ChangesList { 'bot' => $rcObj->mAttribs['rc_bot'], ) ); } - $r .= ' '.$rcObj->timestamp.' '; + $r .= ' ' . $rcObj->timestamp . ' '; # Article or log link if( $logType ) { $logPage = new LogPage( $logType ); @@ -1250,7 +1248,7 @@ class EnhancedChangesList extends ChangesList { if ( $type == RC_LOG ) { $r .= $this->insertLogEntry( $rcObj ); } else { - $r .= ' '.$rcObj->userlink . $rcObj->usertalklink; + $r .= ' ' . $rcObj->userlink . $rcObj->usertalklink; $r .= $this->insertComment( $rcObj ); $this->insertRollback( $r, $rcObj ); } @@ -1258,7 +1256,7 @@ class EnhancedChangesList extends ChangesList { # Tags $this->insertTags( $r, $rcObj, $classes ); # Show how many people are watching this if enabled - $r .= $this->numberofWatchingusers($rcObj->numberofWatchingusers); + $r .= $this->numberofWatchingusers( $rcObj->numberofWatchingusers ); $r .= "\n"; @@ -1291,7 +1289,7 @@ class EnhancedChangesList extends ChangesList { wfProfileOut( __METHOD__ ); - return '
    '.$blockOut.'
    '; + return '
    ' . $blockOut . '
    '; } /**