Automattic\WPSC\Device_Detection
User_Agent_Info::is_PalmWebOS
Detects if the current browser is on a Palm device running the new WebOS. This EXCLUDES TouchPad.
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 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
Method of the class: User_Agent_Info{}
No Hooks.
Returns
null. Nothing (null).
Usage
$result = User_Agent_Info::is_PalmWebOS( $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_PalmWebOS() User Agent Info::is PalmWebOS code WPSCache 3.1.0
public static function is_PalmWebOS( $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, 'webos' ) ) {
return false;
} elseif ( self::is_opera_mini( $user_agent ) || self::is_opera_mobile( $user_agent ) || self::is_firefox_mobile( $user_agent ) ) {
return false;
} else {
return true;
}
}