r99314 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r99313‎ | r99314 | r99315 >
Date:17:42, 8 October 2011
Author:ashley
Status:deferred
Tags:
Comment:
commit Theme extension by Skizzerz from http://www.mediawiki.org/wiki/Extension:Theme
Modified paths:
  • /trunk/extensions/Theme (added) (history)
  • /trunk/extensions/Theme/Theme.php (added) (history)

Diff [purge]

Index: trunk/extensions/Theme/Theme.php
@@ -0,0 +1,34 @@
 2+<?php
 3+
 4+//Theme "extension" (allows using themes of skins)
 5+
 6+$wgExtensionCredits['other'][] = array(
 7+ 'name' => 'Theme',
 8+ 'description' => 'Theme loader extension for skins',
 9+ 'version' => '1.0',
 10+ 'author' => 'Ryan Schmidt',
 11+);
 12+
 13+$wgHooks['BeforePageDisplay'][] = 'efDisplayTheme';
 14+
 15+function efDisplayTheme( &$out, &$sk ) {
 16+ global $wgRequest, $wgStylePath, $wgStyleDirectory, $wgDefaultTheme, $wgValidSkinNames;
 17+ $theme = $wgRequest->getVal( 'usetheme', false );
 18+ $useskin = $wgRequest->getVal( 'useskin', false );
 19+ $skin = $useskin ? $useskin : $sk->getSkinName();
 20+ if( !array_key_exists( strtolower( $skin ), $wgValidSkinNames ) ) {
 21+ $skin = $sk->getSkinName(); //so we don't load themes for skins when we can't actually load the skin
 22+ }
 23+ if( $theme ) {
 24+ $url = $skin . '/themes/' . $theme . '.css';
 25+ } elseif( isset( $wgDefaultTheme ) && $wgDefaultTheme != 'default' ) {
 26+ $url = $skin . '/themes/' . $wgDefaultTheme . '.css';
 27+ } else {
 28+ $url = false;
 29+ }
 30+ if( !$url || !file_exists( $wgStyleDirectory . '/' . $url ) ) {
 31+ return true;
 32+ }
 33+ $out->addExtensionStyle( $wgStylePath . '/' . $url );
 34+ return true;
 35+}
\ No newline at end of file
Property changes on: trunk/extensions/Theme/Theme.php
___________________________________________________________________
Added: svn:eol-style
136 + native

Status & tagging log