Automattic\Jetpack\Device_Detection
User_Agent_Info::is_opera_desktop()
Detect modern Opera desktop
Mozilla/5.0 (Macintosh; Intel Mac OS X 11_2_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.182 Safari/537.36 OPR/74.0.3911.203
Looking for "OPR/" specifically.
Method of the class: User_Agent_Info{}
No Hooks.
Return
null
. Nothing (null).
Usage
$result = User_Agent_Info::is_opera_desktop();
User_Agent_Info::is_opera_desktop() User Agent Info::is opera desktop code WPSCache 1.12.4
public static function is_opera_desktop() { if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) { return false; } if ( false === strpos( wp_unslash( $_SERVER['HTTP_USER_AGENT'] ), 'OPR/' ) ) { // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- This is validating. return false; } return true; }