Take the footer icon html building common to all 3 skins using r77741 $wgFooterIcons...
authorDaniel Friesen <dantman@users.mediawiki.org>
Sun, 5 Dec 2010 04:44:28 +0000 (04:44 +0000)
committerDaniel Friesen <dantman@users.mediawiki.org>
Sun, 5 Dec 2010 04:44:28 +0000 (04:44 +0000)
Also fix the location of the noprint class meant to be on footer-icons in vector.

includes/Skin.php
skins/Modern.php
skins/MonoBook.php
skins/Vector.php

index 271e4f0..11a4651 100644 (file)
@@ -1630,6 +1630,29 @@ class Skin extends Linker {
                return $s;
        }
 
+       /**
+        * Renders a $wgFooterIcons icon acording to the method's arguments
+        * @param $icon Array: The icon to build the html for
+        * @param $useImg Boolean: Whether to use the icon's image or output a text-only footericon
+        */
+       function makeFooterIcon( $icon, $useImg = true ) {
+               if ( is_string($icon) ) {
+                       $html = $icon;
+               } else {
+                       $url = $icon["url"];
+                       unset($icon["url"]);
+                       if ( isset($icon["src"]) && $useImg ) {
+                               $html = Html::element( 'img', $icon ); // do this the lazy way, just pass icon data as an attribute array
+                       } else {
+                               $html = htmlspecialchars($icon["alt"]);
+                       }
+                       if ( $url ) {
+                               $html = Html::rawElement( 'a', array( "href" => $url ), $html );
+                       }
+               }
+               return $html;
+       }
+
        /**
         * Gets the link to the wiki's main page.
         * @return string
index 086f8bf..27f958e 100644 (file)
@@ -194,16 +194,10 @@ class ModernTemplate extends MonoBookTemplate {
                foreach ( $footericons as $blockName => $footerIcons ) { ?>
                        <div id="mw_<?php echo htmlspecialchars($blockName); ?>">
 <?php
-                       foreach ( $footerIcons as $icon ) { 
-                               if ( is_string($icon) ) {
-                                       $html = $icon;
-                               } else {
-                                       $html = htmlspecialchars($icon["alt"]);
-                                       if ( $icon["url"] ) {
-                                               $html = Html::element( 'a', array( "href" => $icon["url"] ), $html );
-                                       }
-                               }
-                               echo "                          $html\n";
+                       foreach ( $footerIcons as $icon ) { ?>
+                               <?php echo $this->skin->makeFooterIcon( $icon, false ); ?>
+
+<?php
                        } ?>
                        </div>
 <?php
index e3e2e9a..8b0db5b 100644 (file)
@@ -189,23 +189,11 @@ class MonoBookTemplate extends QuickTemplate {
 <div id="footer"<?php $this->html('userlangattributes') ?>>
 <?php foreach ( $footericons as $blockName => $footerIcons ) { ?>
        <div id="f-<?php echo htmlspecialchars($blockName); ?>ico">
-<?php  foreach ( $footerIcons as $icon ) { 
-                       if ( is_string($icon) ) {
-                               $html = $icon;
-                       } else {
-                               $url = $icon["url"];
-                               unset($icon["url"]);
-                               if ( isset($icon["src"]) ) {
-                                       $html = Html::element( 'img', $icon ); // do this the lazy way, just pass icon data as an attribute array
-                               } else {
-                                       $html = htmlspecialchars($icon["alt"]);
-                               }
-                               if ( $url ) {
-                                       $html = Html::rawElement( 'a', array( "href" => $url ), $html );
-                               }
-                       }
-                       echo "          $html\n";
-               } ?>
+<?php foreach ( $footerIcons as $icon ) { ?>
+               <?php echo $this->skin->makeFooterIcon( $icon ); ?>
+
+<?php }
+?>
        </div>
 <?php }
 
index 057f205..f972101 100644 (file)
@@ -545,26 +545,13 @@ class VectorTemplate extends QuickTemplate {
                                <?php endif; ?>
                        <?php endforeach; ?>
 <?php                  if ( count( $footericons ) > 0 ): ?>
-                               <ul id="footer-icons">
+                               <ul id="footer-icons" class="noprint">
 <?php                  foreach ( $footericons as $blockName => $footerIcons ): ?>
-                                       <li id="footer-<?php echo htmlspecialchars($blockName); ?>ico" class="noprint">
-<?php                                  foreach ( $footerIcons as $icon ):
-                                                       if ( is_string($icon) ) {
-                                                               $html = $icon;
-                                                       } else {
-                                                               $url = $icon["url"];
-                                                               unset($icon["url"]);
-                                                               if ( isset($icon["src"]) ) {
-                                                                       $html = Html::element( 'img', $icon ); // do this the lazy way, just pass icon data as an attribute array
-                                                               } else {
-                                                                       $html = htmlspecialchars($icon["alt"]);
-                                                               }
-                                                               if ( $url ) {
-                                                                       $html = Html::rawElement( 'a', array( "href" => $url ), $html );
-                                                               }
-                                                       }
-                                                       echo "                                          $html\n";
-                                               endforeach; ?>
+                                       <li id="footer-<?php echo htmlspecialchars($blockName); ?>ico">
+<?php                          foreach ( $footerIcons as $icon ): ?>
+                                               <?php echo $this->skin->makeFooterIcon( $icon ); ?>
+
+<?php                          endforeach; ?>
                                        </li>
 <?php                  endforeach; ?>
                                </ul>