r97705 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r97704‎ | r97705 | r97706 >
Date:08:40, 21 September 2011
Author:ialex
Status:ok
Tags:
Comment:
Call Linker methods statically
Modified paths:
  • /trunk/phase3/includes/HistoryPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/HistoryPage.php
@@ -23,8 +23,6 @@
2424 private $article;
2525 /** The $article title object. Found on construction. */
2626 private $title;
27 - /** Shortcut to the user Skin object. */
28 - private $skin;
2927
3028 /**
3129 * Construct a new HistoryPage.
@@ -32,10 +30,8 @@
3331 * @param $article Article
3432 */
3533 function __construct( $article ) {
36 - global $wgUser;
3734 $this->article = $article;
3835 $this->title = $article->getTitle();
39 - $this->skin = $wgUser->getSkin();
4036 $this->preCacheMessages();
4137 }
4238
@@ -90,12 +86,11 @@
9187
9288 // Creation of a subtitle link pointing to [[Special:Log]]
9389 $logPage = SpecialPage::getTitleFor( 'Log' );
94 - $logLink = $this->skin->link(
 90+ $logLink = Linker::linkKnown(
9591 $logPage,
9692 wfMsgHtml( 'viewpagelogs' ),
9793 array(),
98 - array( 'page' => $this->title->getPrefixedText() ),
99 - array( 'known', 'noclasses' )
 94+ array( 'page' => $this->title->getPrefixedText() )
10095 );
10196 $wgOut->setSubtitle( $logLink );
10297
@@ -522,12 +517,12 @@
523518 } elseif ( $rev->getVisibility() && $wgUser->isAllowed( 'deletedhistory' ) ) {
524519 // If revision was hidden from sysops, disable the link
525520 if ( !$rev->userCan( Revision::DELETED_RESTRICTED ) ) {
526 - $cdel = $this->getSkin()->revDeleteLinkDisabled( false );
 521+ $cdel = Linker::revDeleteLinkDisabled( false );
527522 // Otherwise, show the link...
528523 } else {
529524 $query = array( 'type' => 'revision',
530525 'target' => $this->title->getPrefixedDbkey(), 'ids' => $rev->getId() );
531 - $del .= $this->getSkin()->revDeleteLink( $query,
 526+ $del .= Linker::revDeleteLink( $query,
532527 $rev->isDeleted( Revision::DELETED_RESTRICTED ), false );
533528 }
534529 }
@@ -540,7 +535,7 @@
541536 $s .= " $link";
542537 $s .= $dirmark;
543538 $s .= " <span class='history-user'>" .
544 - $this->getSkin()->revUserTools( $rev, true ) . "</span>";
 539+ Linker::revUserTools( $rev, true ) . "</span>";
545540 $s .= $dirmark;
546541
547542 if ( $rev->isMinor() ) {
@@ -548,10 +543,10 @@
549544 }
550545
551546 if ( !is_null( $size = $rev->getSize() ) && !$rev->isDeleted( Revision::DELETED_TEXT ) ) {
552 - $s .= ' ' . $this->getSkin()->formatRevisionSize( $size );
 547+ $s .= ' ' . Linker::formatRevisionSize( $size );
553548 }
554549
555 - $s .= $this->getSkin()->revComment( $rev, false, true );
 550+ $s .= Linker::revComment( $rev, false, true );
556551
557552 if ( $notificationtimestamp && ( $row->rev_timestamp >= $notificationtimestamp ) ) {
558553 $s .= ' <span class="updatedmarker">' . wfMsgHtml( 'updatedmarker' ) . '</span>';
@@ -564,7 +559,7 @@
565560 if ( $latest && $this->title->userCan( 'rollback' ) && $this->title->userCan( 'edit' ) ) {
566561 $this->preventClickjacking();
567562 $tools[] = '<span class="mw-rollback-link">' .
568 - $this->getSkin()->buildRollbackLink( $rev ) . '</span>';
 563+ Linker::buildRollbackLink( $rev ) . '</span>';
569564 }
570565
571566 if ( $this->title->quickUserCan( 'edit' )
@@ -575,7 +570,7 @@
576571 $undoTooltip = $latest
577572 ? array( 'title' => wfMsg( 'tooltip-undo' ) )
578573 : array();
579 - $undolink = $this->getSkin()->link(
 574+ $undolink = Linker::linkKnown(
580575 $this->title,
581576 wfMsgHtml( 'editundo' ),
582577 $undoTooltip,
@@ -583,8 +578,7 @@
584579 'action' => 'edit',
585580 'undoafter' => $next->rev_id,
586581 'undo' => $rev->getId()
587 - ),
588 - array( 'known', 'noclasses' )
 582+ )
589583 );
590584 $tools[] = "<span class=\"mw-history-undo\">{$undolink}</span>";
591585 }
@@ -620,12 +614,11 @@
621615 $date = $wgLang->timeanddate( wfTimestamp( TS_MW, $rev->getTimestamp() ), true );
622616 $date = htmlspecialchars( $date );
623617 if ( $rev->userCan( Revision::DELETED_TEXT ) ) {
624 - $link = $this->getSkin()->link(
 618+ $link = Linker::linkKnown(
625619 $this->title,
626620 $date,
627621 array(),
628 - array( 'oldid' => $rev->getId() ),
629 - array( 'known', 'noclasses' )
 622+ array( 'oldid' => $rev->getId() )
630623 );
631624 } else {
632625 $link = $date;
@@ -648,15 +641,14 @@
649642 if ( $latest || !$rev->userCan( Revision::DELETED_TEXT ) ) {
650643 return $cur;
651644 } else {
652 - return $this->getSkin()->link(
 645+ return Linker::linkKnown(
653646 $this->title,
654647 $cur,
655648 array(),
656649 array(
657650 'diff' => $this->title->getLatestRevID(),
658651 'oldid' => $rev->getId()
659 - ),
660 - array( 'known', 'noclasses' )
 652+ )
661653 );
662654 }
663655 }
@@ -677,30 +669,28 @@
678670 return $last;
679671 } elseif ( $next === 'unknown' ) {
680672 # Next row probably exists but is unknown, use an oldid=prev link
681 - return $this->getSkin()->link(
 673+ return Linker::linkKnown(
682674 $this->title,
683675 $last,
684676 array(),
685677 array(
686678 'diff' => $prevRev->getId(),
687679 'oldid' => 'prev'
688 - ),
689 - array( 'known', 'noclasses' )
 680+ )
690681 );
691682 } elseif ( !$prevRev->userCan( Revision::DELETED_TEXT )
692683 || !$nextRev->userCan( Revision::DELETED_TEXT ) )
693684 {
694685 return $last;
695686 } else {
696 - return $this->getSkin()->link(
 687+ return Linker::linkKnown(
697688 $this->title,
698689 $last,
699690 array(),
700691 array(
701692 'diff' => $prevRev->getId(),
702693 'oldid' => $next->rev_id
703 - ),
704 - array( 'known', 'noclasses' )
 694+ )
705695 );
706696 }
707697 }

Status & tagging log