Implementations for MonoBook, Vector, and Modern. Modern implementation uses text instead of icons as desired.
*/
$wgExperimentalHtmlIds = true;
+/**
+ * Abstract list of footer icons for skins in place of old copyrightico and poweredbyico code
+ * You can add new icons to the built in copyright or poweredby, or you can create
+ * a new block. Though note that you may need to add some custom css to get good styling
+ * of new blocks in monobook. vector and modern should work without any special css.
+ */
+$wgFooterIcons = array(
+ "copyright" => array(
+ "copyright" => array(), // placeholder for the built in copyright icon
+ ),
+ "poweredby" => array(
+ "mediawiki" => array(
+ "src" => null, // Defaults to "$wgStylePath/common/images/poweredby_mediawiki_88x31.png"
+ "url" => "http://www.mediawiki.org/",
+ "alt" => "Powered by MediaWiki",
+ )
+ ),
+);
+
/**
* Search form behavior for Vector skin only
* true = use an icon search button
$wgDeletedDirectory = $wgFileStore['deleted']['directory'];
}
+if( isset($wgFooterIcons["copyright"]) &&
+ isset($wgFooterIcons["copyright"]["copyright"]) &&
+ $wgFooterIcons["copyright"]["copyright"] === array() ) {
+ if ( isset( $wgCopyrightIcon ) && $wgCopyrightIcon ) {
+ $wgFooterIcons["copyright"]["copyright"] = $wgCopyrightIcon;
+ } elseif ( $wgRightsIcon || $wgRightsText ) {
+ $wgFooterIcons["copyright"]["copyright"] = array(
+ "url" => $wgRightsUrl,
+ "src" => $wgRightsIcon,
+ "alt" => $wgRightsText,
+ );
+ } else {
+ unset($wgFooterIcons["copyright"]["copyright"]);
+ }
+}
+
+if( isset($wgFooterIcons["poweredby"]) &&
+ isset($wgFooterIcons["poweredby"]["mediawiki"]) &&
+ $wgFooterIcons["poweredby"]["mediawiki"]["src"] === null ) {
+ $wgFooterIcons["poweredby"]["mediawiki"]["src"] = "$wgStylePath/common/images/poweredby_mediawiki_88x31.png";
+}
+
/**
* Unconditional protection for NS_MEDIAWIKI since otherwise it's too easy for a
* sysadmin to set $wgNamespaceProtection incorrectly and leave the wiki insecure.
'disclaimer',
),
) );
+
+ global $wgFooterIcons;
+ $tpl->set( 'footericons', $wgFooterIcons );
+ foreach ( $tpl->data["footericons"] as $footerIconsKey => &$footerIconsBlock ) {
+ if ( count($footerIconsBlock) > 0 ) {
+ foreach ( $footerIconsBlock as &$footerIcon ) {
+ if ( isset($footerIcon["src"]) ) {
+ if ( !isset($footerIcon["width"]) ) $footerIcon["width"] = 88;
+ if ( !isset($footerIcon["height"]) ) $footerIcon["height"] = 31;
+ }
+ }
+ } else {
+ unset($tpl->data["footericons"][$footerIconsKey]);
+ }
+ }
if ( $wgDebugComments ) {
$tpl->setRef( 'debug', $out->mDebugtext );
var $skinname = 'modern', $stylename = 'modern',
$template = 'ModernTemplate', $useHeadElement = true;
- /*
- * We don't like the default getPoweredBy, the icon clashes with the
- * skin L&F.
- */
- function getPoweredBy() {
- global $wgVersion;
- $text = "<div class='mw_poweredby'>Powered by MediaWiki $wgVersion</div>";
- wfRunHooks( 'SkinGetPoweredBy', array( &$text, $this ) );
- return $text;
- }
-
function setupSkinUserCss( OutputPage $out ){
// Do not call parent::setupSkinUserCss(), we have our own print style
$out->addStyle( 'common/shared.css', 'screen' );
// 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
- $footerlinks = array(
- 'lastmod', 'viewcount', 'numberofwatchingusers', 'credits', 'copyright',
- 'privacy', 'about', 'disclaimer', 'tagline',
- );
foreach( $footerlinks as $aLink ) {
if( isset( $this->data[$aLink] ) && $this->data[$aLink] ) {
?> <li id="<?php echo$aLink?>"><?php $this->html($aLink) ?></li>
}
?>
</ul>
- <?php echo $this->html("poweredbyico"); ?>
+<?php
+ 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";
+ } ?>
+ </div>
+<?php
+ }
+?>
</div>
<?php $this->html('bottomscripts'); /* JS call to runBodyOnloadHook */ ?>
$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
+ 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]);
+ }
+ }
$this->html( 'headelement' );
?><div id="globalWrapper">
</div><!-- end of the left (by default at least) column -->
<div class="visualClear"></div>
<div id="footer"<?php $this->html('userlangattributes') ?>>
-<?php
-if($this->data['poweredbyico']) { ?>
- <div id="f-poweredbyico"><?php $this->html('poweredbyico') ?></div>
-<?php }
-if($this->data['copyrightico']) { ?>
- <div id="f-copyrightico"><?php $this->html('copyrightico') ?></div>
+<?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";
+ } ?>
+ </div>
<?php }
// Generate additional footer links
// Generate additional footer links
$footerlinks = $this->data["footerlinks"];
- // footerlinks doesn't include icons for now, so we'll just append the default
- $footerlinks["icons"] = array( 'poweredbyico', 'copyrightico', );
- $footerlinksClasses = array(
- 'icons' => array( 'noprint' )
- );
-
// Reduce footer links down to only those which are being used
$validFooterLinks = array();
foreach( $footerlinks as $category => $links ) {
}
}
}
+
+ // 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'] =
<div id="footer"<?php $this->html('userlangattributes') ?>>
<?php foreach( $validFooterLinks as $category => $links ): ?>
<?php if ( count( $links ) > 0 ): ?>
- <ul id="footer-<?php echo $category ?>"<?php if (isset($footerlinksClasses[$category])) echo ' class="' . implode(" ", $footerlinksClasses[$category]) . '"'; ?>>
+ <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>
</ul>
<?php endif; ?>
<?php endforeach; ?>
+<?php if ( count( $footericons ) > 0 ): ?>
+ <ul id="footer-icons">
+<?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>
+<?php endforeach; ?>
+ </ul>
+ <?php endif; ?>
<div style="clear:both"></div>
</div>
<!-- /footer -->