Index: trunk/phase3/includes/ChangesList.php |
— | — | @@ -24,6 +24,7 @@ |
25 | 25 | */ |
26 | 26 | class ChangesList { |
27 | 27 | # Called by history lists and recent changes |
| 28 | + public $skin; |
28 | 29 | |
29 | 30 | /** |
30 | 31 | * Changeslist contructor |
— | — | @@ -45,7 +46,8 @@ |
46 | 47 | $sk = $user->getSkin(); |
47 | 48 | $list = NULL; |
48 | 49 | if( wfRunHooks( 'FetchChangesList', array( &$user, &$sk, &$list ) ) ) { |
49 | | - return $user->getOption( 'usenewrc' ) ? new EnhancedChangesList( $sk ) : new OldChangesList( $sk ); |
| 50 | + return $user->getOption( 'usenewrc' ) ? |
| 51 | + new EnhancedChangesList( $sk ) : new OldChangesList( $sk ); |
50 | 52 | } else { |
51 | 53 | return $list; |
52 | 54 | } |
— | — | @@ -147,7 +149,6 @@ |
148 | 150 | |
149 | 151 | protected function insertDateHeader( &$s, $rc_timestamp ) { |
150 | 152 | global $wgLang; |
151 | | - |
152 | 153 | # Make date header if necessary |
153 | 154 | $date = $wgLang->date( $rc_timestamp, true, true ); |
154 | 155 | if( $date != $this->lastdate ) { |
— | — | @@ -210,15 +211,14 @@ |
211 | 212 | # RTL/LTR marker |
212 | 213 | $articlelink .= $wgContLang->getDirMark(); |
213 | 214 | |
214 | | - wfRunHooks('ChangesListInsertArticleLink', |
215 | | - array(&$this, &$articlelink, &$s, &$rc, $unpatrolled, $watched)); |
| 215 | + wfRunHooks( 'ChangesListInsertArticleLink', |
| 216 | + array(&$this, &$articlelink, &$s, &$rc, $unpatrolled, $watched) ); |
216 | 217 | |
217 | 218 | $s .= " $articlelink"; |
218 | 219 | } |
219 | 220 | |
220 | 221 | protected function insertTimestamp( &$s, $rc ) { |
221 | 222 | global $wgLang; |
222 | | - # Timestamp |
223 | 223 | $s .= $this->message['semicolon-separator'] . $wgLang->time( $rc->mAttribs['rc_timestamp'], true, true ) . ' . . '; |
224 | 224 | } |
225 | 225 | |
— | — | @@ -336,8 +336,7 @@ |
337 | 337 | public function recentChangesLine( &$rc, $watched = false ) { |
338 | 338 | global $wgContLang, $wgRCShowChangedSize, $wgUser; |
339 | 339 | |
340 | | - $fname = 'ChangesList::recentChangesLineOld'; |
341 | | - wfProfileIn( $fname ); |
| 340 | + wfProfileIn( __METHOD__ ); |
342 | 341 | |
343 | 342 | # Extract DB fields into local scope |
344 | 343 | // FIXME: Would be good to replace this extract() call with something that explicitly initializes local variables. |
— | — | @@ -368,19 +367,12 @@ |
369 | 368 | } |
370 | 369 | // Regular entries |
371 | 370 | } else { |
372 | | - wfProfileIn($fname.'-page'); |
373 | | - |
374 | 371 | $this->insertDiffHist($s, $rc, $unpatrolled); |
375 | | - |
376 | 372 | # M, N, b and ! (minor, new, bot and unpatrolled) |
377 | 373 | $s .= $this->recentChangesFlags( $rc_type == RC_NEW, $rc_minor, $unpatrolled, '', $rc_bot ); |
378 | 374 | $this->insertArticleLink($s, $rc, $unpatrolled, $watched); |
379 | | - |
380 | | - wfProfileOut($fname.'-page'); |
381 | 375 | } |
382 | 376 | |
383 | | - wfProfileIn( $fname.'-rest' ); |
384 | | - |
385 | 377 | $this->insertTimestamp($s,$rc); |
386 | 378 | |
387 | 379 | if( $wgRCShowChangedSize ) { |
— | — | @@ -404,9 +396,7 @@ |
405 | 397 | |
406 | 398 | $s = "<li>$s</li>\n"; |
407 | 399 | |
408 | | - wfProfileOut( $fname.'-rest' ); |
409 | | - |
410 | | - wfProfileOut( $fname ); |
| 400 | + wfProfileOut( __METHOD__ ); |
411 | 401 | return $dateheader . $s; |
412 | 402 | } |
413 | 403 | } |
— | — | @@ -663,7 +653,7 @@ |
664 | 654 | if( $namehidden ) { |
665 | 655 | $r .= ' <span class="history-deleted">' . wfMsgHtml('rev-deleted-event') . '</span>'; |
666 | 656 | } else { |
667 | | - $r .= $this->maybeWatchedLink( $block[0]->link, $block[0]->watched ); |
| 657 | + $this->insertArticleLink( $r, $block[0], $block[0]->unpatrolled, $block[0]->watched ); |
668 | 658 | } |
669 | 659 | |
670 | 660 | $r .= $wgContLang->getDirMark(); |
— | — | @@ -728,7 +718,8 @@ |
729 | 719 | $r .= "</td></tr></table>\n"; |
730 | 720 | |
731 | 721 | # Sub-entries |
732 | | - $r .= '<div id="mw-rc-subentries-'.$jsid.'" class="mw-changeslist-hidden"><table cellpadding="0" cellspacing="0" border="0" style="background: none">'; |
| 722 | + $r .= '<div id="mw-rc-subentries-'.$jsid.'" class="mw-changeslist-hidden">'; |
| 723 | + $r .= '<table cellpadding="0" cellspacing="0" border="0" style="background: none">'; |
733 | 724 | foreach( $block as $rcObj ) { |
734 | 725 | # Get rc_xxxx variables |
735 | 726 | // FIXME: Would be good to replace this extract() call with something that explicitly initializes local variables. |
— | — | @@ -751,9 +742,10 @@ |
752 | 743 | } else if( !ChangesList::userCan($rcObj,Revision::DELETED_TEXT) ) { |
753 | 744 | $link = '<span class="history-deleted"><tt>'.$rcObj->timestamp.'</tt></span> '; |
754 | 745 | } else { |
755 | | - $rcIdEq = ($rcObj->unpatrolled && $rc_type == RC_NEW) ? '&rcid='.$rcObj->mAttribs['rc_id'] : ''; |
756 | | - |
757 | | - $link = '<tt>'.$this->skin->makeKnownLinkObj( $rcObj->getTitle(), $rcObj->timestamp, $curIdEq.'&'.$o.$rcIdEq ).'</tt>'; |
| 746 | + $rcIdEq = ($rcObj->unpatrolled && $rc_type == RC_NEW) ? |
| 747 | + '&rcid='.$rcObj->mAttribs['rc_id'] : ''; |
| 748 | + $link = '<tt>'.$this->skin->makeKnownLinkObj( $rcObj->getTitle(), |
| 749 | + $rcObj->timestamp, $curIdEq.'&'.$o.$rcIdEq ).'</tt>'; |
758 | 750 | if( $this->isDeleted($rcObj,Revision::DELETED_TEXT) ) |
759 | 751 | $link = '<span class="history-deleted">'.$link.'</span> '; |
760 | 752 | } |
— | — | @@ -849,16 +841,13 @@ |
850 | 842 | */ |
851 | 843 | protected function recentChangesBlockLine( $rcObj ) { |
852 | 844 | global $wgContLang, $wgRCShowChangedSize; |
853 | | - |
854 | 845 | # Get rc_xxxx variables |
855 | 846 | // FIXME: Would be good to replace this extract() call with something that explicitly initializes local variables. |
856 | 847 | extract( $rcObj->mAttribs ); |
857 | | - $curIdEq = 'curid='.$rc_cur_id; |
| 848 | + $curIdEq = "curid={$rc_cur_id}"; |
858 | 849 | |
859 | 850 | $r = '<table cellspacing="0" cellpadding="0" border="0" style="background: none"><tr>'; |
860 | | - |
861 | 851 | $r .= '<td valign="top" style="white-space: nowrap"><tt>' . $this->spacerArrow() . ' '; |
862 | | - |
863 | 852 | # Flag and Timestamp |
864 | 853 | if( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) { |
865 | 854 | $r .= ' '; // 4 flags -> 4 spaces |
— | — | @@ -866,33 +855,26 @@ |
867 | 856 | $r .= $this->recentChangesFlags( $rc_type == RC_NEW, $rc_minor, $rcObj->unpatrolled, ' ', $rc_bot ); |
868 | 857 | } |
869 | 858 | $r .= ' '.$rcObj->timestamp.' </tt></td><td>'; |
870 | | - |
871 | 859 | # Article or log link |
872 | 860 | if( $rc_log_type ) { |
873 | 861 | $logtitle = Title::newFromText( "Log/$rc_log_type", NS_SPECIAL ); |
874 | 862 | $logname = LogPage::logName( $rc_log_type ); |
875 | 863 | $r .= '(' . $this->skin->makeKnownLinkObj($logtitle, $logname ) . ')'; |
876 | | - } else if( !$this->userCan($rcObj,Revision::DELETED_TEXT) ) { |
877 | | - $r .= '<span class="history-deleted">' . $rcObj->link . '</span>'; |
878 | 864 | } else { |
879 | | - $r .= $this->maybeWatchedLink( $rcObj->link, $rcObj->watched ); |
| 865 | + $this->insertArticleLink( $r, $rcObj, $rcObj->unpatrolled, $rcObj->watched ); |
880 | 866 | } |
881 | | - |
882 | 867 | # Diff and hist links |
883 | 868 | if ( $rc_type != RC_LOG ) { |
884 | 869 | $r .= ' ('. $rcObj->difflink . $this->message['semicolon-separator']; |
885 | 870 | $r .= $this->skin->makeKnownLinkObj( $rcObj->getTitle(), wfMsg( 'hist' ), $curIdEq.'&action=history' ) . ')'; |
886 | 871 | } |
887 | 872 | $r .= ' . . '; |
888 | | - |
889 | 873 | # Character diff |
890 | 874 | if( $wgRCShowChangedSize ) { |
891 | 875 | $r .= ( $rcObj->getCharacterDifference() == '' ? '' : $rcObj->getCharacterDifference() . ' . . ' ) ; |
892 | 876 | } |
893 | | - |
894 | 877 | # User/talk |
895 | 878 | $r .= ' '.$rcObj->userlink . $rcObj->usertalklink; |
896 | | - |
897 | 879 | # Log action (if any) |
898 | 880 | if( $rc_log_type ) { |
899 | 881 | if( $this->isDeleted($rcObj,LogPage::DELETED_ACTION) ) { |
— | — | @@ -902,7 +884,6 @@ |
903 | 885 | $this->skin, LogPage::extractParams($rc_params), true, true ); |
904 | 886 | } |
905 | 887 | } |
906 | | - |
907 | 888 | # Edit or log comment |
908 | 889 | if( $rc_type != RC_MOVE && $rc_type != RC_MOVE_OVER_REDIRECT ) { |
909 | 890 | // log comment |
— | — | @@ -912,7 +893,6 @@ |
913 | 894 | $r .= $this->skin->commentBlock( $rc_comment, $rcObj->getTitle() ); |
914 | 895 | } |
915 | 896 | } |
916 | | - |
917 | 897 | # Show how many people are watching this if enabled |
918 | 898 | $r .= $this->numberofWatchingusers($rcObj->numberofWatchingusers); |
919 | 899 | |
— | — | @@ -936,7 +916,6 @@ |
937 | 917 | $blockOut .= $this->recentChangesBlockGroup( $block ); |
938 | 918 | } |
939 | 919 | } |
940 | | - |
941 | 920 | return '<div>'.$blockOut.'</div>'; |
942 | 921 | } |
943 | 922 | |