@@ 815-831 (lines=17) @@ | ||
812 | * Detects if the current browser is a Windows Phone 7 device. |
|
813 | * ex: Mozilla/4.0 (compatible; MSIE 7.0; Windows Phone OS 7.0; Trident/3.1; IEMobile/7.0; LG; GW910) |
|
814 | */ |
|
815 | public static function is_WindowsPhone7() { |
|
816 | if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) { |
|
817 | return false; |
|
818 | } |
|
819 | ||
820 | $ua = strtolower( $_SERVER['HTTP_USER_AGENT'] ); |
|
821 | ||
822 | if ( false === strpos( $ua, 'windows phone os 7' ) ) { |
|
823 | return false; |
|
824 | } else { |
|
825 | if ( self::is_opera_mini() || self::is_opera_mobile() || self::is_firefox_mobile() ) { |
|
826 | return false; |
|
827 | } else { |
|
828 | return true; |
|
829 | } |
|
830 | } |
|
831 | } |
|
832 | ||
833 | /** |
|
834 | * Detects if the current browser is a Windows Phone 8 device. |
|
@@ 856-872 (lines=17) @@ | ||
853 | * 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 |
|
854 | * 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 |
|
855 | */ |
|
856 | public static function is_PalmWebOS() { |
|
857 | if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) { |
|
858 | return false; |
|
859 | } |
|
860 | ||
861 | $ua = strtolower( $_SERVER['HTTP_USER_AGENT'] ); |
|
862 | ||
863 | if ( false === strpos( $ua, 'webos' ) ) { |
|
864 | return false; |
|
865 | } else { |
|
866 | if ( self::is_opera_mini() || self::is_opera_mobile() || self::is_firefox_mobile() ) { |
|
867 | return false; |
|
868 | } else { |
|
869 | return true; |
|
870 | } |
|
871 | } |
|
872 | } |
|
873 | ||
874 | /** |
|
875 | * Detects if the current browser is the HP TouchPad default browser. This excludes phones wt WebOS. |
|
@@ 1040-1057 (lines=18) @@ | ||
1037 | /** |
|
1038 | * Detects if the current UA is a MeeGo device (Nokia Smartphone). |
|
1039 | */ |
|
1040 | public static function is_MeeGo() { |
|
1041 | ||
1042 | if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) { |
|
1043 | return false; |
|
1044 | } |
|
1045 | ||
1046 | $ua = strtolower( $_SERVER['HTTP_USER_AGENT'] ); |
|
1047 | ||
1048 | if ( false === strpos( $ua, 'meego' ) ) { |
|
1049 | return false; |
|
1050 | } else { |
|
1051 | if ( self::is_opera_mini() || self::is_opera_mobile() || self::is_firefox_mobile() ) { |
|
1052 | return false; |
|
1053 | } else { |
|
1054 | return true; |
|
1055 | } |
|
1056 | } |
|
1057 | } |
|
1058 | ||
1059 | /** |
|
1060 | * The is_webkit() method can be used to check the User Agent for an webkit generic browser. |
|
@@ 1084-1100 (lines=17) @@ | ||
1081 | * |
|
1082 | * @return boolean true if the browser is Android otherwise false |
|
1083 | */ |
|
1084 | public static function is_android() { |
|
1085 | if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) { |
|
1086 | return false; |
|
1087 | } |
|
1088 | ||
1089 | $agent = strtolower( $_SERVER['HTTP_USER_AGENT'] ); |
|
1090 | $pos_android = strpos( $agent, 'android' ); |
|
1091 | if ( false !== $pos_android ) { |
|
1092 | if ( self::is_opera_mini() || self::is_opera_mobile() || self::is_firefox_mobile() ) { |
|
1093 | return false; |
|
1094 | } else { |
|
1095 | return true; |
|
1096 | } |
|
1097 | } else { |
|
1098 | return false; |
|
1099 | } |
|
1100 | } |
|
1101 | ||
1102 | /** |
|
1103 | * Detects if the current browser is the Native Android Tablet browser. |
|
@@ 1250-1267 (lines=18) @@ | ||
1247 | * The is_blackbeberry() method can be used to check the User Agent for a blackberry device. |
|
1248 | * Note that opera mini on BB matches this rule. |
|
1249 | */ |
|
1250 | public static function is_blackbeberry() { |
|
1251 | if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) { |
|
1252 | return false; |
|
1253 | } |
|
1254 | ||
1255 | $agent = strtolower( $_SERVER['HTTP_USER_AGENT'] ); |
|
1256 | ||
1257 | $pos_blackberry = strpos( $agent, 'blackberry' ); |
|
1258 | if ( false !== $pos_blackberry ) { |
|
1259 | if ( self::is_opera_mini() || self::is_opera_mobile() || self::is_firefox_mobile() ) { |
|
1260 | return false; |
|
1261 | } else { |
|
1262 | return true; |
|
1263 | } |
|
1264 | } else { |
|
1265 | return false; |
|
1266 | } |
|
1267 | } |
|
1268 | ||
1269 | /** |
|
1270 | * The is_blackberry_10() method can be used to check the User Agent for a BlackBerry 10 device. |