|
@@ 834-850 (lines=17) @@
|
| 831 |
|
* Detects if the current browser is a Windows Phone 7 device. |
| 832 |
|
* ex: Mozilla/4.0 (compatible; MSIE 7.0; Windows Phone OS 7.0; Trident/3.1; IEMobile/7.0; LG; GW910) |
| 833 |
|
*/ |
| 834 |
|
public static function is_WindowsPhone7() { |
| 835 |
|
if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) { |
| 836 |
|
return false; |
| 837 |
|
} |
| 838 |
|
|
| 839 |
|
$ua = strtolower( $_SERVER['HTTP_USER_AGENT'] ); |
| 840 |
|
|
| 841 |
|
if ( false === strpos( $ua, 'windows phone os 7' ) ) { |
| 842 |
|
return false; |
| 843 |
|
} else { |
| 844 |
|
if ( self::is_opera_mini() || self::is_opera_mobile() || self::is_firefox_mobile() ) { |
| 845 |
|
return false; |
| 846 |
|
} else { |
| 847 |
|
return true; |
| 848 |
|
} |
| 849 |
|
} |
| 850 |
|
} |
| 851 |
|
|
| 852 |
|
/** |
| 853 |
|
* Detects if the current browser is a Windows Phone 8 device. |
|
@@ 875-891 (lines=17) @@
|
| 872 |
|
* Ex1: Mozilla/5.0 (webOS/1.4.0; U; en-US) AppleWebKit/532.2 (KHTML, like Gecko) Version/1.0 Safari/532.2 Pre/1.1 |
| 873 |
|
* Ex2: Mozilla/5.0 (webOS/1.4.0; U; en-US) AppleWebKit/532.2 (KHTML, like Gecko) Version/1.0 Safari/532.2 Pixi/1.1 |
| 874 |
|
*/ |
| 875 |
|
public static function is_PalmWebOS() { |
| 876 |
|
if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) { |
| 877 |
|
return false; |
| 878 |
|
} |
| 879 |
|
|
| 880 |
|
$ua = strtolower( $_SERVER['HTTP_USER_AGENT'] ); |
| 881 |
|
|
| 882 |
|
if ( false === strpos( $ua, 'webos' ) ) { |
| 883 |
|
return false; |
| 884 |
|
} else { |
| 885 |
|
if ( self::is_opera_mini() || self::is_opera_mobile() || self::is_firefox_mobile() ) { |
| 886 |
|
return false; |
| 887 |
|
} else { |
| 888 |
|
return true; |
| 889 |
|
} |
| 890 |
|
} |
| 891 |
|
} |
| 892 |
|
|
| 893 |
|
/** |
| 894 |
|
* Detects if the current browser is the HP TouchPad default browser. This excludes phones wt WebOS. |
|
@@ 1059-1076 (lines=18) @@
|
| 1056 |
|
/** |
| 1057 |
|
* Detects if the current UA is a MeeGo device (Nokia Smartphone). |
| 1058 |
|
*/ |
| 1059 |
|
public static function is_MeeGo() { |
| 1060 |
|
|
| 1061 |
|
if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) { |
| 1062 |
|
return false; |
| 1063 |
|
} |
| 1064 |
|
|
| 1065 |
|
$ua = strtolower( $_SERVER['HTTP_USER_AGENT'] ); |
| 1066 |
|
|
| 1067 |
|
if ( false === strpos( $ua, 'meego' ) ) { |
| 1068 |
|
return false; |
| 1069 |
|
} else { |
| 1070 |
|
if ( self::is_opera_mini() || self::is_opera_mobile() || self::is_firefox_mobile() ) { |
| 1071 |
|
return false; |
| 1072 |
|
} else { |
| 1073 |
|
return true; |
| 1074 |
|
} |
| 1075 |
|
} |
| 1076 |
|
} |
| 1077 |
|
|
| 1078 |
|
/** |
| 1079 |
|
* The is_webkit() method can be used to check the User Agent for an webkit generic browser. |
|
@@ 1103-1119 (lines=17) @@
|
| 1100 |
|
* |
| 1101 |
|
* @return boolean true if the browser is Android otherwise false |
| 1102 |
|
*/ |
| 1103 |
|
public static function is_android() { |
| 1104 |
|
if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) { |
| 1105 |
|
return false; |
| 1106 |
|
} |
| 1107 |
|
|
| 1108 |
|
$agent = strtolower( $_SERVER['HTTP_USER_AGENT'] ); |
| 1109 |
|
$pos_android = strpos( $agent, 'android' ); |
| 1110 |
|
if ( false !== $pos_android ) { |
| 1111 |
|
if ( self::is_opera_mini() || self::is_opera_mobile() || self::is_firefox_mobile() ) { |
| 1112 |
|
return false; |
| 1113 |
|
} else { |
| 1114 |
|
return true; |
| 1115 |
|
} |
| 1116 |
|
} else { |
| 1117 |
|
return false; |
| 1118 |
|
} |
| 1119 |
|
} |
| 1120 |
|
|
| 1121 |
|
/** |
| 1122 |
|
* Detects if the current browser is the Native Android Tablet browser. |
|
@@ 1269-1286 (lines=18) @@
|
| 1266 |
|
* The is_blackbeberry() method can be used to check the User Agent for a blackberry device. |
| 1267 |
|
* Note that opera mini on BB matches this rule. |
| 1268 |
|
*/ |
| 1269 |
|
public static function is_blackbeberry() { |
| 1270 |
|
if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) { |
| 1271 |
|
return false; |
| 1272 |
|
} |
| 1273 |
|
|
| 1274 |
|
$agent = strtolower( $_SERVER['HTTP_USER_AGENT'] ); |
| 1275 |
|
|
| 1276 |
|
$pos_blackberry = strpos( $agent, 'blackberry' ); |
| 1277 |
|
if ( false !== $pos_blackberry ) { |
| 1278 |
|
if ( self::is_opera_mini() || self::is_opera_mobile() || self::is_firefox_mobile() ) { |
| 1279 |
|
return false; |
| 1280 |
|
} else { |
| 1281 |
|
return true; |
| 1282 |
|
} |
| 1283 |
|
} else { |
| 1284 |
|
return false; |
| 1285 |
|
} |
| 1286 |
|
} |
| 1287 |
|
|
| 1288 |
|
/** |
| 1289 |
|
* The is_blackberry_10() method can be used to check the User Agent for a BlackBerry 10 device. |