Automattic\Jetpack\Device_Detection
User_Agent_Info::is_opera_mobile()
Detects if the current browser is Opera Mobile
What is the difference between Opera Mobile and Opera Mini?
- Opera Mobile is a full Internet browser for mobile devices.
- Opera Mini always uses a transcoder to convert the page for a small display. (it uses Opera advanced server compression technology to compress web content before it gets to a device. The rendering engine is on Opera's server.)
Opera/9.80 (Windows NT 6.1; Opera Mobi/14316; U; en) Presto/2.7.81 Version/11.00" Opera/9.50 (Nintendo DSi; Opera/507; U; en-US)
Method of the class: User_Agent_Info{}
No Hooks.
Return
null
. Nothing (null).
Usage
$result = User_Agent_Info::is_opera_mobile();
User_Agent_Info::is_opera_mobile() User Agent Info::is opera mobile code WPSCache 1.12.4
public static function is_opera_mobile() { 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, 'opera' ) !== false && strpos( $ua, 'mobi' ) !== false ) { return true; } elseif ( strpos( $ua, 'opera' ) !== false && strpos( $ua, 'nintendo dsi' ) !== false ) { return true; } else { return false; } }