Automattic\Jetpack\Device_Detection

User_Agent_Info::is_twitter_for_ipad()public staticWPSCache 1.0

Detects if the current UA is Twitter for iPad

Old version 4.X - Mozilla/5.0 (iPad; U; CPU OS 4_3_5 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Mobile/8L1 Twitter for iPad Ver 5.0 or Higher - Mozilla/5.0 (iPad; CPU 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 (null).

Usage

$result = User_Agent_Info::is_twitter_for_ipad();

User_Agent_Info::is_twitter_for_ipad() code WPSCache 1.11.0

public static function is_twitter_for_ipad() {
	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, 'twitter for ipad' ) !== false ) {
		return true;
	} elseif ( strpos( $ua, 'ipad' ) !== false && strpos( $ua, 'twitter for iphone' ) !== false ) {
		return true;
	} else {
		return false;
	}
}