@@ 807-823 (lines=17) @@ | ||
804 | * Detects if the current browser is a Windows Phone 7 device. |
|
805 | * ex: Mozilla/4.0 (compatible; MSIE 7.0; Windows Phone OS 7.0; Trident/3.1; IEMobile/7.0; LG; GW910) |
|
806 | */ |
|
807 | public static function is_WindowsPhone7() { |
|
808 | if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) { |
|
809 | return false; |
|
810 | } |
|
811 | ||
812 | $ua = strtolower( $_SERVER['HTTP_USER_AGENT'] ); |
|
813 | ||
814 | if ( false === strpos( $ua, 'windows phone os 7' ) ) { |
|
815 | return false; |
|
816 | } else { |
|
817 | if ( self::is_opera_mini() || self::is_opera_mobile() || self::is_firefox_mobile() ) { |
|
818 | return false; |
|
819 | } else { |
|
820 | return true; |
|
821 | } |
|
822 | } |
|
823 | } |
|
824 | ||
825 | /** |
|
826 | * Detects if the current browser is a Windows Phone 8 device. |
|
@@ 848-864 (lines=17) @@ | ||
845 | * 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 |
|
846 | * 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 |
|
847 | */ |
|
848 | public static function is_PalmWebOS() { |
|
849 | if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) { |
|
850 | return false; |
|
851 | } |
|
852 | ||
853 | $ua = strtolower( $_SERVER['HTTP_USER_AGENT'] ); |
|
854 | ||
855 | if ( false === strpos( $ua, 'webos' ) ) { |
|
856 | return false; |
|
857 | } else { |
|
858 | if ( self::is_opera_mini() || self::is_opera_mobile() || self::is_firefox_mobile() ) { |
|
859 | return false; |
|
860 | } else { |
|
861 | return true; |
|
862 | } |
|
863 | } |
|
864 | } |
|
865 | ||
866 | /** |
|
867 | * Detects if the current browser is the HP TouchPad default browser. This excludes phones wt WebOS. |
|
@@ 1032-1049 (lines=18) @@ | ||
1029 | /** |
|
1030 | * Detects if the current UA is a MeeGo device (Nokia Smartphone). |
|
1031 | */ |
|
1032 | public static function is_MeeGo() { |
|
1033 | ||
1034 | if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) { |
|
1035 | return false; |
|
1036 | } |
|
1037 | ||
1038 | $ua = strtolower( $_SERVER['HTTP_USER_AGENT'] ); |
|
1039 | ||
1040 | if ( false === strpos( $ua, 'meego' ) ) { |
|
1041 | return false; |
|
1042 | } else { |
|
1043 | if ( self::is_opera_mini() || self::is_opera_mobile() || self::is_firefox_mobile() ) { |
|
1044 | return false; |
|
1045 | } else { |
|
1046 | return true; |
|
1047 | } |
|
1048 | } |
|
1049 | } |
|
1050 | ||
1051 | /** |
|
1052 | * The is_webkit() method can be used to check the User Agent for an webkit generic browser. |
|
@@ 1076-1092 (lines=17) @@ | ||
1073 | * |
|
1074 | * @return boolean true if the browser is Android otherwise false |
|
1075 | */ |
|
1076 | public static function is_android() { |
|
1077 | if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) { |
|
1078 | return false; |
|
1079 | } |
|
1080 | ||
1081 | $agent = strtolower( $_SERVER['HTTP_USER_AGENT'] ); |
|
1082 | $pos_android = strpos( $agent, 'android' ); |
|
1083 | if ( false !== $pos_android ) { |
|
1084 | if ( self::is_opera_mini() || self::is_opera_mobile() || self::is_firefox_mobile() ) { |
|
1085 | return false; |
|
1086 | } else { |
|
1087 | return true; |
|
1088 | } |
|
1089 | } else { |
|
1090 | return false; |
|
1091 | } |
|
1092 | } |
|
1093 | ||
1094 | /** |
|
1095 | * Detects if the current browser is the Native Android Tablet browser. |
|
@@ 1242-1259 (lines=18) @@ | ||
1239 | * The is_blackbeberry() method can be used to check the User Agent for a blackberry device. |
|
1240 | * Note that opera mini on BB matches this rule. |
|
1241 | */ |
|
1242 | public static function is_blackbeberry() { |
|
1243 | if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) { |
|
1244 | return false; |
|
1245 | } |
|
1246 | ||
1247 | $agent = strtolower( $_SERVER['HTTP_USER_AGENT'] ); |
|
1248 | ||
1249 | $pos_blackberry = strpos( $agent, 'blackberry' ); |
|
1250 | if ( false !== $pos_blackberry ) { |
|
1251 | if ( self::is_opera_mini() || self::is_opera_mobile() || self::is_firefox_mobile() ) { |
|
1252 | return false; |
|
1253 | } else { |
|
1254 | return true; |
|
1255 | } |
|
1256 | } else { |
|
1257 | return false; |
|
1258 | } |
|
1259 | } |
|
1260 | ||
1261 | /** |
|
1262 | * The is_blackberry_10() method can be used to check the User Agent for a BlackBerry 10 device. |