Google XML Sitemaps - Version 4.1.4

Version Description

(2022-06-06) = * Fixed the issue of PHP warnings * Fixed links per page issue * Improved WordPress 6.0 compatibility

Download this release

Release Info

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

Code changes from version 4.1.3 to 4.1.4

class-googlesitemapgeneratorstandardbuilder.php CHANGED
@@ -654,13 +654,20 @@ class GoogleSitemapGeneratorStandardBuilder {
654
  $pages = $gsg->get_pages();
655
  if ( $pages && is_array( $pages ) && count( $pages ) > 0 ) {
656
  foreach ( $pages as $page ) {
 
 
 
 
 
 
657
 
 
658
  /**
659
  * Description for $page variable.
660
  *
661
  * @var $page GoogleSitemapGeneratorPage
662
  */
663
- $gsg->add_url( $page->get_url(), $page->get_last_mod(), $page->get_change_freq(), $page->get_priority() );
664
  }
665
  }
666
  }
@@ -750,7 +757,8 @@ class GoogleSitemapGeneratorStandardBuilder {
750
  $pages = $gsg->get_pages();
751
  if ( count( $pages ) > 0 ) {
752
  foreach ( $pages as $page ) {
753
- if ( $page instanceof GoogleSitemapGeneratorPage && $page->get_url() ) {
 
754
  $gsg->add_sitemap( 'externals', null, $blog_update );
755
  break;
756
  }
654
  $pages = $gsg->get_pages();
655
  if ( $pages && is_array( $pages ) && count( $pages ) > 0 ) {
656
  foreach ( $pages as $page ) {
657
+ // Disabled phpcs for backward compatibility .
658
+ // phpcs:disable
659
+ $url = ! empty( $page->get_url() ) ? $page->get_url() : $page->_url;
660
+ $change_freq = ! empty( $page->get_change_freq() ) ? $page->get_change_freq() : $page->_changeFreq;
661
+ $priority = ! empty( $page->get_priority() ) ? $page->get_priority() : $page->_priority;
662
+ $last_mod = ! empty( $page->_lastMod ) ? $page->_lastMod : $page->last_mod;
663
 
664
+ // phpcs:enable
665
  /**
666
  * Description for $page variable.
667
  *
668
  * @var $page GoogleSitemapGeneratorPage
669
  */
670
+ $gsg->add_url( $url, $last_mod, $change_freq, $priority );
671
  }
672
  }
673
  }
757
  $pages = $gsg->get_pages();
758
  if ( count( $pages ) > 0 ) {
759
  foreach ( $pages as $page ) {
760
+ $url = ! empty( $page->get_url() ) ? $page->get_url() : $page->_url;
761
+ if ( $page instanceof GoogleSitemapGeneratorPage && $url ) {
762
  $gsg->add_sitemap( 'externals', null, $blog_update );
763
  break;
764
  }
class-googlesitemapgeneratorui.php CHANGED
@@ -497,7 +497,12 @@ class GoogleSitemapGeneratorUI {
497
  } elseif ( substr( $k, 0, 6 ) === 'sm_pr_' ) {
498
  $this->sg->set_option( $k, (float) sanitize_text_field( wp_unslash( $_POST[ $k ] ) ) );
499
  } elseif ( 'sm_links_page' === $k ) {
500
- $this->sg->set_option( $k, (float) sanitize_text_field( wp_unslash( $_POST[ $k ] ) ) );
 
 
 
 
 
501
  } elseif ( substr( $k, 0, 3 ) === 'sm_' ) {
502
  $this->sg->set_option( $k, (bool) sanitize_text_field( wp_unslash( $_POST[ $k ] ) ) );
503
  }
@@ -1034,9 +1039,9 @@ class GoogleSitemapGeneratorUI {
1034
  }
1035
 
1036
  ?>
1037
- <?php if ( $this->sg->get_option( 'b_ping' ) || $this->sg->get_option( 'b_pingmsn' ) ) : ?>
1038
  <li>
1039
- Notify Search Engines about <a href='<?php echo esc_url( wp_nonce_url( $this->sg->get_back_link() . '&sm_ping_main=true', 'sitemap' ) ); ?>'>your sitemap </a> or <a href='#' onclick='window.open('<?php echo esc_html( wp_nonce_url( $this->sg->get_back_link() . '&sm_ping_all=true&noheader=true', 'sitemap' ) ); ?>','','width=650, height=500, resizable=yes'); return false;'>your main sitemap and all sub-sitemaps</a> now.
1040
  </li>
1041
  <?php endif; ?>
1042
  <?php
497
  } elseif ( substr( $k, 0, 6 ) === 'sm_pr_' ) {
498
  $this->sg->set_option( $k, (float) sanitize_text_field( wp_unslash( $_POST[ $k ] ) ) );
499
  } elseif ( 'sm_links_page' === $k ) {
500
+ $links_per_page = sanitize_text_field( wp_unslash( $_POST[ $k ] ) );
501
+ $links_per_page = (int) $links_per_page;
502
+ if ( 0 >= $links_per_page || is_nan( $links_per_page ) ) {
503
+ $links_per_page = 10;
504
+ }
505
+ $this->sg->set_option( $k, (float) $links_per_page );
506
  } elseif ( substr( $k, 0, 3 ) === 'sm_' ) {
507
  $this->sg->set_option( $k, (bool) sanitize_text_field( wp_unslash( $_POST[ $k ] ) ) );
508
  }
1039
  }
1040
 
1041
  ?>
1042
+ <?php if ( $this->sg->get_option( 'b_ping' ) ) : ?>
1043
  <li>
1044
+ Notify Search Engines about <a href='<?php echo esc_url( wp_nonce_url( $this->sg->get_back_link() . '&sm_ping_main=true', 'sitemap' ) ); ?>'>your sitemap </a> or <a href='<?php echo esc_url( wp_nonce_url( $this->sg->get_back_link() . '&sm_ping_main=true', 'sitemap' ) ); ?>'>your main sitemap and all sub-sitemaps</a> now.
1045
  </li>
1046
  <?php endif; ?>
1047
  <?php
documentation.txt CHANGED
@@ -313,8 +313,8 @@ Release History:
313
  2018-12-18 4.1.0 Fixed security issues related to forms and external URLs
314
  2022-04-07 4.1.1 Fixed security issues and added support for WooCommerce based sitemap
315
  2022-04-07 4.1.2 Fixed security issues and features like support for WooCommerce based sitemap
316
- 2022-05-31 4.1.3 Added backward compatibility settings, changed Google Tracking ID field to optional, fixed PHP warnings
317
-
318
 
319
 
320
 
313
  2018-12-18 4.1.0 Fixed security issues related to forms and external URLs
314
  2022-04-07 4.1.1 Fixed security issues and added support for WooCommerce based sitemap
315
  2022-04-07 4.1.2 Fixed security issues and features like support for WooCommerce based sitemap
316
+ 2022-05-31 4.1.3 Added backward compatibility settings, Changed Google Tracking ID field to optional, Fixed PHP warnings
317
+ 2022-06-06 4.1.4 Fixed the issue of PHP warnings, Fixed links per page issue, Improved WordPress 6.0 compatibility
318
 
319
 
320
 
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  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: 5.9.3
6
- Stable tag: 4.1.3
7
  License: GPLv2
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -77,6 +77,11 @@ The WordPress.org repository is just another place to download this plugin. I do
77
 
78
  == Changelog ==
79
 
 
 
 
 
 
80
  = 4.1.3 (2022-05-31) =
81
  * Added backward compatibility settings
82
  * Changed Google Tracking ID field to optional
@@ -94,16 +99,16 @@ The WordPress.org repository is just another place to download this plugin. I do
94
  * Added option to list custom post in the archive sitemap
95
 
96
  = 4.1.1 (2022-04-07) =
97
- * Fix security issue related to Cross-Site Scripting attacks on debug page
98
- * Fix HTTP error while generating sitemap (because of conflict of www and now www site)
99
- * Fix handles the removal of Wordpress native sitemap entry from robots.txt
100
- * Added option for flush database rewrite on deactivate plugin
101
- * Added options for split the custom categories into multiple sitemap by custom taxonomy
102
- * Added options to omit the posts which added in robots.txt to disallow
103
- * Added option to set links per page for tags and categories
104
- * Added option for provide the custom name for the sitemap.xml file
105
- * Added option for custom post type's list into the archive sitemap
106
- * Added support of manage priorities and frequencies for products category
107
 
108
  = 4.1.0 (2018-12-18) =
109
  * Fixed security issue related to escaping external URLs
2
  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.4
7
  License: GPLv2
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
77
 
78
  == Changelog ==
79
 
80
+ = 4.1.4 (2022-06-06) =
81
+ * Fixed the issue of PHP warnings
82
+ * Fixed links per page issue
83
+ * Improved WordPress 6.0 compatibility
84
+
85
  = 4.1.3 (2022-05-31) =
86
  * Added backward compatibility settings
87
  * Changed Google Tracking ID field to optional
99
  * Added option to list custom post in the archive sitemap
100
 
101
  = 4.1.1 (2022-04-07) =
102
+ * fix security issue related to Cross-Site Scripting attacks on debug page
103
+ * fix HTTP error while generating sitemap (because of conflict of www and now www site)
104
+ * fix handles the removal of Wordpress native sitemap entry from robots.txt
105
+ * added option for flush database rewrite on deactivate plugin
106
+ * added options for split the custom categories into multiple sitemap by custom taxonomy
107
+ * added options to omit the posts which added in robots.txt to disallow
108
+ * added option to set links per page for tags and categories
109
+ * added option for provide the custom name for the sitemap.xml file
110
+ * added option for custom post type's list into the archive sitemap
111
+ * added support of manage priorities and frequencies for products category
112
 
113
  = 4.1.0 (2018-12-18) =
114
  * Fixed security issue related to escaping external URLs
sitemap-core.php CHANGED
@@ -538,12 +538,12 @@ class GoogleSitemapGeneratorSitemapEntry {
538
  }
539
 
540
  $r = '';
541
- $r .= '\\t<sitemap>\\n';
542
- $r .= '\\t\\t<loc>' . $this->escape_xml( esc_url_raw( $this->url ) ) . '</loc>\\n';
543
  if ( $this->last_mod > 0 ) {
544
- $r .= '\\t\\t<lastmod>' . gmdate( 'Y-m-d\TH:i:s+00:00', $this->last_mod ) . '</lastmod>\\n';
545
  }
546
- $r .= '\\t</sitemap>\\n';
547
  return $r;
548
  }
549
 
@@ -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 {
@@ -869,7 +869,7 @@ final class GoogleSitemapGenerator {
869
  *
870
  * @since 4.0
871
  */
872
- public function __construct() {
873
  }
874
 
875
  /**
@@ -1335,7 +1335,6 @@ final class GoogleSitemapGenerator {
1335
  $this->options['sm_b_prio_provider'] = 'GoogleSitemapGeneratorPrioByCountProvider'; // Provider for automatic priority calculation .
1336
  $this->options['sm_b_ping'] = true; // Auto ping Google .
1337
  $this->options['sm_b_stats'] = false; // Send anonymous stats .
1338
- $this->options['sm_b_pingmsn'] = true; // Auto ping MSN .
1339
  $this->options['sm_b_autozip'] = true; // Try to gzip the output .
1340
  $this->options['sm_b_memory'] = ''; // Set Memory Limit (e.g. 16M) .
1341
  $this->options['sm_b_time'] = -1; // Set time limit in seconds, 0 for unlimited, -1 for disabled .
@@ -1508,6 +1507,7 @@ final class GoogleSitemapGenerator {
1508
  global $wpdb;
1509
 
1510
  $needs_update = false;
 
1511
  $pages_string = $wpdb->get_var( "SELECT option_value FROM $wpdb->options WHERE option_name = 'sm_cpages'" ); // db call ok; no-cache ok.
1512
 
1513
  // Class sm_page was renamed with 3.0 -> rename it in serialized value for compatibility .
@@ -2414,7 +2414,9 @@ final class GoogleSitemapGenerator {
2414
 
2415
  // Try to get as much as debug / error output as possible .
2416
  $err_level = error_reporting( E_ALL );
2417
- define( 'WP_DEBUG_DISPLAY', true );
 
 
2418
 
2419
  if ( ! defined( 'WP_DEBUG' ) ) {
2420
  define( 'WP_DEBUG', true );
538
  }
539
 
540
  $r = '';
541
+ $r .= "\t<sitemap>\n";
542
+ $r .= "\t\t<loc>" . $this->escape_xml( esc_url_raw( $this->url ) ) . "</loc>\n";
543
  if ( $this->last_mod > 0 ) {
544
+ $r .= "\t\t<lastmod>" . gmdate( 'Y-m-d\TH:i:s+00:00', $this->last_mod ) . "</lastmod>\n";
545
  }
546
+ $r .= "\t</sitemap>\n";
547
  return $r;
548
  }
549
 
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 {
869
  *
870
  * @since 4.0
871
  */
872
+ private function __construct() {
873
  }
874
 
875
  /**
1335
  $this->options['sm_b_prio_provider'] = 'GoogleSitemapGeneratorPrioByCountProvider'; // Provider for automatic priority calculation .
1336
  $this->options['sm_b_ping'] = true; // Auto ping Google .
1337
  $this->options['sm_b_stats'] = false; // Send anonymous stats .
 
1338
  $this->options['sm_b_autozip'] = true; // Try to gzip the output .
1339
  $this->options['sm_b_memory'] = ''; // Set Memory Limit (e.g. 16M) .
1340
  $this->options['sm_b_time'] = -1; // Set time limit in seconds, 0 for unlimited, -1 for disabled .
1507
  global $wpdb;
1508
 
1509
  $needs_update = false;
1510
+
1511
  $pages_string = $wpdb->get_var( "SELECT option_value FROM $wpdb->options WHERE option_name = 'sm_cpages'" ); // db call ok; no-cache ok.
1512
 
1513
  // Class sm_page was renamed with 3.0 -> rename it in serialized value for compatibility .
2414
 
2415
  // Try to get as much as debug / error output as possible .
2416
  $err_level = error_reporting( E_ALL );
2417
+ if ( ! defined( 'WP_DEBUG_DISPLAY' ) ) {
2418
+ define( 'WP_DEBUG_DISPLAY', true );
2419
+ }
2420
 
2421
  if ( ! defined( 'WP_DEBUG' ) ) {
2422
  define( 'WP_DEBUG', true );
sitemap.php CHANGED
@@ -17,7 +17,7 @@
17
  * Plugin Name: Google XML Sitemaps
18
  * Plugin URI: http://www.arnebrachhold.de/redir/sitemap-home/
19
  * Description: This plugin improves SEO using sitemaps for best indexation by search engines like Google, Bing, Yahoo and others.
20
- * Version: 4.1.3
21
  * Author: Auctollo
22
  * Author URI: http://www.arnebrachhold.de/
23
  * Text Domain: sitemap
17
  * Plugin Name: Google XML Sitemaps
18
  * Plugin URI: http://www.arnebrachhold.de/redir/sitemap-home/
19
  * Description: This plugin improves SEO using sitemaps for best indexation by search engines like Google, Bing, Yahoo and others.
20
+ * Version: 4.1.4
21
  * Author: Auctollo
22
  * Author URI: http://www.arnebrachhold.de/
23
  * Text Domain: sitemap