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