X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FCategoryViewer.php;h=389b07747499bdbaee391d743cbcc7c1f59c934f;hb=ba292d9b05eb43f60f76566bcc27fe285beace3d;hp=b912603611421f904096198bc6197c4d3d92439d;hpb=a85d1b9d0cd7f02111d3a647d5b91e3b1f334563;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/CategoryViewer.php b/includes/CategoryViewer.php index b912603611..389b077474 100644 --- a/includes/CategoryViewer.php +++ b/includes/CategoryViewer.php @@ -138,9 +138,13 @@ class CategoryViewer extends ContextSource { } $lang = $this->getLanguage(); - $langAttribs = [ 'lang' => $lang->getHtmlCode(), 'dir' => $lang->getDir() ]; + $attribs = [ + 'class' => 'mw-category-generated', + 'lang' => $lang->getHtmlCode(), + 'dir' => $lang->getDir() + ]; # put a div around the headings which are in the user language - $r = Html::openElement( 'div', $langAttribs ) . $r . ''; + $r = Html::openElement( 'div', $attribs ) . $r . ''; return $r; } @@ -387,6 +391,7 @@ class CategoryViewer extends ContextSource { $r = ''; $rescnt = count( $this->children ); $dbcnt = $this->cat->getSubcatCount(); + // This function should be called even if the result isn't used, it has side-effects $countmsg = $this->getCountMessage( $rescnt, $dbcnt, 'subcat' ); if ( $rescnt > 0 ) { @@ -417,6 +422,7 @@ class CategoryViewer extends ContextSource { $dbcnt = $this->cat->getPageCount() - $this->cat->getSubcatCount() - $this->cat->getFileCount(); $rescnt = count( $this->articles ); + // This function should be called even if the result isn't used, it has side-effects $countmsg = $this->getCountMessage( $rescnt, $dbcnt, 'article' ); if ( $rescnt > 0 ) { @@ -437,10 +443,11 @@ class CategoryViewer extends ContextSource { function getImageSection() { $r = ''; $rescnt = $this->showGallery ? $this->gallery->count() : count( $this->imgsNoGallery ); - if ( $rescnt > 0 ) { - $dbcnt = $this->cat->getFileCount(); - $countmsg = $this->getCountMessage( $rescnt, $dbcnt, 'file' ); + $dbcnt = $this->cat->getFileCount(); + // This function should be called even if the result isn't used, it has side-effects + $countmsg = $this->getCountMessage( $rescnt, $dbcnt, 'file' ); + if ( $rescnt > 0 ) { $r .= "
\n"; $r .= '

' . $this->msg(