Instant Indexing for Google - Version 1.1.10

Version Description

Download this release

Release Info

Developer rankmath
Plugin Icon 128x128 Instant Indexing for Google
Version 1.1.10
Comparing to
See all releases

Code changes from version 1.1.9 to 1.1.10

assets/js/console.js CHANGED
@@ -120,11 +120,9 @@ jQuery(document).ready(function($) {
120
  var originalValue = $( '#giapi_indexnow_api_key' ).val()
121
  $( '#giapi_indexnow_api_key' ).val( '...' )
122
  $.ajax( {
123
- url: rm_giapi.rest_url + '/resetKey',
124
- type: 'POST',
125
- beforeSend( xhr ) {
126
- xhr.setRequestHeader( 'X-WP-Nonce', rankMath.api.nonce );
127
- },
128
  success: function( response ) {
129
  $( '#giapi_indexnow_api_key' ).val( response.key );
130
  $( '#indexnow_api_key_location').text( response.location );
120
  var originalValue = $( '#giapi_indexnow_api_key' ).val()
121
  $( '#giapi_indexnow_api_key' ).val( '...' )
122
  $.ajax( {
123
+ url: ajaxurl,
124
+ type: 'GET',
125
+ data: { action: 'rm_giapi_reset_key', _ajax_nonce: $('#reset_key_nonce').val() },
 
 
126
  success: function( response ) {
127
  $( '#giapi_indexnow_api_key' ).val( response.key );
128
  $( '#indexnow_api_key_location').text( response.location );
assets/js/console.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(document).ready(function(e){var s=e("#giapi-response"),i=e("#giapi-submit"),a=e("#giapi-url"),n=e(".giapi-action"),r=e("#giapi-response-userfriendly");e("#giapi-response-trigger").click(function(s){s.preventDefault(),e(this).find(".dashicons").toggleClass("dashicons-arrow-down-alt2 dashicons-arrow-up-alt2"),e("#giapi-response-wrapper").toggle()}),e("#instant-indexing").submit(function(t){t.preventDefault(),i.attr("disabled","disabled");var o=a.val(),l=n.filter(":checked").val(),d=e("#_wpnonce").val();e.ajax({url:ajaxurl,type:"POST",dataType:"json",data:{action:"rm_giapi",url:o,api_action:l,_wpnonce:d}}).always(function(t){!function(i,t,o){var l=(f=new Date).toLocaleTimeString(),d=a.val().split("\n").filter(Boolean),p=d[0],c=!1,g=n.filter(":checked").val();d.length>1&&(p="(batch)",c=!0);var _=g;if("bing_submit"===g&&(_="indexnow_submit"),r.removeClass("not-ready fail success").addClass("ready").find(".response-id").html("<strong>"+_+"</strong> "+p),"bing_submit"!==o)if(c)r.addClass("success").find(".response-status").text(rm_giapi.l10n_success+" ").siblings(".response-message").text(rm_giapi.l10n_see_response),void 0!==i.error?r.addClass("fail").find(".response-status").text(rm_giapi.l10n_error+" "+i.error.code).siblings(".response-message").text(i.error.message):e.each(i,function(e,s){if(void 0!==s.error){var i="";void 0!==s.error.code&&(i=s.error.code),void 0!==s.error.message&&s.error.message,r.addClass("fail").find(".response-status").text(rm_giapi.l10n_error+" "+i).siblings(".response-message").text(s.error.message)}});else if(void 0!==i.error)r.addClass("fail").find(".response-status").text(rm_giapi.l10n_error+" "+i.error.code).siblings(".response-message").text(i.error.message);else{var u=i;void 0!==i.urlNotificationMetadata&&(u=i.urlNotificationMetadata);var f=new Date(u.latestUpdate.notifyTime);r.addClass("success").find(".response-status").text(rm_giapi.l10n_success+" ").siblings(".response-message").text(rm_giapi.l10n_last_updated+" "+f.toString())}else void 0!==i.error?r.addClass("fail").find(".response-status").text(rm_giapi.l10n_error+" "+i.error.code).siblings(".response-message").text(i.error.message):r.addClass("success").find(".response-status").text(rm_giapi.l10n_success+" ").siblings(".response-message").text(rm_giapi.l10n_see_response),g="indexnow_submit";var m=l+" "+g+": "+p+"\n"+JSON.stringify(i,null,2)+"\n"+"-".repeat(56),v=s.val();s.val(m+"\n"+v)}(t,0,l),i.removeAttr("disabled"),e.ajax({url:ajaxurl,type:"POST",dataType:"json",data:{action:"rm_giapi_limits",_wpnonce:d}}).done(function(s){e.each(s,function(s,i){e("#giapi-limit-"+s).text(i)})})})}),rm_giapi.submit_onload&&e("#instant-indexing").submit(),e("#indexnow_show_response_codes").on("click",function(s){s.preventDefault(),e(this).toggleClass("active"),e("#indexnow_response_codes").toggleClass("hidden")}),e("#indexnow_reset_key").on("click",function(s){s.preventDefault();var i=e("#giapi_indexnow_api_key").val();e("#giapi_indexnow_api_key").val("..."),e.ajax({url:rm_giapi.rest_url+"/resetKey",type:"POST",beforeSend(e){e.setRequestHeader("X-WP-Nonce",rankMath.api.nonce)},success:function(s){e("#giapi_indexnow_api_key").val(s.key),e("#indexnow_api_key_location").text(s.location),e("#indexnow_check_key").attr("href",s.location)},error:function(s){e("#giapi_indexnow_api_key").val(i)}})})}),jQuery(window).on("load",function(){jQuery("#giapi-submit").prop("disabled",!1)});
1
+ jQuery(document).ready(function(e){var s=e("#giapi-response"),i=e("#giapi-submit"),a=e("#giapi-url"),n=e(".giapi-action"),r=e("#giapi-response-userfriendly");e("#giapi-response-trigger").click(function(s){s.preventDefault(),e(this).find(".dashicons").toggleClass("dashicons-arrow-down-alt2 dashicons-arrow-up-alt2"),e("#giapi-response-wrapper").toggle()}),e("#instant-indexing").submit(function(t){t.preventDefault(),i.attr("disabled","disabled");var o=a.val(),l=n.filter(":checked").val(),d=e("#_wpnonce").val();e.ajax({url:ajaxurl,type:"POST",dataType:"json",data:{action:"rm_giapi",url:o,api_action:l,_wpnonce:d}}).always(function(t){!function(i,t,o){var l=(f=new Date).toLocaleTimeString(),d=a.val().split("\n").filter(Boolean),p=d[0],c=!1,g=n.filter(":checked").val();d.length>1&&(p="(batch)",c=!0);var _=g;if("bing_submit"===g&&(_="indexnow_submit"),r.removeClass("not-ready fail success").addClass("ready").find(".response-id").html("<strong>"+_+"</strong> "+p),"bing_submit"!==o)if(c)r.addClass("success").find(".response-status").text(rm_giapi.l10n_success+" ").siblings(".response-message").text(rm_giapi.l10n_see_response),void 0!==i.error?r.addClass("fail").find(".response-status").text(rm_giapi.l10n_error+" "+i.error.code).siblings(".response-message").text(i.error.message):e.each(i,function(e,s){if(void 0!==s.error){var i="";void 0!==s.error.code&&(i=s.error.code),void 0!==s.error.message&&s.error.message,r.addClass("fail").find(".response-status").text(rm_giapi.l10n_error+" "+i).siblings(".response-message").text(s.error.message)}});else if(void 0!==i.error)r.addClass("fail").find(".response-status").text(rm_giapi.l10n_error+" "+i.error.code).siblings(".response-message").text(i.error.message);else{var u=i;void 0!==i.urlNotificationMetadata&&(u=i.urlNotificationMetadata);var f=new Date(u.latestUpdate.notifyTime);r.addClass("success").find(".response-status").text(rm_giapi.l10n_success+" ").siblings(".response-message").text(rm_giapi.l10n_last_updated+" "+f.toString())}else void 0!==i.error?r.addClass("fail").find(".response-status").text(rm_giapi.l10n_error+" "+i.error.code).siblings(".response-message").text(i.error.message):r.addClass("success").find(".response-status").text(rm_giapi.l10n_success+" ").siblings(".response-message").text(rm_giapi.l10n_see_response),g="indexnow_submit";var m=l+" "+g+": "+p+"\n"+JSON.stringify(i,null,2)+"\n"+"-".repeat(56),x=s.val();s.val(m+"\n"+x)}(t,0,l),i.removeAttr("disabled"),e.ajax({url:ajaxurl,type:"POST",dataType:"json",data:{action:"rm_giapi_limits",_wpnonce:d}}).done(function(s){e.each(s,function(s,i){e("#giapi-limit-"+s).text(i)})})})}),rm_giapi.submit_onload&&e("#instant-indexing").submit(),e("#indexnow_show_response_codes").on("click",function(s){s.preventDefault(),e(this).toggleClass("active"),e("#indexnow_response_codes").toggleClass("hidden")}),e("#indexnow_reset_key").on("click",function(s){s.preventDefault();var i=e("#giapi_indexnow_api_key").val();e("#giapi_indexnow_api_key").val("..."),e.ajax({url:ajaxurl,type:"GET",data:{action:"rm_giapi_reset_key",_ajax_nonce:e("#reset_key_nonce").val()},success:function(s){e("#giapi_indexnow_api_key").val(s.key),e("#indexnow_api_key_location").text(s.location),e("#indexnow_check_key").attr("href",s.location)},error:function(s){e("#giapi_indexnow_api_key").val(i)}})})}),jQuery(window).on("load",function(){jQuery("#giapi-submit").prop("disabled",!1)});
includes/class-instant-indexing.php CHANGED
@@ -15,7 +15,7 @@ class RM_GIAPI {
15
  *
16
  * @var string
17
  */
18
- public $version = '1.1.9';
19
 
20
  /**
21
  * Holds the admin menu hook suffix for the "dummy" dashboard.
@@ -156,6 +156,7 @@ class RM_GIAPI {
156
  add_action( 'admin_footer', [ $this, 'admin_footer' ], 20 );
157
  add_action( 'admin_enqueue_scripts', [ $this, 'admin_enqueue_scripts' ] );
158
  add_action( 'wp_ajax_rm_giapi', [ $this, 'ajax_rm_giapi' ] );
 
159
  add_action( 'wp_ajax_rm_giapi_limits', [ $this, 'ajax_get_limits' ] );
160
  add_action( 'admin_init', [ $this, 'rm_missing_admin_notice_error' ], 20, 1 );
161
  add_action( 'admin_notices', [ $this, 'display_notices' ], 10, 1 );
@@ -559,6 +560,58 @@ class RM_GIAPI {
559
  die();
560
  }
561
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
562
  /**
563
  * Normalize input URLs.
564
  *
15
  *
16
  * @var string
17
  */
18
+ public $version = '1.1.10';
19
 
20
  /**
21
  * Holds the admin menu hook suffix for the "dummy" dashboard.
156
  add_action( 'admin_footer', [ $this, 'admin_footer' ], 20 );
157
  add_action( 'admin_enqueue_scripts', [ $this, 'admin_enqueue_scripts' ] );
158
  add_action( 'wp_ajax_rm_giapi', [ $this, 'ajax_rm_giapi' ] );
159
+ add_action( 'wp_ajax_rm_giapi_reset_key', [ $this, 'ajax_reset_key' ] );
160
  add_action( 'wp_ajax_rm_giapi_limits', [ $this, 'ajax_get_limits' ] );
161
  add_action( 'admin_init', [ $this, 'rm_missing_admin_notice_error' ], 20, 1 );
162
  add_action( 'admin_notices', [ $this, 'display_notices' ], 10, 1 );
560
  die();
561
  }
562
 
563
+ /**
564
+ * AJAX handler to generate and save a new API key.
565
+ *
566
+ * @return void
567
+ */
568
+ public function ajax_reset_key() {
569
+ check_ajax_referer( 'rm_giapi_reset_key' );
570
+
571
+ if ( ! current_user_can( apply_filters( 'rank_math/indexing_api/capability', 'manage_options' ) ) ) {
572
+ die( '0' );
573
+ }
574
+
575
+ $this->reset_indexnow_key();
576
+
577
+ $settings = get_option( 'rank-math-options-instant-indexing', [] );
578
+ $key = $settings['indexnow_api_key'];
579
+ $location = trailingslashit( home_url() ) . $key . '.txt';
580
+
581
+ wp_send_json(
582
+ [
583
+ 'status' => 'ok',
584
+ 'key' => $key,
585
+ 'location' => $location,
586
+ ]
587
+ );
588
+ die();
589
+ }
590
+
591
+ /**
592
+ * Generate new API key and save it.
593
+ *
594
+ * @return void
595
+ */
596
+ public function reset_indexnow_key() {
597
+ $settings = RankMath\Helper::get_settings( 'instant_indexing', [] );
598
+ $settings['indexnow_api_key'] = $this->generate_indexnow_key();
599
+ $this->api_key = $settings['indexnow_api_key'];
600
+ update_option( 'rank-math-options-instant-indexing', $settings );
601
+ }
602
+
603
+ /**
604
+ * Generate new API key.
605
+ *
606
+ * @return string
607
+ */
608
+ public function generate_indexnow_key() {
609
+ $api_key = wp_generate_uuid4();
610
+ $api_key = preg_replace( '[-]', '', $api_key );
611
+
612
+ return $api_key;
613
+ }
614
+
615
  /**
616
  * Normalize input URLs.
617
  *
instant-indexing.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Instant Indexing
4
  * Plugin URI: https://rankmath.com/wordpress/plugin/instant-indexing/
5
  * Description: Get your website crawled immediately by Google using their NEW Indexing APIs.
6
- * Version: 1.1.9
7
  * Author: Rank Math
8
  * Author URI: https://s.rankmath.com/home
9
  * License: GPL v3
3
  * Plugin Name: Instant Indexing
4
  * Plugin URI: https://rankmath.com/wordpress/plugin/instant-indexing/
5
  * Description: Get your website crawled immediately by Google using their NEW Indexing APIs.
6
+ * Version: 1.1.10
7
  * Author: Rank Math
8
  * Author URI: https://s.rankmath.com/home
9
  * License: GPL v3
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: indexing api, crawling, live streaming, fast indexing, job posting
5
  Tested up to: 5.9
6
  Requires at least: 5.6
7
  Requires PHP: 7.2
8
- Stable tag: 1.1.9
9
  License: GPL-2.0+
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.txt
11
 
@@ -106,6 +106,9 @@ Technically, yes. That's what the plugin is made to do. But, please note that we
106
 
107
  == Changelog ==
108
 
 
 
 
109
  = v1.1.9 [Feb 03, 2022] =
110
  * Improved: New field to reset API key
111
  * Improved: New field to check API key
5
  Tested up to: 5.9
6
  Requires at least: 5.6
7
  Requires PHP: 7.2
8
+ Stable tag: 1.1.10
9
  License: GPL-2.0+
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.txt
11
 
106
 
107
  == Changelog ==
108
 
109
+ = v1.1.10 [Feb 03, 2022] =
110
+ * Fixed: Compatibility issue with Rank Math SEO
111
+
112
  = v1.1.9 [Feb 03, 2022] =
113
  * Improved: New field to reset API key
114
  * Improved: New field to check API key
views/bing-settings.php CHANGED
@@ -10,8 +10,9 @@ $check_key_label = __( 'Check Key', 'fast-indexing-api' );
10
  // Translators: %s is the words "Check Key".
11
  $field_desc = sprintf( __( 'Use the %1$s button to verify that the key is accessible for search engines. Clicking on it should open the key file in your browser and show the API key.', 'fast-indexing-api' ), '<strong>' . $check_key_label . '</strong>' );
12
 
13
- $key_location = $this->rmapi->get_key_location();
14
  $reset_button = '<a href="#" id="indexnow_reset_key" class="button button-secondary large-button"><span class="dashicons dashicons-update"></span> ' . esc_html__( 'Change Key', 'fast-indexing-api' ) . '</a>';
 
15
  $check_button = '<a href="' . esc_url( $key_location ) . '" id="indexnow_check_key" class="button button-secondary large-button" target="_blank"><span class="dashicons dashicons-search"></span> ' . $check_key_label . '</a>';
16
  ?>
17
  <div class="wrap rank-math-wrap">
@@ -33,9 +34,10 @@ $check_button = '<a href="' . esc_url( $key_location ) . '" id="indexnow_check_k
33
  <p class="description"><?php esc_html_e( 'The IndexNow API key proves the ownership of the site. It is generated automatically. You can change the key if it becomes known to third parties.', 'fast-indexing-api' ); ?></p>
34
  </th>
35
  <td>
36
- <input type="text" class="large-text" id="giapi_indexnow_api_key" disabled="disabled" name="giapi_settings[indexnow_api_key]" value="<?php echo esc_attr( $this->rmapi->get_key() ); ?>">
37
  <br />
38
  <?php echo wp_kses_post( $reset_button ); ?>
 
39
  </td>
40
  </tr>
41
  </tr>
@@ -45,7 +47,7 @@ $check_button = '<a href="' . esc_url( $key_location ) . '" id="indexnow_check_k
45
  <p class="description"><?php echo wp_kses_post( $field_desc ); ?></p>
46
  </th>
47
  <td>
48
- <code id="indexnow_api_key_location"><?php echo esc_url( $this->rmapi->get_key_location() ); ?></code>
49
  <br />
50
  <?php echo wp_kses_post( $check_button ); ?>
51
  </td>
10
  // Translators: %s is the words "Check Key".
11
  $field_desc = sprintf( __( 'Use the %1$s button to verify that the key is accessible for search engines. Clicking on it should open the key file in your browser and show the API key.', 'fast-indexing-api' ), '<strong>' . $check_key_label . '</strong>' );
12
 
13
+ $key_location = $this->rmapi->get_key_location( 'fast-indexing-api_settings' );
14
  $reset_button = '<a href="#" id="indexnow_reset_key" class="button button-secondary large-button"><span class="dashicons dashicons-update"></span> ' . esc_html__( 'Change Key', 'fast-indexing-api' ) . '</a>';
15
+ $reset_nonce = wp_nonce_field( 'rm_giapi_reset_key', 'reset_key_nonce', true, false );
16
  $check_button = '<a href="' . esc_url( $key_location ) . '" id="indexnow_check_key" class="button button-secondary large-button" target="_blank"><span class="dashicons dashicons-search"></span> ' . $check_key_label . '</a>';
17
  ?>
18
  <div class="wrap rank-math-wrap">
34
  <p class="description"><?php esc_html_e( 'The IndexNow API key proves the ownership of the site. It is generated automatically. You can change the key if it becomes known to third parties.', 'fast-indexing-api' ); ?></p>
35
  </th>
36
  <td>
37
+ <input type="text" class="large-text" id="giapi_indexnow_api_key" disabled="disabled" name="giapi_settings[indexnow_api_key]" value="<?php echo esc_attr( $this->rmapi->get_api_key() ); ?>">
38
  <br />
39
  <?php echo wp_kses_post( $reset_button ); ?>
40
+ <?php echo $reset_nonce; ?>
41
  </td>
42
  </tr>
43
  </tr>
47
  <p class="description"><?php echo wp_kses_post( $field_desc ); ?></p>
48
  </th>
49
  <td>
50
+ <code id="indexnow_api_key_location"><?php echo esc_url( $key_location ); ?></code>
51
  <br />
52
  <?php echo wp_kses_post( $check_button ); ?>
53
  </td>
views/console.php CHANGED
@@ -17,7 +17,7 @@
17
  echo wp_kses_post(
18
  sprintf(
19
  /* translators: %s is a link to the plugin settings tab. */
20
- __( 'Please navigate to the %s tab to configure the plugin.', 'fast-indexing-api' ),
21
  '<a href="' . esc_url( admin_url( 'admin.php?page=instant-indexing&tab=google_settings' ) ) . '">' . __( 'Settings', 'fast-indexing-api' ) . '</a>'
22
  )
23
  );
@@ -25,10 +25,8 @@
25
  </p>
26
  </div>
27
  <?php
28
- return;
29
- }
30
- ?>
31
-
32
  <div class="giapi-limits">
33
  <?php if ( $this->get_setting( 'json_key' ) ) { ?>
34
  <p class="" style="line-height: 1.8"><a href="https://developers.google.com/search/apis/indexing-api/v3/quota-pricing" target="_blank"><strong><?php esc_html_e( 'Google API Remaining Quota:', 'fast-indexing-api' ); ?></strong></a><br>
@@ -37,6 +35,9 @@
37
  <code><?php esc_html_e( 'MetadataRequestsPerMinutePerProject', 'fast-indexing-api' ); ?> = <strong id="giapi-limit-metapermin"><?php echo absint( $limits['metapermin'] ); ?></strong> / <?php echo absint( $limits['metapermin_max'] ); ?></code></p>
38
  <?php } ?>
39
  </div>
 
 
 
40
 
41
  <form id="instant-indexing" class="wpform" method="post">
42
  <label for="giapi-url"><?php esc_html_e( 'URLs (one per line, up to 100 for Google and 10,000 for IndexNow):', 'fast-indexing-api' ); ?></label><br>
17
  echo wp_kses_post(
18
  sprintf(
19
  /* translators: %s is a link to the plugin settings tab. */
20
+ __( 'To use the Google Indexing API, please navigate to the %s tab and configure the API.', 'fast-indexing-api' ),
21
  '<a href="' . esc_url( admin_url( 'admin.php?page=instant-indexing&tab=google_settings' ) ) . '">' . __( 'Settings', 'fast-indexing-api' ) . '</a>'
22
  )
23
  );
25
  </p>
26
  </div>
27
  <?php
28
+ } else {
29
+ ?>
 
 
30
  <div class="giapi-limits">
31
  <?php if ( $this->get_setting( 'json_key' ) ) { ?>
32
  <p class="" style="line-height: 1.8"><a href="https://developers.google.com/search/apis/indexing-api/v3/quota-pricing" target="_blank"><strong><?php esc_html_e( 'Google API Remaining Quota:', 'fast-indexing-api' ); ?></strong></a><br>
35
  <code><?php esc_html_e( 'MetadataRequestsPerMinutePerProject', 'fast-indexing-api' ); ?> = <strong id="giapi-limit-metapermin"><?php echo absint( $limits['metapermin'] ); ?></strong> / <?php echo absint( $limits['metapermin_max'] ); ?></code></p>
36
  <?php } ?>
37
  </div>
38
+ <?php
39
+ }
40
+ ?>
41
 
42
  <form id="instant-indexing" class="wpform" method="post">
43
  <label for="giapi-url"><?php esc_html_e( 'URLs (one per line, up to 100 for Google and 10,000 for IndexNow):', 'fast-indexing-api' ); ?></label><br>