[MediaWiki-commits] [Gerrit] Use Config instead of globals - change (mediawiki...Truglass)

2014-11-03 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: Use Config instead of globals
..


Use Config instead of globals

Change-Id: If6eac180316ef626e319fbd39988259dfcaffe16
---
M Truglass.php
M Truglass.skin.php
2 files changed, 20 insertions(+), 4 deletions(-)

Approvals:
  Legoktm: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/Truglass.php b/Truglass.php
index 4936925..5c4e94c 100644
--- a/Truglass.php
+++ b/Truglass.php
@@ -39,6 +39,7 @@
 // Autoload the skin class, make it a valid skin, set up i18n, set up CSS
 // (via ResourceLoader)
 $wgAutoloadClasses['SkinTruglass'] = __DIR__ . '/Truglass.skin.php';
+$wgConfigRegistry['truglass'] = 'GlobalVarConfig::newInstance';
 $wgMessagesDirs['SkinTruglass'] = __DIR__ . '/i18n';
 $wgResourceModules['skins.truglass'] = array(
'styles' = array(
diff --git a/Truglass.skin.php b/Truglass.skin.php
index 460b650..890c8ec 100644
--- a/Truglass.skin.php
+++ b/Truglass.skin.php
@@ -19,14 +19,29 @@
  * Inherit main code from SkinTemplate, set the CSS and template filter.
  */
 class SkinTruglass extends SkinTemplate {
-   var $skinname = 'truglass', $stylename = 'truglass',
+   public $skinname = 'truglass', $stylename = 'truglass',
$template = 'TruglassTemplate', $useHeadElement = true;
+   /**
+* @var Config
+*/
+   private $truglassConfig;
+
+   public function __construct() {
+   $this-truglassConfig = 
ConfigFactory::getDefaultInstance()-makeConfig( 'truglass' );
+   }
 
function setupSkinUserCss( OutputPage $out ) {
parent::setupSkinUserCss( $out );
 
// Add CSS
$out-addModuleStyles( 'skins.truglass' );
+   }
+
+   /**
+* Override to pass our Config instance to it
+*/
+   public function setupTemplate( $classname, $repository = false, 
$cache_dir = false ) {
+   return new $classname( $this-truglassConfig );
}
 }
 
@@ -340,9 +355,9 @@
 * an array.
 */
function networkNavigationBox() {
-   global $wgTruglassSidebarLinks;
+   $sidebarLinks = $this-config-get( 'TruglassSidebarLinks' );
 
-   if( is_array( $wgTruglassSidebarLinks )  !empty( 
$wgTruglassSidebarLinks ) ) {
+   if( is_array( $sidebarLinks )  !empty( $sidebarLinks ) ) {
 ?
div class=sbmodule 
id=sbm-networknav
h4 class=sbmoduletitle 
displayer?php echo wfMessage( 'truglass-links' )-parse() ?/h4
@@ -350,7 +365,7 @@
div class=stretcher
ul
?php
-   foreach 
( $wgTruglassSidebarLinks as $link = $title ) {
+   foreach 
( $sidebarLinks as $link = $title ) {

echo 'lia href=http://' . $link . '/' . $title . '/a/li';
}
?

-- 
To view, visit https://gerrit.wikimedia.org/r/168912
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: If6eac180316ef626e319fbd39988259dfcaffe16
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/skins/Truglass
Gerrit-Branch: master
Gerrit-Owner: Lewis Cawte le...@lewiscawte.me
Gerrit-Reviewer: Legoktm legoktm.wikipe...@gmail.com
Gerrit-Reviewer: Lewis Cawte le...@lewiscawte.me
Gerrit-Reviewer: jenkins-bot 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Use Config instead of globals - change (mediawiki...Truglass)

2014-10-26 Thread Lewis Cawte (Code Review)
Lewis Cawte has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/168912

Change subject: Use Config instead of globals
..

Use Config instead of globals

Change-Id: If6eac180316ef626e319fbd39988259dfcaffe16
---
M Truglass.skin.php
1 file changed, 4 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/skins/Truglass 
refs/changes/12/168912/1

diff --git a/Truglass.skin.php b/Truglass.skin.php
index 460b650..31f9984 100644
--- a/Truglass.skin.php
+++ b/Truglass.skin.php
@@ -263,7 +263,7 @@
form name=searchform 
action=?php $this-text( 'wgScript' ) ? id=searchform
input 
type=hidden name=title value=?php $this-text( 'searchtitle' ) ?/
input 
type=hidden name=fulltext class=searchButton value=?php $this-msg( 
'search' ) ? /
-   img src=?php 
$this-text( 'stylepath' ) ?/Truglass/?php $this-text( 'stylename' ) 
?/searchleftcap?php if( $wgLang-isRTL() ) echo '_rtl'; ?.gif alt= 
width=17 height=19 border=0 id=s1 class=srchimgs /
+   img src=?php 
$this-text( 'stylepath' ) ?/Truglass/?php $this-text( 'stylename' ) 
?/searchleftcap?php if( RequestContext::getMain()-getLanguage()-is) echo 
'_rtl'; ?.gif alt= width=17 height=19 border=0 id=s1 
class=srchimgs /
input 
type=text name=search class=sbox id=q01 ?php if( $this-haveMsg( 
'accesskey-search' ) ) { ?accesskey=?php $this-msg( 'accesskey-search' ) 
??php } if( isset( $this-data['search'] ) ) { ? value=?php $this-text( 
'search' ) ??php } ? /
img src=?php 
$this-text( 'stylepath' ) ?/Truglass/?php $this-text( 'stylename' ) 
?/searchrightcap?php if( $wgLang-isRTL() ) echo '_rtl'; ?.gif alt= 
width=9 height=19 border=0 id=s2 class=srchimgs /
/form
@@ -340,9 +340,9 @@
 * an array.
 */
function networkNavigationBox() {
-   global $wgTruglassSidebarLinks;
+   $sidebarLinks = $this-config-get( 'TruglassSidebarLinks' );
 
-   if( is_array( $wgTruglassSidebarLinks )  !empty( 
$wgTruglassSidebarLinks ) ) {
+   if( is_array( $sidebarLinks )  !empty( $sidebarLinks ) ) {
 ?
div class=sbmodule 
id=sbm-networknav
h4 class=sbmoduletitle 
displayer?php echo wfMessage( 'truglass-links' )-parse() ?/h4
@@ -350,7 +350,7 @@
div class=stretcher
ul
?php
-   foreach 
( $wgTruglassSidebarLinks as $link = $title ) {
+   foreach 
( $sidebarLinks as $link = $title ) {

echo 'lia href=http://' . $link . '/' . $title . '/a/li';
}
?

-- 
To view, visit https://gerrit.wikimedia.org/r/168912
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If6eac180316ef626e319fbd39988259dfcaffe16
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/skins/Truglass
Gerrit-Branch: master
Gerrit-Owner: Lewis Cawte le...@lewiscawte.me

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits