Google XML Sitemap Generator - Version 1.3.0

Version Description

Release Date: September 7th, 2016

  • New : Support for custom post types and taxonomy
  • New : Add custom entries to you robot.txt file.
Download this release

Release Info

Developer XmlSitemapGenerator
Plugin Icon 128x128 Google XML Sitemap Generator
Version 1.3.0
Comparing to
See all releases

Code changes from version 1.2.3 to 1.3.0

XmlSitemap.xsl CHANGED
@@ -30,7 +30,7 @@
30
  <div id="header">
31
  <p>
32
  This is an XML Sitemap comaptible with major search engines such as Google, Bing, Baidu and Yandex.<br />
33
- For more information and support go to <a href="https://xmlsitemapgenerator.org/sitemap-generator.aspx">Wordpress Sitemap Generator Plugin</a> homepage. <br />
34
  You can find more information about XML sitemaps on <a href="http://sitemaps.org">sitemaps.org</a>
35
  </p>
36
  </div>
@@ -73,7 +73,7 @@
73
  </table>
74
 
75
  <div id="xsgFooter">Generated by XmlSitemapGenerator.org -
76
- <a href="https://xmlsitemapgenerator.org/sitemap-generator.aspx" title="WordPress XML Sitemap Generator Plugin">WordPress XML Sitemap Generator Plugin</a></div>
77
  </div>
78
 
79
  </xsl:template>
30
  <div id="header">
31
  <p>
32
  This is an XML Sitemap comaptible with major search engines such as Google, Bing, Baidu and Yandex.<br />
33
+ For more information and support go to <a href="https://xmlsitemapgenerator.org/wordpress-sitemap-generator-plugin.aspx">Wordpress Sitemap Generator Plugin</a> homepage. <br />
34
  You can find more information about XML sitemaps on <a href="http://sitemaps.org">sitemaps.org</a>
35
  </p>
36
  </div>
73
  </table>
74
 
75
  <div id="xsgFooter">Generated by XmlSitemapGenerator.org -
76
+ <a href="https://xmlsitemapgenerator.org/wordpress-sitemap-generator-plugin.aspx" title="WordPress XML Sitemap Generator Plugin">WordPress XML Sitemap Generator Plugin</a></div>
77
  </div>
78
 
79
  </xsl:template>
code/core.php CHANGED
@@ -4,8 +4,8 @@ namespace xmlSitemapGenerator;
4
 
5
  include_once 'settingsModels.php';
6
  include_once 'upgrader.php';
7
-
8
- define ( "XSG_PLUGIN_VERSION" , "1.2.3");
9
  define ( "XSG_PLUGIN_NAME" , "www-xml-sitemap-generator-org");
10
  define ( "XSG_RULES_VERSION" , "0003"); // increment this if the rewrite rules ever change.
11
  define ( "XSG_RULES_OPTION_NAME" , "wpXSG_rewrite_done");
@@ -136,7 +136,11 @@ class core {
136
  $builder->render($wp_query->query_vars["xml-sitemap"]); //$wp_query->query_vars["xml-sitemap"]
137
  }
138
  }
139
-
 
 
 
 
140
  public static function addRobotLinks()
141
  {
142
  $globalSettings = get_option( "wpXSG_global" , new globalSettings() );
@@ -147,6 +151,9 @@ class core {
147
  echo "\nAllow: /rsssitemap.xml";
148
  echo "\nAllow: /htmlsitemap.htm";
149
  }
 
 
 
150
  }
151
  public static function addRssLink()
152
  {
4
 
5
  include_once 'settingsModels.php';
6
  include_once 'upgrader.php';
7
+
8
+ define ( "XSG_PLUGIN_VERSION" , "1.3.0");
9
  define ( "XSG_PLUGIN_NAME" , "www-xml-sitemap-generator-org");
10
  define ( "XSG_RULES_VERSION" , "0003"); // increment this if the rewrite rules ever change.
11
  define ( "XSG_RULES_OPTION_NAME" , "wpXSG_rewrite_done");
136
  $builder->render($wp_query->query_vars["xml-sitemap"]); //$wp_query->query_vars["xml-sitemap"]
137
  }
138
  }
139
+
140
+ static function safeRead($object,$property)
141
+ {
142
+ return ( isset( $object->{$property} ) ? $object->{$property} : "" );
143
+ }
144
  public static function addRobotLinks()
145
  {
146
  $globalSettings = get_option( "wpXSG_global" , new globalSettings() );
151
  echo "\nAllow: /rsssitemap.xml";
152
  echo "\nAllow: /htmlsitemap.htm";
153
  }
154
+ echo "\n\n";
155
+ echo self::safeRead($globalSettings,"robotEntries");
156
+
157
  }
158
  public static function addRssLink()
159
  {
code/dataAccess.php CHANGED
@@ -95,6 +95,21 @@ class dataAccess {
95
  $settings = $wpdb->query($cmd);
96
 
97
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
98
 
99
  // type = "post" or "page" , date = "created" or "updated"
100
  //$limit = 0 for no limit.)
@@ -106,6 +121,13 @@ class dataAccess {
106
 
107
  $tablemeta = $wpdb->prefix . 'xsg_sitemap_meta';
108
 
 
 
 
 
 
 
 
109
  $cmd = "SELECT
110
  posts.*,
111
  postmeta.*, Tag_meta.* , UNIX_TIMESTAMP({$date}) as sitemapDate
@@ -125,10 +147,10 @@ class dataAccess {
125
  GROUP BY terms.object_id
126
  ) as Tag_meta
127
  ON posts.Id = Tag_meta.Post_id
128
- WHERE post_status = 'publish' AND (post_type = 'page' OR post_type = 'post')
129
  AND posts.post_password = '' AND posts.ID <> {$frontPageId}
130
  ORDER BY {$date} DESC ";
131
-
132
 
133
  if ($limit > 0 )
134
  {
95
  $settings = $wpdb->query($cmd);
96
 
97
  }
98
+
99
+ static function getPostTypes()
100
+ {
101
+ $args = array(
102
+ 'public' => true,
103
+ '_builtin' => false
104
+ );
105
+
106
+ $output = 'names'; // 'names' or 'objects' (default: 'names')
107
+ $operator = 'and'; // 'and' or 'or' (default: 'and')
108
+
109
+ $post_types = get_post_types( $args, $output, $operator );
110
+
111
+ return $post_types;
112
+ }
113
 
114
  // type = "post" or "page" , date = "created" or "updated"
115
  //$limit = 0 for no limit.)
121
 
122
  $tablemeta = $wpdb->prefix . 'xsg_sitemap_meta';
123
 
124
+ $postTypes = "";
125
+ foreach ( self::getPostTypes() as $post_type )
126
+ {
127
+ $postTypes .= " OR post_type = '{$post_type}'";
128
+ }
129
+
130
+
131
  $cmd = "SELECT
132
  posts.*,
133
  postmeta.*, Tag_meta.* , UNIX_TIMESTAMP({$date}) as sitemapDate
147
  GROUP BY terms.object_id
148
  ) as Tag_meta
149
  ON posts.Id = Tag_meta.Post_id
150
+ WHERE post_status = 'publish' AND (post_type = 'page' OR post_type = 'post' {$postTypes})
151
  AND posts.post_password = '' AND posts.ID <> {$frontPageId}
152
  ORDER BY {$date} DESC ";
153
+
154
 
155
  if ($limit > 0 )
156
  {
code/settings.php CHANGED
@@ -24,6 +24,32 @@ class settings
24
  register_setting( XSG_PLUGIN_NAME, XSG_PLUGIN_NAME );
25
  }
26
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  static function getDefaults($name){
28
 
29
  $settings = new metaSettings();
@@ -57,6 +83,7 @@ class settings
57
  $globalSettings->addToRobots = ( isset( $_POST['addToRobots'] ) ? $_POST['addToRobots'] : 0 );
58
  $globalSettings->sendStats = ( isset( $_POST['sendStats'] ) ? $_POST['sendStats'] : 0 );
59
  $globalSettings->smallCredit = ( isset( $_POST['smallCredit'] ) ? $_POST['smallCredit'] : 0 );
 
60
 
61
  update_option( "wpXSG_global" , $globalSettings , true);
62
 
@@ -75,6 +102,12 @@ class settings
75
 
76
  $sitemapDefaults->excludeRules = ( isset( $_POST['excludeRules'] ) ? $_POST['excludeRules'] : "" );
77
 
 
 
 
 
 
 
78
  update_option( "wpXSG_sitemapDefaults" , $sitemapDefaults , false);
79
 
80
  core::updateStatistics("Admin", "SaveSettings",0);
@@ -132,11 +165,10 @@ class settings
132
 
133
 
134
 
135
- <p>Here you can edit your admin settings and defaults.</p>
136
- <p>You can override categories, tags, pages and posts when adding and editing them.</p>
137
- <a target="_blank" href="https://xmlsitemapgenerator.org/contact.aspx">contact us</a> with any comments,
138
  questions, suggestions and bugs.</strong></p>
139
-
140
 
141
  <div id="poststuff" class="metabox-holder has-right-sidebar">
142
 
@@ -197,13 +229,16 @@ class settings
197
 
198
 
199
  <div class="postbox">
200
- <h3 class="hndle"><span>Please support us</span></h3>
201
  <div class="inside">
202
  <p>We take time out of our personal lives to develop and support our sitemap tools and cover costs out of our own pockets.
203
  </p>
204
- <p>Please help with costs by making a small contribution..</p>
205
-
206
- <p><a target="_blank" href="https://xmlsitemapgenerator.org/donate.aspx">Make a small donation</a></p>
 
 
 
207
  </div>
208
  </div>
209
 
@@ -296,8 +331,25 @@ class settings
296
  self::RenderDefaultSection("Archive - recent","recentArchive",$sitemapDefaults->recentArchive);
297
  self::RenderDefaultSection("Archive - old","oldArchive",$sitemapDefaults->oldArchive);
298
  self::RenderDefaultSection("Authors","authors",$sitemapDefaults->authors);
299
-
 
300
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
301
  ?>
302
 
303
 
@@ -308,6 +360,18 @@ class settings
308
  </div>
309
  </div>
310
 
 
 
 
 
 
 
 
 
 
 
 
 
311
  <div class="postbox">
312
  <h3 class="hndle"><span>Log</span></h3>
313
  <div class="inside">
@@ -322,7 +386,7 @@ class settings
322
 
323
  </div>
324
 
325
- <?php submit_button(); ?>
326
 
327
  </div>
328
 
24
  register_setting( XSG_PLUGIN_NAME, XSG_PLUGIN_NAME );
25
  }
26
 
27
+ static function getPostTypes()
28
+ {
29
+ $args = array(
30
+ 'public' => true,
31
+ '_builtin' => false
32
+ );
33
+
34
+ $output = 'names'; // 'names' or 'objects' (default: 'names')
35
+ $operator = 'and'; // 'and' or 'or' (default: 'and')
36
+
37
+ $post_types = get_post_types( $args, $output, $operator );
38
+
39
+ return $post_types;
40
+ }
41
+ static function postTypeDefault($sitemapDefaults,$name)
42
+ {
43
+
44
+ return ( isset( $sitemapDefaults->{$name} ) ? $sitemapDefaults->{$name} : $sitemapDefaults->posts );
45
+ }
46
+
47
+ static function safeRead($object,$property)
48
+ {
49
+ return ( isset( $object->{$property} ) ? $object->{$property} : "" );
50
+ }
51
+
52
+
53
  static function getDefaults($name){
54
 
55
  $settings = new metaSettings();
83
  $globalSettings->addToRobots = ( isset( $_POST['addToRobots'] ) ? $_POST['addToRobots'] : 0 );
84
  $globalSettings->sendStats = ( isset( $_POST['sendStats'] ) ? $_POST['sendStats'] : 0 );
85
  $globalSettings->smallCredit = ( isset( $_POST['smallCredit'] ) ? $_POST['smallCredit'] : 0 );
86
+ $globalSettings->robotEntries = ( isset( $_POST['robotEntries'] ) ? $_POST['robotEntries'] : "" );
87
 
88
  update_option( "wpXSG_global" , $globalSettings , true);
89
 
102
 
103
  $sitemapDefaults->excludeRules = ( isset( $_POST['excludeRules'] ) ? $_POST['excludeRules'] : "" );
104
 
105
+ foreach ( self::getPostTypes() as $post_type )
106
+ {
107
+ $sitemapDefaults->{$post_type} = self::getDefaults($post_type);
108
+ }
109
+
110
+
111
  update_option( "wpXSG_sitemapDefaults" , $sitemapDefaults , false);
112
 
113
  core::updateStatistics("Admin", "SaveSettings",0);
165
 
166
 
167
 
168
+ <p>Here you can edit your admin settings and defaults. You can override categories, tags, pages and posts when adding and editing them.</p>
169
+ <p>Sharing is caring, so please support us with a <a target="_blank" href="https://xmlsitemapgenerator.org/donate.aspx">quick share</a> and if possible a <a target="_blank" href="https://xmlsitemapgenerator.org/donate.aspx">small donation</a>.</p>
170
+ Please feel free to <a target="_blank" href="https://xmlsitemapgenerator.org/contact.aspx">contact us</a> with any comments,
171
  questions, suggestions and bugs.</strong></p>
 
172
 
173
  <div id="poststuff" class="metabox-holder has-right-sidebar">
174
 
229
 
230
 
231
  <div class="postbox">
232
+ <h3 class="hndle"><span>Sharing is caring</span></h3>
233
  <div class="inside">
234
  <p>We take time out of our personal lives to develop and support our sitemap tools and cover costs out of our own pockets.
235
  </p>
236
+ <p>Please support us with a <a target="_blank" href="https://xmlsitemapgenerator.org/donate.aspx">quick share</a> and
237
+ if possible a <a target="_blank" href="https://xmlsitemapgenerator.org/donate.aspx">small donation</a>.</p>
238
+ <p>Please feel free to <a target="_blank" href="https://xmlsitemapgenerator.org/contact.aspx">contact us</a> with any comments,
239
+ questions, suggestions and bugs.</strong></p>
240
+
241
+
242
  </div>
243
  </div>
244
 
331
  self::RenderDefaultSection("Archive - recent","recentArchive",$sitemapDefaults->recentArchive);
332
  self::RenderDefaultSection("Archive - old","oldArchive",$sitemapDefaults->oldArchive);
333
  self::RenderDefaultSection("Authors","authors",$sitemapDefaults->authors);
334
+ ?>
335
+ </table>
336
 
337
+ <p>Custom post types<p/>
338
+ <table class="wp-list-table widefat fixed striped tags" style="clear:none;">
339
+ <thead>
340
+ <tr>
341
+ <th scope="col">Page / area</th>
342
+ <th scope="col">Exclude</th>
343
+ <th scope="col">Relative priority</th>
344
+ <th scope="col">Update frequency</th>
345
+ </tr>
346
+ </thead>
347
+
348
+ <?php
349
+ foreach ( self::getPostTypes() as $post_type )
350
+ {
351
+ self::RenderDefaultSection($post_type,$post_type, self::postTypeDefault($sitemapDefaults,$post_type));
352
+ }
353
  ?>
354
 
355
 
360
  </div>
361
  </div>
362
 
363
+ <div class="postbox">
364
+ <h3 class="hndle"><span>Robots.txt</span></h3>
365
+ <div class="inside">
366
+ <p>Add custom entries to your robots.txt file.</p>
367
+ <textarea name="robotEntries" id="robotEntries" rows="10" style="width:98%;"><?php echo self::safeRead($globalSettings,"robotEntries"); ?></textarea>
368
+
369
+ </div>
370
+ </div>
371
+
372
+ <?php submit_button(); ?>
373
+
374
+
375
  <div class="postbox">
376
  <h3 class="hndle"><span>Log</span></h3>
377
  <div class="inside">
386
 
387
  </div>
388
 
389
+
390
 
391
  </div>
392
 
code/settingsModels.php CHANGED
@@ -31,10 +31,11 @@ class sitemapDefaults {
31
  public $recentArchive ;
32
  public $oldArchive ;
33
  public $authors ;
34
-
35
  public $dateField = "updated"; // date field for sitemap can be updated or created date.
36
  public $excludeRules = "";
37
-
 
38
  }
39
 
40
  class globalSettings {
31
  public $recentArchive ;
32
  public $oldArchive ;
33
  public $authors ;
34
+
35
  public $dateField = "updated"; // date field for sitemap can be updated or created date.
36
  public $excludeRules = "";
37
+
38
+ public $customPosts = array();
39
  }
40
 
41
  class globalSettings {
code/sitemapBuilder.php CHANGED
@@ -182,6 +182,23 @@ include_once 'renderers.php';
182
 
183
  }
184
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
185
  function getPosts( $sitemapDefaults, $limit = 0){
186
 
187
 
@@ -193,15 +210,8 @@ include_once 'renderers.php';
193
 
194
 
195
  // wp_cache_add($result ->ID, $result , 'posts');
196
-
197
- if ($result->post_type == 'page')
198
- {
199
- $defaults = $sitemapDefaults->pages;
200
- }
201
- else
202
- {
203
- $defaults = $sitemapDefaults->posts;
204
- }
205
 
206
  $exlcude = $this->getMetaValue($result->exclude, $result->tagExclude, $defaults->exclude) ;
207
 
182
 
183
  }
184
 
185
+
186
+ static function postTypeDefault($sitemapDefaults,$name)
187
+ {
188
+ if ($name == 'page')
189
+ {
190
+ return $sitemapDefaults->pages;
191
+ }
192
+ elseif ($name == 'post')
193
+ {
194
+ return $sitemapDefaults->posts;
195
+ }
196
+ else
197
+ {
198
+ return ( isset( $sitemapDefaults->{$name} ) ? $sitemapDefaults->{$name} : $sitemapDefaults->posts );
199
+ }
200
+ }
201
+
202
  function getPosts( $sitemapDefaults, $limit = 0){
203
 
204
 
210
 
211
 
212
  // wp_cache_add($result ->ID, $result , 'posts');
213
+ $defaults = self::postTypeDefault($sitemapDefaults,$result->post_type );
214
+
 
 
 
 
 
 
 
215
 
216
  $exlcude = $this->getMetaValue($result->exclude, $result->tagExclude, $defaults->exclude) ;
217
 
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: XmlSitemapGenerator
3
  Tags: title, xml, rss, sitemap, yandex, metaboxes, google, bing, yahoo, baidu
4
  Donate link: https://XmlSitemapGenerator.org/donate.aspx
5
  Requires at least: 4.0
6
- Tested up to: 4.6
7
- Stable tag: 1.2.3
8
 
9
 
10
  Easy to use, highly configurable WordPress RSS and Google XML Sitemap generator plugin. Compatible with Google, Bing, Baidu, Yandex and more.
@@ -17,13 +17,14 @@ Easy to use, highly configurable WordPress RSS and Google XML Sitemap generator
17
 
18
  * HTML, RSS and Google XML Sitemap formats.
19
  * List all your WordPress Pages, Posts, Archives, Authors, Categories and Tags.
 
20
  * Includes paged links for posts for Archives, Authors, Categories and Tags.
21
  * Set global sitemap default values for priorty and update frequencies.
22
  * Set sitemap value for priority and frequency at the category, tag, post and page level.
23
  * Automatic daily auto ping when you have updated pages / posts in WordPress.
24
  * Add latest pages / posts RSS feed to page header.
25
- * Updates your Robots.txt file with sitemap entries.
26
-
27
 
28
  **New features**
29
 
@@ -39,7 +40,7 @@ Stay in touch via [facebook](https://www.facebook.com/XmlSitemapGenerator) and [
39
  4. Configure tag, category, post and page level settings when adding / editing them.
40
  5. It's that easy!
41
 
42
- ** Having problems? **
43
 
44
  * Check out our [trouble shooting](http://blog.xmlsitemapgenerator.org/2016/06/troubleshooting-your-wordpress-sitemap.html) blog post.
45
 
@@ -54,6 +55,13 @@ Stay in touch via [facebook](https://www.facebook.com/XmlSitemapGenerator) and [
54
 
55
  == Changelog ==
56
 
 
 
 
 
 
 
 
57
  = 1.2.3 =
58
  Release Date: April 5th, 2016
59
 
3
  Tags: title, xml, rss, sitemap, yandex, metaboxes, google, bing, yahoo, baidu
4
  Donate link: https://XmlSitemapGenerator.org/donate.aspx
5
  Requires at least: 4.0
6
+ Tested up to: 4.7
7
+ Stable tag: 1.3.0
8
 
9
 
10
  Easy to use, highly configurable WordPress RSS and Google XML Sitemap generator plugin. Compatible with Google, Bing, Baidu, Yandex and more.
17
 
18
  * HTML, RSS and Google XML Sitemap formats.
19
  * List all your WordPress Pages, Posts, Archives, Authors, Categories and Tags.
20
+ * Support for custom post types and taxonomy
21
  * Includes paged links for posts for Archives, Authors, Categories and Tags.
22
  * Set global sitemap default values for priorty and update frequencies.
23
  * Set sitemap value for priority and frequency at the category, tag, post and page level.
24
  * Automatic daily auto ping when you have updated pages / posts in WordPress.
25
  * Add latest pages / posts RSS feed to page header.
26
+ * Automatically adds sitemap entries to your robots.txt file.
27
+ * Add custom entries to your robots.txt file.
28
 
29
  **New features**
30
 
40
  4. Configure tag, category, post and page level settings when adding / editing them.
41
  5. It's that easy!
42
 
43
+ **Having problems?**
44
 
45
  * Check out our [trouble shooting](http://blog.xmlsitemapgenerator.org/2016/06/troubleshooting-your-wordpress-sitemap.html) blog post.
46
 
55
 
56
  == Changelog ==
57
 
58
+ = 1.3.0 =
59
+ Release Date: September 7th, 2016
60
+
61
+ * New : Support for custom post types and taxonomy
62
+ * New : Add custom entries to you robot.txt file.
63
+
64
+
65
  = 1.2.3 =
66
  Release Date: April 5th, 2016
67
 
www-xml-sitemap-generator-org.php CHANGED
@@ -4,7 +4,7 @@ namespace xmlSitemapGenerator;
4
  Plugin Name: Google XML Sitemap Generator
5
  Plugin URI: https://XmlSitemapGenerator.org
6
  Description: HTML, RSS and Google XML Sitemap generator compatible with Google, Bing, Baidu, Yandex and more.
7
- Version: 1.2.3
8
  Author: XmlSitemapGenerator.org
9
  Author URI: https://XmlSitemapGenerator.org
10
  License: GPL2
4
  Plugin Name: Google XML Sitemap Generator
5
  Plugin URI: https://XmlSitemapGenerator.org
6
  Description: HTML, RSS and Google XML Sitemap generator compatible with Google, Bing, Baidu, Yandex and more.
7
+ Version: 1.3.0
8
  Author: XmlSitemapGenerator.org
9
  Author URI: https://XmlSitemapGenerator.org
10
  License: GPL2