Index: trunk/extensions/MobileFrontend/MobileFrontendTemplate.php |
— | — | @@ -1,51 +1,51 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | 4 | if( !defined( 'MEDIAWIKI' ) ) { |
5 | | - die( -1 ); |
| 5 | + die( -1 ); |
6 | 6 | } |
7 | 7 | |
8 | 8 | abstract class MobileFrontendTemplate { |
9 | 9 | public $data; |
10 | | - |
| 10 | + |
11 | 11 | /** |
12 | | - * Constructor |
13 | | - */ |
| 12 | + * Constructor |
| 13 | + */ |
14 | 14 | public function __construct() { |
15 | 15 | $this->data = array(); |
16 | 16 | } |
17 | | - |
| 17 | + |
18 | 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 | | - } |
| 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 | 26 | |
27 | 27 | /** |
28 | | - * Sets the value $value to $name |
29 | | - * @param $name |
30 | | - * @param $value |
31 | | - */ |
32 | | - public function setByArray( $options ) { |
| 28 | + * Sets the value $value to $name |
| 29 | + * @param $name |
| 30 | + * @param $value |
| 31 | + */ |
| 32 | + public function setByArray( $options ) { |
33 | 33 | foreach ($options as $name => $value ) { |
34 | 34 | $this->set( $name, $value ); |
35 | 35 | } |
36 | | - } |
| 36 | + } |
37 | 37 | |
38 | 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 | | - } |
| 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 | 46 | |
47 | | - /** |
48 | | - * Main function, used by classes that subclass MobileFrontendTemplate |
49 | | - * to show the actual HTML output |
50 | | - */ |
51 | | - abstract public function getHTML(); |
52 | | -} |
\ No newline at end of file |
| 47 | + /** |
| 48 | + * Main function, used by classes that subclass MobileFrontendTemplate |
| 49 | + * to show the actual HTML output |
| 50 | + */ |
| 51 | + abstract public function getHTML(); |
| 52 | +} |
Index: trunk/extensions/MobileFrontend/MobileFrontend.php |
— | — | @@ -519,7 +519,7 @@ |
520 | 520 | |
521 | 521 | self::$title = $out->getTitle(); |
522 | 522 | |
523 | | - if ( Title::newMainPage()->equals( self::$title ) ) { |
| 523 | + if ( self::$title->isMainPage() ) { |
524 | 524 | self::$isMainPage = true; |
525 | 525 | } |
526 | 526 | if ( self::$title->getNamespace() == NS_FILE ) { |
— | — | @@ -537,9 +537,7 @@ |
538 | 538 | $location = str_replace( '&mfi=1', '', str_replace( '&mfi=0', '', $location ) ); |
539 | 539 | $location = $this->getRelativeURL( $location ); |
540 | 540 | $wgRequest->response()->header( 'Location: ' . $location . '&mfi=0' ); |
541 | | - } |
542 | | - |
543 | | - if ( self::$disableImages == 0 ) { |
| 541 | + } elseif ( self::$disableImages == 0 ) { |
544 | 542 | $disableImages = $wgRequest->getCookie( 'disableImages' ); |
545 | 543 | if ( $disableImages ) { |
546 | 544 | self::$disableImages = $disableImages; |
— | — | @@ -752,6 +750,9 @@ |
753 | 751 | return true; |
754 | 752 | } |
755 | 753 | |
| 754 | + /** |
| 755 | + * @return Mixed |
| 756 | + */ |
756 | 757 | private function getOptInOutCookie() { |
757 | 758 | global $wgRequest; |
758 | 759 | wfProfileIn( __METHOD__ ); |
Index: trunk/extensions/MobileFrontend/DisableTemplate.php |
— | — | @@ -5,11 +5,10 @@ |
6 | 6 | } |
7 | 7 | |
8 | 8 | class DisableTemplate extends MobileFrontendTemplate { |
9 | | - |
| 9 | + |
10 | 10 | public function getHTML() { |
11 | 11 | |
12 | | - $currentURL = $this->data['currentURL']; |
13 | | - $currentURL = str_replace( '&mobileaction=disable_mobile_site', '', $currentURL ); |
| 12 | + $currentURL = str_replace( '&mobileaction=disable_mobile_site', '', $this->data['currentURL'] ); // TODO: $currentURl is unused |
14 | 13 | $mobileRedirectFormAction = $this->data['mobileRedirectFormAction']; |
15 | 14 | |
16 | 15 | $disableHtml = <<<HTML |
— | — | @@ -20,7 +19,7 @@ |
21 | 20 | {$this->data['explainDisable']} |
22 | 21 | </p> |
23 | 22 | <div id='disableButtons'> |
24 | | - <form action='{$this->data['mobileRedirectFormAction']}' method='get'> |
| 23 | + <form action='{$mobileRedirectFormAction}' method='get'> |
25 | 24 | <input name='to' type='hidden' value='{$this->data['currentURL']}' /> |
26 | 25 | <input name='expires_in_days' type='hidden' value='3650' /> |
27 | 26 | <button id='disableButton' type='submit'>{$this->data['disableButton']}</button> |