Index: trunk/phase3/includes/ChangesList.php |
— | — | @@ -225,35 +225,6 @@ |
226 | 226 | } |
227 | 227 | } |
228 | 228 | |
229 | | - /** |
230 | | - * @param $s |
231 | | - * @param $rc RecentChange |
232 | | - * @return void |
233 | | - */ |
234 | | - public function insertMove( &$s, $rc ) { |
235 | | - # Diff |
236 | | - $s .= '(' . $this->message['diff'] . ') ('; |
237 | | - # Hist |
238 | | - $s .= Linker::linkKnown( |
239 | | - $rc->getMovedToTitle(), |
240 | | - $this->message['hist'], |
241 | | - array(), |
242 | | - array( 'action' => 'history' ) |
243 | | - ) . ') . . '; |
244 | | - # "[[x]] moved to [[y]]" |
245 | | - $msg = ( $rc->mAttribs['rc_type'] == RC_MOVE ) ? '1movedto2' : '1movedto2_redir'; |
246 | | - $s .= wfMsgHtml( |
247 | | - $msg, |
248 | | - Linker::linkKnown( |
249 | | - $rc->getTitle(), |
250 | | - null, |
251 | | - array(), |
252 | | - array( 'redirect' => 'no' ) |
253 | | - ), |
254 | | - Linker::linkKnown( $rc->getMovedToTitle() ) |
255 | | - ); |
256 | | - } |
257 | | - |
258 | 229 | public function insertDateHeader( &$s, $rc_timestamp ) { |
259 | 230 | # Make date header if necessary |
260 | 231 | $date = $this->getLang()->date( $rc_timestamp, true, true ); |
— | — | @@ -268,8 +239,8 @@ |
269 | 240 | } |
270 | 241 | |
271 | 242 | public function insertLog( &$s, $title, $logtype ) { |
272 | | - $logname = LogPage::logName( $logtype ); |
273 | | - $s .= '(' . Linker::linkKnown( $title, htmlspecialchars( $logname ) ) . ')'; |
| 243 | + $logname = LogType::factory( $logtype )->getName()->escaped(); |
| 244 | + $s .= '(' . Linker::linkKnown( $title, $logname ) . ')'; |
274 | 245 | } |
275 | 246 | |
276 | 247 | /** |
— | — | @@ -388,31 +359,12 @@ |
389 | 360 | * |
390 | 361 | * @param $rc RecentChange |
391 | 362 | */ |
392 | | - public function insertAction( &$s, &$rc ) { |
393 | | - if( $rc->mAttribs['rc_type'] == RC_LOG ) { |
394 | | - if( $this->isDeleted( $rc, LogPage::DELETED_ACTION ) ) { |
395 | | - $s .= ' <span class="history-deleted">' . wfMsgHtml( 'rev-deleted-event' ) . '</span>'; |
396 | | - } else { |
397 | | - $s .= ' '.LogPage::actionText( $rc->mAttribs['rc_log_type'], $rc->mAttribs['rc_log_action'], |
398 | | - $rc->getTitle(), $this->getSkin(), LogPage::extractParams( $rc->mAttribs['rc_params'] ), true, true ); |
399 | | - } |
400 | | - } |
| 363 | + public function insertLogEntry( $rc ) { |
| 364 | + $formatter = LogFormatter::newFromRow( $rc->mAttribs ); |
| 365 | + $mark = $this->getLang()->getDirMark(); |
| 366 | + return $formatter->getActionText() . " $mark" . $formatter->getComment(); |
401 | 367 | } |
402 | 368 | |
403 | | - /** insert a formatted comment |
404 | | - * |
405 | | - * @param $rc RecentChange |
406 | | - */ |
407 | | - public function insertComment( &$s, &$rc ) { |
408 | | - if( $rc->mAttribs['rc_type'] != RC_MOVE && $rc->mAttribs['rc_type'] != RC_MOVE_OVER_REDIRECT ) { |
409 | | - if( $this->isDeleted( $rc, Revision::DELETED_COMMENT ) ) { |
410 | | - $s .= ' <span class="history-deleted">' . wfMsgHtml( 'rev-deleted-comment' ) . '</span>'; |
411 | | - } else { |
412 | | - $s .= Linker::commentBlock( $rc->mAttribs['rc_comment'], $rc->getTitle() ); |
413 | | - } |
414 | | - } |
415 | | - } |
416 | | - |
417 | 369 | /** |
418 | 370 | * Check whether to enable recent changes patrol features |
419 | 371 | * @return Boolean |
— | — | @@ -546,9 +498,8 @@ |
547 | 499 | } |
548 | 500 | } |
549 | 501 | |
550 | | - // Moved pages |
| 502 | + // Moved pages (very very old, not supported anymore) |
551 | 503 | if( $rc->mAttribs['rc_type'] == RC_MOVE || $rc->mAttribs['rc_type'] == RC_MOVE_OVER_REDIRECT ) { |
552 | | - $this->insertMove( $s, $rc ); |
553 | 504 | // Log entries |
554 | 505 | } elseif( $rc->mAttribs['rc_log_type'] ) { |
555 | 506 | $logtitle = Title::newFromText( 'Log/'.$rc->mAttribs['rc_log_type'], NS_SPECIAL ); |
— | — | @@ -583,16 +534,16 @@ |
584 | 535 | $s .= "$cd . . "; |
585 | 536 | } |
586 | 537 | } |
587 | | - # User tool links |
588 | | - $this->insertUserRelatedLinks( $s, $rc ); |
589 | | - # LTR/RTL direction mark |
590 | | - $s .= $this->getLang()->getDirMark(); |
591 | | - # Log action text (if any) |
592 | | - $this->insertAction( $s, $rc ); |
593 | | - # LTR/RTL direction mark |
594 | | - $s .= $this->getLang()->getDirMark(); |
595 | | - # Edit or log comment |
596 | | - $this->insertComment( $s, $rc ); |
| 538 | + |
| 539 | + if ( $rc->mAttribs['rc_type'] == RC_LOG ) { |
| 540 | + $s .= $this->insertLogEntry( $rc ); |
| 541 | + } else { |
| 542 | + # User tool links |
| 543 | + $this->insertUserRelatedLinks( $s, $rc ); |
| 544 | + # LTR/RTL direction mark |
| 545 | + $s .= $this->getLang()->getDirMark(); |
| 546 | + } |
| 547 | + |
597 | 548 | # Tags |
598 | 549 | $this->insertTags( $s, $rc, $classes ); |
599 | 550 | # Rollback |
— | — | @@ -1039,13 +990,14 @@ |
1040 | 991 | $r .= $rcObj->getCharacterDifference() . ' . . ' ; |
1041 | 992 | } |
1042 | 993 | |
1043 | | - # User links |
1044 | | - $r .= $rcObj->userlink; |
1045 | | - $r .= $rcObj->usertalklink; |
1046 | | - // log action |
1047 | | - $this->insertAction( $r, $rcObj ); |
1048 | | - // log comment |
1049 | | - $this->insertComment( $r, $rcObj ); |
| 994 | + if ( $rcObj->mAttribs['rc_type'] == RC_LOG ) { |
| 995 | + $r .= $this->insertLogEntry( $rcObj ); |
| 996 | + } else { |
| 997 | + # User links |
| 998 | + $r .= $rcObj->userlink; |
| 999 | + $r .= $rcObj->usertalklink; |
| 1000 | + } |
| 1001 | + |
1050 | 1002 | # Rollback |
1051 | 1003 | $this->insertRollback( $r, $rcObj ); |
1052 | 1004 | # Tags |
— | — | @@ -1165,19 +1117,13 @@ |
1166 | 1118 | if( $wgRCShowChangedSize && ($cd = $rcObj->getCharacterDifference()) ) { |
1167 | 1119 | $r .= "$cd . . "; |
1168 | 1120 | } |
1169 | | - # User/talk |
1170 | | - $r .= ' '.$rcObj->userlink . $rcObj->usertalklink; |
1171 | | - # Log action (if any) |
1172 | | - if( $logType ) { |
1173 | | - if( $this->isDeleted($rcObj,LogPage::DELETED_ACTION) ) { |
1174 | | - $r .= ' <span class="history-deleted">' . wfMsgHtml('rev-deleted-event') . '</span>'; |
1175 | | - } else { |
1176 | | - $r .= ' ' . LogPage::actionText( $logType, $rcObj->mAttribs['rc_log_action'], $rcObj->getTitle(), |
1177 | | - $this->getSkin(), LogPage::extractParams( $rcObj->mAttribs['rc_params'] ), true, true ); |
1178 | | - } |
| 1121 | + |
| 1122 | + if ( $type == RC_LOG ) { |
| 1123 | + $r .= $this->insertLogEntry( $rcObj ); |
| 1124 | + } else { |
| 1125 | + $r .= ' '.$rcObj->userlink . $rcObj->usertalklink; |
1179 | 1126 | } |
1180 | | - $this->insertComment( $r, $rcObj ); |
1181 | | - $this->insertRollback( $r, $rcObj ); |
| 1127 | + |
1182 | 1128 | # Tags |
1183 | 1129 | $classes = explode( ' ', $classes ); |
1184 | 1130 | $this->insertTags( $r, $rcObj, $classes ); |
Index: trunk/extensions/CleanChanges/CleanChanges_body.php |
— | — | @@ -109,29 +109,8 @@ |
110 | 110 | } |
111 | 111 | |
112 | 112 | protected function getLogAction( $rc ) { |
113 | | - global $wgUser; |
114 | | - |
115 | | - $priviledged = $wgUser->isAllowed('deleterevision'); |
116 | | - $deleted = $this->isDeleted($rc, LogPage::DELETED_ACTION); |
117 | | - |
118 | | - if ( $deleted && !$priviledged ) { |
119 | | - return $this->XMLwrapper( 'history-deleted', wfMsg('rev-deleted-event') ); |
120 | | - } else { |
121 | | - $action = LogPage::actionText( |
122 | | - $rc->getAttribute('rc_log_type'), |
123 | | - $rc->getAttribute('rc_log_action'), |
124 | | - $rc->getTitle(), |
125 | | - $this->skin, |
126 | | - LogPage::extractParams( $rc->getAttribute('rc_params') ), |
127 | | - true, |
128 | | - true |
129 | | - ); |
130 | | - if ( $deleted ) { |
131 | | - $class = array( 'class' => 'history-deleted' ); |
132 | | - $action = Xml::tags( 'span', $class, $action ); |
133 | | - } |
134 | | - return $action; |
135 | | - } |
| 113 | + $formatter = LogFormatter::newFromRow( $rc->mAttribs ); |
| 114 | + return $formatter->getActionText(); |
136 | 115 | } |
137 | 116 | |
138 | 117 | /** |
— | — | @@ -181,7 +160,9 @@ |
182 | 161 | $rc->getAttribute( 'rc_user_text' ) ); |
183 | 162 | $rc->_userInfo = $stuff[0]; |
184 | 163 | |
185 | | - $rc->_comment = $this->getComment( $rc ); |
| 164 | + if ( !$this->isLog( $rc ) ) { |
| 165 | + $rc->_comment = $this->getComment( $rc ); |
| 166 | + } |
186 | 167 | |
187 | 168 | $rc->_watching = $this->numberofWatchingusers( $baseRC->numberofWatchingusers ); |
188 | 169 | |
— | — | @@ -362,10 +343,15 @@ |
363 | 344 | } |
364 | 345 | |
365 | 346 | $items[] = $this->userSeparator; |
366 | | - $items[] = $rcObj->_user; |
367 | | - $items[] = $rcObj->_userInfo; |
368 | | - $items[] = $rcObj->_comment; |
369 | 347 | |
| 348 | + if ( $this->isLog( $rcObj ) ) { |
| 349 | + $items[] = $this->getLogAction( $rcObj ); |
| 350 | + } else { |
| 351 | + $items[] = $rcObj->_user; |
| 352 | + $items[] = $rcObj->_userInfo; |
| 353 | + $items[] = $rcObj->_comment; |
| 354 | + } |
| 355 | + |
370 | 356 | $lines .= '<div>' . implode( " {$this->dir}", $items ) . "</div>\n"; |
371 | 357 | } |
372 | 358 | return $lines; |
— | — | @@ -399,11 +385,16 @@ |
400 | 386 | } |
401 | 387 | |
402 | 388 | $items[] = $this->userSeparator; |
403 | | - $items[] = $rcObj->_user; |
404 | | - $items[] = $rcObj->_userInfo; |
405 | | - $items[] = $rcObj->_comment; |
406 | | - $items[] = $rcObj->_watching; |
407 | 389 | |
| 390 | + if ( $this->isLog( $rcObj ) ) { |
| 391 | + $items[] = $this->getLogAction( $rcObj ); |
| 392 | + } else { |
| 393 | + $items[] = $rcObj->_user; |
| 394 | + $items[] = $rcObj->_userInfo; |
| 395 | + $items[] = $rcObj->_comment; |
| 396 | + $items[] = $rcObj->_watching; |
| 397 | + } |
| 398 | + |
408 | 399 | return '<div>' . implode( " {$this->dir}", $items ) . "</div>\n"; |
409 | 400 | |
410 | 401 | } |
— | — | @@ -412,8 +403,6 @@ |
413 | 404 | global $wgUser; |
414 | 405 | $comment = $rc->getAttribute( 'rc_comment' ); |
415 | 406 | $action = ''; |
416 | | - if ( $this->isLog($rc) ) $action = $this->getLogAction( $rc ); |
417 | | - |
418 | 407 | if ( $comment === '' ) { |
419 | 408 | return $action; |
420 | 409 | } elseif ( $this->isDeleted( $rc, LogPage::DELETED_COMMENT ) ) { |