Index: trunk/phase3/skins/Vector.php |
— | — | @@ -413,13 +413,7 @@ |
414 | 414 | |
415 | 415 | // Generate additional footer links |
416 | 416 | $footerlinks = $this->data["footerlinks"]; |
417 | | - // footerlinks doesn't include icons for now, so we'll just append the default |
418 | | - $footerlinks["icons"] = array( 'poweredbyico', 'copyrightico', ); |
419 | 417 | |
420 | | - $footerlinksClasses = array( |
421 | | - 'icons' => array( 'noprint' ) |
422 | | - ); |
423 | | - |
424 | 418 | // Reduce footer links down to only those which are being used |
425 | 419 | $validFooterLinks = array(); |
426 | 420 | foreach( $footerlinks as $category => $links ) { |
— | — | @@ -430,6 +424,24 @@ |
431 | 425 | } |
432 | 426 | } |
433 | 427 | } |
| 428 | + |
| 429 | + // Generate additional footer icons |
| 430 | + $footericons = $this->data["footericons"]; |
| 431 | + // Unset any icons which don't have an image |
| 432 | + foreach ( $footericons as $footerIconsKey => &$footerIconsBlock ) { |
| 433 | + foreach ( $footerIconsBlock as $footerIconKey => $footerIcon ) { |
| 434 | + if ( !is_string($footerIcon) && !isset($footerIcon["src"]) ) { |
| 435 | + unset($footerIconsBlock[$footerIconKey]); |
| 436 | + } |
| 437 | + } |
| 438 | + } |
| 439 | + // Redo removal of any empty blocks |
| 440 | + foreach ( $footericons as $footerIconsKey => &$footerIconsBlock ) { |
| 441 | + if ( count($footerIconsBlock) <= 0 ) { |
| 442 | + unset($footericons[$footerIconsKey]); |
| 443 | + } |
| 444 | + } |
| 445 | + |
434 | 446 | // Reverse horizontally rendered navigation elements |
435 | 447 | if ( $wgLang->isRTL() ) { |
436 | 448 | $this->data['view_urls'] = |
— | — | @@ -523,7 +535,7 @@ |
524 | 536 | <div id="footer"<?php $this->html('userlangattributes') ?>> |
525 | 537 | <?php foreach( $validFooterLinks as $category => $links ): ?> |
526 | 538 | <?php if ( count( $links ) > 0 ): ?> |
527 | | - <ul id="footer-<?php echo $category ?>"<?php if (isset($footerlinksClasses[$category])) echo ' class="' . implode(" ", $footerlinksClasses[$category]) . '"'; ?>> |
| 539 | + <ul id="footer-<?php echo $category ?>"> |
528 | 540 | <?php foreach( $links as $link ): ?> |
529 | 541 | <?php if( isset( $this->data[$link] ) && $this->data[$link] ): ?> |
530 | 542 | <li id="footer-<?php echo $category ?>-<?php echo $link ?>"><?php $this->html( $link ) ?></li> |
— | — | @@ -532,6 +544,31 @@ |
533 | 545 | </ul> |
534 | 546 | <?php endif; ?> |
535 | 547 | <?php endforeach; ?> |
| 548 | +<?php if ( count( $footericons ) > 0 ): ?> |
| 549 | + <ul id="footer-icons"> |
| 550 | +<?php foreach ( $footericons as $blockName => $footerIcons ): ?> |
| 551 | + <li id="footer-<?php echo htmlspecialchars($blockName); ?>ico" class="noprint"> |
| 552 | +<?php foreach ( $footerIcons as $icon ): |
| 553 | + if ( is_string($icon) ) { |
| 554 | + $html = $icon; |
| 555 | + } else { |
| 556 | + $url = $icon["url"]; |
| 557 | + unset($icon["url"]); |
| 558 | + if ( isset($icon["src"]) ) { |
| 559 | + $html = Html::element( 'img', $icon ); // do this the lazy way, just pass icon data as an attribute array |
| 560 | + } else { |
| 561 | + $html = htmlspecialchars($icon["alt"]); |
| 562 | + } |
| 563 | + if ( $url ) { |
| 564 | + $html = Html::rawElement( 'a', array( "href" => $url ), $html ); |
| 565 | + } |
| 566 | + } |
| 567 | + echo " $html\n"; |
| 568 | + endforeach; ?> |
| 569 | + </li> |
| 570 | +<?php endforeach; ?> |
| 571 | + </ul> |
| 572 | + <?php endif; ?> |
536 | 573 | <div style="clear:both"></div> |
537 | 574 | </div> |
538 | 575 | <!-- /footer --> |
Index: trunk/phase3/skins/MonoBook.php |
— | — | @@ -74,6 +74,22 @@ |
75 | 75 | $footerlinks = $this->data["footerlinks"]; |
76 | 76 | // fold footerlinks into a single array using a bit of trickery |
77 | 77 | $footerlinks = call_user_func_array('array_merge', array_values($footerlinks)); |
| 78 | + // Generate additional footer icons |
| 79 | + $footericons = $this->data["footericons"]; |
| 80 | + // Unset any icons which don't have an image |
| 81 | + foreach ( $footericons as $footerIconsKey => &$footerIconsBlock ) { |
| 82 | + foreach ( $footerIconsBlock as $footerIconKey => $footerIcon ) { |
| 83 | + if ( !is_string($footerIcon) && !isset($footerIcon["src"]) ) { |
| 84 | + unset($footerIconsBlock[$footerIconKey]); |
| 85 | + } |
| 86 | + } |
| 87 | + } |
| 88 | + // Redo removal of any empty blocks |
| 89 | + foreach ( $footericons as $footerIconsKey => &$footerIconsBlock ) { |
| 90 | + if ( count($footerIconsBlock) <= 0 ) { |
| 91 | + unset($footericons[$footerIconsKey]); |
| 92 | + } |
| 93 | + } |
78 | 94 | |
79 | 95 | $this->html( 'headelement' ); |
80 | 96 | ?><div id="globalWrapper"> |
— | — | @@ -171,13 +187,27 @@ |
172 | 188 | </div><!-- end of the left (by default at least) column --> |
173 | 189 | <div class="visualClear"></div> |
174 | 190 | <div id="footer"<?php $this->html('userlangattributes') ?>> |
175 | | -<?php |
176 | | -if($this->data['poweredbyico']) { ?> |
177 | | - <div id="f-poweredbyico"><?php $this->html('poweredbyico') ?></div> |
| 191 | +<?php foreach ( $footericons as $blockName => $footerIcons ) { ?> |
| 192 | + <div id="f-<?php echo htmlspecialchars($blockName); ?>ico"> |
| 193 | +<?php foreach ( $footerIcons as $icon ) { |
| 194 | + if ( is_string($icon) ) { |
| 195 | + $html = $icon; |
| 196 | + } else { |
| 197 | + $url = $icon["url"]; |
| 198 | + unset($icon["url"]); |
| 199 | + if ( isset($icon["src"]) ) { |
| 200 | + $html = Html::element( 'img', $icon ); // do this the lazy way, just pass icon data as an attribute array |
| 201 | + } else { |
| 202 | + $html = htmlspecialchars($icon["alt"]); |
| 203 | + } |
| 204 | + if ( $url ) { |
| 205 | + $html = Html::rawElement( 'a', array( "href" => $url ), $html ); |
| 206 | + } |
| 207 | + } |
| 208 | + echo " $html\n"; |
| 209 | + } ?> |
| 210 | + </div> |
178 | 211 | <?php } |
179 | | -if($this->data['copyrightico']) { ?> |
180 | | - <div id="f-copyrightico"><?php $this->html('copyrightico') ?></div> |
181 | | -<?php } |
182 | 212 | |
183 | 213 | // Generate additional footer links |
184 | 214 | $validFooterLinks = array(); |
Index: trunk/phase3/skins/Modern.php |
— | — | @@ -21,17 +21,6 @@ |
22 | 22 | var $skinname = 'modern', $stylename = 'modern', |
23 | 23 | $template = 'ModernTemplate', $useHeadElement = true; |
24 | 24 | |
25 | | - /* |
26 | | - * We don't like the default getPoweredBy, the icon clashes with the |
27 | | - * skin L&F. |
28 | | - */ |
29 | | - function getPoweredBy() { |
30 | | - global $wgVersion; |
31 | | - $text = "<div class='mw_poweredby'>Powered by MediaWiki $wgVersion</div>"; |
32 | | - wfRunHooks( 'SkinGetPoweredBy', array( &$text, $this ) ); |
33 | | - return $text; |
34 | | - } |
35 | | - |
36 | 25 | function setupSkinUserCss( OutputPage $out ){ |
37 | 26 | // Do not call parent::setupSkinUserCss(), we have our own print style |
38 | 27 | $out->addStyle( 'common/shared.css', 'screen' ); |
— | — | @@ -63,6 +52,18 @@ |
64 | 53 | // Suppress warnings to prevent notices about missing indexes in $this->data |
65 | 54 | wfSuppressWarnings(); |
66 | 55 | |
| 56 | + // Generate additional footer links |
| 57 | + $footerlinks = $this->data["footerlinks"]; |
| 58 | + // fold footerlinks into a single array using a bit of trickery |
| 59 | + $footerlinks = call_user_func_array('array_merge', array_values($footerlinks)); |
| 60 | + // Generate additional footer icons |
| 61 | + $footericons = $this->data["footericons"]; |
| 62 | + // Unset copyright.copyright since we don't need the icon and already output a copyright from footerlinks |
| 63 | + unset($footericons["copyright"]["copyright"]); |
| 64 | + if ( count($footericons["copyright"]) <= 0 ) { |
| 65 | + unset($footericons["copyright"]); |
| 66 | + } |
| 67 | + |
67 | 68 | $this->html( 'headelement' ); |
68 | 69 | ?> |
69 | 70 | |
— | — | @@ -182,10 +183,6 @@ |
183 | 184 | <div id="footer"<?php $this->html('userlangattributes') ?>> |
184 | 185 | <ul id="f-list"> |
185 | 186 | <?php |
186 | | - $footerlinks = array( |
187 | | - 'lastmod', 'viewcount', 'numberofwatchingusers', 'credits', 'copyright', |
188 | | - 'privacy', 'about', 'disclaimer', 'tagline', |
189 | | - ); |
190 | 187 | foreach( $footerlinks as $aLink ) { |
191 | 188 | if( isset( $this->data[$aLink] ) && $this->data[$aLink] ) { |
192 | 189 | ?> <li id="<?php echo$aLink?>"><?php $this->html($aLink) ?></li> |
— | — | @@ -193,7 +190,25 @@ |
194 | 191 | } |
195 | 192 | ?> |
196 | 193 | </ul> |
197 | | - <?php echo $this->html("poweredbyico"); ?> |
| 194 | +<?php |
| 195 | + foreach ( $footericons as $blockName => $footerIcons ) { ?> |
| 196 | + <div id="mw_<?php echo htmlspecialchars($blockName); ?>"> |
| 197 | +<?php |
| 198 | + foreach ( $footerIcons as $icon ) { |
| 199 | + if ( is_string($icon) ) { |
| 200 | + $html = $icon; |
| 201 | + } else { |
| 202 | + $html = htmlspecialchars($icon["alt"]); |
| 203 | + if ( $icon["url"] ) { |
| 204 | + $html = Html::element( 'a', array( "href" => $icon["url"] ), $html ); |
| 205 | + } |
| 206 | + } |
| 207 | + echo " $html\n"; |
| 208 | + } ?> |
| 209 | + </div> |
| 210 | +<?php |
| 211 | + } |
| 212 | +?> |
198 | 213 | </div> |
199 | 214 | |
200 | 215 | <?php $this->html('bottomscripts'); /* JS call to runBodyOnloadHook */ ?> |
Index: trunk/phase3/includes/Setup.php |
— | — | @@ -63,6 +63,28 @@ |
64 | 64 | $wgDeletedDirectory = $wgFileStore['deleted']['directory']; |
65 | 65 | } |
66 | 66 | |
| 67 | +if( isset($wgFooterIcons["copyright"]) && |
| 68 | + isset($wgFooterIcons["copyright"]["copyright"]) && |
| 69 | + $wgFooterIcons["copyright"]["copyright"] === array() ) { |
| 70 | + if ( isset( $wgCopyrightIcon ) && $wgCopyrightIcon ) { |
| 71 | + $wgFooterIcons["copyright"]["copyright"] = $wgCopyrightIcon; |
| 72 | + } elseif ( $wgRightsIcon || $wgRightsText ) { |
| 73 | + $wgFooterIcons["copyright"]["copyright"] = array( |
| 74 | + "url" => $wgRightsUrl, |
| 75 | + "src" => $wgRightsIcon, |
| 76 | + "alt" => $wgRightsText, |
| 77 | + ); |
| 78 | + } else { |
| 79 | + unset($wgFooterIcons["copyright"]["copyright"]); |
| 80 | + } |
| 81 | +} |
| 82 | + |
| 83 | +if( isset($wgFooterIcons["poweredby"]) && |
| 84 | + isset($wgFooterIcons["poweredby"]["mediawiki"]) && |
| 85 | + $wgFooterIcons["poweredby"]["mediawiki"]["src"] === null ) { |
| 86 | + $wgFooterIcons["poweredby"]["mediawiki"]["src"] = "$wgStylePath/common/images/poweredby_mediawiki_88x31.png"; |
| 87 | +} |
| 88 | + |
67 | 89 | /** |
68 | 90 | * Unconditional protection for NS_MEDIAWIKI since otherwise it's too easy for a |
69 | 91 | * sysadmin to set $wgNamespaceProtection incorrectly and leave the wiki insecure. |
Index: trunk/phase3/includes/SkinTemplate.php |
— | — | @@ -425,6 +425,21 @@ |
426 | 426 | 'disclaimer', |
427 | 427 | ), |
428 | 428 | ) ); |
| 429 | + |
| 430 | + global $wgFooterIcons; |
| 431 | + $tpl->set( 'footericons', $wgFooterIcons ); |
| 432 | + foreach ( $tpl->data["footericons"] as $footerIconsKey => &$footerIconsBlock ) { |
| 433 | + if ( count($footerIconsBlock) > 0 ) { |
| 434 | + foreach ( $footerIconsBlock as &$footerIcon ) { |
| 435 | + if ( isset($footerIcon["src"]) ) { |
| 436 | + if ( !isset($footerIcon["width"]) ) $footerIcon["width"] = 88; |
| 437 | + if ( !isset($footerIcon["height"]) ) $footerIcon["height"] = 31; |
| 438 | + } |
| 439 | + } |
| 440 | + } else { |
| 441 | + unset($tpl->data["footericons"][$footerIconsKey]); |
| 442 | + } |
| 443 | + } |
429 | 444 | |
430 | 445 | if ( $wgDebugComments ) { |
431 | 446 | $tpl->setRef( 'debug', $out->mDebugtext ); |
Index: trunk/phase3/includes/DefaultSettings.php |
— | — | @@ -2263,6 +2263,25 @@ |
2264 | 2264 | $wgExperimentalHtmlIds = true; |
2265 | 2265 | |
2266 | 2266 | /** |
| 2267 | + * Abstract list of footer icons for skins in place of old copyrightico and poweredbyico code |
| 2268 | + * You can add new icons to the built in copyright or poweredby, or you can create |
| 2269 | + * a new block. Though note that you may need to add some custom css to get good styling |
| 2270 | + * of new blocks in monobook. vector and modern should work without any special css. |
| 2271 | + */ |
| 2272 | +$wgFooterIcons = array( |
| 2273 | + "copyright" => array( |
| 2274 | + "copyright" => array(), // placeholder for the built in copyright icon |
| 2275 | + ), |
| 2276 | + "poweredby" => array( |
| 2277 | + "mediawiki" => array( |
| 2278 | + "src" => null, // Defaults to "$wgStylePath/common/images/poweredby_mediawiki_88x31.png" |
| 2279 | + "url" => "http://www.mediawiki.org/", |
| 2280 | + "alt" => "Powered by MediaWiki", |
| 2281 | + ) |
| 2282 | + ), |
| 2283 | +); |
| 2284 | + |
| 2285 | +/** |
2267 | 2286 | * Search form behavior for Vector skin only |
2268 | 2287 | * true = use an icon search button |
2269 | 2288 | * false = use Go & Search buttons |