Version Description
Release Date: August 19th, 2021 * Fix : PHP debug / log errors xmlRenderer.php when images disabled. * Fix : Post settings not updating. * Fix : News sitemap missing language tag. * Fix : News not working due to bad database upgrade script. * Fix : Activation issues on network installs.
Download this release
Release Info
Developer | XmlSitemapGenerator |
Plugin | Google XML Sitemap Generator |
Version | 2.0.2 |
Comparing to | |
See all releases |
Code changes from version 2.0.0 to 2.0.2
- code/core.php +14 -23
- code/postMetaData.php +18 -12
- code/providers/archiveProvider.php +15 -1
- code/providers/authorsProvider.php +11 -0
- code/providers/coreProvider.php +1 -1
- code/providers/indexProvider.php +5 -1
- code/providers/postsProvider.php +49 -15
- code/providers/termsProvider.php +44 -29
- code/renderers/htmRenderer.php +9 -6
- code/renderers/newsRenderer.php +21 -17
- code/renderers/rssRenderer.php +7 -4
- code/renderers/xmlRenderer.php +26 -13
- code/upgrader.php +11 -9
- readme.txt +16 -2
- www-xml-sitemap-generator-org.php +6 -6
code/core.php
CHANGED
@@ -49,9 +49,11 @@ class core {
|
|
49 |
return $globalSettings;
|
50 |
}
|
51 |
|
|
|
52 |
public static function doSiteActivation()
|
53 |
{
|
54 |
self::addDatabaseTable();
|
|
|
55 |
|
56 |
self::add_rewrite_rules();
|
57 |
flush_rewrite_rules();
|
@@ -65,6 +67,7 @@ class core {
|
|
65 |
|
66 |
|
67 |
public static function activatePlugin($network_wide){
|
|
|
68 |
if ( is_multisite() && $network_wide ) {
|
69 |
|
70 |
if ( false == is_super_admin() ) {
|
@@ -81,12 +84,20 @@ class core {
|
|
81 |
|
82 |
} else {
|
83 |
self::doSiteActivation();
|
84 |
-
|
85 |
}
|
86 |
-
|
87 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
public static function activated($plugin)
|
89 |
{
|
|
|
90 |
if( $plugin == self::pluginFilename() ) {
|
91 |
wp_redirect( admin_url( 'options-general.php?page=www-xml-sitemap-generator-org' ));
|
92 |
exit;
|
@@ -98,27 +109,7 @@ class core {
|
|
98 |
}
|
99 |
|
100 |
|
101 |
-
|
102 |
-
{
|
103 |
-
if ( ! function_exists( 'is_plugin_active_for_network' ) ) {
|
104 |
-
require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
|
105 |
-
}
|
106 |
-
$network_wide = is_plugin_active_for_network( 'www-xml-sitemap-generator-org/www-xml-sitemap-generator-org.php') ;
|
107 |
-
if ( is_multisite() && $network_wide ) {
|
108 |
-
|
109 |
-
global $wpdb;
|
110 |
-
|
111 |
-
foreach ($wpdb->get_col("SELECT blog_id FROM $wpdb->blogs") as $blog_id) {
|
112 |
-
switch_to_blog($blog_id);
|
113 |
-
upgrader::checkUpgrade();
|
114 |
-
restore_current_blog();
|
115 |
-
}
|
116 |
-
} else {
|
117 |
-
upgrader::checkUpgrade();
|
118 |
-
}
|
119 |
-
|
120 |
-
}
|
121 |
-
|
122 |
public static function initialisePlugin()
|
123 |
{
|
124 |
|
49 |
return $globalSettings;
|
50 |
}
|
51 |
|
52 |
+
// called for each site being actiivated.
|
53 |
public static function doSiteActivation()
|
54 |
{
|
55 |
self::addDatabaseTable();
|
56 |
+
upgrader::doUpgrade();
|
57 |
|
58 |
self::add_rewrite_rules();
|
59 |
flush_rewrite_rules();
|
67 |
|
68 |
|
69 |
public static function activatePlugin($network_wide){
|
70 |
+
|
71 |
if ( is_multisite() && $network_wide ) {
|
72 |
|
73 |
if ( false == is_super_admin() ) {
|
84 |
|
85 |
} else {
|
86 |
self::doSiteActivation();
|
|
|
87 |
}
|
|
|
88 |
}
|
89 |
+
|
90 |
+
public static function activateNewBlog( $new_site ) {
|
91 |
+
switch_to_blog( $new_site->blog_id );
|
92 |
+
self::doSiteActivation();
|
93 |
+
restore_current_blog();
|
94 |
+
}
|
95 |
+
|
96 |
+
|
97 |
+
// used to redirect the user to the plugin settings when activated manually.
|
98 |
public static function activated($plugin)
|
99 |
{
|
100 |
+
|
101 |
if( $plugin == self::pluginFilename() ) {
|
102 |
wp_redirect( admin_url( 'options-general.php?page=www-xml-sitemap-generator-org' ));
|
103 |
exit;
|
109 |
}
|
110 |
|
111 |
|
112 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
public static function initialisePlugin()
|
114 |
{
|
115 |
|
code/postMetaData.php
CHANGED
@@ -34,9 +34,9 @@ class postMetaData
|
|
34 |
);
|
35 |
}
|
36 |
|
37 |
-
static function handlePostBack( $post_id, $post
|
|
|
38 |
|
39 |
-
|
40 |
/* Verify the nonce before proceeding. */
|
41 |
if ( !isset( $_POST['wpXSG_meta_nonce'] ) || !wp_verify_nonce( $_POST['wpXSG_meta_nonce'], basename( __FILE__ ) ) )
|
42 |
return ;
|
@@ -57,14 +57,16 @@ class postMetaData
|
|
57 |
$settings->exclude = ( isset( $_POST['wpXSG-Exclude'] ) ? $_POST['wpXSG-Exclude'] : '0' );
|
58 |
$settings->priority = ( isset( $_POST['wpXSG-Priority'] ) ? $_POST['wpXSG-Priority'] : 'default' );
|
59 |
$settings->frequency = ( isset( $_POST['wpXSG-Frequency'] ) ? $_POST['wpXSG-Frequency'] : 'default' );
|
60 |
-
|
61 |
|
62 |
dataAccess::saveMetaItem($settings);
|
|
|
|
|
63 |
|
64 |
}
|
65 |
|
66 |
|
67 |
-
static function render( $post )
|
68 |
{
|
69 |
|
70 |
|
@@ -73,17 +75,21 @@ class postMetaData
|
|
73 |
wp_nonce_field( basename( __FILE__ ), 'wpXSG_meta_nonce' );
|
74 |
|
75 |
?>
|
76 |
-
|
77 |
-
<p><strong>Sitemap inclusion</strong></p>
|
78 |
-
<select name="wpXSG-Exclude" id="wpXSG-Exclude" ></select>
|
79 |
-
<label for="wpXSG-Exclude"></label>
|
80 |
|
81 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
<select name="wpXSG-Priority" id="wpXSG-Priority" ></select>
|
83 |
-
|
84 |
-
|
|
|
85 |
<select name="wpXSG-Frequency" id="wpXSG-Frequency" ></select>
|
86 |
-
|
87 |
|
88 |
|
89 |
<script type="text/javascript" src="<?php echo xsgPluginPath(); ?>assets/scripts.js"></script>
|
34 |
);
|
35 |
}
|
36 |
|
37 |
+
static function handlePostBack( $post_id , $post) {
|
38 |
+
|
39 |
|
|
|
40 |
/* Verify the nonce before proceeding. */
|
41 |
if ( !isset( $_POST['wpXSG_meta_nonce'] ) || !wp_verify_nonce( $_POST['wpXSG_meta_nonce'], basename( __FILE__ ) ) )
|
42 |
return ;
|
57 |
$settings->exclude = ( isset( $_POST['wpXSG-Exclude'] ) ? $_POST['wpXSG-Exclude'] : '0' );
|
58 |
$settings->priority = ( isset( $_POST['wpXSG-Priority'] ) ? $_POST['wpXSG-Priority'] : 'default' );
|
59 |
$settings->frequency = ( isset( $_POST['wpXSG-Frequency'] ) ? $_POST['wpXSG-Frequency'] : 'default' );
|
60 |
+
$settings->news = 0 ;
|
61 |
|
62 |
dataAccess::saveMetaItem($settings);
|
63 |
+
|
64 |
+
return $post_id;
|
65 |
|
66 |
}
|
67 |
|
68 |
|
69 |
+
static function render( $post, $metabox )
|
70 |
{
|
71 |
|
72 |
|
75 |
wp_nonce_field( basename( __FILE__ ), 'wpXSG_meta_nonce' );
|
76 |
|
77 |
?>
|
|
|
|
|
|
|
|
|
78 |
|
79 |
+
|
80 |
+
|
81 |
+
<div class="components-panel__row"><div class="components-base-control"><div class="components-base-control__field">
|
82 |
+
<label class="components-base-control__label" for="wpXSG-Exclude">Sitemap inclusion</label><br />
|
83 |
+
<select name="wpXSG-Exclude" id="wpXSG-Exclude" ></select>
|
84 |
+
</div></div></div>
|
85 |
+
<div class="components-panel__row"><div class="components-base-control"><div class="components-base-control__field">
|
86 |
+
<label class="components-base-control__label" for="wpXSG-Priority">Relative priority</label><br />
|
87 |
<select name="wpXSG-Priority" id="wpXSG-Priority" ></select>
|
88 |
+
</div></div></div>
|
89 |
+
<div class="components-panel__row"><div class="components-base-control"><div class="components-base-control__field">
|
90 |
+
<label class="components-base-control__label" for="wpXSG-Frequency">Update frequency</label><br />
|
91 |
<select name="wpXSG-Frequency" id="wpXSG-Frequency" ></select>
|
92 |
+
</div></div></div>
|
93 |
|
94 |
|
95 |
<script type="text/javascript" src="<?php echo xsgPluginPath(); ?>assets/scripts.js"></script>
|
code/providers/archiveProvider.php
CHANGED
@@ -16,6 +16,7 @@ namespace xmlSitemapGenerator;
|
|
16 |
|
17 |
public function getPageCount($type)
|
18 |
{
|
|
|
19 |
return 1;
|
20 |
|
21 |
}
|
@@ -23,6 +24,8 @@ namespace xmlSitemapGenerator;
|
|
23 |
public function getPage($type,$page)
|
24 |
{
|
25 |
|
|
|
|
|
26 |
global $wpdb;
|
27 |
|
28 |
$date = self::getDateField($this->sitemapDefaults->dateField);
|
@@ -89,7 +92,18 @@ namespace xmlSitemapGenerator;
|
|
89 |
|
90 |
}
|
91 |
}
|
92 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
}
|
94 |
|
95 |
|
16 |
|
17 |
public function getPageCount($type)
|
18 |
{
|
19 |
+
if ($this->exclude()) {return 0;}
|
20 |
return 1;
|
21 |
|
22 |
}
|
24 |
public function getPage($type,$page)
|
25 |
{
|
26 |
|
27 |
+
if ($this->exclude()) {return;}
|
28 |
+
|
29 |
global $wpdb;
|
30 |
|
31 |
$date = self::getDateField($this->sitemapDefaults->dateField);
|
92 |
|
93 |
}
|
94 |
}
|
95 |
+
|
96 |
+
private function exclude()
|
97 |
+
{
|
98 |
+
|
99 |
+
$defaults1 = $this->sitemapDefaults->recentArchive;
|
100 |
+
$defaults2 = $this->sitemapDefaults->oldArchive;
|
101 |
+
|
102 |
+
if ($this->isExcluded($defaults1->exclude) && $this->isExcluded($defaults2->exclude) ) {return true;}
|
103 |
+
return false;
|
104 |
+
}
|
105 |
+
|
106 |
+
|
107 |
}
|
108 |
|
109 |
|
code/providers/authorsProvider.php
CHANGED
@@ -17,12 +17,16 @@ namespace xmlSitemapGenerator;
|
|
17 |
|
18 |
public function getPageCount($type)
|
19 |
{
|
|
|
20 |
return 1;
|
21 |
|
22 |
}
|
23 |
|
24 |
public function getPage($type,$page)
|
25 |
{
|
|
|
|
|
|
|
26 |
global $wpdb;
|
27 |
|
28 |
$date = self::getDateField($this->sitemapDefaults->dateField);
|
@@ -78,6 +82,13 @@ namespace xmlSitemapGenerator;
|
|
78 |
}
|
79 |
}
|
80 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
}
|
82 |
|
83 |
|
17 |
|
18 |
public function getPageCount($type)
|
19 |
{
|
20 |
+
if ($this->exclude()) {return 0;}
|
21 |
return 1;
|
22 |
|
23 |
}
|
24 |
|
25 |
public function getPage($type,$page)
|
26 |
{
|
27 |
+
|
28 |
+
if ($this->exclude()) {return ;}
|
29 |
+
|
30 |
global $wpdb;
|
31 |
|
32 |
$date = self::getDateField($this->sitemapDefaults->dateField);
|
82 |
}
|
83 |
}
|
84 |
|
85 |
+
private function exclude()
|
86 |
+
{
|
87 |
+
if ($this->isExcluded($this->sitemapDefaults->authors->exclude) ) {return true;}
|
88 |
+
return false;
|
89 |
+
}
|
90 |
+
|
91 |
+
|
92 |
}
|
93 |
|
94 |
|
code/providers/coreProvider.php
CHANGED
@@ -197,7 +197,7 @@ namespace xmlSitemapGenerator;
|
|
197 |
{
|
198 |
if (isset($value))
|
199 |
{
|
200 |
-
if (value==2) {return true;}
|
201 |
}
|
202 |
return false;
|
203 |
}
|
197 |
{
|
198 |
if (isset($value))
|
199 |
{
|
200 |
+
if ($value==2) {return true;}
|
201 |
}
|
202 |
return false;
|
203 |
}
|
code/providers/indexProvider.php
CHANGED
@@ -71,7 +71,11 @@ namespace xmlSitemapGenerator;
|
|
71 |
foreach($types as $typeName)
|
72 |
{
|
73 |
$pages = $provider->getPageCount($typeName);
|
74 |
-
|
|
|
|
|
|
|
|
|
75 |
}
|
76 |
|
77 |
}
|
71 |
foreach($types as $typeName)
|
72 |
{
|
73 |
$pages = $provider->getPageCount($typeName);
|
74 |
+
if ($pages > 0)
|
75 |
+
{
|
76 |
+
$this->doPopulate($providerName, $typeName, $pages);
|
77 |
+
}
|
78 |
+
|
79 |
}
|
80 |
|
81 |
}
|
code/providers/postsProvider.php
CHANGED
@@ -19,7 +19,14 @@ namespace xmlSitemapGenerator;
|
|
19 |
|
20 |
public function getPageCount($type)
|
21 |
{
|
22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
$frontPageId = get_option( 'page_on_front' );
|
25 |
|
@@ -37,6 +44,9 @@ namespace xmlSitemapGenerator;
|
|
37 |
|
38 |
public function getPage($type, $page)
|
39 |
{
|
|
|
|
|
|
|
40 |
global $wpdb;
|
41 |
|
42 |
if ($page == 1 && $type == 'page') { $this->addHomePage(); }
|
@@ -137,7 +147,7 @@ namespace xmlSitemapGenerator;
|
|
137 |
foreach( $results as $result ) {
|
138 |
|
139 |
// wp_cache_add($result ->ID, $result , 'posts');
|
140 |
-
$defaults =
|
141 |
$exlcude = $this->getMetaValue($result->exclude, $result->tagExclude, $defaults->exclude) ;
|
142 |
|
143 |
if ($exlcude == 2) {$temp = $temp . " - excluded"; continue;}
|
@@ -169,21 +179,45 @@ namespace xmlSitemapGenerator;
|
|
169 |
|
170 |
}
|
171 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
172 |
|
173 |
-
private
|
174 |
{
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
}
|
188 |
|
189 |
private static function getPostTypes()
|
19 |
|
20 |
public function getPageCount($type)
|
21 |
{
|
22 |
+
if ($this->exclude($type)) {return 0;}
|
23 |
+
|
24 |
+
// if type is "page" and included check if we should include pages or just the homepage.
|
25 |
+
if ($this->excludePages()) {return 1;}
|
26 |
+
|
27 |
+
global $wpdb;
|
28 |
+
|
29 |
+
|
30 |
|
31 |
$frontPageId = get_option( 'page_on_front' );
|
32 |
|
44 |
|
45 |
public function getPage($type, $page)
|
46 |
{
|
47 |
+
|
48 |
+
if ($this->exclude($type)) {return;}
|
49 |
+
|
50 |
global $wpdb;
|
51 |
|
52 |
if ($page == 1 && $type == 'page') { $this->addHomePage(); }
|
147 |
foreach( $results as $result ) {
|
148 |
|
149 |
// wp_cache_add($result ->ID, $result , 'posts');
|
150 |
+
$defaults = $this->postTypeDefault( $result->post_type );
|
151 |
$exlcude = $this->getMetaValue($result->exclude, $result->tagExclude, $defaults->exclude) ;
|
152 |
|
153 |
if ($exlcude == 2) {$temp = $temp . " - excluded"; continue;}
|
179 |
|
180 |
}
|
181 |
}
|
182 |
+
|
183 |
+
private function excludePages()
|
184 |
+
{
|
185 |
+
$defaults = $this->postTypeDefault('page');
|
186 |
+
return $this->isExcluded($defaults->exclude);
|
187 |
+
}
|
188 |
+
|
189 |
+
private function exclude($type)
|
190 |
+
{
|
191 |
+
|
192 |
+
$defaults = $this->postTypeDefault($type);
|
193 |
+
|
194 |
+
if ($type == "page")
|
195 |
+
{
|
196 |
+
$defaults2 = $this->sitemapDefaults->homepage;
|
197 |
+
if ( $this->isExcluded($defaults->exclude) && $this->isExcluded($defaults2->exclude) ) {return true;}
|
198 |
+
return false;
|
199 |
+
}
|
200 |
+
else
|
201 |
+
{
|
202 |
+
return $this->isExcluded($defaults->exclude);
|
203 |
+
}
|
204 |
+
|
205 |
+
}
|
206 |
|
207 |
+
private function postTypeDefault($type)
|
208 |
{
|
209 |
+
if ($type == 'page')
|
210 |
+
{
|
211 |
+
return $this->sitemapDefaults->pages;
|
212 |
+
}
|
213 |
+
elseif ($type == 'post')
|
214 |
+
{
|
215 |
+
return $this->sitemapDefaults->posts;
|
216 |
+
}
|
217 |
+
else
|
218 |
+
{
|
219 |
+
return ( isset( $this->sitemapDefaults->{$type} ) ? $this->sitemapDefaults->{$type} : $this->sitemapDefaults->posts );
|
220 |
+
}
|
221 |
}
|
222 |
|
223 |
private static function getPostTypes()
|
code/providers/termsProvider.php
CHANGED
@@ -17,7 +17,10 @@ namespace xmlSitemapGenerator;
|
|
17 |
|
18 |
public function getPageCount($type)
|
19 |
{
|
|
|
|
|
20 |
global $wpdb;
|
|
|
21 |
$sql = "SELECT Count(DISTINCT terms.term_id)
|
22 |
FROM {$wpdb->terms} as terms
|
23 |
INNER JOIN {$wpdb->term_relationships} as Relationships ON terms.Term_id = Relationships.term_taxonomy_id
|
@@ -31,7 +34,11 @@ namespace xmlSitemapGenerator;
|
|
31 |
|
32 |
public function getPage($type, $page)
|
33 |
{
|
|
|
|
|
|
|
34 |
global $wpdb;
|
|
|
35 |
|
36 |
if ($page == 1 && $type == 'page') { $this->addHomePage(); }
|
37 |
|
@@ -65,47 +72,55 @@ namespace xmlSitemapGenerator;
|
|
65 |
return $this->urlsList;
|
66 |
|
67 |
}
|
68 |
-
|
69 |
-
private function doPopulate($results)
|
70 |
-
{
|
71 |
|
72 |
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
{$defaults = $this->sitemapDefaults->taxonomyTags;}
|
81 |
|
82 |
-
|
83 |
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
|
88 |
-
|
89 |
-
|
90 |
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
|
99 |
-
|
100 |
|
101 |
-
}
|
102 |
-
}
|
103 |
}
|
104 |
-
|
|
|
105 |
}
|
106 |
|
107 |
|
108 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
|
110 |
|
111 |
|
17 |
|
18 |
public function getPageCount($type)
|
19 |
{
|
20 |
+
if ($this->exclude($type)) {return 0;}
|
21 |
+
|
22 |
global $wpdb;
|
23 |
+
|
24 |
$sql = "SELECT Count(DISTINCT terms.term_id)
|
25 |
FROM {$wpdb->terms} as terms
|
26 |
INNER JOIN {$wpdb->term_relationships} as Relationships ON terms.Term_id = Relationships.term_taxonomy_id
|
34 |
|
35 |
public function getPage($type, $page)
|
36 |
{
|
37 |
+
|
38 |
+
if ($this->exclude($type)) {return;}
|
39 |
+
|
40 |
global $wpdb;
|
41 |
+
|
42 |
|
43 |
if ($page == 1 && $type == 'page') { $this->addHomePage(); }
|
44 |
|
72 |
return $this->urlsList;
|
73 |
|
74 |
}
|
75 |
+
|
|
|
|
|
76 |
|
77 |
|
78 |
+
private function doPopulate($results)
|
79 |
+
{
|
80 |
+
foreach( $results as $result ) {
|
81 |
+
if ($result->taxonomy == 'category')
|
82 |
+
{$defaults = $this->sitemapDefaults->taxonomyCategories;}
|
83 |
+
else
|
84 |
+
{$defaults = $this->sitemapDefaults->taxonomyTags;}
|
|
|
85 |
|
86 |
+
$exlcude = $this->getMetaValue(null, $result->exclude, $defaults->exclude) ;
|
87 |
|
88 |
+
if ($exlcude != 2)
|
89 |
+
{
|
90 |
+
$pageUrl = get_category_link($result);
|
91 |
|
92 |
+
if ($this->isIncluded($pageUrl,$this->sitemapDefaults->excludeRules ))
|
93 |
+
{
|
94 |
|
95 |
+
$url = new mapItem();
|
96 |
+
$url->location = $pageUrl;
|
97 |
+
$url->title = $result->name;
|
98 |
+
$url->description = $result->description;
|
99 |
+
$url->modified = $result->sitemapDate ;
|
100 |
+
$url->priority = $this->getMetaValue(null,$result->priority,$defaults->priority) ;
|
101 |
+
$url->frequency = $this->getMetaValue(null,$result->frequency,$defaults->frequency) ;
|
102 |
|
103 |
+
$this->addUrls($result->posts, $url);
|
104 |
|
|
|
|
|
105 |
}
|
106 |
+
}
|
107 |
+
}
|
108 |
}
|
109 |
|
110 |
|
111 |
+
private function exclude($type)
|
112 |
+
{
|
113 |
+
if ($type == 'category')
|
114 |
+
{
|
115 |
+
$defaults = $this->sitemapDefaults->taxonomyCategories;
|
116 |
+
}
|
117 |
+
else
|
118 |
+
{
|
119 |
+
$defaults = $this->sitemapDefaults->taxonomyTags;
|
120 |
+
}
|
121 |
+
|
122 |
+
return $this->isExcluded($defaults->exclude);
|
123 |
+
}
|
124 |
|
125 |
|
126 |
|
code/renderers/htmRenderer.php
CHANGED
@@ -37,13 +37,16 @@ namespace xmlSitemapGenerator;
|
|
37 |
$this->renderHeader($title);
|
38 |
|
39 |
echo "<ul>\n";
|
40 |
-
|
|
|
41 |
{
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
|
|
|
|
47 |
|
48 |
$this->renderFooter();
|
49 |
|
37 |
$this->renderHeader($title);
|
38 |
|
39 |
echo "<ul>\n";
|
40 |
+
|
41 |
+
if (isset($urls))
|
42 |
{
|
43 |
+
foreach( $urls as $url )
|
44 |
+
{
|
45 |
+
|
46 |
+
$this->renderItem($url);
|
47 |
+
}
|
48 |
+
echo "</ul>\n";
|
49 |
+
}
|
50 |
|
51 |
$this->renderFooter();
|
52 |
|
code/renderers/newsRenderer.php
CHANGED
@@ -22,17 +22,17 @@ namespace xmlSitemapGenerator;
|
|
22 |
|
23 |
private function renderItem($siteName, $url)
|
24 |
{
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
$this->renderImages($url->images);
|
37 |
echo "</url>\n" ;
|
38 |
}
|
@@ -48,9 +48,10 @@ namespace xmlSitemapGenerator;
|
|
48 |
|
49 |
$siteName = get_option('blogname');
|
50 |
|
51 |
-
|
52 |
$urlXls = xsgPluginPath(). '/assets/SitemapXMLnews.xsl';
|
53 |
-
|
|
|
54 |
ob_start();
|
55 |
header('Content-Type: text/xml; charset=utf-8');
|
56 |
|
@@ -68,11 +69,14 @@ namespace xmlSitemapGenerator;
|
|
68 |
echo ' >';
|
69 |
echo "\n";
|
70 |
|
71 |
-
|
72 |
-
|
73 |
-
|
|
|
|
|
|
|
74 |
}
|
75 |
-
|
76 |
echo "\n";
|
77 |
echo '</urlset>';
|
78 |
echo "\n";
|
22 |
|
23 |
private function renderItem($siteName, $url)
|
24 |
{
|
25 |
+
echo '<url>' ;
|
26 |
+
echo '<loc>' . htmlspecialchars($url->location) . '</loc>';
|
27 |
+
echo '<news:news>';
|
28 |
+
echo '<news:publication>';
|
29 |
+
echo '<news:name>' . $siteName . '</news:name>';
|
30 |
+
echo '<news:language>' . substr( get_bloginfo ( 'language' ), 0, 2 ) . '</news:language>';
|
31 |
+
echo '</news:publication>';
|
32 |
+
echo '<news:publication_date>' . date('Y-m-d\TH:i:s+00:00', $url->modified) . '</news:publication_date>';
|
33 |
+
echo '<news:title>' . $url->title . '</news:title>';
|
34 |
+
echo '</news:news>';
|
35 |
+
|
36 |
$this->renderImages($url->images);
|
37 |
echo "</url>\n" ;
|
38 |
}
|
48 |
|
49 |
$siteName = get_option('blogname');
|
50 |
|
51 |
+
|
52 |
$urlXls = xsgPluginPath(). '/assets/SitemapXMLnews.xsl';
|
53 |
+
|
54 |
+
ob_get_clean();
|
55 |
ob_start();
|
56 |
header('Content-Type: text/xml; charset=utf-8');
|
57 |
|
69 |
echo ' >';
|
70 |
echo "\n";
|
71 |
|
72 |
+
if (isset($urls))
|
73 |
+
{
|
74 |
+
foreach( $urls as $url )
|
75 |
+
{
|
76 |
+
$this->renderItem($siteName,$url);
|
77 |
+
}
|
78 |
}
|
79 |
+
|
80 |
echo "\n";
|
81 |
echo '</urlset>';
|
82 |
echo "\n";
|
code/renderers/rssRenderer.php
CHANGED
@@ -62,11 +62,14 @@ namespace xmlSitemapGenerator;
|
|
62 |
|
63 |
|
64 |
echo "\n";
|
65 |
-
|
66 |
{
|
67 |
-
|
68 |
-
|
69 |
-
|
|
|
|
|
|
|
70 |
echo "\n";
|
71 |
echo '</channel>';
|
72 |
echo "\n";
|
62 |
|
63 |
|
64 |
echo "\n";
|
65 |
+
if (isset($urls))
|
66 |
{
|
67 |
+
foreach( $urls as $url )
|
68 |
+
{
|
69 |
+
|
70 |
+
$this->renderItem($url, $isIndex);
|
71 |
+
}
|
72 |
+
}
|
73 |
echo "\n";
|
74 |
echo '</channel>';
|
75 |
echo "\n";
|
code/renderers/xmlRenderer.php
CHANGED
@@ -99,6 +99,7 @@ namespace xmlSitemapGenerator;
|
|
99 |
if (!empty($image->title)) { echo '<image:title>' . $image->title . '</image:title>';}
|
100 |
echo "</image:image>\n" ;
|
101 |
}
|
|
|
102 |
}
|
103 |
|
104 |
private function renderItem( $url)
|
@@ -115,7 +116,11 @@ namespace xmlSitemapGenerator;
|
|
115 |
if (!$url->priority==0) {
|
116 |
echo "<priority>" . $this->getPriority($url->priority) . "</priority>";
|
117 |
}
|
118 |
-
|
|
|
|
|
|
|
|
|
119 |
echo "</url>\n" ;
|
120 |
}
|
121 |
|
@@ -125,6 +130,7 @@ namespace xmlSitemapGenerator;
|
|
125 |
|
126 |
$urlXls = xsgPluginPath(). '/assets/SitemapXML.xsl';
|
127 |
|
|
|
128 |
ob_start();
|
129 |
header('Content-Type: text/xml; charset=utf-8');
|
130 |
|
@@ -140,12 +146,15 @@ namespace xmlSitemapGenerator;
|
|
140 |
echo ' xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd http://www.google.com/schemas/sitemap-image/1.1 http://www.google.com/schemas/sitemap-image/1.1/sitemap-image.xsd"';
|
141 |
echo ' >';
|
142 |
echo "\n";
|
143 |
-
|
144 |
-
|
145 |
-
{
|
146 |
-
|
147 |
-
|
148 |
-
|
|
|
|
|
|
|
149 |
}
|
150 |
|
151 |
echo "\n";
|
@@ -159,9 +168,10 @@ namespace xmlSitemapGenerator;
|
|
159 |
|
160 |
public function renderPages($urls){
|
161 |
|
162 |
-
|
163 |
$urlXls = xsgPluginPath(). '/assets/SitemapXML.xsl';
|
164 |
-
|
|
|
165 |
ob_start();
|
166 |
header('Content-Type: text/xml; charset=utf-8');
|
167 |
|
@@ -177,10 +187,13 @@ namespace xmlSitemapGenerator;
|
|
177 |
echo ' xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd http://www.google.com/schemas/sitemap-image/1.1 http://www.google.com/schemas/sitemap-image/1.1/sitemap-image.xsd"';
|
178 |
echo ' >';
|
179 |
echo "\n";
|
180 |
-
|
181 |
-
|
182 |
-
{
|
183 |
-
|
|
|
|
|
|
|
184 |
}
|
185 |
|
186 |
echo "\n";
|
99 |
if (!empty($image->title)) { echo '<image:title>' . $image->title . '</image:title>';}
|
100 |
echo "</image:image>\n" ;
|
101 |
}
|
102 |
+
|
103 |
}
|
104 |
|
105 |
private function renderItem( $url)
|
116 |
if (!$url->priority==0) {
|
117 |
echo "<priority>" . $this->getPriority($url->priority) . "</priority>";
|
118 |
}
|
119 |
+
|
120 |
+
if (isset($url->images))
|
121 |
+
{
|
122 |
+
$this->renderImages($url->images);
|
123 |
+
}
|
124 |
echo "</url>\n" ;
|
125 |
}
|
126 |
|
130 |
|
131 |
$urlXls = xsgPluginPath(). '/assets/SitemapXML.xsl';
|
132 |
|
133 |
+
ob_get_clean();
|
134 |
ob_start();
|
135 |
header('Content-Type: text/xml; charset=utf-8');
|
136 |
|
146 |
echo ' xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd http://www.google.com/schemas/sitemap-image/1.1 http://www.google.com/schemas/sitemap-image/1.1/sitemap-image.xsd"';
|
147 |
echo ' >';
|
148 |
echo "\n";
|
149 |
+
|
150 |
+
if (isset($urls))
|
151 |
+
{
|
152 |
+
foreach( $urls as $url )
|
153 |
+
{
|
154 |
+
echo '<sitemap>' ;
|
155 |
+
echo '<loc>' . htmlspecialchars($url->location) . '</loc>';
|
156 |
+
echo "</sitemap>\n" ;
|
157 |
+
}
|
158 |
}
|
159 |
|
160 |
echo "\n";
|
168 |
|
169 |
public function renderPages($urls){
|
170 |
|
171 |
+
|
172 |
$urlXls = xsgPluginPath(). '/assets/SitemapXML.xsl';
|
173 |
+
|
174 |
+
ob_get_clean();
|
175 |
ob_start();
|
176 |
header('Content-Type: text/xml; charset=utf-8');
|
177 |
|
187 |
echo ' xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd http://www.google.com/schemas/sitemap-image/1.1 http://www.google.com/schemas/sitemap-image/1.1/sitemap-image.xsd"';
|
188 |
echo ' >';
|
189 |
echo "\n";
|
190 |
+
|
191 |
+
if (isset($urls))
|
192 |
+
{
|
193 |
+
foreach( $urls as $url )
|
194 |
+
{
|
195 |
+
$this->renderItem($url);
|
196 |
+
}
|
197 |
}
|
198 |
|
199 |
echo "\n";
|
code/upgrader.php
CHANGED
@@ -6,35 +6,37 @@ namespace xmlSitemapGenerator;
|
|
6 |
class upgrader
|
7 |
{
|
8 |
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
public static function checkUpgrade()
|
13 |
{
|
14 |
-
|
15 |
-
$
|
|
|
|
|
16 |
|
17 |
if ($installed_Update < $current_update )
|
18 |
{
|
19 |
self::runScripts($installed_Update);
|
20 |
update_option( "xmsg_Update", $current_update , true);
|
21 |
}
|
|
|
22 |
}
|
23 |
|
24 |
public static function runScripts($installed_Update)
|
25 |
{
|
26 |
global $wpdb;
|
27 |
$tablemeta = $wpdb->prefix . 'xsg_sitemap_meta';
|
28 |
-
|
|
|
29 |
{
|
30 |
$cmd = "UPDATE {$tablemeta} SET frequency = 8 WHERE frequency = 7";
|
31 |
$wpdb->query($cmd);
|
32 |
}
|
33 |
|
34 |
-
if ($installed_Update <
|
35 |
{
|
36 |
-
$cmd = "
|
37 |
$wpdb->query($cmd);
|
|
|
38 |
}
|
39 |
}
|
40 |
|
6 |
class upgrader
|
7 |
{
|
8 |
|
9 |
+
public static function doUpgrade()
|
|
|
|
|
|
|
10 |
{
|
11 |
+
|
12 |
+
$current_update = 4;
|
13 |
+
|
14 |
+
$installed_Update = intval(get_option( "xmsg_Update" , 0 ));
|
15 |
|
16 |
if ($installed_Update < $current_update )
|
17 |
{
|
18 |
self::runScripts($installed_Update);
|
19 |
update_option( "xmsg_Update", $current_update , true);
|
20 |
}
|
21 |
+
|
22 |
}
|
23 |
|
24 |
public static function runScripts($installed_Update)
|
25 |
{
|
26 |
global $wpdb;
|
27 |
$tablemeta = $wpdb->prefix . 'xsg_sitemap_meta';
|
28 |
+
|
29 |
+
if ($installed_Update < 1)
|
30 |
{
|
31 |
$cmd = "UPDATE {$tablemeta} SET frequency = 8 WHERE frequency = 7";
|
32 |
$wpdb->query($cmd);
|
33 |
}
|
34 |
|
35 |
+
if ($installed_Update < 4)
|
36 |
{
|
37 |
+
$cmd = "ALTER TABLE {$tablemeta} ADD COLUMN news INT NOT NULL DEFAULT 0";
|
38 |
$wpdb->query($cmd);
|
39 |
+
|
40 |
}
|
41 |
}
|
42 |
|
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
Contributors: XmlSitemapGenerator
|
3 |
Tags: google, google sitemaps, seo, xml sitemap
|
4 |
Donate link: https://xmlsitemapgenerator.org/contribute/subscribeother.aspx?service=wordpress
|
5 |
-
Requires at least:
|
6 |
-
Tested up to: 5.
|
7 |
|
8 |
Improve your websites SEO with a comprehensive, easy to use RSS and XML sitemap plugin. Compatible with Google, Bing, Baidu, Yandex and more.
|
9 |
|
@@ -127,6 +127,20 @@ You should now be up and running, but you may also want to :
|
|
127 |
|
128 |
== Changelog ==
|
129 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
= 2.0.0 =
|
131 |
Release Date: February 7th, 2021
|
132 |
|
2 |
Contributors: XmlSitemapGenerator
|
3 |
Tags: google, google sitemaps, seo, xml sitemap
|
4 |
Donate link: https://xmlsitemapgenerator.org/contribute/subscribeother.aspx?service=wordpress
|
5 |
+
Requires at least: 5.1.0
|
6 |
+
Tested up to: 5.8.0
|
7 |
|
8 |
Improve your websites SEO with a comprehensive, easy to use RSS and XML sitemap plugin. Compatible with Google, Bing, Baidu, Yandex and more.
|
9 |
|
127 |
|
128 |
== Changelog ==
|
129 |
|
130 |
+
= 2.0.2 =
|
131 |
+
Release Date: August 19th, 2021
|
132 |
+
* Fix : PHP debug / log errors xmlRenderer.php when images disabled.
|
133 |
+
* Fix : Post settings not updating.
|
134 |
+
* Fix : News sitemap missing language tag.
|
135 |
+
* Fix : News not working due to bad database upgrade script.
|
136 |
+
* Fix : Activation issues on network installs.
|
137 |
+
|
138 |
+
= 2.0.1 =
|
139 |
+
Release Date: February 11th, 2021
|
140 |
+
* Fix : Activation issue.
|
141 |
+
* Fix : Sitemap index "Invalid content" issue.
|
142 |
+
* Fix : Exclude setting not working.
|
143 |
+
|
144 |
= 2.0.0 =
|
145 |
Release Date: February 7th, 2021
|
146 |
|
www-xml-sitemap-generator-org.php
CHANGED
@@ -4,7 +4,7 @@ namespace xmlSitemapGenerator;
|
|
4 |
Plugin Name: Google XML Sitemap Generator
|
5 |
Plugin URI: https://XmlSitemapGenerator.org
|
6 |
Description: HTML, RSS and Google XML Sitemap generator compatible with Google, Bing, Baidu, Yandex and more.
|
7 |
-
Version: 2.0.
|
8 |
Author: XmlSitemapGenerator.org
|
9 |
Author URI: https://XmlSitemapGenerator.org
|
10 |
License: GPL2
|
@@ -29,14 +29,14 @@ if(defined('ABSPATH') && defined('WPINC')) {
|
|
29 |
|
30 |
add_action("init", 'xmlSitemapGenerator\core::initialisePlugin');
|
31 |
|
|
|
32 |
add_action( 'activated_plugin', 'xmlSitemapGenerator\core::activated');
|
33 |
-
|
34 |
-
add_action( 'plugins_loaded', 'xmlSitemapGenerator\core::checkUpgrade' );
|
35 |
-
|
36 |
-
|
37 |
|
38 |
// when ever a new blog is created in network mode
|
39 |
-
add_action( '
|
|
|
|
|
|
|
40 |
|
41 |
}
|
42 |
|
4 |
Plugin Name: Google XML Sitemap Generator
|
5 |
Plugin URI: https://XmlSitemapGenerator.org
|
6 |
Description: HTML, RSS and Google XML Sitemap generator compatible with Google, Bing, Baidu, Yandex and more.
|
7 |
+
Version: 2.0.2
|
8 |
Author: XmlSitemapGenerator.org
|
9 |
Author URI: https://XmlSitemapGenerator.org
|
10 |
License: GPL2
|
29 |
|
30 |
add_action("init", 'xmlSitemapGenerator\core::initialisePlugin');
|
31 |
|
32 |
+
// used to redirect the user to the plugin settings when activated manually.
|
33 |
add_action( 'activated_plugin', 'xmlSitemapGenerator\core::activated');
|
|
|
|
|
|
|
|
|
34 |
|
35 |
// when ever a new blog is created in network mode
|
36 |
+
add_action( 'wp_initialize_site', 'xmlSitemapGenerator\core::activateNewBlog', 900 );
|
37 |
+
|
38 |
+
add_action( 'upgrader_process_complete', 'xmlSitemapGenerator\core::activatePlugin' );
|
39 |
+
|
40 |
|
41 |
}
|
42 |
|