Index: trunk/phase3/includes/HistoryPage.php |
— | — | @@ -19,7 +19,12 @@ |
20 | 20 | const DIR_PREV = 0; |
21 | 21 | const DIR_NEXT = 1; |
22 | 22 | |
23 | | - var $article, $title, $skin; |
| 23 | + /** Contains the Article object. Passed on construction. */ |
| 24 | + private $article; |
| 25 | + /** The $article title object. Found on construction. */ |
| 26 | + private $title; |
| 27 | + /** Shortcut to the user Skin object. */ |
| 28 | + private $skin; |
24 | 29 | |
25 | 30 | /** |
26 | 31 | * Construct a new HistoryPage. |
— | — | @@ -34,11 +39,13 @@ |
35 | 40 | $this->preCacheMessages(); |
36 | 41 | } |
37 | 42 | |
38 | | - function getArticle() { |
| 43 | + /** Get the Article object we are working on. */ |
| 44 | + public function getArticle() { |
39 | 45 | return $this->article; |
40 | 46 | } |
41 | 47 | |
42 | | - function getTitle() { |
| 48 | + /** Get the Title object. */ |
| 49 | + public function getTitle() { |
43 | 50 | return $this->title; |
44 | 51 | } |
45 | 52 | |
— | — | @@ -46,7 +53,7 @@ |
47 | 54 | * As we use the same small set of messages in various methods and that |
48 | 55 | * they are called often, we call them once and save them in $this->message |
49 | 56 | */ |
50 | | - function preCacheMessages() { |
| 57 | + private function preCacheMessages() { |
51 | 58 | // Precache various messages |
52 | 59 | if ( !isset( $this->message ) ) { |
53 | 60 | $msgs = array( 'cur', 'last', 'pipe-separator' ); |
— | — | @@ -63,7 +70,7 @@ |
64 | 71 | function history() { |
65 | 72 | global $wgOut, $wgRequest, $wgScript; |
66 | 73 | |
67 | | - /* |
| 74 | + /** |
68 | 75 | * Allow client caching. |
69 | 76 | */ |
70 | 77 | if ( $wgOut->checkLastModified( $this->article->getTouched() ) ) |
— | — | @@ -71,9 +78,7 @@ |
72 | 79 | |
73 | 80 | wfProfileIn( __METHOD__ ); |
74 | 81 | |
75 | | - /* |
76 | | - * Setup page variables. |
77 | | - */ |
| 82 | + // Setup page variables. |
78 | 83 | $wgOut->setPageTitle( wfMsg( 'history-title', $this->title->getPrefixedText() ) ); |
79 | 84 | $wgOut->setPageTitleActionText( wfMsg( 'history_short' ) ); |
80 | 85 | $wgOut->setArticleFlag( false ); |
— | — | @@ -83,6 +88,7 @@ |
84 | 89 | $wgOut->setFeedAppendQuery( 'action=history' ); |
85 | 90 | $wgOut->addModules( array( 'mediawiki.legacy.history', 'mediawiki.views.history' ) ); |
86 | 91 | |
| 92 | + // Creation of a subtitle link pointing to [[Special:Log]] |
87 | 93 | $logPage = SpecialPage::getTitleFor( 'Log' ); |
88 | 94 | $logLink = $this->skin->link( |
89 | 95 | $logPage, |
— | — | @@ -93,15 +99,14 @@ |
94 | 100 | ); |
95 | 101 | $wgOut->setSubtitle( $logLink ); |
96 | 102 | |
| 103 | + // Handle atom/RSS feeds. |
97 | 104 | $feedType = $wgRequest->getVal( 'feed' ); |
98 | 105 | if ( $feedType ) { |
99 | 106 | wfProfileOut( __METHOD__ ); |
100 | 107 | return $this->feed( $feedType ); |
101 | 108 | } |
102 | 109 | |
103 | | - /* |
104 | | - * Fail if article doesn't exist. |
105 | | - */ |
| 110 | + // Fail nicely if article doesn't exist. |
106 | 111 | if ( !$this->title->exists() ) { |
107 | 112 | $wgOut->addWikiMsg( 'nohistory' ); |
108 | 113 | # show deletion/move log if there is an entry |
— | — | @@ -123,10 +128,11 @@ |
124 | 129 | /** |
125 | 130 | * Add date selector to quickly get to a certain time |
126 | 131 | */ |
127 | | - $year = $wgRequest->getInt( 'year' ); |
128 | | - $month = $wgRequest->getInt( 'month' ); |
129 | | - $tagFilter = $wgRequest->getVal( 'tagfilter' ); |
| 132 | + $year = $wgRequest->getInt( 'year' ); |
| 133 | + $month = $wgRequest->getInt( 'month' ); |
| 134 | + $tagFilter = $wgRequest->getVal( 'tagfilter' ); |
130 | 135 | $tagSelector = ChangeTags::buildTagFilterSelector( $tagFilter ); |
| 136 | + |
131 | 137 | /** |
132 | 138 | * Option to show only revisions that have been (partially) hidden via RevisionDelete |
133 | 139 | */ |
— | — | @@ -138,6 +144,7 @@ |
139 | 145 | $checkDeleted = Xml::checkLabel( wfMsg( 'history-show-deleted' ), |
140 | 146 | 'deleted', 'mw-show-deleted-only', $wgRequest->getBool( 'deleted' ) ) . "\n"; |
141 | 147 | |
| 148 | + // Add the general form |
142 | 149 | $action = htmlspecialchars( $wgScript ); |
143 | 150 | $wgOut->addHTML( |
144 | 151 | "<form action=\"$action\" method=\"get\" id=\"mw-history-searchform\">" . |
— | — | @@ -157,9 +164,7 @@ |
158 | 165 | |
159 | 166 | wfRunHooks( 'PageHistoryBeforeList', array( &$this->article ) ); |
160 | 167 | |
161 | | - /** |
162 | | - * Do the list |
163 | | - */ |
| 168 | + // Create and output the list. |
164 | 169 | $pager = new HistoryPager( $this, $year, $month, $tagFilter, $conds ); |
165 | 170 | $wgOut->addHTML( |
166 | 171 | $pager->getNavigationBar() . |
— | — | @@ -232,6 +237,7 @@ |
233 | 238 | } |
234 | 239 | $items = $this->fetchRevisions( $limit, 0, HistoryPage::DIR_NEXT ); |
235 | 240 | |
| 241 | + // Generate feed elements enclosed between header and footer. |
236 | 242 | $feed->outHeader(); |
237 | 243 | if ( $items ) { |
238 | 244 | foreach ( $items as $row ) { |