r110637 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r110636‎ | r110637 | r110638 >
Date:00:06, 3 February 2012
Author:reedy
Status:ok
Tags:mobile 
Comment:
Fix for r109884

Feels a bit icky, but using $wgExtensionFunctions to instantiate instance of ExtMobileFrontend and attach all the hooks (as the classes are loaded by that point)
Modified paths:
  • /trunk/extensions/MobileFrontend/MobileFrontend.php (modified) (history)

Diff [purge]

Index: trunk/extensions/MobileFrontend/MobileFrontend.php
@@ -79,13 +79,19 @@
8080 */
8181 $wgMobileRedirectFormAction = false;
8282
83 -$wgExtMobileFrontend = new ExtMobileFrontend();
 83+$wgExtMobileFrontend = null;
8484
85 -$wgHooks['BeforePageDisplay'][] = array( &$wgExtMobileFrontend, 'beforePageDisplayHTML' );
86 -$wgHooks['BeforePageRedirect'][] = array( &$wgExtMobileFrontend, 'beforePageRedirect' );
87 -$wgHooks['SkinTemplateOutputPageBeforeExec'][] = array( &$wgExtMobileFrontend, 'addMobileFooter' );
88 -$wgHooks['TestCanonicalRedirect'][] = array( &$wgExtMobileFrontend, 'testCanonicalRedirect' );
 85+$wgExtensionFunctions[] = 'efMobileFrontend_Setup';
8986
 87+function efMobileFrontend_Setup() {
 88+ global $wgExtMobileFrontend, $wgHooks;
 89+ $wgExtMobileFrontend = new ExtMobileFrontend();
 90+ $wgHooks['BeforePageDisplay'][] = array( &$wgExtMobileFrontend, 'beforePageDisplayHTML' );
 91+ $wgHooks['BeforePageRedirect'][] = array( &$wgExtMobileFrontend, 'beforePageRedirect' );
 92+ $wgHooks['SkinTemplateOutputPageBeforeExec'][] = array( &$wgExtMobileFrontend, 'addMobileFooter' );
 93+ $wgHooks['TestCanonicalRedirect'][] = array( &$wgExtMobileFrontend, 'testCanonicalRedirect' );
 94+}
 95+
9096 /**
9197 * Make the classes, tags and ids stripped from page content configurable.
9298 * Each item will be stripped from the page.

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r109884move Mobile Frontend class to separate body filepreilly00:41, 24 January 2012

Status & tagging log