Google XML Sitemap Generator - Version 1.3.5

Version Description

Release Date: February 08 March, 2020

  • New : Tested up to wordpress 5.4.
  • New : Set sitemap values per author/user.
  • New : Include scheduled posts.
  • Fix : Authors variable undefined debug output
  • Fix : Page options do not work for multisite/network
  • Fix : Incorrect sitemap values due to ID collisions
  • Fix : Settings link on network plugins
  • Fix : Google ping url
Download this release

Release Info

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

Code changes from version 1.3.3 to 1.3.5

XmlSitemap.xsl CHANGED
@@ -73,7 +73,7 @@
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>
73
  </table>
74
 
75
  <div id="xsgFooter">Generated by XmlSitemapGenerator.org -
76
+ <a href="https://xmlsitemapgenerator.org/wordpress-sitemap-generator-plugin.aspx" title="WordPress Sitemap Generator Plugin">WordPress XML Sitemap Plugin</a></div>
77
  </div>
78
 
79
  </xsl:template>
code/authorMetaData.php ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace xmlSitemapGenerator;
3
+
4
+ include_once 'dataAccess.php';
5
+
6
+ class authorMetaData
7
+ {
8
+
9
+ public static function addHooks()
10
+ {
11
+
12
+ add_action('edit_user_profile', array( __CLASS__, 'renderEdit' ) );
13
+ add_action( 'profile_update' , array( __CLASS__, 'save_metaData' ), 10, 2);
14
+
15
+ }
16
+
17
+
18
+ static function save_metaData($userId ) {
19
+
20
+ /* Verify the nonce before proceeding. */
21
+ if ( !isset( $_POST['wpXSG_meta_nonce'] ) || !wp_verify_nonce( $_POST['wpXSG_meta_nonce'], basename( __FILE__ ) ) )
22
+ return ;
23
+
24
+
25
+ /* Check if the current user has permission to edit the post. */
26
+ if ( !current_user_can( 'edit_user') )
27
+ return $userId;
28
+
29
+
30
+ $settings = new metaSettings();
31
+
32
+ $settings->id = ( isset( $_POST['wpXSG-metaId'] ) ? $_POST['wpXSG-metaId'] : '0' );
33
+ $settings->itemId = $userId ;
34
+ $settings->itemType = "author";
35
+ $settings->exclude = ( isset( $_POST['wpXSG-Exclude'] ) ? $_POST['wpXSG-Exclude'] : '0' );
36
+ $settings->priority = ( isset( $_POST['wpXSG-Priority'] ) ? $_POST['wpXSG-Priority'] : 'default' );
37
+ $settings->frequency = ( isset( $_POST['wpXSG-Frequency'] ) ? $_POST['wpXSG-Frequency'] : 'default' );
38
+ $settings->inherit = ( isset( $_POST['wpXSG-Inherit'] ) ? $_POST['wpXSG-Inherit'] : 0 );
39
+
40
+ dataAccess::saveMetaItem($settings );
41
+
42
+
43
+
44
+ }
45
+
46
+
47
+
48
+
49
+ static function renderEdit($WP_User )
50
+ {
51
+ $userId = $WP_User->ID;
52
+ self::addHooks();
53
+
54
+ $settings = dataAccess::getMetaItem($userId , "author");
55
+
56
+
57
+ wp_nonce_field( basename( __FILE__ ), 'wpXSG_meta_nonce' );
58
+ ?>
59
+
60
+
61
+ <h3>Sitemap settings : </h3>
62
+
63
+
64
+
65
+
66
+ <table class="form-table">
67
+ <tbody><tr class="form-field form-required term-name-wrap">
68
+ <th scope="row"><label for="name">Sitemap inclusion</label></th>
69
+ <td>
70
+ <select name="wpXSG-Exclude" id="wpXSG-Exclude" ></select>
71
+ <p> Exclude this category/tag from your sitemap.</p>
72
+ </td>
73
+ </tr>
74
+ <tr class="form-field term-slug-wrap">
75
+ <th scope="row"><label for="slug">Relative priority</label></th>
76
+ <td>
77
+ <select name="wpXSG-Priority" id="wpXSG-Priority" ></select>
78
+ <p>Relative priority for this category/tag and related posts.</p>
79
+ </td>
80
+ </tr>
81
+ <tr class="form-field term-description-wrap">
82
+ <th scope="row"><label for="description">Update frequency</label></th>
83
+ <td>
84
+ <select name="wpXSG-Frequency" id="wpXSG-Frequency" ></select>
85
+ <p>Sitemap update frequency for this category/tag.</p>
86
+ </td>
87
+ </tr>
88
+
89
+ </tbody></table>
90
+
91
+ <script type="text/javascript" src="<?php echo xsgPluginPath(); ?>scripts.js"></script>
92
+ <script>
93
+ xsg_populate("wpXSG-Exclude" ,excludeSelect, <?php echo $settings->exclude ?>);
94
+ xsg_populate("wpXSG-Priority" ,prioritySelect, <?php echo $settings->priority ?>);
95
+ xsg_populate("wpXSG-Frequency" ,frequencySelect, <?php echo $settings->frequency ?>);
96
+ xsg_populate("wpXSG-Inherit" ,inheritSelect, <?php echo $settings->inherit ?>);
97
+ </script>
98
+
99
+
100
+ <?php
101
+
102
+ }
103
+
104
+
105
+
106
+
107
+
108
+
109
+ }
110
+
111
+ ?>
code/core.php CHANGED
@@ -5,7 +5,7 @@ namespace xmlSitemapGenerator;
5
  include_once 'settingsModels.php';
6
  include_once 'upgrader.php';
7
 
8
- define ( "XSG_PLUGIN_VERSION" , "1.3.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");
@@ -26,10 +26,9 @@ class core {
26
  }
27
 
28
 
29
-
30
- public static function activatePlugin(){
31
-
32
- self::upgradeDatabase();
33
 
34
  self::addRewriteHooks();
35
  self::activateRewriteRules();
@@ -40,19 +39,64 @@ class core {
40
 
41
  self::updateStatistics("Plugin","Activate", "");
42
 
43
- core::doPing();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
  }
45
 
46
  public static function deactivatePlugin() {
47
  delete_option("wpXMSG_rewrite_done");
48
  self::updateStatistics("Plugin","Deactivate","");
49
  }
50
- public static function initialisePlugin() {
 
 
 
 
 
 
 
 
 
51
 
 
 
 
 
 
 
 
 
 
 
52
 
53
- // NB Network activation will not upgrade a site
54
- // do upgrade will check current upgrade script version and apply as necessary
55
- upgrader::checkUpgrade();
 
56
 
57
  // 2 is required for $file to be populated
58
  add_filter('plugin_row_meta', array(__CLASS__, 'filter_plugin_row_meta'),10,2);
@@ -65,10 +109,12 @@ class core {
65
  include_once 'settings.php';
66
  include_once 'postMetaData.php';
67
  include_once 'categoryMetaData.php';
 
68
 
69
  settings::addHooks();
70
  categoryMetaData::addHooks();
71
  postMetaData::addHooks();
 
72
 
73
  add_action('admin_notices', array(__CLASS__, 'showWarnings'));
74
 
@@ -132,7 +178,7 @@ class core {
132
 
133
  }
134
 
135
- static function upgradeDatabase()
136
  {
137
  try
138
  {
@@ -221,11 +267,13 @@ class core {
221
  $plugin = self::pluginFilename();
222
  if ($file == $plugin)
223
  {
224
- $new_links = array(
225
- '<a href="options-general.php?page=' . XSG_PLUGIN_NAME . '">Settings</a>'
226
- );
227
-
228
- $links = array_merge( $links, $new_links );
 
 
229
  }
230
  return $links;
231
  }
@@ -296,6 +344,7 @@ class core {
296
  'v' => 1,
297
  'tid' => 'UA-679276-7',
298
  'cid' => get_option('wpXSG_MapId'),
 
299
  't' => 'event',
300
  'ec' => $eventCategory,
301
  'ea' => $eventAction,
@@ -308,7 +357,7 @@ class core {
308
  'cd6' => $timeBand
309
  );
310
 
311
- $url = 'https://ssl.google-analytics.com/collect';
312
 
313
  try
314
  {
5
  include_once 'settingsModels.php';
6
  include_once 'upgrader.php';
7
 
8
+ define ( "XSG_PLUGIN_VERSION" , "1.3.5");
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");
26
  }
27
 
28
 
29
+ public static function doSiteActivation()
30
+ {
31
+ self::addDatabaseTable();
 
32
 
33
  self::addRewriteHooks();
34
  self::activateRewriteRules();
39
 
40
  self::updateStatistics("Plugin","Activate", "");
41
 
42
+ core::doPing();
43
+ }
44
+
45
+ function activate_new_blog( $blog_id, $user_id, $domain, $path, $site_id, $meta )
46
+ {
47
+ switch_to_blog($blog_id);
48
+ self::doSiteActivation();
49
+ restore_current_blog();
50
+ }
51
+
52
+ public static function activatePlugin($network_wide){
53
+ if ( is_multisite() && $network_wide ) {
54
+
55
+ global $wpdb;
56
+
57
+ foreach ($wpdb->get_col("SELECT blog_id FROM $wpdb->blogs") as $blog_id) {
58
+ switch_to_blog($blog_id);
59
+ self::doSiteActivation();
60
+ restore_current_blog();
61
+ }
62
+
63
+ } else {
64
+ self::doSiteActivation();
65
+ }
66
+
67
+
68
  }
69
 
70
  public static function deactivatePlugin() {
71
  delete_option("wpXMSG_rewrite_done");
72
  self::updateStatistics("Plugin","Deactivate","");
73
  }
74
+
75
+ public static function checkUpgrade()
76
+ {
77
+ if ( ! function_exists( 'is_plugin_active_for_network' ) ) {
78
+ require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
79
+ }
80
+ $network_wide = is_plugin_active_for_network( 'www-xml-sitemap-generator-org/www-xml-sitemap-generator-org.php') ;
81
+ if ( is_multisite() && $network_wide ) {
82
+
83
+ global $wpdb;
84
 
85
+ foreach ($wpdb->get_col("SELECT blog_id FROM $wpdb->blogs") as $blog_id) {
86
+ switch_to_blog($blog_id);
87
+ upgrader::checkUpgrade();
88
+ restore_current_blog();
89
+ }
90
+ } else {
91
+ upgrader::checkUpgrade();
92
+ }
93
+
94
+ }
95
 
96
+
97
+ public static function initialisePlugin()
98
+ {
99
+
100
 
101
  // 2 is required for $file to be populated
102
  add_filter('plugin_row_meta', array(__CLASS__, 'filter_plugin_row_meta'),10,2);
109
  include_once 'settings.php';
110
  include_once 'postMetaData.php';
111
  include_once 'categoryMetaData.php';
112
+ include_once 'authorMetaData.php';
113
 
114
  settings::addHooks();
115
  categoryMetaData::addHooks();
116
  postMetaData::addHooks();
117
+ authorMetaData::addHooks();
118
 
119
  add_action('admin_notices', array(__CLASS__, 'showWarnings'));
120
 
178
 
179
  }
180
 
181
+ static function addDatabaseTable()
182
  {
183
  try
184
  {
267
  $plugin = self::pluginFilename();
268
  if ($file == $plugin)
269
  {
270
+ $url = $_SERVER['REQUEST_URI'];
271
+ if (strpos( $url, "network") == false) {
272
+ $new_links = array('<a href="options-general.php?page=' . XSG_PLUGIN_NAME . '">settings</a>');
273
+ $links = array_merge( $links, $new_links );
274
+ }
275
+
276
+
277
  }
278
  return $links;
279
  }
344
  'v' => 1,
345
  'tid' => 'UA-679276-7',
346
  'cid' => get_option('wpXSG_MapId'),
347
+ 'aip' => 1,
348
  't' => 'event',
349
  'ec' => $eventCategory,
350
  'ea' => $eventAction,
357
  'cd6' => $timeBand
358
  );
359
 
360
+ $url = 'https://www.google-analytics.com/collect';
361
 
362
  try
363
  {
code/dataAccess.php CHANGED
@@ -141,13 +141,13 @@ class dataAccess {
141
  Max(meta.frequency) as tagFrequency
142
  FROM {$tablemeta} as meta
143
  INNER JOIN {$wpdb->term_relationships} as terms
144
- ON meta.itemId = terms.term_taxonomy_id
145
  WHERE meta.itemType = 'taxonomy' AND meta.inherit = 1
146
 
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
 
@@ -157,7 +157,8 @@ class dataAccess {
157
  $cmd .= " LIMIT {$limit} " ;
158
  }
159
 
160
-
 
161
  $results = self::execute($cmd);
162
 
163
  return $results;
@@ -186,7 +187,7 @@ class dataAccess {
186
  INNER JOIN {$wpdb->posts} as posts ON Relationships.object_id = posts.Id
187
  AND posts.post_status = 'publish' AND posts.post_password = ''
188
  INNER JOIN {$wpdb->term_taxonomy} as tax ON terms.term_id = tax.term_id
189
- LEFT JOIN {$tablemeta} as meta ON terms.term_Id = meta.ItemId
190
  WHERE tax.taxonomy IN ({$taxonomies})
191
  GROUP BY terms.term_id, terms.name, terms.slug, terms.term_group, tax.description, tax.term_taxonomy_id, tax.taxonomy, tax.description, meta.exclude, meta.priority, meta.frequency";
192
 
@@ -202,11 +203,12 @@ class dataAccess {
202
  $date = self::getDateField($date);
203
  $tablemeta = $wpdb->prefix . 'xsg_sitemap_meta';
204
 
205
- $cmd = "SELECT users.ID, users.user_nicename, users.user_login, users.display_name ,
206
  UNIX_TIMESTAMP(MAX(posts.{$date})) AS sitemapDate, Count(posts.ID) as posts
207
  FROM {$wpdb->users} users LEFT JOIN {$wpdb->posts} as posts ON users.Id = posts.post_author
208
  AND posts.post_type = 'post' AND posts.post_status = 'publish' AND posts.post_password = ''
209
- GROUP BY users.user_nicename, users.user_login, users.display_name ";
 
210
 
211
  $results = self::execute($cmd);
212
 
@@ -222,12 +224,12 @@ class dataAccess {
222
 
223
  $date = self::getDateField($date);
224
 
225
- $cmd = "SELECT DISTINCT YEAR({$date}) AS year,MONTH({$date}) AS month,
226
  UNIX_TIMESTAMP(MAX(posts.{$date})) AS sitemapDate, Count(posts.ID) as posts
227
  FROM {$wpdb->posts} as posts
228
  WHERE post_status = 'publish' AND post_type = 'post' AND posts.post_password = ''
229
- GROUP BY YEAR({$date}), MONTH({$date})
230
- ORDER BY {$date} DESC";
231
 
232
  $results = self::execute($cmd);
233
 
141
  Max(meta.frequency) as tagFrequency
142
  FROM {$tablemeta} as meta
143
  INNER JOIN {$wpdb->term_relationships} as terms
144
+ ON meta.itemId = terms.term_taxonomy_id AND meta.itemType = 'posts'
145
  WHERE meta.itemType = 'taxonomy' AND meta.inherit = 1
146
 
147
  GROUP BY terms.object_id
148
  ) as Tag_meta
149
  ON posts.Id = Tag_meta.Post_id
150
+ WHERE (post_status = 'publish' OR post_status = 'future' ) AND (post_type = 'page' OR post_type = 'post' {$postTypes})
151
  AND posts.post_password = '' AND posts.ID <> {$frontPageId}
152
  ORDER BY {$date} DESC ";
153
 
157
  $cmd .= " LIMIT {$limit} " ;
158
  }
159
 
160
+
161
+
162
  $results = self::execute($cmd);
163
 
164
  return $results;
187
  INNER JOIN {$wpdb->posts} as posts ON Relationships.object_id = posts.Id
188
  AND posts.post_status = 'publish' AND posts.post_password = ''
189
  INNER JOIN {$wpdb->term_taxonomy} as tax ON terms.term_id = tax.term_id
190
+ LEFT JOIN {$tablemeta} as meta ON terms.term_Id = meta.ItemId AND meta.itemType = 'taxonomy'
191
  WHERE tax.taxonomy IN ({$taxonomies})
192
  GROUP BY terms.term_id, terms.name, terms.slug, terms.term_group, tax.description, tax.term_taxonomy_id, tax.taxonomy, tax.description, meta.exclude, meta.priority, meta.frequency";
193
 
203
  $date = self::getDateField($date);
204
  $tablemeta = $wpdb->prefix . 'xsg_sitemap_meta';
205
 
206
+ $cmd = "SELECT users.ID, users.user_nicename, users.user_login, users.display_name ,meta.exclude, meta.priority, meta.frequency,
207
  UNIX_TIMESTAMP(MAX(posts.{$date})) AS sitemapDate, Count(posts.ID) as posts
208
  FROM {$wpdb->users} users LEFT JOIN {$wpdb->posts} as posts ON users.Id = posts.post_author
209
  AND posts.post_type = 'post' AND posts.post_status = 'publish' AND posts.post_password = ''
210
+ LEFT JOIN {$tablemeta} as meta ON users.ID = meta.ItemId AND meta.itemType = 'author'
211
+ GROUP BY users.user_nicename, users.user_login, users.display_name, meta.exclude, meta.priority, meta.frequency";
212
 
213
  $results = self::execute($cmd);
214
 
224
 
225
  $date = self::getDateField($date);
226
 
227
+ $cmd = "SELECT DISTINCT YEAR(post_date) AS year,MONTH(post_date) AS month,
228
  UNIX_TIMESTAMP(MAX(posts.{$date})) AS sitemapDate, Count(posts.ID) as posts
229
  FROM {$wpdb->posts} as posts
230
  WHERE post_status = 'publish' AND post_type = 'post' AND posts.post_password = ''
231
+ GROUP BY YEAR(post_date), MONTH(post_date)";
232
+
233
 
234
  $results = self::execute($cmd);
235
 
code/renderers.php CHANGED
@@ -378,7 +378,7 @@ namespace xmlSitemapGenerator;
378
  <div id="header">
379
  <p>
380
  This is an XML Sitemap comaptible with major search engines such as Google, Bing, Baidu and Yandex.<br />
381
- For more information and support go to <a href="https://xmlsitemapgenerator.org/sitemap-generator.aspx">Wordpress Sitemap Generator Plugin</a> homepage. <br />
382
  You can find more information about XML sitemaps on <a href="http://sitemaps.org">sitemaps.org</a>
383
  </p>
384
  </div>
378
  <div id="header">
379
  <p>
380
  This is an XML Sitemap comaptible with major search engines such as Google, Bing, Baidu and Yandex.<br />
381
+ For more information and support go to <a href="https://xmlsitemapgenerator.org/wordpress-sitemap-generator-plugin.aspx">Wordpress Sitemap Generator Plugin</a> homepage. <br />
382
  You can find more information about XML sitemaps on <a href="http://sitemaps.org">sitemaps.org</a>
383
  </p>
384
  </div>
code/settings.php CHANGED
@@ -57,7 +57,7 @@ class settings
57
  $settings->exclude = ( isset( $_POST[$name . 'Exclude'] ) ? $_POST[$name . 'Exclude'] : 0 );
58
  $settings->priority = ( isset( $_POST[$name . 'Priority'] ) ? $_POST[$name . 'Priority'] : 0 );
59
  $settings->frequency = ( isset( $_POST[$name . 'Frequency'] ) ? $_POST[$name . 'Frequency'] : 0 );
60
-
61
 
62
  return $settings;
63
  }
@@ -115,7 +115,7 @@ class settings
115
 
116
  }
117
 
118
- static function RenderDefaultSection($title,$name,$defaults){
119
 
120
  ?>
121
 
@@ -124,6 +124,14 @@ class settings
124
  <td scope="col"><select name="<?php echo $name; ?>Exclude" id="<?php echo $name; ?>Exclude" ></select> </td>
125
  <td scope="col"><select name="<?php echo $name; ?>Priority" id="<?php echo $name; ?>Priority" ></select> </td>
126
  <td scope="col"><select name="<?php echo $name; ?>Frequency" id="<?php echo $name; ?>Frequency" ></select> </td>
 
 
 
 
 
 
 
 
127
  </tr>
128
  <script>
129
  xsg_populate("<?php echo $name; ?>Exclude" ,excludeDefaults, <?php echo $defaults->exclude ?>);
@@ -315,6 +323,7 @@ class settings
315
  <th scope="col">Exclude</th>
316
  <th scope="col">Relative priority</th>
317
  <th scope="col">Update frequency</th>
 
318
  </tr>
319
  </thead>
320
  <tbody id="the-list" >
@@ -322,15 +331,15 @@ class settings
322
 
323
  <?php
324
 
325
- self::RenderDefaultSection("Home page","homepage",$sitemapDefaults->homepage);
326
- self::RenderDefaultSection("Regular page","pages",$sitemapDefaults->pages);
327
- self::RenderDefaultSection("Post page","posts",$sitemapDefaults->posts);
328
- self::RenderDefaultSection("Taxonomy - categories","taxonomyCategories",$sitemapDefaults->taxonomyCategories);
329
- self::RenderDefaultSection("Taxonomy - tags","taxonomyTags",$sitemapDefaults->taxonomyTags);
330
 
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
 
@@ -342,13 +351,14 @@ class settings
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
 
57
  $settings->exclude = ( isset( $_POST[$name . 'Exclude'] ) ? $_POST[$name . 'Exclude'] : 0 );
58
  $settings->priority = ( isset( $_POST[$name . 'Priority'] ) ? $_POST[$name . 'Priority'] : 0 );
59
  $settings->frequency = ( isset( $_POST[$name . 'Frequency'] ) ? $_POST[$name . 'Frequency'] : 0 );
60
+ $settings->scheduled = ( isset( $_POST[$name . 'Scheduled'] ) ? 1 : 0 );
61
 
62
  return $settings;
63
  }
115
 
116
  }
117
 
118
+ static function RenderDefaultSection($title,$name,$defaults,$scheduled){
119
 
120
  ?>
121
 
124
  <td scope="col"><select name="<?php echo $name; ?>Exclude" id="<?php echo $name; ?>Exclude" ></select> </td>
125
  <td scope="col"><select name="<?php echo $name; ?>Priority" id="<?php echo $name; ?>Priority" ></select> </td>
126
  <td scope="col"><select name="<?php echo $name; ?>Frequency" id="<?php echo $name; ?>Frequency" ></select> </td>
127
+ <?php if ($scheduled) { ?>
128
+ <td scope="col"><input type="checkbox" name="<?php echo $name; ?>Scheduled" id="<?php echo $name; ?>Scheduled"
129
+ <?php if ($defaults->scheduled) { echo 'checked="checked"';} ?>
130
+ ></input> </td>
131
+ <?php }
132
+ else
133
+ { echo '<td scope="col"></td>';}
134
+ ?>
135
  </tr>
136
  <script>
137
  xsg_populate("<?php echo $name; ?>Exclude" ,excludeDefaults, <?php echo $defaults->exclude ?>);
323
  <th scope="col">Exclude</th>
324
  <th scope="col">Relative priority</th>
325
  <th scope="col">Update frequency</th>
326
+ <th scope="col">Include scheduled</th>
327
  </tr>
328
  </thead>
329
  <tbody id="the-list" >
331
 
332
  <?php
333
 
334
+ self::RenderDefaultSection("Home page","homepage",$sitemapDefaults->homepage, false);
335
+ self::RenderDefaultSection("Regular page","pages",$sitemapDefaults->pages, true);
336
+ self::RenderDefaultSection("Post page","posts",$sitemapDefaults->posts, true);
337
+ self::RenderDefaultSection("Taxonomy - categories","taxonomyCategories",$sitemapDefaults->taxonomyCategories, false);
338
+ self::RenderDefaultSection("Taxonomy - tags","taxonomyTags",$sitemapDefaults->taxonomyTags, false);
339
 
340
+ self::RenderDefaultSection("Archive - recent","recentArchive",$sitemapDefaults->recentArchive, false);
341
+ self::RenderDefaultSection("Archive - old","oldArchive",$sitemapDefaults->oldArchive, false);
342
+ self::RenderDefaultSection("Authors","authors",$sitemapDefaults->authors, false);
343
  ?>
344
  </table>
345
 
351
  <th scope="col">Exclude</th>
352
  <th scope="col">Relative priority</th>
353
  <th scope="col">Update frequency</th>
354
+ <th scope="col">Include scheduled</th>
355
  </tr>
356
  </thead>
357
 
358
  <?php
359
  foreach ( self::getPostTypes() as $post_type )
360
  {
361
+ self::RenderDefaultSection($post_type,$post_type, self::postTypeDefault($sitemapDefaults,$post_type), true);
362
  }
363
  ?>
364
 
code/settingsModels.php CHANGED
@@ -62,7 +62,7 @@ class metaSettings
62
  public $priority = 1;
63
  public $frequency = 1;
64
  public $inherit = 0;
65
-
66
 
67
  }
68
 
62
  public $priority = 1;
63
  public $frequency = 1;
64
  public $inherit = 0;
65
+ public $scheduled = 0;
66
 
67
  }
68
 
code/sitemapBuilder.php CHANGED
@@ -140,6 +140,15 @@ include_once 'renderers.php';
140
  return esc_url_raw( $result );
141
  }
142
 
 
 
 
 
 
 
 
 
 
143
  function getMetaValue($postValue,$tagValue,$default)
144
  {
145
 
@@ -203,7 +212,7 @@ include_once 'renderers.php';
203
 
204
 
205
  $results = dataAccess::getPages( $sitemapDefaults->dateField , $limit);
206
-
207
  if ($results ) {
208
 
209
  foreach( $results as $result ) {
@@ -212,37 +221,33 @@ include_once 'renderers.php';
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
 
218
- if ($exlcude != 2)
219
- {
220
- $pageUrl = get_permalink($result);
 
221
 
222
- if ($this->isIncluded($pageUrl,$sitemapDefaults->excludeRules ))
223
- {
224
-
225
- $url = new mapItem();
226
- $url->location = $pageUrl ;
227
- $url->title = get_the_title( $result ); //$result->post_title;
228
- $url->description = $result->post_excerpt;
229
- $url->modified = $result->sitemapDate ;
230
 
231
- $url->priority = $this->getMetaValue($result->priority,$result->tagPriority, $defaults->priority) ;
232
- $url->frequency = $this->getMetaValue($result->frequency,$result->tagFrequency,$defaults->frequency) ;
233
-
234
- $this->addUrls(0, $url);
235
-
236
- }
237
- }
 
 
 
238
  }
239
  }
240
-
241
  }
242
 
243
  function getTaxonomy($sitemapDefaults)
244
  {
245
-
246
  $results = dataAccess::getTaxonomy( $sitemapDefaults->dateField );
247
 
248
 
@@ -289,6 +294,8 @@ include_once 'renderers.php';
289
  function getAuthors($sitemapDefaults)
290
  {
291
 
 
 
292
  $results = dataAccess::getAuthors($sitemapDefaults->dateField );
293
 
294
 
@@ -315,10 +322,10 @@ include_once 'renderers.php';
315
  $url = new mapItem();
316
  $url->location = $pageUrl;
317
  $url->title = $result->display_name ;
318
- // $url->description = $result->description;
319
  $url->modified = $result->sitemapDate ;
320
- $url->priority = $defaults->priority ;
321
- $url->frequency = $defaults->frequency ;
322
 
323
  $this->addUrls($result->posts, $url);
324
  }
@@ -330,6 +337,7 @@ include_once 'renderers.php';
330
  function getArchive($sitemapDefaults)
331
  {
332
 
 
333
  $results = dataAccess::getArchives($sitemapDefaults->dateField );
334
 
335
  if ($results ) {
@@ -363,7 +371,7 @@ include_once 'renderers.php';
363
  $url = new mapItem();
364
  $url->location = $pageUrl;
365
  $url->title = date('F', strtotime("2012-$result->month-01")) . " | " . $result->year ;
366
- // $url->description = $result->description;
367
  $url->modified = $result->sitemapDate ;
368
  $url->priority = $defaults->priority ;
369
  $url->frequency = $defaults->frequency ;
@@ -417,6 +425,7 @@ include_once 'renderers.php';
417
  $this->getTaxonomy($settings);
418
  $this->getAuthors($settings);
419
  $this->getArchive($settings);
 
420
  }
421
 
422
  function getNewUrls()
140
  return esc_url_raw( $result );
141
  }
142
 
143
+ function isExcluded($value)
144
+ {
145
+ if (isset($value))
146
+ {
147
+ if (value==2) {return true;}
148
+ }
149
+ return false;
150
+ }
151
+
152
  function getMetaValue($postValue,$tagValue,$default)
153
  {
154
 
212
 
213
 
214
  $results = dataAccess::getPages( $sitemapDefaults->dateField , $limit);
215
+ $temp = "";
216
  if ($results ) {
217
 
218
  foreach( $results as $result ) {
221
  // wp_cache_add($result ->ID, $result , 'posts');
222
  $defaults = self::postTypeDefault($sitemapDefaults,$result->post_type );
223
 
 
224
  $exlcude = $this->getMetaValue($result->exclude, $result->tagExclude, $defaults->exclude) ;
225
 
226
+ if ($exlcude == 2) {$temp = $temp . " - excluded"; continue;}
227
+ if ( $result->post_status =='future' && $defaults->scheduled == 0) { continue;}
228
+
229
+ $pageUrl = get_permalink($result);
230
 
231
+ if (!($this->isIncluded($pageUrl,$sitemapDefaults->excludeRules ))) {continue;}
 
 
 
 
 
 
 
232
 
233
+ $url = new mapItem();
234
+ $url->location = $pageUrl ;
235
+ $url->title = get_the_title( $result ); //$result->post_title;
236
+ $url->description = $result->post_excerpt;
237
+ $url->modified = $result->sitemapDate ;
238
+ $url->priority = $this->getMetaValue($result->priority,$result->tagPriority, $defaults->priority) ;
239
+ $url->frequency = $this->getMetaValue($result->frequency,$result->tagFrequency,$defaults->frequency) ;
240
+
241
+ $this->addUrls(0, $url);
242
+
243
  }
244
  }
245
+
246
  }
247
 
248
  function getTaxonomy($sitemapDefaults)
249
  {
250
+
251
  $results = dataAccess::getTaxonomy( $sitemapDefaults->dateField );
252
 
253
 
294
  function getAuthors($sitemapDefaults)
295
  {
296
 
297
+
298
+
299
  $results = dataAccess::getAuthors($sitemapDefaults->dateField );
300
 
301
 
322
  $url = new mapItem();
323
  $url->location = $pageUrl;
324
  $url->title = $result->display_name ;
325
+ $url->description = "";
326
  $url->modified = $result->sitemapDate ;
327
+ $url->priority = $this->getMetaValue(null,$result->priority,$defaults->priority) ;
328
+ $url->frequency = $this->getMetaValue(null,$result->frequency,$defaults->frequency) ;
329
 
330
  $this->addUrls($result->posts, $url);
331
  }
337
  function getArchive($sitemapDefaults)
338
  {
339
 
340
+
341
  $results = dataAccess::getArchives($sitemapDefaults->dateField );
342
 
343
  if ($results ) {
371
  $url = new mapItem();
372
  $url->location = $pageUrl;
373
  $url->title = date('F', strtotime("2012-$result->month-01")) . " | " . $result->year ;
374
+ $url->description = "";
375
  $url->modified = $result->sitemapDate ;
376
  $url->priority = $defaults->priority ;
377
  $url->frequency = $defaults->frequency ;
425
  $this->getTaxonomy($settings);
426
  $this->getAuthors($settings);
427
  $this->getArchive($settings);
428
+
429
  }
430
 
431
  function getNewUrls()
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: XmlSitemapGenerator
3
  Tags: google, google sitemaps, seo, xml sitemap
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.3
8
 
9
  Improve your websites SEO with a comprehensive, easy to use RSS and XML sitemap plugin. Compatible with Google, Bing, Baidu, Yandex and more.
10
 
@@ -98,7 +98,7 @@ Simply go to the Reading Settings page and ensure "Discourage search engines fro
98
 
99
  You should now be up and running, but you may also want to :
100
 
101
- 5. Change the global defaults for pages, posts, etc.
102
  4. Configure tag, category, post and page level settings when adding / editing them.
103
 
104
  **Still having problems?**
@@ -116,6 +116,23 @@ You should now be up and running, but you may also want to :
116
 
117
  == Changelog ==
118
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
119
  = 1.3.2 and 1.3.3 =
120
  Release Date: February 3rd, 2017
121
 
3
  Tags: google, google sitemaps, seo, xml sitemap
4
  Donate link: https://XmlSitemapGenerator.org/donate.aspx
5
  Requires at least: 4.0
6
+ Tested up to: 5.4.0
7
+ Stable tag: 1.3.5
8
 
9
  Improve your websites SEO with a comprehensive, easy to use RSS and XML sitemap plugin. Compatible with Google, Bing, Baidu, Yandex and more.
10
 
98
 
99
  You should now be up and running, but you may also want to :
100
 
101
+ 5. Change the sitemap global defaults for pages, posts, etc.
102
  4. Configure tag, category, post and page level settings when adding / editing them.
103
 
104
  **Still having problems?**
116
 
117
  == Changelog ==
118
 
119
+ = 1.3.5 =
120
+ Release Date: February 08 March, 2020
121
+
122
+ * New : Tested up to wordpress 5.4.
123
+ * New : Set sitemap values per author/user.
124
+ * New : Include scheduled posts.
125
+ * Fix : Authors variable undefined debug output
126
+ * Fix : Page options do not work for multisite/network
127
+ * Fix : Incorrect sitemap values due to ID collisions
128
+ * Fix : Settings link on network plugins
129
+ * Fix : Google ping url
130
+
131
+ = 1.3.4 =
132
+ Release Date: February 28th, 2017
133
+
134
+ * Fix : Archive reporting incorrect number of pages
135
+
136
  = 1.3.2 and 1.3.3 =
137
  Release Date: February 3rd, 2017
138
 
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.3.3
8
  Author: XmlSitemapGenerator.org
9
  Author URI: https://XmlSitemapGenerator.org
10
  License: GPL2
@@ -25,8 +25,12 @@ function xsgPluginPath() {
25
 
26
  if(defined('ABSPATH') && defined('WPINC')) {
27
  add_action("init", 'xmlSitemapGenerator\core::initialisePlugin');
 
28
  register_activation_hook(__FILE__, 'xmlSitemapGenerator\core::activatePlugin');
29
 
 
 
 
30
  // call this here because other plugins in the init might flush.
31
  core::addQueryVariableHooks();
32
  core::addRewriteHooks();
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.5
8
  Author: XmlSitemapGenerator.org
9
  Author URI: https://XmlSitemapGenerator.org
10
  License: GPL2
25
 
26
  if(defined('ABSPATH') && defined('WPINC')) {
27
  add_action("init", 'xmlSitemapGenerator\core::initialisePlugin');
28
+
29
  register_activation_hook(__FILE__, 'xmlSitemapGenerator\core::activatePlugin');
30
 
31
+ add_action( 'plugins_loaded', 'xmlSitemapGenerator\core::checkUpgrade' );
32
+ add_action( 'wpmu_new_blog', 'xmlSitemapGenerator\core::activate_new_blog' );
33
+
34
  // call this here because other plugins in the init might flush.
35
  core::addQueryVariableHooks();
36
  core::addRewriteHooks();