@@ 820-836 (lines=17) @@ | ||
817 | * Detects if the current browser is a Windows Phone 7 device. |
|
818 | * ex: Mozilla/4.0 (compatible; MSIE 7.0; Windows Phone OS 7.0; Trident/3.1; IEMobile/7.0; LG; GW910) |
|
819 | */ |
|
820 | public static function is_WindowsPhone7() { |
|
821 | if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) { |
|
822 | return false; |
|
823 | } |
|
824 | ||
825 | $ua = strtolower( $_SERVER['HTTP_USER_AGENT'] ); |
|
826 | ||
827 | if ( false === strpos( $ua, 'windows phone os 7' ) ) { |
|
828 | return false; |
|
829 | } else { |
|
830 | if ( self::is_opera_mini() || self::is_opera_mobile() || self::is_firefox_mobile() ) { |
|
831 | return false; |
|
832 | } else { |
|
833 | return true; |
|
834 | } |
|
835 | } |
|
836 | } |
|
837 | ||
838 | /** |
|
839 | * Detects if the current browser is a Windows Phone 8 device. |
|
@@ 862-878 (lines=17) @@ | ||
859 | * 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 |
|
860 | * 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 |
|
861 | */ |
|
862 | public static function is_PalmWebOS() { |
|
863 | if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) { |
|
864 | return false; |
|
865 | } |
|
866 | ||
867 | $ua = strtolower( $_SERVER['HTTP_USER_AGENT'] ); |
|
868 | ||
869 | if ( false === strpos( $ua, 'webos' ) ) { |
|
870 | return false; |
|
871 | } else { |
|
872 | if ( self::is_opera_mini() || self::is_opera_mobile() || self::is_firefox_mobile() ) { |
|
873 | return false; |
|
874 | } else { |
|
875 | return true; |
|
876 | } |
|
877 | } |
|
878 | } |
|
879 | ||
880 | /** |
|
881 | * Detects if the current browser is the HP TouchPad default browser. This excludes phones wt WebOS. |
|
@@ 1048-1065 (lines=18) @@ | ||
1045 | /** |
|
1046 | * Detects if the current UA is a MeeGo device (Nokia Smartphone). |
|
1047 | */ |
|
1048 | public static function is_MeeGo() { |
|
1049 | ||
1050 | if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) { |
|
1051 | return false; |
|
1052 | } |
|
1053 | ||
1054 | $ua = strtolower( $_SERVER['HTTP_USER_AGENT'] ); |
|
1055 | ||
1056 | if ( false === strpos( $ua, 'meego' ) ) { |
|
1057 | return false; |
|
1058 | } else { |
|
1059 | if ( self::is_opera_mini() || self::is_opera_mobile() || self::is_firefox_mobile() ) { |
|
1060 | return false; |
|
1061 | } else { |
|
1062 | return true; |
|
1063 | } |
|
1064 | } |
|
1065 | } |
|
1066 | ||
1067 | ||
1068 | /** |
|
@@ 1093-1109 (lines=17) @@ | ||
1090 | * |
|
1091 | * @return boolean true if the browser is Android otherwise false |
|
1092 | */ |
|
1093 | public static function is_android() { |
|
1094 | if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) { |
|
1095 | return false; |
|
1096 | } |
|
1097 | ||
1098 | $agent = strtolower( $_SERVER['HTTP_USER_AGENT'] ); |
|
1099 | $pos_android = strpos( $agent, 'android' ); |
|
1100 | if ( false !== $pos_android ) { |
|
1101 | if ( self::is_opera_mini() || self::is_opera_mobile() || self::is_firefox_mobile() ) { |
|
1102 | return false; |
|
1103 | } else { |
|
1104 | return true; |
|
1105 | } |
|
1106 | } else { |
|
1107 | return false; |
|
1108 | } |
|
1109 | } |
|
1110 | ||
1111 | ||
1112 | /** |
|
@@ 1261-1278 (lines=18) @@ | ||
1258 | * The is_blackbeberry() method can be used to check the User Agent for a blackberry device. |
|
1259 | * Note that opera mini on BB matches this rule. |
|
1260 | */ |
|
1261 | public static function is_blackbeberry() { |
|
1262 | if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) { |
|
1263 | return false; |
|
1264 | } |
|
1265 | ||
1266 | $agent = strtolower( $_SERVER['HTTP_USER_AGENT'] ); |
|
1267 | ||
1268 | $pos_blackberry = strpos( $agent, 'blackberry' ); |
|
1269 | if ( false !== $pos_blackberry ) { |
|
1270 | if ( self::is_opera_mini() || self::is_opera_mobile() || self::is_firefox_mobile() ) { |
|
1271 | return false; |
|
1272 | } else { |
|
1273 | return true; |
|
1274 | } |
|
1275 | } else { |
|
1276 | return false; |
|
1277 | } |
|
1278 | } |
|
1279 | ||
1280 | /** |
|
1281 | * The is_blackberry_10() method can be used to check the User Agent for a BlackBerry 10 device. |