MediaWiki  REL1_24
OldChangesList.php
Go to the documentation of this file.
00001 <?php
00023 class OldChangesList extends ChangesList {
00024 
00034     public function recentChangesLine( &$rc, $watched = false, $linenumber = null ) {
00035         wfProfileIn( __METHOD__ );
00036 
00037         $classes = array();
00038         // use mw-line-even/mw-line-odd class only if linenumber is given (feature from bug 14468)
00039         if ( $linenumber ) {
00040             if ( $linenumber & 1 ) {
00041                 $classes[] = 'mw-line-odd';
00042             } else {
00043                 $classes[] = 'mw-line-even';
00044             }
00045         }
00046 
00047         // Indicate watched status on the line to allow for more
00048         // comprehensive styling.
00049         $classes[] = $watched && $rc->mAttribs['rc_timestamp'] >= $watched
00050             ? 'mw-changeslist-line-watched' : 'mw-changeslist-line-not-watched';
00051 
00052         $html = $this->formatChangeLine( $rc, $classes, $watched );
00053 
00054         if ( $this->watchlist ) {
00055             $classes[] = Sanitizer::escapeClass( 'watchlist-' .
00056                 $rc->mAttribs['rc_namespace'] . '-' . $rc->mAttribs['rc_title'] );
00057         }
00058 
00059         if ( !wfRunHooks( 'OldChangesListRecentChangesLine', array( &$this, &$html, $rc, &$classes ) ) ) {
00060             wfProfileOut( __METHOD__ );
00061 
00062             return false;
00063         }
00064 
00065         wfProfileOut( __METHOD__ );
00066 
00067         $dateheader = ''; // $html now contains only <li>...</li>, for hooks' convenience.
00068         $this->insertDateHeader( $dateheader, $rc->mAttribs['rc_timestamp'] );
00069 
00070         return "$dateheader<li class=\"" . implode( ' ', $classes ) . "\">" . $html . "</li>\n";
00071     }
00072 
00080     private function formatChangeLine( RecentChange $rc, array &$classes, $watched ) {
00081         $html = '';
00082 
00083         if ( $rc->mAttribs['rc_log_type'] ) {
00084             $logtitle = SpecialPage::getTitleFor( 'Log', $rc->mAttribs['rc_log_type'] );
00085             $this->insertLog( $html, $logtitle, $rc->mAttribs['rc_log_type'] );
00086         // Log entries (old format) or log targets, and special pages
00087         } elseif ( $rc->mAttribs['rc_namespace'] == NS_SPECIAL ) {
00088             list( $name, $htmlubpage ) = SpecialPageFactory::resolveAlias( $rc->mAttribs['rc_title'] );
00089             if ( $name == 'Log' ) {
00090                 $this->insertLog( $html, $rc->getTitle(), $htmlubpage );
00091             }
00092         // Regular entries
00093         } else {
00094             $unpatrolled = $this->showAsUnpatrolled( $rc );
00095 
00096             $this->insertDiffHist( $html, $rc, $unpatrolled );
00097             # M, N, b and ! (minor, new, bot and unpatrolled)
00098             $html .= $this->recentChangesFlags(
00099                 array(
00100                     'newpage' => $rc->mAttribs['rc_type'] == RC_NEW,
00101                     'minor' => $rc->mAttribs['rc_minor'],
00102                     'unpatrolled' => $unpatrolled,
00103                     'bot' => $rc->mAttribs['rc_bot']
00104                 ),
00105                 ''
00106             );
00107             $this->insertArticleLink( $html, $rc, $unpatrolled, $watched );
00108         }
00109         # Edit/log timestamp
00110         $this->insertTimestamp( $html, $rc );
00111         # Bytes added or removed
00112         if ( $this->getConfig()->get( 'RCShowChangedSize' ) ) {
00113             $cd = $this->formatCharacterDifference( $rc );
00114             if ( $cd !== '' ) {
00115                 $html .= $cd . '  <span class="mw-changeslist-separator">. .</span> ';
00116             }
00117         }
00118 
00119         if ( $rc->mAttribs['rc_type'] == RC_LOG ) {
00120             $html .= $this->insertLogEntry( $rc );
00121         } else {
00122             # User tool links
00123             $this->insertUserRelatedLinks( $html, $rc );
00124             # LTR/RTL direction mark
00125             $html .= $this->getLanguage()->getDirMark();
00126             $html .= $this->insertComment( $rc );
00127         }
00128 
00129         # Tags
00130         $this->insertTags( $html, $rc, $classes );
00131         # Rollback
00132         $this->insertRollback( $html, $rc );
00133         # For subclasses
00134         $this->insertExtra( $html, $rc, $classes );
00135 
00136         # How many users watch this page
00137         if ( $rc->numberofWatchingusers > 0 ) {
00138             $html .= ' ' . $this->numberofWatchingusers( $rc->numberofWatchingusers );
00139         }
00140 
00141         return $html;
00142     }
00143 }