Automattic\Jetpack\Device_Detection

User_Agent_Info::is_firefox_mobile()public staticWPSCache 1.0

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.

Return

null. Nothing.

Usage

$result = User_Agent_Info::is_firefox_mobile();

User_Agent_Info::is_firefox_mobile() code WPSCache 1.9.1

public static function is_firefox_mobile() {

	if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) {
		return false;
	}

	$ua = strtolower( wp_unslash( $_SERVER['HTTP_USER_AGENT'] ) ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- This is validating.

	if ( strpos( $ua, 'fennec' ) !== false ) {
		return true;
	} else {
		return false;
	}
}