updated plugin Jetpack Protect version 5.0.0
This commit is contained in:
@ -177,7 +177,6 @@ class Device_Detection {
|
||||
'dumb' => false,
|
||||
'any' => false,
|
||||
);
|
||||
$first_run = true;
|
||||
$matched_agent = '';
|
||||
|
||||
// If an invalid kind is passed in, reset it to default.
|
||||
@ -207,44 +206,40 @@ class Device_Detection {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( $first_run ) {
|
||||
$first_run = false;
|
||||
// checks for iPhoneTier devices & RichCSS devices.
|
||||
if ( $ua_info->isTierIphone() || $ua_info->isTierRichCSS() ) {
|
||||
$kinds['smart'] = true;
|
||||
$matched_agent = $ua_info->matched_agent;
|
||||
}
|
||||
|
||||
// checks for iPhoneTier devices & RichCSS devices.
|
||||
if ( $ua_info->isTierIphone() || $ua_info->isTierRichCSS() ) {
|
||||
$kinds['smart'] = true;
|
||||
$matched_agent = $ua_info->matched_agent;
|
||||
}
|
||||
if ( ! $kinds['smart'] ) {
|
||||
// if smart, we are not dumb so no need to check.
|
||||
$dumb_agents = $ua_info->dumb_agents;
|
||||
|
||||
if ( ! $kinds['smart'] ) {
|
||||
// if smart, we are not dumb so no need to check.
|
||||
$dumb_agents = $ua_info->dumb_agents;
|
||||
foreach ( $dumb_agents as $dumb_agent ) {
|
||||
if ( false !== strpos( $agent, $dumb_agent ) ) {
|
||||
$kinds['dumb'] = true;
|
||||
$matched_agent = $dumb_agent;
|
||||
|
||||
foreach ( $dumb_agents as $dumb_agent ) {
|
||||
if ( false !== strpos( $agent, $dumb_agent ) ) {
|
||||
$kinds['dumb'] = true;
|
||||
$matched_agent = $dumb_agent;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! $kinds['dumb'] ) {
|
||||
if ( isset( $_SERVER['HTTP_X_WAP_PROFILE'] ) ) {
|
||||
$kinds['dumb'] = true;
|
||||
$matched_agent = 'http_x_wap_profile';
|
||||
} elseif ( isset( $_SERVER['HTTP_ACCEPT'] ) && ( preg_match( '/wap\.|\.wap/i', $_SERVER['HTTP_ACCEPT'] ) || false !== strpos( strtolower( $_SERVER['HTTP_ACCEPT'] ), 'application/vnd.wap.xhtml+xml' ) ) ) { // phpcs:ignore WordPress.Security.ValidatedSanitizedInput -- This is doing the validating.
|
||||
$kinds['dumb'] = true;
|
||||
$matched_agent = 'vnd.wap.xhtml+xml';
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( $kinds['dumb'] || $kinds['smart'] ) {
|
||||
$kinds['any'] = true;
|
||||
if ( ! $kinds['dumb'] ) {
|
||||
if ( isset( $_SERVER['HTTP_X_WAP_PROFILE'] ) ) {
|
||||
$kinds['dumb'] = true;
|
||||
$matched_agent = 'http_x_wap_profile';
|
||||
} elseif ( isset( $_SERVER['HTTP_ACCEPT'] ) && ( preg_match( '/wap\.|\.wap/i', $_SERVER['HTTP_ACCEPT'] ) || false !== strpos( strtolower( $_SERVER['HTTP_ACCEPT'] ), 'application/vnd.wap.xhtml+xml' ) ) ) { // phpcs:ignore WordPress.Security.ValidatedSanitizedInput -- This is doing the validating.
|
||||
$kinds['dumb'] = true;
|
||||
$matched_agent = 'vnd.wap.xhtml+xml';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( $kinds['dumb'] || $kinds['smart'] ) {
|
||||
$kinds['any'] = true;
|
||||
}
|
||||
|
||||
$value = $kinds[ $kind ];
|
||||
|
||||
if ( $return_matched_agent ) {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user