Automattic\Jetpack\Device_Detection

User_Agent_Info::is_twitter_for_iphone()public staticWPSCache 1.0

Detects if the current UA is Twitter for iPhone

Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_3_5 like Mac OS X; nb-no) AppleWebKit/533.17.9 (KHTML, like Gecko) Mobile/8L1 Twitter for iPhone Mozilla/5.0 (iPhone; CPU iPhone OS 5_1_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Mobile/9B206 Twitter for iPhone

Method of the class: User_Agent_Info{}

No Hooks.

Return

null. Nothing.

Usage

$result = User_Agent_Info::is_twitter_for_iphone();

User_Agent_Info::is_twitter_for_iphone() code WPSCache 1.9.1

public static function is_twitter_for_iphone() {
	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, 'ipad' ) !== false ) {
		return false;
	}

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