https://www.mediawiki.org/wiki/Special:Code/MediaWiki/105331

Revision: 105331
Author:   demon
Date:     2011-12-06 18:50:14 +0000 (Tue, 06 Dec 2011)
Log Message:
-----------
Remove empty() for some unconditionally set variables and use isset() for some 
array index checking

Modified Paths:
--------------
    trunk/extensions/MobileFrontend/CssDetection.php
    trunk/extensions/MobileFrontend/MobileFrontend.php

Modified: trunk/extensions/MobileFrontend/CssDetection.php
===================================================================
--- trunk/extensions/MobileFrontend/CssDetection.php    2011-12-06 18:48:48 UTC 
(rev 105330)
+++ trunk/extensions/MobileFrontend/CssDetection.php    2011-12-06 18:50:14 UTC 
(rev 105331)
@@ -48,7 +48,7 @@
                        $rawName = $snippet;
                }
 
-               if ( empty( $output ) ) {
+               if ( !$output ) {
                        $output = 'Unknown HTML snippet found: ';
                        $type = 'UNKNOWN';
                        $rawName = $snippet;

Modified: trunk/extensions/MobileFrontend/MobileFrontend.php
===================================================================
--- trunk/extensions/MobileFrontend/MobileFrontend.php  2011-12-06 18:48:48 UTC 
(rev 105330)
+++ trunk/extensions/MobileFrontend/MobileFrontend.php  2011-12-06 18:50:14 UTC 
(rev 105331)
@@ -443,14 +443,13 @@
                // Thus, globalized objects will not be available as expected 
in the function.
                // This is stated to be intended behavior, as per the 
following: [http://bugs.php.net/bug.php?id=40104]
                
-               $xDevice = !empty( $_SERVER['HTTP_X_DEVICE'] ) ? 
$_SERVER['HTTP_X_DEVICE'] : '';
+               $xDevice = isset( $_SERVER['HTTP_X_DEVICE'] ) ? 
$_SERVER['HTTP_X_DEVICE'] : '';
                self::$useFormat = $wgRequest->getText( 'useformat' );
                $mobileAction = $wgRequest->getText( 'mobileaction' );
                $action = $wgRequest->getText( 'action' );
 
-               if ( self::$useFormat === 'mobile' ||
-                       self::$useFormat === 'mobile-wap' ||
-                       !empty( $xDevice ) ) {
+               if ( self::$useFormat === 'mobile' || self::$useFormat === 
'mobile-wap' ||
+                       $xDevice ) {
                                if ( $action !== 'edit' &&
                                         $mobileAction !== 'view_normal_site' ) 
{
 
@@ -497,10 +496,10 @@
                                        self::$search = $wgRequest->getText( 
'search' );
                                        self::$searchField = 
$wgRequest->getText( 'search', '' );
 
-                                       $acceptHeader = !empty( 
$_SERVER["HTTP_ACCEPT"] ) ? $_SERVER["HTTP_ACCEPT"] : '';
+                                       $acceptHeader = isset( 
$_SERVER["HTTP_ACCEPT"] ) ? $_SERVER["HTTP_ACCEPT"] : '';
                                        $device = new DeviceDetection();
 
-                                       if ( !empty( $xDevice ) ) {
+                                       if ( $xDevice ) {
                                                $formatName = $xDevice;
                                        } else {
                                                $formatName = 
$device->formatName( $userAgent, $acceptHeader );
@@ -595,7 +594,7 @@
                                                if ( $returnToVal ) {
                                                        $q['returnto'] = 
$returnToVal;
                                                }
-                                               
+
                                                self::$wsLoginFormAction = 
self::$title->getLocalURL( $q );
                                        }
                                        


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to