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