Google XML Sitemap Generator - Version 1.2.1

Version Description

Release Date: September 23rd, 2015

  • Fix : Unexpected out put when activating
  • Fix : Missing Hourly update frequency
  • Fix : PHP warnings in sitemaps when in debug mode
Download this release

Release Info

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

Code changes from version 1.2 to 1.2.1

code/core.php CHANGED
@@ -3,7 +3,7 @@
3
  namespace xmlSitemapGenerator;
4
 
5
  include_once 'settingsModels.php';
6
-
7
 
8
  define ( "PLUGIN_NAME" , "www-xml-sitemap-generator-org");
9
  define ( "RULES_VERSION" , "0003"); // increment this if the rewrite rules ever change.
@@ -47,7 +47,9 @@ class core {
47
 
48
 
49
  public static function activatePlugin(){
 
50
  self::upgradeDatabase();
 
51
  self::addRewriteHooks();
52
  self::activateRewriteRules();
53
  flush_rewrite_rules();
@@ -66,19 +68,23 @@ class core {
66
  }
67
  public static function initialisePlugin() {
68
 
69
- // 2 is required for $file to be populated
70
 
 
 
 
 
 
71
  add_filter('plugin_row_meta', array(__CLASS__, 'filter_plugin_row_meta'),10,2);
72
  add_action('do_robots', array(__CLASS__, 'addRobotLinks'), 100, 0);
73
  add_action('wp_head', array(__CLASS__, 'addRssLink'),100);
74
 
75
-
76
  // only include admin files when necessary.
77
  if (is_admin())
78
  {
79
  include_once 'settings.php';
80
  include_once 'postMetaData.php';
81
  include_once 'categoryMetaData.php';
 
82
  settings::addHooks();
83
  categoryMetaData::addHooks();
84
  postMetaData::addHooks();
@@ -101,22 +107,23 @@ class core {
101
  {
102
  add_action('wp_loaded', array(__CLASS__, 'activateRewriteRules'), 99999, 1);
103
  }
 
104
  }
105
 
106
- function doPing()
107
  {
108
  include_once 'pinger.php';
109
  $globalSettings = get_option( "wpXSG_global" , new globalSettings() );
110
 
111
  if ($globalSettings->pingSitemap == true)
112
  {
113
- $sitemapDefaults = get_option( "wpXSG_sitemapDefaults" , new sitemapDefaults() );
114
  pinger::doAutoPings($sitemapDefaults->dateField);
115
  }
116
 
117
  }
118
 
119
- function upgradeDatabase()
120
  {
121
  try
122
  {
@@ -160,7 +167,7 @@ class core {
160
  echo "\nAllow: /htmlsitemap.htm";
161
  }
162
  }
163
- public function addRssLink()
164
  {
165
  $globalSettings = get_option( "wpXSG_global" , new globalSettings() );
166
  if($globalSettings->addRssToHead == true)
@@ -218,7 +225,7 @@ class core {
218
  else
219
  { return "Log empty";}
220
  }
221
- function statusUpdate( $statusMessage)
222
  {
223
 
224
  $statusMessage = strip_tags($statusMessage);
@@ -231,7 +238,7 @@ class core {
231
 
232
  update_option('xmsg_Log', $array);
233
  }
234
- function doRequest($url) {
235
 
236
  $response = wp_remote_get($url );
237
 
3
  namespace xmlSitemapGenerator;
4
 
5
  include_once 'settingsModels.php';
6
+ include_once 'upgrader.php';
7
 
8
  define ( "PLUGIN_NAME" , "www-xml-sitemap-generator-org");
9
  define ( "RULES_VERSION" , "0003"); // increment this if the rewrite rules ever change.
47
 
48
 
49
  public static function activatePlugin(){
50
+
51
  self::upgradeDatabase();
52
+
53
  self::addRewriteHooks();
54
  self::activateRewriteRules();
55
  flush_rewrite_rules();
68
  }
69
  public static function initialisePlugin() {
70
 
 
71
 
72
+ // NB Network activation will not upgrade a site
73
+ // do upgrade will check current upgrade script version and apply as necessary
74
+ upgrader::checkUpgrade();
75
+
76
+ // 2 is required for $file to be populated
77
  add_filter('plugin_row_meta', array(__CLASS__, 'filter_plugin_row_meta'),10,2);
78
  add_action('do_robots', array(__CLASS__, 'addRobotLinks'), 100, 0);
79
  add_action('wp_head', array(__CLASS__, 'addRssLink'),100);
80
 
 
81
  // only include admin files when necessary.
82
  if (is_admin())
83
  {
84
  include_once 'settings.php';
85
  include_once 'postMetaData.php';
86
  include_once 'categoryMetaData.php';
87
+
88
  settings::addHooks();
89
  categoryMetaData::addHooks();
90
  postMetaData::addHooks();
107
  {
108
  add_action('wp_loaded', array(__CLASS__, 'activateRewriteRules'), 99999, 1);
109
  }
110
+
111
  }
112
 
113
+ static function doPing()
114
  {
115
  include_once 'pinger.php';
116
  $globalSettings = get_option( "wpXSG_global" , new globalSettings() );
117
 
118
  if ($globalSettings->pingSitemap == true)
119
  {
120
+ $sitemapDefaults = get_option( "wpXSG_sitemapDefaults" , new sitemapDefaults() );$sitemapDefaults = get_option( "wpXSG_sitemapDefaults" , new sitemapDefaults() );
121
  pinger::doAutoPings($sitemapDefaults->dateField);
122
  }
123
 
124
  }
125
 
126
+ static function upgradeDatabase()
127
  {
128
  try
129
  {
167
  echo "\nAllow: /htmlsitemap.htm";
168
  }
169
  }
170
+ public static function addRssLink()
171
  {
172
  $globalSettings = get_option( "wpXSG_global" , new globalSettings() );
173
  if($globalSettings->addRssToHead == true)
225
  else
226
  { return "Log empty";}
227
  }
228
+ static function statusUpdate( $statusMessage)
229
  {
230
 
231
  $statusMessage = strip_tags($statusMessage);
238
 
239
  update_option('xmsg_Log', $array);
240
  }
241
+ static function doRequest($url) {
242
 
243
  $response = wp_remote_get($url );
244
 
code/dataAccess.php CHANGED
@@ -173,7 +173,7 @@ class dataAccess {
173
  $date = self::getDateField($date);
174
  $tablemeta = $wpdb->prefix . 'xsg_sitemap_meta';
175
 
176
- $cmd = "SELECT users.user_nicename, users.user_login, users.display_name ,
177
  UNIX_TIMESTAMP(MAX(posts.{$date})) AS sitemapDate, Count(posts.ID) as posts
178
  FROM {$wpdb->users} users LEFT JOIN {$wpdb->posts} as posts ON users.Id = posts.post_author
179
  AND posts.post_type = 'post' AND posts.post_status = 'publish' AND posts.post_password = ''
173
  $date = self::getDateField($date);
174
  $tablemeta = $wpdb->prefix . 'xsg_sitemap_meta';
175
 
176
+ $cmd = "SELECT users.ID, users.user_nicename, users.user_login, users.display_name ,
177
  UNIX_TIMESTAMP(MAX(posts.{$date})) AS sitemapDate, Count(posts.ID) as posts
178
  FROM {$wpdb->users} users LEFT JOIN {$wpdb->posts} as posts ON users.Id = posts.post_author
179
  AND posts.post_type = 'post' AND posts.post_status = 'publish' AND posts.post_password = ''
code/pinger.php CHANGED
@@ -7,7 +7,7 @@ include_once 'dataAccess.php';
7
  class pinger
8
  {
9
 
10
- public function doPing($tag = "manual")
11
  {
12
  $sitemapUrl = urlencode( get_bloginfo( 'url' ) . '/xmlsitemap.xml');
13
  $url = "http://www.google.com/webmasters/sitemaps/ping?sitemap=" . $sitemapUrl;
@@ -21,7 +21,7 @@ class pinger
21
  update_option('xmsg_LastPing', time());
22
  }
23
 
24
- public function doManualPing()
25
  {
26
  $startTime = microtime(true) ;
27
  self::doPing("Manual");
@@ -29,7 +29,7 @@ class pinger
29
  core::updateStatistics("Ping", "Manual", $time);
30
 
31
  }
32
- public function doAutoPings($date)
33
  {
34
  $startTime = microtime(true) ;
35
  $lasModified = dataAccess::getLastModified($date);
7
  class pinger
8
  {
9
 
10
+ public static function doPing($tag = "manual")
11
  {
12
  $sitemapUrl = urlencode( get_bloginfo( 'url' ) . '/xmlsitemap.xml');
13
  $url = "http://www.google.com/webmasters/sitemaps/ping?sitemap=" . $sitemapUrl;
21
  update_option('xmsg_LastPing', time());
22
  }
23
 
24
+ public static function doManualPing()
25
  {
26
  $startTime = microtime(true) ;
27
  self::doPing("Manual");
29
  core::updateStatistics("Ping", "Manual", $time);
30
 
31
  }
32
+ public static function doAutoPings($date)
33
  {
34
  $startTime = microtime(true) ;
35
  $lasModified = dataAccess::getLastModified($date);
code/renderers.php CHANGED
@@ -114,6 +114,9 @@ namespace xmlSitemapGenerator;
114
  return "daily";
115
  break;
116
  case 7:
 
 
 
117
  return "always";
118
  break;
119
  default:
114
  return "daily";
115
  break;
116
  case 7:
117
+ return "hourly";
118
+ break;
119
+ case 8:
120
  return "always";
121
  break;
122
  default:
code/settings.php CHANGED
@@ -130,16 +130,12 @@ class settings
130
 
131
  <h2>Google XML Sitemap Generator</h2>
132
 
133
-
134
- <p style="color:#B80000"><strong>This is the initial release of this plugin and recommend you use it with
135
- caution, especially with important live production websites.
136
- As always you should regularly backup your website.</p> <p style="color:#B80000">Please
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
  <p>Here you can edit your admin settings and defaults.</p>
141
  <p>You can override categories, tags, pages and posts when adding and editing them.</p>
142
-
 
143
 
144
 
145
  <div id="poststuff" class="metabox-holder has-right-sidebar">
130
 
131
  <h2>Google XML Sitemap Generator</h2>
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">
code/sitemapBuilder.php CHANGED
@@ -299,16 +299,16 @@ include_once 'renderers.php';
299
  {
300
  $pageUrl = get_author_posts_url($result->ID, $result->user_nicename);
301
 
302
- if ($this->isIncluded($pageUrl,$settings->excludeRules ))
303
  {
304
 
305
  $url = new mapItem();
306
  $url->location = $pageUrl;
307
  $url->title = $result->display_name ;
308
- $url->description = $result->description;
309
  $url->modified = $result->sitemapDate ;
310
- $url->priority = $this->getMetaValue(null,$result->priority,$defaults->priority) ;
311
- $url->frequency = $this->getMetaValue(null,$result->frequency,$defaults->frequency) ;
312
 
313
  $this->addUrls($result->posts, $url);
314
  }
@@ -338,7 +338,7 @@ include_once 'renderers.php';
338
  $defaults = $sitemapDefaults->oldArchive;
339
  }
340
 
341
- $exlcude = $this->getMetaValue(null, $result->exclude, $defaults->exclude) ;
342
  $posts = $result->posts;
343
 
344
  $pageUrl = get_month_link( $result->year , $result->month) ;
@@ -347,16 +347,16 @@ include_once 'renderers.php';
347
  if ($exlcude != 2)
348
  {
349
 
350
- if ($this->isIncluded($pageUrl,$settings->excludeRules ))
351
  {
352
 
353
  $url = new mapItem();
354
  $url->location = $pageUrl;
355
  $url->title = date('F', strtotime("2012-$result->month-01")) . " | " . $result->year ;
356
- $url->description = $result->description;
357
  $url->modified = $result->sitemapDate ;
358
- $url->priority = $this->getMetaValue($result->priority,$result->tagPriority, $defaults->priority) ;
359
- $url->frequency = $this->getMetaValue($result->frequency,$result->tagFrequency,$defaults->frequency) ;
360
 
361
  $this->addUrls($result->posts, $url);
362
 
@@ -373,11 +373,14 @@ include_once 'renderers.php';
373
 
374
  $defaults = $sitemapDefaults->homepage;
375
  $pageUrl = get_bloginfo( 'url' );
 
 
 
376
 
377
  if ($exlcude != 2)
378
  {
379
 
380
- if ($this->isIncluded($pageUrl,$settings->excludeRules ))
381
  {
382
 
383
  $url = new mapItem();
@@ -388,7 +391,7 @@ include_once 'renderers.php';
388
  $url->priority = $defaults->priority ;
389
  $url->frequency = $defaults->frequency ;
390
 
391
- $this->addUrls($result->posts, $url);
392
 
393
  }
394
  }
299
  {
300
  $pageUrl = get_author_posts_url($result->ID, $result->user_nicename);
301
 
302
+ if ($this->isIncluded($pageUrl,$sitemapDefaults->excludeRules ))
303
  {
304
 
305
  $url = new mapItem();
306
  $url->location = $pageUrl;
307
  $url->title = $result->display_name ;
308
+ // $url->description = $result->description;
309
  $url->modified = $result->sitemapDate ;
310
+ $url->priority = $defaults->priority ;
311
+ $url->frequency = $defaults->frequency ;
312
 
313
  $this->addUrls($result->posts, $url);
314
  }
338
  $defaults = $sitemapDefaults->oldArchive;
339
  }
340
 
341
+ $exlcude = $defaults->exclude ;
342
  $posts = $result->posts;
343
 
344
  $pageUrl = get_month_link( $result->year , $result->month) ;
347
  if ($exlcude != 2)
348
  {
349
 
350
+ if ($this->isIncluded($pageUrl,$sitemapDefaults->excludeRules ))
351
  {
352
 
353
  $url = new mapItem();
354
  $url->location = $pageUrl;
355
  $url->title = date('F', strtotime("2012-$result->month-01")) . " | " . $result->year ;
356
+ // $url->description = $result->description;
357
  $url->modified = $result->sitemapDate ;
358
+ $url->priority = $defaults->priority ;
359
+ $url->frequency = $defaults->frequency ;
360
 
361
  $this->addUrls($result->posts, $url);
362
 
373
 
374
  $defaults = $sitemapDefaults->homepage;
375
  $pageUrl = get_bloginfo( 'url' );
376
+
377
+
378
+ $exlcude = $defaults->exclude ;
379
 
380
  if ($exlcude != 2)
381
  {
382
 
383
+ if ($this->isIncluded($pageUrl,$sitemapDefaults->excludeRules ))
384
  {
385
 
386
  $url = new mapItem();
391
  $url->priority = $defaults->priority ;
392
  $url->frequency = $defaults->frequency ;
393
 
394
+ $this->addUrls(0, $url);
395
 
396
  }
397
  }
code/upgrader.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace xmlSitemapGenerator;
4
+
5
+
6
+ class upgrader
7
+ {
8
+
9
+
10
+
11
+
12
+ public static function checkUpgrade()
13
+ {
14
+ $current_update = 00001;
15
+ $installed_Update = get_option( "xmsg_Update" , 00000 );
16
+
17
+ if ($installed_Update < $current_update )
18
+ {
19
+ self::runScripts($installed_Update);
20
+ update_option( "xmsg_Update", $current_update , true);
21
+ }
22
+ }
23
+
24
+ public static function runScripts($installed_Update)
25
+ {
26
+ global $wpdb;
27
+ $tablemeta = $wpdb->prefix . 'xsg_sitemap_meta';
28
+ if ($installed_Update < 00001)
29
+ {
30
+ $cmd = "UPDATE {$tablemeta} SET frequency = 8 WHERE frequency = 7";
31
+ $wpdb->query($cmd);
32
+ }
33
+
34
+ }
35
+
36
+
37
+ }
38
+ ?>
readme.txt CHANGED
@@ -4,7 +4,7 @@ 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.3
7
- Stable tag: 1.2
8
 
9
 
10
  Easy to use, highly configurable WordPress RSS and Google XML Sitemap generator plugin. Compatible with Google, Bing, Baidu, Yandex and more.
@@ -51,6 +51,13 @@ Stay in touch via [facebook](https://www.facebook.com/XmlSitemapGenerator) and [
51
 
52
  == Changelog ==
53
 
 
 
 
 
 
 
 
54
  = 1.2 =
55
  Release Date: September 2nd, 2015
56
 
4
  Donate link: https://XmlSitemapGenerator.org/donate.aspx
5
  Requires at least: 4.0
6
  Tested up to: 4.3
7
+ Stable tag: 1.2.1
8
 
9
 
10
  Easy to use, highly configurable WordPress RSS and Google XML Sitemap generator plugin. Compatible with Google, Bing, Baidu, Yandex and more.
51
 
52
  == Changelog ==
53
 
54
+ = 1.2.1 =
55
+ Release Date: September 23rd, 2015
56
+
57
+ * Fix : Unexpected out put when activating
58
+ * Fix : Missing Hourly update frequency
59
+ * Fix : PHP warnings in sitemaps when in debug mode
60
+
61
  = 1.2 =
62
  Release Date: September 2nd, 2015
63
 
scripts.js CHANGED
@@ -19,10 +19,10 @@
19
 
20
  var excludeDefaults = [[2,"exclude"] , [3,"include"] ];
21
  var priorityDefaults = [[0,"none"], [2,"0.0"], [3,"0.1"], [4,"0.2"], [5,"0.3"], [6,"0.4"] , [7,"0.5"] , [8,"0.6"] , [9,"0.7"] , [10,"0.8"] , [11,"0.9"], [12,"1.0"] ];
22
- var frequencyDefaults = [[0,"none"], [7,"always"], [6,"daily"], [5,"weekly"], [4,"monthly"], [3,"yearly"] , [2,"never"] ];
23
 
24
  var inheritSelect = [ [0,"Don't inherit"], [1,"Inherit"] ];
25
  var excludeSelect = [ [1,"default"], [2,"exclude"] , [3,"include"] ];
26
  var prioritySelect = [[0,"none"],[1, "default"], [2,"0.0"], [3,"0.1"], [4,"0.2"], [5,"0.3"], [6,"0.4"] , [7,"0.5"] , [8,"0.6"] , [9,"0.7"] , [10,"0.8"] , [11,"0.9"], [12,"1.0"] ];
27
- var frequencySelect = [[0,"none"],[1, "default"], [7,"always"], [6,"daily"], [5,"weekly"], [4,"monthly"], [3,"yearly"] , [2,"never"] ];
28
 
19
 
20
  var excludeDefaults = [[2,"exclude"] , [3,"include"] ];
21
  var priorityDefaults = [[0,"none"], [2,"0.0"], [3,"0.1"], [4,"0.2"], [5,"0.3"], [6,"0.4"] , [7,"0.5"] , [8,"0.6"] , [9,"0.7"] , [10,"0.8"] , [11,"0.9"], [12,"1.0"] ];
22
+ var frequencyDefaults = [[0,"none"], [8,"always"], [7,"hourly"], [6,"daily"], [5,"weekly"], [4,"monthly"], [3,"yearly"] , [2,"never"] ];
23
 
24
  var inheritSelect = [ [0,"Don't inherit"], [1,"Inherit"] ];
25
  var excludeSelect = [ [1,"default"], [2,"exclude"] , [3,"include"] ];
26
  var prioritySelect = [[0,"none"],[1, "default"], [2,"0.0"], [3,"0.1"], [4,"0.2"], [5,"0.3"], [6,"0.4"] , [7,"0.5"] , [8,"0.6"] , [9,"0.7"] , [10,"0.8"] , [11,"0.9"], [12,"1.0"] ];
27
+ var frequencySelect = [[0,"none"],[1, "default"], [8,"always"], [7,"hourly"], [6,"daily"], [5,"weekly"], [4,"monthly"], [3,"yearly"] , [2,"never"] ];
28
 
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
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.2.1
8
  Author: XmlSitemapGenerator.org
9
  Author URI: https://XmlSitemapGenerator.org
10
  License: GPL2