Legoktm has uploaded a new change for review.

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

Change subject: Move SkinPerPage class to separate file
......................................................................

Move SkinPerPage class to separate file

Change-Id: I014c6edcd283886505968817c59978ac7435235e
---
A SkinPerPage.body.php
M SkinPerPage.php
2 files changed, 56 insertions(+), 53 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SkinPerPage 
refs/changes/71/210271/1

diff --git a/SkinPerPage.body.php b/SkinPerPage.body.php
new file mode 100644
index 0000000..6216cdd
--- /dev/null
+++ b/SkinPerPage.body.php
@@ -0,0 +1,55 @@
+<?php
+
+class SkinPerPage {
+       /**
+        * Register our extension tag and parser function
+        *
+        * @param Parser $parser
+        * @return bool
+        */
+       public static function onParserFirstCallInit( Parser $parser ) {
+               # Old one for backwards compatibility
+               $parser->setHook( 'skin', array( __CLASS__, 'parserHook' ) );
+               # Function-style one that users should actually use
+               $parser->setFunctionHook( 'useskin', array( __CLASS__, 
'useskinHook' ) );
+               return true;
+       }
+
+       /**
+        * Handler for <skin>foo</skin>
+        */
+       public static function parserHook( $text, $attribs, Parser $parser ) {
+               $parser->mOutput->spp_skin = $text;
+               return '';
+       }
+
+       /**
+        * Reads the skin key from ParserOutput and sets it as the skin to use 
for display
+        *
+        * @param OutputPage $out
+        * @param ParserOutput $parserOutput
+        * @return bool
+        */
+       public static function onOutputPageParserOutput( OutputPage $out, 
ParserOutput $parserOutput ) {
+               if ( isset( $parserOutput->spp_skin ) ) {
+                       $key = Skin::normalizeKey( trim( strtolower( 
$parserOutput->spp_skin ) ) );
+                       if ( class_exists( 'SkinFactory' ) ) {
+                               $skin = 
SkinFactory::getDefaultInstance()->makeSkin( $key );
+                       } else {
+                               $skin = Skin::newFromKey( $key );
+                       }
+                       RequestContext::getMain()->setSkin( $skin );
+               }
+               return true;
+       }
+
+       /**
+        * Handler for {{#useskin:foo}}
+        *
+        * @param Parser $parser
+        * @param string $skin
+        */
+       public static function useskinHook( Parser $parser, $skin = '' ) {
+               SkinPerPage::parserHook( $skin, array(), $parser );
+       }
+}
diff --git a/SkinPerPage.php b/SkinPerPage.php
index 07b33a4..c9babe5 100755
--- a/SkinPerPage.php
+++ b/SkinPerPage.php
@@ -22,56 +22,4 @@
 $wgHooks['ParserFirstCallInit'][] = 'SkinPerPage::onParserFirstCallInit';
 $wgHooks['OutputPageParserOutput'][] = 'SkinPerPage::onOutputPageParserOutput';
 
-class SkinPerPage {
-       /**
-        * Register our extension tag and parser function
-        *
-        * @param Parser $parser
-        * @return bool
-        */
-       public static function onParserFirstCallInit( Parser $parser ) {
-               # Old one for backwards compatibility
-               $parser->setHook( 'skin', array( __CLASS__, 'parserHook' ) );
-               # Function-style one that users should actually use
-               $parser->setFunctionHook( 'useskin', array( __CLASS__, 
'useskinHook' ) );
-               return true;
-       }
-
-       /**
-        * Handler for <skin>foo</skin>
-        */
-       public static function parserHook( $text, $attribs, Parser $parser ) {
-               $parser->mOutput->spp_skin = $text;
-               return '';
-       }
-
-       /**
-        * Reads the skin key from ParserOutput and sets it as the skin to use 
for display
-        *
-        * @param OutputPage $out
-        * @param ParserOutput $parserOutput
-        * @return bool
-        */
-       public static function onOutputPageParserOutput( OutputPage $out, 
ParserOutput $parserOutput ) {
-               if ( isset( $parserOutput->spp_skin ) ) {
-                       $key = Skin::normalizeKey( trim( strtolower( 
$parserOutput->spp_skin ) ) );
-                       if ( class_exists( 'SkinFactory' ) ) {
-                               $skin = 
SkinFactory::getDefaultInstance()->makeSkin( $key );
-                       } else {
-                               $skin = Skin::newFromKey( $key );
-                       }
-                       RequestContext::getMain()->setSkin( $skin );
-               }
-               return true;
-       }
-
-       /**
-        * Handler for {{#useskin:foo}}
-        *
-        * @param Parser $parser
-        * @param string $skin
-        */
-       public static function useskinHook( Parser $parser, $skin = '' ) {
-               SkinPerPage::parserHook( $skin, array(), $parser );
-       }
-}
+$wgAutoloadClasses['SkinPerPage'] = __DIR__ . '/SkinPerPage.body.php';

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I014c6edcd283886505968817c59978ac7435235e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SkinPerPage
Gerrit-Branch: master
Gerrit-Owner: Legoktm <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to