Google XML Sitemaps - Version 4.1.7

Version Description

(2022-11-24) = * Fixed custom taxonomy unit generation issue * Fixed plugin deactivation notice

Download this release

Release Info

Developer auctollo
Plugin Icon 128x128 Google XML Sitemaps
Version 4.1.7
Comparing to
See all releases

Code changes from version 4.1.6 to 4.1.7

class-googlesitemapgeneratorloader.php CHANGED
@@ -185,10 +185,7 @@ class GoogleSitemapGeneratorLoader {
185
  * Remove rewrite hooks method
186
  */
187
  public static function remove_rewrite_hooks() {
188
- $sg = GoogleSitemapGenerator::get_instance();
189
- if ( $sg->get_option( 'b_sitemap_name' ) !== $sg->get_option( 'b_old_sm_name' ) ) {
190
- add_filter( 'rewrite_rules_array', array( __CLASS__, 'remove_rewrite_rules' ), 1, 1 );
191
- }
192
  }
193
 
194
  /**
185
  * Remove rewrite hooks method
186
  */
187
  public static function remove_rewrite_hooks() {
188
+ add_filter( 'rewrite_rules_array', array( __CLASS__, 'remove_rewrite_rules' ), 1, 1 );
 
 
 
189
  }
190
 
191
  /**
class-googlesitemapgeneratorstandardbuilder.php CHANGED
@@ -73,15 +73,25 @@ class GoogleSitemapGeneratorStandardBuilder {
73
  return;
74
  }
75
 
76
- $pts = strrpos( $params, '-', $pts - strlen( $params ) - 1 );
77
-
78
- $post_type = substr( $params, 0, $pts );
79
- $type = explode( '-', $post_type );
80
- $post_type = $type[0];
81
- $limit = $type[1];
82
- $limits = substr( $limit, 1 );
 
 
 
 
 
 
 
83
  $links_per_page = $gsg->get_option( 'links_page' );
84
- $limit = ( (int) $limits ) * $links_per_page;
 
 
 
85
  if ( ! $post_type || ! in_array( $post_type, $gsg->get_active_post_types(), true ) ) {
86
  return;
87
  }
@@ -161,8 +171,8 @@ class GoogleSitemapGeneratorStandardBuilder {
161
  // phpcs:disable
162
  $q = $wpdb->prepare( $qs, $post_type, $year, $month );
163
  // phpcs:enable
164
- $posts = $wpdb->get_results( $q ); // phpcs:ignore
165
- $posts = array_slice( $posts, ( $limit - $links_per_page) );
166
  $post_count = count( $posts );
167
  if ( ( $post_count ) > 0 ) {
168
  /**
@@ -494,6 +504,9 @@ class GoogleSitemapGeneratorStandardBuilder {
494
 
495
  $offset = $taxonomy;
496
  $links_per_page = $gsg->get_option( 'links_page' );
 
 
 
497
  if ( strpos( $taxonomy, '-' ) !== false ) {
498
  $offset = substr( $taxonomy, strrpos( $taxonomy, '-' ) + 1 );
499
  $taxonomy = str_replace( '-' . $offset, '', $taxonomy );
@@ -580,6 +593,9 @@ class GoogleSitemapGeneratorStandardBuilder {
580
  */
581
  public function build_product_tags( GoogleSitemapGenerator $gsg, $offset ) {
582
  $links_per_page = $gsg->get_option( 'links_page' );
 
 
 
583
  $offset = ( --$offset ) * $links_per_page;
584
 
585
  add_filter( 'get_terms_fields', array( $this, 'filter_terms_query' ), 20, 2 );
@@ -611,6 +627,9 @@ class GoogleSitemapGeneratorStandardBuilder {
611
  */
612
  public function build_product_categories( GoogleSitemapGenerator $gsg, $offset ) {
613
  $links_per_page = $gsg->get_option( 'links_page' );
 
 
 
614
  $offset = ( --$offset ) * $links_per_page;
615
  $excludes = array();
616
  $excl_cats = $gsg->get_option( 'b_exclude_cats' ); // Excluded cats.
@@ -699,9 +718,9 @@ class GoogleSitemapGeneratorStandardBuilder {
699
 
700
  foreach ( $taxonomies as $taxonomy ) {
701
  if ( ! in_array( $taxonomy, $taxonomies_to_exclude, true ) ) {
702
- $step = 1;
703
- $taxs = get_terms( $taxonomy, array( 'exclude' => $excludes ) );
704
- $i = 0;
705
  foreach ( $taxs as $tax ) {
706
  if ( 0 === ( $i % $links_per_page ) && '' !== $tax->taxonomy ) {
707
  $gsg->add_sitemap( 'tax-' . $tax->taxonomy, $step, $blog_update );
73
  return;
74
  }
75
 
76
+ $pts = strrpos( $params, '-', $pts - strlen( $params ) - 1 );
77
+
78
+ $param_length = count( explode( '-', $params ) );
79
+ $post_type = '';
80
+ $post_type = substr( $params, 0, $pts );
81
+ $type = explode( '-', $post_type );
82
+ if ( $param_length > 4 ) {
83
+ $new = array_slice( $type,0,count($type) -1 );
84
+ $post_type = implode( "-", $new );
85
+ } else {
86
+ $post_type = $type[0];
87
+ }
88
+ $limit = $type[count($type)-1];
89
+ $limits = substr( $limit, 1 );
90
  $links_per_page = $gsg->get_option( 'links_page' );
91
+ if ( gettype( $links_per_page ) !== 'integer' ) {
92
+ $links_per_page = (int) 10;
93
+ }
94
+ $limit = ( (int) $limits ) * $links_per_page;
95
  if ( ! $post_type || ! in_array( $post_type, $gsg->get_active_post_types(), true ) ) {
96
  return;
97
  }
171
  // phpcs:disable
172
  $q = $wpdb->prepare( $qs, $post_type, $year, $month );
173
  // phpcs:enable
174
+ $posts = $wpdb->get_results( $q ); // phpcs:ignore
175
+ $posts = array_slice( $posts, ( $limit - $links_per_page ) );
176
  $post_count = count( $posts );
177
  if ( ( $post_count ) > 0 ) {
178
  /**
504
 
505
  $offset = $taxonomy;
506
  $links_per_page = $gsg->get_option( 'links_page' );
507
+ if ( gettype( $links_per_page ) !== 'integer' ) {
508
+ $links_per_page = (int) 10;
509
+ }
510
  if ( strpos( $taxonomy, '-' ) !== false ) {
511
  $offset = substr( $taxonomy, strrpos( $taxonomy, '-' ) + 1 );
512
  $taxonomy = str_replace( '-' . $offset, '', $taxonomy );
593
  */
594
  public function build_product_tags( GoogleSitemapGenerator $gsg, $offset ) {
595
  $links_per_page = $gsg->get_option( 'links_page' );
596
+ if ( gettype( $links_per_page ) !== 'integer' ) {
597
+ $links_per_page = (int) 10;
598
+ }
599
  $offset = ( --$offset ) * $links_per_page;
600
 
601
  add_filter( 'get_terms_fields', array( $this, 'filter_terms_query' ), 20, 2 );
627
  */
628
  public function build_product_categories( GoogleSitemapGenerator $gsg, $offset ) {
629
  $links_per_page = $gsg->get_option( 'links_page' );
630
+ if ( gettype( $links_per_page ) !== 'integer' ) {
631
+ $links_per_page = (int) 10;
632
+ }
633
  $offset = ( --$offset ) * $links_per_page;
634
  $excludes = array();
635
  $excl_cats = $gsg->get_option( 'b_exclude_cats' ); // Excluded cats.
718
 
719
  foreach ( $taxonomies as $taxonomy ) {
720
  if ( ! in_array( $taxonomy, $taxonomies_to_exclude, true ) ) {
721
+ $step = 1;
722
+ $taxs = get_terms( $taxonomy, array( 'exclude' => $excludes ) );
723
+ $i = 0;
724
  foreach ( $taxs as $tax ) {
725
  if ( 0 === ( $i % $links_per_page ) && '' !== $tax->taxonomy ) {
726
  $gsg->add_sitemap( 'tax-' . $tax->taxonomy, $step, $blog_update );
documentation.txt CHANGED
@@ -317,6 +317,7 @@ Release History:
317
  2022-06-06 4.1.4 Fixed the issue of PHP warnings, Fixed links per page issue, Improved WordPress 6.0 compatibility
318
  2022-06-14 4.1.5 Fixed code regressions moving from git to svn
319
  2022-11-23 4.1.6 Made the Google TID field non mandatory in order to ping Google
 
320
 
321
 
322
 
317
  2022-06-06 4.1.4 Fixed the issue of PHP warnings, Fixed links per page issue, Improved WordPress 6.0 compatibility
318
  2022-06-14 4.1.5 Fixed code regressions moving from git to svn
319
  2022-11-23 4.1.6 Made the Google TID field non mandatory in order to ping Google
320
+ 2022-11-24 4.1.7 Fixed custom taxonomy unit generation issue
321
 
322
 
323
 
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: auctollo
3
  Tags: seo, google, bing, yahoo, msn, ask, live, sitemaps, google sitemaps, xml sitemap, xml
4
  Requires at least: 3.3
5
  Tested up to: 6.0
6
- Stable tag: 4.1.6
7
  License: GPLv2
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -77,7 +77,11 @@ The WordPress.org repository is just another place to download this plugin. I do
77
 
78
  == Changelog ==
79
 
80
- = 4.1.5 (2022-11-23) =
 
 
 
 
81
  * Fixed mishandling of empty categories
82
  * Fixed _url undefined notice error
83
  * Fixed error when build_taxonomies throws a fatal error when accessing sub-sitemap without pagination
3
  Tags: seo, google, bing, yahoo, msn, ask, live, sitemaps, google sitemaps, xml sitemap, xml
4
  Requires at least: 3.3
5
  Tested up to: 6.0
6
+ Stable tag: 4.1.7
7
  License: GPLv2
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
77
 
78
  == Changelog ==
79
 
80
+ = 4.1.7 (2022-11-24) =
81
+ * Fixed custom taxonomy unit generation issue
82
+ * Fixed plugin deactivation notice
83
+
84
+ = 4.1.6 (2022-11-23) =
85
  * Fixed mishandling of empty categories
86
  * Fixed _url undefined notice error
87
  * Fixed error when build_taxonomies throws a fatal error when accessing sub-sitemap without pagination
sitemap-core.php CHANGED
@@ -9,7 +9,7 @@
9
 
10
  use function Bhittani\StarRating\functions\sanitize;
11
  /**
12
- * $Id: sitemap-core.php 935247 2014-06-19 17:13:03Z arnee $
13
  */
14
 
15
  // Enable for dev! Good code doesn't generate any notices...
@@ -753,7 +753,7 @@ class GoogleSitemapGeneratorPrioByAverageProvider implements Google_Sitemap_Gene
753
  public function get_post_priority( $post_id, $comment_count ) {
754
 
755
  // Do not divide by zero !
756
- if ( 0 == $this->average ) {
757
  if ( $comment_count > 0 ) {
758
  $priority = 1;
759
  } else {
@@ -1702,7 +1702,7 @@ final class GoogleSitemapGenerator {
1702
  // Manual override for root URL .
1703
  $base_url_settings = $this->get_option( 'b_baseurl' );
1704
  $sm_sitemap_name = $this->get_option( 'b_sitemap_name' );
1705
- $old_sm_name = $this->get_option( 'b_old_sm_name' );
1706
  if ( ! empty( $base_url_settings ) ) {
1707
  $base_url = $base_url_settings;
1708
  } elseif ( defined( 'SM_BASE_URL' ) && SM_BASE_URL ) {
9
 
10
  use function Bhittani\StarRating\functions\sanitize;
11
  /**
12
+ * $Id: sitemap-core.php 2823802 2022-11-24 18:12:38Z auctollo $
13
  */
14
 
15
  // Enable for dev! Good code doesn't generate any notices...
753
  public function get_post_priority( $post_id, $comment_count ) {
754
 
755
  // Do not divide by zero !
756
+ if ( 0 === $this->average ) {
757
  if ( $comment_count > 0 ) {
758
  $priority = 1;
759
  } else {
1702
  // Manual override for root URL .
1703
  $base_url_settings = $this->get_option( 'b_baseurl' );
1704
  $sm_sitemap_name = $this->get_option( 'b_sitemap_name' );
1705
+ $old_sm_name = $this->get_option( 'b_old_sm_name' );
1706
  if ( ! empty( $base_url_settings ) ) {
1707
  $base_url = $base_url_settings;
1708
  } elseif ( defined( 'SM_BASE_URL' ) && SM_BASE_URL ) {
sitemap.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * $Id: sitemap.php 2743211 2022-06-16 04:18:21Z auctollo $
4
 
5
  * Google XML Sitemaps Generator for WordPress
6
  * ==============================================================================
@@ -17,7 +17,7 @@
17
  * Plugin Name: Google XML Sitemaps
18
  * Plugin URI: https://auctollo.com/
19
  * Description: This plugin improves SEO using sitemaps for best indexation by search engines like Google, Bing, Yahoo and others.
20
- * Version: 4.1.6
21
  * Author: Auctollo
22
  * Author URI: https://acutollo.com/
23
  * Text Domain: sitemap
1
  <?php
2
  /**
3
+ * $Id: sitemap.php 2823802 2022-11-24 18:12:38Z auctollo $
4
 
5
  * Google XML Sitemaps Generator for WordPress
6
  * ==============================================================================
17
  * Plugin Name: Google XML Sitemaps
18
  * Plugin URI: https://auctollo.com/
19
  * Description: This plugin improves SEO using sitemaps for best indexation by search engines like Google, Bing, Yahoo and others.
20
+ * Version: 4.1.7
21
  * Author: Auctollo
22
  * Author URI: https://acutollo.com/
23
  * Text Domain: sitemap