Index: trunk/extensions/MobileFrontend2/MobileFrontend2.php |
— | — | @@ -27,6 +27,7 @@ |
28 | 28 | |
29 | 29 | $wgAutoloadClasses['MobileFrontend2_Detection'] = $dir . 'MobileFrontend2_Detection.php'; |
30 | 30 | $wgAutoloadClasses['MobileFrontend2_Hooks'] = $dir . 'MobileFrontend2_Hooks.php'; |
| 31 | +$wgAutoloadClasses['MobileFrontend2_Options'] = $dir . 'MobileFrontend2_Options.php'; |
31 | 32 | $wgAutoloadClasses['MobileFrontend2_PostParse'] = $dir . 'MobileFrontend2_PostParse.php'; |
32 | 33 | |
33 | 34 | // Skins |
Index: trunk/extensions/MobileFrontend2/skins/Mobile.php |
— | — | @@ -129,10 +129,13 @@ |
130 | 130 | <?php $this->html( 'headscripts' ) ?> |
131 | 131 | </head> |
132 | 132 | <body> |
| 133 | + <?php if ( !MobileFrontend2_Options::getHideSearch() ): ?> |
133 | 134 | <!-- search/header --> |
134 | 135 | <div id="header"> |
135 | 136 | <div id="searchbox"> |
| 137 | + <?php if ( !MobileFrontend2_Options::getHideLogo() ): ?> |
136 | 138 | <img src="<?php $this->text( 'mobilelogopath' ) ?>" alt="Logo" id="logo" width="35" height="22" /> |
| 139 | + <?php endif ?> |
137 | 140 | <form action="<?php $this->text( 'wgScript' ) ?>" class="search_bar" method="get"> |
138 | 141 | <input type="hidden" name="title" value="Special:Search" /> |
139 | 142 | |
— | — | @@ -144,6 +147,7 @@ |
145 | 148 | </form> |
146 | 149 | </div> |
147 | 150 | </div> |
| 151 | + <?php endif ?> |
148 | 152 | |
149 | 153 | <!-- content --> |
150 | 154 | <div class="show" id="content_wrapper"> |
— | — | @@ -162,6 +166,7 @@ |
163 | 167 | <!-- /bodyContent --> |
164 | 168 | </div> |
165 | 169 | |
| 170 | + <?php if ( !MobileFrontend2_Options::getHideFooter() ): ?> |
166 | 171 | <!-- footer --> |
167 | 172 | <div id="footer"> |
168 | 173 | <div class="nav" id="footmenu"> |
— | — | @@ -177,6 +182,7 @@ |
178 | 183 | </div> |
179 | 184 | </div> |
180 | 185 | </div> |
| 186 | + <?php endif ?> |
181 | 187 | |
182 | 188 | <?php $this->html( 'bottomscripts' ) ?> |
183 | 189 | |
Index: trunk/extensions/MobileFrontend2/MobileFrontend2_Options.php |
— | — | @@ -0,0 +1,60 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +class MobileFrontend2_Options { |
| 5 | + |
| 6 | + /** |
| 7 | + * Hide the search bar |
| 8 | + * |
| 9 | + * @var bool |
| 10 | + */ |
| 11 | + protected static $hideSearch = false; |
| 12 | + |
| 13 | + /** |
| 14 | + * Hides the logo |
| 15 | + * |
| 16 | + * @var bool |
| 17 | + */ |
| 18 | + protected static $hideLogo = false; |
| 19 | + |
| 20 | + /** |
| 21 | + * Hides the footer |
| 22 | + * |
| 23 | + * @var bool |
| 24 | + */ |
| 25 | + protected static $hideFooter = false; |
| 26 | + |
| 27 | + /** |
| 28 | + * Detects options based on user preferences |
| 29 | + */ |
| 30 | + public static function detect() { |
| 31 | + $request = RequestContext::getMain()->getRequest(); |
| 32 | + |
| 33 | + self::$hideSearch = $request->getBool( 'hidesearch' ); |
| 34 | + self::$hideLogo = $request->getBool( 'hidelogo' ); |
| 35 | + // TODO: Previously this was lumped into hidelogo. Notify mobile team |
| 36 | + self::$hideFooter = $request->getBool( 'hidefooter' ); |
| 37 | + |
| 38 | + // TODO: Hook for Wikimedia |
| 39 | + } |
| 40 | + |
| 41 | + /** |
| 42 | + * @return boolean |
| 43 | + */ |
| 44 | + public static function getHideLogo() { |
| 45 | + return self::$hideLogo; |
| 46 | + } |
| 47 | + |
| 48 | + /** |
| 49 | + * @return boolean |
| 50 | + */ |
| 51 | + public static function getHideSearch() { |
| 52 | + return self::$hideSearch; |
| 53 | + } |
| 54 | + |
| 55 | + /** |
| 56 | + * @return boolean |
| 57 | + */ |
| 58 | + public static function getHideFooter() { |
| 59 | + return self::$hideFooter; |
| 60 | + } |
| 61 | +} |
Property changes on: trunk/extensions/MobileFrontend2/MobileFrontend2_Options.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 62 | + native |
Index: trunk/extensions/MobileFrontend2/MobileFrontend2_Detection.php |
— | — | @@ -49,6 +49,10 @@ |
50 | 50 | */ |
51 | 51 | private static function enable() { |
52 | 52 | self::$enabled = true; |
| 53 | + |
| 54 | + // Do some initialization |
| 55 | + MobileFrontend2_Options::detect(); |
| 56 | + |
53 | 57 | return true; |
54 | 58 | } |
55 | 59 | |