WordPress SEO Plugin – Rank Math - Version 1.0.54.1

Version Description

[Dec 09, 2020] = * Improved: The overall data fetching process of the Analytics module from Google * Improved: Importing the top 1,000 keywords in the Analytics from Google * Fixed: The Classic Editor was not working properly on the installations where the PHP 7.2 or lower was used. Please update to at least PHP 7.4 for better security and speed * Fixed: Multiple reconnect notices were showing on some installations

Download this release

Release Info

Developer rankmath
Plugin Icon 128x128 WordPress SEO Plugin – Rank Math
Version 1.0.54.1
Comparing to
See all releases

Code changes from version 1.0.54 to 1.0.54.1

includes/admin/class-admin.php CHANGED
@@ -127,6 +127,10 @@ class Admin implements Runner {
127
  $current_request
128
  );
129
 
 
 
 
 
130
  wp_safe_redirect( $current_request );
131
  exit();
132
 
127
  $current_request
128
  );
129
 
130
+ // Remove possible admin notice if we have new access token.
131
+ delete_option( 'rankmath_google_api_failed_attempts_data' );
132
+ delete_option( 'rankmath_google_api_reconnect' );
133
+
134
  wp_safe_redirect( $current_request );
135
  exit();
136
 
includes/admin/class-serp-preview.php CHANGED
@@ -457,7 +457,7 @@ class Serp_Preview {
457
 
458
  return \array_merge(
459
  $offers,
460
- $this->get_ratings_data( $schema ),
461
  );
462
  }
463
 
@@ -481,7 +481,7 @@ class Serp_Preview {
481
  'event_date' => ! empty( $schema['startDate'] ) ? date_i18n( 'j M Y', $schema['startDate'] ) : '',
482
  'event_place' => $address,
483
  ],
484
- $this->get_ratings_data( $schema ),
485
  );
486
  }
487
 
@@ -497,7 +497,7 @@ class Serp_Preview {
497
  'time' => ! empty( $schema['totalTime'] ) ? $schema['totalTime'] : '',
498
  'calories' => ! empty( $schema['nutrition'] ) && ! empty( $schema['nutrition']['calories'] ) ? $schema['nutrition']['calories'] : '',
499
  ],
500
- $this->get_ratings_data( $schema ),
501
  );
502
  }
503
 
457
 
458
  return \array_merge(
459
  $offers,
460
+ $this->get_ratings_data( $schema )
461
  );
462
  }
463
 
481
  'event_date' => ! empty( $schema['startDate'] ) ? date_i18n( 'j M Y', $schema['startDate'] ) : '',
482
  'event_place' => $address,
483
  ],
484
+ $this->get_ratings_data( $schema )
485
  );
486
  }
487
 
497
  'time' => ! empty( $schema['totalTime'] ) ? $schema['totalTime'] : '',
498
  'calories' => ! empty( $schema['nutrition'] ) && ! empty( $schema['nutrition']['calories'] ) ? $schema['nutrition']['calories'] : '',
499
  ],
500
+ $this->get_ratings_data( $schema )
501
  );
502
  }
503
 
includes/modules/analytics/class-analytics.php CHANGED
@@ -85,6 +85,7 @@ class Analytics extends Base {
85
 
86
  $tokens = Authentication::tokens();
87
  if ( ! empty( $tokens['refresh_token'] ) ) {
 
88
  return;
89
  }
90
 
@@ -98,6 +99,7 @@ class Analytics extends Base {
98
  [
99
  'type' => 'error',
100
  'classes' => 'rank-math-error rank-math-notice',
 
101
  ]
102
  );
103
  }
85
 
86
  $tokens = Authentication::tokens();
87
  if ( ! empty( $tokens['refresh_token'] ) ) {
88
+ Helper::remove_notification( 'reconnect' );
89
  return;
90
  }
91
 
99
  [
100
  'type' => 'error',
101
  'classes' => 'rank-math-error rank-math-notice',
102
+ 'id' => 'reconnect',
103
  ]
104
  );
105
  }
includes/modules/analytics/class-data-fetcher.php CHANGED
@@ -276,7 +276,7 @@ class Data_Fetcher {
276
  $count = 1;
277
  $start = Helper::get_midnight( time() + DAY_IN_SECONDS );
278
 
279
- for ( $current = 1; $current <= 15; $current++ ) {
280
  $date = date_i18n( 'Y-m-d', $start - ( DAY_IN_SECONDS * $current ) );
281
  if ( ! DB::date_exists( $date ) ) {
282
  $count++;
276
  $count = 1;
277
  $start = Helper::get_midnight( time() + DAY_IN_SECONDS );
278
 
279
+ for ( $current = 1; $current <= 90; $current++ ) {
280
  $date = date_i18n( 'Y-m-d', $start - ( DAY_IN_SECONDS * $current ) );
281
  if ( ! DB::date_exists( $date ) ) {
282
  $count++;
includes/modules/analytics/class-stats.php CHANGED
@@ -570,7 +570,13 @@ class Stats extends Keywords {
570
  * @return string
571
  */
572
  public static function get_relative_url( $url ) {
573
- $home_url = [ 'https://creativefan.com', home_url() ];
 
 
 
 
 
 
574
 
575
  return \str_replace( $home_url, '', $url );
576
  }
570
  * @return string
571
  */
572
  public static function get_relative_url( $url ) {
573
+ $home_url = home_url();
574
+
575
+ $domain = strtolower( wp_parse_url( home_url(), PHP_URL_HOST ) );
576
+ $domain = str_replace( [ 'www.', '.' ], [ '', '\.' ], $domain );
577
+ $regex = "/http[s]?:\/\/(www\.)?$domain/mU";
578
+ $url = strtolower( trim( $url ) );
579
+ $url = preg_replace( $regex, '', $url );
580
 
581
  return \str_replace( $home_url, '', $url );
582
  }
includes/modules/analytics/google/class-api.php CHANGED
@@ -104,6 +104,8 @@ class Api extends Console {
104
  Authentication::tokens( false );
105
  delete_option( 'rank_math_google_analytic_profile' );
106
  delete_option( 'rank_math_google_analytic_options' );
 
 
107
 
108
  return $this->is_success();
109
  }
@@ -114,6 +116,6 @@ class Api extends Console {
114
  * @return int
115
  */
116
  public function get_row_limit() {
117
- return apply_filters( 'rank_math/analytics/row_limit', 5000 );
118
  }
119
  }
104
  Authentication::tokens( false );
105
  delete_option( 'rank_math_google_analytic_profile' );
106
  delete_option( 'rank_math_google_analytic_options' );
107
+ delete_option( 'rankmath_google_api_failed_attempts_data' );
108
+ delete_option( 'rankmath_google_api_reconnect' );
109
 
110
  return $this->is_success();
111
  }
116
  * @return int
117
  */
118
  public function get_row_limit() {
119
+ return apply_filters( 'rank_math/analytics/row_limit', 1000 );
120
  }
121
  }
includes/modules/analytics/google/class-console.php CHANGED
@@ -10,7 +10,7 @@
10
 
11
  namespace RankMath\Google;
12
 
13
- use RankMath\Helpers\Security;
14
 
15
  defined( 'ABSPATH' ) || exit;
16
 
@@ -191,6 +191,8 @@ class Console extends Analytics {
191
  $args
192
  );
193
 
 
 
194
  if ( ! $this->is_success() || ! isset( $response['rows'] ) ) {
195
  return false;
196
  }
@@ -198,6 +200,47 @@ class Console extends Analytics {
198
  return $response['rows'];
199
  }
200
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
201
  /**
202
  * Is site verified.
203
  *
10
 
11
  namespace RankMath\Google;
12
 
13
+ use RankMath\Analytics\Data_Fetcher;
14
 
15
  defined( 'ABSPATH' ) || exit;
16
 
191
  $args
192
  );
193
 
194
+ $this->log_failed_request( $response, $start_date, func_get_args() );
195
+
196
  if ( ! $this->is_success() || ! isset( $response['rows'] ) ) {
197
  return false;
198
  }
200
  return $response['rows'];
201
  }
202
 
203
+ /**
204
+ * Log every failed API call.
205
+ * And kill all next scheduled event if failed count is more then three.
206
+ */
207
+ private function log_failed_request( $response, $start_date, $args ) {
208
+ if ( $this->is_success() ) {
209
+ return;
210
+ }
211
+
212
+ // Number of allowed attempt.
213
+ $allow_fail_attempt = 3;
214
+ $option_key = 'rankmath_google_api_failed_attempts_data';
215
+ $reconnect_google_option_key = 'rankmath_google_api_reconnect';
216
+
217
+ if ( ! empty( $response['error'] ) && is_array( $response['error'] ) ) {
218
+
219
+ $failed_attempts = get_option( $option_key, [] );
220
+ $failed_attempts = ( ! empty( $failed_attempts ) && is_array( $failed_attempts ) ) ? $failed_attempts : [];
221
+ $failed_attempts[] = [
222
+ 'args' => $args,
223
+ 'error' => $response['error'],
224
+ ];
225
+
226
+ update_option( $option_key, $failed_attempts );
227
+
228
+ if ( $allow_fail_attempt < count( $failed_attempts ) ) {
229
+ update_option( $reconnect_google_option_key, 'search_analytics_query' );
230
+ Data_Fetcher::get()->kill_process();
231
+ } else {
232
+ as_schedule_single_action(
233
+ time() + ( 60 ),
234
+ 'rank_math/analytics/get_analytics',
235
+ [ $start_date ]
236
+ );
237
+ }
238
+ } else {
239
+ delete_option( $option_key );
240
+ delete_option( $reconnect_google_option_key );
241
+ }
242
+ }
243
+
244
  /**
245
  * Is site verified.
246
  *
rank-math.php CHANGED
@@ -9,7 +9,7 @@
9
  *
10
  * @wordpress-plugin
11
  * Plugin Name: Rank Math SEO
12
- * Version: 1.0.54
13
  * Plugin URI: https://s.rankmath.com/home
14
  * Description: Rank Math is a revolutionary SEO product that combines the features of many SEO tools and lets you multiply your traffic in the easiest way possible.
15
  * Author: Rank Math
@@ -34,7 +34,7 @@ final class RankMath {
34
  *
35
  * @var string
36
  */
37
- public $version = '1.0.54';
38
 
39
  /**
40
  * Rank Math database version.
9
  *
10
  * @wordpress-plugin
11
  * Plugin Name: Rank Math SEO
12
+ * Version: 1.0.54.1
13
  * Plugin URI: https://s.rankmath.com/home
14
  * Description: Rank Math is a revolutionary SEO product that combines the features of many SEO tools and lets you multiply your traffic in the easiest way possible.
15
  * Author: Rank Math
34
  *
35
  * @var string
36
  */
37
+ public $version = '1.0.54.1';
38
 
39
  /**
40
  * Rank Math database version.
readme.txt CHANGED
@@ -2,10 +2,10 @@
2
  Contributors: rankmath
3
  Plugin link: https://rankmath.com/?utm_source=LP&utm_campaign=WP
4
  Tags: seo, sitemap, google search console, schema, redirection
5
- Tested up to: 5.5.3
6
  Requires at least: 5.2
7
  Requires PHP: 7.0
8
- Stable tag: 1.0.54
9
  License: GPL-2.0+
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.txt
11
 
@@ -475,6 +475,12 @@ Please drop us an email at support@rankmath.com and we would be more than happy
475
 
476
  == Changelog ==
477
 
 
 
 
 
 
 
478
  = 1.0.54 [Dec 08, 2020] =
479
  * Added: Now [Analytics](https://rankmath.com/kb/analytics/) shows Keywords even with the 0 clicks, this will help to show accurate CTR and Total Keyword count
480
  * Added: Show reconnect notice if the Google refresh token is missing
2
  Contributors: rankmath
3
  Plugin link: https://rankmath.com/?utm_source=LP&utm_campaign=WP
4
  Tags: seo, sitemap, google search console, schema, redirection
5
+ Tested up to: 5.6
6
  Requires at least: 5.2
7
  Requires PHP: 7.0
8
+ Stable tag: 1.0.54.1
9
  License: GPL-2.0+
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.txt
11
 
475
 
476
  == Changelog ==
477
 
478
+ = 1.0.54.1 [Dec 09, 2020] =
479
+ * Improved: The overall data fetching process of the Analytics module from Google
480
+ * Improved: Importing the top 1,000 keywords in the Analytics from Google
481
+ * Fixed: The Classic Editor was not working properly on the installations where the PHP 7.2 or lower was used. Please update to at least PHP 7.4 for better security and speed
482
+ * Fixed: Multiple reconnect notices were showing on some installations
483
+
484
  = 1.0.54 [Dec 08, 2020] =
485
  * Added: Now [Analytics](https://rankmath.com/kb/analytics/) shows Keywords even with the 0 clicks, this will help to show accurate CTR and Total Keyword count
486
  * Added: Show reconnect notice if the Google refresh token is missing