Automattic\Jetpack\Device_Detection

User_Agent_Info::is_facebook_for_ipad()public staticWPSCache 1.0

Detects if the current UA is Facebook for iPad

  • Facebook 4020.0 (iPad; iPhone OS 5.0.1; en_US)
  • Mozilla/5.0 (iPad; U; CPU iPhone OS 5_0 like Mac OS X; en_US) AppleWebKit (KHTML, like Gecko) Mobile [FBAN/FBForIPhone;FBAV/4.0.2;FBBV/4020.0;FBDV/iPad2,1;FBMD/iPad;FBSN/iPhone OS;FBSV/5.0;FBSS/1; FBCR/;FBID/tablet;FBLC/en_US;FBSF/1.0]
  • Mozilla/5.0 (iPad; CPU OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Mobile/10A403 [FBAN/FBIOS;FBAV/5.0;FBBV/47423;FBDV/iPad2,1;FBMD/iPad;FBSN/iPhone OS;FBSV/6.0;FBSS/1; FBCR/;FBID/tablet;FBLC/en_US]

Метод класса: User_Agent_Info{}

Хуков нет.

Возвращает

null. Ничего.

Использование

$result = User_Agent_Info::is_facebook_for_ipad();

Код User_Agent_Info::is_facebook_for_ipad() WPSCache 1.9.1

public static function is_facebook_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 ( false === strpos( $ua, 'ipad' ) ) {
		return false;
	}

	if ( false !== strpos( $ua, 'facebook' ) || false !== strpos( $ua, 'fbforiphone' ) || false !== strpos( $ua, 'fban/fbios;' ) ) {
		return true;
	} else {
		return false;
	}
}