XML Sitemap & Google News feeds - Version 3.8.8

Version Description

Bugfixes: PHP4 compatibility + mu-plugins URL stylesheet

=

Download this release

Release Info

Developer RavanH
Plugin Icon 128x128 XML Sitemap & Google News feeds
Version 3.8.8
Comparing to
See all releases

Code changes from version 3.8.5 to 3.8.8

Files changed (6) hide show
  1. XMLSitemapFeed.class.php +123 -0
  2. feed-sitemap.php +8 -5
  3. hacks.php +325 -0
  4. readme.txt +43 -20
  5. sitemap.xsl.php +1 -1
  6. xml-sitemap.php +20 -441
XMLSitemapFeed.class.php ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /* ------------------------------
3
+ * XMLSitemapFeed CLASS
4
+ * ------------------------------ */
5
+
6
+ class XMLSitemapFeed {
7
+
8
+ function go() {
9
+ if ( '0' == get_option( 'blog_public' ) || ( $wpdb->blogid && function_exists('get_site_option') && get_site_option('tags_blog_id') == $wpdb->blogid ) ) {
10
+ // we are on a blog that blocks spiders!
11
+ // create NO sitemap
12
+ // - OR -
13
+ // we are on wpmu and this is a tags blog!
14
+ // create NO sitemap since it will be full
15
+ // of links outside the blogs own domain...
16
+ } else {
17
+ // INIT
18
+ add_action('init', array(__CLASS__, 'init') );
19
+
20
+ // FEEDS
21
+ add_action('do_feed_sitemap', array(__CLASS__, 'load_template'), 10, 1);
22
+
23
+ // REWRITES
24
+ add_filter('generate_rewrite_rules', array(__CLASS__, 'rewrite') );
25
+
26
+ // ROBOTSTXT
27
+ add_action('do_robotstxt', array(__CLASS__, 'robots'), 1 );
28
+ }
29
+
30
+ // DE-ACTIVATION
31
+ register_deactivation_hook( XMLSF_PLUGIN_DIR . '/xml-sitemap.php', array(__CLASS__, 'deactivate') );
32
+ }
33
+
34
+ // FEEDS //
35
+ // set up the feed template
36
+ function load_template() {
37
+ load_template( XMLSF_PLUGIN_DIR . '/feed-sitemap.php' );
38
+ }
39
+
40
+ // REWRITES //
41
+ // add sitemap rewrite rules
42
+ function rewrite($wp_rewrite) {
43
+ $feed_rules = array(
44
+ 'sitemap.xml$' => $wp_rewrite->index . '?feed=sitemap',
45
+ );
46
+ $wp_rewrite->rules = $feed_rules + $wp_rewrite->rules;
47
+ }
48
+
49
+ // ROBOTSTXT //
50
+ // add sitemap location in robots.txt generated by WP
51
+ // available filter : robotstxt_sitemap_url
52
+ function robots() {
53
+
54
+ // hook for filter 'xml_sitemap_url' provides an array here and MUST get an array returned
55
+ $sitemap_array = apply_filters('xml_sitemap_url',array(trailingslashit(get_bloginfo('url'))."sitemap.xml"));
56
+
57
+ echo "\n# XML Sitemap Feed ".XMLSF_VERSION." (http://4visions.nl/en/wordpress-plugins/xml-sitemap-feed/)";
58
+
59
+ if ( is_array($sitemap_array) && !empty($sitemap_array) )
60
+ foreach ( $sitemap_array as $url )
61
+ echo "\nSitemap: " . $url;
62
+ else
63
+ echo "\n# Warning: xml sitemap url is missing, filtered out or filter did not return an array.";
64
+
65
+ echo "\n\n";
66
+ }
67
+
68
+ // DE-ACTIVATION
69
+ function deactivate() {
70
+ remove_filter('generate_rewrite_rules', array(__CLASS__, 'rewrite') );
71
+ delete_option('xml-sitemap-feed-version');
72
+ global $wp_rewrite;
73
+ $wp_rewrite->flush_rules();
74
+ }
75
+
76
+ // MULTI-LANGUAGE PLUGIN FILTERS
77
+
78
+ // qTranslate
79
+ function qtranslate($input) {
80
+ global $q_config;
81
+
82
+ if (is_array($input)) // got an array? return one!
83
+ foreach ( $input as $url )
84
+ foreach($q_config['enabled_languages'] as $language)
85
+ $return[] = qtrans_convertURL($url,$language);
86
+ else // not an array? just convert the string.
87
+ $return = qtrans_convertURL($input);
88
+
89
+ return $return;
90
+ }
91
+
92
+ // xLanguage
93
+ function xlanguage($input) {
94
+ global $xlanguage;
95
+
96
+ if (is_array($input)) // got an array? return one!
97
+ foreach ( $input as $url )
98
+ foreach($xlanguage->options['language'] as $language)
99
+ $return[] = $xlanguage->filter_link_in_lang($url,$language['code']);
100
+ else // not an array? just convert the string.
101
+ $return = $xlanguage->filter_link($input);
102
+
103
+ return $return;
104
+ }
105
+
106
+ function init() {
107
+ // FLUSH RULES after (site wide) plugin upgrade
108
+ if (get_option('xml-sitemap-feed-version') != XMLSF_VERSION) {
109
+ update_option('xml-sitemap-feed-version', XMLSF_VERSION);
110
+ global $wp_rewrite;
111
+ $wp_rewrite->flush_rules();
112
+ }
113
+
114
+ // check for qTranslate and add filter
115
+ if (defined('QT_LANGUAGE'))
116
+ add_filter('xml_sitemap_url', array(__CLASS__, 'qtranslate'), 99);
117
+
118
+ // check for xLanguage and add filter
119
+ if (defined('xLanguageTagQuery'))
120
+ add_filter('xml_sitemap_url', array(__CLASS__, 'xlanguage'), 99);
121
+ }
122
+
123
+ }
feed-sitemap.php CHANGED
@@ -8,14 +8,16 @@
8
  status_header('200'); // force header('HTTP/1.1 200 OK') for sites without posts
9
  header('Content-Type: text/xml; charset=' . get_bloginfo('charset'), true);
10
 
11
- echo '<?xml version="1.0" encoding="'.get_bloginfo('charset').'"?><?xml-stylesheet type="text/xsl" href="'.XMLSF_PLUGIN_URL.'/sitemap.xsl.php?v='.XMLSF_VERSION.'"?>
12
  <!-- generated-on="'.date('Y-m-d\TH:i:s+00:00').'" -->
13
  <!-- generator="XML Sitemap Feed plugin for WordPress" -->
14
- <!-- generator-url="http://4visions.nl/wordpress-plugins/xml-sitemap-feed/" -->
15
  <!-- generator-version="'.XMLSF_VERSION.'" -->
 
16
  ';
17
 
18
- // presets are changable; please read comments:
 
19
  $max_priority = 1.0; // Maximum priority value for any URL in the sitemap; set to any other value between 0 and 1.
20
  $min_priority = 0; // Minimum priority value for any URL in the sitemap; set to any other value between 0 and 1.
21
  // NOTE: Changing these values will influence each URL's priority. Priority values are taken by
@@ -78,12 +80,13 @@ $counter = 1;
78
 
79
  // start with the main URL
80
  ?>
81
- <urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><url><loc><?php
82
  // hook for filter 'xml_sitemap_url' provides a string here and MUST get a string returned
83
  $url = apply_filters( 'xml_sitemap_url', trailingslashit(get_bloginfo('url')) );
84
  if ( is_string($url) ) echo esc_url( $url ); else echo esc_url( trailingslashit(get_bloginfo('url')) );
85
  ?></loc><lastmod><?php echo mysql2date('Y-m-d\TH:i:s+00:00', $lastmodified_gmt, false); ?></lastmod><changefreq>daily</changefreq><priority>1.0</priority></url><?php
86
- // and loop away!
 
87
  if ( have_posts() ) : while ( have_posts() && $counter < $maxURLS ) : the_post();
88
 
89
  // check if we are not dealing with an external URL :: Thanks, Francois Deschenes :)
8
  status_header('200'); // force header('HTTP/1.1 200 OK') for sites without posts
9
  header('Content-Type: text/xml; charset=' . get_bloginfo('charset'), true);
10
 
11
+ echo '<?xml version="1.0" encoding="'.get_bloginfo('charset').'"?><?xml-stylesheet type="text/xsl" href="'.get_option('home').'/'.str_replace(ABSPATH,"", XMLSF_PLUGIN_DIR).'/sitemap.xsl.php?v='.XMLSF_VERSION.'"?>
12
  <!-- generated-on="'.date('Y-m-d\TH:i:s+00:00').'" -->
13
  <!-- generator="XML Sitemap Feed plugin for WordPress" -->
14
+ <!-- generator-url="http://4visions.nl/en/wordpress-plugins/xml-sitemap-feed/" -->
15
  <!-- generator-version="'.XMLSF_VERSION.'" -->
16
+ <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
17
  ';
18
 
19
+ // presets are changable
20
+ // please read comments:
21
  $max_priority = 1.0; // Maximum priority value for any URL in the sitemap; set to any other value between 0 and 1.
22
  $min_priority = 0; // Minimum priority value for any URL in the sitemap; set to any other value between 0 and 1.
23
  // NOTE: Changing these values will influence each URL's priority. Priority values are taken by
80
 
81
  // start with the main URL
82
  ?>
83
+ <url><loc><?php
84
  // hook for filter 'xml_sitemap_url' provides a string here and MUST get a string returned
85
  $url = apply_filters( 'xml_sitemap_url', trailingslashit(get_bloginfo('url')) );
86
  if ( is_string($url) ) echo esc_url( $url ); else echo esc_url( trailingslashit(get_bloginfo('url')) );
87
  ?></loc><lastmod><?php echo mysql2date('Y-m-d\TH:i:s+00:00', $lastmodified_gmt, false); ?></lastmod><changefreq>daily</changefreq><priority>1.0</priority></url><?php
88
+
89
+ // then loop away!
90
  if ( have_posts() ) : while ( have_posts() && $counter < $maxURLS ) : the_post();
91
 
92
  // check if we are not dealing with an external URL :: Thanks, Francois Deschenes :)
hacks.php ADDED
@@ -0,0 +1,325 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /* -------------------------------------
3
+ * MISSING WORDPRESS FUNCTIONS
4
+ * ------------------------------------- */
5
+
6
+ /**
7
+ * Retrieve last page modified date depending on timezone.
8
+ *
9
+ * The server timezone is the default and is the difference between GMT and
10
+ * server time. The 'blog' value is just when the last post was modified. The
11
+ * 'gmt' is when the last post was modified in GMT time.
12
+ *
13
+ * Adaptation of get_lastpostmodified defined in wp-includes/post.php since 1.2.0
14
+ *
15
+ * @uses $wpdb
16
+ * @uses $blog_id
17
+ * @uses apply_filters() Calls 'get_lastpagemodified' filter
18
+ *
19
+ * @param string $timezone The location to get the time. Can be 'gmt', 'blog', or 'server'.
20
+ * @return string The date the post was last modified.
21
+ */
22
+ if( !function_exists('get_lastpagemodified') ) {
23
+ function get_lastpagemodified($timezone = 'server') {
24
+ global $wpdb;
25
+
26
+ $add_seconds_server = date('Z');
27
+ $timezone = strtolower( $timezone );
28
+
29
+ $lastpagemodified = wp_cache_get( "lastpagemodified:$timezone", 'timeinfo' );
30
+ if ( $lastpagemodified )
31
+ return apply_filters( 'get_lastpagemodified', $lastpagemodified, $timezone );
32
+
33
+ switch ( strtolower($timezone) ) {
34
+ case 'gmt':
35
+ $lastpagemodified = $wpdb->get_var("SELECT post_modified_gmt FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'page' ORDER BY post_modified_gmt DESC LIMIT 1");
36
+ break;
37
+ case 'blog':
38
+ $lastpagemodified = $wpdb->get_var("SELECT post_modified FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'page' ORDER BY post_modified_gmt DESC LIMIT 1");
39
+ break;
40
+ case 'server':
41
+ $lastpagemodified = $wpdb->get_var("SELECT DATE_ADD(post_modified_gmt, INTERVAL '$add_seconds_server' SECOND) FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'page' ORDER BY post_modified_gmt DESC LIMIT 1");
42
+ break;
43
+ }
44
+
45
+ $lastpagedate = get_lastpagedate($timezone);
46
+ if ( $lastpagedate > $lastpagemodified )
47
+ $lastpagemodified = $lastpagedate;
48
+
49
+ if ( $lastpagemodified )
50
+ wp_cache_set( "lastpagemodified:$timezone", $lastpagemodified, 'timeinfo' );
51
+
52
+ return apply_filters( 'get_lastpagemodified', $lastpagemodified, $timezone );
53
+ }
54
+ }
55
+
56
+ /**
57
+ * Retrieve the date that the last page was published.
58
+ *
59
+ * The server timezone is the default and is the difference between GMT and
60
+ * server time. The 'blog' value is the date when the last post was posted. The
61
+ * 'gmt' is when the last post was posted in GMT formatted date.
62
+ *
63
+ * Adaptation of get_lastpostdate defined in wp-includes/post.php since 0.71
64
+ *
65
+ * @uses $wpdb
66
+ * @uses $blog_id
67
+ * @uses apply_filters() Calls 'get_lastpagedate' filter
68
+ *
69
+ * @global mixed $cache_lastpagedate Stores the last post date
70
+ * @global mixed $pagenow The current page being viewed
71
+ *
72
+ * @param string $timezone The location to get the time. Can be 'gmt', 'blog', or 'server'.
73
+ * @return string The date of the last post.
74
+ */
75
+ if( !function_exists('get_lastpagedate') ) {
76
+ function get_lastpagedate($timezone = 'server') {
77
+ global $cache_lastpagedate, $wpdb, $blog_id;
78
+ $add_seconds_server = date('Z');
79
+ if ( !isset($cache_lastpagedate[$blog_id][$timezone]) ) {
80
+ switch(strtolower($timezone)) {
81
+ case 'gmt':
82
+ $lastpagedate = $wpdb->get_var("SELECT post_date_gmt FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'page' ORDER BY post_date_gmt DESC LIMIT 1");
83
+ break;
84
+ case 'blog':
85
+ $lastpagedate = $wpdb->get_var("SELECT post_date FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'page' ORDER BY post_date_gmt DESC LIMIT 1");
86
+ break;
87
+ case 'server':
88
+ $lastpagedate = $wpdb->get_var("SELECT DATE_ADD(post_date_gmt, INTERVAL '$add_seconds_server' SECOND) FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'page' ORDER BY post_date_gmt DESC LIMIT 1");
89
+ break;
90
+ }
91
+ $cache_lastpagedate[$blog_id][$timezone] = $lastpagedate;
92
+ } else {
93
+ $lastpagedate = $cache_lastpagedate[$blog_id][$timezone];
94
+ }
95
+ return apply_filters( 'get_lastpagedate', $lastpagedate, $timezone );
96
+ }
97
+ }
98
+
99
+ /**
100
+ * Retrieve first post modified date depending on timezone.
101
+ *
102
+ * The server timezone is the default and is the difference between GMT and
103
+ * server time. The 'blog' value is the date when the last post was posted. The
104
+ * 'gmt' is when the last post was posted in GMT formatted date.
105
+ *
106
+ * Reverse of get_lastpostmodified defined in wp-includes/post.php since WP 1.2.0
107
+ *
108
+ * @uses $wpdb
109
+ * @uses apply_filters() Calls 'get_firstpostmodified' filter
110
+ *
111
+ * @param string $timezone The location to get the time. Can be 'gmt', 'blog', or 'server'.
112
+ * @return string The date of the oldest modified post.
113
+ */
114
+ if( !function_exists('get_firstpostmodified') ) {
115
+ function get_firstpostmodified($timezone = 'server') {
116
+ global $wpdb;
117
+
118
+ $add_seconds_server = date('Z');
119
+ $timezone = strtolower( $timezone );
120
+
121
+ $firstpostmodified = wp_cache_get( "firstpostmodified:$timezone", 'timeinfo' );
122
+ if ( $firstpostmodified )
123
+ return apply_filters( 'get_firstpostmodified', $firstpostmodified, $timezone );
124
+
125
+ switch ( strtolower($timezone) ) {
126
+ case 'gmt':
127
+ $firstpostmodified = $wpdb->get_var("SELECT post_modified_gmt FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'post' ORDER BY post_modified_gmt ASC LIMIT 1");
128
+ break;
129
+ case 'blog':
130
+ $firstpostmodified = $wpdb->get_var("SELECT post_modified FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'post' ORDER BY post_modified_gmt ASC LIMIT 1");
131
+ break;
132
+ case 'server':
133
+ $firstpostmodified = $wpdb->get_var("SELECT DATE_ADD(post_modified_gmt, INTERVAL '$add_seconds_server' SECOND) FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'post' ORDER BY post_modified_gmt ASC LIMIT 1");
134
+ break;
135
+ }
136
+
137
+ $firstpostdate = get_firstpostdate($timezone);
138
+ if ( $firstpostdate > $firstpostmodified )
139
+ $firstpostmodified = $firstpostdate;
140
+
141
+ if ( $firstpostmodified )
142
+ wp_cache_set( "firstpostmodified:$timezone", $firstpostmodified, 'timeinfo' );
143
+
144
+ return apply_filters( 'get_firstpostmodified', $firstpostmodified, $timezone );
145
+ }
146
+ }
147
+
148
+ /**
149
+ * Retrieve first page modified date depending on timezone.
150
+ *
151
+ * The server timezone is the default and is the difference between GMT and
152
+ * server time. The 'blog' value is the date when the last post was posted. The
153
+ * 'gmt' is when the last post was posted in GMT formatted date.
154
+ *
155
+ * Adaptation of get_firstpostmodified defined in this file
156
+ *
157
+ * @uses $wpdb
158
+ * @uses apply_filters() Calls 'get_firstpagemodified' filter
159
+ *
160
+ * @param string $timezone The location to get the time. Can be 'gmt', 'blog', or 'server'.
161
+ * @return string The date of the oldest modified page.
162
+ */
163
+ if( !function_exists('get_firstpagemodified') ) {
164
+ function get_firstpagemodified($timezone = 'server') {
165
+ global $wpdb;
166
+
167
+ $add_seconds_server = date('Z');
168
+ $timezone = strtolower( $timezone );
169
+
170
+ $firstpagemodified = wp_cache_get( "firstpagemodified:$timezone", 'timeinfo' );
171
+ if ( $firstpagemodified )
172
+ return apply_filters( 'get_firstpagemodified', $firstpagemodified, $timezone );
173
+
174
+ switch ( strtolower($timezone) ) {
175
+ case 'gmt':
176
+ $firstpagemodified = $wpdb->get_var("SELECT post_modified_gmt FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'page' ORDER BY post_modified_gmt ASC LIMIT 1");
177
+ break;
178
+ case 'blog':
179
+ $firstpagemodified = $wpdb->get_var("SELECT post_modified FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'page' ORDER BY post_modified_gmt ASC LIMIT 1");
180
+ break;
181
+ case 'server':
182
+ $firstpagemodified = $wpdb->get_var("SELECT DATE_ADD(post_modified_gmt, INTERVAL '$add_seconds_server' SECOND) FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'page' ORDER BY post_modified_gmt ASC LIMIT 1");
183
+ break;
184
+ }
185
+
186
+ $firstpagedate = get_firstpagedate($timezone);
187
+ if ( $firstpagedate > $firstpagemodified )
188
+ $firstpagemodified = $firstpagedate;
189
+
190
+ if ( $firstpagemodified )
191
+ wp_cache_set( "firstpagemodified:$timezone", $firstpagemodified, 'timeinfo' );
192
+
193
+ return apply_filters( 'get_firstpagemodified', $firstpagemodified, $timezone );
194
+ }
195
+ }
196
+
197
+ /**
198
+ * Retrieve the date that the first post was published.
199
+ *
200
+ * The server timezone is the default and is the difference between GMT and
201
+ * server time. The 'blog' value is the date when the last post was posted. The
202
+ * 'gmt' is when the last post was posted in GMT formatted date.
203
+ *
204
+ * Reverse of get_lastpostdate defined in wp-includes/post.php since 0.71
205
+ *
206
+ * @uses $wpdb
207
+ * @uses $cache_firstpostdate
208
+ * @uses $blog_id
209
+ * @uses apply_filters() Calls 'get_firstpostdate' filter
210
+ *
211
+ * @param string $timezone The location to get the time. Can be 'gmt', 'blog', or 'server'.
212
+ * @return string The date of the last post.
213
+ */
214
+ if( !function_exists('get_firstpostdate') ) {
215
+ function get_firstpostdate($timezone = 'server') {
216
+ global $cache_firstpostdate, $wpdb, $blog_id;
217
+ $add_seconds_server = date('Z');
218
+ if ( !isset($cache_firstpostdate[$blog_id][$timezone]) ) {
219
+ switch(strtolower($timezone)) {
220
+ case 'gmt':
221
+ $firstpostdate = $wpdb->get_var("SELECT post_date_gmt FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'post' ORDER BY post_date_gmt ASC LIMIT 1");
222
+ break;
223
+ case 'blog':
224
+ $firstpostdate = $wpdb->get_var("SELECT post_date FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'post' ORDER BY post_date_gmt ASC LIMIT 1");
225
+ break;
226
+ case 'server':
227
+ $firstpostdate = $wpdb->get_var("SELECT DATE_ADD(post_date_gmt, INTERVAL '$add_seconds_server' SECOND) FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'post' ORDER BY post_date_gmt ASC LIMIT 1");
228
+ break;
229
+ }
230
+ $cache_firstpostdate[$blog_id][$timezone] = $firstpostdate;
231
+ } else {
232
+ $firstpostdate = $cache_firstpostdate[$blog_id][$timezone];
233
+ }
234
+ return apply_filters( 'get_firstpostdate', $firstpostdate, $timezone );
235
+ }
236
+ }
237
+
238
+ /**
239
+ * Retrieve the date that the first post was published.
240
+ *
241
+ * The server timezone is the default and is the difference between GMT and
242
+ * server time. The 'blog' value is the date when the last post was posted. The
243
+ * 'gmt' is when the last post was posted in GMT formatted date.
244
+ *
245
+ * Adaptation of get_firstpostdate defined in this file
246
+ *
247
+ * @uses $wpdb
248
+ * @uses $cache_firstpagedate
249
+ * @uses $blog_id
250
+ * @uses apply_filters() Calls 'get_firstpagedate' filter
251
+ *
252
+ * @param string $timezone The location to get the time. Can be 'gmt', 'blog', or 'server'.
253
+ * @return string The date of the last post.
254
+ */
255
+ if( !function_exists('get_firstpagedate') ) {
256
+ function get_firstpagedate($timezone = 'server') {
257
+ global $cache_firstpagedate, $wpdb, $blog_id;
258
+ $add_seconds_server = date('Z');
259
+ if ( !isset($cache_firstpagedate[$blog_id][$timezone]) ) {
260
+ switch(strtolower($timezone)) {
261
+ case 'gmt':
262
+ $firstpagedate = $wpdb->get_var("SELECT post_date_gmt FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'page' ORDER BY post_date_gmt ASC LIMIT 1");
263
+ break;
264
+ case 'blog':
265
+ $firstpagedate = $wpdb->get_var("SELECT post_date FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'page' ORDER BY post_date_gmt ASC LIMIT 1");
266
+ break;
267
+ case 'server':
268
+ $firstpagedate = $wpdb->get_var("SELECT DATE_ADD(post_date_gmt, INTERVAL '$add_seconds_server' SECOND) FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'page' ORDER BY post_date_gmt ASC LIMIT 1");
269
+ break;
270
+ }
271
+ $cache_firstpagedate[$blog_id][$timezone] = $firstpagedate;
272
+ } else {
273
+ $firstpagedate = $cache_firstpagedate[$blog_id][$timezone];
274
+ }
275
+ return apply_filters( 'get_firstpagedate', $firstpagedate, $timezone );
276
+ }
277
+ }
278
+
279
+ /**
280
+ * Retrieve first post/page modified date depending on timezone.
281
+ *
282
+ * The server timezone is the default and is the difference between GMT and
283
+ * server time. The 'blog' value is the date when the last post was posted. The
284
+ * 'gmt' is when the last post was posted in GMT formatted date.
285
+ *
286
+ * Combination of get_firstpostmodified and get_firstpagemodified
287
+ * defined in this file
288
+ *
289
+ * @param string $timezone The location to get the time. Can be 'gmt', 'blog', or 'server'.
290
+ * @return string The date of the oldest modified post or page.
291
+ */
292
+ if( !function_exists('get_firstmodified') ) {
293
+ function get_firstmodified($timezone = 'server') {
294
+ $firstpostmodified = get_firstpostmodified($timezone);
295
+ $firstpagemodified = get_firstpagemodified($timezone);
296
+ if ( mysql2date('U',$firstpostmodified) < mysql2date('U',$firstpagemodified) )
297
+ return $firstpostmodified;
298
+ else
299
+ return $firstpagemodified;
300
+ }
301
+ }
302
+
303
+ /**
304
+ * Retrieve last post/page modified date depending on timezone.
305
+ *
306
+ * The server timezone is the default and is the difference between GMT and
307
+ * server time. The 'blog' value is the date when the last post was posted. The
308
+ * 'gmt' is when the last post was posted in GMT formatted date.
309
+ *
310
+ * Combination of get_lastpostmodified and get_lastpagemodified
311
+ * defined in wp-includes/post.php since WP 1.2.0
312
+ *
313
+ * @param string $timezone The location to get the time. Can be 'gmt', 'blog', or 'server'.
314
+ * @return string The date of the oldest modified post.
315
+ */
316
+ if( !function_exists('get_lastmodified') ) {
317
+ function get_lastmodified($timezone = 'server') {
318
+ $lastpostmodified = get_lastpostmodified($timezone);
319
+ $lastpagemodified = get_lastpagemodified($timezone);
320
+ if ( mysql2date('U',$lastpostmodified) > mysql2date('U',$lastpagemodified) )
321
+ return $lastpostmodified;
322
+ else
323
+ return $lastpagemodified;
324
+ }
325
+ }
readme.txt CHANGED
@@ -1,24 +1,26 @@
1
  === XML Sitemap Feed ===
2
  Contributors: RavanH
3
- Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&amp;business=ravanhagen%40gmail%2ecom&amp;item_name=XML%20Sitemap%20Feed&amp;item_number=3%2e8&amp;no_shipping=0&amp;tax=0&amp;bn=PP%2dDonationsBF&amp;charset=UTF%2d8
4
  Tags: xml, sitemap, xml sitemap, sitemap.xml, Google, Yahoo, Bing, Live, MSN, seo, wpmu, feed, qtranslate, xlanguage
5
  Requires at least: 2.6
6
  Tested up to: 3.0.1
7
- Stable tag: 3.8.5
8
 
9
- Creates one or more (when using qTranlate or xLanguage) feeds that comply with the XML Sitemap protocol for fast indexing by Google, Yahoo, Bing, Ask and others.
10
 
11
  == Description ==
12
 
13
- This plugin dynamically creates an feed that complies with the **XML Sitemap** protocol. There are no options to be set and the feed becomes instantly available on yourblogurl.tld/sitemap.xml (or yourblogurl.tld/?feed=sitemap), ready for indexing by search engines like Google, Yahoo, MSN, Ask.com and others.
14
 
15
- **Now qTranslate and xLanguage compatible!** Tested in Pre-Path Mode and Query Mode. Each language on your site will have its own XML Sitemap.
 
 
16
 
17
  A reference to it (or _them_, when using qTranslate or xLanguage) is added to the dynamically created **robots.txt** on yourblogurl.tld/robots.txt to tell search engines where to find your XML Sitemap(s).
18
 
19
  **NOTES:**
20
 
21
- 1. If you _do not use fancy URL's_ or you have WordPress installed in a _subdirectory_, a dynamic **robots.txt will not be generated**. _You'll have to create your own and upload it to your site root!_ See FAQ's.
22
 
23
  2. On large sites, it is advised to use a good caching plugin like **Quick Cache**, **WP Super Cache** or **W3 Total Cache** to improve your site _and_ sitemap performance.
24
 
@@ -35,7 +37,7 @@ A reference to it (or _them_, when using qTranslate or xLanguage) is added to th
35
  * The feed contains the front page and all posts and pages but _excludes_ category, tag and other dynamic archive pages. This should not be a problem and by most it is even _advised_ to exclude them. There are SEO plugins around that actively block these archive pages from search engines.
36
  * Except by _re-saving_ older posts from time to time (keeping the lastmod date fairly recent) there is no way to manually control the priority of individual posts/pages in the sitemap. See the Faq's for more.
37
  * This plugin does not ping any search engines. But then, WordPress does this by default already via the Ping-o-Matic service so why bother? See the Faq's for more.
38
- * Because the feed is dynamically created, on _very_ large sites the creation process might take a while. Search engines are said to have a short fuse about waiting for a sitemap, so you may want to consider using a cache plugin that also (pre)caches feeds. If you are unfamiliar with caching and server setup start with an easy caching plugin such as **Quick Cache**. For more options you might find solace in **WP Super Cache** or **W3 Total Cache**.
39
 
40
  = Translations =
41
 
@@ -47,7 +49,7 @@ Since 3.8.5, there is a FILTER hook `xml_sitemap_url` available that lets you fi
47
 
48
  = Credits =
49
 
50
- XML Sitemap Feed was originally based on the (discontinued?) plugin Standard XML Sitemap Generator by Patrick Chia. Many thanks! Since then, it has been completely rewriten.
51
 
52
  == Installation ==
53
 
@@ -99,9 +101,9 @@ Dynamic pages like category pages, tag pages and archive pages are not listed in
99
 
100
  Yes and No. This plugin has no options page so there is no way to manually set the priority of urls in the sitemap. But there is automatic post priority calculation based on _post modifaction date_ and _comment activity_, that can either make post priority go to 100% (1.0) for posts with many and recent comments or 0% (0) for the oldest posts with no comments.
101
 
102
- This feature can be used to your advantage: by re-saving your most important older posts from time to time, keeping the **lastmod date** fairly recent, you can ensure a priority of at least 80% (0.8) for those URLs. And if you have comments on on those pages, the priority will even go up to 90% (0.9).
103
 
104
- If you cannot live with these rules, edit the values `$min_priority`, `$max_priority` and `$frontpage_priority` in xml-sitemap-feed/feed-sitemap.php but be careful to not do an automatic upgrade or it will overwrite your customisation.
105
 
106
  = Do I need to submit the sitemap to search engines? =
107
 
@@ -134,12 +136,12 @@ Or if you have WP installed in a subdirectory, on a server without rewrite_rules
134
 
135
  = My WordPress powered blog is installed in a subdirectory. Does that change anything? =
136
 
137
- That depends on where the index.php and .htaccess of your installation resides. If it is in the root, meaning WP is installed in a subdir but the blog is accessible from your domain root, you do not have to do anything. It should work out of the box. However, if the index.php is (e.g. still with your wp-config.php and all other WP files) in a subdir, meaning your blog is only accessible via that subdir, you need to manage your own robots.txt file in your domain root. It _has_ to be in the root (!) and needs a line starting with `Sitemap:` followed by the full URL to the sitemap feed provided by XML Sitemap Feed plugin. Like:
138
  `
139
  Sitemap: http://yourblogurl.tld/subdir/sitemap.xml
140
  `
141
 
142
- If you already have a robots.txt file with another Sitemap referrence like it, you might want to read more about creating an XML Sitemap Index on [sitemaps.org](http://www.sitemaps.org/protocol.php#index) to be able to referrence both sitemaps.
143
 
144
  = Do I need to use a fancy Permalink structure? =
145
 
@@ -168,13 +170,19 @@ The stylesheet (to make the sitemap human readable) can be edited in `xml-sitema
168
 
169
  The sitemap is dynamically generated just like a feed. There is no actual file created.
170
 
171
- = I do see a sitemap.xml file in site root but it does not seem to get updated! =
172
 
173
  You are most likely looking at a sitemap.xml file that has been created by another XML Sitemap plugin before you started using this plugin. Just remove it and let the plugin dynamically generate it just like a feed. There is no actual file created.
174
 
175
  If that's not the case, you are probably using a caching plugin or your browser does not update to the latest feed output. Please verify.
176
 
177
- = I get an ERROR when opening the sitemap or robots.txt ! =
 
 
 
 
 
 
178
 
179
  The following errors might be encountered:
180
 
@@ -204,6 +212,14 @@ Allow: /
204
  `
205
  and upload it to your web root...
206
 
 
 
 
 
 
 
 
 
207
  = Can I do a Network Activate on WP3.0 MS / Site Wide Activate on WPMU with this plugin ? =
208
 
209
  Yes.
@@ -217,8 +233,21 @@ Yes. Upload the complete /xml-sitemap-feed/ directory to /wp-content/mu-plugins/
217
  1. XML Sitemap feed viewed in a normal browser. For human eyes only ;)
218
  2. XML Sitemap source as read by search engines.
219
 
 
 
 
 
 
220
  == Changelog ==
221
 
 
 
 
 
 
 
 
 
222
  = 3.8.5 =
223
  * **xLanguage support** based on code and testing by **Daniele Pelagatti**
224
  * new FILTER HOOK `robotstxt_sitemap_url` for any translate and url changing plugins.
@@ -283,9 +312,3 @@ Yes. Upload the complete /xml-sitemap-feed/ directory to /wp-content/mu-plugins/
283
  = 0.1 =
284
  * rework from Patrick Chia's [Standard XML Sitemaps](http://wordpress.org/extend/plugins/standard-xml-sitemap/)
285
  * increased post urls limit from 100 to 1000 (of max. 50,000 allowed by the Sitemap protocol)
286
-
287
- == Upgrade Notice ==
288
-
289
- = 3.8.5 =
290
- Automatic xLanguage support thanks to Daniele Pelagatti + new FILTER HOOK for other translate and url changing plugins. BUGFIX: Decimal separator cannot be a comma!
291
-
1
  === XML Sitemap Feed ===
2
  Contributors: RavanH
3
+ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=ravanhagen%40gmail%2ecom&item_name=XML%20Sitemap%20Feed&item_number=3%2e8&no_shipping=0&tax=0&bn=PP%2dDonationsBF&charset=UTF%2d8&lc=us
4
  Tags: xml, sitemap, xml sitemap, sitemap.xml, Google, Yahoo, Bing, Live, MSN, seo, wpmu, feed, qtranslate, xlanguage
5
  Requires at least: 2.6
6
  Tested up to: 3.0.1
7
+ Stable tag: 3.8.8
8
 
9
+ A feed that complies with the XML Sitemap protocol for fast indexing by Google, Yahoo, Bing, Ask and others. Multi-Site and Multi-Lingual compatible!
10
 
11
  == Description ==
12
 
13
+ This plugin dynamically creates a feed that complies with the **XML Sitemap** protocol. There are no options to be set and the feed becomes instantly available on yourblogurl.tld/sitemap.xml (or yourblogurl.tld/?feed=sitemap), ready for indexing by search engines like Google, Yahoo, MSN, Ask.com and others.
14
 
15
+ **Compatible with caching plugins** like Super Cache, W3 Total Cache and Quick Cache that cache feeds, allowing better performance to serve the hungry (impatient) spider.
16
+
17
+ **qTranslate and xLanguage compatible!** Tested in Pre-Path Mode and Query Mode. Each language on your site will have its own XML Sitemap.
18
 
19
  A reference to it (or _them_, when using qTranslate or xLanguage) is added to the dynamically created **robots.txt** on yourblogurl.tld/robots.txt to tell search engines where to find your XML Sitemap(s).
20
 
21
  **NOTES:**
22
 
23
+ 1. If you _do not use fancy URL's_ or you have WordPress installed in a _subdirectory_, a dynamic **robots.txt will NOT be generated**. You'll have to create your own and upload it to your site root! See FAQ's.
24
 
25
  2. On large sites, it is advised to use a good caching plugin like **Quick Cache**, **WP Super Cache** or **W3 Total Cache** to improve your site _and_ sitemap performance.
26
 
37
  * The feed contains the front page and all posts and pages but _excludes_ category, tag and other dynamic archive pages. This should not be a problem and by most it is even _advised_ to exclude them. There are SEO plugins around that actively block these archive pages from search engines.
38
  * Except by _re-saving_ older posts from time to time (keeping the lastmod date fairly recent) there is no way to manually control the priority of individual posts/pages in the sitemap. See the Faq's for more.
39
  * This plugin does not ping any search engines. But then, WordPress does this by default already via the Ping-o-Matic service so why bother? See the Faq's for more.
40
+ * Because the feed is dynamically created, on _very_ large sites the creation process might take a while. Search engines are said to have a short fuse about waiting for a sitemap, so you may want to consider using a cache plugin that also (pre)caches feeds. If you are unfamiliar with caching and server setup start with an easy caching plugin such as **Quick Cache**. For more options (and better performance?) you might find solace in **WP Super Cache** or **W3 Total Cache**.
41
 
42
  = Translations =
43
 
49
 
50
  = Credits =
51
 
52
+ XML Sitemap Feed was originally based on the (discontinued?) plugin Standard XML Sitemap Generator by Patrick Chia. Many thanks! Since then, it has been completely rewritten.
53
 
54
  == Installation ==
55
 
101
 
102
  Yes and No. This plugin has no options page so there is no way to manually set the priority of urls in the sitemap. But there is automatic post priority calculation based on _post modifaction date_ and _comment activity_, that can either make post priority go to 100% (1.0) for posts with many and recent comments or 0% (0) for the oldest posts with no comments.
103
 
104
+ This feature can be used to your advantage: by re-saving your most important older posts from time to time, keeping the **lastmod date** fairly recent, you can ensure a priority of at least 80% (0.8) for those URLs. And if you have enough comments on on those pages, the priority can even go up to 100% (1.0).
105
 
106
+ If you cannot live with these rules, edit the values `$min_priority`, `$max_priority` and `$frontpage_priority` in xml-sitemap-feed/feed-sitemap.php but be careful to NOT do an automatic upgrade or it will overwrite your customisation.
107
 
108
  = Do I need to submit the sitemap to search engines? =
109
 
136
 
137
  = My WordPress powered blog is installed in a subdirectory. Does that change anything? =
138
 
139
+ That depends on where the index.php and .htaccess of your installation reside. If they are in the root while the rest of the WP files are installed in a subdir, so the site is accessible from your domain root, you do not have to do anything. It should work out of the box. But if the index.php is together with your wp-config.php and all other WP files in a subdir, meaning your blog is only accessible via that subdir, you need to manage your own robots.txt file in your **domain root**. It _has_ to be in the root (!) and needs a line starting with `Sitemap:` followed by the full URL to the sitemap feed provided by XML Sitemap Feed plugin. Like:
140
  `
141
  Sitemap: http://yourblogurl.tld/subdir/sitemap.xml
142
  `
143
 
144
+ If you already have a robots.txt file with another Sitemap reference like it, just add the full line below or above it.
145
 
146
  = Do I need to use a fancy Permalink structure? =
147
 
170
 
171
  The sitemap is dynamically generated just like a feed. There is no actual file created.
172
 
173
+ = I see a sitemap.xml file in site root but it does not seem to get updated! =
174
 
175
  You are most likely looking at a sitemap.xml file that has been created by another XML Sitemap plugin before you started using this plugin. Just remove it and let the plugin dynamically generate it just like a feed. There is no actual file created.
176
 
177
  If that's not the case, you are probably using a caching plugin or your browser does not update to the latest feed output. Please verify.
178
 
179
+ = I use a caching plugin but the sitemap is not cached =
180
+
181
+ Some caching plugins have the option to switch on/off caching of feeds. Make sure it is turned on.
182
+
183
+ Frederick Townes, developer of **W3 Total Cache**, says: "There's a checkbox option on the page cache settings tab to cache feeds. They will expire according to the expires field value on the browser cache setting for HTML."
184
+
185
+ = I get an ERROR when opening the sitemap or robots.txt! =
186
 
187
  The following errors might be encountered:
188
 
212
  `
213
  and upload it to your web root...
214
 
215
+ ** Error loading stylesheet: An unknown error has occurred **
216
+
217
+ On some setups (usually using the WordPress MU Domain Mapping plugin) this error occurs. The problem is known, the cause is not... Until I find out why this is happening, please take comfort in knowing that this only affects reading the sitemap in normal browsers but will NOT affect any spidering/indexing on your site. The sitemap is still readable by all search engines!
218
+
219
+ = Can I run this on a WPMU / WP3+ Multi-Site setup? =
220
+
221
+ Yes. In fact, it has been designed for it. Tested on WPMU 2.9.2 and WPMS 3.0.1
222
+
223
  = Can I do a Network Activate on WP3.0 MS / Site Wide Activate on WPMU with this plugin ? =
224
 
225
  Yes.
233
  1. XML Sitemap feed viewed in a normal browser. For human eyes only ;)
234
  2. XML Sitemap source as read by search engines.
235
 
236
+ == Upgrade Notice ==
237
+
238
+ = 3.8.8 =
239
+ Bugfixes: PHP4 compatibility + mu-plugins URL stylesheet
240
+
241
  == Changelog ==
242
 
243
+ = 3.8.8 =
244
+ * Bugfix: PHP4 compatibility
245
+ * Bugfix: stylesheet URL when installed in mu-plugins
246
+
247
+ = 3.8.6 =
248
+ * core change to class
249
+ * minified sitemap output by default
250
+
251
  = 3.8.5 =
252
  * **xLanguage support** based on code and testing by **Daniele Pelagatti**
253
  * new FILTER HOOK `robotstxt_sitemap_url` for any translate and url changing plugins.
312
  = 0.1 =
313
  * rework from Patrick Chia's [Standard XML Sitemaps](http://wordpress.org/extend/plugins/standard-xml-sitemap/)
314
  * increased post urls limit from 100 to 1000 (of max. 50,000 allowed by the Sitemap protocol)
 
 
 
 
 
 
sitemap.xsl.php CHANGED
@@ -5,4 +5,4 @@
5
 
6
  header('Content-Type: text/xsl; charset=utf-8', true);
7
 
8
- echo '<?xml version="1.0" encoding="UTF-8"?>'; ?><xsl:stylesheet version="2.0" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:sitemap="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/><xsl:template match="/"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>XML Sitemap Feed</title><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><style type="text/css">body{font-family:"Lucida Grande","Lucida Sans Unicode",Tahoma,Verdana,sans-serif;font-size:13px}#header,#footer{padding:2px;margin:10px;font-size:8pt;color:gray}a{color:black}td{font-size:11px}th{text-align:left;padding-right:30px;font-size:11px}tr.high{background-color:whitesmoke}</style></head><body><h1>XML Sitemap Feed</h1><div id="header">This is an XML Sitemap to aid search engines like <a href="http://www.google.com">Google</a>, <a href="http://www.bing.com/">Bing</a>, <a href="http://www.yahoo.com">Yahoo!</a> and <a href="http://www.ask.com">Ask</a> indexing your site better. Read more about XML sitemaps on <a href="http://sitemaps.org">Sitemaps.org</a>.</div><div id="content"><table cellpadding="5"><tr style="border-bottom:1px black solid;"><th>#</th><th>URL</th><th>Priority</th><th>Change Frequency</th><th>Last Changed</th></tr><xsl:variable name="lower" select="'abcdefghijklmnopqrstuvwxyz'"/><xsl:variable name="upper" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/><xsl:for-each select="sitemap:urlset/sitemap:url"><tr><xsl:if test="position() mod 2 != 1"><xsl:attribute name="class">high</xsl:attribute></xsl:if><td><xsl:value-of select="position()"/></td><td><xsl:variable name="itemURL"><xsl:value-of select="sitemap:loc"/></xsl:variable><a href="{$itemURL}"><xsl:value-of select="sitemap:loc"/></a></td><td><xsl:value-of select="concat(sitemap:priority*100,'%')"/></td><td><xsl:value-of select="concat(translate(substring(sitemap:changefreq, 1, 1),concat($lower, $upper),concat($upper, $lower)),substring(sitemap:changefreq, 2))"/></td><td><xsl:value-of select="concat(substring(sitemap:lastmod,0,11),concat(' ', substring(sitemap:lastmod,12,5)))"/></td></tr></xsl:for-each></table></div><div id="footer"><img src="<?php echo 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']); ?>/sitemapxml.gif" alt="XML Sitemap" title="XML Sitemap" /> generated by <a href="http://4visions.nl/en/index.php?section=57" title="XML Sitemap Feed plugin for WordPress">XML Sitemap Feed <?php echo $_GET['v'] ?></a> running on <a href="http://wordpress.org/">WordPress</a>.</div></body></html></xsl:template></xsl:stylesheet>
5
 
6
  header('Content-Type: text/xsl; charset=utf-8', true);
7
 
8
+ echo '<?xml version="1.0" encoding="UTF-8"?>'; ?><xsl:stylesheet version="2.0" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:sitemap="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/><xsl:template match="/"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>XML Sitemap Feed</title><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><style type="text/css">body{font-family:"Lucida Grande","Lucida Sans Unicode",Tahoma,Verdana,sans-serif;font-size:13px}#header,#footer{padding:2px;margin:10px;font-size:8pt;color:gray}a{color:black}td{font-size:11px}th{text-align:left;padding-right:30px;font-size:11px}tr.high{background-color:whitesmoke}</style></head><body><h1>XML Sitemap Feed</h1><div id="header">This is an XML Sitemap to aid search engines like <a href="http://www.google.com">Google</a>, <a href="http://www.bing.com/">Bing</a>, <a href="http://www.yahoo.com">Yahoo!</a> and <a href="http://www.ask.com">Ask</a> indexing your site better. Read more about XML sitemaps on <a href="http://sitemaps.org">Sitemaps.org</a>.</div><div id="content"><table cellpadding="5"><tr style="border-bottom:1px black solid;"><th>#</th><th>URL</th><th>Priority</th><th>Change Frequency</th><th>Last Changed</th></tr><xsl:variable name="lower" select="'abcdefghijklmnopqrstuvwxyz'"/><xsl:variable name="upper" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/><xsl:for-each select="sitemap:urlset/sitemap:url"><tr><xsl:if test="position() mod 2 != 1"><xsl:attribute name="class">high</xsl:attribute></xsl:if><td><xsl:value-of select="position()"/></td><td><xsl:variable name="itemURL"><xsl:value-of select="sitemap:loc"/></xsl:variable><a href="{$itemURL}"><xsl:value-of select="sitemap:loc"/></a></td><td><xsl:value-of select="concat(sitemap:priority*100,'%')"/></td><td><xsl:value-of select="concat(translate(substring(sitemap:changefreq, 1, 1),concat($lower, $upper),concat($upper, $lower)),substring(sitemap:changefreq, 2))"/></td><td><xsl:value-of select="concat(substring(sitemap:lastmod,0,11),concat(' ', substring(sitemap:lastmod,12,5)))"/></td></tr></xsl:for-each></table></div><div id="footer"><img src="<?php echo 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']); ?>/sitemapxml.gif" alt="XML Sitemap" title="XML Sitemap" /> generated by <a href="http://4visions.nl/en/wordpress-plugins/xml-sitemap-feed/" title="XML Sitemap Feed plugin for WordPress">XML Sitemap Feed <?php echo $_GET['v'] ?></a> running on <a href="http://wordpress.org/">WordPress</a>.</div></body></html></xsl:template></xsl:stylesheet>
xml-sitemap.php CHANGED
@@ -3,12 +3,12 @@
3
  Plugin Name: XML Sitemap Feed
4
  Plugin URI: http://4visions.nl/en/wordpress-plugins/xml-sitemap-feed/
5
  Description: Creates a feed that complies with the XML Sitemap protocol ready for indexing by Google, Yahoo, Bing, Ask and others. Happy with it? Please leave me a <strong><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=ravanhagen%40gmail%2ecom&item_name=XML%20Sitemap%20Feed&item_number=3%2e8&no_shipping=0&tax=0&bn=PP%2dDonationsBF&charset=UTF%2d8&lc=us">Tip</a></strong> for development and support time. Thanks :)
6
- Version: 3.8.5
7
  Author: RavanH
8
  Author URI: http://4visions.nl/
9
  */
10
 
11
- /* Copyright 2009 RavanH (http://4visions.nl/ email : ravanhagen@gmail.com)
12
 
13
  This program is free software; you can redistribute it and/or modify
14
  it under the terms of the GNU General Public License as published by
@@ -35,454 +35,33 @@ Author URI: http://4visions.nl/
35
  * and for the home URL in the sitemap (receives a STRING and MUST)
36
  * return one) itself. Useful for multi language plugins or other
37
  * plugins that affect the blogs main URL... See pre-defined filter
38
- * xml_sitemap_qtranslate() in this file as an example.
 
39
  * ACTIONS
40
- * [ none at this point, but feel free to request one :) ]
41
  *
42
  */
43
-
44
- /* --------------------
45
- * CONSTANTS
46
- * -------------------- */
47
-
48
- // set version
49
- define('XMLSF_VERSION','3.8.5');
50
-
51
- // dir
52
- $xmlsf_dir = dirname(__FILE__);
53
-
54
- // check if xml-sitemap.php is moved one dir up like in WPMU's /mu-plugins/
55
- // NOTE: don't use WP_PLUGIN_URL to avoid problems when installed in /mu-plugins/
56
- if (file_exists($xmlsf_dir.'/xml-sitemap-feed')) {
57
- define('XMLSF_PLUGIN_DIR', $xmlsf_dir.'/xml-sitemap-feed');
58
- define('XMLSF_PLUGIN_URL', plugins_url('xml-sitemap-feed', __FILE__) );
59
- } else {
60
- define('XMLSF_PLUGIN_DIR', $xmlsf_dir);
61
- define('XMLSF_PLUGIN_URL', plugins_url('', __FILE__) );
62
- }
63
-
64
- /* --------------------
65
- * FUNCTIONS
66
- * -------------------- */
67
-
68
- // FEEDS //
69
- // set up the feed template
70
- function xml_sitemap_load_template() {
71
- load_template( XMLSF_PLUGIN_DIR . '/feed-sitemap.php' );
72
- }
73
-
74
- // REWRITES //
75
- // add sitemap rewrite rules
76
- function xml_sitemap_rewrite($wp_rewrite) {
77
- $feed_rules = array(
78
- 'sitemap.xml$' => $wp_rewrite->index . '?feed=sitemap',
79
- );
80
- $wp_rewrite->rules = $feed_rules + $wp_rewrite->rules;
81
- }
82
- // recreate rewrite rules
83
- function xml_sitemap_flush_rewrite_rules() {
84
- global $wp_rewrite;
85
- $wp_rewrite->flush_rules();
86
- }
87
-
88
- // ROBOTSTXT //
89
- // add sitemap location in robots.txt generated by WP
90
- // available filter : robotstxt_sitemap_url
91
- function xml_sitemap_robots() {
92
-
93
- // hook for filter 'xml_sitemap_url' provides an array here and MUST get an array returned
94
- $sitemap_array = apply_filters('xml_sitemap_url',array(trailingslashit(get_bloginfo('url'))."sitemap.xml"));
95
-
96
- echo "\n# XML Sitemap Feed ".XMLSF_VERSION." (http://4visions.nl/en/wordpress-plugins/xml-sitemap-feed/)";
97
-
98
- if ( is_array($sitemap_array) && !empty($sitemap_array) )
99
- foreach ( $sitemap_array as $url )
100
- echo "\nSitemap: " . $url;
101
- else
102
- echo "\n# Warning: xml sitemap url is missing, filtered out or filter did not return an array.";
103
-
104
- echo "\n\n";
105
- }
106
-
107
- // DE/ACTIVATION //
108
- function xml_sitemap_activate() {
109
- update_option('xml-sitemap-feed-version', XMLSF_VERSION);
110
- xml_sitemap_flush_rewrite_rules();
111
- }
112
- function xml_sitemap_deactivate() {
113
- remove_filter('generate_rewrite_rules', 'xml_sitemap_rewrite');
114
- delete_option('xml-sitemap-feed-version');
115
- xml_sitemap_flush_rewrite_rules();
116
- }
117
-
118
-
119
- // MISSING WORDPRESS FUNCTIONS
120
-
121
- if( !function_exists('get_firstmodified') ) {
122
- function get_firstmodified($timezone = 'server') {
123
- $firstpostmodified = get_firstpostmodified($timezone);
124
- $firstpagemodified = get_firstpagemodified($timezone);
125
- if ( mysql2date('U',$firstpostmodified) < mysql2date('U',$firstpagemodified) )
126
- return $firstpostmodified;
127
- else
128
- return $firstpagemodified;
129
- }
130
- }
131
-
132
- if( !function_exists('get_lastmodified') ) {
133
- function get_lastmodified($timezone = 'server') {
134
- $lastpostmodified = get_lastpostmodified($timezone);
135
- $lastpagemodified = get_lastpagemodified($timezone);
136
- if ( mysql2date('U',$lastpostmodified) > mysql2date('U',$lastpagemodified) )
137
- return $lastpostmodified;
138
- else
139
- return $lastpagemodified;
140
- }
141
- }
142
-
143
- /**
144
- * Retrieve last page modified date depending on timezone.
145
- *
146
- * The server timezone is the default and is the difference between GMT and
147
- * server time. The 'blog' value is just when the last post was modified. The
148
- * 'gmt' is when the last post was modified in GMT time.
149
- *
150
- * Adaptation of get_lastpostmodified defined in wp-includes/post.php since 1.2.0
151
- *
152
- * @uses $wpdb
153
- * @uses $blog_id
154
- * @uses apply_filters() Calls 'get_lastpagemodified' filter
155
- *
156
- * @param string $timezone The location to get the time. Can be 'gmt', 'blog', or 'server'.
157
- * @return string The date the post was last modified.
158
- */
159
- if( !function_exists('get_lastpagemodified') ) {
160
- function get_lastpagemodified($timezone = 'server') {
161
- global $wpdb;
162
-
163
- $add_seconds_server = date('Z');
164
- $timezone = strtolower( $timezone );
165
-
166
- $lastpagemodified = wp_cache_get( "lastpagemodified:$timezone", 'timeinfo' );
167
- if ( $lastpagemodified )
168
- return apply_filters( 'get_lastpagemodified', $lastpagemodified, $timezone );
169
-
170
- switch ( strtolower($timezone) ) {
171
- case 'gmt':
172
- $lastpagemodified = $wpdb->get_var("SELECT post_modified_gmt FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'page' ORDER BY post_modified_gmt DESC LIMIT 1");
173
- break;
174
- case 'blog':
175
- $lastpagemodified = $wpdb->get_var("SELECT post_modified FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'page' ORDER BY post_modified_gmt DESC LIMIT 1");
176
- break;
177
- case 'server':
178
- $lastpagemodified = $wpdb->get_var("SELECT DATE_ADD(post_modified_gmt, INTERVAL '$add_seconds_server' SECOND) FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'page' ORDER BY post_modified_gmt DESC LIMIT 1");
179
- break;
180
- }
181
-
182
- $lastpagedate = get_lastpagedate($timezone);
183
- if ( $lastpagedate > $lastpagemodified )
184
- $lastpagemodified = $lastpagedate;
185
-
186
- if ( $lastpagemodified )
187
- wp_cache_set( "lastpagemodified:$timezone", $lastpagemodified, 'timeinfo' );
188
-
189
- return apply_filters( 'get_lastpagemodified', $lastpagemodified, $timezone );
190
- }
191
- }
192
-
193
- /**
194
- * Retrieve the date that the last page was published.
195
- *
196
- * The server timezone is the default and is the difference between GMT and
197
- * server time. The 'blog' value is the date when the last post was posted. The
198
- * 'gmt' is when the last post was posted in GMT formatted date.
199
- *
200
- * Adaptation of get_lastpostdate defined in wp-includes/post.php since 0.71
201
- *
202
- * @uses $wpdb
203
- * @uses $blog_id
204
- * @uses apply_filters() Calls 'get_lastpagedate' filter
205
- *
206
- * @global mixed $cache_lastpagedate Stores the last post date
207
- * @global mixed $pagenow The current page being viewed
208
- *
209
- * @param string $timezone The location to get the time. Can be 'gmt', 'blog', or 'server'.
210
- * @return string The date of the last post.
211
- */
212
- if( !function_exists('get_lastpagedate') ) {
213
- function get_lastpagedate($timezone = 'server') {
214
- global $cache_lastpagedate, $wpdb, $blog_id;
215
- $add_seconds_server = date('Z');
216
- if ( !isset($cache_lastpagedate[$blog_id][$timezone]) ) {
217
- switch(strtolower($timezone)) {
218
- case 'gmt':
219
- $lastpagedate = $wpdb->get_var("SELECT post_date_gmt FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'page' ORDER BY post_date_gmt DESC LIMIT 1");
220
- break;
221
- case 'blog':
222
- $lastpagedate = $wpdb->get_var("SELECT post_date FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'page' ORDER BY post_date_gmt DESC LIMIT 1");
223
- break;
224
- case 'server':
225
- $lastpagedate = $wpdb->get_var("SELECT DATE_ADD(post_date_gmt, INTERVAL '$add_seconds_server' SECOND) FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'page' ORDER BY post_date_gmt DESC LIMIT 1");
226
- break;
227
- }
228
- $cache_lastpagedate[$blog_id][$timezone] = $lastpagedate;
229
- } else {
230
- $lastpagedate = $cache_lastpagedate[$blog_id][$timezone];
231
- }
232
- return apply_filters( 'get_lastpagedate', $lastpagedate, $timezone );
233
- }
234
- }
235
-
236
- /**
237
- * Retrieve first post modified date depending on timezone.
238
- *
239
- * The server timezone is the default and is the difference between GMT and
240
- * server time. The 'blog' value is the date when the last post was posted. The
241
- * 'gmt' is when the last post was posted in GMT formatted date.
242
- *
243
- * Reverse of get_lastpostmodified defined in wp-includes/post.php since WP 1.2.0
244
- *
245
- * @uses $wpdb
246
- * @uses apply_filters() Calls 'get_firstpostmodified' filter
247
- *
248
- * @param string $timezone The location to get the time. Can be 'gmt', 'blog', or 'server'.
249
- * @return string The date of the oldest modified post.
250
- */
251
- if( !function_exists('get_firstpostmodified') ) {
252
- function get_firstpostmodified($timezone = 'server') {
253
- global $wpdb;
254
-
255
- $add_seconds_server = date('Z');
256
- $timezone = strtolower( $timezone );
257
-
258
- $firstpostmodified = wp_cache_get( "firstpostmodified:$timezone", 'timeinfo' );
259
- if ( $firstpostmodified )
260
- return apply_filters( 'get_firstpostmodified', $firstpostmodified, $timezone );
261
-
262
- switch ( strtolower($timezone) ) {
263
- case 'gmt':
264
- $firstpostmodified = $wpdb->get_var("SELECT post_modified_gmt FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'post' ORDER BY post_modified_gmt ASC LIMIT 1");
265
- break;
266
- case 'blog':
267
- $firstpostmodified = $wpdb->get_var("SELECT post_modified FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'post' ORDER BY post_modified_gmt ASC LIMIT 1");
268
- break;
269
- case 'server':
270
- $firstpostmodified = $wpdb->get_var("SELECT DATE_ADD(post_modified_gmt, INTERVAL '$add_seconds_server' SECOND) FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'post' ORDER BY post_modified_gmt ASC LIMIT 1");
271
- break;
272
- }
273
-
274
- $firstpostdate = get_firstpostdate($timezone);
275
- if ( $firstpostdate > $firstpostmodified )
276
- $firstpostmodified = $firstpostdate;
277
-
278
- if ( $firstpostmodified )
279
- wp_cache_set( "firstpostmodified:$timezone", $firstpostmodified, 'timeinfo' );
280
-
281
- return apply_filters( 'get_firstpostmodified', $firstpostmodified, $timezone );
282
- }
283
- }
284
-
285
- /**
286
- * Retrieve first page modified date depending on timezone.
287
- *
288
- * The server timezone is the default and is the difference between GMT and
289
- * server time. The 'blog' value is the date when the last post was posted. The
290
- * 'gmt' is when the last post was posted in GMT formatted date.
291
- *
292
- * Adaptation of get_firstpostmodified defined in this file
293
- *
294
- * @uses $wpdb
295
- * @uses apply_filters() Calls 'get_firstpagemodified' filter
296
- *
297
- * @param string $timezone The location to get the time. Can be 'gmt', 'blog', or 'server'.
298
- * @return string The date of the oldest modified page.
299
- */
300
- if( !function_exists('get_firstpagemodified') ) {
301
- function get_firstpagemodified($timezone = 'server') {
302
- global $wpdb;
303
-
304
- $add_seconds_server = date('Z');
305
- $timezone = strtolower( $timezone );
306
-
307
- $firstpagemodified = wp_cache_get( "firstpagemodified:$timezone", 'timeinfo' );
308
- if ( $firstpagemodified )
309
- return apply_filters( 'get_firstpagemodified', $firstpagemodified, $timezone );
310
-
311
- switch ( strtolower($timezone) ) {
312
- case 'gmt':
313
- $firstpagemodified = $wpdb->get_var("SELECT post_modified_gmt FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'page' ORDER BY post_modified_gmt ASC LIMIT 1");
314
- break;
315
- case 'blog':
316
- $firstpagemodified = $wpdb->get_var("SELECT post_modified FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'page' ORDER BY post_modified_gmt ASC LIMIT 1");
317
- break;
318
- case 'server':
319
- $firstpagemodified = $wpdb->get_var("SELECT DATE_ADD(post_modified_gmt, INTERVAL '$add_seconds_server' SECOND) FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'page' ORDER BY post_modified_gmt ASC LIMIT 1");
320
- break;
321
- }
322
-
323
- $firstpagedate = get_firstpagedate($timezone);
324
- if ( $firstpagedate > $firstpagemodified )
325
- $firstpagemodified = $firstpagedate;
326
-
327
- if ( $firstpagemodified )
328
- wp_cache_set( "firstpagemodified:$timezone", $firstpagemodified, 'timeinfo' );
329
-
330
- return apply_filters( 'get_firstpagemodified', $firstpagemodified, $timezone );
331
- }
332
- }
333
-
334
- /**
335
- * Retrieve the date that the first post was published.
336
- *
337
- * The server timezone is the default and is the difference between GMT and
338
- * server time. The 'blog' value is the date when the last post was posted. The
339
- * 'gmt' is when the last post was posted in GMT formatted date.
340
- *
341
- * Reverse of get_lastpostdate defined in wp-includes/post.php since 0.71
342
- *
343
- * @uses $wpdb
344
- * @uses $cache_firstpostdate
345
- * @uses $blog_id
346
- * @uses apply_filters() Calls 'get_firstpostdate' filter
347
- *
348
- * @param string $timezone The location to get the time. Can be 'gmt', 'blog', or 'server'.
349
- * @return string The date of the last post.
350
- */
351
- if( !function_exists('get_firstpostdate') ) {
352
- function get_firstpostdate($timezone = 'server') {
353
- global $cache_firstpostdate, $wpdb, $blog_id;
354
- $add_seconds_server = date('Z');
355
- if ( !isset($cache_firstpostdate[$blog_id][$timezone]) ) {
356
- switch(strtolower($timezone)) {
357
- case 'gmt':
358
- $firstpostdate = $wpdb->get_var("SELECT post_date_gmt FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'post' ORDER BY post_date_gmt ASC LIMIT 1");
359
- break;
360
- case 'blog':
361
- $firstpostdate = $wpdb->get_var("SELECT post_date FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'post' ORDER BY post_date_gmt ASC LIMIT 1");
362
- break;
363
- case 'server':
364
- $firstpostdate = $wpdb->get_var("SELECT DATE_ADD(post_date_gmt, INTERVAL '$add_seconds_server' SECOND) FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'post' ORDER BY post_date_gmt ASC LIMIT 1");
365
- break;
366
- }
367
- $cache_firstpostdate[$blog_id][$timezone] = $firstpostdate;
368
- } else {
369
- $firstpostdate = $cache_firstpostdate[$blog_id][$timezone];
370
- }
371
- return apply_filters( 'get_firstpostdate', $firstpostdate, $timezone );
372
- }
373
- }
374
-
375
- /**
376
- * Retrieve the date that the first post was published.
377
- *
378
- * The server timezone is the default and is the difference between GMT and
379
- * server time. The 'blog' value is the date when the last post was posted. The
380
- * 'gmt' is when the last post was posted in GMT formatted date.
381
- *
382
- * Adaptation of get_firstpostdate defined in this file
383
- *
384
- * @uses $wpdb
385
- * @uses $cache_firstpagedate
386
- * @uses $blog_id
387
- * @uses apply_filters() Calls 'get_firstpagedate' filter
388
- *
389
- * @param string $timezone The location to get the time. Can be 'gmt', 'blog', or 'server'.
390
- * @return string The date of the last post.
391
- */
392
- if( !function_exists('get_firstpagedate') ) {
393
- function get_firstpagedate($timezone = 'server') {
394
- global $cache_firstpagedate, $wpdb, $blog_id;
395
- $add_seconds_server = date('Z');
396
- if ( !isset($cache_firstpagedate[$blog_id][$timezone]) ) {
397
- switch(strtolower($timezone)) {
398
- case 'gmt':
399
- $firstpagedate = $wpdb->get_var("SELECT post_date_gmt FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'page' ORDER BY post_date_gmt ASC LIMIT 1");
400
- break;
401
- case 'blog':
402
- $firstpagedate = $wpdb->get_var("SELECT post_date FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'page' ORDER BY post_date_gmt ASC LIMIT 1");
403
- break;
404
- case 'server':
405
- $firstpagedate = $wpdb->get_var("SELECT DATE_ADD(post_date_gmt, INTERVAL '$add_seconds_server' SECOND) FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'page' ORDER BY post_date_gmt ASC LIMIT 1");
406
- break;
407
- }
408
- $cache_firstpagedate[$blog_id][$timezone] = $firstpagedate;
409
- } else {
410
- $firstpagedate = $cache_firstpagedate[$blog_id][$timezone];
411
- }
412
- return apply_filters( 'get_firstpagedate', $firstpagedate, $timezone );
413
- }
414
- }
415
-
416
- // MULTI-LANGUAGE PLUGIN FILTERS
417
-
418
- // qTranslate
419
- function xml_sitemap_qtranslate($input) {
420
- global $q_config;
421
-
422
- if (is_array($input)) // got an array? return one!
423
- foreach ( $input as $url )
424
- foreach($q_config['enabled_languages'] as $language)
425
- $return[] = qtrans_convertURL($url,$language);
426
- else // not an array? just convert the string.
427
- $return = qtrans_convertURL($input);
428
-
429
- return $return;
430
- }
431
-
432
- // xLanguage
433
- function xml_sitemap_xlanguage($input) {
434
- global $xlanguage;
435
-
436
- if (is_array($input)) // got an array? return one!
437
- foreach ( $input as $url )
438
- foreach($xlanguage->options['language'] as $language)
439
- $return[] = $xlanguage->filter_link_in_lang($url,$language['code']);
440
- else // not an array? just convert the string.
441
- $return = $xlanguage->filter_link($input);
442
-
443
- return $return;
444
- }
445
 
446
  /* --------------------
447
- * HOOKS ++
448
  * -------------------- */
 
449
 
450
- // FLUSH RULES check
451
- // limited to after (site wide) plugin upgrade
452
- if (get_option('xml-sitemap-feed-version') != XMLSF_VERSION) {
453
- add_action('init', 'xml_sitemap_flush_rewrite_rules' );
454
- update_option('xml-sitemap-feed-version', XMLSF_VERSION);
455
- }
456
-
457
- if ( '0' == get_option( 'blog_public' ) || ( $wpdb->blogid && function_exists('get_site_option') && get_site_option('tags_blog_id') == $wpdb->blogid ) ) {
458
- // we are on a blog that blocks spiders!
459
- // create NO sitemap
460
- // - OR -
461
- // we are on wpmu and this is a tags blog!
462
- // create NO sitemap since it will be full
463
- // of links outside the blogs own domain...
464
- return;
465
- } else {
466
- // FEEDS
467
- add_action('do_feed_sitemap', 'xml_sitemap_load_template', 10, 1);
468
-
469
- // REWRITES
470
- add_filter('generate_rewrite_rules', 'xml_sitemap_rewrite');
471
 
472
- // ROBOTSTXT
473
- add_action('do_robotstxt', 'xml_sitemap_robots');
474
- }
475
 
476
- // check for qTranslate and activate filter
477
- if (function_exists('qtrans_convertURL'))
478
- add_filter('xml_sitemap_url','xml_sitemap_qtranslate',99);
479
 
480
- // check for xLanguage and activate filter
481
- global $xlanguage;
482
- if (isset($xlanguage))
483
- add_filter('xml_sitemap_url','xml_sitemap_xlanguage',99);
484
 
485
- // DE/ACTIVATION
486
- register_activation_hook( __FILE__, 'xml_sitemap_activate' );
487
- register_deactivation_hook( __FILE__, 'xml_sitemap_deactivate' );
488
 
3
  Plugin Name: XML Sitemap Feed
4
  Plugin URI: http://4visions.nl/en/wordpress-plugins/xml-sitemap-feed/
5
  Description: Creates a feed that complies with the XML Sitemap protocol ready for indexing by Google, Yahoo, Bing, Ask and others. Happy with it? Please leave me a <strong><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=ravanhagen%40gmail%2ecom&item_name=XML%20Sitemap%20Feed&item_number=3%2e8&no_shipping=0&tax=0&bn=PP%2dDonationsBF&charset=UTF%2d8&lc=us">Tip</a></strong> for development and support time. Thanks :)
6
+ Version: 3.8.8
7
  Author: RavanH
8
  Author URI: http://4visions.nl/
9
  */
10
 
11
+ /* Copyright 2010 RavanH (http://4visions.nl/ email : ravanhagen@gmail.com)
12
 
13
  This program is free software; you can redistribute it and/or modify
14
  it under the terms of the GNU General Public License as published by
35
  * and for the home URL in the sitemap (receives a STRING and MUST)
36
  * return one) itself. Useful for multi language plugins or other
37
  * plugins that affect the blogs main URL... See pre-defined filter
38
+ * XMLSitemapFeed::qtranslate() in XMLSitemapFeed.class.php as an
39
+ * example.
40
  * ACTIONS
41
+ * [ none at this point, but feel free to request, suggest or code one :) ]
42
  *
43
  */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
 
45
  /* --------------------
46
+ * CONSTANTS
47
  * -------------------- */
48
+ define('XMLSF_VERSION','3.8.8');
49
 
50
+ if (file_exists(dirname(__FILE__).'/xml-sitemap-feed'))
51
+ define('XMLSF_PLUGIN_DIR', dirname(__FILE__).'/xml-sitemap-feed');
52
+ else
53
+ define('XMLSF_PLUGIN_DIR', dirname(__FILE__));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
 
55
+ /* -----------------
56
+ * CLASS
57
+ * ----------------- */
58
 
59
+ if( class_exists('XMLSitemapFeed') || include( XMLSF_PLUGIN_DIR . '/XMLSitemapFeed.class.php' ) )
60
+ XMLSitemapFeed::go();
 
61
 
62
+ /* -------------------------------------
63
+ * MISSING WORDPRESS FUNCTIONS
64
+ * ------------------------------------- */
 
65
 
66
+ include_once(XMLSF_PLUGIN_DIR . '/hacks.php');
 
 
67