Isarra has uploaded a new change for review.
https://gerrit.wikimedia.org/r/213012
Change subject: Move hooks into BlueSky.hooks.php
......................................................................
Move hooks into BlueSky.hooks.php
Hopefully this works. I think it works. It probably works? At least as
much as it worked before.
Also fixed some modes.
Change-Id: I3e7d40bbe432d561d0c03426b86f8a06aa8384d3
---
A BlueSky.hooks.php
M BlueSky.php
M BlueSky.skin.php
3 files changed, 82 insertions(+), 76 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/skins/BlueSky
refs/changes/12/213012/1
diff --git a/BlueSky.hooks.php b/BlueSky.hooks.php
new file mode 100644
index 0000000..4ab5557
--- /dev/null
+++ b/BlueSky.hooks.php
@@ -0,0 +1,79 @@
+<?php
+
+/**
+ * Additional junk for the page head element.
+ */
+class SkinBlueSkyHooks {
+ /**
+ * TOC processing
+ * Shamelessly stolen from brickimedia's refreshed skin
+ * Currently:
https://github.com/Brickimedia/Refreshed/blob/master/Refreshed.skin.php#L72
+ */
+
+ public static function wfTOCCrap( OutputPage &$out, ParserOutput
$parseroutput ) {
+ global $blueSkyTOC;
+ $blueSkyTOC = $parseroutput->mSections;
+
+ return true;
+ }
+
+ public static function onBeforePageDisplayCrap( OutputPage &$out,
&$skin ) {
+ //global $wgRequest, $wgUser;
+
+ // Hooks are global, but we want these things *only* for this
skin.
+ if ( get_class( $skin ) !== 'SkinBlueSky' ) {
+ return true;
+ }
+
+ /*
+ $action = $wgRequest->getVal( 'action', 'view' );
+ $isMainPage = $out->getTitle()->isMainPage();
+ $isArticlePage = $out->getTitle() &&
+ !$isMainPage &&
+ $out->getTitle()->getNamespace() == NS_MAIN &&
+ $action == 'view';
+ */
+
+ $out->addMeta( 'http:content-type', 'text/html; charset=UTF-8'
);
+
+ /*
+ if ( $isArticlePage || $isMainPage ) {
+ global $wgLanguageCode;
+
+ if ( $wgLanguageCode != 'en' ) {
+ $mobileLang = $wgLanguageCode . '.';
+ } else {
+ $mobileLang = '';
+ }
+
+ $out->addLink( array(
+ 'rel' => 'alternate',
+ 'media' => 'only screen and (max-width: 640px)',
+ 'href' => 'http://' . $mobileLang .
'm.wikihow.com/' . $out->getTitle()->getPartialURL()
+ ) );
+ }
+
+ $out->setCanonicalUrl( $out->getTitle()->getFullURL() );
+ $out->addLink( array(
+ 'href' =>
'https://plus.google.com/102818024478962731382',
+ 'rel' => 'publisher'
+ ) );
+
+ $out->addLink( array(
+ 'rel' => 'alternate',
+ 'type' => 'application/rss+xml',
+ 'title' => 'wikiHow: How-to of the Day',
+ 'href' => 'http://www.wikihow.com/feed.rss'
+ ) );
+
+ $out->addLink( array(
+ 'rel' => 'apple-touch-icon',
+ 'href' => $wgStylePath .
'/BlueSky/images/safari-large-icon.png'
+ ) );
+
+ echo $out->getHeadItems();
+ */
+
+ return true;
+ }
+}
diff --git a/BlueSky.php b/BlueSky.php
old mode 100755
new mode 100644
index e1ed677..4acc5fc
--- a/BlueSky.php
+++ b/BlueSky.php
@@ -42,6 +42,7 @@
// Autoload the skin class, make it a valid skin, set up i18n, set up CSS & JS
// (via ResourceLoader)
$wgAutoloadClasses['SkinBlueSky'] = __DIR__ . '/BlueSky.skin.php';
+$wgAutoloadClasses['SkinBlueSkyHooks'] = __DIR__ . '/BlueSky.hooks.php';
$wgExtensionMessagesFiles['SkinBlueSky'] = __DIR__ . '/BlueSky.i18n.php';
$wgMessagesDirs['SkinBlueSky'] = __DIR__ . '/i18n';
@@ -207,81 +208,7 @@
)
);
-/**
- * Additional junk for the page head element.
- */
-$wgHooks['OutputPageParserOutput'][] = 'wfTOCCrap';
-
-$wgHooks['BeforePageDisplay'][] = function( OutputPage &$out, &$skin ) {
- //global $wgRequest, $wgUser;
-
- // Hooks are global, but we want these things *only* for this skin.
- if ( get_class( $skin ) !== 'SkinBlueSky' ) {
- return true;
- }
-
- /*
- $action = $wgRequest->getVal( 'action', 'view' );
- $isMainPage = $out->getTitle()->isMainPage();
- $isArticlePage = $out->getTitle() &&
- !$isMainPage &&
- $out->getTitle()->getNamespace() == NS_MAIN &&
- $action == 'view';
- */
-
- $out->addMeta( 'http:content-type', 'text/html; charset=UTF-8' );
-
- /*
- if ( $isArticlePage || $isMainPage ) {
- global $wgLanguageCode;
-
- if ( $wgLanguageCode != 'en' ) {
- $mobileLang = $wgLanguageCode . '.';
- } else {
- $mobileLang = '';
- }
-
- $out->addLink( array(
- 'rel' => 'alternate',
- 'media' => 'only screen and (max-width: 640px)',
- 'href' => 'http://' . $mobileLang . 'm.wikihow.com/' .
$out->getTitle()->getPartialURL()
- ) );
- }
-
- $out->setCanonicalUrl( $out->getTitle()->getFullURL() );
- $out->addLink( array(
- 'href' => 'https://plus.google.com/102818024478962731382',
- 'rel' => 'publisher'
- ) );
-
- $out->addLink( array(
- 'rel' => 'alternate',
- 'type' => 'application/rss+xml',
- 'title' => 'wikiHow: How-to of the Day',
- 'href' => 'http://www.wikihow.com/feed.rss'
- ) );
-
- $out->addLink( array(
- 'rel' => 'apple-touch-icon',
- 'href' => $wgStylePath . '/BlueSky/images/safari-large-icon.png'
- ) );
-
- echo $out->getHeadItems();
- */
-
- return true;
-};
-
-/**
- * TOC processing
- * Shamelessly stolen from brickimedia's refreshed skin
- * Currently:
https://github.com/Brickimedia/Refreshed/blob/master/Refreshed.skin.php#L72
- */
$blueSkyTOC = '';
-function wfTOCCrap( OutputPage &$out, ParserOutput $parseroutput ) {
- global $blueSkyTOC;
- $blueSkyTOC = $parseroutput->mSections;
-
- return true;
-}
+$wgHooks['OutputPageParserOutput'][] = 'SkinBlueSkyHooks::wfTOCCrap';
+$wgHooks['BeforePageDisplay'][] = 'SkinBlueSkyHooks::onBeforePageDisplayCrap';
diff --git a/BlueSky.skin.php b/BlueSky.skin.php
old mode 100755
new mode 100644
--
To view, visit https://gerrit.wikimedia.org/r/213012
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3e7d40bbe432d561d0c03426b86f8a06aa8384d3
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/skins/BlueSky
Gerrit-Branch: master
Gerrit-Owner: Isarra <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits