WordPress SEO Plugin – Rank Math - Version 1.0.2

Version Description

[Nov 24, 2018] = * Added relative URL support for importing from the Redirection plugin * Fixed Importing from Yoast's Premium version * Showing Not Set words when we do not find any focus keyword set for an article * Improved some files with a better code

Download this release

Release Info

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

Code changes from version 1.0.1 to 1.0.2

includes/3rd-party/wp-rocket.php ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The wp-rocket compatibility functionality.
4
+ *
5
+ * @since 0.9.0
6
+ * @package RankMath
7
+ * @subpackage RankMath\Compatibility
8
+ * @author MyThemeShop <admin@mythemeshop.com>
9
+ */
10
+
11
+ defined( 'ABSPATH' ) || exit;
12
+
13
+ /**
14
+ * Add sitemap option to WP Rocket settings
15
+ *
16
+ * @since 1.0.1
17
+ *
18
+ * @param array $options WP Rocket settings array.
19
+ * @return array Updated WP Rocket settings array
20
+ */
21
+ function rank_math_rocket_sitemap_preload_option( $options ) {
22
+ $options['rank_math_xml_sitemap'] = [
23
+ 'type' => 'checkbox',
24
+ 'container_class' => [
25
+ 'wpr-field--children',
26
+ ],
27
+ 'label' => __( 'Rank Math XML sitemap', 'rank-math' ),
28
+ // translators: %s = Name of the plugin.
29
+ 'description' => sprintf( __( 'We automatically detected the sitemap generated by the %s plugin. You can check the option to preload it.', 'rank-math' ), 'Rank Math' ),
30
+ 'parent' => 'sitemap_preload',
31
+ 'section' => 'preload_section',
32
+ 'page' => 'preload',
33
+ 'default' => 0,
34
+ 'sanitize_callback' => 'sanitize_checkbox',
35
+ ];
36
+
37
+ return $options;
38
+ }
39
+ add_filter( 'rocket_sitemap_preload_options', 'rank_math_rocket_sitemap_preload_option' );
40
+
41
+ /**
42
+ * Add sitemap option to WP Rocket default options
43
+ *
44
+ * @since 1.0.1
45
+ *
46
+ * @param array $options WP Rocket options array.
47
+ * @return array Updated WP Rocket options array
48
+ */
49
+ function rank_math_rocket_add_sitemap_option( $options ) {
50
+ $options['rank_math_xml_sitemap'] = 0;
51
+
52
+ return $options;
53
+ }
54
+ add_filter( 'rocket_first_install_options', 'rank_math_rocket_add_sitemap_option' );
55
+
56
+ /**
57
+ * Sanitize SEO sitemap option value
58
+ *
59
+ * @since 1.0.1
60
+ *
61
+ * @param array $inputs WP Rocket inputs array.
62
+ * @return array Sanitized WP Rocket inputs array
63
+ */
64
+ function rank_math_rocket_sitemap_option_sanitize( $inputs ) {
65
+ $inputs['rank_math_xml_sitemap'] = ! empty( $inputs['rank_math_xml_sitemap'] ) ? 1 : 0;
66
+
67
+ return $inputs;
68
+ }
69
+ add_filter( 'rocket_inputs_sanitize', 'rank_math_rocket_sitemap_option_sanitize' );
70
+
71
+ /**
72
+ * Add SEO sitemap URL to the sitemaps to preload
73
+ *
74
+ * @since 1.0.1
75
+ *
76
+ * @param array $sitemaps Sitemaps to preload.
77
+ * @return array Updated Sitemaps to preload
78
+ */
79
+ function rank_math_rocket_sitemap( $sitemaps ) {
80
+ if ( get_rocket_option( 'rank_math_xml_sitemap', false ) ) {
81
+ $sitemaps[] = \RankMath\Modules\Sitemap\Router::get_base_url( 'sitemap_index.xml' );
82
+ }
83
+
84
+ return $sitemaps;
85
+ }
86
+ add_filter( 'rocket_sitemap_preload_list', 'rank_math_rocket_sitemap' );
includes/admin/class-post-columns.php CHANGED
@@ -207,7 +207,7 @@ class Post_Columns {
207
 
208
  <span class="rank-math-column-display">
209
  <strong title="Focus Keyword"><?php _e( 'Keyword', 'rank-math' ); ?>:</strong>
210
- <span><?php echo $keyword; ?></span>
211
  </span>
212
 
213
  <span class="rank-math-column-value" data-field="focus_keyword" contenteditable="true" tabindex="11">
207
 
208
  <span class="rank-math-column-display">
209
  <strong title="Focus Keyword"><?php _e( 'Keyword', 'rank-math' ); ?>:</strong>
210
+ <span><?php echo $keyword ? $keyword : esc_html__( 'Not Set', 'rank-math' ); ?></span>
211
  </span>
212
 
213
  <span class="rank-math-column-value" data-field="focus_keyword" contenteditable="true" tabindex="11">
includes/admin/importers/class-yoast.php CHANGED
@@ -13,7 +13,7 @@ namespace RankMath\Admin\Importers;
13
  use RankMath\Helper;
14
  use TheLeague\Database\Database;
15
  use RankMath\Modules\Sitemap\Sitemap;
16
- use RankMath\Modules\Redirections\DB;
17
 
18
  defined( 'ABSPATH' ) || exit;
19
 
@@ -589,35 +589,26 @@ class Yoast extends Plugin_Importer {
589
  return false;
590
  }
591
 
592
- Helper::update_modules( array( 'redirections' => 'on' ) );
593
  $count = 0;
 
 
594
  foreach ( $redirections as $redirection ) {
595
- $data = array(
 
 
 
 
 
 
 
 
 
 
596
  'url_to' => isset( $redirection['url'] ) ? $redirection['url'] : '',
597
  'header_code' => isset( $redirection['type'] ) ? $redirection['type'] : '301',
598
- );
599
-
600
- if ( isset( $redirection['origin'] ) ) {
601
- $data['sources'] = array();
602
- $source = array(
603
- 'pattern' => $redirection['origin'],
604
- 'comparison' => isset( $redirection['format'] ) && 'regex' === $redirection['format'] ? 'regex' : 'exact',
605
- );
606
-
607
- // We store regex patterns with delimiters.
608
- if ( 'regex' === $source['comparison'] ) {
609
- $source['pattern'] = '[' . $source['pattern'] . ']';
610
- }
611
-
612
- $results = Database::table( 'rank_math_redirection_sources' )->where( 'pattern', $source['pattern'] )->get( ARRAY_A );
613
- if ( ! empty( $results ) ) {
614
- continue;
615
- }
616
-
617
- $data['sources'][] = $source;
618
- }
619
 
620
- if ( DB::add( $data ) ) {
621
  $count++;
622
  }
623
  }
13
  use RankMath\Helper;
14
  use TheLeague\Database\Database;
15
  use RankMath\Modules\Sitemap\Sitemap;
16
+ use RankMath\Modules\Redirections\Form as Form;
17
 
18
  defined( 'ABSPATH' ) || exit;
19
 
589
  return false;
590
  }
591
 
 
592
  $count = 0;
593
+ $form = new Form;
594
+ Helper::update_modules( array( 'redirections' => 'on' ) );
595
  foreach ( $redirections as $redirection ) {
596
+ if ( ! isset( $redirection['origin'] ) || empty( $redirection['origin'] ) ) {
597
+ continue;
598
+ }
599
+
600
+ $result = $form->save_redirection(array(
601
+ 'sources' => array(
602
+ array(
603
+ 'pattern' => $redirection['origin'],
604
+ 'comparison' => isset( $redirection['format'] ) && 'regex' === $redirection['format'] ? 'regex' : 'exact',
605
+ ),
606
+ ),
607
  'url_to' => isset( $redirection['url'] ) ? $redirection['url'] : '',
608
  'header_code' => isset( $redirection['type'] ) ? $redirection['type'] : '301',
609
+ ));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
610
 
611
+ if ( true === $result ) {
612
  $count++;
613
  }
614
  }
includes/class-compatibility.php CHANGED
@@ -35,6 +35,16 @@ class Compatibility {
35
 
36
  $this->filter( 'rank_math/pre_simple_page_id', 'subscribe_to_comments_reloaded' );
37
  $this->filter( 'genesis_detect_seo_plugins', 'disable_genesis_seo' );
 
 
 
 
 
 
 
 
 
 
38
  }
39
 
40
  /**
35
 
36
  $this->filter( 'rank_math/pre_simple_page_id', 'subscribe_to_comments_reloaded' );
37
  $this->filter( 'genesis_detect_seo_plugins', 'disable_genesis_seo' );
38
+ $this->action( 'plugins_loaded', 'after_modules_loaded' );
39
+ }
40
+
41
+ /**
42
+ * Run functions after modules are loaded
43
+ */
44
+ public function after_modules_loaded() {
45
+ if ( Helper::is_module_active( 'sitemap' ) ) {
46
+ include_once rank_math()->includes_dir() . '3rd-party/wp-rocket.php';
47
+ }
48
  }
49
 
50
  /**
includes/class-rankmath.php CHANGED
@@ -29,7 +29,7 @@ final class RankMath {
29
  *
30
  * @var string
31
  */
32
- public $version = '1.0.1';
33
 
34
  /**
35
  * Rank Math database version.
29
  *
30
  * @var string
31
  */
32
+ public $version = '1.0.2';
33
 
34
  /**
35
  * Rank Math database version.
includes/modules/redirections/class-db.php CHANGED
@@ -214,6 +214,23 @@ class DB {
214
  return self::table()->set( $args )->where( 'id', $id )->update();
215
  }
216
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
217
  /**
218
  * Update counter for redirection.
219
  *
214
  return self::table()->set( $args )->where( 'id', $id )->update();
215
  }
216
 
217
+ /**
218
+ * Add or Update record
219
+ *
220
+ * @param array $redirection Single redirection item.
221
+ * @return int
222
+ */
223
+ public static function update_iff( $redirection ) {
224
+ // Update record.
225
+ if ( isset( $redirection['id'] ) ) {
226
+ self::update( $redirection );
227
+ return $redirection['id'];
228
+ }
229
+
230
+ // Add record.
231
+ return self::add( $redirection );
232
+ }
233
+
234
  /**
235
  * Update counter for redirection.
236
  *
includes/modules/redirections/class-form.php CHANGED
@@ -69,7 +69,7 @@ class Form {
69
  'save_fields' => false,
70
  ) );
71
 
72
- $source_group = $cmb->add_field( array(
73
  'id' => 'sources',
74
  'type' => 'group',
75
  'name' => esc_html__( 'Source URLs', 'rank-math' ),
@@ -129,34 +129,17 @@ class Form {
129
  */
130
  public function set_options( $opts ) {
131
  // If editing previous record.
132
- $redirection_id = $this->is_editing();
133
- if ( $redirection_id ) {
134
  return DB::get_redirection_by_id( $redirection_id );
135
  }
136
 
137
- $url = Helper::param_get( 'url' );
138
- if ( $url ) {
139
  return array( 'sources' => array( array( 'pattern' => $url ) ) );
140
  }
141
 
142
  if ( ! empty( $_REQUEST['log'] ) && is_array( $_REQUEST['log'] ) ) {
143
- $logs = array_map( 'absint', $_REQUEST['log'] );
144
- $logs = Monitor_DB::get_logs( array(
145
- 'ids' => $logs,
146
- 'orderby' => '',
147
- ) );
148
-
149
- $sources = array();
150
- foreach ( $logs['logs'] as $log ) {
151
- if ( empty( $log['uri'] ) ) {
152
- continue;
153
- }
154
- $sources[] = array(
155
- 'pattern' => $log['uri'],
156
- );
157
- }
158
  return array(
159
- 'sources' => $sources,
160
  'url_to' => home_url( '/' ),
161
  );
162
  }
@@ -164,6 +147,31 @@ class Form {
164
  return $opts;
165
  }
166
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
167
  /**
168
  * Save new record form submit handler.
169
  */
@@ -222,14 +230,7 @@ class Form {
222
  }
223
 
224
  $redirection['url_to'] = $this->sanitize_destination( $redirection['url_to'] );
225
-
226
- $redirection_id = 0;
227
- if ( isset( $redirection['id'] ) ) {
228
- DB::update( $redirection );
229
- $redirection_id = $redirection['id'];
230
- } else {
231
- $redirection_id = DB::add( $redirection );
232
- }
233
 
234
  if ( $nocache ) {
235
  return $redirection_id;
@@ -375,13 +376,13 @@ class Form {
375
  private function sanitize_destination( $url ) {
376
  $processed = trim( $url );
377
 
378
- // If beginning looks like a domain but without protocol then let's add http://.
379
  if (
380
  ! Helper::str_start_with( 'http://', $processed ) &&
381
  ! Helper::str_start_with( 'https://', $processed ) &&
382
  ! Helper::str_start_with( '//', $processed )
383
  ) {
384
- $processed = 'http://' . $processed;
385
  }
386
 
387
  $processed = \urldecode( trim( $processed, '/' ) );
69
  'save_fields' => false,
70
  ) );
71
 
72
+ $cmb->add_field( array(
73
  'id' => 'sources',
74
  'type' => 'group',
75
  'name' => esc_html__( 'Source URLs', 'rank-math' ),
129
  */
130
  public function set_options( $opts ) {
131
  // If editing previous record.
132
+ if ( $redirection_id = $this->is_editing() ) { // @codingStandardsIgnoreLine
 
133
  return DB::get_redirection_by_id( $redirection_id );
134
  }
135
 
136
+ if ( $url = Helper::param_get( 'url' ) ) { // @codingStandardsIgnoreLine
 
137
  return array( 'sources' => array( array( 'pattern' => $url ) ) );
138
  }
139
 
140
  if ( ! empty( $_REQUEST['log'] ) && is_array( $_REQUEST['log'] ) ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
141
  return array(
142
+ 'sources' => $this->get_sources_for_log(),
143
  'url_to' => home_url( '/' ),
144
  );
145
  }
147
  return $opts;
148
  }
149
 
150
+ /**
151
+ * Get sources for 404 log items
152
+ *
153
+ * @return array
154
+ */
155
+ private function get_sources_for_log() {
156
+ $logs = array_map( 'absint', $_REQUEST['log'] );
157
+ $logs = Monitor_DB::get_logs( array(
158
+ 'ids' => $logs,
159
+ 'orderby' => '',
160
+ ) );
161
+
162
+ $sources = array();
163
+ foreach ( $logs['logs'] as $log ) {
164
+ if ( empty( $log['uri'] ) ) {
165
+ continue;
166
+ }
167
+ $sources[] = array(
168
+ 'pattern' => $log['uri'],
169
+ );
170
+ }
171
+
172
+ return $sources;
173
+ }
174
+
175
  /**
176
  * Save new record form submit handler.
177
  */
230
  }
231
 
232
  $redirection['url_to'] = $this->sanitize_destination( $redirection['url_to'] );
233
+ $redirection_id = DB::update_iff( $redirection );
 
 
 
 
 
 
 
234
 
235
  if ( $nocache ) {
236
  return $redirection_id;
376
  private function sanitize_destination( $url ) {
377
  $processed = trim( $url );
378
 
379
+ // If beginning looks like a domain but without protocol then let's add home_url().
380
  if (
381
  ! Helper::str_start_with( 'http://', $processed ) &&
382
  ! Helper::str_start_with( 'https://', $processed ) &&
383
  ! Helper::str_start_with( '//', $processed )
384
  ) {
385
+ $processed = home_url( $processed );
386
  }
387
 
388
  $processed = \urldecode( trim( $processed, '/' ) );
includes/modules/redirections/class-metabox.php CHANGED
@@ -41,15 +41,11 @@ class Metabox {
41
  $url = parse_url( get_permalink( $cmb->object_id ), PHP_URL_PATH );
42
  $url = trim( $url, '/' );
43
 
44
- if ( $redirection ) {
45
- $redirection = DB::get_redirection_by_id( $redirection->redirection_id );
46
- } else {
47
- $redirection = array(
48
- 'id' => '',
49
- 'url_to' => '',
50
- 'header_code' => Helper::get_settings( 'general.redirections_header_code' ),
51
- );
52
- }
53
 
54
  $message = ! empty( $redirection['id'] ) ? esc_html__( 'Edit redirection for the URL of this post.', 'rank-math' ) :
55
  esc_html__( 'Create new redirection for the URL of this post.', 'rank-math' );
@@ -121,12 +117,8 @@ class Metabox {
121
  'header_code' => $cmb->data_to_save['redirection_header_code'],
122
  );
123
 
124
- $redirection_id = 0;
125
- if ( ! empty( $values['id'] ) ) {
126
- DB::update( $values );
127
- $redirection_id = $values['id'];
128
- } else {
129
- $redirection_id = DB::add( $values );
130
  rank_math()->add_deferred_error( esc_html__( 'New redirection created.', 'rank-math' ), 'success' );
131
  }
132
 
41
  $url = parse_url( get_permalink( $cmb->object_id ), PHP_URL_PATH );
42
  $url = trim( $url, '/' );
43
 
44
+ $redirection = $redirection ? DB::get_redirection_by_id( $redirection->redirection_id ) : array(
45
+ 'id' => '',
46
+ 'url_to' => '',
47
+ 'header_code' => Helper::get_settings( 'general.redirections_header_code' ),
48
+ );
 
 
 
 
49
 
50
  $message = ! empty( $redirection['id'] ) ? esc_html__( 'Edit redirection for the URL of this post.', 'rank-math' ) :
51
  esc_html__( 'Create new redirection for the URL of this post.', 'rank-math' );
117
  'header_code' => $cmb->data_to_save['redirection_header_code'],
118
  );
119
 
120
+ $redirection_id = DB::update_iff( $values );
121
+ if ( ! isset( $values['id'] ) ) {
 
 
 
 
122
  rank_math()->add_deferred_error( esc_html__( 'New redirection created.', 'rank-math' ), 'success' );
123
  }
124
 
includes/modules/redirections/class-redirections.php CHANGED
@@ -47,15 +47,7 @@ class Redirections {
47
  * Do redirection on frontend.
48
  */
49
  public function do_redirection() {
50
- if ( is_customize_preview() || wp_doing_ajax() || ! isset( $_SERVER['REQUEST_URI'] ) || empty( $_SERVER['REQUEST_URI'] ) ) {
51
- return;
52
- }
53
-
54
- if ( isset( $_SERVER['SCRIPT_URI'] ) && ! empty( $_SERVER['SCRIPT_URI'] ) && admin_url( 'admin-ajax.php' ) === $_SERVER['SCRIPT_URI'] ) {
55
- return;
56
- }
57
-
58
- if ( isset( $_SERVER['HTTP_X_REQUESTED_WITH'] ) && ! empty( $_SERVER['HTTP_X_REQUESTED_WITH'] ) && strtolower( $_SERVER['HTTP_X_REQUESTED_WITH'] ) == 'xmlhttprequest' ) {
59
  return;
60
  }
61
 
@@ -110,4 +102,21 @@ class Redirections {
110
 
111
  return $items;
112
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
113
  }
47
  * Do redirection on frontend.
48
  */
49
  public function do_redirection() {
50
+ if ( is_customize_preview() || wp_doing_ajax() || ! isset( $_SERVER['REQUEST_URI'] ) || empty( $_SERVER['REQUEST_URI'] ) || $this->is_script_uri_or_http_x() ) {
 
 
 
 
 
 
 
 
51
  return;
52
  }
53
 
102
 
103
  return $items;
104
  }
105
+
106
+ /**
107
+ * Is script uri or http-x request
108
+ *
109
+ * @return boolean
110
+ */
111
+ private function is_script_uri_or_http_x() {
112
+ if ( isset( $_SERVER['SCRIPT_URI'] ) && ! empty( $_SERVER['SCRIPT_URI'] ) && admin_url( 'admin-ajax.php' ) === $_SERVER['SCRIPT_URI'] ) {
113
+ return true;
114
+ }
115
+
116
+ if ( isset( $_SERVER['HTTP_X_REQUESTED_WITH'] ) && ! empty( $_SERVER['HTTP_X_REQUESTED_WITH'] ) && strtolower( $_SERVER['HTTP_X_REQUESTED_WITH'] ) == 'xmlhttprequest' ) {
117
+ return true;
118
+ }
119
+
120
+ return false;
121
+ }
122
  }
includes/modules/redirections/class-table.php CHANGED
@@ -82,17 +82,11 @@ class Table extends List_Table {
82
  }
83
 
84
  if ( 'last_accessed' === $column_name ) {
85
- if ( empty( $item['last_accessed'] ) || '0000-00-00 00:00:00' === $item['last_accessed'] ) {
86
- return '';
87
- }
88
- return mysql2date( 'F j, Y, G:i', $item['last_accessed'] );
89
- }
90
-
91
- if ( in_array( $column_name, array( 'hits', 'header_code', 'url_to' ) ) ) {
92
- return $item[ $column_name ];
93
  }
94
 
95
- return print_r( $item, true );
96
  }
97
 
98
  /**
82
  }
83
 
84
  if ( 'last_accessed' === $column_name ) {
85
+ $no_last_accessed = ( empty( $item['last_accessed'] ) || '0000-00-00 00:00:00' === $item['last_accessed'] );
86
+ return $no_last_accessed ? '' : mysql2date( 'F j, Y, G:i', $item['last_accessed'] );
 
 
 
 
 
 
87
  }
88
 
89
+ return in_array( $column_name, array( 'hits', 'header_code', 'url_to' ) ) ? $item[ $column_name ] : print_r( $item, true );
90
  }
91
 
92
  /**
includes/modules/redirections/class-watcher.php CHANGED
@@ -61,7 +61,7 @@ class Watcher {
61
  * @param integer $post_id Post ID.
62
  */
63
  public function pre_post_update( $post_id ) {
64
- $this->updated_posts[ $post_id ] = get_permalink( $post_id );
65
  }
66
 
67
  /**
@@ -293,7 +293,7 @@ class Watcher {
293
  *
294
  * @param int $user_id User ID.
295
  */
296
- public static function invalidate_author( $user_id ) {
297
  Cache::purge_by_object_id( $user_id, 'user' );
298
  }
299
  }
61
  * @param integer $post_id Post ID.
62
  */
63
  public function pre_post_update( $post_id ) {
64
+ $this->updated_posts[ $post_id ] = get_permalink( $post_id );
65
  }
66
 
67
  /**
293
  *
294
  * @param int $user_id User ID.
295
  */
296
+ public function invalidate_author( $user_id ) {
297
  Cache::purge_by_object_id( $user_id, 'user' );
298
  }
299
  }
includes/opengraph/class-image.php CHANGED
@@ -75,6 +75,16 @@ class Image {
75
  }
76
  }
77
 
 
 
 
 
 
 
 
 
 
 
78
  /**
79
  * Return the images array.
80
  *
@@ -93,16 +103,6 @@ class Image {
93
  return ! empty( $this->images );
94
  }
95
 
96
- /**
97
- * Outputs the images.
98
- */
99
- public function show() {
100
- foreach ( $this->get_images() as $image => $image_meta ) {
101
- $this->image_tag( $image );
102
- $this->image_meta( $image_meta );
103
- }
104
- }
105
-
106
  /**
107
  * Outputs an image tag based on whether it's https or not.
108
  *
@@ -343,6 +343,9 @@ class Image {
343
  * @param int $post_id Optional post ID to use.
344
  */
345
  private function set_image_post_meta( $post_id = 0 ) {
 
 
 
346
  $image_id = Helper::get_post_meta( "{$this->opengraph->prefix}_image_id", $post_id );
347
  $this->add_image_by_id( $image_id );
348
  }
@@ -353,7 +356,7 @@ class Image {
353
  * @param int $post_id The post ID.
354
  */
355
  private function set_featured_image( $post_id = null ) {
356
- if ( has_post_thumbnail( $post_id ) ) {
357
  $attachment_id = get_post_thumbnail_id( $post_id );
358
  $this->add_image_by_id( $attachment_id );
359
  }
75
  }
76
  }
77
 
78
+ /**
79
+ * Outputs the images.
80
+ */
81
+ public function show() {
82
+ foreach ( $this->get_images() as $image => $image_meta ) {
83
+ $this->image_tag( $image );
84
+ $this->image_meta( $image_meta );
85
+ }
86
+ }
87
+
88
  /**
89
  * Return the images array.
90
  *
103
  return ! empty( $this->images );
104
  }
105
 
 
 
 
 
 
 
 
 
 
 
106
  /**
107
  * Outputs an image tag based on whether it's https or not.
108
  *
343
  * @param int $post_id Optional post ID to use.
344
  */
345
  private function set_image_post_meta( $post_id = 0 ) {
346
+ if ( empty( $post_id ) ) {
347
+ return;
348
+ }
349
  $image_id = Helper::get_post_meta( "{$this->opengraph->prefix}_image_id", $post_id );
350
  $this->add_image_by_id( $image_id );
351
  }
356
  * @param int $post_id The post ID.
357
  */
358
  private function set_featured_image( $post_id = null ) {
359
+ if ( $post_id && has_post_thumbnail( $post_id ) ) {
360
  $attachment_id = get_post_thumbnail_id( $post_id );
361
  $this->add_image_by_id( $attachment_id );
362
  }
includes/template-tags.php CHANGED
@@ -24,3 +24,12 @@ function rank_math_get_breadcrumbs( $args = array() ) {
24
  function rank_math_the_breadcrumbs( $args = array() ) {
25
  echo rank_math_get_breadcrumbs( $args );
26
  }
 
 
 
 
 
 
 
 
 
24
  function rank_math_the_breadcrumbs( $args = array() ) {
25
  echo rank_math_get_breadcrumbs( $args );
26
  }
27
+
28
+ /**
29
+ * Get sitemap url.
30
+ *
31
+ * @return string
32
+ */
33
+ function rank_math_get_sitemap_url() {
34
+ return \RankMath\Modules\Sitemap\Router::get_base_url( 'sitemap_index.xml' );
35
+ }
languages/rank-math.pot CHANGED
@@ -15,6 +15,13 @@ msgstr ""
15
  "X-Poedit-SourceCharset: UTF-8\n"
16
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
17
 
 
 
 
 
 
 
 
18
  msgid "Insert/edit link"
19
  msgstr ""
20
 
@@ -279,9 +286,15 @@ msgstr ""
279
  msgid "Save"
280
  msgstr ""
281
 
 
 
 
282
  msgid "Keyword"
283
  msgstr ""
284
 
 
 
 
285
  msgid "Title"
286
  msgstr ""
287
 
15
  "X-Poedit-SourceCharset: UTF-8\n"
16
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
17
 
18
+ msgid "Rank Math XML sitemap"
19
+ msgstr ""
20
+
21
+ #. translators: %s = Name of the plugin.
22
+ msgid "We automatically detected the sitemap generated by the %s plugin. You can check the option to preload it."
23
+ msgstr ""
24
+
25
  msgid "Insert/edit link"
26
  msgstr ""
27
 
286
  msgid "Save"
287
  msgstr ""
288
 
289
+ msgid "Update your post"
290
+ msgstr ""
291
+
292
  msgid "Keyword"
293
  msgstr ""
294
 
295
+ msgid "Not Set"
296
+ msgstr ""
297
+
298
  msgid "Title"
299
  msgstr ""
300
 
rank-math.php CHANGED
@@ -9,7 +9,7 @@
9
  *
10
  * @wordpress-plugin
11
  * Plugin Name: Rank Math SEO
12
- * Version: 1.0.1
13
  * Plugin URI: https://link.mythemeshop.com/rankmathseo
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: MyThemeShop
@@ -103,7 +103,7 @@ if ( ! class_exists( 'Rank_Math_Bootstrap', false ) ) {
103
  \Rollbar\Rollbar::init( array(
104
  'access_token' => '020f63d75296413da4ea438e6eed0d04',
105
  'environment' => 'development',
106
- 'code_version' => '1.0.1',
107
  'check_ignore' => array( $this, 'filter_rollbar_items' ),
108
  ));
109
  }
9
  *
10
  * @wordpress-plugin
11
  * Plugin Name: Rank Math SEO
12
+ * Version: 1.0.2
13
  * Plugin URI: https://link.mythemeshop.com/rankmathseo
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: MyThemeShop
103
  \Rollbar\Rollbar::init( array(
104
  'access_token' => '020f63d75296413da4ea438e6eed0d04',
105
  'environment' => 'development',
106
+ 'code_version' => '1.0.2',
107
  'check_ignore' => array( $this, 'filter_rollbar_items' ),
108
  ));
109
  }
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: seo, sitemap, google search console, schema.org, redirection
5
  Tested up to: 4.9.8
6
  Requires at least: 4.6.0
7
  Requires PHP: 5.6
8
- Stable tag: 1.0.1
9
  License: GPL-2.0+
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.txt
11
 
@@ -431,6 +431,12 @@ We look forward to helping you.
431
 
432
  == Changelog ==
433
 
 
 
 
 
 
 
434
  = 1.0.1 [Nov 22, 2018] =
435
  * Fixed a minor JS Console error caused by using images as the first thing inside a paragraph
436
  * For Editor role that didn't have full access to Rank Math features, there was a weird fatal error that we have now fixed
5
  Tested up to: 4.9.8
6
  Requires at least: 4.6.0
7
  Requires PHP: 5.6
8
+ Stable tag: 1.0.2
9
  License: GPL-2.0+
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.txt
11
 
431
 
432
  == Changelog ==
433
 
434
+ = 1.0.2 [Nov 24, 2018] =
435
+ * Added relative URL support for importing from the Redirection plugin
436
+ * Fixed Importing from Yoast's Premium version
437
+ * Showing Not Set words when we do not find any focus keyword set for an article
438
+ * Improved some files with a better code
439
+
440
  = 1.0.1 [Nov 22, 2018] =
441
  * Fixed a minor JS Console error caused by using images as the first thing inside a paragraph
442
  * For Editor role that didn't have full access to Rank Math features, there was a weird fatal error that we have now fixed