Google XML Sitemaps - Version 3.1.7

Version Description

Download this release

Release Info

Developer arnee
Plugin Icon 128x128 Google XML Sitemaps
Version 3.1.7
Comparing to
See all releases

Code changes from version 3.1.6 to 3.1.7

Files changed (5) hide show
  1. documentation.txt +1 -1
  2. readme.txt +3 -3
  3. sitemap-core.php +67 -3
  4. sitemap-ui.php +33 -2
  5. sitemap.php +2 -2
documentation.txt CHANGED
@@ -213,7 +213,7 @@
213
  Improved handling of missing sitemaps files if WP was moved to another location
214
  2009-08-31 3.1.6 Fixed PHP error "Only variables can be passed by reference"
215
  Fixed wrong URLS of multi-page posts (Thanks artstorm!)
216
-
217
 
218
  Maybe Todo:
219
  ==============================================================================
213
  Improved handling of missing sitemaps files if WP was moved to another location
214
  2009-08-31 3.1.6 Fixed PHP error "Only variables can be passed by reference"
215
  Fixed wrong URLS of multi-page posts (Thanks artstorm!)
216
+ 2009-10-21 3.1.7 Added support for custom taxonomies (Thanks to Lee!)
217
 
218
  Maybe Todo:
219
  ==============================================================================
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://www.arnebrachhold.de/redir/sitemap-paypal
4
  Tags: google, sitemaps, google sitemaps, yahoo, msn, ask, live, xml sitemap, xml
5
  Requires at least: 2.1
6
  Tested up to: 2.9
7
- Stable tag: 3.1.5
8
 
9
  This plugin will create a Google sitemaps compliant XML-Sitemap of your WordPress blog.
10
 
@@ -17,7 +17,7 @@ Related Links:
17
  * <a href="http://www.arnebrachhold.de/projects/wordpress-plugins/google-xml-sitemaps-generator/" title="Google XML Sitemaps Plugin for WordPress">Plugin Homepage</a>
18
  * <a href="http://www.arnebrachhold.de/projects/wordpress-plugins/google-xml-sitemaps-generator/changelog/" title="Changelog of the Google XML Sitemaps Plugin for WordPress">Changelog</a>
19
  * <a href="http://www.arnebrachhold.de/2006/04/07/google-sitemaps-faq-sitemap-issues-errors-and-problems/" title="Google Sitemaps FAQ">Plugin and sitemaps FAQ</a>
20
- * <a href="http://wordpress.org/tags/google-sitemap-generator">Support Forum</a>
21
 
22
 
23
  == Installation ==
@@ -56,7 +56,7 @@ Most of the plugin options are described at the [plugin homepage](http://www.arn
56
 
57
  = My question isn't even answered there =
58
 
59
- Please post your question at the [WordPress support forum](http://wordpress.org/tags/sitemap) and tag your post with &quot;sitemap&quot;.
60
 
61
  = What's new in the latest version? =
62
 
4
  Tags: google, sitemaps, google sitemaps, yahoo, msn, ask, live, xml sitemap, xml
5
  Requires at least: 2.1
6
  Tested up to: 2.9
7
+ Stable tag: 3.1.6
8
 
9
  This plugin will create a Google sitemaps compliant XML-Sitemap of your WordPress blog.
10
 
17
  * <a href="http://www.arnebrachhold.de/projects/wordpress-plugins/google-xml-sitemaps-generator/" title="Google XML Sitemaps Plugin for WordPress">Plugin Homepage</a>
18
  * <a href="http://www.arnebrachhold.de/projects/wordpress-plugins/google-xml-sitemaps-generator/changelog/" title="Changelog of the Google XML Sitemaps Plugin for WordPress">Changelog</a>
19
  * <a href="http://www.arnebrachhold.de/2006/04/07/google-sitemaps-faq-sitemap-issues-errors-and-problems/" title="Google Sitemaps FAQ">Plugin and sitemaps FAQ</a>
20
+ * <a href="http://wordpress.org/tags/google-sitemap-generator?forum_id=10">Support Forum</a>
21
 
22
 
23
  == Installation ==
56
 
57
  = My question isn't even answered there =
58
 
59
+ Please post your question at the [WordPress support forum](http://wordpress.org/tags/google-sitemap-generator?forum_id=10) and tag your post with &quot;google-sitemap-generator&quot;.
60
 
61
  = What's new in the latest version? =
62
 
sitemap-core.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /*
3
 
4
- $Id: sitemap-core.php 150610 2009-08-30 21:11:36Z arnee $
5
 
6
  */
7
 
@@ -544,7 +544,7 @@ class GoogleSitemapGeneratorXmlEntry {
544
  class GoogleSitemapGeneratorDebugEntry extends GoogleSitemapGeneratorXmlEntry {
545
 
546
  function Render() {
547
- return "<!-- " . $this->_xml . " -->";
548
  }
549
  }
550
 
@@ -863,7 +863,7 @@ class GoogleSitemapGenerator {
863
  /**
864
  * @var Version of the generator in SVN
865
  */
866
- var $_svnVersion = '$Id: sitemap-core.php 150610 2009-08-30 21:11:36Z arnee $';
867
 
868
  /**
869
  * @var array The unserialized array with the stored options
@@ -1048,6 +1048,7 @@ class GoogleSitemapGenerator {
1048
  $this->_options["sm_in_arch"]=false; //Include archives
1049
  $this->_options["sm_in_auth"]=false; //Include author pages
1050
  $this->_options["sm_in_tags"]=false; //Include tag pages
 
1051
  $this->_options["sm_in_lastmod"]=true; //Include the last modification date
1052
 
1053
  $this->_options["sm_cf_home"]="daily"; //Change frequency of the homepage
@@ -1267,6 +1268,16 @@ class GoogleSitemapGenerator {
1267
  return (function_exists("get_taxonomy") && function_exists("get_terms"));
1268
  }
1269
 
 
 
 
 
 
 
 
 
 
 
1270
  /**
1271
  * Enables the Google Sitemap Generator and registers the WordPress hooks
1272
  *
@@ -2158,6 +2169,59 @@ class GoogleSitemapGenerator {
2158
  if($debug) $this->AddElement(new GoogleSitemapGeneratorDebugEntry("Debug: End Tags"));
2159
  }
2160
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2161
  //Add the custom pages
2162
  if($debug) $this->AddElement(new GoogleSitemapGeneratorDebugEntry("Debug: Start Custom Pages"));
2163
  if($this->_pages && is_array($this->_pages) && count($this->_pages)>0) {
1
  <?php
2
  /*
3
 
4
+ $Id: sitemap-core.php 165547 2009-10-21 20:19:36Z arnee $
5
 
6
  */
7
 
544
  class GoogleSitemapGeneratorDebugEntry extends GoogleSitemapGeneratorXmlEntry {
545
 
546
  function Render() {
547
+ return "<!-- " . $this->_xml . " -->\n";
548
  }
549
  }
550
 
863
  /**
864
  * @var Version of the generator in SVN
865
  */
866
+ var $_svnVersion = '$Id: sitemap-core.php 165547 2009-10-21 20:19:36Z arnee $';
867
 
868
  /**
869
  * @var array The unserialized array with the stored options
1048
  $this->_options["sm_in_arch"]=false; //Include archives
1049
  $this->_options["sm_in_auth"]=false; //Include author pages
1050
  $this->_options["sm_in_tags"]=false; //Include tag pages
1051
+ $this->_options["sm_in_tax"]=array(); //Include additional taxonomies
1052
  $this->_options["sm_in_lastmod"]=true; //Include the last modification date
1053
 
1054
  $this->_options["sm_cf_home"]="daily"; //Change frequency of the homepage
1268
  return (function_exists("get_taxonomy") && function_exists("get_terms"));
1269
  }
1270
 
1271
+ /**
1272
+ * Returns the list of custom taxonies
1273
+ *
1274
+ * @return array Array of names of user-defined taxonomies
1275
+ */
1276
+ function GetCustomTaxonomies() {
1277
+ $taxonomies = get_object_taxonomies('post');
1278
+ return array_diff($taxonomies,array("category","post_tag"));
1279
+ }
1280
+
1281
  /**
1282
  * Enables the Google Sitemap Generator and registers the WordPress hooks
1283
  *
2169
  if($debug) $this->AddElement(new GoogleSitemapGeneratorDebugEntry("Debug: End Tags"));
2170
  }
2171
 
2172
+ //Add custom taxonomy pages
2173
+ if($this->GetOption("in_tax") && $this->IsTaxonomySupported()) {
2174
+
2175
+ if($debug) $this->AddElement(new GoogleSitemapGeneratorDebugEntry("Debug: Start custom taxonomies"));
2176
+ $enabledTaxonomies = $this->GetOption("in_tax");
2177
+
2178
+ $taxList = array();
2179
+
2180
+ foreach ($enabledTaxonomies as $taxName) {
2181
+ $taxonomy = get_taxonomy($taxName);
2182
+ if($taxonomy) $taxList[] = $taxonomy;
2183
+ }
2184
+
2185
+ if(count($taxList)>0) {
2186
+
2187
+ foreach ($taxList as $taxonomy) {
2188
+
2189
+ if($debug) $this->AddElement(new GoogleSitemapGeneratorDebugEntry("Debug: Start Taxonomy " . $taxonomy->name));
2190
+
2191
+ $terms = get_terms($taxonomy->name, array("hide_empty" => true, "hierarchical" => false));
2192
+
2193
+ if($terms && is_array($terms) && count($terms)>0) {
2194
+ $termIDs = array();
2195
+
2196
+ foreach($terms AS $term) $termIDs[] = $wpdb->escape($term->term_taxonomy_id);
2197
+
2198
+ $lastMods = $wpdb->get_results("
2199
+ SELECT
2200
+ r.term_taxonomy_id AS term_id,
2201
+ UNIX_TIMESTAMP(MAX(post_date_gmt)) as mod_date
2202
+ FROM
2203
+ {$wpdb->posts} p , {$wpdb->term_relationships} r
2204
+ WHERE
2205
+ p.ID = r.object_id
2206
+ AND p.post_status = 'publish'
2207
+ AND p.post_type = 'post'
2208
+ AND p.post_password = ''
2209
+ AND r.term_taxonomy_id IN ( ". implode(',',$termIDs) .")
2210
+ ", OBJECT_K);
2211
+
2212
+ foreach($terms AS $term) {
2213
+ $lastMod = (array_key_exists($term->term_taxonomy_id,$lastMods)?$lastMods[$term->term_taxonomy_id]->mod_date:0);
2214
+ $this->AddUrl(get_term_link($term,$taxonomy->name),$lastMod,$this->GetOption("cf_tags"),$this->GetOption("pr_tags"));
2215
+ }
2216
+ }
2217
+
2218
+ if($debug) $this->AddElement(new GoogleSitemapGeneratorDebugEntry("Debug: End Taxonomy " . $taxonomy->name));
2219
+ }
2220
+ }
2221
+
2222
+ if($debug) $this->AddElement(new GoogleSitemapGeneratorDebugEntry("Debug: End custom taxonomies"));
2223
+ }
2224
+
2225
  //Add the custom pages
2226
  if($debug) $this->AddElement(new GoogleSitemapGeneratorDebugEntry("Debug: Start Custom Pages"));
2227
  if($this->_pages && is_array($this->_pages) && count($this->_pages)>0) {
sitemap-ui.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /*
3
 
4
- $Id: sitemap-ui.php 150610 2009-08-30 21:11:36Z arnee $
5
 
6
  */
7
 
@@ -267,7 +267,19 @@ class GoogleSitemapGeneratorUI {
267
  }
268
  //Options of the category "Includes" are boolean
269
  } else if(substr($k,0,6)=="sm_in_") {
270
- $this->sg->_options[$k]=(bool) $_POST[$k];
 
 
 
 
 
 
 
 
 
 
 
 
271
  //Options of the category "Change frequencies" are string
272
  } else if(substr($k,0,6)=="sm_cf_") {
273
  $this->sg->_options[$k]=(string) $_POST[$k];
@@ -981,6 +993,25 @@ class GoogleSitemapGeneratorUI {
981
  <?php _e('Include tag pages', 'sitemap') ?>
982
  </label>
983
  </li>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
984
  <?php endif; ?>
985
  <li>
986
  <label for="sm_in_auth">
1
  <?php
2
  /*
3
 
4
+ $Id: sitemap-ui.php 165547 2009-10-21 20:19:36Z arnee $
5
 
6
  */
7
 
267
  }
268
  //Options of the category "Includes" are boolean
269
  } else if(substr($k,0,6)=="sm_in_") {
270
+ if($k=='sm_in_tax') {
271
+
272
+ $enabledTaxonomies = array();
273
+
274
+ foreach(array_keys((array) $_POST[$k]) AS $taxName) {
275
+ if(empty($taxName) || !is_taxonomy($taxName)) continue;
276
+
277
+ $enabledTaxonomies[] = $taxName;
278
+ }
279
+
280
+ $this->sg->_options[$k] = $enabledTaxonomies;
281
+
282
+ } else $this->sg->_options[$k]=(bool) $_POST[$k];
283
  //Options of the category "Change frequencies" are string
284
  } else if(substr($k,0,6)=="sm_cf_") {
285
  $this->sg->_options[$k]=(string) $_POST[$k];
993
  <?php _e('Include tag pages', 'sitemap') ?>
994
  </label>
995
  </li>
996
+ <?php
997
+ $taxonomies = $this->sg->GetCustomTaxonomies();
998
+
999
+ $enabledTaxonomies = $this->sg->GetOption('in_tax');
1000
+
1001
+ foreach ($taxonomies as $taxName) {
1002
+
1003
+ $taxonomy = get_taxonomy($taxName);
1004
+ $selected = in_array($taxonomy->name, $enabledTaxonomies);
1005
+ ?>
1006
+ <li>
1007
+ <label for="sm_in_tax[<?php echo $taxonomy->name; ?>]">
1008
+ <input type="checkbox" id="sm_in_tax[<?php echo $taxonomy->name; ?>]" name="sm_in_tax[<?php echo $taxonomy->name; ?>]" <?php echo $selected?"checked=\"checked\"":""; ?> />
1009
+ <?php echo str_replace('%s',$taxonomy->label,__('Include taxonomy pages for %s', 'sitemap')); ?>
1010
+ </label>
1011
+ <li>
1012
+ <?php
1013
+ }
1014
+ ?>
1015
  <?php endif; ?>
1016
  <li>
1017
  <label for="sm_in_auth">
sitemap.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
 
3
  /*
4
- $Id: sitemap.php 150611 2009-08-30 21:12:33Z arnee $
5
 
6
  Google XML Sitemaps Generator for WordPress
7
  ==============================================================================
@@ -25,7 +25,7 @@
25
  Plugin Name: Google XML Sitemaps
26
  Plugin URI: http://www.arnebrachhold.de/redir/sitemap-home/
27
  Description: This plugin will generate a sitemaps.org compatible sitemap of your WordPress blog which is supported by Ask.com, Google, MSN Search and YAHOO. <a href="options-general.php?page=sitemap.php">Configuration Page</a>
28
- Version: 3.1.6
29
  Author: Arne Brachhold
30
  Author URI: http://www.arnebrachhold.de/
31
  */
1
  <?php
2
 
3
  /*
4
+ $Id: sitemap.php 165547 2009-10-21 20:19:36Z arnee $
5
 
6
  Google XML Sitemaps Generator for WordPress
7
  ==============================================================================
25
  Plugin Name: Google XML Sitemaps
26
  Plugin URI: http://www.arnebrachhold.de/redir/sitemap-home/
27
  Description: This plugin will generate a sitemaps.org compatible sitemap of your WordPress blog which is supported by Ask.com, Google, MSN Search and YAHOO. <a href="options-general.php?page=sitemap.php">Configuration Page</a>
28
+ Version: 3.1.7
29
  Author: Arne Brachhold
30
  Author URI: http://www.arnebrachhold.de/
31
  */