Google XML Sitemaps - Version 4.1.5

Version Description

(2022-06-14) = * Fixed code regressions moving from git to svn (preventing recent fixes from being available)

Download this release

Release Info

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

Code changes from version 4.1.4 to 4.1.5

class-googlesitemapgeneratorstandardbuilder.php CHANGED
@@ -180,18 +180,7 @@ class GoogleSitemapGeneratorStandardBuilder {
180
  if ( false === $total_post_count ) {
181
  // phpcs:disable
182
  $total_post_count = $wpdb->get_var(
183
- $wpdb->prepare(
184
- "SELECT
185
- COUNT(*)
186
- FROM
187
- {$wpdb->posts} p
188
- WHERE
189
- p.post_password = ''
190
- AND p.post_type = " . $post_type . "
191
- AND p.post_status = 'publish'
192
- " . $ex_post_s_q_l . ' '
193
- . $ex_cat_s_q_l . ''
194
- ) // phpcs:ignore
195
  ); // db call ok.
196
  // phpcs:enable
197
  wp_cache_add( $cache_key, $total_post_count, 'sitemap', 20 );
@@ -301,14 +290,15 @@ class GoogleSitemapGeneratorStandardBuilder {
301
  FROM
302
  $wpdb->posts
303
  WHERE
304
- post_date_gmt < " . $now . "
305
  AND post_status = 'publish'
306
  AND post_type = 'post'
307
  GROUP BY
308
  YEAR(post_date_gmt),
309
  MONTH(post_date_gmt)
310
  ORDER BY
311
- post_date_gmt DESC"
 
312
  )
313
  // phpcs:enable
314
  ); // db call ok; no-cache ok.
@@ -424,27 +414,23 @@ class GoogleSitemapGeneratorStandardBuilder {
424
  if ( 0 === $enabled_post_types_count ) {
425
  $enabled_post_types[] = 'post';
426
  }
427
- // phpcs:disable
428
- $authors = $wpdb->get_results(
429
- $wpdb->prepare(
430
- "SELECT DISTINCT
431
- u.ID,
432
- u.user_nicename,
433
- MAX(p.post_modified_gmt) AS last_post
434
- FROM
435
- {$wpdb->users} u,
436
- {$wpdb->posts} p
437
- WHERE
438
- p.post_author = u.ID
439
- AND p.post_status = 'publish'
440
- AND p.post_type IN('" . implode( "','", array_map( 'esc_sql', $enabled_post_types ) ) . "' )
441
- AND p.post_password = ''
442
- GROUP BY
443
- u.ID,
444
- u.user_nicename"
445
- )
446
- ); // db call ok; no-cache ok.
447
- // phpcs:enable
448
  if ( $authors && is_array( $authors ) ) {
449
  foreach ( $authors as $author ) {
450
  $url = get_author_posts_url( $author->ID, $author->user_nicename );
@@ -660,7 +646,6 @@ class GoogleSitemapGeneratorStandardBuilder {
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.
@@ -686,7 +671,8 @@ class GoogleSitemapGeneratorStandardBuilder {
686
  global $wpdb;
687
  $blog_update = strtotime( get_lastpostmodified( 'gmt' ) );
688
  $links_per_page = $gsg->get_option( 'links_page' );
689
- if ( 0 === $links_per_page ) {
 
690
  $links_per_page = 10;
691
  $gsg->set_option( 'links_page', 10 );
692
  }
@@ -800,15 +786,16 @@ class GoogleSitemapGeneratorStandardBuilder {
800
  {$wpdb->posts} p
801
  WHERE
802
  p.post_password = ''
803
- AND p.post_type = '" . esc_sql( $post_type_custom ) . "'
804
  AND p.post_status = 'publish'
805
- " . $ex_post_s_q_l . ''
806
  . $ex_cat_s_q_l . "
807
  GROUP BY
808
  YEAR(p.post_date_gmt),
809
  MONTH(p.post_date_gmt)
810
  ORDER BY
811
- p.post_date_gmt DESC"
 
812
  );
813
  $posts = $wpdb->get_results($prp);
814
  if ( $posts ) {
180
  if ( false === $total_post_count ) {
181
  // phpcs:disable
182
  $total_post_count = $wpdb->get_var(
183
+ $wpdb->prepare( "SELECT COUNT(*) FROM {$wpdb->posts} p WHERE p.post_password = '' AND p.post_type = '%s' AND p.post_status = 'publish' " . $ex_post_s_q_l . " " . $ex_cat_s_q_l . " ", $post_type ) // phpcs:ignore
 
 
 
 
 
 
 
 
 
 
 
184
  ); // db call ok.
185
  // phpcs:enable
186
  wp_cache_add( $cache_key, $total_post_count, 'sitemap', 20 );
290
  FROM
291
  $wpdb->posts
292
  WHERE
293
+ post_date_gmt < %s
294
  AND post_status = 'publish'
295
  AND post_type = 'post'
296
  GROUP BY
297
  YEAR(post_date_gmt),
298
  MONTH(post_date_gmt)
299
  ORDER BY
300
+ post_date_gmt DESC",
301
+ $now
302
  )
303
  // phpcs:enable
304
  ); // db call ok; no-cache ok.
414
  if ( 0 === $enabled_post_types_count ) {
415
  $enabled_post_types[] = 'post';
416
  }
417
+ $sql = "SELECT DISTINCT
418
+ u.ID,
419
+ u.user_nicename,
420
+ MAX(p.post_modified_gmt) AS last_post
421
+ FROM
422
+ {$wpdb->users} u,
423
+ {$wpdb->posts} p
424
+ WHERE
425
+ p.post_author = u.ID
426
+ AND p.post_status = 'publish'
427
+ AND p.post_type IN(" . implode( ', ', array_fill( 0, count( $enabled_post_types ), '%s' ) ) . ")
428
+ AND p.post_password = ''
429
+ GROUP BY
430
+ u.ID,
431
+ u.user_nicename";
432
+ $query = call_user_func_array( array( $wpdb, 'prepare' ), array_merge( array( $sql ), $enabled_post_types ) );
433
+ $authors = $wpdb->get_results( $query ); // phpcs:ignore
 
 
 
 
434
  if ( $authors && is_array( $authors ) ) {
435
  foreach ( $authors as $author ) {
436
  $url = get_author_posts_url( $author->ID, $author->user_nicename );
646
  $change_freq = ! empty( $page->get_change_freq() ) ? $page->get_change_freq() : $page->_changeFreq;
647
  $priority = ! empty( $page->get_priority() ) ? $page->get_priority() : $page->_priority;
648
  $last_mod = ! empty( $page->_lastMod ) ? $page->_lastMod : $page->last_mod;
 
649
  // phpcs:enable
650
  /**
651
  * Description for $page variable.
671
  global $wpdb;
672
  $blog_update = strtotime( get_lastpostmodified( 'gmt' ) );
673
  $links_per_page = $gsg->get_option( 'links_page' );
674
+ $links_per_page = (int) $links_per_page;
675
+ if ( 0 === $links_per_page || is_nan( $links_per_page ) ) {
676
  $links_per_page = 10;
677
  $gsg->set_option( 'links_page', 10 );
678
  }
786
  {$wpdb->posts} p
787
  WHERE
788
  p.post_password = ''
789
+ AND p.post_type = %s
790
  AND p.post_status = 'publish'
791
+ " . $ex_post_s_q_l . ""
792
  . $ex_cat_s_q_l . "
793
  GROUP BY
794
  YEAR(p.post_date_gmt),
795
  MONTH(p.post_date_gmt)
796
  ORDER BY
797
+ p.post_date_gmt DESC",
798
+ $post_type_custom
799
  );
800
  $posts = $wpdb->get_results($prp);
801
  if ( $posts ) {
class-googlesitemapgeneratorui.php CHANGED
@@ -502,7 +502,7 @@ class GoogleSitemapGeneratorUI {
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
  }
@@ -1008,7 +1008,7 @@ class GoogleSitemapGeneratorUI {
1008
  );
1009
  /* translators: %s: search term */
1010
  echo '<li>' . wp_kses( str_replace( array( '%1$s', '%2$s' ), $this->sg->get_xml_url(), __( 'The URL to your sitemap index file is: <a href=\'%1$s\'>%2$s</a>.', 'sitemap' ) ), $arr ) . '</li>';
1011
- if ( null === $status ) {
1012
  echo '<li>' . esc_html__( 'Search engines haven\'t been notified yet. Write a post to let them know about your sitemap.', 'sitemap' ) . '</li>';
1013
  } else {
1014
 
502
  if ( 0 >= $links_per_page || is_nan( $links_per_page ) ) {
503
  $links_per_page = 10;
504
  }
505
+ $this->sg->set_option( $k, (int) $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
  }
1008
  );
1009
  /* translators: %s: search term */
1010
  echo '<li>' . wp_kses( str_replace( array( '%1$s', '%2$s' ), $this->sg->get_xml_url(), __( 'The URL to your sitemap index file is: <a href=\'%1$s\'>%2$s</a>.', 'sitemap' ) ), $arr ) . '</li>';
1011
+ if ( null === $status || null === $this->sg->get_option( 'i_tid' ) || '' === $this->sg->get_option( 'i_tid' ) ) {
1012
  echo '<li>' . esc_html__( 'Search engines haven\'t been notified yet. Write a post to let them know about your sitemap.', 'sitemap' ) . '</li>';
1013
  } else {
1014
 
documentation.txt CHANGED
@@ -315,7 +315,7 @@ Release History:
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
 
321
 
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
+ 2022-06-14 4.1.5 Fixed code regressions moving from git to svn
319
 
320
 
321
 
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.4
7
  License: GPLv2
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -77,6 +77,9 @@ The WordPress.org repository is just another place to download this plugin. I do
77
 
78
  == Changelog ==
79
 
 
 
 
80
  = 4.1.4 (2022-06-06) =
81
  * Fixed the issue of PHP warnings
82
  * Fixed links per page issue
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.5
7
  License: GPLv2
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
77
 
78
  == Changelog ==
79
 
80
+ = 4.1.5 (2022-06-14) =
81
+ * Fixed code regressions moving from git to svn (preventing recent fixes from being available)
82
+
83
  = 4.1.4 (2022-06-06) =
84
  * Fixed the issue of PHP warnings
85
  * Fixed links per page issue
sitemap-core.php CHANGED
@@ -2077,7 +2077,7 @@ final class GoogleSitemapGenerator {
2077
  if ( ! empty( $style_sheet ) ) {
2078
  $this->add_element( new GoogleSitemapGeneratorXmlEntry( '<' . '?xml-stylesheet type=\'text/xsl\' href=\'' . esc_url( $style_sheet ) . '\'?>' ) );
2079
  }
2080
- $this->add_element( new GoogleSitemapGeneratorDebugEntry( 'sitemap-generator-url=\'http://www.arnebrachhold.de\' sitemap-generator-version=\'' . $this->get_version() . '\'' ) );
2081
  $this->add_element( new GoogleSitemapGeneratorDebugEntry( 'generated-on=\'' . gmdate( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ) ) . '\'' ) );
2082
 
2083
  switch ( $format ) {
2077
  if ( ! empty( $style_sheet ) ) {
2078
  $this->add_element( new GoogleSitemapGeneratorXmlEntry( '<' . '?xml-stylesheet type=\'text/xsl\' href=\'' . esc_url( $style_sheet ) . '\'?>' ) );
2079
  }
2080
+ $this->add_element( new GoogleSitemapGeneratorDebugEntry( 'sitemap-generator-url=\'https://auctollo.com\' sitemap-generator-version=\'' . $this->get_version() . '\'' ) );
2081
  $this->add_element( new GoogleSitemapGeneratorDebugEntry( 'generated-on=\'' . gmdate( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ) ) . '\'' ) );
2082
 
2083
  switch ( $format ) {
sitemap.php CHANGED
@@ -15,11 +15,11 @@
15
  * Info for WordPress:
16
  * ==============================================================================
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
24
  * Domain Path: /lang
25
 
15
  * Info for WordPress:
16
  * ==============================================================================
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.5
21
  * Author: Auctollo
22
+ * Author URI: https://acutollo.com/
23
  * Text Domain: sitemap
24
  * Domain Path: /lang
25
 
sitemap.xsl CHANGED
@@ -62,8 +62,8 @@
62
  <body>
63
  <xsl:apply-templates></xsl:apply-templates>
64
  <div id="footer">
65
- Generated with <a rel="external nofollow" href="http://www.arnebrachhold.de/redir/sitemap-home/" title="Google (XML) Sitemap Generator Plugin for WordPress">Google (XML) Sitemaps Generator Plugin for WordPress</a> by <a rel="external nofollow" href="http://www.arnebrachhold.de/">Arne Brachhold</a>. This XSLT template is released under the GPL and free to use.<br />
66
- If you have problems with your sitemap please visit the <a rel="external nofollow" href="http://www.arnebrachhold.de/redir/sitemap-x-faq/" title="Google (XML) sitemaps FAQ">plugin FAQ</a> or the <a rel="external nofollow" href="https://wordpress.org/support/plugin/google-sitemap-generator">support forum</a>.
67
  </div>
68
  </body>
69
  </html>
@@ -75,8 +75,8 @@
75
  <div id="intro">
76
  <p>
77
  This is a XML Sitemap which is supposed to be processed by search engines which follow the XML Sitemap standard like Ask.com, Bing, Google and Yahoo.<br />
78
- It was generated using the <a rel="external nofollow" href="http://wordpress.org/">WordPress</a> content management system and the <strong><a rel="external nofollow" href="http://www.arnebrachhold.de/redir/sitemap-home/" title="Google (XML) Sitemaps Generator Plugin for WordPress">XML Sitemap Generator Plugin</a></strong> by <a rel="external nofollow" href="http://www.arnebrachhold.de/">Arne Brachhold</a>.<br />
79
- You can find more information about XML sitemaps on <a rel="external nofollow" href="http://sitemaps.org">sitemaps.org</a> and Google's <a rel="external nofollow" href="http://code.google.com/p/sitemap-generators/wiki/SitemapGenerators">list of sitemap programs</a>.
80
  </p>
81
  </div>
82
  <div id="content">
@@ -123,8 +123,8 @@
123
  <div id="intro">
124
  <p>
125
  This is a XML Sitemap which is supposed to be processed by search engines which follow the XML Sitemap standard like Ask.com, Bing, Google and Yahoo.<br />
126
- It was generated using the <a rel="external nofollow" href="http://wordpress.org/">WordPress</a> content management system and the <strong><a rel="external nofollow" href="http://www.arnebrachhold.de/redir/sitemap-home/" title="XML Sitemaps Generator Plugin for WordPress">XML Sitemap Generator Plugin</a></strong> by <a rel="external nofollow" href="http://www.arnebrachhold.de/">Arne Brachhold</a>.<br />
127
- You can find more information about XML sitemaps on <a rel="external nofollow" href="http://sitemaps.org">sitemaps.org</a> and Google's <a rel="external nofollow" href="http://code.google.com/p/sitemap-generators/wiki/SitemapGenerators">list of sitemap programs</a>.<br />
128
  <br />
129
  This file contains links to sub-sitemaps, follow them to see the actual sitemap content.
130
  </p>
62
  <body>
63
  <xsl:apply-templates></xsl:apply-templates>
64
  <div id="footer">
65
+ Generated with <a rel="external nofollow" href="https://auctollo.com/" title="Google (XML) Sitemap Generator Plugin for WordPress">Google (XML) Sitemaps Generator Plugin for WordPress</a> by <a rel="external nofollow" href="https://auctollo.com/">Auctollo</a>. This XSLT template is released under the GPL and free to use.<br />
66
+ If you have problems with your sitemap please visit the <a rel="external nofollow" href="https://wordpress.org/support/plugin/google-sitemap-generator">support forum</a>.
67
  </div>
68
  </body>
69
  </html>
75
  <div id="intro">
76
  <p>
77
  This is a XML Sitemap which is supposed to be processed by search engines which follow the XML Sitemap standard like Ask.com, Bing, Google and Yahoo.<br />
78
+ It was generated using the <a rel="external nofollow" href="https://wordpress.org/">WordPress</a> content management system and the <strong><a rel="external nofollow" href="https://wordpress.org/plugins/google-sitemap-generator/" title="Google (XML) Sitemaps Generator Plugin for WordPress">XML Sitemap Generator Plugin</a></strong> by <a rel="external nofollow" href="https://auctollo.com">Auctollo</a>.<br />
79
+ You can find more information about XML sitemaps on <a rel="external nofollow" href="http://sitemaps.org">sitemaps.org</a> and Google's <a rel="external nofollow" href="https://developers.google.com/search/blog/2009/01/new-google-sitemap-generator-for-your">list of sitemap programs</a>.
80
  </p>
81
  </div>
82
  <div id="content">
123
  <div id="intro">
124
  <p>
125
  This is a XML Sitemap which is supposed to be processed by search engines which follow the XML Sitemap standard like Ask.com, Bing, Google and Yahoo.<br />
126
+ It was generated using the <a rel="external nofollow" href="https://wordpress.org/">WordPress</a> content management system and the <strong><a rel="external nofollow" href="https://wordpress.org/plugins/google-sitemap-generator/" title="XML Sitemaps Generator Plugin for WordPress">XML Sitemap Generator Plugin</a></strong> by <a rel="external nofollow" href="https://auctollo.com/">Auctollo</a>.<br />
127
+ You can find more information about XML sitemaps on <a rel="external nofollow" href="http://sitemaps.org">sitemaps.org</a> and Google's <a rel="external nofollow" href="https://developers.google.com/search/blog/2009/01/new-google-sitemap-generator-for-your">list of sitemap programs</a>.<br />
128
  <br />
129
  This file contains links to sub-sitemaps, follow them to see the actual sitemap content.
130
  </p>