XML Sitemap & Google News feeds - Version 3.9.2

Version Description

Google News stylesheet, bugfixes, WP 3.4 compatibility, basic Polylang compatibility, speed improvement and sticky posts get max priority now

=

Download this release

Release Info

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

Code changes from version 3.9.1 to 3.9.2

XMLSitemapFeed.class.php CHANGED
@@ -5,94 +5,145 @@
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_sitemap'), 10, 1);
22
- add_action('do_feed_sitemap-news', array(__CLASS__, 'load_template_sitemap_news'), 10, 1);
23
-
24
- // REWRITES
25
- add_filter('generate_rewrite_rules', array(__CLASS__, 'rewrite') );
26
-
27
- // ROBOTSTXT
28
- add_action('do_robotstxt', array(__CLASS__, 'robots') );
29
- }
30
-
31
- // DE-ACTIVATION
32
- register_deactivation_hook( XMLSF_PLUGIN_DIR . '/xml-sitemap.php', array(__CLASS__, 'deactivate') );
33
- }
34
 
35
- // FEEDS //
36
  // set up the sitemap template
37
- function load_template_sitemap() {
38
  load_template( XMLSF_PLUGIN_DIR . '/feed-sitemap.php' );
39
  }
40
 
41
  // set up the news sitemap template
42
- function load_template_sitemap_news() {
43
  load_template( XMLSF_PLUGIN_DIR . '/feed-sitemap-news.php' );
44
  }
45
 
 
 
 
 
 
46
  // Create a new filtering function that will add a where clause to the query,
47
  // used for the Google News Sitemap
48
- function xml_sitemap_feed_news_filter_where($where = '') {
49
- //posts in the last 2 days
50
- $where .= " AND post_date > '" . date('Y-m-d', strtotime('-2 days')) . "'";
51
- return $where;
52
  }
 
 
 
 
53
 
54
- // REWRITES //
55
  // add sitemap rewrite rules
56
- function rewrite($wp_rewrite) {
57
  $feed_rules = array(
58
- 'sitemap.xml$' => $wp_rewrite->index . '?feed=sitemap',
59
- 'sitemap-news.xml$' => $wp_rewrite->index . '?feed=sitemap-news',
60
  );
61
  $wp_rewrite->rules = $feed_rules + $wp_rewrite->rules;
62
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
 
64
- // ROBOTSTXT //
65
  // add sitemap location in robots.txt generated by WP
66
- // available filter : robotstxt_sitemap_url
67
- function robots() {
68
 
69
  // hook for filter 'xml_sitemap_url' provides an array here and MUST get an array returned
70
  $blog_url = trailingslashit(get_bloginfo('url'));
71
- $sitemap_array = apply_filters('xml_sitemap_url',array($blog_url."sitemap.xml",$blog_url."sitemap-news.xml"));
72
 
73
- echo "\n# XML Sitemap Feed ".XMLSF_VERSION." (http://4visions.nl/en/wordpress-plugins/xml-sitemap-feed/)";
74
 
75
  if ( is_array($sitemap_array) && !empty($sitemap_array) )
76
  foreach ( $sitemap_array as $url )
77
  echo "\nSitemap: " . $url;
78
  else
79
- echo "\n# Warning: xml sitemap url is missing, filtered out or filter did not return an array.";
80
 
81
  echo "\n\n";
82
  }
83
 
84
- // DE-ACTIVATION
85
- function deactivate() {
 
 
 
86
  remove_filter('generate_rewrite_rules', array(__CLASS__, 'rewrite') );
87
  delete_option('xml-sitemap-feed-version');
88
  global $wp_rewrite;
89
  $wp_rewrite->flush_rules();
90
  }
91
 
92
- // MULTI-LANGUAGE PLUGIN FILTERS
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93
 
94
  // qTranslate
95
- function qtranslate($input) {
96
  global $q_config;
97
 
98
  if (is_array($input)) // got an array? return one!
@@ -106,7 +157,7 @@ class XMLSitemapFeed {
106
  }
107
 
108
  // xLanguage
109
- function xlanguage($input) {
110
  global $xlanguage;
111
 
112
  if (is_array($input)) // got an array? return one!
@@ -114,25 +165,58 @@ class XMLSitemapFeed {
114
  foreach($xlanguage->options['language'] as $language)
115
  $return[] = $xlanguage->filter_link_in_lang($url,$language['code']);
116
  else // not an array? just convert the string.
117
- $return = $xlanguage->filter_link($input);
118
 
119
  return $return;
120
  }
121
 
122
- function init() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
123
  // FLUSH RULES after (site wide) plugin upgrade
124
  if (get_option('xml-sitemap-feed-version') != XMLSF_VERSION) {
125
  update_option('xml-sitemap-feed-version', XMLSF_VERSION);
126
  global $wp_rewrite;
127
  $wp_rewrite->flush_rules();
 
128
  }
 
 
 
 
 
 
129
 
 
 
 
 
 
 
130
  // check for qTranslate and add filter
131
- if (defined('QT_LANGUAGE'))
132
  add_filter('xml_sitemap_url', array(__CLASS__, 'qtranslate'), 99);
133
-
134
  // check for xLanguage and add filter
135
- if (defined('xLanguageTagQuery'))
136
  add_filter('xml_sitemap_url', array(__CLASS__, 'xlanguage'), 99);
137
  }
138
 
5
 
6
  class XMLSitemapFeed {
7
 
8
+ /**
9
+ * FEEDS
10
+ */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
 
 
12
  // set up the sitemap template
13
+ public static function load_template() {
14
  load_template( XMLSF_PLUGIN_DIR . '/feed-sitemap.php' );
15
  }
16
 
17
  // set up the news sitemap template
18
+ public static function load_template_news() {
19
  load_template( XMLSF_PLUGIN_DIR . '/feed-sitemap-news.php' );
20
  }
21
 
22
+ // override default feed limit
23
+ public static function filter_limits( $limits ) {
24
+ return 'LIMIT 0, 49999';
25
+ }
26
+
27
  // Create a new filtering function that will add a where clause to the query,
28
  // used for the Google News Sitemap
29
+ public static function filter_news_where($where = '') {
30
+ //posts from the last 2 days (48 hours + 1 hour to be sure)
31
+ return $where . " AND post_date > '" . date('Y-m-d', strtotime('-49 hours')) . "'";
 
32
  }
33
+
34
+ /**
35
+ * REWRITES
36
+ */
37
 
 
38
  // add sitemap rewrite rules
39
+ public static function rewrite($wp_rewrite) {
40
  $feed_rules = array(
41
+ XMLSF_NAME . '$' => $wp_rewrite->index . '?feed=sitemap',
42
+ XMLSF_NEWS_NAME . '$' => $wp_rewrite->index . '?feed=sitemap-news',
43
  );
44
  $wp_rewrite->rules = $feed_rules + $wp_rewrite->rules;
45
  }
46
+
47
+ /**
48
+ * Remove the trailing slash from permalinks that have an extension,
49
+ * such as /sitemap.xml (thanks to Permalink Editor plugin for WordPress)
50
+ *
51
+ * @param string $request
52
+ */
53
+
54
+ public static function trailingslash($request) {
55
+ if (pathinfo($request, PATHINFO_EXTENSION)) {
56
+ return untrailingslashit($request);
57
+ }
58
+ return $request; //trailingslashit($request);
59
+ }
60
+
61
+ /**
62
+ * ROBOTSTXT
63
+ */
64
 
 
65
  // add sitemap location in robots.txt generated by WP
66
+ // available filter : xml_sitemap_url
67
+ public static function robots() {
68
 
69
  // hook for filter 'xml_sitemap_url' provides an array here and MUST get an array returned
70
  $blog_url = trailingslashit(get_bloginfo('url'));
71
+ $sitemap_array = apply_filters('xml_sitemap_url',array($blog_url.XMLSF_NAME,$blog_url.XMLSF_NEWS_NAME));
72
 
73
+ echo "\n# XML Sitemap Feed ".XMLSF_VERSION." (http://status301.net/wordpress-plugins/xml-sitemap-feed/)";
74
 
75
  if ( is_array($sitemap_array) && !empty($sitemap_array) )
76
  foreach ( $sitemap_array as $url )
77
  echo "\nSitemap: " . $url;
78
  else
79
+ echo "\n# Warning: xml sitemap url is missing, was filtered out or filter did not return an array.";
80
 
81
  echo "\n\n";
82
  }
83
 
84
+ /**
85
+ * DE-ACTIVATION
86
+ */
87
+
88
+ public static function deactivate() {
89
  remove_filter('generate_rewrite_rules', array(__CLASS__, 'rewrite') );
90
  delete_option('xml-sitemap-feed-version');
91
  global $wp_rewrite;
92
  $wp_rewrite->flush_rules();
93
  }
94
 
95
+ /**
96
+ * REQUEST FILTER
97
+ */
98
+
99
+ public static function filter_request( $request ) {
100
+ if (isset($request['feed'])) {
101
+ if ( $request['feed'] == 'sitemap' ) {
102
+ add_filter( 'post_limits', array( __CLASS__, 'filter_limits' ) );
103
+
104
+ $types_arr = explode(',',XMLSF_POST_TYPE);
105
+ $request['post_type'] = (in_array('any',$types_arr)) ? 'any' : $types_arr;
106
+ $request['orderby'] = 'modified';
107
+ }
108
+ if ( $request['feed'] == 'sitemap-news' ) {
109
+ add_filter( 'post_limits', array( __CLASS__, 'filter_limits' ) );
110
+ add_filter( 'posts_where', array( __CLASS__, 'filter_news_where' ), 10, 1 );
111
+
112
+ $types_arr = explode(',',XMLSF_NEWS_POST_TYPE);
113
+ $request['post_type'] = (in_array('any',$types_arr)) ? 'any' : $types_arr;
114
+ }
115
+ }
116
+
117
+ return $request;
118
+ }
119
+
120
+ /**
121
+ * MULTI-LANGUAGE PLUGIN FILTERS
122
+ */
123
+
124
+ // Polylang
125
+ public static function polylang($input) {
126
+ global $polylang;
127
+ $options = get_option('polylang');
128
+
129
+ if (is_array($input)) { // got an array? return one!
130
+ if ('1' == $options['force_lang'] )
131
+ foreach ( $input as $url )
132
+ foreach($polylang->get_languages_list() as $language)
133
+ $return[] = $polylang->add_language_to_link($url,$language);
134
+ else
135
+ foreach ( $input as $url )
136
+ foreach($polylang->get_languages_list() as $language)
137
+ $return[] = add_query_arg('lang', $language->slug, $url);
138
+ } else { // not an array? do nothing, Polylang does all the work :)
139
+ $return = $input;
140
+ }
141
+
142
+ return $return;
143
+ }
144
 
145
  // qTranslate
146
+ public static function qtranslate($input) {
147
  global $q_config;
148
 
149
  if (is_array($input)) // got an array? return one!
157
  }
158
 
159
  // xLanguage
160
+ public static function xlanguage($input) {
161
  global $xlanguage;
162
 
163
  if (is_array($input)) // got an array? return one!
165
  foreach($xlanguage->options['language'] as $language)
166
  $return[] = $xlanguage->filter_link_in_lang($url,$language['code']);
167
  else // not an array? just convert the string.
168
+ $return = $xlanguage->filter_link($input);
169
 
170
  return $return;
171
  }
172
 
173
+ public static function init() {
174
+
175
+ global $wpdb, $query;
176
+
177
+ if ( '0' == get_option( 'blog_public' ) || ( $wpdb->blogid && function_exists('get_site_option') && get_site_option('tags_blog_id') == $wpdb->blogid ) )
178
+ return;
179
+ // we are on a blog that blocks spiders! >> create NO sitemap
180
+ // - OR -
181
+ // we are on wpmu and this is a tags blog! >> create NO sitemap
182
+ // since it will be full of links outside the blogs own domain...
183
+
184
+ // DE-ACTIVATION
185
+ register_deactivation_hook( XMLSF_PLUGIN_DIR . '/xml-sitemap.php', array(__CLASS__, 'deactivate') );
186
+
187
+ // FEEDS
188
+ add_action('do_feed_sitemap', array(__CLASS__, 'load_template'), 10, 1);
189
+ add_action('do_feed_sitemap-news', array(__CLASS__, 'load_template_news'), 10, 1);
190
+
191
+ // REWRITES
192
+ add_filter('generate_rewrite_rules', array(__CLASS__, 'rewrite') );
193
+ add_filter('user_trailingslashit', array(__CLASS__, 'trailingslash') );
194
+
195
  // FLUSH RULES after (site wide) plugin upgrade
196
  if (get_option('xml-sitemap-feed-version') != XMLSF_VERSION) {
197
  update_option('xml-sitemap-feed-version', XMLSF_VERSION);
198
  global $wp_rewrite;
199
  $wp_rewrite->flush_rules();
200
+ // TODO fix PHP Fatal error:Call to a member function flush_rules() on a non-object in /var/www/wordpress/wp-content/plugins/xml-sitemap-feed/XMLSitemapFeed.class.php after (any?) plugin upgrade
201
  }
202
+
203
+ // ROBOTSTXT
204
+ add_action('do_robotstxt', array(__CLASS__, 'robots') );
205
+
206
+ // REQUEST
207
+ add_filter('request', array(__CLASS__, 'filter_request'), 1 );
208
 
209
+
210
+ // LANGUAGE PLUGINS
211
+ // check for Polylang and add filter
212
+ global $polylang;
213
+ if (isset($polylang))
214
+ add_filter('xml_sitemap_url', array(__CLASS__, 'polylang'), 99);
215
  // check for qTranslate and add filter
216
+ elseif (defined('QT_LANGUAGE'))
217
  add_filter('xml_sitemap_url', array(__CLASS__, 'qtranslate'), 99);
 
218
  // check for xLanguage and add filter
219
+ elseif (defined('xLanguageTagQuery'))
220
  add_filter('xml_sitemap_url', array(__CLASS__, 'xlanguage'), 99);
221
  }
222
 
feed-sitemap-news.php CHANGED
@@ -1,17 +1,39 @@
1
  <?php
2
  /**
3
- * XML Sitemap Feed Template for displaying an XML Sitemap feed.
4
  *
5
  * @package XML Sitemap Feed plugin for WordPress
6
  */
7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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').'"?>
12
  <!-- generated-on="'.date('Y-m-d\TH:i:s+00:00').'" -->
13
  <!-- generator="XML & Google News 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:news="http://www.google.com/schemas/sitemap-news/0.9">';
17
 
@@ -19,54 +41,38 @@ $maxURLS = 1000; // maximum number of URLs allowed in a news sitemap.
19
 
20
  // editing below here is not advised!
21
 
22
- // Register the filtering function
23
- add_filter('posts_where', array('XMLSitemapFeed','xml_sitemap_feed_news_filter_where'), 10, 1 );
24
-
25
- // Perform the query, the filter will be applied automatically
26
- query_posts( array(
27
- 'post_type' => 'post',
28
- // 'post_status' => 'publish',
29
- 'caller_get_posts' => 1,
30
- // 'nopaging' => true,
31
- 'posts_per_page' => -1 )
32
- );
33
-
34
- global $wp_query;
35
- $wp_query->is_404 = false; // force is_404() condition to false when on site without posts
36
- $wp_query->is_feed = true; // force is_feed() condition to true so WP Super Cache includes
37
- // the sitemap in its feeds cache
38
-
39
- // prepare counter to limit the number of URLs to the absolute max of 50.000
40
  $counter = 1;
41
 
42
  // loop away!
43
- if ( have_posts() ) : while ( have_posts() && $counter < $maxURLS ) : the_post();
44
 
45
  // check if we are not dealing with an external URL :: Thanks, Francois Deschenes :)
46
- if(!preg_match('/^' . preg_quote(get_bloginfo('url'), '/') . '/i', get_permalink())) continue;
47
-
48
- // get the article language
49
- // qTranslate compatibility, xLanguage no longer developed ?
50
- //global $q_config;
51
- //if ( isset($q_config['language']) )
52
- // $lang = $q_config['language'];
53
- //elseif ( get_option('WPLANG') )
54
- // $lang = get_option('WPLANG');
55
- //else
56
- // $lang = 'en';
57
- //$lang_arr = explode( '_', $lang, 5 );
58
-
59
  // get the article tags
 
 
60
  // TODO : include categories too ??
61
 
62
- $keys_arr = get_the_tags();
63
-
64
- ?><url><loc><?php echo esc_url( get_permalink() ) ?></loc><news:news><news:publication><news:name><?php bloginfo('name'); ?></news:name><news:language><?php echo get_option('rss_language'); ?></news:language></news:publication><news:publication_date><?php echo mysql2date('Y-m-d\TH:i:s+00:00', $post->post_date_gmt, false); ?></news:publication_date><news:title><?php the_title(); ?></news:title><news:keywords><?php $comma = 0; if ($keys_arr) foreach($keys_arr as $key) { if ( $comma == 1 ) { echo ', '; } echo $key->name; $comma = 1; } ?></news:keywords><news:genres>Blog</news:genres></news:news></url><?php
65
 
66
  $counter++;
67
 
68
- endwhile; endif;
69
- // see what we can do for :
 
 
 
 
 
 
 
 
 
 
 
70
  //<news:access>Subscription</news:access> (for now always leave off)
71
  // and
72
  //<news:genres>Blog</news:genres> (for now leave as Blog)
1
  <?php
2
  /**
3
+ * Google News Sitemap Feed Template
4
  *
5
  * @package XML Sitemap Feed plugin for WordPress
6
  */
7
 
8
+ if ( !have_posts() ) :
9
+
10
+ // No posts? Temporary redirect to the main xml sitemap.
11
+ wp_redirect( 'sitemap.xml' ); // default 302... maybe 304 not modified is better?
12
+ exit;
13
+
14
+ // ALTERNATIVE:
15
+ // No posts? Then go and get at least one last post to prevent GWT validation error.
16
+ // Remove the filtering functions
17
+ remove_filter( 'posts_where', array( 'XMLSitemapFeed', 'filter_news_where' ), 10, 1 );
18
+ remove_filter( 'post_limits', array( 'XMLSitemapFeed', 'filter_limits' ) );
19
+
20
+ // Perform the alternative query
21
+ query_posts( 'posts_per_page=1' );
22
+
23
+ global $wp_query;
24
+ $wp_query->is_404 = false; // force is_404() condition to false when on site without posts
25
+ $wp_query->is_feed = true; // force is_feed() condition to true so WP Super Cache includes
26
+ // the sitemap in its feeds cache
27
+
28
+ endif;
29
+
30
  status_header('200'); // force header('HTTP/1.1 200 OK') for sites without posts
31
  header('Content-Type: text/xml; charset=' . get_bloginfo('charset'), true);
32
 
33
+ echo '<?xml version="1.0" encoding="'.get_bloginfo('charset').'"?><?xml-stylesheet type="text/xsl" href="' . plugins_url('',__FILE__) . '/sitemap-news.xsl.php?ver=' . XMLSF_VERSION . '"?>
34
  <!-- generated-on="'.date('Y-m-d\TH:i:s+00:00').'" -->
35
  <!-- generator="XML & Google News Sitemap Feed plugin for WordPress" -->
36
+ <!-- generator-url="http://4visions.nl/wordpress-plugins/xml-sitemap-feed/" -->
37
  <!-- generator-version="'.XMLSF_VERSION.'" -->
38
  <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:news="http://www.google.com/schemas/sitemap-news/0.9">';
39
 
41
 
42
  // editing below here is not advised!
43
 
44
+ // prepare counter to limit the number of URLs to the absolute max of $maxURLS
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  $counter = 1;
46
 
47
  // loop away!
48
+ while ( have_posts() && $counter < $maxURLS ) : the_post();
49
 
50
  // check if we are not dealing with an external URL :: Thanks, Francois Deschenes :)
51
+ if(!preg_match('/^' . preg_quote(home_url(), '/') . '/i', get_permalink())) continue;
52
+
 
 
 
 
 
 
 
 
 
 
 
53
  // get the article tags
54
+ $keys_arr = get_the_tags();
55
+
56
  // TODO : include categories too ??
57
 
58
+ ?>
59
+ <url><loc><?php echo esc_url( get_permalink() ) ?></loc><news:news><news:publication><news:name><?php if(defined('XMLSF_GOOGLE_NEWS_NAME')) echo strip_tags(XMLSF_GOOGLE_NEWS_NAME); else echo strip_tags(get_bloginfo('name')); ?></news:name><news:language><?php echo reset(explode('-', get_bloginfo_rss('language'))); /*bloginfo_rss('language') returns impropper format*/ ?></news:language></news:publication><news:publication_date><?php echo mysql2date('Y-m-d\TH:i:s+00:00', $post->post_date_gmt, false); ?></news:publication_date><news:title><?php echo strip_tags(get_the_title(get_the_ID())); ?></news:title><news:keywords><?php $comma = 0; if ($keys_arr) foreach($keys_arr as $key) { if ( $comma == 1 ) { echo ', '; } echo $key->name; $comma = 1; } ?></news:keywords><news:genres>Blog</news:genres></news:news></url><?php
 
60
 
61
  $counter++;
62
 
63
+ endwhile;
64
+
65
+ // Now what if there are no posts less than 48 hours old? We get an urlset without url nodes...
66
+ // ... resulting in an error by Google Webmaster Tools :(
67
+ // But what can we do? Nothing, I suppose.
68
+
69
+ //else :
70
+
71
+ // echo '<url><loc></loc><news:news><news:publication><news:name>';
72
+ // bloginfo('name');
73
+ // echo '</news:name><news:language>' . get_option('rss_language') . '</news:language></news:publication><news:publication_date></news:publication_date><news:title></news:title><news:keywords></news:keywords><news:genres>Blog</news:genres></news:news></url>';
74
+
75
+ // TODO see what we can do for :
76
  //<news:access>Subscription</news:access> (for now always leave off)
77
  // and
78
  //<news:genres>Blog</news:genres> (for now leave as Blog)
feed-sitemap.php CHANGED
@@ -5,18 +5,18 @@
5
  * @package XML Sitemap Feed plugin for WordPress
6
  */
7
 
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('siteurl').'/'.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 & Google News Sitemap Feed plugin for WordPress" -->
14
- <!-- generator-url="http://4visions.nl/en/wordpress-plugins/xml-sitemap-feed/" -->
15
- <!-- generator-version="'.XMLSF_VERSION.'" -->
16
  ';
17
 
18
- // presets are changable
19
- // please read comments:
20
  $max_priority = 1.0; // Maximum priority value for any URL in the sitemap; set to any other value between 0 and 1.
21
  $min_priority = 0; // Minimum priority value for any URL in the sitemap; set to any other value between 0 and 1.
22
  // NOTE: Changing these values will influence each URL's priority. Priority values are taken by
@@ -25,39 +25,28 @@ $min_priority = 0; // Minimum priority value for any URL in the sitemap; set to
25
  $frontpage_priority = 1.0; // Your front page priority, usually the same as max priority but if you have any reason
26
  // to change it, please be my guest; set to any other value between 0 and 1.
27
 
28
- $maxURLS = 50000; // maximum number of URLs allowed in any sitemap.
29
  $level_weight = 0.1; // Makes a sub-page loose 10% for each level; set to any other value between 0 and 1.
30
  $month_weight = 0.1; // Fall-back value normally ignored by automatic priority calculation, which
31
  // makes a post loose 10% of priority monthly; set to any other value between 0 and 1.
32
 
33
- // editing below here is not advised!
34
 
35
  // Memory issue fix will try to increase allowed PHP memory size to XMLSF_MEMORY_LIMIT constant
36
  // as set in xml-sitemap.php if the current memory limit is lower than that.
37
- if ( function_exists('memory_get_usage') && ( (int) @ini_get('memory_limit') < abs(intval(XMLSF_MEMORY_LIMIT)) ) ) {
38
- if ( $memory_limit = @ini_set('memory_limit', XMLSF_MEMORY_LIMIT) ) {
39
- echo '<!-- memory-limit-increase="' . ( abs(intval(XMLSF_MEMORY_LIMIT)) - (int) $memory_limit ) . 'M" -->
40
  ';
41
- } else {
42
- echo '<!-- memory-limit="' . @ini_get('memory_limit') . '" -->
 
 
 
 
43
  ';
44
  }
45
  }
46
 
47
- // the main query
48
- query_posts( array(
49
- 'post_type' => 'any',
50
- // 'post_status' => 'publish',
51
- // 'caller_get_posts' => 1,
52
- // 'nopaging' => true,
53
- 'posts_per_page' => -1 )
54
- );
55
-
56
- global $wp_query;
57
- $wp_query->is_404 = false; // force is_404() condition to false when on site without posts
58
- $wp_query->is_feed = true; // force is_feed() condition to true so WP Super Cache includes
59
- // the sitemap in its feeds cache
60
-
61
  // setup site variables
62
  $_post_count = wp_count_posts('post');
63
  $_page_count = wp_count_posts('page');
@@ -65,7 +54,7 @@ $_totalcommentcount = wp_count_comments();
65
 
66
  $lastmodified_gmt = get_lastmodified('GMT'); // last posts or page modified date
67
  $lastmodified = mysql2date('U',$lastmodified_gmt); // last posts or page modified date in Unix seconds
68
- $firstmodified = mysql2date('U',get_firstmodified('GMT')); // uses new get_firstmodified() function defined in xml-sitemap.php !
69
 
70
  // calculated presets
71
  if ($_totalcommentcount->approved > 0)
@@ -87,21 +76,21 @@ else
87
  $age_weight = $month_weight / 2629744 ; // else just do 10% per month (that's a month in seconds)
88
 
89
  // prepare counter to limit the number of URLs to the absolute max of 50.000
90
- $counter = 1;
91
 
92
  // start with the main URL
93
  ?>
94
  <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"><url><loc><?php
95
  // hook for filter 'xml_sitemap_url' provides a string here and MUST get a string returned
96
- $url = apply_filters( 'xml_sitemap_url', trailingslashit(get_bloginfo('url')) );
97
- if ( is_string($url) ) echo esc_url( $url ); else echo esc_url( trailingslashit(get_bloginfo('url')) );
98
  ?></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
99
 
100
  // then loop away!
101
- if ( have_posts() ) : while ( have_posts() && $counter < $maxURLS ) : the_post();
102
 
103
  // check if we are not dealing with an external URL :: Thanks, Francois Deschenes :)
104
- if(!preg_match('/^' . preg_quote(get_bloginfo('url'), '/') . '/i', get_permalink())) continue;
105
 
106
  $thispostmodified_gmt = $post->post_modified_gmt; // post GMT timestamp
107
  $thispostmodified = mysql2date('U',$thispostmodified_gmt); // post Unix timestamp
@@ -138,13 +127,16 @@ if ( have_posts() ) : while ( have_posts() && $counter < $maxURLS ) : the_post()
138
  $offset = (($post->comment_count - $average_commentcount) * $comment_weight) - (count($ancestors) * $level_weight);
139
  $priority = $page_priority + $offset;
140
  } else {
141
- $offset = (($post->comment_count - $average_commentcount) * $comment_weight) - (($lastmodified - $thispostmodified) * $age_weight);
 
 
 
142
  $priority = $post_priority + $offset;
143
  }
144
  // trim priority
145
  $priority = ($priority > $max_priority) ? $max_priority : $priority;
146
- $priority = ($priority < $min_priority) ? $min_priority : $priority;
147
- ?><url><loc><?php echo esc_url( get_permalink() ) ?></loc><lastmod><?php echo mysql2date('Y-m-d\TH:i:s+00:00', $thispostmodified_gmt, false) ?></lastmod><changefreq><?php
148
  if(($lastactivityage/86400) < 7) { // last activity less than 1 week old
149
  ?>daily<?php
150
  } else if(($lastactivityage/604800) < 12) { // last activity between 1 and 12 weeks old
@@ -153,7 +145,7 @@ if ( have_posts() ) : while ( have_posts() && $counter < $maxURLS ) : the_post()
153
  ?>monthly<?php
154
  } else { ?>yearly<?php
155
  } ?></changefreq><priority><?php echo number_format($priority,1) ?></priority></url><?php
156
- $counter++;
157
 
158
  endwhile; endif;
159
  ?></urlset>
5
  * @package XML Sitemap Feed plugin for WordPress
6
  */
7
 
8
+ status_header('200'); // force header('HTTP/1.1 200 OK') even 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="' . plugins_url('/sitemap.xsl.php',XMLSF_PLUGIN_DIR . '/feed-sitemap.php') . '?ver=' . XMLSF_VERSION . '"?>
12
+ <!-- generated-on="' . date('Y-m-d\TH:i:s+00:00') . '" -->
13
  <!-- generator="XML & Google News 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
+
20
  $max_priority = 1.0; // Maximum priority value for any URL in the sitemap; set to any other value between 0 and 1.
21
  $min_priority = 0; // Minimum priority value for any URL in the sitemap; set to any other value between 0 and 1.
22
  // NOTE: Changing these values will influence each URL's priority. Priority values are taken by
25
  $frontpage_priority = 1.0; // Your front page priority, usually the same as max priority but if you have any reason
26
  // to change it, please be my guest; set to any other value between 0 and 1.
27
 
28
+ //$maxURLS = 50000; // maximum number of URLs allowed in any sitemap.
29
  $level_weight = 0.1; // Makes a sub-page loose 10% for each level; set to any other value between 0 and 1.
30
  $month_weight = 0.1; // Fall-back value normally ignored by automatic priority calculation, which
31
  // makes a post loose 10% of priority monthly; set to any other value between 0 and 1.
32
 
33
+ // EDITING below here is NOT ADVISED!
34
 
35
  // Memory issue fix will try to increase allowed PHP memory size to XMLSF_MEMORY_LIMIT constant
36
  // as set in xml-sitemap.php if the current memory limit is lower than that.
37
+ if ( function_exists('memory_get_usage') ) {
38
+ echo '<!-- memory-limit="' . @ini_get('memory_limit') . '" -->
 
39
  ';
40
+ if ( (int) @ini_get('memory_limit') < abs(intval(XMLSF_MEMORY_LIMIT)) ) {
41
+ if ( $memory_limit = @ini_set('memory_limit', XMLSF_MEMORY_LIMIT) )
42
+ echo '<!-- memory-limit increased ' . ( abs(intval(XMLSF_MEMORY_LIMIT)) - (int) $memory_limit ) . 'M to ' . abs(intval(XMLSF_MEMORY_LIMIT)) . 'M successfully -->
43
+ ';
44
+ else
45
+ echo '<!-- memory-limit increase failed, trying anyway... -->
46
  ';
47
  }
48
  }
49
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
  // setup site variables
51
  $_post_count = wp_count_posts('post');
52
  $_page_count = wp_count_posts('page');
54
 
55
  $lastmodified_gmt = get_lastmodified('GMT'); // last posts or page modified date
56
  $lastmodified = mysql2date('U',$lastmodified_gmt); // last posts or page modified date in Unix seconds
57
+ $firstmodified = mysql2date('U',get_firstmodified('GMT')); // uses new get_firstmodified() function defined in xml-sitemap/hacks.php !
58
 
59
  // calculated presets
60
  if ($_totalcommentcount->approved > 0)
76
  $age_weight = $month_weight / 2629744 ; // else just do 10% per month (that's a month in seconds)
77
 
78
  // prepare counter to limit the number of URLs to the absolute max of 50.000
79
+ //$counter = 1;
80
 
81
  // start with the main URL
82
  ?>
83
  <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"><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(home_url()) );
86
+ if ( is_string($url) ) echo esc_url( $url ); else echo esc_url( trailingslashit(home_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 :)
93
+ if(!preg_match('/^' . preg_quote(home_url(), '/') . '/i', get_permalink())) continue;
94
 
95
  $thispostmodified_gmt = $post->post_modified_gmt; // post GMT timestamp
96
  $thispostmodified = mysql2date('U',$thispostmodified_gmt); // post Unix timestamp
127
  $offset = (($post->comment_count - $average_commentcount) * $comment_weight) - (count($ancestors) * $level_weight);
128
  $priority = $page_priority + $offset;
129
  } else {
130
+ if(is_sticky($post->ID))
131
+ $offset = $max_priority - $post_priority;
132
+ else
133
+ $offset = (($post->comment_count - $average_commentcount) * $comment_weight) - (($lastmodified - $thispostmodified) * $age_weight);
134
  $priority = $post_priority + $offset;
135
  }
136
  // trim priority
137
  $priority = ($priority > $max_priority) ? $max_priority : $priority;
138
+ $priority = ($priority < $min_priority) ? $min_priority : $priority; ?>
139
+ <url><loc><?php echo esc_url( get_permalink() ) ?></loc><lastmod><?php echo mysql2date('Y-m-d\TH:i:s+00:00', $thispostmodified_gmt, false) ?></lastmod><changefreq><?php
140
  if(($lastactivityage/86400) < 7) { // last activity less than 1 week old
141
  ?>daily<?php
142
  } else if(($lastactivityage/604800) < 12) { // last activity between 1 and 12 weeks old
145
  ?>monthly<?php
146
  } else { ?>yearly<?php
147
  } ?></changefreq><priority><?php echo number_format($priority,1) ?></priority></url><?php
148
+ // $counter++;
149
 
150
  endwhile; endif;
151
  ?></urlset>
readme.txt CHANGED
@@ -3,22 +3,26 @@ 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, news sitemap, sitemap.xml, Google, Google News, Yahoo, Bing, Live, MSN, seo, wpmu, feed, qtranslate, xlanguage
5
  Requires at least: 2.6
6
- Tested up to: 3.3.1
7
- Stable tag: 3.9.1
8
 
9
- Feeds that comply with the XML Sitemap and Google News 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 feeds that comply with the **XML Sitemap** and the **Google News Sitemap** protocol. It is Multi-Site and Multi-Lingual compatible and there are no options to be set nor file or dir access rights to be tampered with.
14
 
15
- You or your site owners on your Multi-site network will not be bothered with complicated settings like other XML Sitemap plugins. XML sitemap values like ChangeFreq and URL Priority is auto-calculated based on post age and comment activity.
16
 
17
  The feeds become instantly available: One XML Sitemap on yourblogurl.tld/sitemap.xml (or yourblogurl.tld/?feed=sitemap), ready for indexing by search engines like Google, Yahoo, MSN, Ask.com and others. And one Google News Sitemap on yourblogurl.tld/sitemap-news.xml (or yourblogurl.tld/?feed=sitemap-news), ready for indexing by Google News. Both are automatically referenced in the dynamically created **robots.txt** on yourblogurl.tld/robots.txt to tell search engines where to find your XML Sitemaps.
18
 
19
- **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.
20
 
21
- **qTranslate and xLanguage compatible!** Tested in Pre-Path Mode and Query Mode. Each language on your site will have its own XML Sitemap.
 
 
 
 
22
 
23
  **NOTES:**
24
 
@@ -29,17 +33,17 @@ The feeds become instantly available: One XML Sitemap on yourblogurl.tld/sitemap
29
  = Advantages =
30
 
31
  * The main advantage of this plugin over other XML Sitemap plugins is **simplicity**. No need to change file or folder permissions, move files or spend time on a difficult plugin options page. In fact, there are no options at all!
32
- * Completely **automatic** post URL _priority_ and _change frequency_ calculation based on post age and comment and trackback activity.
33
- * Works out-of-the-box, even on **multi-site / shared codebase / multi-blog setups** like WordPress MU, WP 3.0 in MultiSite (WPMS) mode and others.
34
- * Also works upon **Network Activate** or placed in **/mu-plugins/** on WP 3.0 in MS mode and WPMU and even takes care to exclude any tags blogs to avoid malus points for link spamming.
35
  * Compatible with multi-lingual sites using **qTranslate** or **xLanguage** to allow all languages to be indexed equally.
36
 
37
  = Limitations =
38
 
39
  * 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.
40
  * 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.
41
- * 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.
42
- * 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**.
43
 
44
  = Translations =
45
 
@@ -51,7 +55,8 @@ Since 3.8.5, there is a FILTER hook `xml_sitemap_url` available that lets you fi
51
 
52
  = Credits =
53
 
54
- 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 and extended in many ways.
 
55
 
56
  == Installation ==
57
 
@@ -87,17 +92,32 @@ The plugin works best from the **/mu-plugins/** folder where it runs quietly in
87
 
88
  Installed alongside [WordPress MU Sitewide Tags Pages](http://wordpress.org/extend/plugins/wordpress-mu-sitewide-tags/), XML Sitemap Feed will **not** create a sitemap.xml nor change robots.txt for any **tag blogs**. This is done deliberately because they would be full of links outside the tags blogs own domain and subsequently ignored (or worse: penalised) by Google.
89
 
 
90
  == Frequently Asked Questions ==
91
 
 
 
 
 
 
 
 
 
92
  = How do I get my latest articles listed on Google News? =
93
 
94
  Go to [Suggest News Content for Google News](http://www.google.com/support/news_pub/bin/request.py?contact_type=suggest_content) and submit your website info as detailed as possible there. Give them the URL(s) of your fresh new Google News Sitemap in the text field 'Other' at the bottom.
95
 
96
  You will also want to add the sitemap to your [Google Webmasters Tools account](https://www.google.com/webmasters/tools/) to check its validity and performance. Create an account if you don't have one yet.
97
 
98
- = My Google News Sitemap is empty! =
 
 
 
 
99
 
100
- The rules of the Google News game are that you do not feed the cookie monster any stale food. Older than 2 days is bad. You need to bake him some fresh bread ;)
 
 
101
 
102
  = How are the values for priority and changefreq calculated? =
103
 
@@ -122,16 +142,7 @@ If you cannot live with these rules, edit the values `$min_priority`, `$max_prio
122
  No. In normal circumstances, your site will be indexed by the major search engines before you know it. The search engines will be looking for a robots.txt file and (with this plugin activated) find a pointer in it to the XML Sitemap on your blog. The search engines will return on a regular basis to see if your site has updates.
123
  ( Read more about _Ping-O-Matic_ under **Does this plugin ping search engines** (below) to make sure your site is under _normal circumstances_ ;) )
124
 
125
- **But** if you have a server _without rewrite rules_, use your blog _without fancy URLs_ (meaning, you have WordPress Permalinks set to the old Default value) or have it installed in a _subdirectory_, read **Do I need to change my robots.txt** for more instructions.
126
-
127
- = Does this plugin ping search engines? =
128
-
129
- No. While other XML Sitemap plugins provide pinging to some search engines upon each post edit or publication, this plugin does not. There are two reasons for that:
130
-
131
- 1. WordPress has a built-in pinging feature. Go in your WP Admin section to Settings > Writing and make sure that the text area under **Update services** contains at least `http://rpc.pingomatic.com`. Read more on [Ping-O-Matic](http://pingomatic.com) about what excellent service you are actually getting _for free with every WordPress blog_ installation!
132
- 1. For the average website, in my experience, pinging Google or others after each little change does not benefit anything except a theoretical smaller delay in re-indexation of your website. This is only theoretical because if your site is popular and active, major search engines will likely be crawling your site on a very regular basis anyway. And if, on the other hand, your site is not high on the agenda of the major search engines, they will likely give no priority to your pings at all.
133
-
134
- You can always take a [Google Webmasters Tools account](https://www.google.com/webmasters/tools/) which will tell you many interesting things about your website, sitemap downloads, search terms and your visitors. Try it!
135
 
136
  = Do I need to change my robots.txt? =
137
 
@@ -143,7 +154,7 @@ Or if you have WP installed in a subdirectory, on a server without rewrite_rules
143
 
144
  = My WordPress powered blog is installed in a subdirectory. Does that change anything? =
145
 
146
- 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:
147
  `
148
  Sitemap: http://yourblogurl.tld/subdir/sitemap.xml
149
  `
@@ -179,7 +190,7 @@ The sitemap is dynamically generated just like a feed. There is no actual file c
179
 
180
  = I see a sitemap.xml file in site root but it does not seem to get updated! =
181
 
182
- 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.
183
 
184
  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.
185
 
@@ -191,11 +202,13 @@ Frederick Townes, developer of **W3 Total Cache**, says: "There's a checkbox opt
191
 
192
  = I get an ERROR when opening the sitemap or robots.txt! =
193
 
194
- The following errors might be encountered:
 
 
195
 
196
  **404 page instead of my sitemap.xml**
197
 
198
- Try to refresh the Permalink structure in WordPress. Go to Settings > Permalinks and re-save them. Then reload the XML Sitemap in your browser with a clean browser cache. ( Try Ctrl+R to bypass the browser cache -- this works on most but not all browsers. )
199
 
200
  **404 page instead of both sitemap.xml and robots.txt**
201
 
@@ -219,40 +232,52 @@ Allow: /
219
  `
220
  and upload it to your web root...
221
 
222
- ** Error loading stylesheet: An unknown error has occurred **
223
 
224
  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!
225
 
226
- = Can I run this on a WPMU / WP3+ Multi-Site setup? =
227
 
228
- Yes. In fact, it has been designed for it. Tested on WPMU 2.9.2 and WPMS 3.0.1 both with normal activation and with Network Activate / Site Wide Activate.
229
 
230
- = Can I run this plugin from /mu-plugins/ on WP3.0 MS or WPMU ? =
231
 
232
- Yes. Upload the complete /xml-sitemap-feed/ directory to /wp-content/mu-plugins/ and move the file xml-sitemap.php one dir up.
233
 
234
  == Screenshots ==
235
 
236
  1. XML Sitemap feed viewed in a normal browser. For human eyes only ;)
237
  2. XML Sitemap source as read by search engines.
238
 
 
239
  == Upgrade Notice ==
240
 
241
- = 3.9.1 =
242
- XSS vulnerability fix release.
243
 
244
  == Changelog ==
245
 
 
 
 
 
 
 
 
 
 
 
 
 
246
  = 3.9.1 =
247
- * BUGFIX: XSS vulnerability in sitemap.xsl.php
248
 
249
  = 3.9 =
250
  * Google News Sitemap
251
  * Memory limit error workaround (for most sites)
252
 
253
  = 3.8.8 =
254
- * Bugfix: PHP4 compatibility
255
- * Bugfix: stylesheet URL when installed in mu-plugins
256
  * core change to class
257
  * minified sitemap output by default
258
 
@@ -293,7 +318,7 @@ XSS vulnerability fix release.
293
  * WP 3.0 (normal and MS mode) ready
294
 
295
  = 3.4 =
296
- * bugfix: use home instead of siteurl for blog url for sitemap reference in robots.txt
297
  * code streamline and cleanup
298
 
299
  = 3.3 =
@@ -301,13 +326,13 @@ XSS vulnerability fix release.
301
 
302
  = 3.2 =
303
  * rewrite and add_feed calls improvements
304
- * bugfix: double entry when static page is frontpage
305
 
306
  = 3.0 =
307
  * added styling to the xml feed to make it human readable
308
 
309
  = 2.1 =
310
- * bugfix: lastmod timezone offset displayed wrong (extra space and missing double-colon)
311
 
312
  = 2.0 =
313
  * priority calculation based on comments and age
@@ -315,7 +340,7 @@ XSS vulnerability fix release.
315
 
316
  = 1.0 =
317
  * changed feed template location to avoid the need to relocate files outside the plugins folder
318
- * bugfix: `get_post_modified_time` instead of `get_post_time`
319
 
320
  = 0.1 =
321
  * rework from Patrick Chia's [Standard XML Sitemaps](http://wordpress.org/extend/plugins/standard-xml-sitemap/)
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, news sitemap, sitemap.xml, Google, Google News, Yahoo, Bing, Live, MSN, seo, wpmu, feed, qtranslate, xlanguage
5
  Requires at least: 2.6
6
+ Tested up to: 3.4
7
+ Stable tag: 3.9.2
8
 
9
+ Feeds that comply with the XML and Google News Sitemap protocol for fast indexing by Google, Yahoo, Bing, Ask and others.
10
 
11
  == Description ==
12
 
13
  This plugin dynamically creates feeds that comply with the **XML Sitemap** and the **Google News Sitemap** protocol. It is Multi-Site and Multi-Lingual compatible and there are no options to be set nor file or dir access rights to be tampered with.
14
 
15
+ Site owners will not be bothered with complicated settings unlike with other XML Sitemap plugins. XML Sitemap values like ChangeFreq and URL Priority are auto-calculated based on post update age and comment activity.
16
 
17
  The feeds become instantly available: One XML Sitemap on yourblogurl.tld/sitemap.xml (or yourblogurl.tld/?feed=sitemap), ready for indexing by search engines like Google, Yahoo, MSN, Ask.com and others. And one Google News Sitemap on yourblogurl.tld/sitemap-news.xml (or yourblogurl.tld/?feed=sitemap-news), ready for indexing by Google News. Both are automatically referenced in the dynamically created **robots.txt** on yourblogurl.tld/robots.txt to tell search engines where to find your XML Sitemaps.
18
 
19
+ Please read the FAQ's for info on how to get your articles listed on Google News.
20
 
21
+ **Multi-Site compatible**
22
+
23
+ **Compatible with caching plugins** like WP Super Cache, W3 Total Cache and Quick Cache that cache feeds, allowing a faster serving to the hungry, impatient (!) spiders. Read the FAQ's for WP Super Cache instructions.
24
+
25
+ **qTranslate and xLanguage compatible!** Tested in Pre-Path Mode and Query Mode. Each language on your site will have its own XML Sitemap.
26
 
27
  **NOTES:**
28
 
33
  = Advantages =
34
 
35
  * The main advantage of this plugin over other XML Sitemap plugins is **simplicity**. No need to change file or folder permissions, move files or spend time on a difficult plugin options page. In fact, there are no options at all!
36
+ * Completely **automatic** post URL _priority_ and _change frequency_ calculation based on post modification age and comment and trackback activity.
37
+ * Works out-of-the-box, even on **multi-site / shared codebase / multi-blog setups** like WordPress MU, WP 3+ in MultiSite mode (WPMS) and others.
38
+ * Also works upon **Network Activate** or placed in **/mu-plugins/** on WP 3+ in MS mode and WPMU and even takes care to exclude any tags blogs to avoid malus points for link spamming.
39
  * Compatible with multi-lingual sites using **qTranslate** or **xLanguage** to allow all languages to be indexed equally.
40
 
41
  = Limitations =
42
 
43
  * 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.
44
  * 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.
45
+ * Because the feed is dynamically created, on 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**.
46
+ * On **VERY** large sites (read: over 10.000 posts) with limited memory assigned to PHP, the generation of the sitemap might cause a problem when the process runs out of memory. See the FAQ's for tips to increase the PHP memory limit on your server.
47
 
48
  = Translations =
49
 
55
 
56
  = Credits =
57
 
58
+ 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 and extended in many ways.
59
+
60
 
61
  == Installation ==
62
 
92
 
93
  Installed alongside [WordPress MU Sitewide Tags Pages](http://wordpress.org/extend/plugins/wordpress-mu-sitewide-tags/), XML Sitemap Feed will **not** create a sitemap.xml nor change robots.txt for any **tag blogs**. This is done deliberately because they would be full of links outside the tags blogs own domain and subsequently ignored (or worse: penalised) by Google.
94
 
95
+
96
  == Frequently Asked Questions ==
97
 
98
+ = Can I run this on a WPMU / WP3+ Multi-Site setup? =
99
+
100
+ Yes. In fact, it has been designed for it. Tested on WPMU 2.9.2 and WPMS 3.0.1 both with normal activation and with Network Activate / Site Wide Activate.
101
+
102
+ = Can I run this plugin from /mu-plugins/ on WP3.0 MS or WPMU ? =
103
+
104
+ Yes. Upload the complete /xml-sitemap-feed/ directory to /wp-content/mu-plugins/ and move the file xml-sitemap.php one dir up.
105
+
106
  = How do I get my latest articles listed on Google News? =
107
 
108
  Go to [Suggest News Content for Google News](http://www.google.com/support/news_pub/bin/request.py?contact_type=suggest_content) and submit your website info as detailed as possible there. Give them the URL(s) of your fresh new Google News Sitemap in the text field 'Other' at the bottom.
109
 
110
  You will also want to add the sitemap to your [Google Webmasters Tools account](https://www.google.com/webmasters/tools/) to check its validity and performance. Create an account if you don't have one yet.
111
 
112
+ = I'm using WP Super Cache but the feed is not cached =
113
+
114
+ Even though the WP Super Cache time-stamp at the bottom of the feed source shows just fine, reloading the sitemap will show a new (different) timestamp. This is true for all feeds, not just the sitemap feed provided by this plugin.
115
+
116
+ Even though WP Super Cache is not able to create a static copy of feeds, it still does caching via the legacy WP Cache and in PHP mode with the '304 Not Modified browser caching' option enabled your sitemap speed will benefit greatly.
117
 
118
+ = The Google News Sitemap gets redirected to the XML Sitemap! =
119
+
120
+ The rules of the Google News game are that you do not feed the hungry spider any stale food. Older than 2 days is bad. You need to bake her some fresh flies ;)
121
 
122
  = How are the values for priority and changefreq calculated? =
123
 
142
  No. In normal circumstances, your site will be indexed by the major search engines before you know it. The search engines will be looking for a robots.txt file and (with this plugin activated) find a pointer in it to the XML Sitemap on your blog. The search engines will return on a regular basis to see if your site has updates.
143
  ( Read more about _Ping-O-Matic_ under **Does this plugin ping search engines** (below) to make sure your site is under _normal circumstances_ ;) )
144
 
145
+ **But** if you use your blog _without fancy URLs_ (meaning, you have WordPress Permalinks set to the old Default value) or have it installed in a _subdirectory_, read **Do I need to change my robots.txt** for more instructions.
 
 
 
 
 
 
 
 
 
146
 
147
  = Do I need to change my robots.txt? =
148
 
154
 
155
  = My WordPress powered blog is installed in a subdirectory. Does that change anything? =
156
 
157
+ That depends on where the index.php of your installation resides. 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:
158
  `
159
  Sitemap: http://yourblogurl.tld/subdir/sitemap.xml
160
  `
190
 
191
  = I see a sitemap.xml file in site root but it does not seem to get updated! =
192
 
193
+ 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 the file and let this plugin dynamically generate your XML Sitemap just like a feed. There will be no actual file created.
194
 
195
  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.
196
 
202
 
203
  = I get an ERROR when opening the sitemap or robots.txt! =
204
 
205
+ The absolute first thing you need to check is your blogs privacy settings. Go to **Settings > Privacy** and make sure you are **allowing search engines to index your site**. If they are blocked, your sitemap will _not_ be available.
206
+
207
+ If that did not solve the issue, check the following errors that might be encountered along with their respective solutions:
208
 
209
  **404 page instead of my sitemap.xml**
210
 
211
+ Try to refresh the Permalink structure in WordPress. Go to Settings > Permalinks and re-save them. Then reload the XML Sitemap in your browser with a clean browser cache. Hit Ctrl+R to bypass the browser cache -- this works on most but not all browsers.
212
 
213
  **404 page instead of both sitemap.xml and robots.txt**
214
 
232
  `
233
  and upload it to your web root...
234
 
235
+ **Error loading stylesheet: An unknown error has occurred**
236
 
237
  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!
238
 
239
+ = I see only a BLANK (white) page when opening the sitemap =
240
 
241
+ You might be experiencing an issue with your servers PHP memory limit. The plugin attempts to increase the memory limit to 256M by itself but in some rare cases that does not work. Or your site is just so big that that is not even enough... In those cases, you should see a messages like `PHP Fatal error: Allowed memory size of xxxxxx bytes exhausted.` in your server/account error log file.
242
 
243
+ Read more on (Increasing memory allocated to PHP)[http://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP] (try a value higher than 256M) or ask your hosting provider what you can do.
244
 
 
245
 
246
  == Screenshots ==
247
 
248
  1. XML Sitemap feed viewed in a normal browser. For human eyes only ;)
249
  2. XML Sitemap source as read by search engines.
250
 
251
+
252
  == Upgrade Notice ==
253
 
254
+ = 3.9.2 =
255
+ Google News stylesheet, bugfixes, WP 3.4 compatibility, basic Polylang compatibility, speed improvement and sticky posts get max priority now
256
 
257
  == Changelog ==
258
 
259
+ = 3.9.2 =
260
+ * BUGFIX: Google News language not rendered on WP 3.4
261
+ * Changeable XML Sitemap and News feed names (through constants)
262
+ * Basic support for Custom Post Types for News feed (through constant)
263
+ * Basic Polylang compatibility
264
+ * Basic Google News feed stylesheet
265
+ * improvement on XSS vulnerability fix
266
+ * Fixed trailing slash
267
+ * Speed improvement: removed extra query_posts()
268
+ * Sticky posts get max priority
269
+ * BUGFIX: PHP4 construct
270
+
271
  = 3.9.1 =
272
+ * SECURITY FIX: XSS vulnerability in sitemap.xsl.php
273
 
274
  = 3.9 =
275
  * Google News Sitemap
276
  * Memory limit error workaround (for most sites)
277
 
278
  = 3.8.8 =
279
+ * BUGFIX: PHP4 compatibility
280
+ * BUGFIX: stylesheet URL when installed in mu-plugins
281
  * core change to class
282
  * minified sitemap output by default
283
 
318
  * WP 3.0 (normal and MS mode) ready
319
 
320
  = 3.4 =
321
+ * BUGFIX: use home instead of siteurl for blog url for sitemap reference in robots.txt
322
  * code streamline and cleanup
323
 
324
  = 3.3 =
326
 
327
  = 3.2 =
328
  * rewrite and add_feed calls improvements
329
+ * BUGFIX: double entry when static page is frontpage
330
 
331
  = 3.0 =
332
  * added styling to the xml feed to make it human readable
333
 
334
  = 2.1 =
335
+ * BUGFIX: lastmod timezone offset displayed wrong (extra space and missing double-colon)
336
 
337
  = 2.0 =
338
  * priority calculation based on comments and age
340
 
341
  = 1.0 =
342
  * changed feed template location to avoid the need to relocate files outside the plugins folder
343
+ * BUGFIX: `get_post_modified_time` instead of `get_post_time`
344
 
345
  = 0.1 =
346
  * rework from Patrick Chia's [Standard XML Sitemaps](http://wordpress.org/extend/plugins/standard-xml-sitemap/)
sitemap-news.xsl.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /* ------------------------------------------
3
+ XML News Sitemap Feed Styleheet Template
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:news="http://www.google.com/schemas/sitemap-news/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>Google News 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}#footer img{vertical-align:bottom}</style></head><body><h1>Google News Sitemap Feed</h1><div id="header">This is a Google News Sitemap to aid <a href="http://news.google.com">Google News</a> finding news from the <strong><em>last 48 hours</em></strong> on your website. Read more about <a href="http://www.google.com/schemas/sitemap-news/0.9/">Google News Sitemaps</a>, submit your site via <a href="http://www.google.com/support/news_pub/bin/request.py?contact_type=suggest_content">Google propose news content</a> and add it in your <a href="https://www.google.com/webmasters/tools/">Google Webmaster Tools</a> account.</div><div id="content"><table cellpadding="5"><tr style="border-bottom:1px black solid;"><th>#</th><th>URL</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></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://status301.net/wordpress-plugins/xml-sitemap-feed/" title="XML Sitemap Feed plugin for WordPress">XML &amp; Google News Sitemap Feed <?php echo (preg_match( '`^\d{1,2}\.\d{1,2}(\.\d{1,2})?$`' , $_GET['ver'] )) ? $_GET['ver'] : ''; ?></a> running on <a href="http://wordpress.org/">WordPress</a>.</div></body></html></xsl:template></xsl:stylesheet>
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}#footer img{vertical-align:text-bottom}</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 &amp; Google News Sitemap Feed <?php echo (is_numeric($_GET['v'])) ? $_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}#footer img{vertical-align:bottom}</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://status301.net/wordpress-plugins/xml-sitemap-feed/" title="XML Sitemap Feed plugin for WordPress">XML &amp; Google News Sitemap Feed <?php echo (preg_match( '`^\d{1,2}\.\d{1,2}(\.\d{1,2})?$`' , $_GET['ver'] )) ? $_GET['ver'] : ''; ?></a> running on <a href="http://wordpress.org/">WordPress</a>.</div></body></html></xsl:template></xsl:stylesheet>
xml-sitemap.php CHANGED
@@ -1,14 +1,15 @@
1
  <?php
2
  /*
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.9.1
 
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
@@ -32,33 +33,53 @@ Author URI: http://4visions.nl/
32
  * FILTERS
33
  * xml_sitemap_url -> Filters the URL used in the sitemap reference in robots.txt
34
  * (receives an ARRAY and MUST return one; can be multiple urls)
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.9.1');
49
- define('XMLSF_MEMORY_LIMIT','128M');
50
 
51
- if (file_exists(dirname(__FILE__).'/xml-sitemap-feed'))
52
- define('XMLSF_PLUGIN_DIR', dirname(__FILE__).'/xml-sitemap-feed');
 
 
53
  else
54
- define('XMLSF_PLUGIN_DIR', dirname(__FILE__));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
 
56
  /* -----------------
57
  * CLASS
58
  * ----------------- */
59
 
60
- if( class_exists('XMLSitemapFeed') || include( XMLSF_PLUGIN_DIR . '/XMLSitemapFeed.class.php' ) )
61
- XMLSitemapFeed::go();
62
 
63
  /* -------------------------------------
64
  * MISSING WORDPRESS FUNCTIONS
1
  <?php
2
  /*
3
  Plugin Name: XML Sitemap Feed
4
+ Plugin URI: http://status301.net/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
+ Text Domain: xml-sitemap-feed
7
+ Version: 3.9.2
8
  Author: RavanH
9
+ Author URI: http://status301.net/
10
  */
11
 
12
+ /* Copyright 2010 RavanH (http://status301.net/ email : ravanhagen@gmail.com)
13
 
14
  This program is free software; you can redistribute it and/or modify
15
  it under the terms of the GNU General Public License as published by
33
  * FILTERS
34
  * xml_sitemap_url -> Filters the URL used in the sitemap reference in robots.txt
35
  * (receives an ARRAY and MUST return one; can be multiple urls)
36
+ * and for the home URL in the sitemap (receives a STRING and MUST
37
  * return one) itself. Useful for multi language plugins or other
38
  * plugins that affect the blogs main URL... See pre-defined filter
39
  * XMLSitemapFeed::qtranslate() in XMLSitemapFeed.class.php as an
40
  * example.
41
  * ACTIONS
42
+ * [ none at this point, but feel free to request, suggest or submit one :) ]
43
  *
44
  */
45
 
46
+ if(!empty($_SERVER['SCRIPT_FILENAME']) && 'xml-sitemap.php' == basename($_SERVER['SCRIPT_FILENAME']))
47
+ die('You can not access this page directly!');
48
+
49
  /* --------------------
50
  * CONSTANTS
51
  * -------------------- */
 
 
52
 
53
+ define('XMLSF_VERSION', '3.9.2');
54
+
55
+ if ( file_exists ( dirname(__FILE__).'/xml-sitemap-feed' ) )
56
+ define('XMLSF_PLUGIN_DIR', dirname(__FILE__) . '/xml-sitemap-feed');
57
  else
58
+ define('XMLSF_PLUGIN_DIR', dirname(__FILE__));
59
+
60
+ /* The following constants can be overridden by defining them in wp-config.php */
61
+
62
+ if ( !defined('XMLSF_MEMORY_LIMIT') )
63
+ define('XMLSF_MEMORY_LIMIT', '256M');
64
+
65
+ if ( !defined('XMLSF_POST_TYPE') )
66
+ define('XMLSF_POST_TYPE', 'any');
67
+
68
+ if ( !defined('XMLSF_NEWS_POST_TYPE') )
69
+ define('XMLSF_NEWS_POST_TYPE', 'post');
70
+
71
+ if ( !defined('XMLSF_NAME') )
72
+ define('XMLSF_NAME', 'sitemap.xml');
73
+
74
+ if ( !defined('XMLSF_NEWS_NAME') )
75
+ define('XMLSF_NEWS_NAME', 'sitemap-news.xml');
76
 
77
  /* -----------------
78
  * CLASS
79
  * ----------------- */
80
 
81
+ if ( class_exists('XMLSitemapFeed') || include( XMLSF_PLUGIN_DIR . '/XMLSitemapFeed.class.php' ) )
82
+ XMLSitemapFeed::init();
83
 
84
  /* -------------------------------------
85
  * MISSING WORDPRESS FUNCTIONS