Version Description
- FIX: double genre terms on upgrade from 4.4, thanks @mouhalves
- FIX: wp_count_posts uncached and too heavy on large sites, thanks @carlalexander
- Last-modified response header now linked to Update on comments setting
- FIX: plugin_basename propagation
Download this release
Release Info
Developer | RavanH |
Plugin | XML Sitemap & Google News feeds |
Version | 4.9.1 |
Comparing to | |
See all releases |
Code changes from version 4.9 to 4.9.1
- includes/class-xmlsitemapfeed-admin.php +31 -16
- includes/class-xmlsitemapfeed.php +85 -73
- includes/xsl/sitemap-index.xsl +3 -3
- readme.txt +9 -2
- xml-sitemap.php +2 -3
includes/class-xmlsitemapfeed-admin.php
CHANGED
@@ -625,8 +625,7 @@ jQuery( document ).ready( function() {
|
|
625 |
</fieldset>';
|
626 |
|
627 |
// genres tag
|
628 |
-
$
|
629 |
-
$gn_translations = $gn_genres = array(
|
630 |
'PressRelease' => __('PressRelease','xml-sitemap-feed'),
|
631 |
'Satire' => __('Satire','xml-sitemap-feed'),
|
632 |
'Blog' => __('Blog','xml-sitemap-feed'),
|
@@ -645,8 +644,8 @@ jQuery( document ).ready( function() {
|
|
645 |
echo '</p>
|
646 |
<p class="description">'.__('Use Ctrl plus click to select more than one or to deselect.','xml-sitemap-feed').' '.__('The FactCheck label may be applied if you publish stories with fact-checking content that\'s indicated by schema.org ClaimReview markup.','xml-sitemap-feed').' '.sprintf(__('Read more about source labels on %s','xml-sitemap-feed'),'<a href="https://support.google.com/news/publisher/answer/4582731" target="_blank">'.__('What does each source label mean?','xml-sitemap-feed').'</a>').'</p>
|
647 |
<ul>
|
648 |
-
<li><label>'.__('Default genre:','xml-sitemap-feed').'<br><select multiple name="'.$this->prefix.'news_tags[genres][default][]" id="xmlsf_news_tags_genres_default" size="'.count($gn_genres).'">';
|
649 |
-
foreach ( $gn_genres as $name ) {
|
650 |
echo '<option value="'.$name.'" '.selected( in_array($name,$genres_default), true, false ).'>' . ( isset($gn_translations[$name]) && !empty($gn_translations[$name]) ? $gn_translations[$name] : $name ) . ' </option>';
|
651 |
}
|
652 |
echo '
|
@@ -879,7 +878,7 @@ jQuery( document ).ready( function() {
|
|
879 |
|
880 |
public function meta_box($post) {
|
881 |
// Use nonce for verification
|
882 |
-
wp_nonce_field( plugin_basename
|
883 |
|
884 |
// The actual fields for data entry
|
885 |
// Use get_post_meta to retrieve an existing value from the database and use the value for the form
|
@@ -930,7 +929,7 @@ jQuery( document ).ready( function() {
|
|
930 |
|
931 |
public function meta_box_news($post) {
|
932 |
// Use nonce for verification
|
933 |
-
wp_nonce_field( plugin_basename
|
934 |
|
935 |
// The actual fields for data entry
|
936 |
// Use get_post_meta to retrieve an existing value from the database and use the value for the form
|
@@ -962,7 +961,7 @@ jQuery( document ).ready( function() {
|
|
962 |
if ( !isset($post_id) )
|
963 |
$post_id = (int)$_REQUEST['post_ID'];
|
964 |
|
965 |
-
if ( !current_user_can( 'edit_post', $post_id ) || !isset($_POST['xmlsf_sitemap_nonce']) || !wp_verify_nonce($_POST['xmlsf_sitemap_nonce'], plugin_basename
|
966 |
return;
|
967 |
|
968 |
// _xmlsf_priority
|
@@ -1010,11 +1009,33 @@ jQuery( document ).ready( function() {
|
|
1010 |
}
|
1011 |
|
1012 |
// CATCH TRANSIENT for recreating terms
|
1013 |
-
if ( delete_transient('xmlsf_create_genres') ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1014 |
foreach ($this->gn_genres as $name) {
|
1015 |
wp_insert_term( $name, 'gn-genre' );
|
1016 |
}
|
1017 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1018 |
}
|
1019 |
|
1020 |
/**
|
@@ -1028,7 +1049,6 @@ jQuery( document ).ready( function() {
|
|
1028 |
register_setting('reading', $this->prefix.'sitemaps', array($this,'sanitize_sitemaps_settings') );
|
1029 |
add_settings_field($this->prefix.'sitemaps', __('Enable XML sitemaps','xml-sitemap-feed'), array($this,'sitemaps_settings_field'), 'reading');
|
1030 |
|
1031 |
-
|
1032 |
// robots rules only when permalinks are set
|
1033 |
$rules = get_option( 'rewrite_rules' );
|
1034 |
if( get_option('permalink_structure') && isset( $rules['robots\.txt$'] ) ) {
|
@@ -1091,7 +1111,8 @@ jQuery( document ).ready( function() {
|
|
1091 |
* CONSTRUCTOR
|
1092 |
*/
|
1093 |
|
1094 |
-
function __construct() {
|
|
|
1095 |
|
1096 |
// ACTION LINK
|
1097 |
add_filter('plugin_action_links_' . $this->plugin_basename, array($this, 'add_action_link') );
|
@@ -1101,9 +1122,3 @@ jQuery( document ).ready( function() {
|
|
1101 |
$this->register_settings();
|
1102 |
}
|
1103 |
}
|
1104 |
-
|
1105 |
-
/* ----------------------
|
1106 |
-
* INSTANTIATE
|
1107 |
-
* ---------------------- */
|
1108 |
-
|
1109 |
-
$xmlsf_admin = new XMLSitemapFeed_Admin();
|
625 |
</fieldset>';
|
626 |
|
627 |
// genres tag
|
628 |
+
$gn_translations = array(
|
|
|
629 |
'PressRelease' => __('PressRelease','xml-sitemap-feed'),
|
630 |
'Satire' => __('Satire','xml-sitemap-feed'),
|
631 |
'Blog' => __('Blog','xml-sitemap-feed'),
|
644 |
echo '</p>
|
645 |
<p class="description">'.__('Use Ctrl plus click to select more than one or to deselect.','xml-sitemap-feed').' '.__('The FactCheck label may be applied if you publish stories with fact-checking content that\'s indicated by schema.org ClaimReview markup.','xml-sitemap-feed').' '.sprintf(__('Read more about source labels on %s','xml-sitemap-feed'),'<a href="https://support.google.com/news/publisher/answer/4582731" target="_blank">'.__('What does each source label mean?','xml-sitemap-feed').'</a>').'</p>
|
646 |
<ul>
|
647 |
+
<li><label>'.__('Default genre:','xml-sitemap-feed').'<br><select multiple name="'.$this->prefix.'news_tags[genres][default][]" id="xmlsf_news_tags_genres_default" size="'.count($this->gn_genres).'">';
|
648 |
+
foreach ( $this->gn_genres as $name ) {
|
649 |
echo '<option value="'.$name.'" '.selected( in_array($name,$genres_default), true, false ).'>' . ( isset($gn_translations[$name]) && !empty($gn_translations[$name]) ? $gn_translations[$name] : $name ) . ' </option>';
|
650 |
}
|
651 |
echo '
|
878 |
|
879 |
public function meta_box($post) {
|
880 |
// Use nonce for verification
|
881 |
+
wp_nonce_field( $this->plugin_basename, 'xmlsf_sitemap_nonce' );
|
882 |
|
883 |
// The actual fields for data entry
|
884 |
// Use get_post_meta to retrieve an existing value from the database and use the value for the form
|
929 |
|
930 |
public function meta_box_news($post) {
|
931 |
// Use nonce for verification
|
932 |
+
wp_nonce_field( $this->plugin_basename, 'xmlsf_sitemap_nonce' );
|
933 |
|
934 |
// The actual fields for data entry
|
935 |
// Use get_post_meta to retrieve an existing value from the database and use the value for the form
|
961 |
if ( !isset($post_id) )
|
962 |
$post_id = (int)$_REQUEST['post_ID'];
|
963 |
|
964 |
+
if ( !current_user_can( 'edit_post', $post_id ) || !isset($_POST['xmlsf_sitemap_nonce']) || !wp_verify_nonce($_POST['xmlsf_sitemap_nonce'], $this->plugin_basename) )
|
965 |
return;
|
966 |
|
967 |
// _xmlsf_priority
|
1009 |
}
|
1010 |
|
1011 |
// CATCH TRANSIENT for recreating terms
|
1012 |
+
if ( delete_transient('xmlsf_create_genres') && taxonomy_exists('gn-genre') ) {
|
1013 |
+
|
1014 |
+
// check if terms already exist and if they have the old slug
|
1015 |
+
$terms = get_terms( 'gn-genre', array('hide_empty' => false) );
|
1016 |
+
if ( is_array($terms) && !empty($terms) ) {
|
1017 |
+
foreach ( $terms as $term ) {
|
1018 |
+
if ( in_array($term->name,$this->gn_genres) ) {
|
1019 |
+
$slug = strtolower($term->name);
|
1020 |
+
if ( $term->slug !== $slug )
|
1021 |
+
wp_update_term( $term->term_id, 'gn-genre', array(
|
1022 |
+
'slug' => $slug
|
1023 |
+
) );
|
1024 |
+
}
|
1025 |
+
}
|
1026 |
+
}
|
1027 |
+
|
1028 |
foreach ($this->gn_genres as $name) {
|
1029 |
wp_insert_term( $name, 'gn-genre' );
|
1030 |
}
|
1031 |
}
|
1032 |
+
|
1033 |
+
// CATCH TRANSIENT for static file warning
|
1034 |
+
$files = get_transient('xmlsf_static_files_found');
|
1035 |
+
if ( !empty($files) ) {
|
1036 |
+
// TODO admin message about static files: explode(', ',$files);
|
1037 |
+
// with option to ignore or delete files or check again...
|
1038 |
+
}
|
1039 |
}
|
1040 |
|
1041 |
/**
|
1049 |
register_setting('reading', $this->prefix.'sitemaps', array($this,'sanitize_sitemaps_settings') );
|
1050 |
add_settings_field($this->prefix.'sitemaps', __('Enable XML sitemaps','xml-sitemap-feed'), array($this,'sitemaps_settings_field'), 'reading');
|
1051 |
|
|
|
1052 |
// robots rules only when permalinks are set
|
1053 |
$rules = get_option( 'rewrite_rules' );
|
1054 |
if( get_option('permalink_structure') && isset( $rules['robots\.txt$'] ) ) {
|
1111 |
* CONSTRUCTOR
|
1112 |
*/
|
1113 |
|
1114 |
+
function __construct( $basename = 'xml-sitemap-feed/xml-sitemap.php' ) {
|
1115 |
+
$this->plugin_basename = $basename;
|
1116 |
|
1117 |
// ACTION LINK
|
1118 |
add_filter('plugin_action_links_' . $this->plugin_basename, array($this, 'add_action_link') );
|
1122 |
$this->register_settings();
|
1123 |
}
|
1124 |
}
|
|
|
|
|
|
|
|
|
|
|
|
includes/class-xmlsitemapfeed.php
CHANGED
@@ -213,9 +213,7 @@ class XMLSitemapFeed {
|
|
213 |
}
|
214 |
|
215 |
if ( isset($this->defaults['post_types']['post']) ) {
|
216 |
-
|
217 |
-
$this->defaults['post_types']['post']['archive'] = 'yearly';
|
218 |
-
}
|
219 |
$this->defaults['post_types']['post']['priority'] = '0.7';
|
220 |
$this->defaults['post_types']['post']['dynamic_priority'] = '1';
|
221 |
}
|
@@ -541,7 +539,7 @@ class XMLSitemapFeed {
|
|
541 |
is_string($type) &&
|
542 |
isset($return[$type]) &&
|
543 |
!empty($return[$type]['tags'])
|
544 |
-
) ? (array)$return[$type]['tags'] : array();
|
545 |
}
|
546 |
|
547 |
/**
|
@@ -683,10 +681,10 @@ class XMLSitemapFeed {
|
|
683 |
|
684 |
if( !empty($options[$post->post_type]['update_lastmod_on_comments']) )
|
685 |
$lastcomment = get_comments( array(
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
|
691 |
if ( isset($lastcomment[0]->comment_date_gmt) )
|
692 |
if ( mysql2date( 'U', $lastcomment[0]->comment_date_gmt, false ) > mysql2date( 'U', $postmodified, false ) )
|
@@ -1188,6 +1186,9 @@ class XMLSitemapFeed {
|
|
1188 |
|
1189 |
if ( isset($request['feed']) && strpos($request['feed'],'sitemap') === 0 ) :
|
1190 |
|
|
|
|
|
|
|
1191 |
// CONTENT_TYPE and REPSONSE HEADERS filtering function
|
1192 |
add_filter( 'feed_content_type', array($this, 'content_type') );
|
1193 |
add_filter( 'wp_headers', array($this, 'headers') );
|
@@ -1240,12 +1241,18 @@ class XMLSitemapFeed {
|
|
1240 |
return $request;
|
1241 |
}
|
1242 |
|
1243 |
-
|
1244 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1245 |
|
1246 |
// prepare for post types and return modified request
|
1247 |
if ( strpos($request['feed'],'sitemap-posttype') === 0 ) {
|
1248 |
-
foreach ( $
|
1249 |
if ( $request['feed'] == 'sitemap-posttype-'.$post_type['name'] ) {
|
1250 |
// setup filter
|
1251 |
add_filter( 'post_limits', array($this, 'filter_limits') );
|
@@ -1259,6 +1266,8 @@ class XMLSitemapFeed {
|
|
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 ) {
|
@@ -1617,64 +1626,66 @@ class XMLSitemapFeed {
|
|
1617 |
// ... but make sure rules are regenerated when admin is visited.
|
1618 |
set_transient( 'xmlsf_flush_rewrite_rules', '' );
|
1619 |
|
1620 |
-
//
|
1621 |
-
|
1622 |
-
$robot_rules = str_replace(array('Disallow: */wp-content/','Allow: */wp-content/uploads/'),'',$robot_rules);
|
1623 |
-
delete_option( $this->prefix.'robots' );
|
1624 |
-
add_option( $this->prefix.'robots', $robot_rules, '', 'no' );
|
1625 |
-
}
|
1626 |
|
1627 |
-
if (
|
1628 |
-
// register location taxonomies then delete all terms
|
1629 |
-
register_taxonomy( 'gn-location-3', null );
|
1630 |
-
$terms = get_terms( 'gn-location-3', array('hide_empty' => false) );
|
1631 |
-
foreach ( $terms as $term ) {
|
1632 |
-
wp_delete_term( $term->term_id, 'gn-location-3' );
|
1633 |
-
}
|
1634 |
|
1635 |
-
|
1636 |
-
|
1637 |
-
|
1638 |
-
|
1639 |
-
|
|
|
|
|
1640 |
|
1641 |
-
|
1642 |
-
|
1643 |
-
|
1644 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1645 |
}
|
1646 |
-
}
|
1647 |
|
1648 |
-
|
1649 |
-
|
1650 |
-
|
1651 |
-
|
1652 |
-
|
1653 |
-
|
1654 |
-
|
1655 |
-
foreach ($this->gn_genres as $name) {
|
1656 |
-
wp_insert_term( $name, 'gn-genre' );
|
1657 |
-
}
|
1658 |
-
}
|
1659 |
|
1660 |
-
|
1661 |
-
|
1662 |
-
|
1663 |
-
|
1664 |
-
|
1665 |
-
|
1666 |
-
|
1667 |
-
|
1668 |
-
|
1669 |
-
|
1670 |
-
// and set array
|
1671 |
-
$ping[$se]['pong'] = $arr;
|
1672 |
}
|
1673 |
}
|
1674 |
-
|
1675 |
-
|
1676 |
-
|
1677 |
-
|
|
|
|
|
|
|
1678 |
|
1679 |
update_option( $this->prefix.'version', XMLSF_VERSION );
|
1680 |
|
@@ -1694,26 +1705,27 @@ class XMLSitemapFeed {
|
|
1694 |
}
|
1695 |
|
1696 |
/**
|
1697 |
-
*
|
1698 |
*/
|
1699 |
-
public function
|
1700 |
-
|
1701 |
-
$this->flush_rules();
|
1702 |
|
1703 |
-
// try to remove static sitemap files, but only if
|
1704 |
-
// this is not a multisite or we're on the main site or network activating
|
1705 |
if ( !is_multisite() || is_main_site() || is_network_admin() ) {
|
1706 |
-
// CHECK FOR STATIC SITEMAP FILES, DELETE IF EXIST
|
1707 |
$home_path = trailingslashit( get_home_path() );
|
1708 |
$sitemaps = $this->get_sitemaps();
|
1709 |
foreach ( $sitemaps as $name => $pretty ) {
|
1710 |
if ( file_exists( $home_path . $pretty ) ) {
|
1711 |
-
|
1712 |
}
|
1713 |
}
|
1714 |
}
|
|
|
|
|
|
|
|
|
1715 |
}
|
1716 |
|
|
|
1717 |
/**
|
1718 |
* Init
|
1719 |
*/
|
@@ -1755,6 +1767,8 @@ class XMLSitemapFeed {
|
|
1755 |
public function admin_init() {
|
1756 |
// Include the admin class file
|
1757 |
include_once( dirname( __FILE__ ) . '/class-xmlsitemapfeed-admin.php' );
|
|
|
|
|
1758 |
}
|
1759 |
|
1760 |
/**
|
@@ -1825,7 +1839,7 @@ class XMLSitemapFeed {
|
|
1825 |
* CONSTRUCTOR
|
1826 |
*/
|
1827 |
|
1828 |
-
function __construct( $basename = 'xml-sitemap-feed/xml-sitemap.php') {
|
1829 |
$this->plugin_basename = $basename;
|
1830 |
|
1831 |
// sitemap element filters
|
@@ -1862,8 +1876,6 @@ class XMLSitemapFeed {
|
|
1862 |
|
1863 |
// NGINX HELPER PURGE URLS
|
1864 |
add_filter( 'rt_nginx_helper_purge_urls', array($this, 'nginx_helper_purge_urls'), 10, 2 );
|
1865 |
-
|
1866 |
-
// ACTIVATION
|
1867 |
-
register_activation_hook( $basename, array($this, 'activate') );
|
1868 |
}
|
|
|
1869 |
}
|
213 |
}
|
214 |
|
215 |
if ( isset($this->defaults['post_types']['post']) ) {
|
216 |
+
$this->defaults['post_types']['post']['archive'] = 'yearly';
|
|
|
|
|
217 |
$this->defaults['post_types']['post']['priority'] = '0.7';
|
218 |
$this->defaults['post_types']['post']['dynamic_priority'] = '1';
|
219 |
}
|
539 |
is_string($type) &&
|
540 |
isset($return[$type]) &&
|
541 |
!empty($return[$type]['tags'])
|
542 |
+
) ? (array) $return[$type]['tags'] : array();
|
543 |
}
|
544 |
|
545 |
/**
|
681 |
|
682 |
if( !empty($options[$post->post_type]['update_lastmod_on_comments']) )
|
683 |
$lastcomment = get_comments( array(
|
684 |
+
'status' => 'approve',
|
685 |
+
'number' => 1,
|
686 |
+
'post_id' => $post->ID,
|
687 |
+
) );
|
688 |
|
689 |
if ( isset($lastcomment[0]->comment_date_gmt) )
|
690 |
if ( mysql2date( 'U', $lastcomment[0]->comment_date_gmt, false ) > mysql2date( 'U', $postmodified, false ) )
|
1186 |
|
1187 |
if ( isset($request['feed']) && strpos($request['feed'],'sitemap') === 0 ) :
|
1188 |
|
1189 |
+
// set the normal sitemap conditional tag
|
1190 |
+
$this->is_sitemap = true;
|
1191 |
+
|
1192 |
// CONTENT_TYPE and REPSONSE HEADERS filtering function
|
1193 |
add_filter( 'feed_content_type', array($this, 'content_type') );
|
1194 |
add_filter( 'wp_headers', array($this, 'headers') );
|
1241 |
return $request;
|
1242 |
}
|
1243 |
|
1244 |
+
$options = $this->get_post_types();
|
1245 |
+
|
1246 |
+
foreach ( $options as $post_type ) {
|
1247 |
+
if( !empty($post_type['update_lastmod_on_comments']) ) {
|
1248 |
+
$request['withcomments'] = true;
|
1249 |
+
break;
|
1250 |
+
}
|
1251 |
+
}
|
1252 |
|
1253 |
// prepare for post types and return modified request
|
1254 |
if ( strpos($request['feed'],'sitemap-posttype') === 0 ) {
|
1255 |
+
foreach ( $options as $post_type ) {
|
1256 |
if ( $request['feed'] == 'sitemap-posttype-'.$post_type['name'] ) {
|
1257 |
// setup filter
|
1258 |
add_filter( 'post_limits', array($this, 'filter_limits') );
|
1266 |
}
|
1267 |
}
|
1268 |
|
1269 |
+
// for index and custom sitemap, nothing (else) to do (yet)
|
1270 |
+
|
1271 |
// prepare for taxonomies and return modified request
|
1272 |
if ( strpos($request['feed'],'sitemap-taxonomy') === 0 ) {
|
1273 |
foreach ( $this->get_taxonomies() as $taxonomy ) {
|
1626 |
// ... but make sure rules are regenerated when admin is visited.
|
1627 |
set_transient( 'xmlsf_flush_rewrite_rules', '' );
|
1628 |
|
1629 |
+
// set this up with a transient too !! get_home_path function not available on init !?!
|
1630 |
+
//$this->check_static_files();
|
|
|
|
|
|
|
|
|
1631 |
|
1632 |
+
if ( $old_version !== 0 ) :
|
|
|
|
|
|
|
|
|
|
|
|
|
1633 |
|
1634 |
+
if ( version_compare('4.4', $old_version, '>') ) {
|
1635 |
+
// remove robots.txt rules blocking stylesheets
|
1636 |
+
if ( $robot_rules = get_option($this->prefix.'robots') ) {
|
1637 |
+
$robot_rules = str_replace(array('Disallow: */wp-content/','Allow: */wp-content/uploads/'),'',$robot_rules);
|
1638 |
+
delete_option( $this->prefix.'robots' );
|
1639 |
+
add_option( $this->prefix.'robots', $robot_rules, '', 'no' );
|
1640 |
+
}
|
1641 |
|
1642 |
+
// upgrade pings
|
1643 |
+
if ( $pong = get_option( $this->prefix.'pong' ) and is_array($pong) ) { // use 'and' here for precedence of the assignement operator, thanks @kitchin
|
1644 |
+
$ping = $this->get_ping();
|
1645 |
+
foreach ( $pong as $se => $arr) {
|
1646 |
+
if ( is_array( $arr ) ) {
|
1647 |
+
// convert formatted time to unix time
|
1648 |
+
foreach ( $arr as $pretty => $date ) {
|
1649 |
+
$time = strtotime($date);
|
1650 |
+
$arr[$pretty] = (int)$time < time() ? $time : '';
|
1651 |
+
}
|
1652 |
+
// and set array
|
1653 |
+
$ping[$se]['pong'] = $arr;
|
1654 |
+
}
|
1655 |
+
}
|
1656 |
+
delete_option( $this->prefix.'pong' );
|
1657 |
+
delete_option( $this->prefix.'ping' );
|
1658 |
+
add_option( $this->prefix.'ping', array_merge( $this->defaults('ping'), $ping ), '', 'no' );
|
1659 |
+
}
|
1660 |
}
|
|
|
1661 |
|
1662 |
+
if ( version_compare('4.4.1', $old_version, '>') ) {
|
1663 |
+
// register location taxonomies then delete all terms
|
1664 |
+
register_taxonomy( 'gn-location-3', null );
|
1665 |
+
$terms = get_terms( 'gn-location-3', array('hide_empty' => false) );
|
1666 |
+
foreach ( $terms as $term ) {
|
1667 |
+
wp_delete_term( $term->term_id, 'gn-location-3' );
|
1668 |
+
}
|
|
|
|
|
|
|
|
|
1669 |
|
1670 |
+
register_taxonomy( 'gn-location-2', null );
|
1671 |
+
$terms = get_terms( 'gn-location-2',array('hide_empty' => false) );
|
1672 |
+
foreach ( $terms as $term ) {
|
1673 |
+
wp_delete_term( $term->term_id, 'gn-location-2' );
|
1674 |
+
}
|
1675 |
+
|
1676 |
+
register_taxonomy( 'gn-location-1', null );
|
1677 |
+
$terms = get_terms( 'gn-location-1',array('hide_empty' => false) );
|
1678 |
+
foreach ( $terms as $term ) {
|
1679 |
+
wp_delete_term( $term->term_id, 'gn-location-1' );
|
|
|
|
|
1680 |
}
|
1681 |
}
|
1682 |
+
|
1683 |
+
if ( version_compare('4.9', $old_version, '>') ) {
|
1684 |
+
// flag to rebuild taxonomy terms
|
1685 |
+
set_transient('xmlsf_create_genres','');
|
1686 |
+
};
|
1687 |
+
|
1688 |
+
endif;
|
1689 |
|
1690 |
update_option( $this->prefix.'version', XMLSF_VERSION );
|
1691 |
|
1705 |
}
|
1706 |
|
1707 |
/**
|
1708 |
+
* Check for static sitemap files
|
1709 |
*/
|
1710 |
+
public function check_static_files() {
|
1711 |
+
$files = array();
|
|
|
1712 |
|
|
|
|
|
1713 |
if ( !is_multisite() || is_main_site() || is_network_admin() ) {
|
|
|
1714 |
$home_path = trailingslashit( get_home_path() );
|
1715 |
$sitemaps = $this->get_sitemaps();
|
1716 |
foreach ( $sitemaps as $name => $pretty ) {
|
1717 |
if ( file_exists( $home_path . $pretty ) ) {
|
1718 |
+
$files[] = $home_path . $pretty;
|
1719 |
}
|
1720 |
}
|
1721 |
}
|
1722 |
+
|
1723 |
+
if ( !empty($files) ) {
|
1724 |
+
set_transient('xmlsf_static_files_found', $files);
|
1725 |
+
}
|
1726 |
}
|
1727 |
|
1728 |
+
|
1729 |
/**
|
1730 |
* Init
|
1731 |
*/
|
1767 |
public function admin_init() {
|
1768 |
// Include the admin class file
|
1769 |
include_once( dirname( __FILE__ ) . '/class-xmlsitemapfeed-admin.php' );
|
1770 |
+
|
1771 |
+
new XMLSitemapFeed_Admin( $this->plugin_basename );
|
1772 |
}
|
1773 |
|
1774 |
/**
|
1839 |
* CONSTRUCTOR
|
1840 |
*/
|
1841 |
|
1842 |
+
function __construct( $basename = 'xml-sitemap-feed/xml-sitemap.php' ) {
|
1843 |
$this->plugin_basename = $basename;
|
1844 |
|
1845 |
// sitemap element filters
|
1876 |
|
1877 |
// NGINX HELPER PURGE URLS
|
1878 |
add_filter( 'rt_nginx_helper_purge_urls', array($this, 'nginx_helper_purge_urls'), 10, 2 );
|
|
|
|
|
|
|
1879 |
}
|
1880 |
+
|
1881 |
}
|
includes/xsl/sitemap-index.xsl
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
-
<xsl:stylesheet version="2.0"
|
3 |
xmlns:html="http://www.w3.org/TR/REC-html40"
|
4 |
-
xmlns:sitemap="http://www.sitemaps.org/schemas/sitemap/0.9"
|
5 |
-
sitemap:news="http://www.google.com/schemas/sitemap-news/0.9"
|
6 |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
7 |
<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
|
8 |
<xsl:template match="/">
|
1 |
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<xsl:stylesheet version="2.0"
|
3 |
xmlns:html="http://www.w3.org/TR/REC-html40"
|
4 |
+
xmlns:sitemap="http://www.sitemaps.org/schemas/sitemap/0.9"
|
5 |
+
sitemap:news="http://www.google.com/schemas/sitemap-news/0.9"
|
6 |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
7 |
<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
|
8 |
<xsl:template match="/">
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=ravan
|
|
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.9
|
8 |
|
9 |
XML and Google News Sitemaps to feed the hungry spiders. Multisite, WP Super Cache, Polylang and WPML compatible.
|
10 |
|
@@ -272,10 +272,17 @@ 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.9 =
|
275 |
-
|
|
|
276 |
|
277 |
== Changelog ==
|
278 |
|
|
|
|
|
|
|
|
|
|
|
|
|
279 |
= 4.9 =
|
280 |
* Code cleanup
|
281 |
* NEW: FactCheck genre
|
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.9.1
|
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.9 =
|
275 |
+
Bugfix release.
|
276 |
+
|
277 |
|
278 |
== Changelog ==
|
279 |
|
280 |
+
= 4.9.1 =
|
281 |
+
* FIX: double genre terms on upgrade from 4.4, thanks @mouhalves
|
282 |
+
* FIX: wp_count_posts uncached and too heavy on large sites, thanks @carlalexander
|
283 |
+
* Last-modified response header now linked to Update on comments setting
|
284 |
+
* FIX: plugin_basename propagation
|
285 |
+
|
286 |
= 4.9 =
|
287 |
* Code cleanup
|
288 |
* NEW: FactCheck genre
|
xml-sitemap.php
CHANGED
@@ -4,7 +4,7 @@ Plugin Name: XML Sitemap & Google News feeds
|
|
4 |
Plugin URI: http://status301.net/wordpress-plugins/xml-sitemap-feed/
|
5 |
Description: Feed the hungry spiders in compliance with the XML Sitemap and Google News protocols. Happy with the results? Please leave me a <strong><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=ravanhagen%40gmail%2ecom&item_name=XML%20Sitemap%20Feed">tip</a></strong> for continued development and support. Thanks :)
|
6 |
Text Domain: xml-sitemap-feed
|
7 |
-
Version: 4.9
|
8 |
Requires PHP: 5.6
|
9 |
Author: RavanH
|
10 |
Author URI: http://status301.net/
|
@@ -59,7 +59,7 @@ if ( ! defined( 'WPINC' ) ) die;
|
|
59 |
* CONSTANTS
|
60 |
* -------------------- */
|
61 |
|
62 |
-
define('XMLSF_VERSION', '4.9');
|
63 |
|
64 |
/*
|
65 |
* The following constants can be used to change plugin defaults
|
@@ -96,7 +96,6 @@ if ( !defined('XMLSF_NEWS_NAME') )
|
|
96 |
* define('XMLSF_MULTISITE_UNINSTALL', true);
|
97 |
*/
|
98 |
|
99 |
-
|
100 |
/* -------------------------------------
|
101 |
* INCLUDE HACKS & CLASS
|
102 |
* ------------------------------------- */
|
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">tip</a></strong> for continued development and support. Thanks :)
|
6 |
Text Domain: xml-sitemap-feed
|
7 |
+
Version: 4.9.1
|
8 |
Requires PHP: 5.6
|
9 |
Author: RavanH
|
10 |
Author URI: http://status301.net/
|
59 |
* CONSTANTS
|
60 |
* -------------------- */
|
61 |
|
62 |
+
define('XMLSF_VERSION', '4.9.1');
|
63 |
|
64 |
/*
|
65 |
* The following constants can be used to change plugin defaults
|
96 |
* define('XMLSF_MULTISITE_UNINSTALL', true);
|
97 |
*/
|
98 |
|
|
|
99 |
/* -------------------------------------
|
100 |
* INCLUDE HACKS & CLASS
|
101 |
* ------------------------------------- */
|