Automattic\WPSC\Device_Detection
User_Agent_Info::is_firefox_mobile
Detects if the current browser is Firefox Mobile (Fennec)
See http://www.useragentstring.com/pages/Fennec/ Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.1.1) Gecko/20110415 Firefox/4.0.2pre Fennec/4.0.1 Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1b2pre) Gecko/20081015 Fennec/1.0a1
Method of the class: User_Agent_Info{}
No Hooks.
Returns
null. Nothing (null).
Usage
$result = User_Agent_Info::is_firefox_mobile( $user_agent );
- $user_agent(string|null)
- User agent string to check. If not provided, uses $_SERVER['HTTP_USER_AGENT'].
Default:null
User_Agent_Info::is_firefox_mobile() User Agent Info::is firefox mobile code WPSCache 3.1.0
public static function is_firefox_mobile( $user_agent = null ) {
$user_agent = self::maybe_get_user_agent_from_server( $user_agent );
if ( empty( $user_agent ) ) {
return false;
}
$ua = strtolower( wp_unslash( $user_agent ) ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- This is validating.
if ( strpos( $ua, 'fennec' ) !== false ) {
return true;
} else {
return false;
}
}