XML Sitemap & Google News feeds - Version 4.4.1

Version Description

Multiple default genres, several bugfixes, dropping Google News old geolocation tag plus XMLSF_POST_TYPE and XMLSF_NEWS_POST_TYPE.

=

Download this release

Release Info

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

Code changes from version 4.4 to 4.4.1

hacks.php CHANGED
@@ -47,7 +47,7 @@ if( !function_exists('get_lastdate') ) {
47
 
48
  sort($lastmodified);
49
  $lastmodified = array_filter($lastmodified);
50
- return apply_filters( 'get_lastdate', reset($lastmodified), $timezone );
51
  }
52
  }
53
 
47
 
48
  sort($lastmodified);
49
  $lastmodified = array_filter($lastmodified);
50
+ return apply_filters( 'get_lastdate', end($lastmodified), $timezone );
51
  }
52
  }
53
 
includes/admin.php CHANGED
@@ -3,7 +3,9 @@
3
  * XMLSF Admin CLASS
4
  * ------------------------------ */
5
 
6
- class XMLSF_Admin extends XMLSitemapFeed {
 
 
7
 
8
  /**
9
  * SETTINGS
@@ -21,7 +23,7 @@
21
  if (isset($options['sitemap']))
22
  echo '<span class="description"> &nbsp;&ndash;&nbsp; <a href="#xmlsf" id="xmlsf_link">'.translate('Settings').'</a> &nbsp;&ndash;&nbsp; <a href="'.trailingslashit(get_bloginfo('url')). ( ('' == get_option('permalink_structure')) ? '?feed=sitemap' : $options['sitemap'] ) .'" target="_blank">'.translate('View').'</a></span>';
23
 
24
- echo '<br />
25
  <label><input type="checkbox" name="'.$prefix.'sitemaps[sitemap-news]" id="xmlsf_sitemaps_news" value="'.XMLSF_NEWS_NAME.'" '.checked(isset($options['sitemap-news']), true, false).' '.disabled($disabled, true, false).' /> '.__('Google News Sitemap','xml-sitemap-feed').'</label>';
26
  if (isset($options['sitemap-news']))
27
  echo '<span class="description"> &nbsp;&ndash;&nbsp; <a href="#xmlnf" id="xmlnf_link">'.translate('Settings').'</a> &nbsp;&ndash;&nbsp; <a href="'.trailingslashit(get_bloginfo('url')). ( ('' == get_option('permalink_structure')) ? '?feed=sitemap-news' : $options['sitemap-news'] ) .'" target="_blank">'.translate('View').'</a></span>';
@@ -137,7 +139,7 @@
137
  }
138
  date_default_timezone_set('UTC');
139
  }
140
- echo '</span><br />';
141
  }
142
 
143
  echo '
@@ -195,8 +197,8 @@
195
  public function robots_settings_field() {
196
  echo '
197
  <fieldset><legend class="screen-reader-text">'.__('Additional robots.txt rules','xml-sitemap-feed').'</legend>
198
- <label>'.sprintf(__('Rules that will be appended to the %s generated by WordPress:','xml-sitemap-feed'),'<a href="'.trailingslashit(get_bloginfo('url')).'robots.txt" target="_blank">robots.txt</a>').'<br /><textarea name="'.parent::prefix().'robots" id="xmlsf_robots" class="large-text" cols="50" rows="6" />'.esc_attr( parent::get_robots() ).'</textarea></label>
199
- <p class="description">'.__('These rules will not have effect when you are using a static robots.txt file.','xml-sitemap-feed').'<br /><span style="color: red" class="warning">'.__('Only add rules here when you know what you are doing, otherwise you might break search engine access to your site.','xml-sitemap-feed').'</span></p>
200
  </fieldset>';
201
  }
202
 
@@ -256,7 +258,7 @@
256
 
257
  if (!empty($options[$post_type->name]['active'])) {
258
 
259
- echo ' &nbsp;&ndash;&nbsp; <span class="description"><a id="xmlsf_post_types_'.$post_type->name.'_link" href="#xmlsf_post_types_'.$post_type->name.'_settings">'.translate('Settings').'</a></span><br />
260
  <script type="text/javascript">
261
  jQuery( document ).ready( function() {
262
  jQuery("#xmlsf_post_types_'.$post_type->name.'_settings").hide();
@@ -320,7 +322,7 @@
320
 
321
  </ul>';
322
  } else {
323
- echo '<br />';
324
  }
325
  }
326
 
@@ -371,7 +373,7 @@ jQuery( document ).ready( function() {
371
  // echo '<span class="description error" style="color: red">'.__('This taxonomy type might not be suitable for public use. Please check the urls in the taxonomy sitemap.','xml-sitemap-feed').'</span>';
372
 
373
  $output .= '
374
- <br />';
375
  }
376
 
377
  if ($output) {
@@ -408,9 +410,9 @@ jQuery( document ).ready( function() {
408
 
409
  echo '
410
  <fieldset><legend class="screen-reader-text">'.__('Include custom XML Sitemaps','xml-sitemap-feed').'</legend>
411
- <label>'.__('Additional XML Sitemaps to append to the main XML Sitemap Index:','xml-sitemap-feed').'<br />
412
  <textarea name="'.parent::prefix().'custom_sitemaps" id="xmlsf_custom_sitemaps" class="large-text" cols="50" rows="4" />'. implode("\n",$lines) .'</textarea></label>
413
- <p class="description">'.__('Add the full URL, including protocol (http/https) and domain, of any XML Sitemap that you want to append to the Sitemap Index. Start each URL on a new line.','xml-sitemap-feed').'<br /><span style="color: red" class="warning">'.__('Only valid sitemaps are allowed in the Sitemap Index. Use your Google/Bing Webmaster Tools to verify!','xml-sitemap-feed').'</span></p>
414
  </fieldset>';
415
 
416
  }
@@ -428,7 +430,7 @@ jQuery( document ).ready( function() {
428
 
429
  echo '
430
  <fieldset><legend class="screen-reader-text">'.__('Include custom URLs','xml-sitemap-feed').'</legend>
431
- <label>'.__('Additional URLs to append in an extra XML Sitemap:','xml-sitemap-feed').'<br />
432
  <textarea name="'.parent::prefix().'urls" id="xmlsf_urls" class="large-text" cols="50" rows="4" />'. implode("\n",$lines) .'</textarea></label>
433
  <p class="description">'.__('Add the full URL, including protocol (http/https) and domain, of any (static) page that you want to append to the ones already included by WordPress. Optionally add a priority value between 0 and 1, separated with a space after the URL. Start each URL on a new line.','xml-sitemap-feed').'</p>
434
  </fieldset>';
@@ -441,7 +443,7 @@ jQuery( document ).ready( function() {
441
 
442
  echo '
443
  <fieldset><legend class="screen-reader-text">'.__('Allowed domains','xml-sitemap-feed').'</legend>
444
- <label>'.__('Additional domains to allow in the XML Sitemaps:','xml-sitemap-feed').'<br /><textarea name="'.parent::prefix().'domains" id="xmlsf_domains" class="large-text" cols="50" rows="4" />'. implode("\n",$domains) .'</textarea></label>
445
  <p class="description">'.sprintf(__('By default, only the domain %s as used in your WordPress site address is allowed. This means that all URLs that use another domain (custom URLs or using a plugin like Page Links To) are filtered from the XML Sitemap. However, if you are the verified owner of other domains in your Google/Bing Webmaster Tools account, you can include these in the same sitemap. Add these domains, without protocol (http/https) each on a new line. Note that if you enter a domain with www, all URLs without it or with other subdomains will be filtered.','xml-sitemap-feed'),'<strong>'.$default.'</strong>').'</p>
446
  </fieldset>';
447
 
@@ -456,7 +458,9 @@ jQuery( document ).ready( function() {
456
  echo '<p><a target="_blank" href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=ravanhagen%40gmail%2ecom&item_name=XML%20Sitemap%20Feeds&item_number='.XMLSF_VERSION.'&no_shipping=0&tax=0&charset=UTF%2d8" title="'.
457
  sprintf(__('Donate to keep the free %s plugin development & support going!','xml-sitemap-feed'),__('XML Sitemap & Google News Feeds','xml-sitemap-feed')).'"><img src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif" style="border:none;float:right;margin:4px 0 0 10px" alt="'.
458
  sprintf(__('Donate to keep the free %s plugin development & support going!','xml-sitemap-feed'),__('XML Sitemap & Google News Feeds','xml-sitemap-feed')).'" width="92" height="26" /></a>'.
459
- sprintf(__('These settings control the Google News Sitemap generated by the %s plugin.','xml-sitemap-feed'),__('XML Sitemap & Google News Feeds','xml-sitemap-feed')).' '.__('When you are done configuring and preparing your news content and you are convinced your site adheres to the <a href="https://support.google.com/news/publisher/answer/40787?ref_topic=2484652" target="_blank">Google News guidelines</a>, go ahead and <a href="https://support.google.com/news/publisher/troubleshooter/3179220?#ts=3179198" target="_blank">submit your site for inclusion</a>!','xml-sitemap-feed').' '.
 
 
460
  sprintf(__('For ping options, go to %s.','xml-sitemap-feed'),'<a href="options-writing.php">'.translate('Writing Settings').'</a>').'</p>';
461
 
462
  }
@@ -468,7 +472,8 @@ jQuery( document ).ready( function() {
468
  $name = !empty($options['name']) ? $options['name'] : '';
469
  echo '
470
  <fieldset><legend class="screen-reader-text">'.__('Publication name','xml-sitemap-feed').'</legend>
471
- <input type="text" name="'.parent::prefix().'news_tags[name]" id="xmlsf_news_name" value="'.$name.'" class="regular-text"> <span class="description">'.sprintf(__('By default, the general %s setting will be used.','xml-sitemap-feed'),'<a href="options-general.php">'.translate('Site Title').'</a>').'</span>
 
472
  </fieldset>';
473
  }
474
 
@@ -495,7 +500,7 @@ jQuery( document ).ready( function() {
495
  if ( !is_object($post_type) || in_array($post_type->name,parent::disabled_post_types()) )
496
  continue;
497
 
498
- $checked = in_array($post_type->name,$news_post_type) || $news_post_type == 'any' ? true : false;
499
  $disabled = false;
500
  if ( isset($options['categories']) && is_array($options['categories']) ) {
501
  // need to disable all post types that do not have the category taxonomy
@@ -511,7 +516,7 @@ jQuery( document ).ready( function() {
511
  $post_type->name.'" value="'.$post_type->name.'" '.
512
  checked( $checked, true, false).' '.
513
  disabled( $disabled, true, false).' /> '.
514
- $post_type->label.'</label><br />';
515
  }
516
  echo '
517
  <p class="description">'.sprintf(__('At least one post type must be selected. By default, the post type %s will be used.','xml-sitemap-feed'),translate('Posts')).'</p>
@@ -523,6 +528,12 @@ jQuery( document ).ready( function() {
523
  public function news_categories_field() {
524
  $options = parent::get_option('news_tags');
525
 
 
 
 
 
 
 
526
  $all_categories = get_terms( 'category', array('hide_empty' => 0,'hierachical' => true) );
527
  $selected_categories = isset($options['categories']) && is_array($options['categories']) ? $options['categories'] : array();
528
  $count = count($all_categories);
@@ -537,7 +548,7 @@ jQuery( document ).ready( function() {
537
 
538
  $size = $count < 15 ? $count : 15;
539
  echo '
540
- <label>'.__('Limit to posts in these post categories:','xml-sitemap-feed').'<br />
541
  <select multiple name="'.parent::prefix().'news_tags[categories][]" size="'.$size.'">';
542
 
543
  foreach($all_categories as $category) {
@@ -553,7 +564,7 @@ jQuery( document ).ready( function() {
553
  echo '
554
  </select>
555
  </label>
556
- <p class="description">'.__('If you wish to limit posts that will feature in your News Sitemap to certain categories, select them here. Use the Ctrl/Cmd key plus click to select more than one or to deselect. If no categories are selected, posts of all categories will be included in your News Sitemap.','xml-sitemap-feed').'<br /><span style="color: red" class="warning">'.__('Please be aware that limiting by post category will rule out all custom post types that do not use post categories, even if you selected them to be included (above).','xml-sitemap-feed').'</span></p>';
557
  echo '
558
  </fieldset>';
559
  }
@@ -575,20 +586,26 @@ jQuery( document ).ready( function() {
575
  '>'.__('Attached images','xml-sitemap-feed').'</option>
576
  ';
577
  echo '</select></label>
578
- <p class="description">'.__('Note: Google News prefers at most one image per article in the News Sitemap. If multiple valid images are specified, the crawler will have to pick one arbitrarily. Images in News Sitemaps should be in jpeg or png format.','xml-sitemap-feed').' <a href="https://support.google.com/news/publisher/answer/185541" target="_blank">'.translate('More information...').'</a></p>
579
  </fieldset>';
580
  }
581
 
582
- public function news_access_field() {
 
 
 
 
 
583
  $options = parent::get_option('news_tags');
584
  $prefix = parent::prefix();
585
 
 
586
  $access = !empty($options['access']) ? $options['access'] : '';
587
  $access_default = !empty($access['default']) ? $access['default'] : '';
588
  $access_password = !empty($access['password']) ? $access['password'] : '';
589
  echo '
590
- <fieldset id="xmlsf_news_access"><legend class="screen-reader-text">'.__('Access (&lt;access&gt; tag)','xml-sitemap-feed').'</legend>
591
- '.sprintf(__('The &lt;access&gt; tag specifies whether an article is available to all readers (%1$s), or only to those with a free (%2$s) or paid membership (%3$s) to your site.','xml-sitemap-feed'),translate('Public'),__('Registration','xml-sitemap-feed'),__('Subscription','xml-sitemap-feed')).'
592
 
593
  <ul>';
594
 
@@ -599,36 +616,24 @@ jQuery( document ).ready( function() {
599
  <option value="Subscription" '.selected( "Subscription" == $access_default, true, false).'>'.__('Subscription','xml-sitemap-feed').'</option>
600
  </select></label></li>';
601
  echo '
602
-
603
- <li><label>'.sprintf(__('Tag %s posts as','xml-sitemap-feed'),translate('Password Protected')).' <select name="'.$prefix.'news_tags[access][password]" id="xmlsf_news_tags_access_password">
604
  <option value="Registration" '.selected( "Registration" == $access_password, true, false).'>'.__('Registration','xml-sitemap-feed').'</option>
605
  <option value="Subscription" '.selected( "Subscription" == $access_password, true, false).'>'.__('Subscription','xml-sitemap-feed').'</option>
606
  </select></label></li>';
607
  echo '
608
  </ul>
609
-
610
- <p class="description">'.__('Note: The &lt;access&gt; tag is required when applicable. Do not leave it to Public when your content is not.','xml-sitemap-feed').' <a href="https://support.google.com/news/publisher/answer/93992" target="_blank">'.translate('More information...').'</a></p>
611
- </fieldset>';
612
- }
613
 
614
- public function news_genres_field() {
615
- $options = parent::get_option('news_tags');
616
- $prefix = parent::prefix();
617
  $gn_genres = parent::gn_genres();
618
- /* $gn_genres_tr = array(
619
- 'gn-pressrelease' => __('Press Release','xml-sitemap-feed'),
620
- 'gn-satire' => __('Satire','xml-sitemap-feed'),
621
- 'gn-blog' => __('Blog','xml-sitemap-feed'),
622
- 'gn-oped' => __('Op-Ed','xml-sitemap-feed'),
623
- 'gn-opinion' => __('Opinion','xml-sitemap-feed'),
624
- 'gn-usergenerated' => __('User-Generated','xml-sitemap-feed')
625
- );
626
- */
627
  $genres = !empty($options['genres']) ? $options['genres'] : array();
628
- $genres_default = !empty($genres['default']) ? $genres['default'] : '';
 
 
 
629
  echo '
630
- <fieldset id="xmlsf_news_genres"><legend class="screen-reader-text">'.__('Genres (&lt;genres&gt; tag)','xml-sitemap-feed').'</legend>
631
- '.__('The &lt;genres&gt; tag specifies one or more properties for an article, namely, whether it is a press release, a blog post, an opinion, an op-ed piece, user-generated content, or satire.','xml-sitemap-feed').' '.__('You can assign Google News genres when writing a new post.','xml-sitemap-feed');
632
  echo '<input type="hidden" name="'.$prefix.'news_tags[genres][active]" value="';
633
  echo !empty($genres['active']) ? $genres['active'] : '';
634
  echo '" />';
@@ -639,16 +644,15 @@ jQuery( document ).ready( function() {
639
  */
640
  echo '
641
  <ul>
642
- <li><label>'.__('Default genre:','xml-sitemap-feed').' <select name="'.$prefix.'news_tags[genres][default]" id="xmlsf_news_tags_genres_default">
643
- <option value="">'.translate('None').'</option>';
644
- foreach ( $gn_genres as $slug => $name) {
645
  echo '
646
- <option value="'.$name.'" '.selected( $name == $genres_default, true, false ).'>'.$name.'</option>';
647
- }
648
  echo '
649
- </select></label></li>
650
  </ul>
651
- <p class="description">'.__('Note: The &lt;genres&gt; tag is required when applicable and restricted to the list provided above.','xml-sitemap-feed').' <a href="https://support.google.com/news/publisher/answer/93992" target="_blank">'.translate('More information...').'</a></p>
 
652
  </fieldset>';
653
 
654
  }
@@ -680,28 +684,6 @@ jQuery( document ).ready( function() {
680
  </fieldset>';
681
  }
682
 
683
- public function news_locations_field() {
684
- $options = parent::get_option('news_tags');
685
- $prefix = parent::prefix();
686
-
687
- $locations = !empty($options['locations']) ? $options['locations'] : array();
688
- echo '
689
- <fieldset id="xmlsf_news_locations"><legend class="screen-reader-text">'.__('Locations (&lt;geo_locations&gt; tag)','xml-sitemap-feed').'</legend>
690
- '.__('The &lt;geo_locations&gt; tag is used identify the geographic location of your articles.','xml-sitemap-feed').' '.__('You can assign locations when writing a new post.','xml-sitemap-feed');
691
- echo '<input type="hidden" name="'.$prefix.'news_tags[locations][active]" value="';
692
- echo !empty($locations['active']) ? $locations['active'] : '';
693
- echo '" />';
694
- echo '
695
- <ul>
696
- <li><label>'.__('Default location:','xml-sitemap-feed').' <input type="text" name="'.$prefix.'news_tags[locations][default]" id="xmlsf_news_tags_locations_default" value="';
697
- echo !empty($locations['default']) ? $locations['default'] : '';
698
- echo '" class="regular-text"></label> <span class="description">'.__('Separate with a comma.','xml-sitemap-feed').'</span></li>
699
- </ul>
700
- <p class="description">'.__('You should list location entities from smallest entity to largest. For example: <code>Detroit, Michigan, USA</code> or <code>Rhône-Alpes, France</code>.','xml-sitemap-feed').' <a href="https://support.google.com/news/publisher/answer/1662970" target="_blank">'.translate('More information...').'</a></p>
701
- </fieldset>';
702
- }
703
-
704
-
705
  //sanitize callback functions
706
 
707
  public function sanitize_robots_settings($new) {
@@ -993,10 +975,10 @@ jQuery( document ).ready( function() {
993
  add_settings_field($prefix.'news_post_type', __('Include post types','xml-sitemap-feed'), array($this,'news_post_type_field'), 'reading', 'news_sitemap_section');
994
  add_settings_field($prefix.'news_categories', translate('Categories'), array($this,'news_categories_field'), 'reading', 'news_sitemap_section');
995
  add_settings_field($prefix.'news_image', translate('Images'), array($this,'news_image_field'), 'reading', 'news_sitemap_section');
996
- add_settings_field($prefix.'news_access', __('Access (&lt;access&gt; tag)','xml-sitemap-feed'), array($this,'news_access_field'), 'reading', 'news_sitemap_section');
997
- add_settings_field($prefix.'news_genres', __('Genres (&lt;genres&gt; tag)','xml-sitemap-feed'), array($this,'news_genres_field'), 'reading', 'news_sitemap_section');
998
- add_settings_field($prefix.'news_keywords', __('Topics (&lt;keywords&gt; tag)','xml-sitemap-feed'), array($this,'news_keywords_field'), 'reading', 'news_sitemap_section');
999
- add_settings_field($prefix.'news_locations', __('Locations (&lt;geo_locations&gt; tag)','xml-sitemap-feed'), array($this,'news_locations_field'), 'reading', 'news_sitemap_section');
1000
  }
1001
 
1002
  if ( isset($sitemaps['sitemap']) || isset($sitemaps['sitemap-news']) ) {
@@ -1015,5 +997,6 @@ jQuery( document ).ready( function() {
1015
  * INSTANTIATE
1016
  * ---------------------- */
1017
 
1018
- if ( class_exists('XMLSitemapFeed') )
1019
- $xmlsf_admin = new XMLSF_Admin();
 
3
  * XMLSF Admin CLASS
4
  * ------------------------------ */
5
 
6
+ if ( class_exists('XMLSitemapFeed') ) :
7
+
8
+ class XMLSF_Admin extends XMLSitemapFeed {
9
 
10
  /**
11
  * SETTINGS
23
  if (isset($options['sitemap']))
24
  echo '<span class="description"> &nbsp;&ndash;&nbsp; <a href="#xmlsf" id="xmlsf_link">'.translate('Settings').'</a> &nbsp;&ndash;&nbsp; <a href="'.trailingslashit(get_bloginfo('url')). ( ('' == get_option('permalink_structure')) ? '?feed=sitemap' : $options['sitemap'] ) .'" target="_blank">'.translate('View').'</a></span>';
25
 
26
+ echo '<br>
27
  <label><input type="checkbox" name="'.$prefix.'sitemaps[sitemap-news]" id="xmlsf_sitemaps_news" value="'.XMLSF_NEWS_NAME.'" '.checked(isset($options['sitemap-news']), true, false).' '.disabled($disabled, true, false).' /> '.__('Google News Sitemap','xml-sitemap-feed').'</label>';
28
  if (isset($options['sitemap-news']))
29
  echo '<span class="description"> &nbsp;&ndash;&nbsp; <a href="#xmlnf" id="xmlnf_link">'.translate('Settings').'</a> &nbsp;&ndash;&nbsp; <a href="'.trailingslashit(get_bloginfo('url')). ( ('' == get_option('permalink_structure')) ? '?feed=sitemap-news' : $options['sitemap-news'] ) .'" target="_blank">'.translate('View').'</a></span>';
139
  }
140
  date_default_timezone_set('UTC');
141
  }
142
+ echo '</span><br>';
143
  }
144
 
145
  echo '
197
  public function robots_settings_field() {
198
  echo '
199
  <fieldset><legend class="screen-reader-text">'.__('Additional robots.txt rules','xml-sitemap-feed').'</legend>
200
+ <label>'.sprintf(__('Rules that will be appended to the %s generated by WordPress:','xml-sitemap-feed'),'<a href="'.trailingslashit(get_bloginfo('url')).'robots.txt" target="_blank">robots.txt</a>').'<br><textarea name="'.parent::prefix().'robots" id="xmlsf_robots" class="large-text" cols="50" rows="6" />'.esc_attr( parent::get_robots() ).'</textarea></label>
201
+ <p class="description">'.__('These rules will not have effect when you are using a static robots.txt file.','xml-sitemap-feed').'<br><span style="color: red" class="warning">'.__('Only add rules here when you know what you are doing, otherwise you might break search engine access to your site.','xml-sitemap-feed').'</span></p>
202
  </fieldset>';
203
  }
204
 
258
 
259
  if (!empty($options[$post_type->name]['active'])) {
260
 
261
+ echo ' &nbsp;&ndash;&nbsp; <span class="description"><a id="xmlsf_post_types_'.$post_type->name.'_link" href="#xmlsf_post_types_'.$post_type->name.'_settings">'.translate('Settings').'</a></span><br>
262
  <script type="text/javascript">
263
  jQuery( document ).ready( function() {
264
  jQuery("#xmlsf_post_types_'.$post_type->name.'_settings").hide();
322
 
323
  </ul>';
324
  } else {
325
+ echo '<br>';
326
  }
327
  }
328
 
373
  // echo '<span class="description error" style="color: red">'.__('This taxonomy type might not be suitable for public use. Please check the urls in the taxonomy sitemap.','xml-sitemap-feed').'</span>';
374
 
375
  $output .= '
376
+ <br>';
377
  }
378
 
379
  if ($output) {
410
 
411
  echo '
412
  <fieldset><legend class="screen-reader-text">'.__('Include custom XML Sitemaps','xml-sitemap-feed').'</legend>
413
+ <label>'.__('Additional XML Sitemaps to append to the main XML Sitemap Index:','xml-sitemap-feed').'<br>
414
  <textarea name="'.parent::prefix().'custom_sitemaps" id="xmlsf_custom_sitemaps" class="large-text" cols="50" rows="4" />'. implode("\n",$lines) .'</textarea></label>
415
+ <p class="description">'.__('Add the full URL, including protocol (http/https) and domain, of any XML Sitemap that you want to append to the Sitemap Index. Start each URL on a new line.','xml-sitemap-feed').'<br><span style="color: red" class="warning">'.__('Only valid sitemaps are allowed in the Sitemap Index. Use your Google/Bing Webmaster Tools to verify!','xml-sitemap-feed').'</span></p>
416
  </fieldset>';
417
 
418
  }
430
 
431
  echo '
432
  <fieldset><legend class="screen-reader-text">'.__('Include custom URLs','xml-sitemap-feed').'</legend>
433
+ <label>'.__('Additional URLs to append in an extra XML Sitemap:','xml-sitemap-feed').'<br>
434
  <textarea name="'.parent::prefix().'urls" id="xmlsf_urls" class="large-text" cols="50" rows="4" />'. implode("\n",$lines) .'</textarea></label>
435
  <p class="description">'.__('Add the full URL, including protocol (http/https) and domain, of any (static) page that you want to append to the ones already included by WordPress. Optionally add a priority value between 0 and 1, separated with a space after the URL. Start each URL on a new line.','xml-sitemap-feed').'</p>
436
  </fieldset>';
443
 
444
  echo '
445
  <fieldset><legend class="screen-reader-text">'.__('Allowed domains','xml-sitemap-feed').'</legend>
446
+ <label>'.__('Additional domains to allow in the XML Sitemaps:','xml-sitemap-feed').'<br><textarea name="'.parent::prefix().'domains" id="xmlsf_domains" class="large-text" cols="50" rows="4" />'. implode("\n",$domains) .'</textarea></label>
447
  <p class="description">'.sprintf(__('By default, only the domain %s as used in your WordPress site address is allowed. This means that all URLs that use another domain (custom URLs or using a plugin like Page Links To) are filtered from the XML Sitemap. However, if you are the verified owner of other domains in your Google/Bing Webmaster Tools account, you can include these in the same sitemap. Add these domains, without protocol (http/https) each on a new line. Note that if you enter a domain with www, all URLs without it or with other subdomains will be filtered.','xml-sitemap-feed'),'<strong>'.$default.'</strong>').'</p>
448
  </fieldset>';
449
 
458
  echo '<p><a target="_blank" href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=ravanhagen%40gmail%2ecom&item_name=XML%20Sitemap%20Feeds&item_number='.XMLSF_VERSION.'&no_shipping=0&tax=0&charset=UTF%2d8" title="'.
459
  sprintf(__('Donate to keep the free %s plugin development & support going!','xml-sitemap-feed'),__('XML Sitemap & Google News Feeds','xml-sitemap-feed')).'"><img src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif" style="border:none;float:right;margin:4px 0 0 10px" alt="'.
460
  sprintf(__('Donate to keep the free %s plugin development & support going!','xml-sitemap-feed'),__('XML Sitemap & Google News Feeds','xml-sitemap-feed')).'" width="92" height="26" /></a>'.
461
+ sprintf(__('These settings control the Google News Sitemap generated by the %s plugin.','xml-sitemap-feed'),__('XML Sitemap & Google News Feeds','xml-sitemap-feed')).' '.
462
+ __('When you are done configuring and preparing your news content and you are convinced your site adheres to the <a href="https://support.google.com/news/publisher/answer/40787" target="_blank">Google News guidelines</a>, go ahead and <a href="https://partnerdash.google.com/partnerdash/d/news" target="_blank">submit your site for inclusion</a>!','xml-sitemap-feed').' '.
463
+ __('It is strongly recommended to submit your news sitemap to your Google Webmasters Tools account to monitor for warnings or errors. Read more on how to <a href="https://support.google.com/webmasters/answer/183669" target="_blank">Manage sitemaps with the Sitemaps page</a>.','xml-sitemap-feed').' '.
464
  sprintf(__('For ping options, go to %s.','xml-sitemap-feed'),'<a href="options-writing.php">'.translate('Writing Settings').'</a>').'</p>';
465
 
466
  }
472
  $name = !empty($options['name']) ? $options['name'] : '';
473
  echo '
474
  <fieldset><legend class="screen-reader-text">'.__('Publication name','xml-sitemap-feed').'</legend>
475
+ <input type="text" name="'.parent::prefix().'news_tags[name]" id="xmlsf_news_name" value="'.$name.'" class="regular-text"> <span class="description">'.sprintf(__('By default, the general %s setting will be used.','xml-sitemap-feed'),'<a href="options-general.php">'.translate('Site Title').'</a>').'</span> ' .
476
+ __('The publication name should match the name submitted on the Google News Publisher Center. If you wish to change it, please read <a href="https://support.google.com/news/publisher/answer/40402" target="_blank">Updated publication name</a>.') . '
477
  </fieldset>';
478
  }
479
 
500
  if ( !is_object($post_type) || in_array($post_type->name,parent::disabled_post_types()) )
501
  continue;
502
 
503
+ $checked = in_array($post_type->name,$news_post_type) ? true : false;
504
  $disabled = false;
505
  if ( isset($options['categories']) && is_array($options['categories']) ) {
506
  // need to disable all post types that do not have the category taxonomy
516
  $post_type->name.'" value="'.$post_type->name.'" '.
517
  checked( $checked, true, false).' '.
518
  disabled( $disabled, true, false).' /> '.
519
+ $post_type->label.'</label><br>';
520
  }
521
  echo '
522
  <p class="description">'.sprintf(__('At least one post type must be selected. By default, the post type %s will be used.','xml-sitemap-feed'),translate('Posts')).'</p>
528
  public function news_categories_field() {
529
  $options = parent::get_option('news_tags');
530
 
531
+ if ( !empty($options['post_type']) && array( 'post' ) !== (array)$options['post_type'] ) {
532
+ echo '
533
+ <p class="description">' . sprintf(__('Selection based on categories will be available when <strong>only</strong> the post type %s is included above.','xml-sitemap-feed'),translate('Posts')) . '</p>';
534
+ return;
535
+ }
536
+
537
  $all_categories = get_terms( 'category', array('hide_empty' => 0,'hierachical' => true) );
538
  $selected_categories = isset($options['categories']) && is_array($options['categories']) ? $options['categories'] : array();
539
  $count = count($all_categories);
548
 
549
  $size = $count < 15 ? $count : 15;
550
  echo '
551
+ <label>'.__('Limit to posts in these post categories:','xml-sitemap-feed').'<br>
552
  <select multiple name="'.parent::prefix().'news_tags[categories][]" size="'.$size.'">';
553
 
554
  foreach($all_categories as $category) {
564
  echo '
565
  </select>
566
  </label>
567
+ <p class="description">'.__('If you wish to limit posts that will feature in your News Sitemap to certain categories, select them here. If no categories are selected, posts of all categories will be included in your News Sitemap.','xml-sitemap-feed').' '.__('Use the Ctrl/Cmd key plus click to select more than one or to deselect.','xml-sitemap-feed');
568
  echo '
569
  </fieldset>';
570
  }
586
  '>'.__('Attached images','xml-sitemap-feed').'</option>
587
  ';
588
  echo '</select></label>
589
+ <p class="description">'.__('Note: Google News prefers at most one image per article in the News Sitemap. If multiple valid images are specified, the crawler will have to pick one arbitrarily. Images in News Sitemaps should be in jpeg or png format.','xml-sitemap-feed').' <a href="https://support.google.com/news/publisher/answer/185541" target="_blank">'.__('More information&hellip;','xml-sitemap-feed').'</a></p>
590
  </fieldset>';
591
  }
592
 
593
+ public function news_labels_field() {
594
+ echo '
595
+ <fieldset id="xmlsf_news_labels"><legend class="screen-reader-text">'.__('Source labels','xml-sitemap-feed').'</legend>' .
596
+ __('You can use the &lt;access&gt; and &lt;genres&gt; tags to provide Google more information about the content of your articles.','xml-sitemap-feed') . ' <a href="https://support.google.com/news/publisher/answer/93992" target="_blank">'.__('More information&hellip;','xml-sitemap-feed').'</a>
597
+ <br><br>';
598
+
599
  $options = parent::get_option('news_tags');
600
  $prefix = parent::prefix();
601
 
602
+ // access tag
603
  $access = !empty($options['access']) ? $options['access'] : '';
604
  $access_default = !empty($access['default']) ? $access['default'] : '';
605
  $access_password = !empty($access['password']) ? $access['password'] : '';
606
  echo '
607
+ <fieldset id="xmlsf_news_access"><legend class="screen-reader-text">'.__('Access (&lt;access&gt; tag)','xml-sitemap-feed').'</legend>
608
+ '.sprintf(__('The &lt;access&gt; tag specifies whether an article is available to all readers (%1$s), or only to those with a free (%2$s) or paid membership (%3$s) to your site.','xml-sitemap-feed'),translate('Public'),__('Registration','xml-sitemap-feed'),__('Subscription','xml-sitemap-feed')).'
609
 
610
  <ul>';
611
 
616
  <option value="Subscription" '.selected( "Subscription" == $access_default, true, false).'>'.__('Subscription','xml-sitemap-feed').'</option>
617
  </select></label></li>';
618
  echo '
619
+ <li><label>'.__('Tag Password Protected posts as','xml-sitemap-feed').' <select name="'.$prefix.'news_tags[access][password]" id="xmlsf_news_tags_access_password">
 
620
  <option value="Registration" '.selected( "Registration" == $access_password, true, false).'>'.__('Registration','xml-sitemap-feed').'</option>
621
  <option value="Subscription" '.selected( "Subscription" == $access_password, true, false).'>'.__('Subscription','xml-sitemap-feed').'</option>
622
  </select></label></li>';
623
  echo '
624
  </ul>
625
+ </fieldset>';
 
 
 
626
 
627
+ // genres tag
 
 
628
  $gn_genres = parent::gn_genres();
 
 
 
 
 
 
 
 
 
629
  $genres = !empty($options['genres']) ? $options['genres'] : array();
630
+ $genres_default = !empty($genres['default']) ? (array)$genres['default'] : array();
631
+
632
+ $count = count($gn_genres);
633
+
634
  echo '
635
+ <fieldset id="xmlsf_news_genres"><legend class="screen-reader-text">'.__('Genres (&lt;genres&gt; tag)','xml-sitemap-feed').'</legend>
636
+ '.__('The &lt;genres&gt; tag specifies one or more properties for an article, namely, whether it is a press release, a blog post, an opinion, an op-ed piece, user-generated content, or satire.','xml-sitemap-feed').' '.__('You can assign more genres when writing a post.','xml-sitemap-feed');
637
  echo '<input type="hidden" name="'.$prefix.'news_tags[genres][active]" value="';
638
  echo !empty($genres['active']) ? $genres['active'] : '';
639
  echo '" />';
644
  */
645
  echo '
646
  <ul>
647
+ <li><label>'.__('Default genre:','xml-sitemap-feed').'<br><select multiple name="'.$prefix.'news_tags[genres][default][]" id="xmlsf_news_tags_genres_default" size="'.$count.'">';
648
+ foreach ( $gn_genres as $slug => $name)
 
649
  echo '
650
+ <option value="'.$name.'" '.selected( in_array($name,$genres_default), true, false ).'>'.$name.'</option>';
 
651
  echo '
652
+ </select></label></li>
653
  </ul>
654
+ </fieldset>
655
+ <p class="description">'.__('Use the Ctrl/Cmd key plus click to select more than one or to deselect.','xml-sitemap-feed').' '.sprintf(__('Read more about source labels on %s','xml-sitemap-feed'),'<a href="https://support.google.com/news/publisher/answer/4582731" target="_blank">'.__('What does each source label mean?','xml-sitemap-feed').'</a>').'</p>
656
  </fieldset>';
657
 
658
  }
684
  </fieldset>';
685
  }
686
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
687
  //sanitize callback functions
688
 
689
  public function sanitize_robots_settings($new) {
975
  add_settings_field($prefix.'news_post_type', __('Include post types','xml-sitemap-feed'), array($this,'news_post_type_field'), 'reading', 'news_sitemap_section');
976
  add_settings_field($prefix.'news_categories', translate('Categories'), array($this,'news_categories_field'), 'reading', 'news_sitemap_section');
977
  add_settings_field($prefix.'news_image', translate('Images'), array($this,'news_image_field'), 'reading', 'news_sitemap_section');
978
+ add_settings_field($prefix.'news_access', __('Source labels','xml-sitemap-feed'), array($this,'news_labels_field'), 'reading', 'news_sitemap_section');
979
+ //add_settings_field($prefix.'news_genres', __('Genres (&lt;genres&gt; tag)','xml-sitemap-feed'), array($this,'news_genres_field'), 'reading', 'news_sitemap_section');
980
+ add_settings_field($prefix.'news_keywords', __('Topics','xml-sitemap-feed'), array($this,'news_keywords_field'), 'reading', 'news_sitemap_section');
981
+
982
  }
983
 
984
  if ( isset($sitemaps['sitemap']) || isset($sitemaps['sitemap-news']) ) {
997
  * INSTANTIATE
998
  * ---------------------- */
999
 
1000
+ $xmlsf_admin = new XMLSF_Admin();
1001
+
1002
+ endif;
includes/core.php CHANGED
@@ -3,6 +3,8 @@
3
  * XMLSitemapFeed CLASS
4
  * ------------------------------ */
5
 
 
 
6
  class XMLSitemapFeed {
7
 
8
  /**
@@ -93,10 +95,7 @@ class XMLSitemapFeed {
93
  );
94
  }
95
 
96
- if ( defined('XMLSF_POST_TYPE') && XMLSF_POST_TYPE != 'any' )
97
- $active_arr = array_map('trim',explode(',',XMLSF_POST_TYPE));
98
- else
99
- $active_arr = array('post','page');
100
 
101
  foreach ( $active_arr as $name )
102
  if ( isset($this->defaults['post_types'][$name]) )
@@ -166,29 +165,24 @@ class XMLSitemapFeed {
166
  $this->defaults['domains'] = array();
167
 
168
  // news sitemap tags settings
169
- $news_post_types = defined('XMLSF_NEWS_POST_TYPE') ? explode(',',XMLSF_NEWS_POST_TYPE) : array('post');
170
  $this->defaults['news_tags'] = array(
171
  'name' => '',
172
- 'post_type' => (in_array('any',$news_post_types)) ? 'any' : $news_post_types,
173
  'categories' => '',
174
  'image' => 'featured',
175
  'access' => array(
176
  'default' => '',
177
- 'private' => 'Registration',
178
  'password' => 'Subscription'
179
  ),
180
  'genres' => array(
181
  'active' => '1',
182
- 'default' => ''
183
  ),
184
  'keywords' => array(
185
  'from' => 'category',
186
  'default' => ''
187
- ),
188
- 'locations' => array(
189
- 'active' => '1',
190
- 'default' => ''
191
- )
192
  );
193
  }
194
 
@@ -906,37 +900,37 @@ class XMLSitemapFeed {
906
  // set up the sitemap index template
907
  public function load_template_index()
908
  {
909
- load_template( XMLSF_PLUGIN_DIR . '/includes/feed-sitemap.php' );
910
  }
911
 
912
  // set up the sitemap home page(s) template
913
  public function load_template_base()
914
  {
915
- load_template( XMLSF_PLUGIN_DIR . '/includes/feed-sitemap-home.php' );
916
  }
917
 
918
  // set up the post types sitemap template
919
  public function load_template()
920
  {
921
- load_template( XMLSF_PLUGIN_DIR . '/includes/feed-sitemap-post_type.php' );
922
  }
923
 
924
  // set up the taxonomy sitemap template
925
  public function load_template_taxonomy()
926
  {
927
- load_template( XMLSF_PLUGIN_DIR . '/includes/feed-sitemap-taxonomy.php' );
928
  }
929
 
930
  // set up the news sitemap template
931
  public function load_template_news()
932
  {
933
- load_template( XMLSF_PLUGIN_DIR . '/includes/feed-sitemap-news.php' );
934
  }
935
 
936
  // set up the news sitemap template
937
  public function load_template_custom()
938
  {
939
- load_template( XMLSF_PLUGIN_DIR . '/includes/feed-sitemap-custom.php' );
940
  }
941
 
942
  /**
@@ -1069,27 +1063,8 @@ class XMLSitemapFeed {
1069
  delete_option('xmlsf_'.$option);
1070
  }
1071
 
1072
- if(!term_exists('gn-genre') || !term_exists('gn-location-1') || !term_exists('gn-location-2') || !term_exists('gn-location-3'))
1073
- $this->register_gn_taxonomies();
1074
-
1075
- $terms = get_terms('gn-genre',array('hide_empty' => false));
1076
- foreach ( $terms as $term ) {
1077
- wp_delete_term( $term->term_id, 'gn-genre' );
1078
- }
1079
- $terms = get_terms('gn-location-1',array('hide_empty' => false));
1080
- foreach ( $terms as $term ) {
1081
- wp_delete_term( $term->term_id, 'gn-location-1' );
1082
- }
1083
- $terms = get_terms('gn-location-2',array('hide_empty' => false));
1084
- foreach ( $terms as $term ) {
1085
- wp_delete_term( $term->term_id, 'gn-location-2' );
1086
- }
1087
- $terms = get_terms('gn-location-3',array('hide_empty' => false));
1088
- foreach ( $terms as $term ) {
1089
- wp_delete_term( $term->term_id, 'gn-location-3' );
1090
- }
1091
-
1092
- error_log('XML Sitemap Feeds settings cleared');
1093
  }
1094
 
1095
  function cache_flush()
@@ -1104,46 +1079,71 @@ class XMLSitemapFeed {
1104
 
1105
  public function upgrade($version)
1106
  {
1107
- if ( version_compare(XMLSF_VERSION, $version, '>') ) {
1108
- // rewrite rules not available on plugins_loaded
1109
- // and don't flush rules from init as Polylang chokes on that
1110
- // just remove the db option and let WP regenerate them when ready...
1111
- delete_option('rewrite_rules');
1112
- // ... but make sure rules are regenerated when admin is visited.
1113
- set_transient('xmlsf_flush_rewrite_rules','');
1114
-
1115
- // remove robots.txt rule blocking stylesheets, but only one time!
1116
- if ( version_compare('4.4', $version, '>') && $robot_rules = get_option($this->prefix.'robots')) {
1117
- $robot_rules = str_replace(array("Disallow: */wp-content/","Allow: */wp-content/uploads/"),"",$robot_rules);
1118
- delete_option($this->prefix.'robots');
1119
- add_option($this->prefix.'robots', $robot_rules, '', 'no');
1120
- }
1121
-
1122
- // upgrade pings
1123
- if ( $pong = get_option( $this->prefix.'pong' ) && is_array($pong) ) {
1124
- $ping = $this->get_ping();
1125
- foreach ( $pong as $se => $arr) {
1126
- if ( is_array( $arr ) ) {
1127
- // convert formatted time to unix time
1128
- foreach ( $arr as $pretty => $date ) {
1129
- $time = strtotime($date);
1130
- $arr[$pretty] = (int)$time < time() ? $time : '';
1131
- }
1132
- // and set array
1133
- $ping[$se]['pong'] = $arr;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1134
  }
 
 
1135
  }
1136
- delete_option( $this->prefix.'pong' );
1137
- delete_option( $this->prefix.'ping' );
1138
- add_option( $this->prefix.'ping', array_merge( $this->defaults('ping'), $ping ), '', 'no' );
1139
  }
 
 
 
 
1140
 
1141
- delete_option('xmlsf_version');
1142
- add_option($this->prefix.'version', XMLSF_VERSION, '', 'no');
1143
 
 
1144
  error_log('XML Sitemap Feeds upgraded from '.$version.' to '.XMLSF_VERSION);
1145
- }
1146
-
1147
  }
1148
 
1149
  public function plugins_loaded()
@@ -1151,13 +1151,52 @@ class XMLSitemapFeed {
1151
  // TEXT DOMAIN
1152
  if ( is_admin() ) // text domain needed on admin only
1153
  load_plugin_textdomain('xml-sitemap-feed', false, dirname(dirname(plugin_basename( __FILE__ ))) . '/languages' );
 
 
1154
 
 
 
1155
  // UPGRADE
1156
- $this->upgrade( get_option('xmlsf_version', 0) );
 
 
 
 
 
 
1157
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1158
  }
1159
 
1160
- private function flush_rules($hard = false)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1161
  {
1162
  // did you flush already?
1163
  if ($this->yes_mother)
@@ -1167,8 +1206,10 @@ class XMLSitemapFeed {
1167
  // don't need hard flush by default
1168
  $wp_rewrite->flush_rules($hard);
1169
 
 
 
 
1170
  $this->yes_mother = true;
1171
- error_log('XML Sitemap Feeds rewrite rules flushed');
1172
  }
1173
 
1174
  public function register_gn_taxonomies()
@@ -1177,8 +1218,6 @@ class XMLSitemapFeed {
1177
  $options = $this->get_option('news_tags');
1178
 
1179
  $post_types = !empty($options['post_type']) ? $options['post_type'] : $defaults['post_type'];
1180
- if ($post_types=='any')
1181
- $post_types = get_post_types(array('public'=>true));
1182
 
1183
  register_taxonomy( 'gn-genre', $post_types, array(
1184
  'hierarchical' => true,
@@ -1199,100 +1238,8 @@ class XMLSitemapFeed {
1199
  )
1200
  ));
1201
 
1202
- register_taxonomy( 'gn-location-3', $post_types, array(
1203
- 'hierarchical' => false,
1204
- 'labels' => array(
1205
- 'name' => __('Google News Country','xml-sitemap-feed'),
1206
- //'menu_name' => __('GN Genres','xml-sitemap-feed'),
1207
- 'separate_items_with_commas' => __('Only one allowed. Must be consistent with other Google News location entities (if set).','xml-sitemap-feed'),
1208
- ),
1209
- 'public' => false,
1210
- 'show_ui' => true,
1211
- 'show_tagcloud' => false,
1212
- 'query_var' => false,
1213
- 'capabilities' => array( // prevent creation / deletion
1214
- 'manage_terms' => 'nobody',
1215
- 'edit_terms' => 'nobody',
1216
- 'delete_terms' => 'nobody',
1217
- 'assign_terms' => 'edit_posts'
1218
- )
1219
- ));
1220
-
1221
- register_taxonomy( 'gn-location-2', $post_types, array(
1222
- 'hierarchical' => false,
1223
- 'labels' => array(
1224
- 'name' => __('Google News State/Province','xml-sitemap-feed'),
1225
- //'menu_name' => __('GN Genres','xml-sitemap-feed'),
1226
- 'separate_items_with_commas' => __('Only one allowed. Must be consistent with other Google News location entities (if set).','xml-sitemap-feed'),
1227
- ),
1228
- 'public' => false,
1229
- 'show_ui' => true,
1230
- 'show_tagcloud' => false,
1231
- 'query_var' => false,
1232
- 'capabilities' => array( // prevent creation / deletion
1233
- 'manage_terms' => 'nobody',
1234
- 'edit_terms' => 'nobody',
1235
- 'delete_terms' => 'nobody',
1236
- 'assign_terms' => 'edit_posts'
1237
- )
1238
- ));
1239
-
1240
- register_taxonomy( 'gn-location-1', $post_types, array(
1241
- 'hierarchical' => false,
1242
- 'labels' => array(
1243
- 'name' => __('Google News City','xml-sitemap-feed'),
1244
- //'menu_name' => __('GN Genres','xml-sitemap-feed'),
1245
- 'separate_items_with_commas' => __('Only one allowed. Must be consistent with other Google News location entities (if set).','xml-sitemap-feed'),
1246
- ),
1247
- 'public' => false,
1248
- 'show_ui' => true,
1249
- 'show_tagcloud' => false,
1250
- 'query_var' => false,
1251
- 'capabilities' => array( // prevent creation / deletion
1252
- 'manage_terms' => 'nobody',
1253
- 'edit_terms' => 'nobody',
1254
- 'delete_terms' => 'nobody',
1255
- 'assign_terms' => 'edit_posts'
1256
- )
1257
- ));
1258
-
1259
  }
1260
 
1261
- public function register_news_taxonomy()
1262
- {
1263
- $sitemaps = $this->get_sitemaps();
1264
-
1265
- if (isset($sitemaps['sitemap-news'])) {
1266
-
1267
- // register the taxonomies
1268
- $this->register_gn_taxonomies();
1269
-
1270
- // create terms
1271
- if (delete_transient('xmlsf_create_genres')) {
1272
- foreach ($this->gn_genres as $slug => $name) {
1273
- wp_insert_term( $name, 'gn-genre', array(
1274
- 'slug' => $slug,
1275
- ) );
1276
- }
1277
- }
1278
- }
1279
- }
1280
-
1281
- public function admin_init()
1282
- {
1283
- // CATCH TRANSIENT for reset
1284
- if (delete_transient('xmlsf_clear_settings'))
1285
- $this->clear_settings();
1286
-
1287
- // CATCH TRANSIENT for flushing rewrite rules after the sitemaps setting has changed
1288
- if (delete_transient('xmlsf_flush_rewrite_rules'))
1289
- $this->flush_rules();
1290
-
1291
- // Include the admin class file
1292
- include_once( XMLSF_PLUGIN_DIR . '/includes/admin.php' );
1293
-
1294
- }
1295
-
1296
  // for debugging
1297
  public function _e_usage()
1298
  {
@@ -1330,7 +1277,7 @@ class XMLSitemapFeed {
1330
  add_filter('user_trailingslashit', array($this, 'trailingslash') );
1331
 
1332
  // TAXONOMY
1333
- add_action('init', array($this,'register_news_taxonomy'), 0 );
1334
 
1335
  // REGISTER SETTINGS, SETTINGS FIELDS...
1336
  add_action('admin_init', array($this,'admin_init'));
@@ -1354,3 +1301,5 @@ class XMLSitemapFeed {
1354
 
1355
  }
1356
  }
 
 
3
  * XMLSitemapFeed CLASS
4
  * ------------------------------ */
5
 
6
+ if ( !class_exists('XMLSitemapFeed') ) :
7
+
8
  class XMLSitemapFeed {
9
 
10
  /**
95
  );
96
  }
97
 
98
+ $active_arr = array('post','page');
 
 
 
99
 
100
  foreach ( $active_arr as $name )
101
  if ( isset($this->defaults['post_types'][$name]) )
165
  $this->defaults['domains'] = array();
166
 
167
  // news sitemap tags settings
 
168
  $this->defaults['news_tags'] = array(
169
  'name' => '',
170
+ 'post_type' => array('post'),
171
  'categories' => '',
172
  'image' => 'featured',
173
  'access' => array(
174
  'default' => '',
175
+ //'private' => 'Registration', // private posts do not show up in feeds when not logged in. no point in setting access level then...
176
  'password' => 'Subscription'
177
  ),
178
  'genres' => array(
179
  'active' => '1',
180
+ 'default' => array()
181
  ),
182
  'keywords' => array(
183
  'from' => 'category',
184
  'default' => ''
185
+ )
 
 
 
 
186
  );
187
  }
188
 
900
  // set up the sitemap index template
901
  public function load_template_index()
902
  {
903
+ load_template( dirname( __FILE__ ) . '/feed-sitemap.php' );
904
  }
905
 
906
  // set up the sitemap home page(s) template
907
  public function load_template_base()
908
  {
909
+ load_template( dirname( __FILE__ ) . '/feed-sitemap-home.php' );
910
  }
911
 
912
  // set up the post types sitemap template
913
  public function load_template()
914
  {
915
+ load_template( dirname( __FILE__ ) . '/feed-sitemap-post_type.php' );
916
  }
917
 
918
  // set up the taxonomy sitemap template
919
  public function load_template_taxonomy()
920
  {
921
+ load_template( dirname( __FILE__ ) . '/feed-sitemap-taxonomy.php' );
922
  }
923
 
924
  // set up the news sitemap template
925
  public function load_template_news()
926
  {
927
+ load_template( dirname( __FILE__ ) . '/feed-sitemap-news.php' );
928
  }
929
 
930
  // set up the news sitemap template
931
  public function load_template_custom()
932
  {
933
+ load_template( dirname( __FILE__ ) . '/feed-sitemap-custom.php' );
934
  }
935
 
936
  /**
1063
  delete_option('xmlsf_'.$option);
1064
  }
1065
 
1066
+ if ( defined('WP_DEBUG') && WP_DEBUG )
1067
+ error_log('XML Sitemap Feeds settings cleared');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1068
  }
1069
 
1070
  function cache_flush()
1079
 
1080
  public function upgrade($version)
1081
  {
1082
+ // rewrite rules not available on plugins_loaded
1083
+ // and don't flush rules from init as Polylang chokes on that
1084
+ // just remove the db option and let WP regenerate them when ready...
1085
+ delete_option('rewrite_rules');
1086
+ // ... but make sure rules are regenerated when admin is visited.
1087
+ set_transient('xmlsf_flush_rewrite_rules','');
1088
+
1089
+ // remove robots.txt rule blocking stylesheets, but only one time!
1090
+ if ( version_compare('4.4', $version, '>') && $robot_rules = get_option($this->prefix.'robots')) {
1091
+ $robot_rules = str_replace(array("Disallow: */wp-content/","Allow: */wp-content/uploads/"),"",$robot_rules);
1092
+ delete_option($this->prefix.'robots');
1093
+ add_option($this->prefix.'robots', $robot_rules, '', 'no');
1094
+ }
1095
+
1096
+ if ( version_compare('4.4.1', $version, '>') ) {
1097
+ // register location taxonomies then delete all terms
1098
+
1099
+ register_taxonomy( 'gn-location-3', null );
1100
+
1101
+ $terms = get_terms('gn-location-3',array('hide_empty' => false));
1102
+
1103
+ foreach ( $terms as $term )
1104
+ wp_delete_term( $term->term_id, 'gn-location-3' );
1105
+
1106
+ register_taxonomy( 'gn-location-2', null );
1107
+
1108
+ $terms = get_terms('gn-location-2',array('hide_empty' => false));
1109
+
1110
+ foreach ( $terms as $term )
1111
+ wp_delete_term( $term->term_id, 'gn-location-2' );
1112
+
1113
+ register_taxonomy( 'gn-location-1', null );
1114
+
1115
+ $terms = get_terms('gn-location-1',array('hide_empty' => false));
1116
+
1117
+ foreach ( $terms as $term )
1118
+ wp_delete_term( $term->term_id, 'gn-location-1' );
1119
+
1120
+ }
1121
+
1122
+ // upgrade pings
1123
+ if ( $pong = get_option( $this->prefix.'pong' ) && is_array($pong) ) {
1124
+ $ping = $this->get_ping();
1125
+ foreach ( $pong as $se => $arr) {
1126
+ if ( is_array( $arr ) ) {
1127
+ // convert formatted time to unix time
1128
+ foreach ( $arr as $pretty => $date ) {
1129
+ $time = strtotime($date);
1130
+ $arr[$pretty] = (int)$time < time() ? $time : '';
1131
  }
1132
+ // and set array
1133
+ $ping[$se]['pong'] = $arr;
1134
  }
 
 
 
1135
  }
1136
+ delete_option( $this->prefix.'pong' );
1137
+ delete_option( $this->prefix.'ping' );
1138
+ add_option( $this->prefix.'ping', array_merge( $this->defaults('ping'), $ping ), '', 'no' );
1139
+ }
1140
 
1141
+ delete_option('xmlsf_version');
1142
+ add_option($this->prefix.'version', XMLSF_VERSION, '', 'no');
1143
 
1144
+ if ( defined('WP_DEBUG') && WP_DEBUG )
1145
  error_log('XML Sitemap Feeds upgraded from '.$version.' to '.XMLSF_VERSION);
1146
+
 
1147
  }
1148
 
1149
  public function plugins_loaded()
1151
  // TEXT DOMAIN
1152
  if ( is_admin() ) // text domain needed on admin only
1153
  load_plugin_textdomain('xml-sitemap-feed', false, dirname(dirname(plugin_basename( __FILE__ ))) . '/languages' );
1154
+
1155
+ }
1156
 
1157
+ public function init()
1158
+ {
1159
  // UPGRADE
1160
+ $version = get_option('xmlsf_version', 0);
1161
+
1162
+ if ( version_compare(XMLSF_VERSION, $version, '>') )
1163
+ $this->upgrade($version);
1164
+
1165
+ // TAXONOMIES
1166
+ $sitemaps = $this->get_sitemaps();
1167
 
1168
+ if (isset($sitemaps['sitemap-news'])) {
1169
+ // register the taxonomies
1170
+ $this->register_gn_taxonomies();
1171
+
1172
+ // create terms
1173
+ if ( delete_transient('xmlsf_create_genres') ) {
1174
+ foreach ($this->gn_genres as $slug => $name) {
1175
+ wp_insert_term( $name, 'gn-genre', array(
1176
+ 'slug' => $slug,
1177
+ ) );
1178
+ }
1179
+ }
1180
+ }
1181
+
1182
  }
1183
 
1184
+ public function admin_init()
1185
+ {
1186
+ // CATCH TRANSIENT for reset
1187
+ if (delete_transient('xmlsf_clear_settings'))
1188
+ $this->clear_settings();
1189
+
1190
+ // CATCH TRANSIENT for flushing rewrite rules after the sitemaps setting has changed
1191
+ if (delete_transient('xmlsf_flush_rewrite_rules'))
1192
+ $this->flush_rules();
1193
+
1194
+ // Include the admin class file
1195
+ include_once( dirname(__FILE__) . '/admin.php' );
1196
+
1197
+ }
1198
+
1199
+ public function flush_rules($hard = false)
1200
  {
1201
  // did you flush already?
1202
  if ($this->yes_mother)
1206
  // don't need hard flush by default
1207
  $wp_rewrite->flush_rules($hard);
1208
 
1209
+ if ( defined('WP_DEBUG') && WP_DEBUG )
1210
+ error_log('XML Sitemap Feeds rewrite rules flushed');
1211
+
1212
  $this->yes_mother = true;
 
1213
  }
1214
 
1215
  public function register_gn_taxonomies()
1218
  $options = $this->get_option('news_tags');
1219
 
1220
  $post_types = !empty($options['post_type']) ? $options['post_type'] : $defaults['post_type'];
 
 
1221
 
1222
  register_taxonomy( 'gn-genre', $post_types, array(
1223
  'hierarchical' => true,
1238
  )
1239
  ));
1240
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1241
  }
1242
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1243
  // for debugging
1244
  public function _e_usage()
1245
  {
1277
  add_filter('user_trailingslashit', array($this, 'trailingslash') );
1278
 
1279
  // TAXONOMY
1280
+ add_action('init', array($this,'init'), 0 );
1281
 
1282
  // REGISTER SETTINGS, SETTINGS FIELDS...
1283
  add_action('admin_init', array($this,'admin_init'));
1301
 
1302
  }
1303
  }
1304
+
1305
+ endif;
includes/feed-sitemap-custom.php CHANGED
@@ -10,7 +10,7 @@ header('Content-Type: text/xml; charset=' . get_bloginfo('charset'), true);
10
  header('X-Robots-Tag: noindex, follow', true);
11
 
12
  echo '<?xml version="1.0" encoding="' . get_bloginfo('charset') . '"?>
13
- <?xml-stylesheet type="text/xsl" href="' . XMLSF_PLUGIN_URL . '/includes/xsl/sitemap.xsl?ver=' . XMLSF_VERSION . '"?>
14
  <!-- generated-on="' . date('Y-m-d\TH:i:s+00:00') . '" -->
15
  <!-- generator="XML & Google News Sitemap Feed plugin for WordPress" -->
16
  <!-- generator-url="http://status301.net/wordpress-plugins/xml-sitemap-feed/" -->
10
  header('X-Robots-Tag: noindex, follow', true);
11
 
12
  echo '<?xml version="1.0" encoding="' . get_bloginfo('charset') . '"?>
13
+ <?xml-stylesheet type="text/xsl" href="' . plugins_url('/xsl/sitemap.xsl',__FILE__) . '?ver=' . XMLSF_VERSION . '"?>
14
  <!-- generated-on="' . date('Y-m-d\TH:i:s+00:00') . '" -->
15
  <!-- generator="XML & Google News Sitemap Feed plugin for WordPress" -->
16
  <!-- generator-url="http://status301.net/wordpress-plugins/xml-sitemap-feed/" -->
includes/feed-sitemap-home.php CHANGED
@@ -10,7 +10,7 @@ header('Content-Type: text/xml; charset=' . get_bloginfo('charset'), true);
10
  header('X-Robots-Tag: noindex, follow', true);
11
 
12
  echo '<?xml version="1.0" encoding="' . get_bloginfo('charset') . '"?>
13
- <?xml-stylesheet type="text/xsl" href="' . XMLSF_PLUGIN_URL . '/includes/xsl/sitemap.xsl?ver=' . XMLSF_VERSION . '"?>
14
  <!-- generated-on="' . date('Y-m-d\TH:i:s+00:00') . '" -->
15
  <!-- generator="XML & Google News Sitemap Feed plugin for WordPress" -->
16
  <!-- generator-url="http://status301.net/wordpress-plugins/xml-sitemap-feed/" -->
10
  header('X-Robots-Tag: noindex, follow', true);
11
 
12
  echo '<?xml version="1.0" encoding="' . get_bloginfo('charset') . '"?>
13
+ <?xml-stylesheet type="text/xsl" href="' . plugins_url('/xsl/sitemap.xsl',__FILE__) . '?ver=' . XMLSF_VERSION . '"?>
14
  <!-- generated-on="' . date('Y-m-d\TH:i:s+00:00') . '" -->
15
  <!-- generator="XML & Google News Sitemap Feed plugin for WordPress" -->
16
  <!-- generator-url="http://status301.net/wordpress-plugins/xml-sitemap-feed/" -->
includes/feed-sitemap-news.php CHANGED
@@ -13,7 +13,7 @@ header('Content-Type: text/xml; charset=' . get_bloginfo('charset'), true);
13
  header('X-Robots-Tag: noindex, follow', true);
14
 
15
  echo '<?xml version="1.0" encoding="'.get_bloginfo('charset').'"?>
16
- <?xml-stylesheet type="text/xsl" href="' . XMLSF_PLUGIN_URL . '/includes/xsl/sitemap-news.xsl?ver=' . XMLSF_VERSION . '"?>
17
  <!-- generated-on="'.date('Y-m-d\TH:i:s+00:00').'" -->
18
  <!-- generator="XML & Google News Sitemap Feed plugin for WordPress" -->
19
  <!-- generator-url="http://status301.net/wordpress-plugins/xml-sitemap-feed/" -->
@@ -81,9 +81,6 @@ if ( have_posts() ) :
81
  // access tag
82
  $access = '';
83
  if (!empty($options['access'])) {
84
- // if ( get_post_status() == 'private' ) {
85
- // if (!empty($options['access']['private'])) $access = $options['access']['private'];
86
- // } else
87
  if ( post_password_required() ) {
88
  if (!empty($options['access']['password'])) $access = $options['access']['password'];
89
  } else {
@@ -113,7 +110,7 @@ if ( have_posts() ) :
113
  $genres = trim(apply_filters('the_title_xmlsitemap', $genres));
114
 
115
  if ( empty($genres) && !empty($options['genres']) && !empty($options['genres']['default']) ) {
116
- $genres = trim(apply_filters('the_title_xmlsitemap', $options['genres']['default']));
117
  }
118
 
119
  if ( !empty($genres) ) {
@@ -150,36 +147,7 @@ if ( have_posts() ) :
150
  ?>
151
  <news:keywords><?php echo $keywords; ?></news:keywords>
152
  <?php
153
- }
154
-
155
- // locations tag
156
- $locations = '';
157
- $sep = '';
158
- $locs = array('gn-location-1','gn-location-2','gn-location-3');
159
- foreach ($locs as $tax) {
160
- $terms = get_the_terms($post->ID,$tax);
161
- if ( is_array($terms) ) {
162
- $obj = reset($terms);
163
- $term = is_object($obj) ? trim($obj->name) : '';
164
- if ( !empty($term) ) {
165
- $locations .= $sep . $term;
166
- $sep = ', ';
167
- }
168
- }
169
- }
170
-
171
- $locations = trim(apply_filters('the_title_xmlsitemap', $locations));
172
-
173
- if ( empty($locations) && isset($options['locations']) && !empty($options['locations']['default']) ) {
174
- $locations = trim(apply_filters('the_title_xmlsitemap', $options['locations']['default']));
175
- }
176
-
177
- if ( !empty($locations) ) {
178
- ?>
179
- <news:geo_locations><?php echo $locations; ?></news:geo_locations>
180
- <?php
181
- }
182
-
183
  ?>
184
  </news:news>
185
  <?php
@@ -211,18 +179,12 @@ if ( have_posts() ) :
211
  <?php
212
  endwhile;
213
  else :
214
- // No posts? Then there is only the homepage...
215
 
216
  $lastmodified_gmt = get_lastmodified('GMT'); // last posts or page modified date
217
  ?>
218
  <url>
219
- <loc><?php
220
- // hook for filter 'xml_sitemap_url' provides a string here and MUST get a string returned
221
- //$url = apply_filters( 'xml_sitemap_url', trailingslashit(home_url()) );
222
- //if ( is_string($url) )
223
- // echo esc_url( $url );
224
- //else
225
- echo esc_url( trailingslashit(home_url()) ); ?></loc>
226
  <lastmod><?php echo mysql2date('Y-m-d\TH:i:s+00:00', $lastmodified_gmt, false); ?></lastmod>
227
  <changefreq>daily</changefreq>
228
  <priority>1.0</priority>
13
  header('X-Robots-Tag: noindex, follow', true);
14
 
15
  echo '<?xml version="1.0" encoding="'.get_bloginfo('charset').'"?>
16
+ <?xml-stylesheet type="text/xsl" href="' . plugins_url('/xsl/sitemap-news.xsl',__FILE__) . '?ver=' . XMLSF_VERSION . '"?>
17
  <!-- generated-on="'.date('Y-m-d\TH:i:s+00:00').'" -->
18
  <!-- generator="XML & Google News Sitemap Feed plugin for WordPress" -->
19
  <!-- generator-url="http://status301.net/wordpress-plugins/xml-sitemap-feed/" -->
81
  // access tag
82
  $access = '';
83
  if (!empty($options['access'])) {
 
 
 
84
  if ( post_password_required() ) {
85
  if (!empty($options['access']['password'])) $access = $options['access']['password'];
86
  } else {
110
  $genres = trim(apply_filters('the_title_xmlsitemap', $genres));
111
 
112
  if ( empty($genres) && !empty($options['genres']) && !empty($options['genres']['default']) ) {
113
+ $genres = implode( ', ', (array)$options['genres']['default'] );
114
  }
115
 
116
  if ( !empty($genres) ) {
147
  ?>
148
  <news:keywords><?php echo $keywords; ?></news:keywords>
149
  <?php
150
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
151
  ?>
152
  </news:news>
153
  <?php
179
  <?php
180
  endwhile;
181
  else :
182
+ // No posts? Then only do the homepage...
183
 
184
  $lastmodified_gmt = get_lastmodified('GMT'); // last posts or page modified date
185
  ?>
186
  <url>
187
+ <loc><?php echo esc_url( trailingslashit(home_url()) ); ?></loc>
 
 
 
 
 
 
188
  <lastmod><?php echo mysql2date('Y-m-d\TH:i:s+00:00', $lastmodified_gmt, false); ?></lastmod>
189
  <changefreq>daily</changefreq>
190
  <priority>1.0</priority>
includes/feed-sitemap-post_type.php CHANGED
@@ -10,7 +10,7 @@ header('Content-Type: text/xml; charset=' . get_bloginfo('charset'), true);
10
  header('X-Robots-Tag: noindex, follow', true);
11
 
12
  echo '<?xml version="1.0" encoding="' . get_bloginfo('charset') . '"?>
13
- <?xml-stylesheet type="text/xsl" href="' . XMLSF_PLUGIN_URL . '/includes/xsl/sitemap.xsl?ver=' . XMLSF_VERSION . '"?>
14
  <!-- generated-on="' . date('Y-m-d\TH:i:s+00:00') . '" -->
15
  <!-- generator="XML & Google News Sitemap Feed plugin for WordPress" -->
16
  <!-- generator-url="http://status301.net/wordpress-plugins/xml-sitemap-feed/" -->
10
  header('X-Robots-Tag: noindex, follow', true);
11
 
12
  echo '<?xml version="1.0" encoding="' . get_bloginfo('charset') . '"?>
13
+ <?xml-stylesheet type="text/xsl" href="' . plugins_url('/xsl/sitemap.xsl',__FILE__) . '?ver=' . XMLSF_VERSION . '"?>
14
  <!-- generated-on="' . date('Y-m-d\TH:i:s+00:00') . '" -->
15
  <!-- generator="XML & Google News Sitemap Feed plugin for WordPress" -->
16
  <!-- generator-url="http://status301.net/wordpress-plugins/xml-sitemap-feed/" -->
includes/feed-sitemap-taxonomy.php CHANGED
@@ -10,7 +10,7 @@ header('Content-Type: text/xml; charset=' . get_bloginfo('charset', 'UTF-8'), tr
10
  header('X-Robots-Tag: noindex, follow', true);
11
 
12
  echo '<?xml version="1.0" encoding="'.get_bloginfo('charset', 'UTF-8').'"?>
13
- <?xml-stylesheet type="text/xsl" href="' . XMLSF_PLUGIN_URL . '/includes/xsl/sitemap.xsl?ver=' . XMLSF_VERSION . '"?>
14
  <!-- generated-on="'.date('Y-m-d\TH:i:s+00:00').'" -->
15
  <!-- generator="XML & Google News Sitemap Feed plugin for WordPress" -->
16
  <!-- generator-url="http://status310.net/wordpress-plugins/xml-sitemap-feed/" -->
10
  header('X-Robots-Tag: noindex, follow', true);
11
 
12
  echo '<?xml version="1.0" encoding="'.get_bloginfo('charset', 'UTF-8').'"?>
13
+ <?xml-stylesheet type="text/xsl" href="' . plugins_url('/xsl/sitemap.xsl',__FILE__) . '?ver=' . XMLSF_VERSION . '"?>
14
  <!-- generated-on="'.date('Y-m-d\TH:i:s+00:00').'" -->
15
  <!-- generator="XML & Google News Sitemap Feed plugin for WordPress" -->
16
  <!-- generator-url="http://status310.net/wordpress-plugins/xml-sitemap-feed/" -->
includes/feed-sitemap.php CHANGED
@@ -10,7 +10,7 @@ header('Content-Type: text/xml; charset=' . get_bloginfo('charset'), true);
10
  header('X-Robots-Tag: noindex, follow', true);
11
 
12
  echo '<?xml version="1.0" encoding="'.get_bloginfo('charset').'"?>
13
- <?xml-stylesheet type="text/xsl" href="' . XMLSF_PLUGIN_URL . '/includes/xsl/sitemap-index.xsl?ver=' . XMLSF_VERSION . '"?>
14
  <!-- generated-on="'.date('Y-m-d\TH:i:s+00:00').'" -->
15
  <!-- generator="XML & Google News Sitemap Feed plugin for WordPress" -->
16
  <!-- generator-url="http://status301.net/wordpress-plugins/xml-sitemap-feed/" -->
10
  header('X-Robots-Tag: noindex, follow', true);
11
 
12
  echo '<?xml version="1.0" encoding="'.get_bloginfo('charset').'"?>
13
+ <?xml-stylesheet type="text/xsl" href="' . plugins_url('xsl/sitemap-index.xsl',__FILE__) . '?ver=' . XMLSF_VERSION . '"?>
14
  <!-- generated-on="'.date('Y-m-d\TH:i:s+00:00').'" -->
15
  <!-- generator="XML & Google News Sitemap Feed plugin for WordPress" -->
16
  <!-- generator-url="http://status301.net/wordpress-plugins/xml-sitemap-feed/" -->
includes/xsl/sitemap-news.xsl CHANGED
@@ -27,7 +27,6 @@
27
  <th>Genre(s)</th>
28
  <th>Keyword(s)</th>
29
  <th>Image(s)</th>
30
- <th>Location</th>
31
  <th>Publication Date (GMT)</th>
32
  </tr>
33
  <xsl:variable name="lower" select="'abcdefghijklmnopqrstuvwxyz'"/>
@@ -42,7 +41,6 @@
42
  <td><xsl:value-of select="news:news/news:genres"/></td>
43
  <td><xsl:value-of select="news:news/news:keywords"/></td>
44
  <td><xsl:value-of select="count(image:image)"/></td>
45
- <td><xsl:value-of select="news:news/news:geo_locations"/></td>
46
  <td><xsl:value-of select="concat(substring(news:news/news:publication_date,0,11),concat(' ', substring(news:news/news:publication_date,12,8)))"/></td>
47
  </tr>
48
  </xsl:for-each>
27
  <th>Genre(s)</th>
28
  <th>Keyword(s)</th>
29
  <th>Image(s)</th>
 
30
  <th>Publication Date (GMT)</th>
31
  </tr>
32
  <xsl:variable name="lower" select="'abcdefghijklmnopqrstuvwxyz'"/>
41
  <td><xsl:value-of select="news:news/news:genres"/></td>
42
  <td><xsl:value-of select="news:news/news:keywords"/></td>
43
  <td><xsl:value-of select="count(image:image)"/></td>
 
44
  <td><xsl:value-of select="concat(substring(news:news/news:publication_date,0,11),concat(' ', substring(news:news/news:publication_date,12,8)))"/></td>
45
  </tr>
46
  </xsl:for-each>
readme.txt CHANGED
@@ -3,8 +3,8 @@ 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: sitemap, xml sitemap, news sitemap, sitemap.xml, robots.txt, Google, Google News, Yahoo, Bing, , Yandex, Baidu, seo, feed, polylang, image sitemap
5
  Requires at least: 3.2
6
- Tested up to: 4.2
7
- Stable tag: 4.4
8
 
9
  XML and Google News Sitemaps to feed the hungry spiders. Multisite, WP Super Cache and Polylang compatible.
10
 
@@ -47,7 +47,7 @@ Please read the FAQ's for info on how to get your articles listed on Google News
47
 
48
  * Optionally include Image tags with caption and title for featured images or attached images.
49
  * Options to: set a different News Publication Name, include custom post types or limit inclusion to certain post categories.
50
- * Configure <access>, <genres>, <keywords> and <geo_locations> both globally and post by post
51
  * Pings Google on new publications.
52
 
53
  ** More **
@@ -293,12 +293,19 @@ Thanks for sharing your translation :)
293
 
294
  == Upgrade Notice ==
295
 
296
- = 4.4 =
297
- Google News Sitemap: limit posts to certain categories. Some (query) optimizations and bugfixes.
298
 
299
 
300
  == Changelog ==
301
 
 
 
 
 
 
 
 
302
  = 4.4 =
303
  * Pings max once per hour (5 minutes for news sitemap)
304
  * Seperate ping for Google News 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: sitemap, xml sitemap, news sitemap, sitemap.xml, robots.txt, Google, Google News, Yahoo, Bing, , Yandex, Baidu, seo, feed, polylang, image sitemap
5
  Requires at least: 3.2
6
+ Tested up to: 4.3
7
+ Stable tag: 4.4.1
8
 
9
  XML and Google News Sitemaps to feed the hungry spiders. Multisite, WP Super Cache and Polylang compatible.
10
 
47
 
48
  * Optionally include Image tags with caption and title for featured images or attached images.
49
  * Options to: set a different News Publication Name, include custom post types or limit inclusion to certain post categories.
50
+ * Configure <access>, <genres> and <keywords> tags both globally and post by post
51
  * Pings Google on new publications.
52
 
53
  ** More **
293
 
294
  == Upgrade Notice ==
295
 
296
+ = 4.4.1 =
297
+ Multiple default genres, several bugfixes, dropping Google News old geolocation tag plus XMLSF_POST_TYPE and XMLSF_NEWS_POST_TYPE.
298
 
299
 
300
  == Changelog ==
301
 
302
+ = 4.4.1 =
303
+ * BUGFIX contribution by alejandra.aranibar: multiple news post types makes get_lastdate return oldest instead of newest date
304
+ * BUGFIX plugins_url filter not working, reported by Michael
305
+ * Dropped GN Geolocation tag support
306
+ * Dropped XMLSF_POST_TYPE and XMLSF_NEWS_POST_TYPE defines support
307
+ * Multiple default genres
308
+
309
  = 4.4 =
310
  * Pings max once per hour (5 minutes for news sitemap)
311
  * Seperate ping for Google News Sitemap
uninstall.php CHANGED
@@ -40,16 +40,15 @@ class XMLSitemapFeed_Uninstall {
40
  */
41
  function uninstall($blog_id = false)
42
  {
43
- /* TODO: find a way to delete tax terms without the plugin active and the tax being registered.
44
- *
45
- * Either replicate register_gn_taxonomies and clear_settings here...
46
- * Or do something like (would this work at all? and on multisite with switch_to_blog?):
47
- if ( class_exists('XMLSitemapFeed') || include_once( dirname(__FILE__) . '/includes/core.php' ) )
48
- $xmlsf = new XMLSitemapFeed();
49
- $xmlsf->clear_settings();
50
- * But for now, stick to siple options removal:
51
- */
52
-
53
  // remove plugin settings
54
  delete_option('xmlsf_version');
55
  delete_option('xmlsf_sitemaps');
@@ -66,7 +65,7 @@ class XMLSitemapFeed_Uninstall {
66
  // make rewrite rules update at the appropriate time
67
  delete_option('rewrite_rules');
68
 
69
- // one last 'Kilroy was here'
70
  if ($blog_id)
71
  error_log('XML Sitemap Feeds settings cleared from site '.$blog_id.'.');
72
  else
40
  */
41
  function uninstall($blog_id = false)
42
  {
43
+ // delete all taxonomy terms
44
+ register_taxonomy( 'gn-genre', null );
45
+
46
+ $terms = get_terms('gn-genre',array('hide_empty' => false));
47
+
48
+ if ( is_array($terms) )
49
+ foreach ( $terms as $term )
50
+ wp_delete_term( $term->term_id, 'gn-genre' );
51
+
 
52
  // remove plugin settings
53
  delete_option('xmlsf_version');
54
  delete_option('xmlsf_sitemaps');
65
  // make rewrite rules update at the appropriate time
66
  delete_option('rewrite_rules');
67
 
68
+ // Kilroy was here
69
  if ($blog_id)
70
  error_log('XML Sitemap Feeds settings cleared from site '.$blog_id.'.');
71
  else
xml-sitemap.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: XML Sitemap & Google News feeds
4
  Plugin URI: http://status301.net/wordpress-plugins/xml-sitemap-feed/
5
  Description: Feed the hungry spiders in compliance with the XML Sitemap and Google News protocols. Happy with the results? 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=4%2e0&no_shipping=0&tax=0&bn=PP%2dDonationsBF&charset=UTF%2d8&lc=us">tip</a></strong> for continued development and support. Thanks :)
6
  Text Domain: xml-sitemap-feed
7
- Version: 4.4
8
  Author: RavanH
9
  Author URI: http://status301.net/
10
  */
@@ -40,31 +40,17 @@ Author URI: http://status301.net/
40
  */
41
 
42
  if(!empty($_SERVER['SCRIPT_FILENAME']) && 'xml-sitemap.php' == basename($_SERVER['SCRIPT_FILENAME']))
 
43
  die('You may not access this file directly!');
44
 
45
  /* --------------------
46
  * CONSTANTS
47
  * -------------------- */
48
 
49
- define('XMLSF_VERSION', '4.4');
50
 
51
  define('XMLSF_PLUGIN_BASENAME', plugin_basename(__FILE__));
52
 
53
- if ( file_exists ( dirname(__FILE__).'/xml-sitemap-feed' ) ) :
54
-
55
- define('XMLSF_PLUGIN_DIR', dirname(__FILE__).'/xml-sitemap-feed');
56
-
57
- define('XMLSF_PLUGIN_URL', plugins_url('/xml-sitemap-feed',__FILE__) );
58
-
59
- else :
60
-
61
- define('XMLSF_PLUGIN_DIR', dirname(__FILE__));
62
-
63
- define('XMLSF_PLUGIN_URL', plugins_url('',__FILE__));
64
-
65
- endif;
66
-
67
-
68
  /*
69
  * The following constants can be used to change plugin defaults
70
  * by defining them in wp-config.php
@@ -90,39 +76,6 @@ if ( !defined('XMLSF_NEWS_NAME') )
90
 
91
  define('XMLSF_NEWS_NAME', 'sitemap-news.xml');
92
 
93
- /*
94
- * XMLSF_POST_TYPE
95
- *
96
- * Comma seperated list of post types.
97
- * default: 'any'
98
- *
99
- * example:
100
- * define('XMLSF_POST_TYPE', 'post,page');
101
- */
102
-
103
-
104
- /*
105
- * XMLSF_POST_TYPE_NEWS_TAGS
106
- *
107
- * Post types to append sitemap news tags to in regular sitemaps.
108
- * Does not have effect when News sitemap is switched of in site settings.
109
- * default: 'post'
110
- *
111
- * example:
112
- * define('XMLSF_POST_TYPE_NEWS_TAGS', 'post,mycustomtype');
113
- */
114
-
115
-
116
- /*
117
- * XMLSF_NEWS_POST_TYPE
118
- *
119
- * Post types to include in dedicated news sitemap
120
- * default: 'post'
121
- *
122
- * example:
123
- * define('XMLSF_NEWS_POST_TYPE', 'post,news');
124
- */
125
-
126
  /*
127
  * XMLSF_MULTISITE_UNINSTALL
128
  *
@@ -137,14 +90,19 @@ if ( !defined('XMLSF_NEWS_NAME') )
137
 
138
 
139
  /* -------------------------------------
140
- * MISSING WORDPRESS FUNCTIONS
141
  * ------------------------------------- */
 
 
 
 
 
142
 
143
- include_once(XMLSF_PLUGIN_DIR . '/hacks.php');
 
144
 
145
  /* ----------------------
146
  * INSTANTIATE
147
  * ---------------------- */
148
 
149
- if ( class_exists('XMLSitemapFeed') || include_once( XMLSF_PLUGIN_DIR . '/includes/core.php' ) )
150
- $xmlsf = new XMLSitemapFeed();
4
  Plugin URI: http://status301.net/wordpress-plugins/xml-sitemap-feed/
5
  Description: Feed the hungry spiders in compliance with the XML Sitemap and Google News protocols. Happy with the results? 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=4%2e0&no_shipping=0&tax=0&bn=PP%2dDonationsBF&charset=UTF%2d8&lc=us">tip</a></strong> for continued development and support. Thanks :)
6
  Text Domain: xml-sitemap-feed
7
+ Version: 4.4.1
8
  Author: RavanH
9
  Author URI: http://status301.net/
10
  */
40
  */
41
 
42
  if(!empty($_SERVER['SCRIPT_FILENAME']) && 'xml-sitemap.php' == basename($_SERVER['SCRIPT_FILENAME']))
43
+
44
  die('You may not access this file directly!');
45
 
46
  /* --------------------
47
  * CONSTANTS
48
  * -------------------- */
49
 
50
+ define('XMLSF_VERSION', '4.4.1');
51
 
52
  define('XMLSF_PLUGIN_BASENAME', plugin_basename(__FILE__));
53
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  /*
55
  * The following constants can be used to change plugin defaults
56
  * by defining them in wp-config.php
76
 
77
  define('XMLSF_NEWS_NAME', 'sitemap-news.xml');
78
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
  /*
80
  * XMLSF_MULTISITE_UNINSTALL
81
  *
90
 
91
 
92
  /* -------------------------------------
93
+ * INCLUDE HACKS & CLASS
94
  * ------------------------------------- */
95
+
96
+ $xmlsf_dir = dirname(__FILE__);
97
+
98
+ if ( file_exists ( $xmlsf_dir.'/xml-sitemap-feed' ) )
99
+ $xmlsf_dir .= '/xml-sitemap-feed';
100
 
101
+ include_once( $xmlsf_dir.'/hacks.php' );
102
+ include_once( $xmlsf_dir.'/includes/core.php' );
103
 
104
  /* ----------------------
105
  * INSTANTIATE
106
  * ---------------------- */
107
 
108
+ $xmlsf = new XMLSitemapFeed();