}
}
+ /**
+ * Returns an array of footerlinks trimmed down to only those footer links that
+ * are valid.
+ * If you pass "flat" as an option then the returned array will be a flat array
+ * of footer icons instead of a key/value array of footerlinks arrays broken
+ * up into categories.
+ */
+ function getFooterLinks($option = null) {
+ $footerlinks = $this->data["footerlinks"];
+
+ // Reduce footer links down to only those which are being used
+ $validFooterLinks = array();
+ foreach( $footerlinks as $category => $links ) {
+ $validFooterLinks[$category] = array();
+ foreach( $links as $link ) {
+ if( isset( $this->data[$link] ) && $this->data[$link] ) {
+ $validFooterLinks[$category][] = $link;
+ }
+ }
+ if ( count( $validFooterLinks[$category] ) <= 0 ) {
+ unset($validFooterLinks[$category]);
+ }
+ }
+
+ if ( $option == "flat" ) {
+ // fold footerlinks into a single array using a bit of trickery
+ $validFooterLinks = call_user_func_array('array_merge', array_values($validFooterLinks));
+ }
+
+ return $validFooterLinks;
+ }
+
+ /**
+ * Returns an array of footer icons filtered down by options relevant to how
+ * the skin wishes to display them.
+ * If you pass "icononly" as the option all footer icons which do not have an
+ * image icon set will be filtered out.
+ * If you pass "nocopyright" then MediaWiki's copyright icon will not be included
+ * in the list of footer icons. This is mostly useful for skins which only
+ * display the text from footericons instead of the images and don't want a
+ * duplicate copyright statement because footerlinks already rendered one.
+ */
+ function getFooterIcons($option = null) {
+ // Generate additional footer icons
+ $footericons = $this->data["footericons"];
+
+ if ( $option == "icononly" ) {
+ // Unset any icons which don't have an image
+ foreach ( $footericons as $footerIconsKey => &$footerIconsBlock ) {
+ foreach ( $footerIconsBlock as $footerIconKey => $footerIcon ) {
+ if ( !is_string($footerIcon) && !isset($footerIcon["src"]) ) {
+ unset($footerIconsBlock[$footerIconKey]);
+ }
+ }
+ }
+ // Redo removal of any empty blocks
+ foreach ( $footericons as $footerIconsKey => &$footerIconsBlock ) {
+ if ( count($footerIconsBlock) <= 0 ) {
+ unset($footericons[$footerIconsKey]);
+ }
+ }
+ } else if ( $option == "nocopyright" ) {
+ $footericons = $this->data["footericons"];
+ unset($footericons["copyright"]["copyright"]);
+ if ( count($footericons["copyright"]) <= 0 ) {
+ unset($footericons["copyright"]);
+ }
+ }
+
+ return $footericons;
+ }
+
+
}
// Suppress warnings to prevent notices about missing indexes in $this->data
wfSuppressWarnings();
- // Generate additional footer links
- $footerlinks = $this->data["footerlinks"];
- // fold footerlinks into a single array using a bit of trickery
- $footerlinks = call_user_func_array('array_merge', array_values($footerlinks));
- // Generate additional footer icons
- $footericons = $this->data["footericons"];
- // Unset copyright.copyright since we don't need the icon and already output a copyright from footerlinks
- unset($footericons["copyright"]["copyright"]);
- if ( count($footericons["copyright"]) <= 0 ) {
- unset($footericons["copyright"]);
- }
-
$this->html( 'headelement' );
?>
<div id="footer"<?php $this->html('userlangattributes') ?>>
<ul id="f-list">
<?php
- foreach( $footerlinks as $aLink ) {
+ foreach( $this->getFooterLinks("flat") as $aLink ) {
if( isset( $this->data[$aLink] ) && $this->data[$aLink] ) {
?> <li id="<?php echo$aLink?>"><?php $this->html($aLink) ?></li>
<?php }
?>
</ul>
<?php
- foreach ( $footericons as $blockName => $footerIcons ) { ?>
+ foreach ( $this->getFooterIcons("nocopyright") as $blockName => $footerIcons ) { ?>
<div id="mw_<?php echo htmlspecialchars($blockName); ?>">
<?php
foreach ( $footerIcons as $icon ) { ?>
// Suppress warnings to prevent notices about missing indexes in $this->data
wfSuppressWarnings();
- // Generate additional footer links
- $footerlinks = $this->data["footerlinks"];
- // fold footerlinks into a single array using a bit of trickery
- $footerlinks = call_user_func_array('array_merge', array_values($footerlinks));
// Generate additional footer icons
$footericons = $this->data["footericons"];
// Unset any icons which don't have an image
<?php }
// Generate additional footer links
- $validFooterLinks = array();
- foreach( $footerlinks as $aLink ) {
- if( isset( $this->data[$aLink] ) && $this->data[$aLink] ) {
- $validFooterLinks[] = $aLink;
- }
- }
+ $validFooterLinks = $this->getFooterLinks("flat");
if ( count( $validFooterLinks ) > 0 ) {
?> <ul id="f-list">
<?php
- foreach( $validFooterLinks as $aLink ) {
- if( isset( $this->data[$aLink] ) && $this->data[$aLink] ) {
-?> <li id="<?php echo $aLink ?>"><?php $this->html($aLink) ?></li>
-<?php }
+ foreach( $validFooterLinks as $aLink ) { ?>
+ <li id="<?php echo $aLink ?>"><?php $this->html($aLink) ?></li>
+
+<?php
}
?>
</ul>
$this->skin->tooltipAndAccesskey('pt-'.$key);
}
- // Generate additional footer links
- $footerlinks = $this->data["footerlinks"];
-
- // Reduce footer links down to only those which are being used
- $validFooterLinks = array();
- foreach( $footerlinks as $category => $links ) {
- $validFooterLinks[$category] = array();
- foreach( $links as $link ) {
- if( isset( $this->data[$link] ) && $this->data[$link] ) {
- $validFooterLinks[$category][] = $link;
- }
- }
- }
-
- // Generate additional footer icons
- $footericons = $this->data["footericons"];
- // Unset any icons which don't have an image
- foreach ( $footericons as $footerIconsKey => &$footerIconsBlock ) {
- foreach ( $footerIconsBlock as $footerIconKey => $footerIcon ) {
- if ( !is_string($footerIcon) && !isset($footerIcon["src"]) ) {
- unset($footerIconsBlock[$footerIconKey]);
- }
- }
- }
- // Redo removal of any empty blocks
- foreach ( $footericons as $footerIconsKey => &$footerIconsBlock ) {
- if ( count($footerIconsBlock) <= 0 ) {
- unset($footericons[$footerIconsKey]);
- }
- }
-
// Reverse horizontally rendered navigation elements
if ( $wgLang->isRTL() ) {
$this->data['view_urls'] =
<!-- /panel -->
<!-- footer -->
<div id="footer"<?php $this->html('userlangattributes') ?>>
- <?php foreach( $validFooterLinks as $category => $links ): ?>
- <?php if ( count( $links ) > 0 ): ?>
+ <?php foreach( $this->getFooterLinks() as $category => $links ): ?>
<ul id="footer-<?php echo $category ?>">
<?php foreach( $links as $link ): ?>
- <?php if( isset( $this->data[$link] ) && $this->data[$link] ): ?>
<li id="footer-<?php echo $category ?>-<?php echo $link ?>"><?php $this->html( $link ) ?></li>
- <?php endif; ?>
<?php endforeach; ?>
</ul>
- <?php endif; ?>
<?php endforeach; ?>
-<?php if ( count( $footericons ) > 0 ): ?>
+ <?php $footericons = $this->getFooterIcons("icononly");
+ if ( count( $footericons ) > 0 ): ?>
<ul id="footer-icons" class="noprint">
<?php foreach ( $footericons as $blockName => $footerIcons ): ?>
<li id="footer-<?php echo htmlspecialchars($blockName); ?>ico">