[ Index ] |
PHP Cross Reference of MediaWiki-1.24.0 |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * Generate a list of changes using the good old system (no javascript). 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 2 of the License, or 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License along 16 * with this program; if not, write to the Free Software Foundation, Inc., 17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 * http://www.gnu.org/copyleft/gpl.html 19 * 20 * @file 21 */ 22 23 class OldChangesList extends ChangesList { 24 25 /** 26 * Format a line using the old system (aka without any javascript). 27 * 28 * @param RecentChange $rc Passed by reference 29 * @param bool $watched (default false) 30 * @param int $linenumber (default null) 31 * 32 * @return string|bool 33 */ 34 public function recentChangesLine( &$rc, $watched = false, $linenumber = null ) { 35 wfProfileIn( __METHOD__ ); 36 37 $classes = array(); 38 // use mw-line-even/mw-line-odd class only if linenumber is given (feature from bug 14468) 39 if ( $linenumber ) { 40 if ( $linenumber & 1 ) { 41 $classes[] = 'mw-line-odd'; 42 } else { 43 $classes[] = 'mw-line-even'; 44 } 45 } 46 47 // Indicate watched status on the line to allow for more 48 // comprehensive styling. 49 $classes[] = $watched && $rc->mAttribs['rc_timestamp'] >= $watched 50 ? 'mw-changeslist-line-watched' : 'mw-changeslist-line-not-watched'; 51 52 $html = $this->formatChangeLine( $rc, $classes, $watched ); 53 54 if ( $this->watchlist ) { 55 $classes[] = Sanitizer::escapeClass( 'watchlist-' . 56 $rc->mAttribs['rc_namespace'] . '-' . $rc->mAttribs['rc_title'] ); 57 } 58 59 if ( !wfRunHooks( 'OldChangesListRecentChangesLine', array( &$this, &$html, $rc, &$classes ) ) ) { 60 wfProfileOut( __METHOD__ ); 61 62 return false; 63 } 64 65 wfProfileOut( __METHOD__ ); 66 67 $dateheader = ''; // $html now contains only <li>...</li>, for hooks' convenience. 68 $this->insertDateHeader( $dateheader, $rc->mAttribs['rc_timestamp'] ); 69 70 return "$dateheader<li class=\"" . implode( ' ', $classes ) . "\">" . $html . "</li>\n"; 71 } 72 73 /** 74 * @param RecentChange $rc 75 * @param string[] &$classes 76 * @param boolean $watched 77 * 78 * @return string 79 */ 80 private function formatChangeLine( RecentChange $rc, array &$classes, $watched ) { 81 $html = ''; 82 83 if ( $rc->mAttribs['rc_log_type'] ) { 84 $logtitle = SpecialPage::getTitleFor( 'Log', $rc->mAttribs['rc_log_type'] ); 85 $this->insertLog( $html, $logtitle, $rc->mAttribs['rc_log_type'] ); 86 // Log entries (old format) or log targets, and special pages 87 } elseif ( $rc->mAttribs['rc_namespace'] == NS_SPECIAL ) { 88 list( $name, $htmlubpage ) = SpecialPageFactory::resolveAlias( $rc->mAttribs['rc_title'] ); 89 if ( $name == 'Log' ) { 90 $this->insertLog( $html, $rc->getTitle(), $htmlubpage ); 91 } 92 // Regular entries 93 } else { 94 $unpatrolled = $this->showAsUnpatrolled( $rc ); 95 96 $this->insertDiffHist( $html, $rc, $unpatrolled ); 97 # M, N, b and ! (minor, new, bot and unpatrolled) 98 $html .= $this->recentChangesFlags( 99 array( 100 'newpage' => $rc->mAttribs['rc_type'] == RC_NEW, 101 'minor' => $rc->mAttribs['rc_minor'], 102 'unpatrolled' => $unpatrolled, 103 'bot' => $rc->mAttribs['rc_bot'] 104 ), 105 '' 106 ); 107 $this->insertArticleLink( $html, $rc, $unpatrolled, $watched ); 108 } 109 # Edit/log timestamp 110 $this->insertTimestamp( $html, $rc ); 111 # Bytes added or removed 112 if ( $this->getConfig()->get( 'RCShowChangedSize' ) ) { 113 $cd = $this->formatCharacterDifference( $rc ); 114 if ( $cd !== '' ) { 115 $html .= $cd . ' <span class="mw-changeslist-separator">. .</span> '; 116 } 117 } 118 119 if ( $rc->mAttribs['rc_type'] == RC_LOG ) { 120 $html .= $this->insertLogEntry( $rc ); 121 } else { 122 # User tool links 123 $this->insertUserRelatedLinks( $html, $rc ); 124 # LTR/RTL direction mark 125 $html .= $this->getLanguage()->getDirMark(); 126 $html .= $this->insertComment( $rc ); 127 } 128 129 # Tags 130 $this->insertTags( $html, $rc, $classes ); 131 # Rollback 132 $this->insertRollback( $html, $rc ); 133 # For subclasses 134 $this->insertExtra( $html, $rc, $classes ); 135 136 # How many users watch this page 137 if ( $rc->numberofWatchingusers > 0 ) { 138 $html .= ' ' . $this->numberofWatchingusers( $rc->numberofWatchingusers ); 139 } 140 141 return $html; 142 } 143 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 14:03:12 2014 | Cross-referenced by PHPXref 0.7.1 |