Index: trunk/extensions/ZeroRatedMobileAccess/ZeroRatedMobileAccess.php |
— | — | @@ -0,0 +1,56 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * Extension ZeroRatedMobileAccess — Zero Rated Mobile Access |
| 5 | + * |
| 6 | + * @file |
| 7 | + * @ingroup Extensions |
| 8 | + * @author Patrick Reilly |
| 9 | + * @copyright © 2011 Patrick Reilly |
| 10 | + * @licence GNU General Public Licence 2.0 or later |
| 11 | + */ |
| 12 | + |
| 13 | +// Needs to be called within MediaWiki; not standalone |
| 14 | +if ( !defined( 'MEDIAWIKI' ) ) { |
| 15 | + echo( "This is an extension to the MediaWiki package and cannot be run standalone.\n" ); |
| 16 | + die( -1 ); |
| 17 | +} |
| 18 | + |
| 19 | +// Extension credits that will show up on Special:Version |
| 20 | +$wgExtensionCredits['other'][] = array( |
| 21 | + 'path' => __FILE__, |
| 22 | + 'name' => 'ZeroRatedMobileAccess', |
| 23 | + 'version' => ExtZeroRatedMobileAccess::VERSION, |
| 24 | + 'author' => '[http://www.mediawiki.org/wiki/User:Preilly Preilly]', |
| 25 | + 'descriptionmsg' => 'zero-rated-mobile-access-desc', |
| 26 | + 'url' => 'https://www.mediawiki.org/wiki/Extension:ZeroRatedMobileAccess', |
| 27 | +); |
| 28 | + |
| 29 | +$cwd = dirname( __FILE__ ) . DIRECTORY_SEPARATOR; |
| 30 | +$wgExtensionMessagesFiles['ZeroRatedMobileAccess'] = $cwd . 'ZeroRatedMobileAccess.i18n.php'; |
| 31 | + |
| 32 | +$wgExtZeroRatedMobileAccess = new ExtZeroRatedMobileAccess(); |
| 33 | + |
| 34 | +$wgHooks['BeforePageDisplay'][] = array( &$wgExtZeroRatedMobileAccess, 'beforePageDisplayHTML' ); |
| 35 | + |
| 36 | +class ExtZeroRatedMobileAccess { |
| 37 | + const VERSION = '0.0.1'; |
| 38 | + |
| 39 | + public static $renderZeroRatedLandingPage; |
| 40 | + |
| 41 | + /** |
| 42 | + * @param $out OutputPage |
| 43 | + * @param $text String |
| 44 | + * @return bool |
| 45 | + */ |
| 46 | + public function beforePageDisplayHTML( &$out, &$text ) { |
| 47 | + global $wgRequest; |
| 48 | + wfProfileIn( __METHOD__ ); |
| 49 | + self::$renderZeroRatedLandingPage = $wgRequest->getInt( 'renderZeroRatedLandingPage' ); |
| 50 | + if ( self::$renderZeroRatedLandingPage === 1 ) { |
| 51 | + echo wfMsg( 'zero-rated-mobile-access-desc' ); |
| 52 | + exit(); |
| 53 | + } |
| 54 | + wfProfileOut( __METHOD__ ); |
| 55 | + return true; |
| 56 | + } |
| 57 | +} |
\ No newline at end of file |
Property changes on: trunk/extensions/ZeroRatedMobileAccess/ZeroRatedMobileAccess.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 58 | + native |
Index: trunk/extensions/ZeroRatedMobileAccess/ZeroRatedMobileAccess.i18n.php |
— | — | @@ -0,0 +1,21 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * Internationalisation file for the extension ZeroRatedMobileAccess |
| 5 | + * |
| 6 | + * @file |
| 7 | + * @ingroup Extensions |
| 8 | + * @author Patrick Reilly |
| 9 | + * @copyright © 2011 Patrick Reilly |
| 10 | + * @licence GNU General Public Licence 2.0 or later |
| 11 | + */ |
| 12 | + |
| 13 | +$messages = array(); |
| 14 | + |
| 15 | +// en translation |
| 16 | +$messages['en'] = array ( |
| 17 | + 'zero-rated-mobile-access-desc' => 'Zero Rated Mobile Access', |
| 18 | +); |
| 19 | + |
| 20 | +$messages['qqq'] = array( |
| 21 | + 'zero-rated-mobile-access-desc' => '{{Identical|Show}}', |
| 22 | +); |
\ No newline at end of file |
Property changes on: trunk/extensions/ZeroRatedMobileAccess/ZeroRatedMobileAccess.i18n.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 23 | + native |