Version Description
Bugfix release: options page and news pings.
=
Download this release
Release Info
Developer | deployer |
Plugin | XML Sitemap & Google News feeds |
Version | 5.1.1 |
Comparing to | |
See all releases |
Code changes from version 5.1 to 5.1.1
- controllers/admin/main.php +8 -13
- controllers/admin/sitemap-news.php +5 -4
- controllers/admin/sitemap.php +33 -32
- controllers/global.php +2 -3
- controllers/main.php +0 -39
- controllers/sitemap-news.php +60 -2
- readme.txt +8 -4
- views/admin/field-news-ping-log.php +1 -1
- views/admin/field-sitemaps.php +6 -6
- views/styles/sitemap-index.xsl +1 -1
- views/styles/sitemap-news.xsl +1 -1
- views/styles/sitemap-taxonomy.xsl +1 -1
- views/styles/sitemap.xsl +1 -1
- xml-sitemap.php +2 -2
controllers/admin/main.php
CHANGED
@@ -27,14 +27,14 @@ class XMLSF_Admin_Controller
|
|
27 |
require XMLSF_DIR . '/models/admin/main.php';
|
28 |
require XMLSF_DIR . '/controllers/admin/notices.php';
|
29 |
|
30 |
-
$sitemaps = (array) get_option( 'xmlsf_sitemaps' );
|
31 |
|
32 |
-
if ( isset($sitemaps['sitemap']) ) {
|
33 |
require XMLSF_DIR . '/models/admin/sitemap.php';
|
34 |
require XMLSF_DIR . '/controllers/admin/sitemap.php';
|
35 |
}
|
36 |
|
37 |
-
if ( isset($sitemaps['sitemap-news']) ) {
|
38 |
require XMLSF_DIR . '/models/admin/sitemap-news.php';
|
39 |
require XMLSF_DIR . '/controllers/admin/sitemap-news.php';
|
40 |
}
|
@@ -44,7 +44,7 @@ class XMLSF_Admin_Controller
|
|
44 |
|
45 |
add_action( 'admin_init', array( $this, 'notices_actions' ) );
|
46 |
add_action( 'admin_init', array( $this, 'transients_actions' ) );
|
47 |
-
add_action( 'admin_init', array( $this, 'register_settings' ) );
|
48 |
|
49 |
// ACTIONS & CHECKS
|
50 |
add_action( 'admin_init', array( $this, 'tools_actions' ) );
|
@@ -63,14 +63,12 @@ class XMLSF_Admin_Controller
|
|
63 |
|
64 |
public function register_settings()
|
65 |
{
|
66 |
-
$sitemaps = (array) get_option( 'xmlsf_sitemaps' );
|
67 |
-
|
68 |
// sitemaps
|
69 |
register_setting( 'reading', 'xmlsf_sitemaps', array('XMLSF_Admin_Sanitize','sitemaps_settings') );
|
70 |
add_settings_field( 'xmlsf_sitemaps', __('Enable XML sitemaps','xml-sitemap-feed'), array($this,'sitemaps_settings_field'), 'reading' );
|
71 |
|
72 |
// custom domains, only when any sitemap is active
|
73 |
-
if ( isset($sitemaps['sitemap']) || isset($sitemaps['sitemap-news']) ) {
|
74 |
register_setting( 'reading', 'xmlsf_domains', array('XMLSF_Admin_Sanitize','domains_settings') );
|
75 |
add_settings_field( 'xmlsf_domains', __('Allowed domains','xml-sitemap-feed'), array($this,'domains_settings_field'), 'reading' );
|
76 |
}
|
@@ -86,7 +84,7 @@ class XMLSF_Admin_Controller
|
|
86 |
}
|
87 |
|
88 |
// ping, only when any sitemap is active
|
89 |
-
if ( isset($sitemaps['sitemap']) || isset($sitemaps['sitemap-news']) ) {
|
90 |
register_setting( 'writing', 'xmlsf_ping', array('XMLSF_Admin_Sanitize','ping_settings') );
|
91 |
add_settings_field( 'xmlsf_ping', __('Ping Services','xml-sitemap-feed'), array($this,'ping_settings_field'), 'writing' );
|
92 |
add_action( 'load-options-writing.php', array($this,'ping_settings_help') );
|
@@ -142,8 +140,6 @@ class XMLSF_Admin_Controller
|
|
142 |
{
|
143 |
if ( 1 == get_option('blog_public') ) :
|
144 |
|
145 |
-
$options = (array) get_option( 'xmlsf_sitemaps' );
|
146 |
-
|
147 |
// The actual fields for data entry
|
148 |
include XMLSF_DIR . '/views/admin/field-sitemaps.php';
|
149 |
|
@@ -160,7 +156,7 @@ class XMLSF_Admin_Controller
|
|
160 |
|
161 |
public function domains_settings_field()
|
162 |
{
|
163 |
-
$domains = get_option('xmlsf_domains');
|
164 |
if ( !is_array($domains) ) $domains = array();
|
165 |
|
166 |
// The actual fields for data entry
|
@@ -277,9 +273,8 @@ class XMLSF_Admin_Controller
|
|
277 |
public function check_static_files()
|
278 |
{
|
279 |
$home_path = trailingslashit( get_home_path() );
|
280 |
-
$sitemaps = get_option( 'xmlsf_sitemaps' );
|
281 |
self::$static_files = array();
|
282 |
-
$check_for =
|
283 |
if ( get_option('xmlsf_robots') ) {
|
284 |
$check_for['robots'] = 'robots.txt';
|
285 |
}
|
27 |
require XMLSF_DIR . '/models/admin/main.php';
|
28 |
require XMLSF_DIR . '/controllers/admin/notices.php';
|
29 |
|
30 |
+
$this->sitemaps = (array) get_option( 'xmlsf_sitemaps', array() );
|
31 |
|
32 |
+
if ( isset($this->sitemaps['sitemap']) ) {
|
33 |
require XMLSF_DIR . '/models/admin/sitemap.php';
|
34 |
require XMLSF_DIR . '/controllers/admin/sitemap.php';
|
35 |
}
|
36 |
|
37 |
+
if ( isset($this->sitemaps['sitemap-news']) ) {
|
38 |
require XMLSF_DIR . '/models/admin/sitemap-news.php';
|
39 |
require XMLSF_DIR . '/controllers/admin/sitemap-news.php';
|
40 |
}
|
44 |
|
45 |
add_action( 'admin_init', array( $this, 'notices_actions' ) );
|
46 |
add_action( 'admin_init', array( $this, 'transients_actions' ) );
|
47 |
+
add_action( 'admin_init', array( $this, 'register_settings' ), 0 );
|
48 |
|
49 |
// ACTIONS & CHECKS
|
50 |
add_action( 'admin_init', array( $this, 'tools_actions' ) );
|
63 |
|
64 |
public function register_settings()
|
65 |
{
|
|
|
|
|
66 |
// sitemaps
|
67 |
register_setting( 'reading', 'xmlsf_sitemaps', array('XMLSF_Admin_Sanitize','sitemaps_settings') );
|
68 |
add_settings_field( 'xmlsf_sitemaps', __('Enable XML sitemaps','xml-sitemap-feed'), array($this,'sitemaps_settings_field'), 'reading' );
|
69 |
|
70 |
// custom domains, only when any sitemap is active
|
71 |
+
if ( isset($this->sitemaps['sitemap']) || isset($this->sitemaps['sitemap-news']) ) {
|
72 |
register_setting( 'reading', 'xmlsf_domains', array('XMLSF_Admin_Sanitize','domains_settings') );
|
73 |
add_settings_field( 'xmlsf_domains', __('Allowed domains','xml-sitemap-feed'), array($this,'domains_settings_field'), 'reading' );
|
74 |
}
|
84 |
}
|
85 |
|
86 |
// ping, only when any sitemap is active
|
87 |
+
if ( isset($this->sitemaps['sitemap']) || isset($this->sitemaps['sitemap-news']) ) {
|
88 |
register_setting( 'writing', 'xmlsf_ping', array('XMLSF_Admin_Sanitize','ping_settings') );
|
89 |
add_settings_field( 'xmlsf_ping', __('Ping Services','xml-sitemap-feed'), array($this,'ping_settings_field'), 'writing' );
|
90 |
add_action( 'load-options-writing.php', array($this,'ping_settings_help') );
|
140 |
{
|
141 |
if ( 1 == get_option('blog_public') ) :
|
142 |
|
|
|
|
|
143 |
// The actual fields for data entry
|
144 |
include XMLSF_DIR . '/views/admin/field-sitemaps.php';
|
145 |
|
156 |
|
157 |
public function domains_settings_field()
|
158 |
{
|
159 |
+
$domains = get_option( 'xmlsf_domains' );
|
160 |
if ( !is_array($domains) ) $domains = array();
|
161 |
|
162 |
// The actual fields for data entry
|
273 |
public function check_static_files()
|
274 |
{
|
275 |
$home_path = trailingslashit( get_home_path() );
|
|
|
276 |
self::$static_files = array();
|
277 |
+
$check_for = $this->sitemaps;
|
278 |
if ( get_option('xmlsf_robots') ) {
|
279 |
$check_for['robots'] = 'robots.txt';
|
280 |
}
|
controllers/admin/sitemap-news.php
CHANGED
@@ -76,7 +76,7 @@ class XMLSF_Admin_Sitemap_News extends XMLSF_Admin_Controller
|
|
76 |
/* Adds a News Sitemap box to the side column */
|
77 |
public function add_meta_box()
|
78 |
{
|
79 |
-
$news_tags = get_option('xmlsf_news_tags');
|
80 |
$news_post_types = !empty($news_tags['post_type']) && is_array($news_tags['post_type']) ? $news_tags['post_type'] : array('post');
|
81 |
|
82 |
// Only include metabox on post types that are included
|
@@ -147,9 +147,10 @@ class XMLSF_Admin_Sitemap_News extends XMLSF_Admin_Controller
|
|
147 |
*/
|
148 |
public function settings_page()
|
149 |
{
|
150 |
-
$this->options = get_option( 'xmlsf_news_tags', array() );
|
151 |
-
|
152 |
-
$
|
|
|
153 |
|
154 |
$active_tab = isset( $_GET[ 'tab' ] ) ? $_GET[ 'tab' ] : 'general';
|
155 |
|
76 |
/* Adds a News Sitemap box to the side column */
|
77 |
public function add_meta_box()
|
78 |
{
|
79 |
+
$news_tags = get_option( 'xmlsf_news_tags' );
|
80 |
$news_post_types = !empty($news_tags['post_type']) && is_array($news_tags['post_type']) ? $news_tags['post_type'] : array('post');
|
81 |
|
82 |
// Only include metabox on post types that are included
|
147 |
*/
|
148 |
public function settings_page()
|
149 |
{
|
150 |
+
$this->options = (array) get_option( 'xmlsf_news_tags', array() );
|
151 |
+
|
152 |
+
$sitemaps = (array) get_option( 'xmlsf_sitemaps', array() );
|
153 |
+
$url = trailingslashit(get_bloginfo('url')) . ( xmlsf()->plain_permalinks() || empty($sitemaps['sitemap-news']) ? '?feed=sitemap-news' : $sitemaps['sitemap-news'] );
|
154 |
|
155 |
$active_tab = isset( $_GET[ 'tab' ] ) ? $_GET[ 'tab' ] : 'general';
|
156 |
|
controllers/admin/sitemap.php
CHANGED
@@ -27,43 +27,44 @@ class XMLSF_Admin_Sitemap extends XMLSF_Admin_Controller
|
|
27 |
|
28 |
public function tools_actions()
|
29 |
{
|
30 |
-
if ( isset( $_POST['xmlsf-ping-sitemap'] ) )
|
31 |
-
|
32 |
|
33 |
-
|
34 |
|
35 |
-
|
36 |
-
$result = xmlsf_ping( $se, $sitemaps['sitemap'], HOUR_IN_SECONDS );
|
37 |
|
38 |
-
|
|
|
39 |
|
40 |
-
|
41 |
-
case 200:
|
42 |
-
$msg = sprintf( /* Translators: Search engine / Service name */ __( 'Pinged %s with success.', 'xml-sitemap-feed' ), $se_name );
|
43 |
-
$type = 'updated';
|
44 |
-
break;
|
45 |
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
|
|
50 |
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
|
61 |
-
|
|
|
|
|
62 |
}
|
63 |
|
64 |
-
|
65 |
-
add_settings_error( 'ping_sitemap', 'ping_sitemap', translate('Security check failed.') );
|
66 |
}
|
|
|
|
|
|
|
67 |
}
|
68 |
}
|
69 |
|
@@ -83,7 +84,7 @@ class XMLSF_Admin_Sitemap extends XMLSF_Admin_Controller
|
|
83 |
$wpseo_titles = get_option( 'wpseo_titles' );
|
84 |
if ( !empty( $wpseo_titles['disable-date'] ) ) {
|
85 |
// check if Split by option is set anywhere
|
86 |
-
foreach ( (array) get_option( 'xmlsf_post_types' ) as $type => $settings ) {
|
87 |
if ( is_array( $settings ) && !empty( $settings['archive'] ) ) {
|
88 |
add_action( 'admin_notices', array( 'XMLSF_Admin_Notices', 'notice_wpseo_date_redirect' ) );
|
89 |
break;
|
@@ -110,7 +111,7 @@ class XMLSF_Admin_Sitemap extends XMLSF_Admin_Controller
|
|
110 |
$seopress_titles = get_option( 'seopress_titles_option_name' );
|
111 |
if ( ! empty( $seopress_toggle['toggle-titles'] ) && ! empty( $seopress_titles['seopress_titles_archives_date_disable'] ) ) {
|
112 |
// check if Split by option is set anywhere
|
113 |
-
foreach ( (array) get_option( 'xmlsf_post_types' ) as $type => $settings ) {
|
114 |
if ( is_array( $settings ) && !empty( $settings['archive'] ) ) {
|
115 |
add_action( 'admin_notices', array( 'XMLSF_Admin_Notices', 'notice_seopress_date_redirect' ) );
|
116 |
break;
|
@@ -272,8 +273,8 @@ class XMLSF_Admin_Sitemap extends XMLSF_Admin_Controller
|
|
272 |
|
273 |
$active_tab = isset( $_GET[ 'tab' ] ) ? $_GET[ 'tab' ] : 'post_types';
|
274 |
|
275 |
-
$
|
276 |
-
$url = trailingslashit(get_bloginfo('url')) . ( xmlsf()->plain_permalinks() ? '?feed=sitemap' : $
|
277 |
|
278 |
include XMLSF_DIR . '/views/admin/page-sitemap.php';
|
279 |
}
|
@@ -360,7 +361,7 @@ class XMLSF_Admin_Sitemap extends XMLSF_Admin_Controller
|
|
360 |
|
361 |
$count = wp_count_posts( $obj->name );
|
362 |
|
363 |
-
$options = get_option('xmlsf_post_types');
|
364 |
|
365 |
// The actual fields for data entry
|
366 |
include XMLSF_DIR . '/views/admin/field-sitemap-post-type.php';
|
@@ -393,7 +394,7 @@ class XMLSF_Admin_Sitemap extends XMLSF_Admin_Controller
|
|
393 |
}
|
394 |
|
395 |
public function urls_settings_field() {
|
396 |
-
$urls = get_option('xmlsf_urls');
|
397 |
$lines = array();
|
398 |
|
399 |
if( is_array($urls) && !empty($urls) ) {
|
27 |
|
28 |
public function tools_actions()
|
29 |
{
|
30 |
+
if ( ! isset( $_POST['xmlsf-ping-sitemap'] ) )
|
31 |
+
return;
|
32 |
|
33 |
+
if ( isset( $_POST['_xmlsf_help_nonce'] ) && wp_verify_nonce( $_POST['_xmlsf_help_nonce'], XMLSF_BASENAME.'-help' ) ) {
|
34 |
|
35 |
+
$sitemaps = get_option( 'xmlsf_sitemaps' );
|
|
|
36 |
|
37 |
+
foreach ( array('google','bing') as $se ) {
|
38 |
+
$result = xmlsf_ping( $se, $sitemaps['sitemap'], HOUR_IN_SECONDS );
|
39 |
|
40 |
+
$se_name = 'google' == $se ? __('Google','xml-sitemap-feed') : __('Bing & Yahoo','xml-sitemap-feed');
|
|
|
|
|
|
|
|
|
41 |
|
42 |
+
switch( $result ) {
|
43 |
+
case 200:
|
44 |
+
$msg = sprintf( /* Translators: Search engine / Service name */ __( 'Pinged %s with success.', 'xml-sitemap-feed' ), $se_name );
|
45 |
+
$type = 'updated';
|
46 |
+
break;
|
47 |
|
48 |
+
case 999:
|
49 |
+
$msg = sprintf( /* Translators: Search engine / Service name, interval number */ __( 'Ping %s skipped: Sitemap already sent within the last %d minutes.', 'xml-sitemap-feed' ), $se_name, 60 );
|
50 |
+
$type = 'notice-warning';
|
51 |
+
break;
|
52 |
|
53 |
+
case '':
|
54 |
+
$msg = sprintf( translate('Oops: %s'), translate('Something went wrong.') );
|
55 |
+
$type = 'error';
|
56 |
+
break;
|
57 |
|
58 |
+
default:
|
59 |
+
$msg = sprintf( /* Translators: Search engine / Service name, response code number */ __( 'Ping %s failed with response code: %d', 'xml-sitemap-feed' ), $se_name, $result );
|
60 |
+
$type = 'error';
|
61 |
}
|
62 |
|
63 |
+
add_settings_error( 'ping_sitemap', 'ping_sitemap', $msg, $type );
|
|
|
64 |
}
|
65 |
+
|
66 |
+
} else {
|
67 |
+
add_settings_error( 'ping_sitemap', 'ping_sitemap', translate('Security check failed.') );
|
68 |
}
|
69 |
}
|
70 |
|
84 |
$wpseo_titles = get_option( 'wpseo_titles' );
|
85 |
if ( !empty( $wpseo_titles['disable-date'] ) ) {
|
86 |
// check if Split by option is set anywhere
|
87 |
+
foreach ( (array) get_option( 'xmlsf_post_types', array() ) as $type => $settings ) {
|
88 |
if ( is_array( $settings ) && !empty( $settings['archive'] ) ) {
|
89 |
add_action( 'admin_notices', array( 'XMLSF_Admin_Notices', 'notice_wpseo_date_redirect' ) );
|
90 |
break;
|
111 |
$seopress_titles = get_option( 'seopress_titles_option_name' );
|
112 |
if ( ! empty( $seopress_toggle['toggle-titles'] ) && ! empty( $seopress_titles['seopress_titles_archives_date_disable'] ) ) {
|
113 |
// check if Split by option is set anywhere
|
114 |
+
foreach ( (array) get_option( 'xmlsf_post_types', array() ) as $type => $settings ) {
|
115 |
if ( is_array( $settings ) && !empty( $settings['archive'] ) ) {
|
116 |
add_action( 'admin_notices', array( 'XMLSF_Admin_Notices', 'notice_seopress_date_redirect' ) );
|
117 |
break;
|
273 |
|
274 |
$active_tab = isset( $_GET[ 'tab' ] ) ? $_GET[ 'tab' ] : 'post_types';
|
275 |
|
276 |
+
$sitemaps = (array) get_option( 'xmlsf_sitemaps', array() );
|
277 |
+
$url = trailingslashit(get_bloginfo('url')) . ( xmlsf()->plain_permalinks() || empty($sitemaps['sitemap']) ? '?feed=sitemap' : $sitemaps['sitemap'] );
|
278 |
|
279 |
include XMLSF_DIR . '/views/admin/page-sitemap.php';
|
280 |
}
|
361 |
|
362 |
$count = wp_count_posts( $obj->name );
|
363 |
|
364 |
+
$options = get_option( 'xmlsf_post_types' );
|
365 |
|
366 |
// The actual fields for data entry
|
367 |
include XMLSF_DIR . '/views/admin/field-sitemap-post-type.php';
|
394 |
}
|
395 |
|
396 |
public function urls_settings_field() {
|
397 |
+
$urls = get_option( 'xmlsf_urls' );
|
398 |
$lines = array();
|
399 |
|
400 |
if( is_array($urls) && !empty($urls) ) {
|
controllers/global.php
CHANGED
@@ -41,15 +41,14 @@ function xmlsf_init() {
|
|
41 |
if ( ! empty( $sitemaps['sitemap-news'] ) ) {
|
42 |
require XMLSF_DIR . '/models/sitemap-news.php';
|
43 |
add_filter( 'xmlsf_news_post_types', 'xmlsf_news_filter_post_types' );
|
44 |
-
//add_filter( 'request', 'xmlsf_news_filter_request', 2 );
|
45 |
|
46 |
require XMLSF_DIR . '/controllers/sitemap-news.php';
|
47 |
-
|
|
|
48 |
|
49 |
if ( ! empty( $sitemaps['sitemap'] ) ) {
|
50 |
require XMLSF_DIR . '/models/sitemap.php';
|
51 |
add_filter( 'xmlsf_post_types', 'xmlsf_filter_post_types' );
|
52 |
-
//add_filter( 'request', 'xmlsf_sitemap_filter_request', 3 );
|
53 |
|
54 |
require XMLSF_DIR . '/controllers/sitemap.php';
|
55 |
new XMLSF_Sitemap_Controller( $sitemaps['sitemap'] );
|
41 |
if ( ! empty( $sitemaps['sitemap-news'] ) ) {
|
42 |
require XMLSF_DIR . '/models/sitemap-news.php';
|
43 |
add_filter( 'xmlsf_news_post_types', 'xmlsf_news_filter_post_types' );
|
|
|
44 |
|
45 |
require XMLSF_DIR . '/controllers/sitemap-news.php';
|
46 |
+
new XMLSF_Sitemap_News_Controller( $sitemaps['sitemap-news'] );
|
47 |
+
}
|
48 |
|
49 |
if ( ! empty( $sitemaps['sitemap'] ) ) {
|
50 |
require XMLSF_DIR . '/models/sitemap.php';
|
51 |
add_filter( 'xmlsf_post_types', 'xmlsf_filter_post_types' );
|
|
|
52 |
|
53 |
require XMLSF_DIR . '/controllers/sitemap.php';
|
54 |
new XMLSF_Sitemap_Controller( $sitemaps['sitemap'] );
|
controllers/main.php
CHANGED
@@ -1,44 +1,5 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
/**
|
4 |
-
* Do pings, hooked to transition post status
|
5 |
-
*
|
6 |
-
* @param $new_status
|
7 |
-
* @param $old_status
|
8 |
-
* @param $post
|
9 |
-
*/
|
10 |
-
function xmlsf_do_pings( $new_status, $old_status, $post ) {
|
11 |
-
// are we publishing?
|
12 |
-
if ( $old_status == 'publish' || $new_status != 'publish' )
|
13 |
-
return;
|
14 |
-
|
15 |
-
$sitemaps = get_option( 'xmlsf_sitemaps' );
|
16 |
-
$ping = get_option( 'xmlsf_ping' );
|
17 |
-
|
18 |
-
if ( !is_array($sitemaps) || empty($sitemaps) || !is_array($ping) || empty($ping) )
|
19 |
-
return;
|
20 |
-
|
21 |
-
if ( isset( $sitemaps['sitemap-news'] ) ) {
|
22 |
-
// check if we've got a post type that is included in our news sitemap
|
23 |
-
// TODO also check category if needed
|
24 |
-
$news_tags = get_option('xmlsf_news_tags');
|
25 |
-
if ( ! empty( $news_tags['post_type'] ) && in_array( $post->post_type, (array) $news_tags['post_type'] ) ) {
|
26 |
-
xmlsf_ping( 'google', $sitemaps['sitemap-news'], 5 * MINUTE_IN_SECONDS );
|
27 |
-
}
|
28 |
-
}
|
29 |
-
|
30 |
-
if ( isset( $sitemaps['sitemap'] ) ) {
|
31 |
-
// check if we've got a post type that is included in our sitemap
|
32 |
-
$post_types = get_option( 'xmlsf_post_types' );
|
33 |
-
if ( is_array( $post_types ) && array_key_exists( $post->post_type, $post_types ) ) {
|
34 |
-
|
35 |
-
foreach ( $ping as $se ) {
|
36 |
-
xmlsf_ping( $se, $sitemaps['sitemap'], HOUR_IN_SECONDS );
|
37 |
-
}
|
38 |
-
}
|
39 |
-
}
|
40 |
-
}
|
41 |
-
|
42 |
/**
|
43 |
* WPML: switch language
|
44 |
* @see https://wpml.org/wpml-hook/wpml_post_language_details/
|
1 |
<?php
|
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
/**
|
4 |
* WPML: switch language
|
5 |
* @see https://wpml.org/wpml-hook/wpml_post_language_details/
|
controllers/sitemap-news.php
CHANGED
@@ -1,9 +1,67 @@
|
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
/**
|
3 |
* set up the news sitemap template
|
4 |
*/
|
5 |
function xmlsf_news_load_template() {
|
6 |
load_template( XMLSF_DIR . '/views/feed-sitemap-news.php' );
|
7 |
}
|
8 |
-
|
9 |
-
add_action('do_feed_sitemap-news', 'xmlsf_news_load_template', 10, 1);
|
1 |
<?php
|
2 |
+
/* ------------------------------
|
3 |
+
* XMLSF Controller CLASS
|
4 |
+
* ------------------------------ */
|
5 |
+
|
6 |
+
class XMLSF_Sitemap_News_Controller
|
7 |
+
{
|
8 |
+
/**
|
9 |
+
* Sitemap index name
|
10 |
+
* @var string
|
11 |
+
*/
|
12 |
+
private $sitemap = 'sitemap-news.xml';
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Post types included in sitemap index
|
16 |
+
* @var array
|
17 |
+
*/
|
18 |
+
private $post_types;
|
19 |
+
|
20 |
+
/**
|
21 |
+
* CONSTRUCTOR
|
22 |
+
* Runs on init
|
23 |
+
*/
|
24 |
+
|
25 |
+
function __construct( $sitemap )
|
26 |
+
{
|
27 |
+
$this->sitemap = $sitemap;
|
28 |
+
|
29 |
+
// PINGING
|
30 |
+
add_action( 'transition_post_status', array($this,'do_pings'), 10, 3 );
|
31 |
+
|
32 |
+
// FEED TEMPLATES
|
33 |
+
add_action('do_feed_sitemap-news', 'xmlsf_news_load_template', 10, 1);
|
34 |
+
}
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Do pings, hooked to transition post status
|
38 |
+
*
|
39 |
+
* @param $new_status
|
40 |
+
* @param $old_status
|
41 |
+
* @param $post
|
42 |
+
*/
|
43 |
+
public function do_pings( $new_status, $old_status, $post ) {
|
44 |
+
// are we publishing?
|
45 |
+
if ( $old_status == 'publish' || $new_status != 'publish' )
|
46 |
+
return;
|
47 |
+
|
48 |
+
$ping = (array) get_option( 'xmlsf_ping', array() );
|
49 |
+
|
50 |
+
if ( in_array( 'google', $ping ) ) {
|
51 |
+
// check if we've got a post type that is included in our news sitemap
|
52 |
+
// TODO also check category if needed
|
53 |
+
$news_tags = get_option('xmlsf_news_tags');
|
54 |
+
if ( ! empty( $news_tags['post_type'] ) && in_array( $post->post_type, (array) $news_tags['post_type'] ) ) {
|
55 |
+
xmlsf_ping( 'google', $this->sitemap, 5 * MINUTE_IN_SECONDS );
|
56 |
+
}
|
57 |
+
}
|
58 |
+
}
|
59 |
+
|
60 |
+
}
|
61 |
+
|
62 |
/**
|
63 |
* set up the news sitemap template
|
64 |
*/
|
65 |
function xmlsf_news_load_template() {
|
66 |
load_template( XMLSF_DIR . '/views/feed-sitemap-news.php' );
|
67 |
}
|
|
|
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Tags: sitemap, xml sitemap, news sitemap, sitemap.xml, robots.txt, Google, Googl
|
|
5 |
Requires at least: 4.4
|
6 |
Requires PHP: 5.4
|
7 |
Tested up to: 5.1
|
8 |
-
Stable tag: 5.1
|
9 |
|
10 |
XML and Google News Sitemaps to feed the hungry spiders. Multisite, WP Super Cache, Polylang and WPML compatible.
|
11 |
|
@@ -289,15 +289,19 @@ Yes. In fact, it has been designed for it. Tested on WPMU 2.9.2 and WPMS 3+ both
|
|
289 |
|
290 |
== Upgrade Notice ==
|
291 |
|
292 |
-
= 5.1 =
|
293 |
|
294 |
-
|
295 |
|
296 |
|
297 |
== Changelog ==
|
298 |
|
|
|
|
|
|
|
299 |
= 5.1.1 =
|
300 |
-
* FIX options page not found
|
|
|
301 |
|
302 |
= 5.1 =
|
303 |
* SEOPress and Catch Box incompatibility admin messages
|
5 |
Requires at least: 4.4
|
6 |
Requires PHP: 5.4
|
7 |
Tested up to: 5.1
|
8 |
+
Stable tag: 5.1.1
|
9 |
|
10 |
XML and Google News Sitemaps to feed the hungry spiders. Multisite, WP Super Cache, Polylang and WPML compatible.
|
11 |
|
289 |
|
290 |
== Upgrade Notice ==
|
291 |
|
292 |
+
= 5.1.1 =
|
293 |
|
294 |
+
Bugfix release: options page and news pings.
|
295 |
|
296 |
|
297 |
== Changelog ==
|
298 |
|
299 |
+
= 5.1.2 =
|
300 |
+
* Plugin support and rate links on plugins page
|
301 |
+
|
302 |
= 5.1.1 =
|
303 |
+
* FIX options page not found
|
304 |
+
* FIX news sitemap only ping
|
305 |
|
306 |
= 5.1 =
|
307 |
* SEOPress and Catch Box incompatibility admin messages
|
views/admin/field-news-ping-log.php
CHANGED
@@ -11,7 +11,7 @@
|
|
11 |
<p>
|
12 |
<label>
|
13 |
<?php _e('Maximum log entries','xml-sitemap-feed'); ?>
|
14 |
-
<input type="number" step="1" min="0" max="10000" id="xmlsf_news_ping_log_max" value="1000" class="medium-text" />
|
15 |
</label>
|
16 |
</p>
|
17 |
<p class="description">
|
11 |
<p>
|
12 |
<label>
|
13 |
<?php _e('Maximum log entries','xml-sitemap-feed'); ?>
|
14 |
+
<input type="number" step="1" min="0" max="10000" id="xmlsf_news_ping_log_max" value="1000" class="medium-text" disabled="disabled" />
|
15 |
</label>
|
16 |
</p>
|
17 |
<p class="description">
|
views/admin/field-sitemaps.php
CHANGED
@@ -3,12 +3,12 @@
|
|
3 |
<?php _e('Enable XML sitemaps','xml-sitemap-feed'); ?>
|
4 |
</legend>
|
5 |
<label>
|
6 |
-
<input type="checkbox" name="xmlsf_sitemaps[sitemap]" id="xmlsf_sitemaps_index" value="sitemap.xml"<?php echo checked(isset($
|
7 |
<?php _e('XML Sitemap Index','xml-sitemap-feed'); ?>
|
8 |
</label>
|
9 |
|
10 |
-
<?php if ( isset($
|
11 |
-
$sitemap_url = trailingslashit(get_bloginfo('url')) . ( xmlsf()->plain_permalinks() ? '?feed=sitemap' : $
|
12 |
?>
|
13 |
<span class="description">
|
14 |
–
|
@@ -20,12 +20,12 @@
|
|
20 |
<br>
|
21 |
|
22 |
<label>
|
23 |
-
<input type="checkbox" name="xmlsf_sitemaps[sitemap-news]" id="xmlsf_sitemaps_news" value="sitemap-news.xml"<?php echo checked(isset($
|
24 |
<?php _e('Google News Sitemap','xml-sitemap-feed'); ?>
|
25 |
</label>
|
26 |
|
27 |
-
<?php if (isset($
|
28 |
-
$news_url = trailingslashit(get_bloginfo('url')) . ( xmlsf()->plain_permalinks() ? '?feed=sitemap-news' : $
|
29 |
?>
|
30 |
<span class="description">
|
31 |
–
|
3 |
<?php _e('Enable XML sitemaps','xml-sitemap-feed'); ?>
|
4 |
</legend>
|
5 |
<label>
|
6 |
+
<input type="checkbox" name="xmlsf_sitemaps[sitemap]" id="xmlsf_sitemaps_index" value="sitemap.xml"<?php echo checked(isset($this->sitemaps['sitemap']), true, false); ?> />
|
7 |
<?php _e('XML Sitemap Index','xml-sitemap-feed'); ?>
|
8 |
</label>
|
9 |
|
10 |
+
<?php if ( isset($this->sitemaps['sitemap']) ) {
|
11 |
+
$sitemap_url = trailingslashit(get_bloginfo('url')) . ( xmlsf()->plain_permalinks() ? '?feed=sitemap' : $this->sitemaps['sitemap'] );
|
12 |
?>
|
13 |
<span class="description">
|
14 |
–
|
20 |
<br>
|
21 |
|
22 |
<label>
|
23 |
+
<input type="checkbox" name="xmlsf_sitemaps[sitemap-news]" id="xmlsf_sitemaps_news" value="sitemap-news.xml"<?php echo checked(isset($this->sitemaps['sitemap-news']), true, false); ?> />
|
24 |
<?php _e('Google News Sitemap','xml-sitemap-feed'); ?>
|
25 |
</label>
|
26 |
|
27 |
+
<?php if (isset($this->sitemaps['sitemap-news'])) {
|
28 |
+
$news_url = trailingslashit(get_bloginfo('url')) . ( xmlsf()->plain_permalinks() ? '?feed=sitemap-news' : $this->sitemaps['sitemap-news'] );
|
29 |
?>
|
30 |
<span class="description">
|
31 |
–
|
views/styles/sitemap-index.xsl
CHANGED
@@ -39,7 +39,7 @@
|
|
39 |
</table>
|
40 |
</div>
|
41 |
<div id="footer">
|
42 |
-
<p><img src="data:image/gif;base64,R0lGODlhUAAPAJEAAGZmZv////9mAImOeSwAAAAAUAAPAAACoISPqcvtD0+YtNqLs968myCE4kiW5jkGw8q27gvDwYfWdq3G+i7T9w/M8Ya7GQAUoiSTEyYSKYA2nSKhdXUdCIlaXzRVDVdB0+dS2lJZ1bkt0Sgti6NysvM5jbq2ai2WywJHYrZUaEhIWJXm99foNiRI9XUoV4g4GJjJyEgBGAkEivIIyPUZeppCqorlheo6ulr00UFba3uLEaG7y9urUAAAOw%3D%3D" alt="XML Sitemap" title="XML Sitemap" /> generated by <a href="https://status301.net/wordpress-plugins/xml-sitemap-feed/"
|
43 |
</div>
|
44 |
</body>
|
45 |
</html>
|
39 |
</table>
|
40 |
</div>
|
41 |
<div id="footer">
|
42 |
+
<p><img src="data:image/gif;base64,R0lGODlhUAAPAJEAAGZmZv////9mAImOeSwAAAAAUAAPAAACoISPqcvtD0+YtNqLs968myCE4kiW5jkGw8q27gvDwYfWdq3G+i7T9w/M8Ya7GQAUoiSTEyYSKYA2nSKhdXUdCIlaXzRVDVdB0+dS2lJZ1bkt0Sgti6NysvM5jbq2ai2WywJHYrZUaEhIWJXm99foNiRI9XUoV4g4GJjJyEgBGAkEivIIyPUZeppCqorlheo6ulr00UFba3uLEaG7y9urUAAAOw%3D%3D" alt="XML Sitemap" title="XML Sitemap" /> generated by <a href="https://status301.net/wordpress-plugins/xml-sitemap-feed/">XML Sitemap & Google News</a> for <a href="https://wordpress.org/">WordPress</a>.</p>
|
43 |
</div>
|
44 |
</body>
|
45 |
</html>
|
views/styles/sitemap-news.xsl
CHANGED
@@ -49,7 +49,7 @@
|
|
49 |
</table>
|
50 |
</div>
|
51 |
<div id="footer">
|
52 |
-
<p><img src="data:image/gif;base64,R0lGODlhUAAPAJEAAGZmZv////9mAImOeSwAAAAAUAAPAAACoISPqcvtD0+YtNqLs968myCE4kiW5jkGw8q27gvDwYfWdq3G+i7T9w/M8Ya7GQAUoiSTEyYSKYA2nSKhdXUdCIlaXzRVDVdB0+dS2lJZ1bkt0Sgti6NysvM5jbq2ai2WywJHYrZUaEhIWJXm99foNiRI9XUoV4g4GJjJyEgBGAkEivIIyPUZeppCqorlheo6ulr00UFba3uLEaG7y9urUAAAOw%3D%3D" alt="XML Sitemap" title="XML Sitemap" /> generated by <a href="https://status301.net/wordpress-plugins/xml-sitemap-feed/"
|
53 |
</div>
|
54 |
</body>
|
55 |
</html>
|
49 |
</table>
|
50 |
</div>
|
51 |
<div id="footer">
|
52 |
+
<p><img src="data:image/gif;base64,R0lGODlhUAAPAJEAAGZmZv////9mAImOeSwAAAAAUAAPAAACoISPqcvtD0+YtNqLs968myCE4kiW5jkGw8q27gvDwYfWdq3G+i7T9w/M8Ya7GQAUoiSTEyYSKYA2nSKhdXUdCIlaXzRVDVdB0+dS2lJZ1bkt0Sgti6NysvM5jbq2ai2WywJHYrZUaEhIWJXm99foNiRI9XUoV4g4GJjJyEgBGAkEivIIyPUZeppCqorlheo6ulr00UFba3uLEaG7y9urUAAAOw%3D%3D" alt="XML Sitemap" title="XML Sitemap" /> generated by <a href="https://status301.net/wordpress-plugins/xml-sitemap-feed/">XML Sitemap & Google News</a> for <a href="https://wordpress.org/">WordPress</a>.</p>
|
53 |
</div>
|
54 |
</body>
|
55 |
</html>
|
views/styles/sitemap-taxonomy.xsl
CHANGED
@@ -38,7 +38,7 @@
|
|
38 |
</table>
|
39 |
</div>
|
40 |
<div id="footer">
|
41 |
-
<p><img src="data:image/gif;base64,R0lGODlhUAAPAJEAAGZmZv////9mAImOeSwAAAAAUAAPAAACoISPqcvtD0+YtNqLs968myCE4kiW5jkGw8q27gvDwYfWdq3G+i7T9w/M8Ya7GQAUoiSTEyYSKYA2nSKhdXUdCIlaXzRVDVdB0+dS2lJZ1bkt0Sgti6NysvM5jbq2ai2WywJHYrZUaEhIWJXm99foNiRI9XUoV4g4GJjJyEgBGAkEivIIyPUZeppCqorlheo6ulr00UFba3uLEaG7y9urUAAAOw%3D%3D" alt="XML Sitemap" title="XML Sitemap" /> generated by <a href="https://status301.net/wordpress-plugins/xml-sitemap-feed/"
|
42 |
</div>
|
43 |
</body>
|
44 |
</html>
|
38 |
</table>
|
39 |
</div>
|
40 |
<div id="footer">
|
41 |
+
<p><img src="data:image/gif;base64,R0lGODlhUAAPAJEAAGZmZv////9mAImOeSwAAAAAUAAPAAACoISPqcvtD0+YtNqLs968myCE4kiW5jkGw8q27gvDwYfWdq3G+i7T9w/M8Ya7GQAUoiSTEyYSKYA2nSKhdXUdCIlaXzRVDVdB0+dS2lJZ1bkt0Sgti6NysvM5jbq2ai2WywJHYrZUaEhIWJXm99foNiRI9XUoV4g4GJjJyEgBGAkEivIIyPUZeppCqorlheo6ulr00UFba3uLEaG7y9urUAAAOw%3D%3D" alt="XML Sitemap" title="XML Sitemap" /> generated by <a href="https://status301.net/wordpress-plugins/xml-sitemap-feed/">XML Sitemap & Google News</a> for <a href="https://wordpress.org/">WordPress</a>.</p>
|
42 |
</div>
|
43 |
</body>
|
44 |
</html>
|
views/styles/sitemap.xsl
CHANGED
@@ -40,7 +40,7 @@
|
|
40 |
</table>
|
41 |
</div>
|
42 |
<div id="footer">
|
43 |
-
<p><img src="data:image/gif;base64,R0lGODlhUAAPAJEAAGZmZv////9mAImOeSwAAAAAUAAPAAACoISPqcvtD0+YtNqLs968myCE4kiW5jkGw8q27gvDwYfWdq3G+i7T9w/M8Ya7GQAUoiSTEyYSKYA2nSKhdXUdCIlaXzRVDVdB0+dS2lJZ1bkt0Sgti6NysvM5jbq2ai2WywJHYrZUaEhIWJXm99foNiRI9XUoV4g4GJjJyEgBGAkEivIIyPUZeppCqorlheo6ulr00UFba3uLEaG7y9urUAAAOw%3D%3D" alt="XML Sitemap" title="XML Sitemap" /> generated by <a href="https://status301.net/wordpress-plugins/xml-sitemap-feed/"
|
44 |
</div>
|
45 |
</body>
|
46 |
</html>
|
40 |
</table>
|
41 |
</div>
|
42 |
<div id="footer">
|
43 |
+
<p><img src="data:image/gif;base64,R0lGODlhUAAPAJEAAGZmZv////9mAImOeSwAAAAAUAAPAAACoISPqcvtD0+YtNqLs968myCE4kiW5jkGw8q27gvDwYfWdq3G+i7T9w/M8Ya7GQAUoiSTEyYSKYA2nSKhdXUdCIlaXzRVDVdB0+dS2lJZ1bkt0Sgti6NysvM5jbq2ai2WywJHYrZUaEhIWJXm99foNiRI9XUoV4g4GJjJyEgBGAkEivIIyPUZeppCqorlheo6ulr00UFba3uLEaG7y9urUAAAOw%3D%3D" alt="XML Sitemap" title="XML Sitemap" /> generated by <a href="https://status301.net/wordpress-plugins/xml-sitemap-feed/">XML Sitemap & Google News</a> for <a href="https://wordpress.org/">WordPress</a>.</p>
|
44 |
</div>
|
45 |
</body>
|
46 |
</html>
|
xml-sitemap.php
CHANGED
@@ -4,13 +4,13 @@ Plugin Name: XML Sitemap & Google News
|
|
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: 5.1
|
8 |
Requires PHP: 5.4
|
9 |
Author: RavanH
|
10 |
Author URI: http://status301.net/
|
11 |
*/
|
12 |
|
13 |
-
define( 'XMLSF_VERSION', '5.1' );
|
14 |
|
15 |
/* Copyright 2019 RavanH
|
16 |
http://status301.net/
|
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: 5.1.1
|
8 |
Requires PHP: 5.4
|
9 |
Author: RavanH
|
10 |
Author URI: http://status301.net/
|
11 |
*/
|
12 |
|
13 |
+
define( 'XMLSF_VERSION', '5.1.1' );
|
14 |
|
15 |
/* Copyright 2019 RavanH
|
16 |
http://status301.net/
|