From 5a8c63847f22324ae80f9f27ffbfa3eeb72e40a4 Mon Sep 17 00:00:00 2001 From: Daniel Friesen Date: Sun, 5 Dec 2010 04:44:28 +0000 Subject: [PATCH] Take the footer icon html building common to all 3 skins using r77741 $wgFooterIcons and turn it into a common makeFooterIcon method they can share. Also fix the location of the noprint class meant to be on footer-icons in vector. --- includes/Skin.php | 23 +++++++++++++++++++++++ skins/Modern.php | 14 ++++---------- skins/MonoBook.php | 22 +++++----------------- skins/Vector.php | 25 ++++++------------------- 4 files changed, 38 insertions(+), 46 deletions(-) diff --git a/includes/Skin.php b/includes/Skin.php index 271e4f0de7..11a4651b24 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -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 diff --git a/skins/Modern.php b/skins/Modern.php index 086f8bfabc..27f958eef5 100644 --- a/skins/Modern.php +++ b/skins/Modern.php @@ -194,16 +194,10 @@ class ModernTemplate extends MonoBookTemplate { foreach ( $footericons as $blockName => $footerIcons ) { ?>
$icon["url"] ), $html ); - } - } - echo " $html\n"; + foreach ( $footerIcons as $icon ) { ?> + skin->makeFooterIcon( $icon, false ); ?> + +
html('userlangattributes') ?>> $footerIcons ) { ?>
- $url ), $html ); - } - } - echo " $html\n"; - } ?> + + skin->makeFooterIcon( $icon ); ?> + +
0 ): ?> -