Automattic\WPSC\Device_Detection

User_Agent_Info::is_opera_minipublic staticWPSCache 1.0

Detects if the current browser is Opera Mini

Opera/8.01 (J2ME/MIDP; Opera Mini/3.0.6306/1528; en; U; ssr) Opera/9.80 (Android;Opera Mini/6.0.24212/24.746 U;en) Presto/2.5.25 Version/10.5454 Opera/9.80 (iPhone; Opera Mini/5.0.019802/18.738; U; en) Presto/2.4.15 Opera/9.80 (J2ME/iPhone;Opera Mini/5.0.019802/886; U; ja) Presto/2.4.15 Opera/9.80 (J2ME/iPhone;Opera Mini/5.0.019802/886; U; ja) Presto/2.4.15 Opera/9.80 (Series 60; Opera Mini/5.1.22783/23.334; U; en) Presto/2.5.25 Version/10.54 Opera/9.80 (BlackBerry; Opera Mini/5.1.22303/22.387; U; en) Presto/2.5.25 Version/10.54

Method of the class: User_Agent_Info{}

No Hooks.

Returns

null. Nothing (null).

Usage

$result = User_Agent_Info::is_opera_mini( $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_opera_mini() code WPSCache 3.1.1

public static function is_opera_mini( $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 ( strpos( $ua, 'opera' ) !== false && strpos( $ua, 'mini' ) !== false ) {
		return true;
	} else {
		return false;
	}
}