| @@ 1081-1096 (lines=16) @@ | ||
| 1078 | /** |
|
| 1079 | * The is_webkit() method can be used to check the User Agent for an webkit generic browser. |
|
| 1080 | */ |
|
| 1081 | public static function is_webkit() { |
|
| 1082 | ||
| 1083 | if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) { |
|
| 1084 | return false; |
|
| 1085 | } |
|
| 1086 | ||
| 1087 | $agent = strtolower( $_SERVER['HTTP_USER_AGENT'] ); |
|
| 1088 | ||
| 1089 | $pos_webkit = strpos( $agent, 'webkit' ); |
|
| 1090 | ||
| 1091 | if ( false !== $pos_webkit ) { |
|
| 1092 | return true; |
|
| 1093 | } else { |
|
| 1094 | return false; |
|
| 1095 | } |
|
| 1096 | } |
|
| 1097 | ||
| 1098 | /** |
|
| 1099 | * Detects if the current browser is the Native Android browser. |
|
| @@ 1179-1190 (lines=12) @@ | ||
| 1176 | * |
|
| 1177 | * @return boolean true if the browser is Kindle monochrome Native browser otherwise false |
|
| 1178 | */ |
|
| 1179 | public static function is_kindle_touch() { |
|
| 1180 | if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) { |
|
| 1181 | return false; |
|
| 1182 | } |
|
| 1183 | $agent = strtolower( $_SERVER['HTTP_USER_AGENT'] ); |
|
| 1184 | $pos_kindle_touch = strpos( $agent, 'kindle/3.0+' ); |
|
| 1185 | if ( false !== $pos_kindle_touch && false === self::is_kindle_fire() ) { |
|
| 1186 | return true; |
|
| 1187 | } else { |
|
| 1188 | return false; |
|
| 1189 | } |
|
| 1190 | } |
|
| 1191 | ||
| 1192 | /** |
|
| 1193 | * Detect if user agent is the WordPress.com Windows 8 app (used ONLY on the custom oauth stylesheet) |
|
| @@ 1195-1207 (lines=13) @@ | ||
| 1192 | /** |
|
| 1193 | * Detect if user agent is the WordPress.com Windows 8 app (used ONLY on the custom oauth stylesheet) |
|
| 1194 | */ |
|
| 1195 | public static function is_windows8_auth() { |
|
| 1196 | if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) { |
|
| 1197 | return false; |
|
| 1198 | } |
|
| 1199 | ||
| 1200 | $agent = strtolower( $_SERVER['HTTP_USER_AGENT'] ); |
|
| 1201 | $pos = strpos( $agent, 'msauthhost' ); |
|
| 1202 | if ( false !== $pos ) { |
|
| 1203 | return true; |
|
| 1204 | } else { |
|
| 1205 | return false; |
|
| 1206 | } |
|
| 1207 | } |
|
| 1208 | ||
| 1209 | /** |
|
| 1210 | * Detect if user agent is the WordPress.com Windows 8 app. |
|
| @@ 1212-1224 (lines=13) @@ | ||
| 1209 | /** |
|
| 1210 | * Detect if user agent is the WordPress.com Windows 8 app. |
|
| 1211 | */ |
|
| 1212 | public static function is_wordpress_for_win8() { |
|
| 1213 | if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) { |
|
| 1214 | return false; |
|
| 1215 | } |
|
| 1216 | ||
| 1217 | $agent = strtolower( $_SERVER['HTTP_USER_AGENT'] ); |
|
| 1218 | $pos = strpos( $agent, 'wp-windows8' ); |
|
| 1219 | if ( false !== $pos ) { |
|
| 1220 | return true; |
|
| 1221 | } else { |
|
| 1222 | return false; |
|
| 1223 | } |
|
| 1224 | } |
|
| 1225 | ||
| 1226 | /** |
|
| 1227 | * Detect if user agent is the WordPress.com Desktop app. |
|
| @@ 1229-1241 (lines=13) @@ | ||
| 1226 | /** |
|
| 1227 | * Detect if user agent is the WordPress.com Desktop app. |
|
| 1228 | */ |
|
| 1229 | public static function is_wordpress_desktop_app() { |
|
| 1230 | if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) { |
|
| 1231 | return false; |
|
| 1232 | } |
|
| 1233 | ||
| 1234 | $agent = strtolower( $_SERVER['HTTP_USER_AGENT'] ); |
|
| 1235 | $pos = strpos( $agent, 'WordPressDesktop' ); |
|
| 1236 | if ( false !== $pos ) { |
|
| 1237 | return true; |
|
| 1238 | } else { |
|
| 1239 | return false; |
|
| 1240 | } |
|
| 1241 | } |
|
| 1242 | ||
| 1243 | /** |
|
| 1244 | * The is_blackberry_tablet() method can be used to check the User Agent for a RIM blackberry tablet. |
|