Automattic\Jetpack\Device_Detection
User_Agent_Info::is_firefox_desktop
Detects if the current browser is Firefox for desktop
See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent/Firefox Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion The platform section will include 'Mobile' for phones and 'Tablet' for tablets.
Метод класса: User_Agent_Info{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$result = User_Agent_Info::is_firefox_desktop( $user_agent );
- $user_agent(строка|null)
- User agent string to check. If not provided, uses $_SERVER['HTTP_USER_AGENT'].
По умолчанию: null
Код User_Agent_Info::is_firefox_desktop() User Agent Info::is firefox desktop WPSCache 3.0.3
public static function is_firefox_desktop( $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 ( false !== strpos( $ua, 'firefox' ) && false === strpos( $ua, 'mobile' ) && false === strpos( $ua, 'tablet' ) ) {
return true;
} else {
return false;
}
}