XML Sitemap & Google News feeds - Version 4.8

Version Description

New conditional functions, ping URL, and several bug fixes.

=

Download this release

Release Info

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

Code changes from version 4.7.5 to 4.8

hacks.php DELETED
@@ -1,167 +0,0 @@
1
- <?php
2
- /* -------------------------------------
3
- * MISSING WORDPRESS FUNCTIONS
4
- * ------------------------------------- */
5
-
6
- /**
7
- * Retrieve the date that the first post/page was published.
8
- *
9
- * The server timezone is the default and is the difference between GMT and
10
- * server time. The 'blog' value is the date when the last post was posted. The
11
- * 'gmt' is when the last post was posted in GMT formatted date.
12
- *
13
- * @uses apply_filters() Calls 'get_firstdate' filter
14
- *
15
- * @param string $timezone The location to get the time. Can be 'gmt', 'blog', or 'server'.
16
- * @param string $post_type Post type to check.
17
- * @return string The date of the last post.
18
- */
19
- if( !function_exists('get_firstdate') ) {
20
- function get_firstdate($timezone = 'server', $post_type = 'any') {
21
- return apply_filters( 'get_firstdate', _get_time( $timezone, 'date', $post_type, 'first' ), $timezone );
22
- }
23
- }
24
-
25
- /**
26
- * Retrieve the date that the last post/page was published.
27
- *
28
- * The server timezone is the default and is the difference between GMT and
29
- * server time. The 'blog' value is the date when the last post was posted. The
30
- * 'gmt' is when the last post was posted in GMT formatted date.
31
- *
32
- * @uses apply_filters() Calls 'get_lastdate' filter
33
- *
34
- * @param string $timezone The location to get the time. Can be 'gmt', 'blog', or 'server'.
35
- * @param $post_types The post type(s). Can be string or array.
36
- * @return string The date of the last post.
37
- */
38
- if( !function_exists('get_lastdate') ) {
39
- function get_lastdate($timezone = 'server', $post_types = 'any', $m = false) {
40
- if (!is_array($post_types))
41
- $post_types = array($post_types);
42
-
43
- $lastmodified = array();
44
- foreach ($post_types as $post_type)
45
- $lastmodified[] = _get_time( $timezone, 'date', $post_type, 'last', $m );
46
-
47
- sort($lastmodified);
48
- $lastmodified = array_filter($lastmodified);
49
- return apply_filters( 'get_lastdate', end($lastmodified), $timezone );
50
- }
51
- }
52
-
53
- /**
54
- * Retrieve last post/page modified date depending on timezone.
55
- *
56
- * The server timezone is the default and is the difference between GMT and
57
- * server time. The 'blog' value is the date when the last post was posted. The
58
- * 'gmt' is when the last post was posted in GMT formatted date.
59
- *
60
- * @uses apply_filters() Calls 'get_lastmodified' filter
61
- *
62
- * @param string $timezone The location to get the time. Can be 'gmt', 'blog', or 'server'.
63
- * @return string The date of the oldest modified post.
64
- */
65
- if( !function_exists('get_lastmodified') ) {
66
- function get_lastmodified($timezone = 'server', $post_type = 'any', $m = false) {
67
- return apply_filters( 'get_lastmodified', _get_time( $timezone, 'modified', $post_type, 'last', $m ), $timezone );
68
- }
69
- }
70
-
71
- /**
72
- * Retrieve first or last post type date data based on timezone.
73
- * Variation of function _get_last_post_time
74
- *
75
- * @param string $timezone The location to get the time. Can be 'gmt', 'blog', or 'server'.
76
- * @param string $field Field to check. Can be 'date' or 'modified'.
77
- * @param string $post_type Post type to check. Defaults to 'any'.
78
- * @param string $which Which to check. Can be 'first' or 'last'. Defaults to 'last'.
79
- * @return string The date.
80
- */
81
- if( !function_exists('_get_time') ) {
82
- function _get_time( $timezone, $field, $post_type = 'any', $which = 'last', $m = 0 ) {
83
- global $wpdb;
84
-
85
- if ( !in_array( $field, array( 'date', 'modified' ) ) )
86
- return false;
87
-
88
- $timezone = strtolower( $timezone );
89
-
90
- $order = ( $which == 'last' ) ? 'DESC' : 'ASC';
91
-
92
- $key = _get_time_key( $timezone, $field, $post_type, $which, $m );
93
-
94
- $date = wp_cache_get( $key, 'timeinfo' );
95
-
96
- if ( !$date ) {
97
- $add_seconds_server = date('Z');
98
-
99
- if ( $post_type == 'any' ) {
100
- $post_types = get_post_types( array( 'public' => true ) );
101
- array_walk( $post_types, array( &$wpdb, 'escape_by_ref' ) );
102
- $post_types = "'" . implode( "', '", $post_types ) . "'";
103
- } elseif ( is_array($post_type) ) {
104
- $types = get_post_types( array( 'public' => true ) );
105
- foreach ( $post_type as $type )
106
- if ( !in_array( $type, $types ) )
107
- return false;
108
- array_walk( $post_type, array( &$wpdb, 'escape_by_ref' ) );
109
- $post_types = "'" . implode( "', '", $post_type ) . "'";
110
- } else {
111
- if ( !in_array( $post_type, get_post_types( array( 'public' => true ) ) ) )
112
- return false;
113
- $post_types = "'" . addslashes($post_type) . "'";
114
- }
115
-
116
- $where = "$wpdb->posts.post_status='publish' AND $wpdb->posts.post_type IN ({$post_types}) AND $wpdb->posts.post_date_gmt ";
117
- // If a month is specified in the querystring, load that month
118
- $m = preg_replace('|[^0-9]|', '', $m);
119
- if ( !empty($m) ) {
120
- $where .= " AND YEAR($wpdb->posts.post_date)=" . substr($m, 0, 4);
121
- if ( strlen($m) > 5 )
122
- $where .= " AND MONTH($wpdb->posts.post_date)=" . substr($m, 4, 2);
123
- }
124
-
125
- switch ( $timezone ) {
126
- case 'gmt':
127
- $date = $wpdb->get_var("SELECT post_{$field}_gmt FROM $wpdb->posts WHERE $where ORDER BY $wpdb->posts.post_{$field}_gmt {$order} LIMIT 1");
128
- break;
129
- case 'blog':
130
- $date = $wpdb->get_var("SELECT post_{$field} FROM $wpdb->posts WHERE $where ORDER BY $wpdb->posts.post_{$field}_gmt {$order} LIMIT 1");
131
- break;
132
- case 'server':
133
- $date = $wpdb->get_var("SELECT DATE_ADD(post_{$field}_gmt, INTERVAL '$add_seconds_server' SECOND) FROM $wpdb->posts WHERE $where ORDER BY $wpdb->posts.post_{$field}_gmt {$order} LIMIT 1");
134
- break;
135
- }
136
-
137
-
138
- if ( $date )
139
- wp_cache_set( $key, $date, 'timeinfo' );
140
- }
141
-
142
- return $date;
143
- }
144
- }
145
-
146
- /**
147
- * Build transient key based on input parameters.
148
- * Contributed by https://github.com/shaula https://wordpress.org/support/users/e2robert/
149
- *
150
- * @param string $timezone The location to get the time. Can be 'gmt', 'blog', or 'server'.
151
- * @param string $field Field to check. Can be 'date' or 'modified'.
152
- * @param string $post_type Post type to check. Defaults to 'any'.
153
- * @param string $which Which to check. Can be 'first' or 'last'. Defaults to 'last'.
154
- * @param string $m month to check.
155
- * @return string.
156
- */
157
- if( !function_exists('_get_time_key') ) {
158
- function _get_time_key( $timezone, $field, $post_type = 'any', $which = 'last', $m = 0 ) {
159
- $timezone = strtolower( $timezone );
160
-
161
- if ( $post_type == 'any' ) {
162
- return "{$which}post{$field}{$m}:$timezone";
163
- }
164
-
165
- return "{$which}posttype{$post_type}{$field}{$m}:$timezone";
166
- }
167
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/class-xmlsitemapfeed-admin.php CHANGED
@@ -3,18 +3,18 @@
3
  * XMLSF Admin CLASS
4
  * ------------------------------ */
5
 
6
- if ( ! defined( 'WPINC' ) ) die;
7
-
8
- if ( class_exists('XMLSitemapFeed') ) :
9
-
10
  class XMLSitemapFeed_Admin extends XMLSitemapFeed {
11
 
12
  /**
13
  * SETTINGS
14
  */
15
 
16
- // TODO refer to support forum !
17
 
 
 
 
 
18
  public function sitemaps_settings_field() {
19
  $options = parent::get_sitemaps();
20
  $disabled = ('1' == get_option('blog_public')) ? false : true;
@@ -629,8 +629,8 @@ jQuery( document ).ready( function() {
629
 
630
  // genres tag
631
  $gn_genres = parent::gn_genres();
632
- $genres = !empty($options['genres']) ? $options['genres'] : array();
633
- $genres_default = !empty($genres['default']) ? (array)$genres['default'] : array();
634
 
635
  echo '
636
  <fieldset id="xmlsf_news_labels_genres"><legend class="screen-reader-text">&lt;genres&gt;</legend>
@@ -642,7 +642,7 @@ jQuery( document ).ready( function() {
642
  foreach ( $gn_genres as $name) {
643
  echo '
644
  <option value="'.$name.'" '.selected( in_array($name,$genres_default), true, false ).'>'.$name.'</option>';
645
- }
646
  echo '
647
  </select></label></li>
648
  </ul>
@@ -651,8 +651,8 @@ jQuery( document ).ready( function() {
651
  </fieldset>';
652
 
653
 
654
- // keywords
655
- $keywords = !empty($options['keywords']) ? $options['keywords'] : array();
656
  $keywords_from = !empty($keywords['from']) ? $keywords['from'] : '';
657
  echo '
658
  <fieldset id="xmlsf_news_keywords"><legend class="screen-reader-text">&lt;keywords&gt;</legend>
@@ -857,9 +857,8 @@ jQuery( document ).ready( function() {
857
  * META BOXES
858
  */
859
 
860
- /* Adds a XML Sitemap box to the side column */
861
- public function add_meta_box ()
862
- {
863
  foreach ( parent::get_post_types() as $post_type ) {
864
  // Only include metaboxes on post types that are included
865
  if (isset($post_type["active"]))
@@ -874,8 +873,7 @@ jQuery( document ).ready( function() {
874
  }
875
  }
876
 
877
- public function meta_box($post)
878
- {
879
  // Use nonce for verification
880
  wp_nonce_field( plugin_basename( __FILE__ ), 'xmlsf_sitemap_nonce' );
881
 
@@ -908,9 +906,8 @@ jQuery( document ).ready( function() {
908
  echo '</label></p>';
909
  }
910
 
911
- /* Adds a News Sitemap box to the side column */
912
- public function add_meta_box_news ()
913
- {
914
  $news_tags = parent::get_option('news_tags');
915
  foreach ( (array)$news_tags['post_type'] as $post_type ) {
916
  // Only include metabox on post types that are included
@@ -922,10 +919,9 @@ jQuery( document ).ready( function() {
922
  'side'
923
  );
924
  }
925
- }
926
 
927
- public function meta_box_news($post)
928
- {
929
  // Use nonce for verification
930
  wp_nonce_field( plugin_basename( __FILE__ ), 'xmlsf_sitemap_nonce' );
931
 
@@ -955,8 +951,7 @@ jQuery( document ).ready( function() {
955
  }
956
 
957
  /* When the post is saved, save our meta data */
958
- function save_metadata( $post_id )
959
- {
960
  if ( !isset($post_id) )
961
  $post_id = (int)$_REQUEST['post_ID'];
962
 
@@ -1032,8 +1027,8 @@ jQuery( document ).ready( function() {
1032
  add_settings_field($prefix.'news_categories', translate('Categories'), array($this,'news_categories_field'), 'reading', 'news_sitemap_section');
1033
  add_settings_field($prefix.'news_image', translate('Images'), array($this,'news_image_field'), 'reading', 'news_sitemap_section');
1034
  add_settings_field($prefix.'news_labels', __('Source labels','xml-sitemap-feed'), array($this,'news_labels_field'), 'reading', 'news_sitemap_section');
1035
- // post meta box
1036
- add_action( 'add_meta_boxes', array($this,'add_meta_box_news') );
1037
  }
1038
 
1039
  if ( isset($sitemaps['sitemap']) ) {
@@ -1059,10 +1054,10 @@ jQuery( document ).ready( function() {
1059
  }
1060
 
1061
  if ( isset($sitemaps['sitemap']) || isset($sitemaps['sitemap-news']) ) {
1062
- register_setting('writing', $prefix.'ping', array($this,'sanitize_ping_settings') );
1063
- add_settings_field($prefix.'ping', translate('Update Services'), array($this,'ping_settings_field'), 'writing');
1064
- // save post meta box settings
1065
- add_action( 'save_post', array($this,'save_metadata') );
1066
  }
1067
  }
1068
 
@@ -1073,5 +1068,3 @@ jQuery( document ).ready( function() {
1073
  * ---------------------- */
1074
 
1075
  $xmlsf_admin = new XMLSitemapFeed_Admin();
1076
-
1077
- endif;
3
  * XMLSF Admin CLASS
4
  * ------------------------------ */
5
 
 
 
 
 
6
  class XMLSitemapFeed_Admin extends XMLSitemapFeed {
7
 
8
  /**
9
  * SETTINGS
10
  */
11
 
12
+ // TODO refer to support forum + invite plugin rating !
13
 
14
+ /**
15
+ * Sitemaps
16
+ * settings field
17
+ */
18
  public function sitemaps_settings_field() {
19
  $options = parent::get_sitemaps();
20
  $disabled = ('1' == get_option('blog_public')) ? false : true;
629
 
630
  // genres tag
631
  $gn_genres = parent::gn_genres();
632
+ $genres = !empty($options['genres']) ? $options['genres'] : [];
633
+ $genres_default = !empty($genres['default']) ? (array)$genres['default'] : [];
634
 
635
  echo '
636
  <fieldset id="xmlsf_news_labels_genres"><legend class="screen-reader-text">&lt;genres&gt;</legend>
642
  foreach ( $gn_genres as $name) {
643
  echo '
644
  <option value="'.$name.'" '.selected( in_array($name,$genres_default), true, false ).'>'.$name.'</option>';
645
+ }
646
  echo '
647
  </select></label></li>
648
  </ul>
651
  </fieldset>';
652
 
653
 
654
+ // keywords
655
+ $keywords = !empty($options['keywords']) ? $options['keywords'] : [];
656
  $keywords_from = !empty($keywords['from']) ? $keywords['from'] : '';
657
  echo '
658
  <fieldset id="xmlsf_news_keywords"><legend class="screen-reader-text">&lt;keywords&gt;</legend>
857
  * META BOXES
858
  */
859
 
860
+ /* Adds a XML Sitemap box to the side column */
861
+ public function add_meta_box () {
 
862
  foreach ( parent::get_post_types() as $post_type ) {
863
  // Only include metaboxes on post types that are included
864
  if (isset($post_type["active"]))
873
  }
874
  }
875
 
876
+ public function meta_box($post) {
 
877
  // Use nonce for verification
878
  wp_nonce_field( plugin_basename( __FILE__ ), 'xmlsf_sitemap_nonce' );
879
 
906
  echo '</label></p>';
907
  }
908
 
909
+ /* Adds a News Sitemap box to the side column */
910
+ public function add_meta_box_news () {
 
911
  $news_tags = parent::get_option('news_tags');
912
  foreach ( (array)$news_tags['post_type'] as $post_type ) {
913
  // Only include metabox on post types that are included
919
  'side'
920
  );
921
  }
922
+ }
923
 
924
+ public function meta_box_news($post) {
 
925
  // Use nonce for verification
926
  wp_nonce_field( plugin_basename( __FILE__ ), 'xmlsf_sitemap_nonce' );
927
 
951
  }
952
 
953
  /* When the post is saved, save our meta data */
954
+ function save_metadata( $post_id ) {
 
955
  if ( !isset($post_id) )
956
  $post_id = (int)$_REQUEST['post_ID'];
957
 
1027
  add_settings_field($prefix.'news_categories', translate('Categories'), array($this,'news_categories_field'), 'reading', 'news_sitemap_section');
1028
  add_settings_field($prefix.'news_image', translate('Images'), array($this,'news_image_field'), 'reading', 'news_sitemap_section');
1029
  add_settings_field($prefix.'news_labels', __('Source labels','xml-sitemap-feed'), array($this,'news_labels_field'), 'reading', 'news_sitemap_section');
1030
+ // post meta box
1031
+ add_action( 'add_meta_boxes', array($this,'add_meta_box_news') );
1032
  }
1033
 
1034
  if ( isset($sitemaps['sitemap']) ) {
1054
  }
1055
 
1056
  if ( isset($sitemaps['sitemap']) || isset($sitemaps['sitemap-news']) ) {
1057
+ register_setting('writing', $prefix.'ping', array($this,'sanitize_ping_settings') );
1058
+ add_settings_field($prefix.'ping', translate('Update Services'), array($this,'ping_settings_field'), 'writing');
1059
+ // save post meta box settings
1060
+ add_action( 'save_post', array($this,'save_metadata') );
1061
  }
1062
  }
1063
 
1068
  * ---------------------- */
1069
 
1070
  $xmlsf_admin = new XMLSitemapFeed_Admin();
 
 
includes/class-xmlsitemapfeed.php CHANGED
@@ -6,39 +6,89 @@
6
  class XMLSitemapFeed {
7
 
8
  /**
9
- * Plugin variables
 
10
  */
11
-
12
- // Pretty permalinks base name
13
  public $base_name = 'sitemap';
14
 
15
- // Pretty permalinks extension
 
 
 
16
  public $extension = 'xml';
17
 
18
- // Database options prefix
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  private $prefix = 'xmlsf_';
20
 
21
- // Timezone and default language
22
- private $timezone = null;
 
 
23
  private $blog_language = null;
24
 
25
- // Flushed flag
 
 
 
26
  private $yes_mother = false;
27
 
 
 
 
 
28
  private $defaults = array();
29
- private $disabled_post_types = array('attachment'); /* attachment post type is disabled... images are included via tags in the post and page sitemaps */
30
- private $disabled_taxonomies = array('post_format'); /* post format taxonomy is brute force disabled for now; might come back... */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  private $gn_genres = array(
32
- 'PressRelease',
33
- 'Satire',
34
- 'Blog',
35
- 'OpEd',
36
- 'Opinion',
37
- 'UserGenerated'
38
- );
39
-
40
- // Global values used for priority and changefreq calculation
 
 
41
  private $domain;
 
 
42
  private $firstdate;
43
  private $lastmodified; // unused at the moment
44
  private $postmodified = array();
@@ -47,32 +97,85 @@ class XMLSitemapFeed {
47
  private $blogpages = null;
48
  private $images = array();
49
 
50
- // make some private parts public ;)
 
 
 
 
 
 
51
 
52
- public function prefix()
53
- {
 
 
 
 
 
 
 
 
 
 
 
54
  return $this->prefix;
55
  }
56
 
57
- public function gn_genres()
58
- {
 
 
 
59
  return $this->gn_genres;
60
  }
61
 
62
- public function domain()
63
- {
 
 
 
64
  // allowed domain
65
- if (empty($this->domain)) {
66
- $url_parsed = parse_url(home_url()); // second parameter PHP_URL_HOST for only PHP5 + ...
67
- $this->domain = str_replace("www.","",$url_parsed['host']);
68
  }
69
 
70
  return $this->domain;
71
  }
72
 
73
- // default options
74
- private function set_defaults()
75
- {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76
  // sitemaps
77
  if ( '1' == get_option('blog_public') )
78
  $this->defaults['sitemaps'] = array(
@@ -127,7 +230,7 @@ class XMLSitemapFeed {
127
  $this->defaults['ping'] = array(
128
  'google' => array (
129
  'active' => '1',
130
- 'uri' => 'http://www.google.com/webmasters/tools/ping?sitemap=',
131
  'type' => 'GET',
132
  'news' => '1'
133
  ),
@@ -155,7 +258,7 @@ class XMLSitemapFeed {
155
  );
156
 
157
  // robots
158
- $this->defaults['robots'] = "";
159
 
160
  // additional urls
161
  $this->defaults['urls'] = array();
@@ -169,7 +272,7 @@ class XMLSitemapFeed {
169
  // news sitemap tags settings
170
  $this->defaults['news_tags'] = array(
171
  'name' => '',
172
- 'post_type' => array('post'),
173
  'categories' => '',
174
  'image' => 'featured',
175
  'access' => array(
@@ -178,7 +281,7 @@ class XMLSitemapFeed {
178
  'password' => 'Subscription'
179
  ),
180
  'genres' => array(
181
- 'default' => array('Blog')
182
  ),
183
  'keywords' => array(
184
  'from' => 'category',
@@ -188,20 +291,13 @@ class XMLSitemapFeed {
188
  }
189
 
190
  /**
191
- * QUERY FUNCTIONS
192
- */
193
-
194
- protected function timezone()
195
- {
196
- $gmt = date_default_timezone_set('UTC');
197
- if ( $this->timezone === null ) {
198
- $this->timezone = $gmt ? 'gmt' : 'blog';
199
- }
200
- return $this->timezone;
201
- }
202
-
203
- protected function defaults($key = false)
204
- {
205
  if (empty($this->defaults))
206
  $this->set_defaults();
207
 
@@ -214,47 +310,75 @@ class XMLSitemapFeed {
214
  return apply_filters( 'xmlsf_defaults', $return, $key );
215
  }
216
 
217
- public function get_option($option)
218
- {
 
 
 
 
 
 
219
  return get_option($this->prefix.$option, $this->defaults($option));
220
  }
221
 
222
- public function get_sitemaps()
223
- {
 
 
 
224
  $return = $this->get_option('sitemaps');
225
 
226
  // make sure it's an array we are returning
227
  return (!empty($return)) ? (array)$return : array();
228
  }
229
 
230
- public function get_ping()
231
- {
 
 
 
232
  $return = $this->get_option('ping');
233
 
234
  // make sure it's an array we are returning
235
  return (!empty($return)) ? (array)$return : array();
236
  }
237
 
238
- protected function disabled_post_types()
239
- {
 
 
 
240
  return $this->disabled_post_types;
241
  }
242
 
243
- protected function disabled_taxonomies()
244
- {
 
 
 
245
  return $this->disabled_taxonomies;
246
  }
247
 
248
- public function get_post_types()
249
- {
 
 
 
 
 
 
 
250
  $return = $this->get_option('post_types');
251
 
252
  // make sure it's an array we are returning
253
  return (!empty($return)) ? (array)$return : array();
254
  }
255
 
256
- public function have_post_types()
257
- {
 
 
 
258
  $return = array();
259
 
260
  foreach ( $this->get_post_types() as $type => $values ) {
@@ -271,40 +395,52 @@ class XMLSitemapFeed {
271
  return (!empty($return)) ? (array)$return : array();
272
  }
273
 
274
- public function get_taxonomies()
275
- {
 
 
 
276
  $return = $this->get_option('taxonomies');
277
 
278
  // make sure it's an array we are returning
279
  return (!empty($return)) ? (array)$return : array();
280
  }
281
 
282
- public function get_custom_sitemaps()
283
- {
 
 
 
284
  $urls = $this->get_option('custom_sitemaps');
285
  // make sure it's an array we are returning
286
  if(!empty($urls)) {
287
- $return = ( !is_array($urls) ) ? explode( "\n", $urls ) : $urls;
288
  } else {
289
  $return = array();
290
  }
291
  return apply_filters( 'xmlsf_custom_sitemaps', $return );
292
  }
293
 
294
- public function get_urls()
295
- {
 
 
 
296
  $urls = $this->get_option('urls');
297
  // make sure it's an array we are returning
298
- if(!empty($urls)) {
299
- $return = ( !is_array($urls) ) ? explode( "\n", $urls ) : $urls;
300
  } else {
301
  $return = array();
302
  }
303
  return apply_filters( 'xmlsf_custom_urls', $return );
304
  }
305
 
306
- public function get_domains()
307
- {
 
 
 
308
  $domains = $this->get_option('domains');
309
  if (!empty($domains) && is_array($domains))
310
  return array_merge( array( $this->domain() ), $domains );
@@ -312,12 +448,19 @@ class XMLSitemapFeed {
312
  return array( $this->domain() );
313
  }
314
 
315
- public function get_archives($post_type = 'post', $type = '')
316
- {
 
 
 
 
 
 
 
317
  global $wpdb;
318
  $return = array();
319
  if ( 'monthly' == $type ) {
320
- $query = "SELECT YEAR(post_date) AS `year`, LPAD(MONTH(post_date),2,'0') AS `month`, count(ID) as posts FROM $wpdb->posts WHERE post_type = '$post_type' AND post_status = 'publish' GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC";
321
  $key = md5($query);
322
  $cache = wp_cache_get( 'xmlsf_get_archives' , 'general');
323
  if ( !isset( $cache[ $key ] ) ) {
@@ -333,7 +476,7 @@ class XMLSitemapFeed {
333
  }
334
  }
335
  } elseif ('yearly' == $type) {
336
- $query = "SELECT YEAR(post_date) AS `year`, count(ID) as posts FROM $wpdb->posts WHERE post_type = '$post_type' AND post_status = 'publish' GROUP BY YEAR(post_date) ORDER BY post_date DESC";
337
  $key = md5($query);
338
  $cache = wp_cache_get( 'xmlsf_get_archives' , 'general');
339
  if ( !isset( $cache[ $key ] ) ) {
@@ -354,13 +497,22 @@ class XMLSitemapFeed {
354
  return $return;
355
  }
356
 
357
- public function get_robots()
358
- {
 
 
 
359
  return ( $robots = $this->get_option('robots') ) ? $robots : '';
360
  }
361
 
362
- public function do_tags( $type = 'post' )
363
- {
 
 
 
 
 
 
364
  $return = $this->get_post_types();
365
 
366
  // make sure it's an array we are returning
@@ -371,8 +523,14 @@ class XMLSitemapFeed {
371
  ) ? (array)$return[$type]['tags'] : array();
372
  }
373
 
374
- private function get_translations( $post_id )
375
- {
 
 
 
 
 
 
376
  $translation_ids = array();
377
  // Polylang compat
378
  if ( function_exists('pll_get_post_translations') ) {
@@ -392,8 +550,11 @@ class XMLSitemapFeed {
392
  return $translation_ids;
393
  }
394
 
395
- private function get_blogpages()
396
- {
 
 
 
397
  if ( null === $this->blogpages ) :
398
  $blogpages = array();
399
  if ( 'page' == get_option('show_on_front') ) {
@@ -408,8 +569,11 @@ class XMLSitemapFeed {
408
  return $this->blogpages;
409
  }
410
 
411
- private function get_frontpages()
412
- {
 
 
 
413
  if ( null === $this->frontpages ) :
414
  $frontpages = array();
415
  if ( 'page' == get_option('show_on_front') ) {
@@ -422,8 +586,14 @@ class XMLSitemapFeed {
422
  return $this->frontpages;
423
  }
424
 
425
- private function is_home( $id )
426
- {
 
 
 
 
 
 
427
  return in_array( $id, $this->get_blogpages() );
428
  }
429
 
@@ -431,8 +601,12 @@ class XMLSitemapFeed {
431
  * TEMPLATE FUNCTIONS
432
  */
433
 
434
- public function headers( $style = '' )
435
- {
 
 
 
 
436
  // maybe output buffering is on, then just make sure we start with a clean buffer
437
  if ( ob_get_level() ) ob_clean();
438
 
@@ -460,26 +634,33 @@ class XMLSitemapFeed {
460
  break;
461
  }
462
 
463
- $output .= '<?xml version="1.0" encoding="' . get_bloginfo('charset') . '"?>'.PHP_EOL;
464
- $output .= '<?xml-stylesheet type="text/xsl" href="' . $style_sheet . '?ver=' . XMLSF_VERSION .'"?>'.PHP_EOL;
465
- $output .= '<!-- generated-on="'.date('Y-m-d\TH:i:s+00:00').'" -->'.PHP_EOL;
466
- $output .= '<!-- generator="XML & Google News Sitemap Feed plugin for WordPress" -->'.PHP_EOL;
467
- $output .= '<!-- generator-url="http://status301.net/wordpress-plugins/xml-sitemap-feed/" -->'.PHP_EOL;
468
- $output .= '<!-- generator-version="'.XMLSF_VERSION.'" -->'.PHP_EOL;
469
 
470
  // return output
471
  return $output;
472
  }
473
 
474
- public function modified( $sitemap = 'post_type', $term = '' )
475
- {
 
 
 
 
 
 
 
476
  if ('post_type' == $sitemap) :
477
 
478
  global $post;
479
 
480
  // if blog page then look for last post date
481
  if ( $post->post_type == 'page' && $this->is_home($post->ID) )
482
- return get_lastmodified('GMT','post');
483
 
484
  if ( empty($this->postmodified[$post->ID]) ) {
485
  $postmodified = get_post_modified_time( 'Y-m-d H:i:s', true, $post->ID );
@@ -531,12 +712,17 @@ class XMLSitemapFeed {
531
  return $this->termmodified[$term->term_id];
532
  } else {
533
  $obj = get_taxonomy($term);
534
- return get_lastdate( 'gmt', $obj->object_type );
535
- // uses get_lastdate() function defined in xml-sitemap/hacks.php !
536
- // which is a shortcut: returns last post date, not last modified date...
537
- // TODO find the long way home: take tax type, get all terms,
538
- // do tax_query with all terms for one post and get its lastmod date
539
- // ... or can 'terms' in tax_query be empty?
 
 
 
 
 
540
  }
541
 
542
  else :
@@ -546,53 +732,106 @@ class XMLSitemapFeed {
546
  endif;
547
  }
548
 
549
- public function get_images( $sitemap = '' )
550
- {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
551
  global $post;
552
  if ( empty($this->images[$post->ID]) ) {
553
- if ('news' == $sitemap) {
554
  $options = $this->get_option('news_tags');
555
  $which = isset($options['image']) ? $options['image'] : '';
556
  } else {
557
  $options = $this->get_post_types();
558
  $which = isset($options[$post->post_type]['tags']['image']) ? $options[$post->post_type]['tags']['image'] : '';
559
  }
560
- if('attached' == $which) {
561
  $args = array( 'post_type' => 'attachment', 'post_mime_type' => 'image', 'numberposts' => -1, 'post_status' =>'inherit', 'post_parent' => $post->ID );
562
  $attachments = get_posts($args);
563
- if ($attachments) {
564
  foreach ( $attachments as $attachment ) {
565
- $url = wp_get_attachment_image_src( $attachment->ID, 'full' );
566
- $this->images[$post->ID][] = array(
567
- 'loc' => esc_attr( esc_url_raw( $url[0] ) ), // use esc_attr() to entity escape & here ?? esc_url() creates &#038; which is not what we want...
568
- 'title' => apply_filters( 'the_title_xmlsitemap', $attachment->post_title ),
569
- 'caption' => apply_filters( 'the_title_xmlsitemap', $attachment->post_excerpt )
570
- );
 
 
 
571
  }
572
  }
573
- } elseif ('featured' == $which) {
574
- if (has_post_thumbnail( $post->ID ) ) {
575
- $attachment = get_post(get_post_thumbnail_id( $post->ID ));
576
- $url = wp_get_attachment_image_src( $attachment->ID, 'full' );
577
- $this->images[$post->ID][] = array(
578
- 'loc' => esc_attr( esc_url_raw( $url[0] ) ),
579
- 'title' => apply_filters( 'the_title_xmlsitemap', $attachment->post_title ),
580
- 'caption' => apply_filters( 'the_title_xmlsitemap', $attachment->post_excerpt )
581
- );
 
 
 
582
  }
583
  }
584
  }
585
  return ( isset($this->images[$post->ID]) ) ? $this->images[$post->ID] : false;
586
  }
587
 
588
- public function get_lastmod( $sitemap = 'post_type', $term = '' )
589
- {
590
- $return = trim(mysql2date('Y-m-d\TH:i:s+00:00', $this->modified($sitemap,$term), false));
591
- return !empty($return) ? "\t<lastmod>".$return."</lastmod>\r\n\t" : '';
 
 
 
 
 
 
 
 
592
  }
593
 
594
- public function get_changefreq( $sitemap = 'post_type', $term = '' )
595
- {
 
 
 
 
 
 
 
596
  $modified = trim($this->modified($sitemap,$term));
597
 
598
  if (empty($modified))
@@ -615,8 +854,15 @@ class XMLSitemapFeed {
615
  return $changefreq;
616
  }
617
 
618
- public function get_priority( $sitemap = 'post_type', $term = '' )
619
- {
 
 
 
 
 
 
 
620
  if ( 'post_type' == $sitemap ) :
621
  global $post;
622
  $options = $this->get_post_types();
@@ -625,23 +871,22 @@ class XMLSitemapFeed {
625
 
626
  if ( !empty($priority_meta) || $priority_meta == '0' ) {
627
 
628
- $priority = floatval(str_replace(",",".",$priority_meta));
629
 
630
  } elseif ( !empty($options[$post->post_type]['dynamic_priority']) ) {
631
 
632
  $post_modified = mysql2date('U',$post->post_modified_gmt, false);
633
 
634
  if ( empty($this->lastmodified) )
635
- $this->lastmodified = mysql2date('U',get_lastmodified('GMT',$post->post_type),false);
636
  // last posts or page modified date in Unix seconds
637
- // uses get_lastmodified() function defined in xml-sitemap/hacks.php !
638
 
639
  if ( empty($this->firstdate) )
640
- $this->firstdate = mysql2date('U',get_firstdate('GMT',$post->post_type),false);
641
- // uses get_firstdate() function defined in xml-sitemap/hacks.php !
642
 
643
  if ( isset($options[$post->post_type]['priority']) )
644
- $priority_value = floatval(str_replace(",",".",$options[$post->post_type]['priority']));
645
  else
646
  $priority_value = floatval($defaults[$post->post_type]['priority']);
647
 
@@ -693,8 +938,11 @@ class XMLSitemapFeed {
693
  return number_format($priority,1);
694
  }
695
 
696
- public function get_home_urls()
697
- {
 
 
 
698
  $urls = array();
699
 
700
  global $sitepress; // Polylang and WPML compat
@@ -704,19 +952,25 @@ class XMLSitemapFeed {
704
  foreach ( $languages as $language )
705
  $urls[] = pll_home_url( $language['slug'] );
706
  else
707
- $urls[] = home_url();
708
  } elseif ( isset($sitepress) && is_object($sitepress) && method_exists($sitepress, 'get_languages') && method_exists($sitepress, 'language_url') ) {
709
  foreach ( array_keys ( $sitepress->get_languages(false,true) ) as $term )
710
  $urls[] = $sitepress->language_url($term);
711
  } else {
712
- $urls[] = home_url();
713
  }
714
 
715
  return $urls;
716
  }
717
 
718
- public function is_excluded( $post_id = null )
719
- {
 
 
 
 
 
 
720
  // no ID, try and get it from global post object
721
  if ( null == $post_id ) {
722
  global $post;
@@ -731,15 +985,21 @@ class XMLSitemapFeed {
731
  return apply_filters( 'xmlsf_excluded', $excluded, $post_id );
732
  }
733
 
734
- public function is_allowed_domain( $url )
735
- {
 
 
 
 
 
 
736
  $domains = $this->get_domains();
737
  $return = false;
738
  $parsed_url = parse_url($url);
739
 
740
  if (isset($parsed_url['host'])) {
741
  foreach( $domains as $domain ) {
742
- if( $parsed_url['host'] == $domain || strpos($parsed_url['host'],".".$domain) !== false ) {
743
  $return = true;
744
  break;
745
  }
@@ -749,9 +1009,17 @@ class XMLSitemapFeed {
749
  return apply_filters( 'xmlsf_allowed_domain', $return, $url );
750
  }
751
 
752
- public function get_index_url( $sitemap = 'home', $type = false, $param = false )
753
- {
754
- $split_url = explode('?', home_url());
 
 
 
 
 
 
 
 
755
 
756
  $name = $this->base_name.'-'.$sitemap;
757
 
@@ -771,8 +1039,14 @@ class XMLSitemapFeed {
771
  return esc_url( trailingslashit($split_url[0]) . $name );
772
  }
773
 
774
- public function get_language( $id )
775
- {
 
 
 
 
 
 
776
  $language = null;
777
 
778
  if ( empty($this->blog_language) ) {
@@ -814,24 +1088,29 @@ class XMLSitemapFeed {
814
  // add sitemap location in robots.txt generated by WP
815
  public function robots($output)
816
  {
817
- echo "\n# XML Sitemap & Google News Feeds version ".XMLSF_VERSION." - http://status301.net/wordpress-plugins/xml-sitemap-feed/";
818
 
819
  if ( '1' != get_option('blog_public') ) {
820
- echo "\n# XML Sitemaps are disabled. Please see Site Visibility on Settings > Reading.";
821
  } else {
822
  foreach ( $this->get_sitemaps() as $pretty )
823
- echo "\nSitemap: " . trailingslashit(get_bloginfo('url')) . $pretty;
824
 
825
  if ( empty($pretty) )
826
- echo "\n# No XML Sitemaps are enabled. Please see XML Sitemaps on Settings > Reading.";
827
  }
828
- echo "\n\n";
829
  }
830
 
831
- // add robots.txt rules
832
- public function robots_txt($output)
833
- {
834
- return $output . $this->get_option('robots') . "\n\n";
 
 
 
 
 
835
  }
836
 
837
  /**
@@ -843,9 +1122,10 @@ class XMLSitemapFeed {
843
  * such as /sitemap.xml (thanks to Permalink Editor plugin for WordPress)
844
  *
845
  * @param string $request
 
 
846
  */
847
- public function trailingslash($request)
848
- {
849
  if (pathinfo($request, PATHINFO_EXTENSION)) {
850
  return untrailingslashit($request);
851
  }
@@ -856,9 +1136,10 @@ class XMLSitemapFeed {
856
  * Add sitemap rewrite rules
857
  *
858
  * @param string $wp_rewrite
 
 
859
  */
860
- public function rewrite_rules($wp_rewrite)
861
- {
862
  $xmlsf_rules = array();
863
  $sitemaps = $this->get_sitemaps();
864
 
@@ -889,23 +1170,26 @@ class XMLSitemapFeed {
889
  $wp_rewrite->rules = $xmlsf_rules + $wp_rewrite->rules;
890
  }
891
 
 
 
 
 
892
  public function wpml_language_switcher() {
893
- // WPML: switch language
894
- // @see https://wpml.org/wpml-hook/wpml_post_language_details/
895
  global $sitepress,$post;
896
  if( isset($sitepress) ) {
897
  $post_language = apply_filters( 'wpml_post_language_details', NULL, $post->ID );
898
  $sitepress->switch_lang($post_language['language_code']);
899
  }
900
-
901
  }
902
 
903
  /**
904
- * REQUEST FILTER
905
- */
906
-
907
- public function filter_request( $request )
908
- {
 
 
909
  if ( isset($request['feed']) && strpos($request['feed'],'sitemap') === 0 ) :
910
  // modify request parameters
911
  $request['post_status'] = 'publish';
@@ -924,6 +1208,7 @@ class XMLSitemapFeed {
924
  add_action( 'the_post', array( $this, 'wpml_language_switcher' ) );
925
  }
926
 
 
927
  if ( $request['feed'] == 'sitemap-news' ) {
928
  $defaults = $this->defaults('news_tags');
929
  $options = $this->get_option('news_tags');
@@ -935,8 +1220,7 @@ class XMLSitemapFeed {
935
  define('DONOTCACHEDB', true);
936
 
937
  // set up query filters
938
- $zone = $this->timezone();
939
- if ( get_lastdate($zone, $news_post_type) > date('Y-m-d H:i:s', strtotime('-48 hours')) ) {
940
  add_filter('post_limits', array($this, 'filter_news_limits'));
941
  add_filter('posts_where', array($this, 'filter_news_where'), 10, 1);
942
  } else {
@@ -950,9 +1234,16 @@ class XMLSitemapFeed {
950
  if ( isset($options['categories']) && is_array($options['categories']) )
951
  $request['cat'] = implode(',',$options['categories']);
952
 
 
 
 
953
  return $request;
954
  }
955
 
 
 
 
 
956
  if ( strpos($request['feed'],'sitemap-posttype') === 0 ) {
957
  foreach ( $this->get_post_types() as $post_type ) {
958
  if ( $request['feed'] == 'sitemap-posttype-'.$post_type['name'] ) {
@@ -961,12 +1252,14 @@ class XMLSitemapFeed {
961
 
962
  $request['post_type'] = $post_type['name'];
963
  $request['orderby'] = 'modified';
 
964
 
965
  return $request;
966
  }
967
  }
968
  }
969
 
 
970
  if ( strpos($request['feed'],'sitemap-taxonomy') === 0 ) {
971
  foreach ( $this->get_taxonomies() as $taxonomy ) {
972
  if ( $request['feed'] == 'sitemap-taxonomy-'.$taxonomy ) {
@@ -995,39 +1288,45 @@ class XMLSitemapFeed {
995
  * FEED TEMPLATES
996
  */
997
 
998
- // set up the sitemap index template
999
- public function load_template_index()
1000
- {
 
1001
  load_template( dirname( __FILE__ ) . '/feed-sitemap.php' );
1002
  }
1003
 
1004
- // set up the sitemap home page(s) template
1005
- public function load_template_base()
1006
- {
 
1007
  load_template( dirname( __FILE__ ) . '/feed-sitemap-home.php' );
1008
  }
1009
 
1010
- // set up the post types sitemap template
1011
- public function load_template()
1012
- {
 
1013
  load_template( dirname( __FILE__ ) . '/feed-sitemap-post_type.php' );
1014
  }
1015
 
1016
- // set up the taxonomy sitemap template
1017
- public function load_template_taxonomy()
1018
- {
 
1019
  load_template( dirname( __FILE__ ) . '/feed-sitemap-taxonomy.php' );
1020
  }
1021
 
1022
- // set up the news sitemap template
1023
- public function load_template_news()
1024
- {
 
1025
  load_template( dirname( __FILE__ ) . '/feed-sitemap-news.php' );
1026
  }
1027
 
1028
- // set up the custom sitemap template
1029
- public function load_template_custom()
1030
- {
 
1031
  load_template( dirname( __FILE__ ) . '/feed-sitemap-custom.php' );
1032
  }
1033
 
@@ -1035,26 +1334,41 @@ class XMLSitemapFeed {
1035
  * LIMITS
1036
  */
1037
 
1038
- // override default feed limit
1039
- public function filter_limits( $limit )
1040
- {
 
 
 
1041
  return 'LIMIT 0, 50000';
1042
  }
1043
 
1044
- // only posts from the last 48 hours
1045
- public function filter_news_where( $where = '' )
1046
- {
1047
- $_gmt = ( 'gmt' === $this->timezone() ) ? '_gmt' : '';
1048
- return $where . " AND post_date" . $_gmt . " > '" . date('Y-m-d H:i:s', strtotime('-48 hours')) . "'";
 
 
 
 
 
1049
  }
1050
 
1051
- // override default feed limit for GN
1052
- public function filter_news_limits( $limits )
1053
- {
 
 
 
1054
  return 'LIMIT 0, 1000';
1055
  }
1056
 
1057
- // in case there is no news, just take the latest post
 
 
 
 
1058
  public function filter_no_news_limits( $limits )
1059
  {
1060
  return 'LIMIT 0, 1';
@@ -1064,8 +1378,15 @@ class XMLSitemapFeed {
1064
  * PINGING
1065
  */
1066
 
1067
- public function ping($uri, $timeout = 3)
1068
- {
 
 
 
 
 
 
 
1069
  $options = array();
1070
  $options['timeout'] = $timeout;
1071
 
@@ -1079,8 +1400,14 @@ class XMLSitemapFeed {
1079
  return $succes;
1080
  }
1081
 
1082
- public function do_pings($new_status, $old_status, $post)
1083
- {
 
 
 
 
 
 
1084
  $sitemaps = $this->get_sitemaps();
1085
  $to_ping = $this->get_ping();
1086
  $update = false;
@@ -1146,8 +1473,10 @@ class XMLSitemapFeed {
1146
  * CLEARING & PURGING
1147
  */
1148
 
1149
- public function clear_settings()
1150
- {
 
 
1151
  delete_option('xmlsf_version');
1152
  foreach ( $this->defaults() as $option => $settings ) {
1153
  delete_option('xmlsf_'.$option);
@@ -1158,39 +1487,46 @@ class XMLSitemapFeed {
1158
  }
1159
  }
1160
 
1161
- function cache_flush( $new_status, $old_status, $post )
1162
- {
 
 
 
 
 
1163
  // are we moving the post in or out of published status?
1164
- if ( $new_status == 'publish' || $old_status == 'publish' ) {
1165
- // Use cache_delete to remove single key instead of complete cache_flush. Thanks Jeremy Clarke!
1166
- wp_cache_delete('xmlsf_get_archives', 'general');
1167
 
1168
- // we cannot delete by cache-group 'timeinfo', therefore we have to re-calculate the cache-key
1169
- wp_cache_delete($this->get_time_key($post), 'timeinfo');
1170
- }
1171
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1172
 
1173
  /**
1174
- * This method mimics triggers the cache-key calculation used within _get_time().
1175
- * The passed parameters mimic the behavior of get_lastmodified.
1176
  *
1177
- * Contributed by https://github.com/shaula https://wordpress.org/support/users/e2robert/
 
1178
  *
1179
- * @param \WP_Post $post
1180
- * @return string
1181
  */
1182
- private function get_time_key($post)
1183
- {
1184
- $timezone = 'gmt';
1185
- $which = 'last';
1186
- $field = 'modified';
1187
- $m = 0;
1188
-
1189
- return _get_time_key($timezone, $field, $post->post_type, $which, $m);
1190
- }
1191
-
1192
- public function nginx_helper_purge_urls( $urls = array(), $redis = false )
1193
- {
1194
  // are permalinks set, blog public and $urls an array?
1195
  if ( '' == get_option('permalink_structure') || '1' != get_option('blog_public') || ! is_array( $urls ) )
1196
  return $urls;
@@ -1247,8 +1583,10 @@ class XMLSitemapFeed {
1247
  * INITIALISATION
1248
  */
1249
 
1250
- public function upgrade( $old_version )
1251
- {
 
 
1252
  // rewrite rules not available on plugins_loaded
1253
  // and don't flush rules from init as Polylang chokes on that
1254
  // just remove the db option and let WP regenerate them when ready...
@@ -1258,7 +1596,7 @@ class XMLSitemapFeed {
1258
 
1259
  // remove robots.txt rule blocking stylesheets, but only one time!
1260
  if ( version_compare('4.4', $old_version, '>') && $robot_rules = get_option($this->prefix.'robots')) {
1261
- $robot_rules = str_replace(array("Disallow: */wp-content/","Allow: */wp-content/uploads/"),"",$robot_rules);
1262
  delete_option($this->prefix.'robots');
1263
  add_option($this->prefix.'robots', $robot_rules, '', 'no');
1264
  }
@@ -1317,16 +1655,20 @@ class XMLSitemapFeed {
1317
  }
1318
  }
1319
 
1320
- public function plugins_loaded()
1321
- {
 
 
1322
  // TEXT DOMAIN
1323
  if ( is_admin() ) { // text domain needed on admin only
1324
- load_plugin_textdomain('xml-sitemap-feed', false, dirname( dirname( __FILE__ ) ) . '/languages' );
1325
  }
1326
  }
1327
 
1328
- public function activate()
1329
- {
 
 
1330
  // flush permalink structure
1331
  $this->flush_rules();
1332
 
@@ -1343,8 +1685,10 @@ class XMLSitemapFeed {
1343
  }
1344
  }
1345
 
1346
- public function init()
1347
- {
 
 
1348
  // UPGRADE
1349
  $version = get_option('xmlsf_version', 0);
1350
 
@@ -1383,8 +1727,10 @@ class XMLSitemapFeed {
1383
  }
1384
  }
1385
 
1386
- public function admin_init()
1387
- {
 
 
1388
  // CATCH TRANSIENT for reset
1389
  if (delete_transient('xmlsf_clear_settings'))
1390
  $this->clear_settings();
@@ -1397,14 +1743,18 @@ class XMLSitemapFeed {
1397
  include_once( dirname( __FILE__ ) . '/class-xmlsitemapfeed-admin.php' );
1398
  }
1399
 
1400
- public function flush_rules( $hard = false )
1401
- {
 
 
 
 
1402
  // did you flush already?
1403
  if ($this->yes_mother)
1404
  return; // yes, mother!
1405
 
1406
  global $wp_rewrite;
1407
- // don't need hard flush by default
1408
  $wp_rewrite->flush_rules($hard);
1409
 
1410
  if ( defined('WP_DEBUG') && WP_DEBUG )
@@ -1413,8 +1763,10 @@ class XMLSitemapFeed {
1413
  $this->yes_mother = true;
1414
  }
1415
 
1416
- public function register_gn_taxonomies()
1417
- {
 
 
1418
  $defaults = $this->defaults('news_tags');
1419
  $options = $this->get_option('news_tags');
1420
 
@@ -1441,7 +1793,10 @@ class XMLSitemapFeed {
1441
  ));
1442
  }
1443
 
1444
- // for debugging
 
 
 
1445
  public function _e_usage()
1446
  {
1447
  if (defined('WP_DEBUG') && WP_DEBUG == true) {
@@ -1482,13 +1837,13 @@ class XMLSitemapFeed {
1482
 
1483
  // ROBOTSTXT
1484
  add_action('do_robotstxt', array($this, 'robots'), 0 );
1485
- add_filter('robots_txt', array($this, 'robots_txt'), 0 );
1486
 
1487
  // PINGING
1488
  add_action('transition_post_status', array($this, 'do_pings'), 10, 3);
1489
 
1490
- // CLEAR OBJECT CACHE
1491
- add_action('transition_post_status', array($this, 'cache_flush'), 99, 3);
1492
 
1493
  // NGINX HELPER PURGE URLS
1494
  add_filter('rt_nginx_helper_purge_urls', array($this, 'nginx_helper_purge_urls'), 10, 2);
6
  class XMLSitemapFeed {
7
 
8
  /**
9
+ * Pretty permalinks base name
10
+ * @var string
11
  */
 
 
12
  public $base_name = 'sitemap';
13
 
14
+ /**
15
+ * Pretty permalinks extension
16
+ * @var string
17
+ */
18
  public $extension = 'xml';
19
 
20
+ /**
21
+ * Signifies whether the current query is for a sitemap feed.
22
+ * @var bool
23
+ */
24
+ public $is_sitemap = false;
25
+
26
+ /**
27
+ * Signifies whether the current query is for a news feed.
28
+ * @var bool
29
+ */
30
+ public $is_news = false;
31
+
32
+ /**
33
+ * Database options prefix
34
+ * @var string
35
+ */
36
  private $prefix = 'xmlsf_';
37
 
38
+ /**
39
+ * Default language
40
+ * @var null $blog_language
41
+ */
42
  private $blog_language = null;
43
 
44
+ /**
45
+ * Flushed flag
46
+ * @var bool
47
+ */
48
  private $yes_mother = false;
49
 
50
+ /**
51
+ * Defaults
52
+ * @var array
53
+ */
54
  private $defaults = array();
55
+
56
+ /**
57
+ * Excluded post types
58
+ *
59
+ * attachment post type is disabled
60
+ * images are included via tags in the post and page sitemaps
61
+ * @var array
62
+ */
63
+ private $disabled_post_types = array('attachment');
64
+
65
+ /**
66
+ * Excluded taxonomies
67
+ *
68
+ * post format taxonomy is disabled
69
+ * @var array
70
+ */
71
+ private $disabled_taxonomies = array('post_format');
72
+
73
+ /**
74
+ * Google News genres
75
+ * @var array
76
+ */
77
  private $gn_genres = array(
78
+ 'PressRelease',
79
+ 'Satire',
80
+ 'Blog',
81
+ 'OpEd',
82
+ 'Opinion',
83
+ 'UserGenerated'
84
+ );
85
+
86
+ /**
87
+ * Global values used for allowed urls, priority and changefreq calculation
88
+ */
89
  private $domain;
90
+ private $scheme;
91
+ private $home_url;
92
  private $firstdate;
93
  private $lastmodified; // unused at the moment
94
  private $postmodified = array();
97
  private $blogpages = null;
98
  private $images = array();
99
 
100
+ /**
101
+ * Get sitemap feed conditional
102
+ * @return bool
103
+ */
104
+ public function is_sitemap() {
105
+ return (bool) $this->is_sitemap;
106
+ }
107
 
108
+ /**
109
+ * Get news feed conditional
110
+ * @return bool
111
+ */
112
+ public function is_news() {
113
+ return (bool) $this->is_news;
114
+ }
115
+
116
+ /**
117
+ * Get prefix
118
+ * @return string
119
+ */
120
+ public function prefix() {
121
  return $this->prefix;
122
  }
123
 
124
+ /**
125
+ * Get gn_genres
126
+ * @return array
127
+ */
128
+ public function gn_genres() {
129
  return $this->gn_genres;
130
  }
131
 
132
+ /**
133
+ * Get domain
134
+ * @return string
135
+ */
136
+ public function domain() {
137
  // allowed domain
138
+ if ( empty($this->domain) ) {
139
+ $host = parse_url( $this->home_url(), PHP_URL_HOST );
140
+ $this->domain = str_replace( 'www.', '', $host );
141
  }
142
 
143
  return $this->domain;
144
  }
145
 
146
+ /**
147
+ * Get scheme
148
+ * @return string
149
+ */
150
+ public function scheme() {
151
+ // scheme to use
152
+ if ( empty($this->scheme) ) {
153
+ $scheme = parse_url( $this->home_url(), PHP_URL_SCHEME );
154
+ $this->scheme = $scheme ? $scheme : 'http';
155
+ }
156
+
157
+ return $this->scheme;
158
+ }
159
+
160
+ /**
161
+ * Get home URL
162
+ * @return string
163
+ */
164
+ public function home_url() {
165
+ // home url
166
+ if ( empty($this->home_url) ) {
167
+ $this->home_url = home_url();
168
+ }
169
+
170
+ return $this->home_url;
171
+ }
172
+
173
+ /**
174
+ * Set default options
175
+ *
176
+ * @return void
177
+ */
178
+ private function set_defaults() {
179
  // sitemaps
180
  if ( '1' == get_option('blog_public') )
181
  $this->defaults['sitemaps'] = array(
230
  $this->defaults['ping'] = array(
231
  'google' => array (
232
  'active' => '1',
233
+ 'uri' => 'http://www.google.com/ping?sitemap=',
234
  'type' => 'GET',
235
  'news' => '1'
236
  ),
258
  );
259
 
260
  // robots
261
+ $this->defaults['robots'] = '';
262
 
263
  // additional urls
264
  $this->defaults['urls'] = array();
272
  // news sitemap tags settings
273
  $this->defaults['news_tags'] = array(
274
  'name' => '',
275
+ 'post_type' => ['post'],
276
  'categories' => '',
277
  'image' => 'featured',
278
  'access' => array(
281
  'password' => 'Subscription'
282
  ),
283
  'genres' => array(
284
+ 'default' => ''
285
  ),
286
  'keywords' => array(
287
  'from' => 'category',
291
  }
292
 
293
  /**
294
+ * Get defaults
295
+ *
296
+ * @param bool|false $key
297
+ *
298
+ * @return array
299
+ */
300
+ protected function defaults($key = false) {
 
 
 
 
 
 
 
301
  if (empty($this->defaults))
302
  $this->set_defaults();
303
 
310
  return apply_filters( 'xmlsf_defaults', $return, $key );
311
  }
312
 
313
+ /**
314
+ * Get option
315
+ *
316
+ * @param $option
317
+ *
318
+ * @return array
319
+ */
320
+ public function get_option($option) {
321
  return get_option($this->prefix.$option, $this->defaults($option));
322
  }
323
 
324
+ /**
325
+ * Get sitemaps
326
+ * @return array
327
+ */
328
+ public function get_sitemaps() {
329
  $return = $this->get_option('sitemaps');
330
 
331
  // make sure it's an array we are returning
332
  return (!empty($return)) ? (array)$return : array();
333
  }
334
 
335
+ /**
336
+ * Get ping
337
+ * @return array
338
+ */
339
+ public function get_ping() {
340
  $return = $this->get_option('ping');
341
 
342
  // make sure it's an array we are returning
343
  return (!empty($return)) ? (array)$return : array();
344
  }
345
 
346
+ /**
347
+ * Get disabled post types
348
+ * @return array
349
+ */
350
+ protected function disabled_post_types() {
351
  return $this->disabled_post_types;
352
  }
353
 
354
+ /**
355
+ * Get disabled taxonomies
356
+ * @return array
357
+ */
358
+ protected function disabled_taxonomies() {
359
  return $this->disabled_taxonomies;
360
  }
361
 
362
+ /**
363
+ * QUERY FUNCTIONS
364
+ */
365
+
366
+ /**
367
+ * Get post types
368
+ * @return array
369
+ */
370
+ public function get_post_types() {
371
  $return = $this->get_option('post_types');
372
 
373
  // make sure it's an array we are returning
374
  return (!empty($return)) ? (array)$return : array();
375
  }
376
 
377
+ /**
378
+ * Have post types
379
+ * @return array
380
+ */
381
+ public function have_post_types() {
382
  $return = array();
383
 
384
  foreach ( $this->get_post_types() as $type => $values ) {
395
  return (!empty($return)) ? (array)$return : array();
396
  }
397
 
398
+ /**
399
+ * Get taxonomies
400
+ * @return array
401
+ */
402
+ public function get_taxonomies() {
403
  $return = $this->get_option('taxonomies');
404
 
405
  // make sure it's an array we are returning
406
  return (!empty($return)) ? (array)$return : array();
407
  }
408
 
409
+ /**
410
+ * Get custom sitemaps
411
+ * @return array
412
+ */
413
+ public function get_custom_sitemaps() {
414
  $urls = $this->get_option('custom_sitemaps');
415
  // make sure it's an array we are returning
416
  if(!empty($urls)) {
417
+ $return = ( !is_array($urls) ) ? explode( PHP_EOL, $urls ) : $urls;
418
  } else {
419
  $return = array();
420
  }
421
  return apply_filters( 'xmlsf_custom_sitemaps', $return );
422
  }
423
 
424
+ /**
425
+ * Get urls
426
+ * @return array
427
+ */
428
+ public function get_urls() {
429
  $urls = $this->get_option('urls');
430
  // make sure it's an array we are returning
431
+ if( !empty($urls) ) {
432
+ $return = ( !is_array($urls) ) ? explode( PHP_EOL, $urls ) : $urls;
433
  } else {
434
  $return = array();
435
  }
436
  return apply_filters( 'xmlsf_custom_urls', $return );
437
  }
438
 
439
+ /**
440
+ * Get domains
441
+ * @return array
442
+ */
443
+ public function get_domains() {
444
  $domains = $this->get_option('domains');
445
  if (!empty($domains) && is_array($domains))
446
  return array_merge( array( $this->domain() ), $domains );
448
  return array( $this->domain() );
449
  }
450
 
451
+ /**
452
+ * Get archives
453
+ *
454
+ * @param string $post_type
455
+ * @param string $type
456
+ *
457
+ * @return array
458
+ */
459
+ public function get_archives($post_type = 'post', $type = '') {
460
  global $wpdb;
461
  $return = array();
462
  if ( 'monthly' == $type ) {
463
+ $query = 'SELECT YEAR(post_date) AS `year`, LPAD(MONTH(post_date),2,\'0\') AS `month`, count(ID) as posts FROM ' . $wpdb->posts . ' WHERE post_type = \'' . $post_type . '\' AND post_status = \'publish\' GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC';
464
  $key = md5($query);
465
  $cache = wp_cache_get( 'xmlsf_get_archives' , 'general');
466
  if ( !isset( $cache[ $key ] ) ) {
476
  }
477
  }
478
  } elseif ('yearly' == $type) {
479
+ $query = 'SELECT YEAR(post_date) AS `year`, count(ID) as posts FROM ' . $wpdb->posts . ' WHERE post_type = \'' . $post_type . '\' AND post_status = \'publish\' GROUP BY YEAR(post_date) ORDER BY post_date DESC';
480
  $key = md5($query);
481
  $cache = wp_cache_get( 'xmlsf_get_archives' , 'general');
482
  if ( !isset( $cache[ $key ] ) ) {
497
  return $return;
498
  }
499
 
500
+ /**
501
+ * Get robots
502
+ * @return string
503
+ */
504
+ public function get_robots() {
505
  return ( $robots = $this->get_option('robots') ) ? $robots : '';
506
  }
507
 
508
+ /**
509
+ * Do tags
510
+ *
511
+ * @param string $type
512
+ *
513
+ * @return array
514
+ */
515
+ public function do_tags( $type = 'post' ) {
516
  $return = $this->get_post_types();
517
 
518
  // make sure it's an array we are returning
523
  ) ? (array)$return[$type]['tags'] : array();
524
  }
525
 
526
+ /**
527
+ * Get translations
528
+ *
529
+ * @param $post_id
530
+ *
531
+ * @return array
532
+ */
533
+ private function get_translations( $post_id ) {
534
  $translation_ids = array();
535
  // Polylang compat
536
  if ( function_exists('pll_get_post_translations') ) {
550
  return $translation_ids;
551
  }
552
 
553
+ /**
554
+ * Get blog_pages
555
+ * @return array
556
+ */
557
+ private function get_blogpages() {
558
  if ( null === $this->blogpages ) :
559
  $blogpages = array();
560
  if ( 'page' == get_option('show_on_front') ) {
569
  return $this->blogpages;
570
  }
571
 
572
+ /**
573
+ * Get front pages
574
+ * @return array
575
+ */
576
+ private function get_frontpages() {
577
  if ( null === $this->frontpages ) :
578
  $frontpages = array();
579
  if ( 'page' == get_option('show_on_front') ) {
586
  return $this->frontpages;
587
  }
588
 
589
+ /**
590
+ * Is home?
591
+ *
592
+ * @param $id
593
+ *
594
+ * @return bool
595
+ */
596
+ private function is_home( $id ) {
597
  return in_array( $id, $this->get_blogpages() );
598
  }
599
 
601
  * TEMPLATE FUNCTIONS
602
  */
603
 
604
+ /**
605
+ * Template headers
606
+ *
607
+ * @return string
608
+ */
609
+ public function headers( $style = '' ) {
610
  // maybe output buffering is on, then just make sure we start with a clean buffer
611
  if ( ob_get_level() ) ob_clean();
612
 
634
  break;
635
  }
636
 
637
+ $output .= '<?xml version="1.0" encoding="' . get_bloginfo('charset') . '"?>' . PHP_EOL;
638
+ $output .= '<?xml-stylesheet type="text/xsl" href="' . $style_sheet . '?ver=' . XMLSF_VERSION .'"?>' . PHP_EOL;
639
+ $output .= '<!-- generated-on="' . date('Y-m-d\TH:i:s+00:00') . '" -->' . PHP_EOL;
640
+ $output .= '<!-- generator="XML & Google News Sitemap Feed plugin for WordPress" -->' . PHP_EOL;
641
+ $output .= '<!-- generator-url="http://status301.net/wordpress-plugins/xml-sitemap-feed/" -->' . PHP_EOL;
642
+ $output .= '<!-- generator-version="' . XMLSF_VERSION . '" -->' . PHP_EOL;
643
 
644
  // return output
645
  return $output;
646
  }
647
 
648
+ /**
649
+ * Modified
650
+ *
651
+ * @param string $sitemap
652
+ * @param string $term
653
+ *
654
+ * @return string
655
+ */
656
+ public function modified( $sitemap = 'post_type', $term = '' ) {
657
  if ('post_type' == $sitemap) :
658
 
659
  global $post;
660
 
661
  // if blog page then look for last post date
662
  if ( $post->post_type == 'page' && $this->is_home($post->ID) )
663
+ return get_lastpostmodified('gmt'); // TODO limit to sitemap included post types...
664
 
665
  if ( empty($this->postmodified[$post->ID]) ) {
666
  $postmodified = get_post_modified_time( 'Y-m-d H:i:s', true, $post->ID );
712
  return $this->termmodified[$term->term_id];
713
  } else {
714
  $obj = get_taxonomy($term);
715
+
716
+ $lastmodified = array();
717
+ foreach ( (array)$obj->object_type as $object_type ) {
718
+ $lastmodified[] = get_lastpostdate( 'gmt', $object_type );
719
+ // returns last post date, not last modified date... (TODO consider making this an opion)
720
+ }
721
+
722
+ sort($lastmodified);
723
+ $lastmodified = array_filter($lastmodified);
724
+
725
+ return end($lastmodified);
726
  }
727
 
728
  else :
732
  endif;
733
  }
734
 
735
+ /**
736
+ * Get absolute URL
737
+ * Converts path or protocol relative URLs to absolute ones.
738
+ *
739
+ * @param string $url
740
+ *
741
+ * @return string|bool
742
+ */
743
+ public function get_absolute_url( $url = false ) {
744
+ // have a string or return false
745
+ if ( empty( $url ) || ! is_string( $url ) ) {
746
+ return false;
747
+ }
748
+
749
+ // check for scheme
750
+ if ( strpos( $url, 'http' ) !== 0 ) {
751
+ // check for relative url path
752
+ if ( strpos( $url, '//' ) !== 0 ) {
753
+ return $this->home_url() . $url;
754
+ }
755
+ return $this->scheme() . ':' . $url;
756
+ }
757
+
758
+ return $url;
759
+ }
760
+
761
+ /**
762
+ * Get images
763
+ *
764
+ * @param string $sitemap
765
+ *
766
+ * @return array|bool
767
+ */
768
+ public function get_images( $sitemap = '' ) {
769
  global $post;
770
  if ( empty($this->images[$post->ID]) ) {
771
+ if ( 'news' == $sitemap ) {
772
  $options = $this->get_option('news_tags');
773
  $which = isset($options['image']) ? $options['image'] : '';
774
  } else {
775
  $options = $this->get_post_types();
776
  $which = isset($options[$post->post_type]['tags']['image']) ? $options[$post->post_type]['tags']['image'] : '';
777
  }
778
+ if ( 'attached' == $which ) {
779
  $args = array( 'post_type' => 'attachment', 'post_mime_type' => 'image', 'numberposts' => -1, 'post_status' =>'inherit', 'post_parent' => $post->ID );
780
  $attachments = get_posts($args);
781
+ if ( $attachments ) {
782
  foreach ( $attachments as $attachment ) {
783
+ $url = wp_get_attachment_image_url( $attachment->ID, 'full' );
784
+ $url = $this->get_absolute_url( $url );
785
+ if ( !empty($url) )
786
+ $this->images[$post->ID][] = array(
787
+ 'loc' => esc_attr( esc_url_raw( $url ) ),
788
+ 'title' => apply_filters( 'the_title_xmlsitemap', $attachment->post_title ),
789
+ 'caption' => apply_filters( 'the_title_xmlsitemap', $attachment->post_excerpt )
790
+ // 'caption' => apply_filters( 'the_title_xmlsitemap', get_post_meta( $attachment->ID, '_wp_attachment_image_alt', true ) )
791
+ );
792
  }
793
  }
794
+ } elseif ( 'featured' == $which ) {
795
+ if ( has_post_thumbnail( $post->ID ) ) {
796
+ //$attachment = get_post( get_post_thumbnail_id( $post->ID ) );
797
+ $url = wp_get_attachment_image_url( get_post_thumbnail_id( $post->ID ), 'full' );
798
+ $url = $this->get_absolute_url( $url );
799
+ if ( !empty($url) )
800
+ $this->images[$post->ID][] = array(
801
+ 'loc' => esc_attr( esc_url_raw( $url ) ),
802
+ 'title' => apply_filters( 'the_title_xmlsitemap', $attachment->post_title ),
803
+ 'caption' => apply_filters( 'the_title_xmlsitemap', $attachment->post_excerpt )
804
+ // 'caption' => apply_filters( 'the_title_xmlsitemap', get_post_meta( $attachment->ID, '_wp_attachment_image_alt', true ) )
805
+ );
806
  }
807
  }
808
  }
809
  return ( isset($this->images[$post->ID]) ) ? $this->images[$post->ID] : false;
810
  }
811
 
812
+ /**
813
+ * Get last modified
814
+ *
815
+ * @param string $sitemap
816
+ * @param string $term
817
+ *
818
+ * @return string
819
+ */
820
+ public function get_lastmod( $sitemap = 'post_type', $term = '' ) {
821
+ $return = trim( mysql2date( 'Y-m-d\TH:i:s+00:00', $this->modified( $sitemap, $term ), false ) );
822
+ return !empty($return) ? ' <lastmod>'.$return.'</lastmod>
823
+ ' : '';
824
  }
825
 
826
+ /**
827
+ * Get change frequency
828
+ *
829
+ * @param string $sitemap
830
+ * @param string $term
831
+ *
832
+ * @return string
833
+ */
834
+ public function get_changefreq( $sitemap = 'post_type', $term = '' ) {
835
  $modified = trim($this->modified($sitemap,$term));
836
 
837
  if (empty($modified))
854
  return $changefreq;
855
  }
856
 
857
+ /**
858
+ * Get priority
859
+ *
860
+ * @param string $sitemap
861
+ * @param WP_Term|string $term
862
+ *
863
+ * @return string
864
+ */
865
+ public function get_priority( $sitemap = 'post_type', $term = '' ) {
866
  if ( 'post_type' == $sitemap ) :
867
  global $post;
868
  $options = $this->get_post_types();
871
 
872
  if ( !empty($priority_meta) || $priority_meta == '0' ) {
873
 
874
+ $priority = floatval(str_replace(',','.',$priority_meta));
875
 
876
  } elseif ( !empty($options[$post->post_type]['dynamic_priority']) ) {
877
 
878
  $post_modified = mysql2date('U',$post->post_modified_gmt, false);
879
 
880
  if ( empty($this->lastmodified) )
881
+ $this->lastmodified = mysql2date('U',get_lastpostmodified('gmt',$post->post_type),false);
882
  // last posts or page modified date in Unix seconds
 
883
 
884
  if ( empty($this->firstdate) )
885
+ $this->firstdate = mysql2date('U',get_firstpostdate('gmt',$post->post_type),false);
886
+ // uses get_firstpostdate() function defined in xml-sitemap/hacks.php !
887
 
888
  if ( isset($options[$post->post_type]['priority']) )
889
+ $priority_value = floatval(str_replace(',','.',$options[$post->post_type]['priority']));
890
  else
891
  $priority_value = floatval($defaults[$post->post_type]['priority']);
892
 
938
  return number_format($priority,1);
939
  }
940
 
941
+ /**
942
+ * Get home urls
943
+ * @return array
944
+ */
945
+ public function get_home_urls() {
946
  $urls = array();
947
 
948
  global $sitepress; // Polylang and WPML compat
952
  foreach ( $languages as $language )
953
  $urls[] = pll_home_url( $language['slug'] );
954
  else
955
+ $urls[] = $this->home_url();
956
  } elseif ( isset($sitepress) && is_object($sitepress) && method_exists($sitepress, 'get_languages') && method_exists($sitepress, 'language_url') ) {
957
  foreach ( array_keys ( $sitepress->get_languages(false,true) ) as $term )
958
  $urls[] = $sitepress->language_url($term);
959
  } else {
960
+ $urls[] = $this->home_url();
961
  }
962
 
963
  return $urls;
964
  }
965
 
966
+ /**
967
+ * Is excluded
968
+ *
969
+ * @param null $post_id
970
+ *
971
+ * @return bool
972
+ */
973
+ public function is_excluded( $post_id = null ) {
974
  // no ID, try and get it from global post object
975
  if ( null == $post_id ) {
976
  global $post;
985
  return apply_filters( 'xmlsf_excluded', $excluded, $post_id );
986
  }
987
 
988
+ /**
989
+ * Is allowed domain
990
+ *
991
+ * @param $url
992
+ *
993
+ * @return mixed|void
994
+ */
995
+ public function is_allowed_domain( $url ) {
996
  $domains = $this->get_domains();
997
  $return = false;
998
  $parsed_url = parse_url($url);
999
 
1000
  if (isset($parsed_url['host'])) {
1001
  foreach( $domains as $domain ) {
1002
+ if( $parsed_url['host'] == $domain || strpos($parsed_url['host'],'.'.$domain) !== false ) {
1003
  $return = true;
1004
  break;
1005
  }
1009
  return apply_filters( 'xmlsf_allowed_domain', $return, $url );
1010
  }
1011
 
1012
+ /**
1013
+ * Get index url
1014
+ *
1015
+ * @param string $sitemap
1016
+ * @param bool|false $type
1017
+ * @param bool|false $param
1018
+ *
1019
+ * @return string
1020
+ */
1021
+ public function get_index_url( $sitemap = 'home', $type = false, $param = false ) {
1022
+ $split_url = explode('?', $this->home_url());
1023
 
1024
  $name = $this->base_name.'-'.$sitemap;
1025
 
1039
  return esc_url( trailingslashit($split_url[0]) . $name );
1040
  }
1041
 
1042
+ /**
1043
+ * Get language
1044
+ *
1045
+ * @param $id
1046
+ *
1047
+ * @return null|string
1048
+ */
1049
+ public function get_language( $id ) {
1050
  $language = null;
1051
 
1052
  if ( empty($this->blog_language) ) {
1088
  // add sitemap location in robots.txt generated by WP
1089
  public function robots($output)
1090
  {
1091
+ echo '# XML Sitemap & Google News Feeds version ' . XMLSF_VERSION . ' - http://status301.net/wordpress-plugins/xml-sitemap-feed/' . PHP_EOL;
1092
 
1093
  if ( '1' != get_option('blog_public') ) {
1094
+ echo '# XML Sitemaps are disabled. Please see Site Visibility on Settings > Reading.';
1095
  } else {
1096
  foreach ( $this->get_sitemaps() as $pretty )
1097
+ echo 'Sitemap: ' . trailingslashit(get_bloginfo('url')) . $pretty . PHP_EOL;
1098
 
1099
  if ( empty($pretty) )
1100
+ echo '# No XML Sitemaps are enabled. Please see XML Sitemaps on Settings > Reading.' . PHP_EOL;
1101
  }
1102
+ echo PHP_EOL;
1103
  }
1104
 
1105
+ /**
1106
+ * add robots.txt rules
1107
+ *
1108
+ * @param $output
1109
+ *
1110
+ * @return string
1111
+ */
1112
+ public function robots_txt($output) {
1113
+ return $output . $this->get_option('robots');
1114
  }
1115
 
1116
  /**
1122
  * such as /sitemap.xml (thanks to Permalink Editor plugin for WordPress)
1123
  *
1124
  * @param string $request
1125
+ *
1126
+ * @return mixed
1127
  */
1128
+ public function trailingslash($request) {
 
1129
  if (pathinfo($request, PATHINFO_EXTENSION)) {
1130
  return untrailingslashit($request);
1131
  }
1136
  * Add sitemap rewrite rules
1137
  *
1138
  * @param string $wp_rewrite
1139
+ *
1140
+ * @return void
1141
  */
1142
+ public function rewrite_rules($wp_rewrite) {
 
1143
  $xmlsf_rules = array();
1144
  $sitemaps = $this->get_sitemaps();
1145
 
1170
  $wp_rewrite->rules = $xmlsf_rules + $wp_rewrite->rules;
1171
  }
1172
 
1173
+ /**
1174
+ * WPML: switch language
1175
+ * @see https://wpml.org/wpml-hook/wpml_post_language_details/
1176
+ */
1177
  public function wpml_language_switcher() {
 
 
1178
  global $sitepress,$post;
1179
  if( isset($sitepress) ) {
1180
  $post_language = apply_filters( 'wpml_post_language_details', NULL, $post->ID );
1181
  $sitepress->switch_lang($post_language['language_code']);
1182
  }
 
1183
  }
1184
 
1185
  /**
1186
+ * Filter request
1187
+ *
1188
+ * @param $request
1189
+ *
1190
+ * @return mixed
1191
+ */
1192
+ public function filter_request( $request ) {
1193
  if ( isset($request['feed']) && strpos($request['feed'],'sitemap') === 0 ) :
1194
  // modify request parameters
1195
  $request['post_status'] = 'publish';
1208
  add_action( 'the_post', array( $this, 'wpml_language_switcher' ) );
1209
  }
1210
 
1211
+ // prepare for news and return modified request
1212
  if ( $request['feed'] == 'sitemap-news' ) {
1213
  $defaults = $this->defaults('news_tags');
1214
  $options = $this->get_option('news_tags');
1220
  define('DONOTCACHEDB', true);
1221
 
1222
  // set up query filters
1223
+ if ( get_lastpostdate('gmt', $news_post_type) > date('Y-m-d H:i:s', strtotime('-48 hours')) ) {
 
1224
  add_filter('post_limits', array($this, 'filter_news_limits'));
1225
  add_filter('posts_where', array($this, 'filter_news_where'), 10, 1);
1226
  } else {
1234
  if ( isset($options['categories']) && is_array($options['categories']) )
1235
  $request['cat'] = implode(',',$options['categories']);
1236
 
1237
+ // set the news sitemap conditional tag
1238
+ $this->is_news = true;
1239
+
1240
  return $request;
1241
  }
1242
 
1243
+ // not returned yet? then set the normal sitemap conditional tag
1244
+ $this->is_sitemap = true;
1245
+
1246
+ // prepare for post types and return modified request
1247
  if ( strpos($request['feed'],'sitemap-posttype') === 0 ) {
1248
  foreach ( $this->get_post_types() as $post_type ) {
1249
  if ( $request['feed'] == 'sitemap-posttype-'.$post_type['name'] ) {
1252
 
1253
  $request['post_type'] = $post_type['name'];
1254
  $request['orderby'] = 'modified';
1255
+ $request['is_date'] = false;
1256
 
1257
  return $request;
1258
  }
1259
  }
1260
  }
1261
 
1262
+ // prepare for taxonomies and return modified request
1263
  if ( strpos($request['feed'],'sitemap-taxonomy') === 0 ) {
1264
  foreach ( $this->get_taxonomies() as $taxonomy ) {
1265
  if ( $request['feed'] == 'sitemap-taxonomy-'.$taxonomy ) {
1288
  * FEED TEMPLATES
1289
  */
1290
 
1291
+ /**
1292
+ * Set up the sitemap index template
1293
+ */
1294
+ public function load_template_index() {
1295
  load_template( dirname( __FILE__ ) . '/feed-sitemap.php' );
1296
  }
1297
 
1298
+ /**
1299
+ * set up the sitemap home page(s) template
1300
+ */
1301
+ public function load_template_base() {
1302
  load_template( dirname( __FILE__ ) . '/feed-sitemap-home.php' );
1303
  }
1304
 
1305
+ /**
1306
+ * set up the post types sitemap template
1307
+ */
1308
+ public function load_template() {
1309
  load_template( dirname( __FILE__ ) . '/feed-sitemap-post_type.php' );
1310
  }
1311
 
1312
+ /**
1313
+ * set up the taxonomy sitemap template
1314
+ */
1315
+ public function load_template_taxonomy() {
1316
  load_template( dirname( __FILE__ ) . '/feed-sitemap-taxonomy.php' );
1317
  }
1318
 
1319
+ /**
1320
+ * set up the news sitemap template
1321
+ */
1322
+ public function load_template_news() {
1323
  load_template( dirname( __FILE__ ) . '/feed-sitemap-news.php' );
1324
  }
1325
 
1326
+ /**
1327
+ * set up the custom sitemap template
1328
+ */
1329
+ public function load_template_custom() {
1330
  load_template( dirname( __FILE__ ) . '/feed-sitemap-custom.php' );
1331
  }
1332
 
1334
  * LIMITS
1335
  */
1336
 
1337
+ /**
1338
+ * Filter limits
1339
+ * override default feed limit
1340
+ * @return string
1341
+ */
1342
+ public function filter_limits( $limit ) {
1343
  return 'LIMIT 0, 50000';
1344
  }
1345
 
1346
+ /**
1347
+ * Filter news WHERE
1348
+ * only posts from the last 48 hours
1349
+ *
1350
+ * @param string $where
1351
+ *
1352
+ * @return string
1353
+ */
1354
+ public function filter_news_where( $where = '' ) {
1355
+ return $where . ' AND post_date_gmt > \'' . date('Y-m-d H:i:s', strtotime('-48 hours')) . '\'';
1356
  }
1357
 
1358
+ /**
1359
+ * Filter news limits
1360
+ * override default feed limit for GN
1361
+ * @return string
1362
+ */
1363
+ public function filter_news_limits( $limits ) {
1364
  return 'LIMIT 0, 1000';
1365
  }
1366
 
1367
+ /**
1368
+ * Filter no news limits
1369
+ * in case there is no news, just take the latest post
1370
+ * @return string
1371
+ */
1372
  public function filter_no_news_limits( $limits )
1373
  {
1374
  return 'LIMIT 0, 1';
1378
  * PINGING
1379
  */
1380
 
1381
+ /**
1382
+ * Ping
1383
+ *
1384
+ * @param $uri
1385
+ * @param int $timeout
1386
+ *
1387
+ * @return bool
1388
+ */
1389
+ public function ping($uri, $timeout = 3) {
1390
  $options = array();
1391
  $options['timeout'] = $timeout;
1392
 
1400
  return $succes;
1401
  }
1402
 
1403
+ /**
1404
+ * Do pings
1405
+ *
1406
+ * @param $new_status
1407
+ * @param $old_status
1408
+ * @param $post
1409
+ */
1410
+ public function do_pings($new_status, $old_status, $post) {
1411
  $sitemaps = $this->get_sitemaps();
1412
  $to_ping = $this->get_ping();
1413
  $update = false;
1473
  * CLEARING & PURGING
1474
  */
1475
 
1476
+ /**
1477
+ * Clear settings
1478
+ */
1479
+ public function clear_settings() {
1480
  delete_option('xmlsf_version');
1481
  foreach ( $this->defaults() as $option => $settings ) {
1482
  delete_option('xmlsf_'.$option);
1487
  }
1488
  }
1489
 
1490
+ /**
1491
+ * Cache delete on clean_post_cache
1492
+ *
1493
+ * @param $post_ID
1494
+ * @param $post
1495
+ */
1496
+ public function clean_post_cache( $post_ID, $post ) {
1497
  // are we moving the post in or out of published status?
1498
+ wp_cache_delete('xmlsf_get_archives', 'general');
 
 
1499
 
1500
+ // TODO get year / month here to delete specific keys too !!!!
1501
+ $m = mysql2date('Ym',$post->post_date_gmt, false);
1502
+ $y = substr($m, 0, 4);
1503
+
1504
+ // clear possible last post modified cache keys
1505
+ wp_cache_delete( 'lastpostmodified:gmt', 'timeinfo' ); // should be handled by WP core?
1506
+ wp_cache_delete( 'lastpostmodified'.$y.':gmt', 'timeinfo' );
1507
+ wp_cache_delete( 'lastpostmodified'.$m.':gmt', 'timeinfo' );
1508
+ wp_cache_delete( 'lastpostmodified'.$y.':gmt:'.$post->post_type, 'timeinfo' );
1509
+ wp_cache_delete( 'lastpostmodified'.$m.':gmt:'.$post->post_type, 'timeinfo' );
1510
+
1511
+ // clear possible last post date cache keys
1512
+ wp_cache_delete( 'lastpostdate:gmt', 'timeinfo' );
1513
+ wp_cache_delete( 'lastpostdate:gmt:'.$post->post_type, 'timeinfo' );
1514
+
1515
+ // clear possible fist post date cache keys
1516
+ wp_cache_delete( 'firstpostdate:gmt', 'timeinfo' );
1517
+ wp_cache_delete( 'firstpostdate:gmt:'.$post->post_type, 'timeinfo' );
1518
+ }
1519
 
1520
  /**
1521
+ * Nginx helper purge urls
1522
+ * adds sitemap urls to the purge array.
1523
  *
1524
+ * @param $urls array
1525
+ * @param $redis bool|false
1526
  *
1527
+ * @return $urls array
 
1528
  */
1529
+ public function nginx_helper_purge_urls( $urls = array(), $redis = false ) {
 
 
 
 
 
 
 
 
 
 
 
1530
  // are permalinks set, blog public and $urls an array?
1531
  if ( '' == get_option('permalink_structure') || '1' != get_option('blog_public') || ! is_array( $urls ) )
1532
  return $urls;
1583
  * INITIALISATION
1584
  */
1585
 
1586
+ /**
1587
+ * Upgrade
1588
+ */
1589
+ public function upgrade( $old_version ) {
1590
  // rewrite rules not available on plugins_loaded
1591
  // and don't flush rules from init as Polylang chokes on that
1592
  // just remove the db option and let WP regenerate them when ready...
1596
 
1597
  // remove robots.txt rule blocking stylesheets, but only one time!
1598
  if ( version_compare('4.4', $old_version, '>') && $robot_rules = get_option($this->prefix.'robots')) {
1599
+ $robot_rules = str_replace(array('Disallow: */wp-content/','Allow: */wp-content/uploads/'),'',$robot_rules);
1600
  delete_option($this->prefix.'robots');
1601
  add_option($this->prefix.'robots', $robot_rules, '', 'no');
1602
  }
1655
  }
1656
  }
1657
 
1658
+ /**
1659
+ * Plugins loaded: load text domain
1660
+ */
1661
+ public function plugins_loaded() {
1662
  // TEXT DOMAIN
1663
  if ( is_admin() ) { // text domain needed on admin only
1664
+ load_plugin_textdomain('xml-sitemap-feed', false, dirname( XMLSF_PLUGIN_BASENAME ) . '/languages' );
1665
  }
1666
  }
1667
 
1668
+ /**
1669
+ * Activate
1670
+ */
1671
+ public function activate() {
1672
  // flush permalink structure
1673
  $this->flush_rules();
1674
 
1685
  }
1686
  }
1687
 
1688
+ /**
1689
+ * Init
1690
+ */
1691
+ public function init() {
1692
  // UPGRADE
1693
  $version = get_option('xmlsf_version', 0);
1694
 
1727
  }
1728
  }
1729
 
1730
+ /**
1731
+ * Admin init
1732
+ */
1733
+ public function admin_init() {
1734
  // CATCH TRANSIENT for reset
1735
  if (delete_transient('xmlsf_clear_settings'))
1736
  $this->clear_settings();
1743
  include_once( dirname( __FILE__ ) . '/class-xmlsitemapfeed-admin.php' );
1744
  }
1745
 
1746
+ /**
1747
+ * Flush rules
1748
+ *
1749
+ * @param bool|false $hard
1750
+ */
1751
+ public function flush_rules( $hard = false ) {
1752
  // did you flush already?
1753
  if ($this->yes_mother)
1754
  return; // yes, mother!
1755
 
1756
  global $wp_rewrite;
1757
+ $wp_rewrite->init();
1758
  $wp_rewrite->flush_rules($hard);
1759
 
1760
  if ( defined('WP_DEBUG') && WP_DEBUG )
1763
  $this->yes_mother = true;
1764
  }
1765
 
1766
+ /**
1767
+ * register google news taxonomies
1768
+ */
1769
+ public function register_gn_taxonomies() {
1770
  $defaults = $this->defaults('news_tags');
1771
  $options = $this->get_option('news_tags');
1772
 
1793
  ));
1794
  }
1795
 
1796
+ /**
1797
+ * Echo usage info
1798
+ * for debugging
1799
+ */
1800
  public function _e_usage()
1801
  {
1802
  if (defined('WP_DEBUG') && WP_DEBUG == true) {
1837
 
1838
  // ROBOTSTXT
1839
  add_action('do_robotstxt', array($this, 'robots'), 0 );
1840
+ add_filter('robots_txt', array($this, 'robots_txt'), 9 );
1841
 
1842
  // PINGING
1843
  add_action('transition_post_status', array($this, 'do_pings'), 10, 3);
1844
 
1845
+ // CLEAR OBJECT CACHE KEYS
1846
+ add_action('clean_post_cache', array($this, 'clean_post_cache'), 99, 2);
1847
 
1848
  // NGINX HELPER PURGE URLS
1849
  add_filter('rt_nginx_helper_purge_urls', array($this, 'nginx_helper_purge_urls'), 10, 2);
includes/feed-sitemap-home.php CHANGED
@@ -18,7 +18,7 @@ echo $xmlsf->headers();
18
  http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
19
  <?php
20
 
21
- $lastmodified = get_lastdate( 'gmt' ); // TODO take language into account !! Dont't use get_lastdate but pull one post for each language instead?
22
  $lastactivityage = ( gmdate('U') - mysql2date( 'U', $lastmodified ) );
23
  foreach ( $xmlsf->get_home_urls() as $url ) {
24
  ?>
18
  http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
19
  <?php
20
 
21
+ $lastmodified = get_lastpostdate( 'gmt' ); // TODO take language into account !! Dont't use get_lastpostdate but pull one post for each language instead?
22
  $lastactivityage = ( gmdate('U') - mysql2date( 'U', $lastmodified ) );
23
  foreach ( $xmlsf->get_home_urls() as $url ) {
24
  ?>
includes/feed-sitemap.php CHANGED
@@ -18,7 +18,7 @@ echo $xmlsf->headers('index');
18
  http://www.sitemaps.org/schemas/sitemap/0.9/siteindex.xsd">
19
  <sitemap>
20
  <loc><?php echo $xmlsf->get_index_url('home'); ?></loc>
21
- <lastmod><?php echo mysql2date('Y-m-d\TH:i:s+00:00', get_lastdate( 'gmt' ), false); ?></lastmod>
22
  </sitemap>
23
  <?php
24
  // add rules for public post types
18
  http://www.sitemaps.org/schemas/sitemap/0.9/siteindex.xsd">
19
  <sitemap>
20
  <loc><?php echo $xmlsf->get_index_url('home'); ?></loc>
21
+ <lastmod><?php echo mysql2date('Y-m-d\TH:i:s+00:00', get_lastpostdate( 'gmt' ), false); ?></lastmod>
22
  </sitemap>
23
  <?php
24
  // add rules for public post types
includes/functions.php ADDED
@@ -0,0 +1,174 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /* -------------------------------------
3
+ * CONDITIONAL FUNCTIONS
4
+ * ------------------------------------- */
5
+
6
+ /**
7
+ * Is the query for a sitemap?
8
+ *
9
+ * @since 4.8
10
+ *
11
+ * @global XMLSitemapFeed $xmlsf Global XML Sitemap Feed instance.
12
+ * @return bool
13
+ */
14
+ function is_sitemap() {
15
+ global $xmlsf;
16
+
17
+ if ( ! isset( $xmlsf ) ) {
18
+ _doing_it_wrong( __FUNCTION__, __( 'Conditional sitemap tags do not work before the sitemap request filter is run. Before then, they always return false.' ), '4.8' );
19
+ return false;
20
+ }
21
+
22
+ return $xmlsf->is_sitemap();
23
+ }
24
+
25
+ /**
26
+ * Is the query for a news sitemap?
27
+ *
28
+ * @since 4.8
29
+ *
30
+ * @global XMLSitemapFeed $xmlsf Global XML Sitemap Feed instance.
31
+ * @return bool
32
+ */
33
+ function is_news() {
34
+ global $xmlsf;
35
+
36
+ if ( ! isset( $xmlsf ) ) {
37
+ _doing_it_wrong( __FUNCTION__, __( 'Conditional sitemap tags do not work before the sitemap request filter is run. Before then, they always return false.' ), '4.8' );
38
+ return false;
39
+ }
40
+
41
+ return $xmlsf->is_news();
42
+ }
43
+
44
+ /* -------------------------------------
45
+ * MISSING WORDPRESS FUNCTIONS
46
+ * ------------------------------------- */
47
+
48
+ /**
49
+ * Retrieve the date that the first post/page was published.
50
+ * Variation of function get_lastpostdate, uses _get_post_time
51
+ *
52
+ * The server timezone is the default and is the difference between GMT and
53
+ * server time. The 'blog' value is the date when the last post was posted. The
54
+ * 'gmt' is when the last post was posted in GMT formatted date.
55
+ *
56
+ * @uses apply_filters() Calls 'get_firstpostdate' filter
57
+ *
58
+ * @param string $timezone The location to get the time. Can be 'gmt', 'blog', or 'server'.
59
+ * @param string $post_type Post type to check.
60
+ * @return string The date of the last post.
61
+ */
62
+ if( !function_exists('get_firstpostdate') ) {
63
+ function get_firstpostdate($timezone = 'server', $post_type = 'any') {
64
+ return apply_filters( 'get_firstpostdate', _get_post_time( $timezone, 'date', $post_type, 'first' ), $timezone );
65
+ }
66
+ }
67
+
68
+ /**
69
+ * Retrieve last post/page modified date depending on timezone.
70
+ * Variation of function get_lastpostmodified, uses _get_post_time
71
+ *
72
+ * The server timezone is the default and is the difference between GMT and
73
+ * server time. The 'blog' value is the date when the last post was posted. The
74
+ * 'gmt' is when the last post was posted in GMT formatted date.
75
+ *
76
+ * @uses apply_filters() Calls 'get_lastmodified' filter
77
+ *
78
+ * @param string $timezone The location to get the time. Can be 'gmt', 'blog', or 'server'.
79
+ * @return string The date of the oldest modified post.
80
+ */
81
+ if( !function_exists('get_lastmodified') ) {
82
+ function get_lastmodified( $timezone = 'server', $post_type = 'any', $m = '' ) {
83
+ return apply_filters( 'get_lastmodified', _get_post_time( $timezone, 'modified', $post_type, 'last', $m ), $timezone );
84
+ }
85
+ }
86
+
87
+ /**
88
+ * Retrieve first or last post type date data based on timezone.
89
+ * Variation of function _get_last_post_time
90
+ *
91
+ * @param string $timezone The location to get the time. Can be 'gmt', 'blog', or 'server'.
92
+ * @param string $field Field to check. Can be 'date' or 'modified'.
93
+ * @param string $post_type Post type to check. Defaults to 'any'.
94
+ * @param string $which Which to check. Can be 'first' or 'last'. Defaults to 'last'.
95
+ * @param string $m year, month or day period. Can be empty or integer.
96
+ * @return string The date.
97
+ */
98
+ if( !function_exists('_get_post_time') ) {
99
+ function _get_post_time( $timezone, $field, $post_type = 'any', $which = 'last', $m = '' ) {
100
+ global $wpdb;
101
+
102
+ if ( !in_array( $field, array( 'date', 'modified' ) ) ) {
103
+ return false;
104
+ }
105
+
106
+ $timezone = strtolower( $timezone );
107
+
108
+ $m = preg_replace('|[^0-9]|', '', $m);
109
+
110
+ $key = "{$which}post{$field}{$m}:$timezone";
111
+
112
+ if ( 'any' !== $post_type ) {
113
+ $key .= ':' . sanitize_key( $post_type );
114
+ }
115
+
116
+ $date = wp_cache_get( $key, 'timeinfo' );
117
+ if ( false !== $date ) {
118
+ return $date;
119
+ }
120
+
121
+ if ( $post_type == 'any' ) {
122
+ $post_types = get_post_types( array( 'public' => true ) );
123
+ array_walk( $post_types, array( &$wpdb, 'escape_by_ref' ) );
124
+ $post_types = "'" . implode( "', '", $post_types ) . "'";
125
+ } elseif ( is_array($post_type) ) {
126
+ $types = get_post_types( array( 'public' => true ) );
127
+ foreach ( $post_type as $type )
128
+ if ( !in_array( $type, $types ) )
129
+ return false;
130
+ array_walk( $post_type, array( &$wpdb, 'escape_by_ref' ) );
131
+ $post_types = "'" . implode( "', '", $post_type ) . "'";
132
+ } else {
133
+ if ( !in_array( $post_type, get_post_types( array( 'public' => true ) ) ) )
134
+ return false;
135
+ $post_types = "'" . addslashes($post_type) . "'";
136
+ }
137
+
138
+ $where = "post_status='publish' AND post_type IN ({$post_types}) AND post_date_gmt";
139
+
140
+ // If a period is specified in the querystring, add that to the query
141
+ if ( !empty($m) ) {
142
+ $where .= " AND YEAR(post_date)=" . substr($m, 0, 4);
143
+ if ( strlen($m) > 5 ) {
144
+ $where .= " AND MONTH(post_date)=" . substr($m, 4, 2);
145
+ if ( strlen($m) > 7 ) {
146
+ $where .= " AND DAY(post_date)=" . substr($m, 6, 2);
147
+ }
148
+ }
149
+ }
150
+
151
+ $order = ( $which == 'last' ) ? 'DESC' : 'ASC';
152
+
153
+ switch ( $timezone ) {
154
+ case 'gmt':
155
+ $date = $wpdb->get_var("SELECT post_{$field}_gmt FROM $wpdb->posts WHERE $where ORDER BY post_{$field}_gmt $order LIMIT 1");
156
+ break;
157
+ case 'blog':
158
+ $date = $wpdb->get_var("SELECT post_{$field} FROM $wpdb->posts WHERE $where ORDER BY post_{$field}_gmt $order LIMIT 1");
159
+ break;
160
+ case 'server':
161
+ $add_seconds_server = date('Z');
162
+ $date = $wpdb->get_var("SELECT DATE_ADD(post_{$field}_gmt, INTERVAL '$add_seconds_server' SECOND) FROM $wpdb->posts WHERE $where ORDER BY post_{$field}_gmt $order LIMIT 1");
163
+ break;
164
+ }
165
+
166
+ if ( $date ) {
167
+ wp_cache_set( $key, $date, 'timeinfo' );
168
+
169
+ return $date;
170
+ }
171
+
172
+ return false;
173
+ }
174
+ }
languages/xml-sitemap-feed-ga_GA.mo ADDED
Binary file
languages/xml-sitemap-feed-ga_GA.po ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: XML Sitemap and Google News feeds/4.0\n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2013-02-22 16:43+0100\n"
6
+ "PO-Revision-Date: 2017-04-20 00:35+0200\n"
7
+ "Last-Translator: RavanH <ravanhagen@gmail.com>\n"
8
+ "Language-Team: ChameleonJohn.com <jordan.silaen@chameleonjohn.com>\n"
9
+ "Language: ga_GA\n"
10
+ "MIME-Version: 1.0\n"
11
+ "Content-Type: text/plain; charset=UTF-8\n"
12
+ "Content-Transfer-Encoding: 8bit\n"
13
+ "X-Poedit-KeywordsList: __;_e;_n\n"
14
+ "X-Poedit-SourceCharset: UTF-8\n"
15
+ "X-Generator: Poedit 1.8.9\n"
16
+
17
+ #: ../includes/admin.php:15
18
+ msgid "Donate to keep the free XML Sitemap Feeds plugin development & support going!"
19
+ msgstr "Síntiúis a choinneáil ar an XML saor in aisce Fothaí Mapa an Láithreáin forbartha plugin & tacaíocht ag dul!"
20
+
21
+ #: ../includes/admin.php:15
22
+ msgid "These settings control the XML Sitemap generation."
23
+ msgstr "Tá na socruithe rialú an ghlúin XML Mapa an Láithreáin."
24
+
25
+ #: ../includes/admin.php:15
26
+ #, php-format
27
+ msgid "XML Sitemaps are disabled if you have set the option %s (above) to %s."
28
+ msgstr "Tá Sitemaps XML faoi mhíchumas má tá tú a leagtar ar an rogha %s (thuas) chun %s ."
29
+
30
+ #: ../includes/admin.php:15
31
+ msgid "Site Visibility"
32
+ msgstr "suíomh Léargas"
33
+
34
+ #: ../includes/admin.php:15
35
+ msgid "Discourage search engines from indexing this site"
36
+ msgstr "Cur in innill chuardaigh as innéacsú suíomh seo"
37
+
38
+ #: ../includes/admin.php:39
39
+ msgid "Regular XML Sitemaps"
40
+ msgstr "Sitemaps XML rialta"
41
+
42
+ #: ../includes/admin.php:41 ../includes/admin.php:47
43
+ msgid "View"
44
+ msgstr "Amharc"
45
+
46
+ #: ../includes/admin.php:45
47
+ msgid "Google News Sitemap"
48
+ msgstr "Google News Mapa an tSuímh"
49
+
50
+ #: ../includes/admin.php:123
51
+ #, php-format
52
+ msgid "Rules to append to %s generated by WordPress."
53
+ msgstr "Rialacha chur mar aguisín le %s ginte ag WordPress."
54
+
55
+ #: ../includes/admin.php:123
56
+ msgid "Warning: Only set rules here when you know what you are doing, otherwise you might break access to your site.<br />Note: These rules will not have effect when you are using a static robots.txt file."
57
+ msgstr "Rabhadh: Níl ach rialacha a leagtar anseo nuair a fhios agat cad tá á dhéanamh, ar shlí eile d'fhéadfadh tú rochtain sos ar do láithreán <br /> Tabhair faoi deara:. Ní bheidh na rialacha éifeacht leis nuair a bhíonn tú ag baint úsáide as comhad robots.txt statach."
58
+
59
+ #: ../includes/admin.php:185
60
+ msgid "XML Sitemaps"
61
+ msgstr "Sitemaps XML"
62
+
63
+ #: ../includes/admin.php:188
64
+ msgid "Enable XML sitemaps"
65
+ msgstr "Cumasaigh sitemaps XML"
66
+
67
+ #: ../includes/admin.php:191
68
+ msgid "Include post types"
69
+ msgstr "I measc na gcineálacha post"
70
+
71
+ #: ../includes/admin.php:194
72
+ msgid "Include taxonomies"
73
+ msgstr "I measc na tacsanomaíochtaí"
74
+
75
+ #: ../includes/admin.php:201
76
+ msgid "Additional robots.txt rules"
77
+ msgstr "Rialacha breise robots.txt"
languages/xml-sitemap-feed.pot CHANGED
@@ -3,7 +3,7 @@ msgid ""
3
  msgstr ""
4
  "Project-Id-Version: XML Sitemap and Google News feeds/4.4\n"
5
  "Report-Msgid-Bugs-To: \n"
6
- "POT-Creation-Date: 2016-05-06 02:07+0200\n"
7
  "PO-Revision-Date: 2015-01-05 04:05+0100\n"
8
  "Last-Translator: RavanH <ravanhagen@gmail.com>\n"
9
  "Language-Team: ravanhagen@gmail.com\n"
@@ -11,183 +11,184 @@ msgstr ""
11
  "MIME-Version: 1.0\n"
12
  "Content-Type: text/plain; charset=UTF-8\n"
13
  "Content-Transfer-Encoding: 8bit\n"
14
- "X-Poedit-KeywordsList: __;_e\n"
15
- "X-Poedit-Basepath: .\n"
16
  "X-Poedit-SourceCharset: UTF-8\n"
17
- "X-Generator: Poedit 1.8.7.1\n"
18
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
19
- "X-Poedit-SearchPath-0: ..\n"
 
20
 
21
- #: ../includes/class-xmlsitemapfeed-admin.php:23
22
  msgid "XML Sitemaps"
23
  msgstr ""
24
 
25
- #: ../includes/class-xmlsitemapfeed-admin.php:24
26
  msgid "XML Sitemap Index"
27
  msgstr ""
28
 
29
- #: ../includes/class-xmlsitemapfeed-admin.php:29
30
- #: ../includes/class-xmlsitemapfeed-admin.php:1010
31
  msgid "Google News Sitemap"
32
  msgstr ""
33
 
34
- #: ../includes/class-xmlsitemapfeed-admin.php:73
35
  msgid "Google"
36
  msgstr ""
37
 
38
- #: ../includes/class-xmlsitemapfeed-admin.php:76
39
  msgid "Bing & Yahoo"
40
  msgstr ""
41
 
42
- #: ../includes/class-xmlsitemapfeed-admin.php:79
43
  msgid "Yandex"
44
  msgstr ""
45
 
46
- #: ../includes/class-xmlsitemapfeed-admin.php:82
47
  msgid "Baidu"
48
  msgstr ""
49
 
50
- #: ../includes/class-xmlsitemapfeed-admin.php:85
51
  msgid "Ping-O-Matic"
52
  msgstr ""
53
 
54
- #: ../includes/class-xmlsitemapfeed-admin.php:140
55
  #, php-format
56
  msgid "Successfully sent %1$s on %2$s."
57
  msgstr ""
58
 
59
- #: ../includes/class-xmlsitemapfeed-admin.php:201
60
- #: ../includes/class-xmlsitemapfeed-admin.php:392
61
- #: ../includes/class-xmlsitemapfeed-admin.php:995
62
  msgid "Additional robots.txt rules"
63
  msgstr ""
64
 
65
- #: ../includes/class-xmlsitemapfeed-admin.php:202
66
  #, php-format
67
  msgid "Rules that will be appended to the %s generated by WordPress:"
68
  msgstr ""
69
 
70
- #: ../includes/class-xmlsitemapfeed-admin.php:203
71
  msgid ""
72
  "These rules will not have effect when you are using a static robots.txt file."
73
  msgstr ""
74
 
75
- #: ../includes/class-xmlsitemapfeed-admin.php:203
76
  msgid ""
77
  "Only add rules here when you know what you are doing, otherwise you might "
78
  "break search engine access to your site."
79
  msgstr ""
80
 
81
- #: ../includes/class-xmlsitemapfeed-admin.php:209
82
- #: ../includes/class-xmlsitemapfeed-admin.php:1005
83
  msgid "Reset XML sitemaps"
84
  msgstr ""
85
 
86
- #: ../includes/class-xmlsitemapfeed-admin.php:211
87
  msgid ""
88
  "Selecting this will clear all XML Sitemap & Google News Sitemap settings "
89
  "after Save Changes. Are you sure?"
90
  msgstr ""
91
 
92
- #: ../includes/class-xmlsitemapfeed-admin.php:212
93
  msgid "Clear all XML Sitemap & Google News Sitemap settings."
94
  msgstr ""
95
 
96
- #: ../includes/class-xmlsitemapfeed-admin.php:215
97
  msgid ""
98
  "Check this option and Save Changes to start fresh with the default settings."
99
  msgstr ""
100
 
101
- #: ../includes/class-xmlsitemapfeed-admin.php:224
102
- #: ../includes/class-xmlsitemapfeed-admin.php:225
103
- #: ../includes/class-xmlsitemapfeed-admin.php:462
104
- #: ../includes/class-xmlsitemapfeed-admin.php:463
105
  #, php-format
106
  msgid "Donate to keep the free %s plugin development & support going!"
107
  msgstr ""
108
 
109
- #: ../includes/class-xmlsitemapfeed-admin.php:224
110
- #: ../includes/class-xmlsitemapfeed-admin.php:225
111
- #: ../includes/class-xmlsitemapfeed-admin.php:226
112
- #: ../includes/class-xmlsitemapfeed-admin.php:462
113
- #: ../includes/class-xmlsitemapfeed-admin.php:463
114
- #: ../includes/class-xmlsitemapfeed-admin.php:464
115
  msgid "XML Sitemap & Google News Feeds"
116
  msgstr ""
117
 
118
- #: ../includes/class-xmlsitemapfeed-admin.php:226
119
  #, php-format
120
  msgid "These settings control the XML Sitemaps generated by the %s plugin."
121
  msgstr ""
122
 
123
- #: ../includes/class-xmlsitemapfeed-admin.php:227
124
- #: ../includes/class-xmlsitemapfeed-admin.php:467
125
  #, php-format
126
  msgid "For ping options, go to %s."
127
  msgstr ""
128
 
129
- #: ../includes/class-xmlsitemapfeed-admin.php:240
130
  msgid "XML Sitemaps for post types"
131
  msgstr ""
132
 
133
- #: ../includes/class-xmlsitemapfeed-admin.php:279
134
  msgid "Year"
135
  msgstr ""
136
 
137
- #: ../includes/class-xmlsitemapfeed-admin.php:280
138
  msgid "Month"
139
  msgstr ""
140
 
141
- #: ../includes/class-xmlsitemapfeed-admin.php:284
142
  msgid "Split by"
143
  msgstr ""
144
 
145
- #: ../includes/class-xmlsitemapfeed-admin.php:294
146
  msgid ""
147
  "Split by year if you experience errors or slow sitemaps. In very rare cases, "
148
  "split by month is needed."
149
  msgstr ""
150
 
151
- #: ../includes/class-xmlsitemapfeed-admin.php:299
152
- #: ../includes/class-xmlsitemapfeed-admin.php:884
153
  msgid "Priority"
154
  msgstr ""
155
 
156
- #: ../includes/class-xmlsitemapfeed-admin.php:301
157
  msgid "Priority can be overridden on individual posts."
158
  msgstr ""
159
 
160
- #: ../includes/class-xmlsitemapfeed-admin.php:306
161
  msgid "Automatic Priority calculation."
162
  msgstr ""
163
 
164
- #: ../includes/class-xmlsitemapfeed-admin.php:306
165
  msgid ""
166
  "Adjusts the Priority based on factors like age, comments, sticky post or "
167
  "blog page. Individual posts with fixed Priority will always keep that value."
168
  msgstr ""
169
 
170
- #: ../includes/class-xmlsitemapfeed-admin.php:311
171
  msgid "Update Lastmod and Changefreq on comments."
172
  msgstr ""
173
 
174
- #: ../includes/class-xmlsitemapfeed-admin.php:311
175
  msgid ""
176
  "Set this if discussion on your site warrants reindexation upon each new "
177
  "comment."
178
  msgstr ""
179
 
180
- #: ../includes/class-xmlsitemapfeed-admin.php:315
181
- #: ../includes/class-xmlsitemapfeed-admin.php:582
182
  msgid "Add image tags for"
183
  msgstr ""
184
 
185
- #: ../includes/class-xmlsitemapfeed-admin.php:323
186
- #: ../includes/class-xmlsitemapfeed-admin.php:589
187
  msgid "Attached images"
188
  msgstr ""
189
 
190
- #: ../includes/class-xmlsitemapfeed-admin.php:333
191
  msgid ""
192
  "Priority settings do not affect ranking in search results in any way. They "
193
  "are only meant to suggest search engines which URLs to index first. Once a "
@@ -195,29 +196,29 @@ msgid ""
195
  "updated."
196
  msgstr ""
197
 
198
- #: ../includes/class-xmlsitemapfeed-admin.php:334
199
  msgid ""
200
  "Maximum Priority (1.0) is reserved for the front page, individual posts and, "
201
  "when allowed, posts with high comment count."
202
  msgstr ""
203
 
204
- #: ../includes/class-xmlsitemapfeed-admin.php:334
205
  msgid ""
206
  "Priority values are taken as relative values. Setting all to the same (high) "
207
  "value is pointless."
208
  msgstr ""
209
 
210
- #: ../includes/class-xmlsitemapfeed-admin.php:384
211
  msgid "XML Sitemaps for taxonomies"
212
  msgstr ""
213
 
214
- #: ../includes/class-xmlsitemapfeed-admin.php:390
215
  msgid ""
216
  "It is generally not recommended to include taxonomy pages, unless their "
217
  "content brings added value."
218
  msgstr ""
219
 
220
- #: ../includes/class-xmlsitemapfeed-admin.php:391
221
  msgid ""
222
  "For example, when you use category descriptions with information that is not "
223
  "present elsewhere on your site or if taxonomy pages list posts with an "
@@ -228,48 +229,48 @@ msgid ""
228
  "disallowing indexation of taxonomies."
229
  msgstr ""
230
 
231
- #: ../includes/class-xmlsitemapfeed-admin.php:392
232
  #, php-format
233
  msgid ""
234
  "You can do this by adding specific robots.txt rules in the %s field above."
235
  msgstr ""
236
 
237
- #: ../includes/class-xmlsitemapfeed-admin.php:407
238
  msgid "No taxonomies available for the currently included post types."
239
  msgstr ""
240
 
241
- #: ../includes/class-xmlsitemapfeed-admin.php:415
242
- #: ../includes/class-xmlsitemapfeed-admin.php:1039
243
  msgid "Include custom XML Sitemaps"
244
  msgstr ""
245
 
246
- #: ../includes/class-xmlsitemapfeed-admin.php:416
247
  msgid "Additional XML Sitemaps to append to the main XML Sitemap Index:"
248
  msgstr ""
249
 
250
- #: ../includes/class-xmlsitemapfeed-admin.php:418
251
  msgid ""
252
  "Add the full URL, including protocol (http/https) and domain, of any XML "
253
  "Sitemap that you want to append to the Sitemap Index. Start each URL on a "
254
  "new line."
255
  msgstr ""
256
 
257
- #: ../includes/class-xmlsitemapfeed-admin.php:418
258
  msgid ""
259
  "Only valid sitemaps are allowed in the Sitemap Index. Use your Google/Bing "
260
  "Webmaster Tools to verify!"
261
  msgstr ""
262
 
263
- #: ../includes/class-xmlsitemapfeed-admin.php:435
264
- #: ../includes/class-xmlsitemapfeed-admin.php:1036
265
  msgid "Include custom URLs"
266
  msgstr ""
267
 
268
- #: ../includes/class-xmlsitemapfeed-admin.php:436
269
  msgid "Additional URLs to append in an extra XML Sitemap:"
270
  msgstr ""
271
 
272
- #: ../includes/class-xmlsitemapfeed-admin.php:438
273
  msgid ""
274
  "Add the full URL, including protocol (http/https) and domain, of any "
275
  "(static) page that you want to append to the ones already included by "
@@ -277,16 +278,16 @@ msgid ""
277
  "space after the URL. Start each URL on a new line."
278
  msgstr ""
279
 
280
- #: ../includes/class-xmlsitemapfeed-admin.php:448
281
- #: ../includes/class-xmlsitemapfeed-admin.php:1033
282
  msgid "Allowed domains"
283
  msgstr ""
284
 
285
- #: ../includes/class-xmlsitemapfeed-admin.php:449
286
  msgid "Additional domains to allow in the XML Sitemaps:"
287
  msgstr ""
288
 
289
- #: ../includes/class-xmlsitemapfeed-admin.php:450
290
  #, php-format
291
  msgid ""
292
  "By default, only the domain %s as used in your WordPress site address is "
@@ -299,13 +300,13 @@ msgid ""
299
  "will be filtered."
300
  msgstr ""
301
 
302
- #: ../includes/class-xmlsitemapfeed-admin.php:464
303
  #, php-format
304
  msgid ""
305
  "These settings control the Google News Sitemap generated by the %s plugin."
306
  msgstr ""
307
 
308
- #: ../includes/class-xmlsitemapfeed-admin.php:465
309
  msgid ""
310
  "When you are done configuring and preparing your news content and you are "
311
  "convinced your site adheres to the <a href=\"https://support.google.com/news/"
@@ -314,7 +315,7 @@ msgid ""
314
  "target=\"_blank\">submit your site for inclusion</a>!"
315
  msgstr ""
316
 
317
- #: ../includes/class-xmlsitemapfeed-admin.php:466
318
  msgid ""
319
  "It is strongly recommended to submit your news sitemap to your Google "
320
  "Webmasters Tools account to monitor for warnings or errors. Read more on how "
@@ -322,17 +323,17 @@ msgid ""
322
  "\"_blank\">Manage sitemaps with the Sitemaps page</a>."
323
  msgstr ""
324
 
325
- #: ../includes/class-xmlsitemapfeed-admin.php:477
326
- #: ../includes/class-xmlsitemapfeed-admin.php:1013
327
  msgid "Publication name"
328
  msgstr ""
329
 
330
- #: ../includes/class-xmlsitemapfeed-admin.php:478
331
  #, php-format
332
  msgid "By default, the general %s setting will be used."
333
  msgstr ""
334
 
335
- #: ../includes/class-xmlsitemapfeed-admin.php:479
336
  msgid ""
337
  "The publication name should match the name submitted on the Google News "
338
  "Publisher Center. If you wish to change it, please read <a href=\"https://"
@@ -340,7 +341,7 @@ msgid ""
340
  "publication name</a>."
341
  msgstr ""
342
 
343
- #: ../includes/class-xmlsitemapfeed-admin.php:496
344
  msgid ""
345
  "Error: There where no valid post types found. Without at least one public "
346
  "post type, a Google News Sitemap cannot be created by this plugin. Please "
@@ -348,67 +349,67 @@ msgid ""
348
  "\">Enable XML sitemaps</a> and choose another method."
349
  msgstr ""
350
 
351
- #: ../includes/class-xmlsitemapfeed-admin.php:499
352
- #: ../includes/class-xmlsitemapfeed-admin.php:1014
353
- #: ../includes/class-xmlsitemapfeed-admin.php:1027
354
  msgid "Include post types"
355
  msgstr ""
356
 
357
- #: ../includes/class-xmlsitemapfeed-admin.php:525
358
  #, php-format
359
  msgid ""
360
  "At least one post type must be selected. By default, the post type %s will "
361
  "be used."
362
  msgstr ""
363
 
364
- #: ../includes/class-xmlsitemapfeed-admin.php:536
365
  #, php-format
366
  msgid ""
367
  "Selection based on categories will be available when <strong>only</strong> "
368
  "the post type %s is included above."
369
  msgstr ""
370
 
371
- #: ../includes/class-xmlsitemapfeed-admin.php:554
372
  msgid "Limit to posts in these post categories:"
373
  msgstr ""
374
 
375
- #: ../includes/class-xmlsitemapfeed-admin.php:570
376
  msgid ""
377
  "If you wish to limit posts that will feature in your News Sitemap to certain "
378
  "categories, select them here. If no categories are selected, posts of all "
379
  "categories will be included in your News Sitemap."
380
  msgstr ""
381
 
382
- #: ../includes/class-xmlsitemapfeed-admin.php:570
383
- #: ../includes/class-xmlsitemapfeed-admin.php:650
384
  msgid "Use the Ctrl/Cmd key plus click to select more than one or to deselect."
385
  msgstr ""
386
 
387
- #: ../includes/class-xmlsitemapfeed-admin.php:592
388
  msgid ""
389
  "Note: Google News prefers at most one image per article in the News Sitemap. "
390
  "If multiple valid images are specified, the crawler will have to pick one "
391
  "arbitrarily. Images in News Sitemaps should be in jpeg or png format."
392
  msgstr ""
393
 
394
- #: ../includes/class-xmlsitemapfeed-admin.php:592
395
- #: ../includes/class-xmlsitemapfeed-admin.php:599
396
  msgid "More information&hellip;"
397
  msgstr ""
398
 
399
- #: ../includes/class-xmlsitemapfeed-admin.php:598
400
- #: ../includes/class-xmlsitemapfeed-admin.php:1017
401
  msgid "Source labels"
402
  msgstr ""
403
 
404
- #: ../includes/class-xmlsitemapfeed-admin.php:599
405
  #, php-format
406
  msgid ""
407
  "You can use the %1$s and %2$s tags to provide Google more information about "
408
  "the content of your articles."
409
  msgstr ""
410
 
411
- #: ../includes/class-xmlsitemapfeed-admin.php:611
412
  #, php-format
413
  msgid ""
414
  "The %4$s tag specifies whether an article is available to all readers "
@@ -416,39 +417,39 @@ msgid ""
416
  "your site."
417
  msgstr ""
418
 
419
- #: ../includes/class-xmlsitemapfeed-admin.php:611
420
- #: ../includes/class-xmlsitemapfeed-admin.php:931
421
  msgid "Registration"
422
  msgstr ""
423
 
424
- #: ../includes/class-xmlsitemapfeed-admin.php:611
425
- #: ../includes/class-xmlsitemapfeed-admin.php:932
426
  msgid "Subscription"
427
  msgstr ""
428
 
429
- #: ../includes/class-xmlsitemapfeed-admin.php:612
430
  msgid "You can assign a different access level when writing a post."
431
  msgstr ""
432
 
433
- #: ../includes/class-xmlsitemapfeed-admin.php:616
434
  msgid "Tag normal posts as"
435
  msgstr ""
436
 
437
- #: ../includes/class-xmlsitemapfeed-admin.php:618
438
- #: ../includes/class-xmlsitemapfeed-admin.php:623
439
  msgid "Free registration"
440
  msgstr ""
441
 
442
- #: ../includes/class-xmlsitemapfeed-admin.php:619
443
- #: ../includes/class-xmlsitemapfeed-admin.php:624
444
  msgid "Paid subscription"
445
  msgstr ""
446
 
447
- #: ../includes/class-xmlsitemapfeed-admin.php:622
448
  msgid "Tag Password Protected posts as"
449
  msgstr ""
450
 
451
- #: ../includes/class-xmlsitemapfeed-admin.php:637
452
  #, php-format
453
  msgid ""
454
  "The %s tag specifies one or more properties for an article, namely, whether "
@@ -456,88 +457,88 @@ msgid ""
456
  "generated content, or satire."
457
  msgstr ""
458
 
459
- #: ../includes/class-xmlsitemapfeed-admin.php:637
460
  msgid "You can assign different genres when writing a post."
461
  msgstr ""
462
 
463
- #: ../includes/class-xmlsitemapfeed-admin.php:641
464
  msgid "Default genre:"
465
  msgstr ""
466
 
467
- #: ../includes/class-xmlsitemapfeed-admin.php:650
468
  #, php-format
469
  msgid "Read more about source labels on %s"
470
  msgstr ""
471
 
472
- #: ../includes/class-xmlsitemapfeed-admin.php:650
473
  msgid "What does each source label mean?"
474
  msgstr ""
475
 
476
- #: ../includes/class-xmlsitemapfeed-admin.php:659
477
  #, php-format
478
  msgid ""
479
  "The %s tag is used to help classify the articles you submit to Google News "
480
  "by <strong>topic</strong>."
481
  msgstr ""
482
 
483
- #: ../includes/class-xmlsitemapfeed-admin.php:661
484
  #, php-format
485
  msgid "Use %s for topics."
486
  msgstr ""
487
 
488
- #: ../includes/class-xmlsitemapfeed-admin.php:668
489
  msgid "Default topic(s):"
490
  msgstr ""
491
 
492
- #: ../includes/class-xmlsitemapfeed-admin.php:670
493
  msgid "Separate with a comma."
494
  msgstr ""
495
 
496
- #: ../includes/class-xmlsitemapfeed-admin.php:674
497
  msgid ""
498
  "Keywords may be drawn from, but are not limited to, the list of <a href="
499
  "\"https://support.google.com/news/publisher/answer/116037\" target=\"_blank"
500
  "\">existing Google News keywords</a>."
501
  msgstr ""
502
 
503
- #: ../includes/class-xmlsitemapfeed-admin.php:851
504
- #: ../includes/class-xmlsitemapfeed-admin.php:1024
505
  msgid "XML Sitemap"
506
  msgstr ""
507
 
508
- #: ../includes/class-xmlsitemapfeed-admin.php:886
509
  #, php-format
510
  msgid "Leave empty for automatic Priority as configured on %1$s > %2$s."
511
  msgstr ""
512
 
513
- #: ../includes/class-xmlsitemapfeed-admin.php:890
514
  msgid "Exclude from XML Sitemap"
515
  msgstr ""
516
 
517
- #: ../includes/class-xmlsitemapfeed-admin.php:902
518
  msgid "Google News"
519
  msgstr ""
520
 
521
- #: ../includes/class-xmlsitemapfeed-admin.php:927
522
  msgid "Access"
523
  msgstr ""
524
 
525
- #: ../includes/class-xmlsitemapfeed-admin.php:936
526
  msgid "Exclude from Google News Sitemap."
527
  msgstr ""
528
 
529
- #: ../includes/class-xmlsitemapfeed-admin.php:988
530
  msgid "Enable XML sitemaps"
531
  msgstr ""
532
 
533
- #: ../includes/class-xmlsitemapfeed-admin.php:1030
534
  msgid "Include taxonomies"
535
  msgstr ""
536
 
537
- #: ../includes/class-xmlsitemapfeed.php:1318
538
  msgid "Google News Genres"
539
  msgstr ""
540
 
541
- #: ../includes/class-xmlsitemapfeed.php:1319
542
  msgid "Google News Genre"
543
  msgstr ""
3
  msgstr ""
4
  "Project-Id-Version: XML Sitemap and Google News feeds/4.4\n"
5
  "Report-Msgid-Bugs-To: \n"
6
+ "POT-Creation-Date: 2017-04-20 00:39+0200\n"
7
  "PO-Revision-Date: 2015-01-05 04:05+0100\n"
8
  "Last-Translator: RavanH <ravanhagen@gmail.com>\n"
9
  "Language-Team: ravanhagen@gmail.com\n"
11
  "MIME-Version: 1.0\n"
12
  "Content-Type: text/plain; charset=UTF-8\n"
13
  "Content-Transfer-Encoding: 8bit\n"
14
+ "X-Poedit-KeywordsList: __;_e;_nx;_x\n"
15
+ "X-Poedit-Basepath: ..\n"
16
  "X-Poedit-SourceCharset: UTF-8\n"
17
+ "X-Generator: Poedit 1.8.9\n"
18
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
19
+ "X-Poedit-SearchPath-0: .\n"
20
+ "X-Poedit-SearchPath-1: includes\n"
21
 
22
+ #: includes/class-xmlsitemapfeed-admin.php:23
23
  msgid "XML Sitemaps"
24
  msgstr ""
25
 
26
+ #: includes/class-xmlsitemapfeed-admin.php:24
27
  msgid "XML Sitemap Index"
28
  msgstr ""
29
 
30
+ #: includes/class-xmlsitemapfeed-admin.php:29
31
+ #: includes/class-xmlsitemapfeed-admin.php:1027
32
  msgid "Google News Sitemap"
33
  msgstr ""
34
 
35
+ #: includes/class-xmlsitemapfeed-admin.php:73
36
  msgid "Google"
37
  msgstr ""
38
 
39
+ #: includes/class-xmlsitemapfeed-admin.php:76
40
  msgid "Bing & Yahoo"
41
  msgstr ""
42
 
43
+ #: includes/class-xmlsitemapfeed-admin.php:79
44
  msgid "Yandex"
45
  msgstr ""
46
 
47
+ #: includes/class-xmlsitemapfeed-admin.php:82
48
  msgid "Baidu"
49
  msgstr ""
50
 
51
+ #: includes/class-xmlsitemapfeed-admin.php:85
52
  msgid "Ping-O-Matic"
53
  msgstr ""
54
 
55
+ #: includes/class-xmlsitemapfeed-admin.php:140
56
  #, php-format
57
  msgid "Successfully sent %1$s on %2$s."
58
  msgstr ""
59
 
60
+ #: includes/class-xmlsitemapfeed-admin.php:201
61
+ #: includes/class-xmlsitemapfeed-admin.php:392
62
+ #: includes/class-xmlsitemapfeed-admin.php:1012
63
  msgid "Additional robots.txt rules"
64
  msgstr ""
65
 
66
+ #: includes/class-xmlsitemapfeed-admin.php:202
67
  #, php-format
68
  msgid "Rules that will be appended to the %s generated by WordPress:"
69
  msgstr ""
70
 
71
+ #: includes/class-xmlsitemapfeed-admin.php:203
72
  msgid ""
73
  "These rules will not have effect when you are using a static robots.txt file."
74
  msgstr ""
75
 
76
+ #: includes/class-xmlsitemapfeed-admin.php:203
77
  msgid ""
78
  "Only add rules here when you know what you are doing, otherwise you might "
79
  "break search engine access to your site."
80
  msgstr ""
81
 
82
+ #: includes/class-xmlsitemapfeed-admin.php:209
83
+ #: includes/class-xmlsitemapfeed-admin.php:1022
84
  msgid "Reset XML sitemaps"
85
  msgstr ""
86
 
87
+ #: includes/class-xmlsitemapfeed-admin.php:211
88
  msgid ""
89
  "Selecting this will clear all XML Sitemap & Google News Sitemap settings "
90
  "after Save Changes. Are you sure?"
91
  msgstr ""
92
 
93
+ #: includes/class-xmlsitemapfeed-admin.php:212
94
  msgid "Clear all XML Sitemap & Google News Sitemap settings."
95
  msgstr ""
96
 
97
+ #: includes/class-xmlsitemapfeed-admin.php:215
98
  msgid ""
99
  "Check this option and Save Changes to start fresh with the default settings."
100
  msgstr ""
101
 
102
+ #: includes/class-xmlsitemapfeed-admin.php:224
103
+ #: includes/class-xmlsitemapfeed-admin.php:225
104
+ #: includes/class-xmlsitemapfeed-admin.php:462
105
+ #: includes/class-xmlsitemapfeed-admin.php:463
106
  #, php-format
107
  msgid "Donate to keep the free %s plugin development & support going!"
108
  msgstr ""
109
 
110
+ #: includes/class-xmlsitemapfeed-admin.php:224
111
+ #: includes/class-xmlsitemapfeed-admin.php:225
112
+ #: includes/class-xmlsitemapfeed-admin.php:226
113
+ #: includes/class-xmlsitemapfeed-admin.php:462
114
+ #: includes/class-xmlsitemapfeed-admin.php:463
115
+ #: includes/class-xmlsitemapfeed-admin.php:464
116
  msgid "XML Sitemap & Google News Feeds"
117
  msgstr ""
118
 
119
+ #: includes/class-xmlsitemapfeed-admin.php:226
120
  #, php-format
121
  msgid "These settings control the XML Sitemaps generated by the %s plugin."
122
  msgstr ""
123
 
124
+ #: includes/class-xmlsitemapfeed-admin.php:227
125
+ #: includes/class-xmlsitemapfeed-admin.php:467
126
  #, php-format
127
  msgid "For ping options, go to %s."
128
  msgstr ""
129
 
130
+ #: includes/class-xmlsitemapfeed-admin.php:240
131
  msgid "XML Sitemaps for post types"
132
  msgstr ""
133
 
134
+ #: includes/class-xmlsitemapfeed-admin.php:279
135
  msgid "Year"
136
  msgstr ""
137
 
138
+ #: includes/class-xmlsitemapfeed-admin.php:280
139
  msgid "Month"
140
  msgstr ""
141
 
142
+ #: includes/class-xmlsitemapfeed-admin.php:284
143
  msgid "Split by"
144
  msgstr ""
145
 
146
+ #: includes/class-xmlsitemapfeed-admin.php:294
147
  msgid ""
148
  "Split by year if you experience errors or slow sitemaps. In very rare cases, "
149
  "split by month is needed."
150
  msgstr ""
151
 
152
+ #: includes/class-xmlsitemapfeed-admin.php:299
153
+ #: includes/class-xmlsitemapfeed-admin.php:901
154
  msgid "Priority"
155
  msgstr ""
156
 
157
+ #: includes/class-xmlsitemapfeed-admin.php:301
158
  msgid "Priority can be overridden on individual posts."
159
  msgstr ""
160
 
161
+ #: includes/class-xmlsitemapfeed-admin.php:306
162
  msgid "Automatic Priority calculation."
163
  msgstr ""
164
 
165
+ #: includes/class-xmlsitemapfeed-admin.php:306
166
  msgid ""
167
  "Adjusts the Priority based on factors like age, comments, sticky post or "
168
  "blog page. Individual posts with fixed Priority will always keep that value."
169
  msgstr ""
170
 
171
+ #: includes/class-xmlsitemapfeed-admin.php:311
172
  msgid "Update Lastmod and Changefreq on comments."
173
  msgstr ""
174
 
175
+ #: includes/class-xmlsitemapfeed-admin.php:311
176
  msgid ""
177
  "Set this if discussion on your site warrants reindexation upon each new "
178
  "comment."
179
  msgstr ""
180
 
181
+ #: includes/class-xmlsitemapfeed-admin.php:315
182
+ #: includes/class-xmlsitemapfeed-admin.php:582
183
  msgid "Add image tags for"
184
  msgstr ""
185
 
186
+ #: includes/class-xmlsitemapfeed-admin.php:323
187
+ #: includes/class-xmlsitemapfeed-admin.php:589
188
  msgid "Attached images"
189
  msgstr ""
190
 
191
+ #: includes/class-xmlsitemapfeed-admin.php:333
192
  msgid ""
193
  "Priority settings do not affect ranking in search results in any way. They "
194
  "are only meant to suggest search engines which URLs to index first. Once a "
196
  "updated."
197
  msgstr ""
198
 
199
+ #: includes/class-xmlsitemapfeed-admin.php:334
200
  msgid ""
201
  "Maximum Priority (1.0) is reserved for the front page, individual posts and, "
202
  "when allowed, posts with high comment count."
203
  msgstr ""
204
 
205
+ #: includes/class-xmlsitemapfeed-admin.php:334
206
  msgid ""
207
  "Priority values are taken as relative values. Setting all to the same (high) "
208
  "value is pointless."
209
  msgstr ""
210
 
211
+ #: includes/class-xmlsitemapfeed-admin.php:384
212
  msgid "XML Sitemaps for taxonomies"
213
  msgstr ""
214
 
215
+ #: includes/class-xmlsitemapfeed-admin.php:390
216
  msgid ""
217
  "It is generally not recommended to include taxonomy pages, unless their "
218
  "content brings added value."
219
  msgstr ""
220
 
221
+ #: includes/class-xmlsitemapfeed-admin.php:391
222
  msgid ""
223
  "For example, when you use category descriptions with information that is not "
224
  "present elsewhere on your site or if taxonomy pages list posts with an "
229
  "disallowing indexation of taxonomies."
230
  msgstr ""
231
 
232
+ #: includes/class-xmlsitemapfeed-admin.php:392
233
  #, php-format
234
  msgid ""
235
  "You can do this by adding specific robots.txt rules in the %s field above."
236
  msgstr ""
237
 
238
+ #: includes/class-xmlsitemapfeed-admin.php:407
239
  msgid "No taxonomies available for the currently included post types."
240
  msgstr ""
241
 
242
+ #: includes/class-xmlsitemapfeed-admin.php:415
243
+ #: includes/class-xmlsitemapfeed-admin.php:1056
244
  msgid "Include custom XML Sitemaps"
245
  msgstr ""
246
 
247
+ #: includes/class-xmlsitemapfeed-admin.php:416
248
  msgid "Additional XML Sitemaps to append to the main XML Sitemap Index:"
249
  msgstr ""
250
 
251
+ #: includes/class-xmlsitemapfeed-admin.php:418
252
  msgid ""
253
  "Add the full URL, including protocol (http/https) and domain, of any XML "
254
  "Sitemap that you want to append to the Sitemap Index. Start each URL on a "
255
  "new line."
256
  msgstr ""
257
 
258
+ #: includes/class-xmlsitemapfeed-admin.php:418
259
  msgid ""
260
  "Only valid sitemaps are allowed in the Sitemap Index. Use your Google/Bing "
261
  "Webmaster Tools to verify!"
262
  msgstr ""
263
 
264
+ #: includes/class-xmlsitemapfeed-admin.php:435
265
+ #: includes/class-xmlsitemapfeed-admin.php:1053
266
  msgid "Include custom URLs"
267
  msgstr ""
268
 
269
+ #: includes/class-xmlsitemapfeed-admin.php:436
270
  msgid "Additional URLs to append in an extra XML Sitemap:"
271
  msgstr ""
272
 
273
+ #: includes/class-xmlsitemapfeed-admin.php:438
274
  msgid ""
275
  "Add the full URL, including protocol (http/https) and domain, of any "
276
  "(static) page that you want to append to the ones already included by "
278
  "space after the URL. Start each URL on a new line."
279
  msgstr ""
280
 
281
+ #: includes/class-xmlsitemapfeed-admin.php:448
282
+ #: includes/class-xmlsitemapfeed-admin.php:1050
283
  msgid "Allowed domains"
284
  msgstr ""
285
 
286
+ #: includes/class-xmlsitemapfeed-admin.php:449
287
  msgid "Additional domains to allow in the XML Sitemaps:"
288
  msgstr ""
289
 
290
+ #: includes/class-xmlsitemapfeed-admin.php:450
291
  #, php-format
292
  msgid ""
293
  "By default, only the domain %s as used in your WordPress site address is "
300
  "will be filtered."
301
  msgstr ""
302
 
303
+ #: includes/class-xmlsitemapfeed-admin.php:464
304
  #, php-format
305
  msgid ""
306
  "These settings control the Google News Sitemap generated by the %s plugin."
307
  msgstr ""
308
 
309
+ #: includes/class-xmlsitemapfeed-admin.php:465
310
  msgid ""
311
  "When you are done configuring and preparing your news content and you are "
312
  "convinced your site adheres to the <a href=\"https://support.google.com/news/"
315
  "target=\"_blank\">submit your site for inclusion</a>!"
316
  msgstr ""
317
 
318
+ #: includes/class-xmlsitemapfeed-admin.php:466
319
  msgid ""
320
  "It is strongly recommended to submit your news sitemap to your Google "
321
  "Webmasters Tools account to monitor for warnings or errors. Read more on how "
323
  "\"_blank\">Manage sitemaps with the Sitemaps page</a>."
324
  msgstr ""
325
 
326
+ #: includes/class-xmlsitemapfeed-admin.php:477
327
+ #: includes/class-xmlsitemapfeed-admin.php:1030
328
  msgid "Publication name"
329
  msgstr ""
330
 
331
+ #: includes/class-xmlsitemapfeed-admin.php:478
332
  #, php-format
333
  msgid "By default, the general %s setting will be used."
334
  msgstr ""
335
 
336
+ #: includes/class-xmlsitemapfeed-admin.php:479
337
  msgid ""
338
  "The publication name should match the name submitted on the Google News "
339
  "Publisher Center. If you wish to change it, please read <a href=\"https://"
341
  "publication name</a>."
342
  msgstr ""
343
 
344
+ #: includes/class-xmlsitemapfeed-admin.php:496
345
  msgid ""
346
  "Error: There where no valid post types found. Without at least one public "
347
  "post type, a Google News Sitemap cannot be created by this plugin. Please "
349
  "\">Enable XML sitemaps</a> and choose another method."
350
  msgstr ""
351
 
352
+ #: includes/class-xmlsitemapfeed-admin.php:499
353
+ #: includes/class-xmlsitemapfeed-admin.php:1031
354
+ #: includes/class-xmlsitemapfeed-admin.php:1044
355
  msgid "Include post types"
356
  msgstr ""
357
 
358
+ #: includes/class-xmlsitemapfeed-admin.php:525
359
  #, php-format
360
  msgid ""
361
  "At least one post type must be selected. By default, the post type %s will "
362
  "be used."
363
  msgstr ""
364
 
365
+ #: includes/class-xmlsitemapfeed-admin.php:536
366
  #, php-format
367
  msgid ""
368
  "Selection based on categories will be available when <strong>only</strong> "
369
  "the post type %s is included above."
370
  msgstr ""
371
 
372
+ #: includes/class-xmlsitemapfeed-admin.php:554
373
  msgid "Limit to posts in these post categories:"
374
  msgstr ""
375
 
376
+ #: includes/class-xmlsitemapfeed-admin.php:570
377
  msgid ""
378
  "If you wish to limit posts that will feature in your News Sitemap to certain "
379
  "categories, select them here. If no categories are selected, posts of all "
380
  "categories will be included in your News Sitemap."
381
  msgstr ""
382
 
383
+ #: includes/class-xmlsitemapfeed-admin.php:570
384
+ #: includes/class-xmlsitemapfeed-admin.php:650
385
  msgid "Use the Ctrl/Cmd key plus click to select more than one or to deselect."
386
  msgstr ""
387
 
388
+ #: includes/class-xmlsitemapfeed-admin.php:592
389
  msgid ""
390
  "Note: Google News prefers at most one image per article in the News Sitemap. "
391
  "If multiple valid images are specified, the crawler will have to pick one "
392
  "arbitrarily. Images in News Sitemaps should be in jpeg or png format."
393
  msgstr ""
394
 
395
+ #: includes/class-xmlsitemapfeed-admin.php:592
396
+ #: includes/class-xmlsitemapfeed-admin.php:599
397
  msgid "More information&hellip;"
398
  msgstr ""
399
 
400
+ #: includes/class-xmlsitemapfeed-admin.php:598
401
+ #: includes/class-xmlsitemapfeed-admin.php:1034
402
  msgid "Source labels"
403
  msgstr ""
404
 
405
+ #: includes/class-xmlsitemapfeed-admin.php:599
406
  #, php-format
407
  msgid ""
408
  "You can use the %1$s and %2$s tags to provide Google more information about "
409
  "the content of your articles."
410
  msgstr ""
411
 
412
+ #: includes/class-xmlsitemapfeed-admin.php:611
413
  #, php-format
414
  msgid ""
415
  "The %4$s tag specifies whether an article is available to all readers "
417
  "your site."
418
  msgstr ""
419
 
420
+ #: includes/class-xmlsitemapfeed-admin.php:611
421
+ #: includes/class-xmlsitemapfeed-admin.php:948
422
  msgid "Registration"
423
  msgstr ""
424
 
425
+ #: includes/class-xmlsitemapfeed-admin.php:611
426
+ #: includes/class-xmlsitemapfeed-admin.php:949
427
  msgid "Subscription"
428
  msgstr ""
429
 
430
+ #: includes/class-xmlsitemapfeed-admin.php:612
431
  msgid "You can assign a different access level when writing a post."
432
  msgstr ""
433
 
434
+ #: includes/class-xmlsitemapfeed-admin.php:616
435
  msgid "Tag normal posts as"
436
  msgstr ""
437
 
438
+ #: includes/class-xmlsitemapfeed-admin.php:618
439
+ #: includes/class-xmlsitemapfeed-admin.php:623
440
  msgid "Free registration"
441
  msgstr ""
442
 
443
+ #: includes/class-xmlsitemapfeed-admin.php:619
444
+ #: includes/class-xmlsitemapfeed-admin.php:624
445
  msgid "Paid subscription"
446
  msgstr ""
447
 
448
+ #: includes/class-xmlsitemapfeed-admin.php:622
449
  msgid "Tag Password Protected posts as"
450
  msgstr ""
451
 
452
+ #: includes/class-xmlsitemapfeed-admin.php:637
453
  #, php-format
454
  msgid ""
455
  "The %s tag specifies one or more properties for an article, namely, whether "
457
  "generated content, or satire."
458
  msgstr ""
459
 
460
+ #: includes/class-xmlsitemapfeed-admin.php:637
461
  msgid "You can assign different genres when writing a post."
462
  msgstr ""
463
 
464
+ #: includes/class-xmlsitemapfeed-admin.php:641
465
  msgid "Default genre:"
466
  msgstr ""
467
 
468
+ #: includes/class-xmlsitemapfeed-admin.php:650
469
  #, php-format
470
  msgid "Read more about source labels on %s"
471
  msgstr ""
472
 
473
+ #: includes/class-xmlsitemapfeed-admin.php:650
474
  msgid "What does each source label mean?"
475
  msgstr ""
476
 
477
+ #: includes/class-xmlsitemapfeed-admin.php:659
478
  #, php-format
479
  msgid ""
480
  "The %s tag is used to help classify the articles you submit to Google News "
481
  "by <strong>topic</strong>."
482
  msgstr ""
483
 
484
+ #: includes/class-xmlsitemapfeed-admin.php:661
485
  #, php-format
486
  msgid "Use %s for topics."
487
  msgstr ""
488
 
489
+ #: includes/class-xmlsitemapfeed-admin.php:668
490
  msgid "Default topic(s):"
491
  msgstr ""
492
 
493
+ #: includes/class-xmlsitemapfeed-admin.php:670
494
  msgid "Separate with a comma."
495
  msgstr ""
496
 
497
+ #: includes/class-xmlsitemapfeed-admin.php:674
498
  msgid ""
499
  "Keywords may be drawn from, but are not limited to, the list of <a href="
500
  "\"https://support.google.com/news/publisher/answer/116037\" target=\"_blank"
501
  "\">existing Google News keywords</a>."
502
  msgstr ""
503
 
504
+ #: includes/class-xmlsitemapfeed-admin.php:868
505
+ #: includes/class-xmlsitemapfeed-admin.php:1041
506
  msgid "XML Sitemap"
507
  msgstr ""
508
 
509
+ #: includes/class-xmlsitemapfeed-admin.php:903
510
  #, php-format
511
  msgid "Leave empty for automatic Priority as configured on %1$s > %2$s."
512
  msgstr ""
513
 
514
+ #: includes/class-xmlsitemapfeed-admin.php:907
515
  msgid "Exclude from XML Sitemap"
516
  msgstr ""
517
 
518
+ #: includes/class-xmlsitemapfeed-admin.php:919
519
  msgid "Google News"
520
  msgstr ""
521
 
522
+ #: includes/class-xmlsitemapfeed-admin.php:944
523
  msgid "Access"
524
  msgstr ""
525
 
526
+ #: includes/class-xmlsitemapfeed-admin.php:953
527
  msgid "Exclude from Google News Sitemap."
528
  msgstr ""
529
 
530
+ #: includes/class-xmlsitemapfeed-admin.php:1005
531
  msgid "Enable XML sitemaps"
532
  msgstr ""
533
 
534
+ #: includes/class-xmlsitemapfeed-admin.php:1047
535
  msgid "Include taxonomies"
536
  msgstr ""
537
 
538
+ #: includes/class-xmlsitemapfeed.php:1426
539
  msgid "Google News Genres"
540
  msgstr ""
541
 
542
+ #: includes/class-xmlsitemapfeed.php:1427
543
  msgid "Google News Genre"
544
  msgstr ""
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
4
  Tags: sitemap, xml sitemap, news sitemap, sitemap.xml, robots.txt, Google, Google News, Yahoo, Bing, , Yandex, Baidu, seo, feed, Polylang, WPML, image sitemap
5
  Requires at least: 3.2
6
- Tested up to: 4.8
7
- Stable tag: 4.7.5
8
 
9
  XML and Google News Sitemaps to feed the hungry spiders. Multisite, WP Super Cache, Polylang and WPML compatible.
10
 
@@ -272,7 +272,7 @@ Yes. In fact, it has been designed for it. Tested on WPMU 2.9.2 and WPMS 3+ both
272
  == Upgrade Notice ==
273
 
274
  = 4.8 =
275
- ... and several bug fixes.
276
 
277
  == Changelog ==
278
 
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=ravanhagen%40gmail%2ecom&item_name=XML%20Sitemap%20Feed
4
  Tags: sitemap, xml sitemap, news sitemap, sitemap.xml, robots.txt, Google, Google News, Yahoo, Bing, , Yandex, Baidu, seo, feed, Polylang, WPML, image sitemap
5
  Requires at least: 3.2
6
+ Tested up to: 4.9
7
+ Stable tag: 4.8
8
 
9
  XML and Google News Sitemaps to feed the hungry spiders. Multisite, WP Super Cache, Polylang and WPML compatible.
10
 
272
  == Upgrade Notice ==
273
 
274
  = 4.8 =
275
+ New conditional functions, ping URL, and several bug fixes.
276
 
277
  == Changelog ==
278
 
xml-sitemap.php CHANGED
@@ -4,12 +4,13 @@ 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.7.5
 
8
  Author: RavanH
9
  Author URI: http://status301.net/
10
  */
11
 
12
- /* Copyright 2016 RavanH
13
  http://status301.net/
14
  mailto: ravanhagen@gmail.com
15
 
@@ -28,20 +29,26 @@ Author URI: http://status301.net/
28
  * --------------------
29
  *
30
  * FILTERS
31
- * xmlsf_defaults -> Filters the default array values for different option groups.
32
- * xmlsf_allowed_domain -> Filters the response when checking the url against allowed domains.
33
- * Passes variable $url; must return true or false.
34
- * xmlsf_excluded -> Filters the response when checking the post for exclusion flags.
35
- * Passes variable $post_id; must return true or false.
36
- * the_title_xmlsitemap -> Filters the Google News publication name, title and keywords
37
- * plus the Image title and caption tags
38
- * xmlsf_custom_urls -> Filters the custom urls array
39
- * xmlsf_custom_sitemaps -> Filters the custom sitemaps array
40
  *
41
  * ACTIONS
42
- * xmlsf_news_tags_after -> Fired inside the Google News Sitemap loop at the end of the news
43
- * tags, just before each closing </news:news> is generated. Can be used to
44
- * echo custom tags or trigger another action in the background.
 
 
 
 
 
 
45
  *
46
  * Feel free to request, suggest or submit more :)
47
  */
@@ -52,7 +59,7 @@ if ( ! defined( 'WPINC' ) ) die;
52
  * CONSTANTS
53
  * -------------------- */
54
 
55
- define('XMLSF_VERSION', '4.7.5');
56
 
57
  define('XMLSF_PLUGIN_BASENAME', plugin_basename(__FILE__));
58
 
@@ -103,7 +110,7 @@ $xmlsf_dir = dirname(__FILE__);
103
  if ( file_exists ( $xmlsf_dir.'/xml-sitemap-feed' ) )
104
  $xmlsf_dir .= '/xml-sitemap-feed';
105
 
106
- include_once( $xmlsf_dir.'/hacks.php' );
107
  include_once( $xmlsf_dir.'/includes/class-xmlsitemapfeed.php' );
108
 
109
  /* ----------------------
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.8
8
+ Requires PHP: 5.6
9
  Author: RavanH
10
  Author URI: http://status301.net/
11
  */
12
 
13
+ /* Copyright 2018 RavanH
14
  http://status301.net/
15
  mailto: ravanhagen@gmail.com
16
 
29
  * --------------------
30
  *
31
  * FILTERS
32
+ * xmlsf_defaults -> Filters the default array values for different option groups.
33
+ * xmlsf_allowed_domain -> Filters the response when checking the url against allowed domains.
34
+ * Passes variable $url; must return true or false.
35
+ * xmlsf_excluded -> Filters the response when checking the post for exclusion flags.
36
+ * Passes variable $post_id; must return true or false.
37
+ * the_title_xmlsitemap -> Filters the Google News publication name, title and keywords
38
+ * plus the Image title and caption tags
39
+ * xmlsf_custom_urls -> Filters the custom urls array
40
+ * xmlsf_custom_sitemaps -> Filters the custom sitemaps array
41
  *
42
  * ACTIONS
43
+ * xmlsf_news_tags_after -> Fired inside the Google News Sitemap loop at the end of the news
44
+ * tags, just before each closing </news:news> is generated. Can be used to
45
+ * echo custom tags or trigger another action in the background.
46
+ *
47
+ * --------------------
48
+ * AVAILABLE FUNCTIONS
49
+ * --------------------
50
+ * is_sitemap() -> conditional, returns bolean, true if the request is for an xml sitemap
51
+ * is_news() -> conditional, returns bolean, true if the request is for an xml news sitemap
52
  *
53
  * Feel free to request, suggest or submit more :)
54
  */
59
  * CONSTANTS
60
  * -------------------- */
61
 
62
+ define('XMLSF_VERSION', '4.8');
63
 
64
  define('XMLSF_PLUGIN_BASENAME', plugin_basename(__FILE__));
65
 
110
  if ( file_exists ( $xmlsf_dir.'/xml-sitemap-feed' ) )
111
  $xmlsf_dir .= '/xml-sitemap-feed';
112
 
113
+ include_once( $xmlsf_dir.'/includes/functions.php' );
114
  include_once( $xmlsf_dir.'/includes/class-xmlsitemapfeed.php' );
115
 
116
  /* ----------------------