Index: trunk/extensions/ZeroRatedMobileAccess/ZeroRatedMobileAccess.php |
— | — | @@ -28,12 +28,22 @@ |
29 | 29 | $cwd = dirname( __FILE__ ) . DIRECTORY_SEPARATOR; |
30 | 30 | $wgExtensionMessagesFiles['ZeroRatedMobileAccess'] = $cwd . 'ZeroRatedMobileAccess.i18n.php'; |
31 | 31 | |
| 32 | +// autoload extension classes |
| 33 | + |
| 34 | +$autoloadClasses = array ( |
| 35 | + 'ZeroRatedMobileAccessTemplate', |
| 36 | +); |
| 37 | + |
| 38 | +foreach ( $autoloadClasses as $class ) { |
| 39 | + $wgAutoloadClasses[$class] = $cwd . $class . '.php'; |
| 40 | +} |
| 41 | + |
32 | 42 | $wgExtZeroRatedMobileAccess = new ExtZeroRatedMobileAccess(); |
33 | 43 | |
34 | 44 | $wgHooks['BeforePageDisplay'][] = array( &$wgExtZeroRatedMobileAccess, 'beforePageDisplayHTML' ); |
35 | 45 | |
36 | 46 | class ExtZeroRatedMobileAccess { |
37 | | - const VERSION = '0.0.1'; |
| 47 | + const VERSION = '0.0.2'; |
38 | 48 | |
39 | 49 | public static $renderZeroRatedLandingPage; |
40 | 50 | |
Index: trunk/extensions/ZeroRatedMobileAccess/ZeroRatedMobileAccessTemplate.php |
— | — | @@ -0,0 +1,51 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +if( !defined( 'MEDIAWIKI' ) ) { |
| 5 | + die( -1 ); |
| 6 | +} |
| 7 | + |
| 8 | +abstract class ZeroRatedMobileAccessTemplate { |
| 9 | + public $data; |
| 10 | + |
| 11 | + /** |
| 12 | + * Constructor |
| 13 | + */ |
| 14 | + public function __construct() { |
| 15 | + $this->data = array(); |
| 16 | + } |
| 17 | + |
| 18 | + /** |
| 19 | + * Sets the value $value to $name |
| 20 | + * @param $name |
| 21 | + * @param $value |
| 22 | + */ |
| 23 | + public function set( $name, $value ) { |
| 24 | + $this->data[$name] = $value; |
| 25 | + } |
| 26 | + |
| 27 | + /** |
| 28 | + * Sets the value $value to $name |
| 29 | + * @param $name |
| 30 | + * @param $value |
| 31 | + */ |
| 32 | + public function setByArray( $options ) { |
| 33 | + foreach ($options as $name => $value ) { |
| 34 | + $this->set( $name, $value ); |
| 35 | + } |
| 36 | + } |
| 37 | + |
| 38 | + /** |
| 39 | + * Gets the value of $name |
| 40 | + * @param $name |
| 41 | + * @return string |
| 42 | + */ |
| 43 | + public function get( $name ) { |
| 44 | + return $this->data[$name]; |
| 45 | + } |
| 46 | + |
| 47 | + /** |
| 48 | + * Main function, used by classes that subclass ZeroRatedMobileAccessTemplate |
| 49 | + * to show the actual HTML output |
| 50 | + */ |
| 51 | + abstract public function getHTML(); |
| 52 | +} |
Property changes on: trunk/extensions/ZeroRatedMobileAccess/ZeroRatedMobileAccessTemplate.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 53 | + native |