Index: trunk/phase3/includes/CategoryPage.php |
— | — | @@ -92,7 +92,7 @@ |
93 | 93 | } |
94 | 94 | } |
95 | 95 | |
96 | | -class CategoryViewer { |
| 96 | +class CategoryViewer extends ContextSource { |
97 | 97 | var $limit, $from, $until, |
98 | 98 | $articles, $articles_start_char, |
99 | 99 | $children, $children_start_char, |
— | — | @@ -138,12 +138,6 @@ |
139 | 139 | private $query; |
140 | 140 | |
141 | 141 | /** |
142 | | - * Context object |
143 | | - * @var IContextSource |
144 | | - */ |
145 | | - protected $context; |
146 | | - |
147 | | - /** |
148 | 142 | * Constructor |
149 | 143 | * |
150 | 144 | * @since 1.19 $context is a second, required parameter |
— | — | @@ -156,7 +150,7 @@ |
157 | 151 | function __construct( $title, IContextSource $context, $from = '', $until = '', $query = array() ) { |
158 | 152 | global $wgCategoryPagingLimit; |
159 | 153 | $this->title = $title; |
160 | | - $this->context = $context; |
| 154 | + $this->setContext( $context ); |
161 | 155 | $this->from = $from; |
162 | 156 | $this->until = $until; |
163 | 157 | $this->limit = $wgCategoryPagingLimit; |
— | — | @@ -175,7 +169,7 @@ |
176 | 170 | global $wgCategoryMagicGallery; |
177 | 171 | wfProfileIn( __METHOD__ ); |
178 | 172 | |
179 | | - $this->showGallery = $wgCategoryMagicGallery && !$this->context->getOutput()->mNoGallery; |
| 173 | + $this->showGallery = $wgCategoryMagicGallery && !$this->getOutput()->mNoGallery; |
180 | 174 | |
181 | 175 | $this->clearCategoryState(); |
182 | 176 | $this->doCategoryQuery(); |
— | — | @@ -265,6 +259,8 @@ |
266 | 260 | * @param string $sortkey The human-readable sortkey (before transforming to icu or whatever). |
267 | 261 | */ |
268 | 262 | function getSubcategorySortChar( $title, $sortkey ) { |
| 263 | + global $wgContLang; |
| 264 | + |
269 | 265 | if ( $title->getPrefixedText() == $sortkey ) { |
270 | 266 | $word = $title->getDBkey(); |
271 | 267 | } else { |
— | — | @@ -273,13 +269,14 @@ |
274 | 270 | |
275 | 271 | $firstChar = $this->collation->getFirstLetter( $word ); |
276 | 272 | |
277 | | - return $this->getLang()->convert( $firstChar ); |
| 273 | + return $wgContLang->convert( $firstChar ); |
278 | 274 | } |
279 | 275 | |
280 | 276 | /** |
281 | 277 | * Add a page in the image namespace |
282 | 278 | */ |
283 | 279 | function addImage( Title $title, $sortkey, $pageLength, $isRedirect = false ) { |
| 280 | + global $wgContLang; |
284 | 281 | if ( $this->showGallery ) { |
285 | 282 | $flip = $this->flip['file']; |
286 | 283 | if ( $flip ) { |
— | — | @@ -296,7 +293,7 @@ |
297 | 294 | } |
298 | 295 | $this->imgsNoGallery[] = $link; |
299 | 296 | |
300 | | - $this->imgsNoGallery_start_char[] = $this->getLang()->convert( |
| 297 | + $this->imgsNoGallery_start_char[] = $wgContLang->convert( |
301 | 298 | $this->collation->getFirstLetter( $sortkey ) ); |
302 | 299 | } |
303 | 300 | } |
— | — | @@ -305,6 +302,8 @@ |
306 | 303 | * Add a miscellaneous page |
307 | 304 | */ |
308 | 305 | function addPage( $title, $sortkey, $pageLength, $isRedirect = false ) { |
| 306 | + global $wgContLang; |
| 307 | + |
309 | 308 | $link = Linker::link( $title ); |
310 | 309 | if ( $isRedirect ) { |
311 | 310 | // This seems kind of pointless given 'mw-redirect' class, |
— | — | @@ -313,7 +312,7 @@ |
314 | 313 | } |
315 | 314 | $this->articles[] = $link; |
316 | 315 | |
317 | | - $this->articles_start_char[] = $this->getLang()->convert( |
| 316 | + $this->articles_start_char[] = $wgContLang->convert( |
318 | 317 | $this->collation->getFirstLetter( $sortkey ) ); |
319 | 318 | } |
320 | 319 | |
— | — | @@ -620,12 +619,8 @@ |
621 | 620 | * @return String HTML |
622 | 621 | */ |
623 | 622 | private function pagingLinks( $first, $last, $type = '' ) { |
624 | | - global $wgLang; |
| 623 | + $prevLink = wfMessage( 'prevn' )->numParams( $this->limit )->escaped(); |
625 | 624 | |
626 | | - $limitText = $this->getLang()->formatNum( $this->limit ); |
627 | | - |
628 | | - $prevLink = wfMsgExt( 'prevn', array( 'escape', 'parsemag' ), $limitText ); |
629 | | - |
630 | 625 | if ( $first != '' ) { |
631 | 626 | $prevQuery = $this->query; |
632 | 627 | $prevQuery["{$type}until"] = $first; |
— | — | @@ -638,7 +633,7 @@ |
639 | 634 | ); |
640 | 635 | } |
641 | 636 | |
642 | | - $nextLink = wfMsgExt( 'nextn', array( 'escape', 'parsemag' ), $limitText ); |
| 637 | + $nextLink = wfMessage( 'nextn' )->numParams( $this->limit )->escaped(); |
643 | 638 | |
644 | 639 | if ( $last != '' ) { |
645 | 640 | $lastQuery = $this->query; |
— | — | @@ -735,23 +730,8 @@ |
736 | 731 | $this->cat->refreshCounts(); |
737 | 732 | } else { |
738 | 733 | # Case 3: hopeless. Don't give a total count at all. |
739 | | - return wfMsgExt( "category-$type-count-limited", 'parse', |
740 | | - $this->getLang()->formatNum( $rescnt ) ); |
| 734 | + return wfMessage( "category-$type-count-limited" )->numParams( $rescnt )->parseAsBlock(); |
741 | 735 | } |
742 | | - return wfMsgExt( |
743 | | - "category-$type-count", |
744 | | - 'parse', |
745 | | - $this->getLang()->formatNum( $rescnt ), |
746 | | - $this->getLang()->formatNum( $totalcnt ) |
747 | | - ); |
| 736 | + return wfMessage( "category-$type-count" )->numParams( $rescnt, $totalcnt )->parseAsBlock(); |
748 | 737 | } |
749 | | - |
750 | | - /** |
751 | | - * Returns a language object from the context |
752 | | - * |
753 | | - * @return Language |
754 | | - */ |
755 | | - protected function getLang() { |
756 | | - return $this->context->getLang(); |
757 | | - } |
758 | 738 | } |