Ensures empty UL elements are never included in output by testing if menus have anyth...
authorTrevor Parscal <tparscal@users.mediawiki.org>
Wed, 31 Mar 2010 06:48:47 +0000 (06:48 +0000)
committerTrevor Parscal <tparscal@users.mediawiki.org>
Wed, 31 Mar 2010 06:48:47 +0000 (06:48 +0000)
skins/Vector.php

index 538c89c..57f37dd 100644 (file)
@@ -694,11 +694,13 @@ class VectorTemplate extends QuickTemplate {
 ?>
 <div id="p-namespaces" class="vectorTabs<?php if ( count( $this->data['namespace_urls'] ) == 0 ) echo ' emptyPortlet'; ?>">
        <h5><?php $this->msg('namespaces') ?></h5>
+       <?php if ( count( $this->data['namespace_urls'] ) ): ?>
        <ul<?php $this->html('userlangattributes') ?>>
                <?php foreach ($this->data['namespace_urls'] as $key => $link ): ?>
                        <li <?php echo $link['attributes'] ?>><a href="<?php echo htmlspecialchars( $link['href'] ) ?>" <?php echo $link['key'] ?>><span><?php echo htmlspecialchars( $link['text'] ) ?></span></a></li>
                <?php endforeach; ?>
        </ul>
+       <?php endif; ?>
 </div>
 <?php
                                break;
@@ -707,11 +709,13 @@ class VectorTemplate extends QuickTemplate {
 <div id="p-variants" class="vectorMenu<?php if ( count( $this->data['variant_urls'] ) == 0 ) echo ' emptyPortlet'; ?>">
        <h5><span><?php $this->msg('variants') ?></span><a href="#"></a></h5>
        <div class="menu">
+               <?php if ( count( $this->data['variant_urls'] ) ): ?>
                <ul<?php $this->html('userlangattributes') ?>>
                        <?php foreach ($this->data['variant_urls'] as $key => $link ): ?>
                                <li<?php echo $link['attributes'] ?>><a href="<?php echo htmlspecialchars( $link['href'] ) ?>" <?php echo $link['key'] ?>><?php echo htmlspecialchars( $link['text'] ) ?></a></li>
                        <?php endforeach; ?>
                </ul>
+               <?php endif; ?>
        </div>
 </div>
 <?php
@@ -720,11 +724,13 @@ class VectorTemplate extends QuickTemplate {
 ?>
 <div id="p-views" class="vectorTabs<?php if ( count( $this->data['view_urls'] ) == 0 ) echo ' emptyPortlet'; ?>">
        <h5><?php $this->msg('views') ?></h5>
+       <?php if ( count( $this->data['view_urls'] ) ): ?>
        <ul<?php $this->html('userlangattributes') ?>>
                <?php foreach ($this->data['view_urls'] as $key => $link ): ?>
                        <li<?php echo $link['attributes'] ?>><a href="<?php echo htmlspecialchars( $link['href'] ) ?>" <?php echo $link['key'] ?>><?php echo (array_key_exists('img',$link) ?  '<img src="'.$link['img'].'" alt="'.$link['text'].'" />' : '<span>'.htmlspecialchars( $link['text'] ).'</span>') ?></a></li>
                <?php endforeach; ?>
        </ul>
+       <?php endif; ?>
 </div>
 <?php
                                break;
@@ -733,11 +739,13 @@ class VectorTemplate extends QuickTemplate {
 <div id="p-cactions" class="vectorMenu<?php if ( count( $this->data['action_urls'] ) == 0 ) echo ' emptyPortlet'; ?>">
        <h5><span><?php $this->msg('actions') ?></span><a href="#"></a></h5>
        <div class="menu">
+               <?php if ( count( $this->data['action_urls'] ) ): ?>
                <ul<?php $this->html('userlangattributes') ?>>
                        <?php foreach ($this->data['action_urls'] as $key => $link ): ?>
                                <li<?php echo $link['attributes'] ?>><a href="<?php echo htmlspecialchars( $link['href'] ) ?>" <?php echo $link['key'] ?>><?php echo htmlspecialchars( $link['text'] ) ?></a></li>
                        <?php endforeach; ?>
                </ul>
+               <?php endif; ?>
        </div>
 </div>
 <?php
@@ -746,11 +754,13 @@ class VectorTemplate extends QuickTemplate {
 ?>
 <div id="p-personal" class="<?php if ( count( $this->data['personal_urls'] ) == 0 ) echo ' emptyPortlet'; ?>">
        <h5><?php $this->msg('personaltools') ?></h5>
+       <?php if ( count( $this->data['personal_urls'] ) ): ?>
        <ul<?php $this->html('userlangattributes') ?>>
                <?php foreach($this->data['personal_urls'] as $key => $item): ?>
                        <li <?php echo $item['attributes'] ?>><a href="<?php echo htmlspecialchars($item['href']) ?>"<?php echo $item['key'] ?><?php if(!empty($item['class'])): ?> class="<?php echo htmlspecialchars($item['class']) ?>"<?php endif; ?>><?php echo htmlspecialchars($item['text']) ?></a></li>
                <?php endforeach; ?>
        </ul>
+       <?php endif; ?>
 </div>
 <?php
                                break;