jenkins-bot has submitted this change and it was merged.
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(-)
Approvals:
Isarra: Looks good to me, but someone else must approve
Krinkle: Looks good to me, approved
jenkins-bot: Verified
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: merged
Gerrit-Change-Id: I014c6edcd283886505968817c59978ac7435235e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SkinPerPage
Gerrit-Branch: master
Gerrit-Owner: Legoktm <[email protected]>
Gerrit-Reviewer: Isarra <[email protected]>
Gerrit-Reviewer: Krinkle <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits