Use ->parse() for messages on Special:ResetTokens
[lhc/web/wiklou.git] / includes / CategoryViewer.php
index f9020b7..a9f5d23 100644 (file)
@@ -141,8 +141,9 @@ class CategoryViewer extends ContextSource {
                $this->children = array();
                $this->children_start_char = array();
                if ( $this->showGallery ) {
-                       $this->gallery = new ImageGallery();
+                       $this->gallery = ImageGalleryBase::factory();
                        $this->gallery->setHideBadImages();
+                       $this->gallery->setContext( $this->getContext() );
                } else {
                        $this->imgsNoGallery = array();
                        $this->imgsNoGallery_start_char = array();
@@ -249,7 +250,7 @@ class CategoryViewer extends ContextSource {
                $link = Linker::link( $title );
                if ( $isRedirect ) {
                        // This seems kind of pointless given 'mw-redirect' class,
-                       // but keeping for back-compatiability with user css.
+                       // but keeping for back-compatibility with user css.
                        $link = '<span class="redirect-in-category">' . $link . '</span>';
                }
                $this->articles[] = $link;
@@ -392,7 +393,7 @@ class CategoryViewer extends ContextSource {
                $r = '';
 
                # @todo FIXME: Here and in the other two sections: we don't need to bother
-               # with this rigamarole if the entire category contents fit on one page
+               # with this rigmarole if the entire category contents fit on one page
                # and have already been retrieved.  We can just use $rescnt in that
                # case and save a query and some logic.
                $dbcnt = $this->cat->getPageCount() - $this->cat->getSubcatCount()
@@ -526,7 +527,10 @@ class CategoryViewer extends ContextSource {
 
                        $first = true;
                        foreach ( $colContents as $char => $articles ) {
-                               $ret .= '<h3>' . htmlspecialchars( $char );
+                               # Change space to non-breaking space to keep headers aligned
+                               $h3char = $char === ' ' ? '&#160;' : htmlspecialchars( $char );
+
+                               $ret .= '<h3>' . $h3char;
                                if ( $first && $char === $prevchar ) {
                                        # We're continuing a previous chunk at the top of a new
                                        # column, so add " cont." after the letter.
@@ -574,7 +578,7 @@ class CategoryViewer extends ContextSource {
         * Create paging links, as a helper method to getSectionPagingLinks().
         *
         * @param string $first The 'until' parameter for the generated URL
-        * @param string $last The 'from' parameter for the genererated URL
+        * @param string $last The 'from' parameter for the generated URL
         * @param string $type A prefix for parameters, 'page' or 'subcat' or
         *     'file'
         * @return String HTML
@@ -645,11 +649,6 @@ class CategoryViewer extends ContextSource {
         * returned?  This function says what. Each type is considered independently
         * of the other types.
         *
-        * Note for grepping: uses the messages category-article-count,
-        * category-article-count-limited, category-subcat-count,
-        * category-subcat-count-limited, category-file-count,
-        * category-file-count-limited.
-        *
         * @param int $rescnt The number of items returned by our database query.
         * @param int $dbcnt The number of items according to the category table.
         * @param string $type 'subcat', 'article', or 'file'
@@ -697,8 +696,12 @@ class CategoryViewer extends ContextSource {
                        $this->cat->refreshCounts();
                } else {
                        # Case 3: hopeless.  Don't give a total count at all.
+                       # Give grep a chance to find the usages: category-subcat-count-limited,
+                       # category-article-count-limited, category-file-count-limited
                        return $this->msg( "category-$type-count-limited" )->numParams( $rescnt )->parseAsBlock();
                }
+               # Give grep a chance to find the usages:
+               # category-subcat-count, category-article-count, category-file-count
                return $this->msg( "category-$type-count" )->numParams( $rescnt, $totalcnt )->parseAsBlock();
        }
 }