Automattic\WPSC\Device_Detection
User_Agent_Info::is_kindle_touch
Detects if the current browser is the Kindle Touch Native browser
Mozilla/5.0 (X11; U; Linux armv7l like Android; en-us) AppleWebKit/531.2+ (KHTML, like Gecko) Version/5.0 Safari/533.2+ Kindle/3.0+
Method of the class: User_Agent_Info{}
No Hooks.
Returns
true|false. true if the browser is Kindle monochrome Native browser otherwise false
Usage
$result = User_Agent_Info::is_kindle_touch( $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_kindle_touch() User Agent Info::is kindle touch code WPSCache 3.1.0
public static function is_kindle_touch( $user_agent = null ) {
$user_agent = self::maybe_get_user_agent_from_server( $user_agent );
if ( empty( $user_agent ) ) {
return false;
}
$agent = strtolower( wp_unslash( $user_agent ) ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- This is validating.
$pos_kindle_touch = strpos( $agent, 'kindle/3.0+' );
if ( false !== $pos_kindle_touch && false === self::is_kindle_fire( $user_agent ) ) {
return true;
} else {
return false;
}
}