PluginProbe
Search Atlas SEO – OTTO AI SEO Automation for WordPress / 2.7.1
Search Atlas SEO – OTTO AI SEO Automation for WordPress v2.7.1
2.7.1 2.7.2 2.7.0 2.6.26 2.6.25 2.6.24 2.6.23 2.6.22 2.6.21 2.6.20 2.6.19 2.6.18 2.6.17 2.6.16 2.6.15 2.6.14 2.6.13 2.6.12 2.6.11 2.6.10 2.6.9 2.6.8 2.6.7 2.6.6 2.6.5 All 141 releases
← All changes | otto/Otto_html_class.php +33 -16 2.7.0 → 2.7.1 View file →
@@ -785,9 +785,9 @@
785 785 $response = wp_remote_get($url_with_params, $args);
786 786
787 787 # Check for errors
788 788 if (is_wp_error($response)) {
789 - error_log('MetaSync ' . Metasync::get_whitelabel_otto_name() . ': API call failed - ' . $response->get_error_message());
789 + error_log('MetaSync ' . Metasync::get_whitelabel_otto_name() . ': API call failed - ' . $response->get_error_message()); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log -- unreachable in production
790 790 return false;
791 791 }
792 792
793 793 # get the response body
@@ -797,9 +797,9 @@
797 797 $response_code = wp_remote_retrieve_response_code($response);
798 798
799 799 # if no change data skip
800 800 if (empty($body) || $response_code !== 200){
801 - error_log('MetaSync ' . Metasync::get_whitelabel_otto_name() . ': API returned empty or non-200. Code: ' . $response_code);
801 + error_log('MetaSync ' . Metasync::get_whitelabel_otto_name() . ': API returned empty or non-200. Code: ' . $response_code); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log -- unreachable in production
802 802 return false;
803 803 }
804 804
805 805 # set the html file path
@@ -992,9 +992,11 @@
992 992
993 993 # Check for timeout or connection errors
994 994 if (is_wp_error($route_html)) {
995 995 $error_msg = $route_html->get_error_message();
996 - error_log('MetaSync ' . Metasync::get_whitelabel_otto_name() . ' DEBUG: FAILED - wp_remote_get error: ' . $error_msg . ' for route: ' . $route);
996 + if (function_exists('metasync_otto_report_render_failure')) {
997 + metasync_otto_report_render_failure('HTTP_FETCH_FAILED', 'Internal fetch failed: ' . $error_msg, [], 'warning');
998 + }
997 999 return false;
998 1000 }
999 1001
1000 1002 # get body
@@ -1009,9 +1011,8 @@
1009 1011 // content and SEO metadata. The normal WordPress request can handle
1010 1012 // the redirect, and OTTO will process the destination on its own URL.
1011 1013 $effective_url = $this->get_effective_fetch_url($route_html);
1012 1014 if ($effective_url !== '' && !$this->fetch_url_matches_route($effective_url, $route, $request_body)) {
1013 - error_log('MetaSync ' . Metasync::get_whitelabel_otto_name() . ' DEBUG: SKIPPED - internal fetch followed redirect from ' . $route . ' to ' . $effective_url);
1014 1015 return false;
1015 1016 }
1016 1017
1017 1018 # Capture the internal fetch's `Set-Cookie`. On the HTTP path OTTO keeps only the
@@ -1043,9 +1044,11 @@
1043 1044
1044 1045
1045 1046 # check not empty
1046 1047 if(empty($html_body) || $response_code !== 200){
1047 - error_log('MetaSync ' . Metasync::get_whitelabel_otto_name() . ' DEBUG: FAILED - Empty body or non-200 status for route: ' . $route);
1048 + if (function_exists('metasync_otto_report_render_failure')) {
1049 + metasync_otto_report_render_failure('HTTP_FETCH_EMPTY', 'Internal fetch returned empty body or non-200 status (HTTP ' . intval($response_code) . ')', [], 'warning');
1050 + }
1048 1051 return false;
1049 1052 }
1050 1053
1051 1054 # Skip DOM processing on oversized documents to avoid fatal OOM.
@@ -1209,9 +1212,9 @@
1209 1212
1210 1213 $result_html = preg_replace_callback(
1211 1214 '/(<' . $heading_type . '(?:\s[^>]*)?>)(.*?)(<\/' . $heading_type . '>)/is',
1212 1215 function ($m) use ($current_value, $recommended_value) {
1213 - $inner_text = trim(preg_replace('/\s+/', ' ', html_entity_decode(strip_tags($m[2]), ENT_QUOTES, 'UTF-8')));
1216 + $inner_text = trim(preg_replace('/\s+/', ' ', html_entity_decode(wp_strip_all_tags($m[2]), ENT_QUOTES, 'UTF-8')));
1214 1217 if ($inner_text !== $current_value) {
1215 1218 return $m[0];
1216 1219 }
1217 1220 # Keep the author's inline formatting; skip when it can't
@@ -1371,11 +1374,11 @@
1371 1374 * @return bool True when no meaningful redirect changed the route.
1372 1375 */
1373 1376 private function fetch_url_matches_route($effective_url, $route, $fetch_url)
1374 1377 {
1375 - $effective = parse_url($effective_url);
1376 - $requested = parse_url($route);
1377 - $transport = parse_url($fetch_url);
1378 + $effective = wp_parse_url($effective_url);
1379 + $requested = wp_parse_url($route);
1380 + $transport = wp_parse_url($fetch_url);
1378 1381 if (!is_array($effective) || !is_array($requested)) {
1379 1382 return true;
1380 1383 }
1381 1384
@@ -2097,10 +2100,10 @@
2097 2100 }
2098 2101
2099 2102 # If it's a protocol-relative URL (//example.com), check if it matches our domain
2100 2103 if (strpos($url, '//') === 0) {
2101 - $parsed_home = parse_url($home_url);
2102 - $parsed_link = parse_url($url);
2104 + $parsed_home = wp_parse_url($home_url);
2105 + $parsed_link = wp_parse_url($url);
2103 2106
2104 2107 if (isset($parsed_home['host']) && isset($parsed_link['host'])) {
2105 2108 if (strtolower($parsed_home['host']) === strtolower($parsed_link['host'])) {
2106 2109 return false;
@@ -3442,14 +3445,14 @@
3442 3445 return true;
3443 3446 }
3444 3447
3445 3448 # Check if amp=1 query parameter is present
3446 - if (isset($_GET['amp']) && $_GET['amp'] == '1') {
3449 + if (isset($_GET['amp']) && $_GET['amp'] == '1') { // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- read-only AMP detection
3447 3450 return true;
3448 3451 }
3449 3452
3450 3453 # Check for other common AMP query parameters
3451 - if (isset($_GET['amp']) && !empty($_GET['amp'])) {
3454 + if (isset($_GET['amp']) && !empty($_GET['amp'])) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- read-only AMP detection
3452 3455 return true;
3453 3456 }
3454 3457
3455 3458 return false;
@@ -3974,9 +3977,9 @@
3974 3977
3975 3978 $result_html = preg_replace_callback(
3976 3979 '/(<' . $heading_type . '(?:\s[^>]*)?>)(.*?)(<\/' . $heading_type . '>)/is',
3977 3980 function ($m) use ($current_value, $recommended_value) {
3978 - $inner_text = trim(preg_replace('/\s+/', ' ', html_entity_decode(strip_tags($m[2]), ENT_QUOTES, 'UTF-8')));
3981 + $inner_text = trim(preg_replace('/\s+/', ' ', html_entity_decode(wp_strip_all_tags($m[2]), ENT_QUOTES, 'UTF-8')));
3979 3982 if ($inner_text !== $current_value) {
3980 3983 return $m[0];
3981 3984 }
3982 3985 # Keep the author's inline formatting; skip when it can't
@@ -4116,12 +4119,26 @@
4116 4119
4117 4120 return $result_html;
4118 4121
4119 4122 } catch (Exception $e) {
4120 - error_log('MetaSync ' . Metasync::get_whitelabel_otto_name() . ': Exception in process_html_directly - ' . $e->getMessage());
4123 + if (function_exists('metasync_otto_report_render_failure')) {
4124 + metasync_otto_report_render_failure(
4125 + 'MODIFICATION_EXCEPTION',
4126 + 'OTTO rewrite threw: ' . $e->getMessage(),
4127 + ['exception' => get_class($e)],
4128 + 'error'
4129 + );
4130 + }
4121 4131 return false;
4122 4132 } catch (Error $e) {
4123 - error_log('MetaSync ' . Metasync::get_whitelabel_otto_name() . ': Error in process_html_directly - ' . $e->getMessage());
4133 + if (function_exists('metasync_otto_report_render_failure')) {
4134 + metasync_otto_report_render_failure(
4135 + 'MODIFICATION_ERROR',
4136 + 'OTTO rewrite errored: ' . $e->getMessage(),
4137 + ['error' => get_class($e)],
4138 + 'error'
4139 + );
4140 + }
4124 4141 return false;
4125 4142 }
4126 4143 }
4127 4144