Remove table header from Special:Tags when there are no tags
[lhc/web/wiklou.git] / includes / specials / SpecialTags.php
index ff263b6..0b8147e 100644 (file)
@@ -114,6 +114,12 @@ class SpecialTags extends SpecialPage {
                $showActions = $user->isAllowed( 'managechangetags' );
 
                // Write the headers
+               $tagUsageStatistics = ChangeTags::tagUsageStatistics();
+
+               // Show header only if there exists atleast one tag
+               if ( !$tagUsageStatistics ) {
+                       return;
+               }
                $html = Xml::tags( 'tr', null, Xml::tags( 'th', null, $this->msg( 'tags-tag' )->parse() ) .
                        Xml::tags( 'th', null, $this->msg( 'tags-display-header' )->parse() ) .
                        Xml::tags( 'th', null, $this->msg( 'tags-description-header' )->parse() ) .
@@ -134,7 +140,7 @@ class SpecialTags extends SpecialPage {
                $this->extensionActivatedTags = array_fill_keys(
                        ChangeTags::listExtensionActivatedTags(), true );
 
-               foreach ( ChangeTags::tagUsageStatistics() as $tag => $hitcount ) {
+               foreach ( $tagUsageStatistics as $tag => $hitcount ) {
                        $html .= $this->doTagRow( $tag, $hitcount, $showActions );
                }