Version Description
Release Date: April 28th, 2022 * New : Set an empty sitemap file to disable a given map. * Fix : Index file showing news twice. * Fix : Archive provider rendered regardless of settings * Fix : Erroneous variables in archive provider. * Fix : Added WP sanitize and esc filters * Fix : Enqueue scripts instead of inline. * Fix : Stable tag. * Fix : Removed analytics. * Fix : Remove latest archive from XML index.
Download this release
Release Info
Developer | XmlSitemapGenerator |
Plugin | Google XML Sitemap Generator |
Version | 2.0.4 |
Comparing to | |
See all releases |
Code changes from version 2.0.3 to 2.0.4
- code/authorMetaData.php +11 -13
- code/categoryMetaData.php +16 -18
- code/core.php +34 -84
- code/dataAccess.php +1 -1
- code/helpers.php +38 -0
- code/pinger.php +1 -2
- code/postMetaData.php +10 -18
- code/providers/ZZZ__postsProvider.php +0 -139
- code/providers/_pageProvider.php +0 -130
- code/providers/archiveProvider.php +27 -15
- code/providers/authorsProvider.php +4 -4
- code/providers/coreProvider.php +6 -24
- code/providers/indexProvider.php +10 -5
- code/providers/latestProvider.php +2 -2
- code/providers/newsProvider.php +1 -1
- code/providers/postsProvider.php +5 -5
- code/providers/termsProvider.php +3 -4
- code/renderers/coreRenderer.php +3 -3
- code/renderers/htmRenderer.php +3 -3
- code/renderers/newsRenderer.php +9 -9
- code/renderers/rssRenderer.php +8 -8
- code/renderers/xmlRenderer.php +10 -10
- code/settings.php +80 -100
- readme.txt +15 -1
- www-xml-sitemap-generator-org.php +1 -1
code/authorMetaData.php
CHANGED
@@ -2,6 +2,7 @@
|
|
2 |
namespace xmlSitemapGenerator;
|
3 |
|
4 |
include_once 'dataAccess.php';
|
|
|
5 |
|
6 |
class authorMetaData
|
7 |
{
|
@@ -21,7 +22,6 @@ class authorMetaData
|
|
21 |
if ( !isset( $_POST['wpXSG_meta_nonce'] ) || !wp_verify_nonce( $_POST['wpXSG_meta_nonce'], basename( __FILE__ ) ) )
|
22 |
return ;
|
23 |
|
24 |
-
|
25 |
/* Check if the current user has permission to edit the post. */
|
26 |
if ( !current_user_can( 'edit_user') )
|
27 |
return $userId;
|
@@ -29,18 +29,17 @@ class authorMetaData
|
|
29 |
|
30 |
$settings = new metaSettings();
|
31 |
|
32 |
-
$settings->id = (
|
33 |
$settings->itemId = $userId ;
|
34 |
$settings->itemType = "author";
|
35 |
-
$settings->exclude = (
|
36 |
-
$settings->priority = (
|
37 |
-
$settings->frequency = (
|
38 |
-
$settings->inherit = (
|
39 |
|
40 |
dataAccess::saveMetaItem($settings );
|
41 |
|
42 |
-
|
43 |
-
|
44 |
}
|
45 |
|
46 |
|
@@ -88,12 +87,11 @@ class authorMetaData
|
|
88 |
|
89 |
</tbody></table>
|
90 |
|
91 |
-
<script type="text/javascript" src="<?php echo xsgPluginPath(); ?>assets/scripts.js"></script>
|
92 |
<script>
|
93 |
-
xsg_populate("wpXSG-Exclude" ,excludeSelect, <?php echo $settings->exclude ?>);
|
94 |
-
xsg_populate("wpXSG-Priority" ,prioritySelect, <?php echo $settings->priority ?>);
|
95 |
-
xsg_populate("wpXSG-Frequency" ,frequencySelect, <?php echo $settings->frequency
|
96 |
-
xsg_populate("wpXSG-Inherit" ,inheritSelect, <?php echo $settings->inherit ?>);
|
97 |
</script>
|
98 |
|
99 |
|
2 |
namespace xmlSitemapGenerator;
|
3 |
|
4 |
include_once 'dataAccess.php';
|
5 |
+
include_once 'helpers.php';
|
6 |
|
7 |
class authorMetaData
|
8 |
{
|
22 |
if ( !isset( $_POST['wpXSG_meta_nonce'] ) || !wp_verify_nonce( $_POST['wpXSG_meta_nonce'], basename( __FILE__ ) ) )
|
23 |
return ;
|
24 |
|
|
|
25 |
/* Check if the current user has permission to edit the post. */
|
26 |
if ( !current_user_can( 'edit_user') )
|
27 |
return $userId;
|
29 |
|
30 |
$settings = new metaSettings();
|
31 |
|
32 |
+
$settings->id = helpers::getFieldValue('wpXSG-metaId' , '0' );
|
33 |
$settings->itemId = $userId ;
|
34 |
$settings->itemType = "author";
|
35 |
+
$settings->exclude = helpers::getFieldValue('wpXSG-Exclude' , '0' );
|
36 |
+
$settings->priority = helpers::getFieldValue('wpXSG-Priority' , 'default' );
|
37 |
+
$settings->frequency = helpers::getFieldValue('wpXSG-Frequency' , 'default' );
|
38 |
+
$settings->inherit = helpers::getFieldValue('wpXSG-Inherit' , 0 );
|
39 |
|
40 |
dataAccess::saveMetaItem($settings );
|
41 |
|
42 |
+
|
|
|
43 |
}
|
44 |
|
45 |
|
87 |
|
88 |
</tbody></table>
|
89 |
|
|
|
90 |
<script>
|
91 |
+
xsg_populate("wpXSG-Exclude" ,excludeSelect, <?php echo esc_attr($settings->exclude) ?>);
|
92 |
+
xsg_populate("wpXSG-Priority" ,prioritySelect, <?php echo esc_attr($settings->priority) ?>);
|
93 |
+
xsg_populate("wpXSG-Frequency" ,frequencySelect, <?php echo esc_attr($settings->frequency) ?>);
|
94 |
+
xsg_populate("wpXSG-Inherit" ,inheritSelect, <?php echo esc_attr($settings->inherit) ?>);
|
95 |
</script>
|
96 |
|
97 |
|
code/categoryMetaData.php
CHANGED
@@ -30,14 +30,14 @@ class categoryMetaData
|
|
30 |
|
31 |
$settings = new metaSettings();
|
32 |
|
33 |
-
$settings->id = (
|
34 |
$settings->itemId = $term_id ;
|
35 |
$settings->itemType = "taxonomy";
|
36 |
-
$settings->exclude = (
|
37 |
-
$settings->priority = (
|
38 |
-
$settings->frequency = (
|
39 |
-
$settings->inherit =
|
40 |
-
$settings->news =
|
41 |
dataAccess::saveMetaItem($settings );
|
42 |
|
43 |
}
|
@@ -93,13 +93,12 @@ class categoryMetaData
|
|
93 |
</div>
|
94 |
<?php } ?>
|
95 |
|
96 |
-
<script type="text/javascript" src="<?php echo xsgPluginPath(); ?>assets/scripts.js"></script>
|
97 |
<script>
|
98 |
-
xsg_populate("wpXSG-Exclude" ,excludeSelect, <?php echo $settings->exclude
|
99 |
-
xsg_populate("wpXSG-Priority" ,prioritySelect, <?php echo $settings->priority ?>);
|
100 |
-
xsg_populate("wpXSG-Frequency" ,frequencySelect, <?php echo $settings->frequency ?>);
|
101 |
-
xsg_populate("wpXSG-Inherit" ,inheritSelect, <?php echo $settings->inherit ?>);
|
102 |
-
xsg_populate("wpXSG-News" ,newsSelect, <?php echo $settings->news ?>);
|
103 |
</script>
|
104 |
|
105 |
<?php
|
@@ -163,13 +162,12 @@ class categoryMetaData
|
|
163 |
<?php } ?>
|
164 |
</tbody></table>
|
165 |
|
166 |
-
<script type="text/javascript" src="<?php echo xsgPluginPath(); ?>assets/scripts.js"></script>
|
167 |
<script>
|
168 |
-
xsg_populate("wpXSG-Exclude" ,excludeSelect, <?php echo $settings->exclude ?>);
|
169 |
-
xsg_populate("wpXSG-Priority" ,prioritySelect, <?php echo $settings->priority ?>);
|
170 |
-
xsg_populate("wpXSG-Frequency" ,frequencySelect, <?php echo $settings->frequency ?>);
|
171 |
-
xsg_populate("wpXSG-Inherit" ,inheritSelect, <?php echo $settings->inherit ?>);
|
172 |
-
xsg_populate("wpXSG-News" ,newsSelect, <?php echo $settings->news ?>);
|
173 |
</script>
|
174 |
|
175 |
|
30 |
|
31 |
$settings = new metaSettings();
|
32 |
|
33 |
+
$settings->id = helpers::getFieldValue('wpXSG-metaId' , '0' );
|
34 |
$settings->itemId = $term_id ;
|
35 |
$settings->itemType = "taxonomy";
|
36 |
+
$settings->exclude = helpers::getFieldValue('wpXSG-Exclude' , '0' );
|
37 |
+
$settings->priority = helpers::getFieldValue('wpXSG-Priority' , 'default' );
|
38 |
+
$settings->frequency = helpers::getFieldValue('wpXSG-Frequency', 'default' );
|
39 |
+
$settings->inherit =helpers::getFieldValue('wpXSG-Inherit', 0 );
|
40 |
+
$settings->news =helpers::getFieldValue('wpXSG-News', 0 );
|
41 |
dataAccess::saveMetaItem($settings );
|
42 |
|
43 |
}
|
93 |
</div>
|
94 |
<?php } ?>
|
95 |
|
|
|
96 |
<script>
|
97 |
+
xsg_populate("wpXSG-Exclude" ,excludeSelect, <?php echo esc_attr($settings->exclude ); ?>);
|
98 |
+
xsg_populate("wpXSG-Priority" ,prioritySelect, <?php echo esc_attr($settings->priority); ?>);
|
99 |
+
xsg_populate("wpXSG-Frequency" ,frequencySelect, <?php echo esc_attr($settings->frequency); ?>);
|
100 |
+
xsg_populate("wpXSG-Inherit" ,inheritSelect, <?php echo esc_attr($settings->inherit); ?>);
|
101 |
+
xsg_populate("wpXSG-News" ,newsSelect, <?php echo esc_attr($settings->news) ?>);
|
102 |
</script>
|
103 |
|
104 |
<?php
|
162 |
<?php } ?>
|
163 |
</tbody></table>
|
164 |
|
|
|
165 |
<script>
|
166 |
+
xsg_populate("wpXSG-Exclude" ,excludeSelect, <?php echo esc_attr($settings->exclude); ?>);
|
167 |
+
xsg_populate("wpXSG-Priority" ,prioritySelect, <?php echo esc_attr($settings->priority); ?>);
|
168 |
+
xsg_populate("wpXSG-Frequency" ,frequencySelect, <?php echo esc_attr($settings->frequency); ?>);
|
169 |
+
xsg_populate("wpXSG-Inherit" ,inheritSelect, <?php echo esc_attr($settings->inherit); ?>);
|
170 |
+
xsg_populate("wpXSG-News" ,newsSelect, <?php echo esc_attr($settings->news); ?>);
|
171 |
</script>
|
172 |
|
173 |
|
code/core.php
CHANGED
@@ -5,6 +5,7 @@ namespace xmlSitemapGenerator;
|
|
5 |
include_once 'dataAccess.php';
|
6 |
include_once 'settingsModels.php';
|
7 |
include_once 'upgrader.php';
|
|
|
8 |
|
9 |
|
10 |
|
@@ -26,25 +27,18 @@ class core {
|
|
26 |
return XSG_PLUGIN_VERSION;
|
27 |
}
|
28 |
|
29 |
-
|
30 |
-
{
|
31 |
-
return ( isset( $object->{$property} ) ? $object->{$property} : $default );
|
32 |
-
}
|
33 |
-
public static function safeRead($object,$property)
|
34 |
-
{
|
35 |
-
return self::safeRead2($object,$property, "");
|
36 |
-
}
|
37 |
|
38 |
public static function getGlobalSettings()
|
39 |
{
|
40 |
$globalSettings = get_option( "wpXSG_global" , new globalSettings() );
|
41 |
|
42 |
// ensure when we read the global settings we have urls assigned
|
43 |
-
$globalSettings->urlXmlSitemap =
|
44 |
-
$globalSettings->urlNewsSitemap =
|
45 |
-
$globalSettings->urlRssSitemap =
|
46 |
-
$globalSettings->urlRssLatest =
|
47 |
-
$globalSettings->urlHtmlSitemap =
|
48 |
|
49 |
return $globalSettings;
|
50 |
}
|
@@ -66,10 +60,10 @@ class core {
|
|
66 |
add_option( "wpXSG_MapId", uniqid("",true) );
|
67 |
update_option( "xmsg_LastPing", 0 );
|
68 |
|
69 |
-
self::updateStatistics("Plugin","Activate", "");
|
70 |
|
71 |
}
|
72 |
|
|
|
73 |
|
74 |
public static function activatePlugin($network_wide){
|
75 |
|
@@ -110,11 +104,13 @@ class core {
|
|
110 |
}
|
111 |
|
112 |
public static function deactivatePlugin() {
|
113 |
-
|
114 |
}
|
115 |
|
116 |
-
|
117 |
-
|
|
|
|
|
118 |
public static function initialisePlugin()
|
119 |
{
|
120 |
|
@@ -131,6 +127,7 @@ class core {
|
|
131 |
add_filter('plugin_row_meta', array(__CLASS__, 'filter_plugin_row_meta'),10,2);
|
132 |
add_action('do_robots', array(__CLASS__, 'addRobotLinks'), 100, 0);
|
133 |
add_action('wp_head', array(__CLASS__, 'addRssLink'),100);
|
|
|
134 |
|
135 |
// only include admin files when necessary.
|
136 |
if (is_admin() && !is_network_admin())
|
@@ -158,21 +155,22 @@ class core {
|
|
158 |
|
159 |
}
|
160 |
|
161 |
-
public static function
|
162 |
{
|
163 |
$url = self::getGlobalProperty($property);
|
164 |
-
|
165 |
-
|
|
|
|
|
166 |
}
|
167 |
|
168 |
public static function add_rewrite_rules()
|
169 |
{
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
add_rewrite_rule(self::getRewriteUrl("urlHtmlSitemap"),'index.php?xsg-format=htm&xsg-provider=index&xsg-type=index&xsg-page=1','top');
|
176 |
add_rewrite_rule("sitemap-files/([a-z]+)/([a-z]+)/([^/]+)/([0-9]+)/?", 'index.php?xsg-format=$matches[1]&xsg-provider=$matches[2]&xsg-type=$matches[3]&xsg-page=$matches[4]&','top');
|
177 |
}
|
178 |
|
@@ -203,7 +201,7 @@ class core {
|
|
203 |
|
204 |
if ($warnings)
|
205 |
{
|
206 |
-
echo
|
207 |
}
|
208 |
|
209 |
}
|
@@ -256,10 +254,6 @@ class core {
|
|
256 |
$page= self::readQueryVar("xsg-page");
|
257 |
|
258 |
|
259 |
-
|
260 |
-
// echo var_dump($format);
|
261 |
-
// exit;
|
262 |
-
|
263 |
if($format !=null && $provider != null && $type !=null && $page !=null)
|
264 |
{
|
265 |
|
@@ -301,8 +295,7 @@ class core {
|
|
301 |
{$renderer->renderPages($urls);}
|
302 |
|
303 |
$time = core::getTimeBand($startTime);
|
304 |
-
|
305 |
-
|
306 |
}
|
307 |
|
308 |
|
@@ -312,15 +305,15 @@ class core {
|
|
312 |
if($globalSettings->addToRobots == true)
|
313 |
{
|
314 |
$base = trailingslashit( get_bloginfo( 'url' ) );
|
315 |
-
echo "\nSitemap: " . $base . self::getGlobalProperty("urlXmlSitemap") . "\n";
|
316 |
|
317 |
-
echo "\nAllow: /" . self::getGlobalProperty("urlRssSitemap");
|
318 |
-
echo "\nAllow: /" . self::getGlobalProperty("urlRssLatest");
|
319 |
-
echo "\nAllow: /" . self::getGlobalProperty("urlHtmlSitemap");
|
320 |
|
321 |
}
|
322 |
echo "\n\n";
|
323 |
-
echo
|
324 |
|
325 |
}
|
326 |
public static function addRssLink()
|
@@ -330,8 +323,8 @@ class core {
|
|
330 |
{
|
331 |
$base = trailingslashit( get_bloginfo( 'url' ) );
|
332 |
$url = $base . "rsslatest.xml";
|
333 |
-
$link = '<link rel="alternate" type="application/rss+xml" title="RSS" href="' . $url . '" />';
|
334 |
-
echo
|
335 |
}
|
336 |
}
|
337 |
|
@@ -339,7 +332,7 @@ class core {
|
|
339 |
public static function getGlobalProperty($property)
|
340 |
{
|
341 |
$globalSettings = self::getGlobalSettings();
|
342 |
-
$value =
|
343 |
return $value;
|
344 |
}
|
345 |
|
@@ -439,50 +432,7 @@ class core {
|
|
439 |
|
440 |
return $timeBand;
|
441 |
}
|
442 |
-
public static function updateStatistics($eventCategory, $eventAction, $timeBand) {
|
443 |
-
|
444 |
-
$globalSettings = self::getGlobalSettings();
|
445 |
-
|
446 |
-
if ($globalSettings->sendStats)
|
447 |
-
{
|
448 |
-
global $wp_version;
|
449 |
-
$postCountLabel = dataAccess::getPostCountBand();
|
450 |
-
|
451 |
-
$postData = array(
|
452 |
-
'v' => 1,
|
453 |
-
'tid' => 'UA-679276-7',
|
454 |
-
'cid' => get_option('wpXSG_MapId'),
|
455 |
-
'aip' => 1,
|
456 |
-
't' => 'event',
|
457 |
-
'ec' => $eventCategory,
|
458 |
-
'ea' => $eventAction,
|
459 |
-
'ev' => 1,
|
460 |
-
'cd1' => site_url(),
|
461 |
-
'cd2' => $wp_version,
|
462 |
-
'cd3' => self::pluginVersion(),
|
463 |
-
'cd4' => PHP_VERSION,
|
464 |
-
'cd5' => $postCountLabel,
|
465 |
-
'cd6' => $timeBand
|
466 |
-
);
|
467 |
-
|
468 |
-
$url = 'https://www.google-analytics.com/collect';
|
469 |
-
|
470 |
-
try
|
471 |
-
{
|
472 |
-
$response = wp_remote_post($url,
|
473 |
-
array(
|
474 |
-
'method' => 'POST',
|
475 |
-
'body' => $postData
|
476 |
-
));
|
477 |
-
}
|
478 |
-
catch (Exception $e)
|
479 |
-
{
|
480 |
-
statusUpdate("sendStats : " . $e->getMessage());
|
481 |
-
}
|
482 |
-
|
483 |
|
484 |
-
}
|
485 |
-
}
|
486 |
}
|
487 |
|
488 |
|
5 |
include_once 'dataAccess.php';
|
6 |
include_once 'settingsModels.php';
|
7 |
include_once 'upgrader.php';
|
8 |
+
include_once 'helpers.php';
|
9 |
|
10 |
|
11 |
|
27 |
return XSG_PLUGIN_VERSION;
|
28 |
}
|
29 |
|
30 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
|
32 |
public static function getGlobalSettings()
|
33 |
{
|
34 |
$globalSettings = get_option( "wpXSG_global" , new globalSettings() );
|
35 |
|
36 |
// ensure when we read the global settings we have urls assigned
|
37 |
+
$globalSettings->urlXmlSitemap = helpers::safeRead2($globalSettings,"urlXmlSitemap","xmlsitemap.xml");
|
38 |
+
$globalSettings->urlNewsSitemap = helpers::safeRead2($globalSettings,"urlNewsSitemap","newssitemap.xml");
|
39 |
+
$globalSettings->urlRssSitemap = helpers::safeRead2($globalSettings,"urlRssSitemap","rsssitemap.xml");
|
40 |
+
$globalSettings->urlRssLatest = helpers::safeRead2($globalSettings,"urlRssLatest","rsslatest.xml");
|
41 |
+
$globalSettings->urlHtmlSitemap = helpers::safeRead2($globalSettings,"urlHtmlSitemap","htmlsitemap.htm");
|
42 |
|
43 |
return $globalSettings;
|
44 |
}
|
60 |
add_option( "wpXSG_MapId", uniqid("",true) );
|
61 |
update_option( "xmsg_LastPing", 0 );
|
62 |
|
|
|
63 |
|
64 |
}
|
65 |
|
66 |
+
|
67 |
|
68 |
public static function activatePlugin($network_wide){
|
69 |
|
104 |
}
|
105 |
|
106 |
public static function deactivatePlugin() {
|
107 |
+
|
108 |
}
|
109 |
|
110 |
+
public static function adminScripts() {
|
111 |
+
wp_enqueue_script( 'xsgScripts', xsgPluginPath() . 'assets/scripts.js' , false );
|
112 |
+
}
|
113 |
+
|
114 |
public static function initialisePlugin()
|
115 |
{
|
116 |
|
127 |
add_filter('plugin_row_meta', array(__CLASS__, 'filter_plugin_row_meta'),10,2);
|
128 |
add_action('do_robots', array(__CLASS__, 'addRobotLinks'), 100, 0);
|
129 |
add_action('wp_head', array(__CLASS__, 'addRssLink'),100);
|
130 |
+
add_action( 'admin_enqueue_scripts', array(__CLASS__, 'adminScripts'),100);
|
131 |
|
132 |
// only include admin files when necessary.
|
133 |
if (is_admin() && !is_network_admin())
|
155 |
|
156 |
}
|
157 |
|
158 |
+
public static function addRewriteUrl($property, $newUrl)
|
159 |
{
|
160 |
$url = self::getGlobalProperty($property);
|
161 |
+
if (strlen($url) > 0 ) {
|
162 |
+
$url = str_replace(".","\.",$url) . '$';
|
163 |
+
add_rewrite_rule($url, $newUrl, 'top');
|
164 |
+
}
|
165 |
}
|
166 |
|
167 |
public static function add_rewrite_rules()
|
168 |
{
|
169 |
+
self::addRewriteUrl("urlXmlSitemap", 'index.php?xsg-format=xml&xsg-provider=index&xsg-type=index&xsg-page=1');
|
170 |
+
self::addRewriteUrl("urlNewsSitemap",'index.php?xsg-format=news&xsg-provider=news&xsg-type=news&xsg-page=1');
|
171 |
+
self::addRewriteUrl("urlRssSitemap", 'index.php?xsg-format=rss&xsg-provider=index&xsg-type=index&xsg-page=1');
|
172 |
+
self::addRewriteUrl("urlRssLatest", 'index.php?xsg-format=rss&xsg-provider=latest&xsg-type=latest&xsg-page=1');
|
173 |
+
self::addRewriteUrl("urlHtmlSitemap",'index.php?xsg-format=htm&xsg-provider=index&xsg-type=index&xsg-page=1');
|
|
|
174 |
add_rewrite_rule("sitemap-files/([a-z]+)/([a-z]+)/([^/]+)/([0-9]+)/?", 'index.php?xsg-format=$matches[1]&xsg-provider=$matches[2]&xsg-type=$matches[3]&xsg-page=$matches[4]&','top');
|
175 |
}
|
176 |
|
201 |
|
202 |
if ($warnings)
|
203 |
{
|
204 |
+
echo '<div id="sitemap-warnings" class="error fade"><p><strong>Problems that will prevent your sitemap working correctly :</strong></p>' . esc_attr($warnings) . '</div>';
|
205 |
}
|
206 |
|
207 |
}
|
254 |
$page= self::readQueryVar("xsg-page");
|
255 |
|
256 |
|
|
|
|
|
|
|
|
|
257 |
if($format !=null && $provider != null && $type !=null && $page !=null)
|
258 |
{
|
259 |
|
295 |
{$renderer->renderPages($urls);}
|
296 |
|
297 |
$time = core::getTimeBand($startTime);
|
298 |
+
|
|
|
299 |
}
|
300 |
|
301 |
|
305 |
if($globalSettings->addToRobots == true)
|
306 |
{
|
307 |
$base = trailingslashit( get_bloginfo( 'url' ) );
|
308 |
+
echo "\nSitemap: " . esc_url_raw($base . self::getGlobalProperty("urlXmlSitemap")) . "\n";
|
309 |
|
310 |
+
echo "\nAllow: /" . esc_url_raw(self::getGlobalProperty("urlRssSitemap"));
|
311 |
+
echo "\nAllow: /" . esc_url_raw(self::getGlobalProperty("urlRssLatest"));
|
312 |
+
echo "\nAllow: /" . esc_url_raw(self::getGlobalProperty("urlHtmlSitemap"));
|
313 |
|
314 |
}
|
315 |
echo "\n\n";
|
316 |
+
echo esc_html(helpers::safeRead($globalSettings,"robotEntries"));
|
317 |
|
318 |
}
|
319 |
public static function addRssLink()
|
323 |
{
|
324 |
$base = trailingslashit( get_bloginfo( 'url' ) );
|
325 |
$url = $base . "rsslatest.xml";
|
326 |
+
$link = '<link rel="alternate" type="application/rss+xml" title="RSS" href="' . esc_url($url) . '" />';
|
327 |
+
echo $link;
|
328 |
}
|
329 |
}
|
330 |
|
332 |
public static function getGlobalProperty($property)
|
333 |
{
|
334 |
$globalSettings = self::getGlobalSettings();
|
335 |
+
$value = helpers::safeRead( $globalSettings, $property);
|
336 |
return $value;
|
337 |
}
|
338 |
|
432 |
|
433 |
return $timeBand;
|
434 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
435 |
|
|
|
|
|
436 |
}
|
437 |
|
438 |
|
code/dataAccess.php
CHANGED
@@ -68,7 +68,7 @@ class dataAccess {
|
|
68 |
|
69 |
if ($settings)
|
70 |
{
|
71 |
-
$settings->news =
|
72 |
}
|
73 |
else
|
74 |
{
|
68 |
|
69 |
if ($settings)
|
70 |
{
|
71 |
+
$settings->news = helpers::safeRead2($settings, "news",0); // for older version that didnt have this property.
|
72 |
}
|
73 |
else
|
74 |
{
|
code/helpers.php
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace xmlSitemapGenerator;
|
4 |
+
|
5 |
+
class helpers {
|
6 |
+
|
7 |
+
// used for reading object properties with a default
|
8 |
+
public static function safeRead2($object, $property, $default) {
|
9 |
+
if (isset( $object->{$property} )) return esc_attr($object->{$property});
|
10 |
+
return $default;
|
11 |
+
}
|
12 |
+
|
13 |
+
// read object property without a default
|
14 |
+
public static function safeRead($object,$property) {
|
15 |
+
return self::safeRead2($object,$property, "");
|
16 |
+
}
|
17 |
+
|
18 |
+
// used for reading post variables
|
19 |
+
static function getFieldValue($field, $default) {
|
20 |
+
if (isset( $_POST[$field])) return sanitize_text_field( $_POST[$field]);
|
21 |
+
return $default;
|
22 |
+
}
|
23 |
+
|
24 |
+
// used for reading post variables (text area)
|
25 |
+
static function getTextAreaValue($field, $default){
|
26 |
+
if (isset( $_POST[$field])) return sanitize_textarea_field($_POST[$field]);
|
27 |
+
return $default;
|
28 |
+
}
|
29 |
+
// used for reading post variables (text area)
|
30 |
+
static function getEmailValue($field, $default){
|
31 |
+
if (isset( $_POST[$field])) return sanitize_email($_POST[$field]);
|
32 |
+
return $default;
|
33 |
+
}
|
34 |
+
|
35 |
+
}
|
36 |
+
|
37 |
+
|
38 |
+
?>
|
code/pinger.php
CHANGED
@@ -26,7 +26,6 @@ class pinger
|
|
26 |
$startTime = microtime(true) ;
|
27 |
self::doPing("Manual");
|
28 |
$time = core::getTimeBand($startTime);
|
29 |
-
core::updateStatistics("Ping", "Manual", $time);
|
30 |
|
31 |
}
|
32 |
public static function doAutoPings($date)
|
@@ -45,7 +44,7 @@ class pinger
|
|
45 |
core::statusUpdate("Auto ping skipped. No modified posts");
|
46 |
}
|
47 |
$time = core::getTimeBand($startTime);
|
48 |
-
|
49 |
}
|
50 |
|
51 |
|
26 |
$startTime = microtime(true) ;
|
27 |
self::doPing("Manual");
|
28 |
$time = core::getTimeBand($startTime);
|
|
|
29 |
|
30 |
}
|
31 |
public static function doAutoPings($date)
|
44 |
core::statusUpdate("Auto ping skipped. No modified posts");
|
45 |
}
|
46 |
$time = core::getTimeBand($startTime);
|
47 |
+
|
48 |
}
|
49 |
|
50 |
|
code/postMetaData.php
CHANGED
@@ -2,28 +2,22 @@
|
|
2 |
namespace xmlSitemapGenerator;
|
3 |
|
4 |
include_once 'dataAccess.php';
|
|
|
5 |
|
6 |
class postMetaData
|
7 |
{
|
8 |
|
9 |
function __construct() {
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
}
|
14 |
|
15 |
public static function addHooks() {
|
16 |
-
|
17 |
-
// add_action('load-post.php', array( __CLASS__, 'add_post_hooks' ) );
|
18 |
-
// add_action('load-post-new.php', array( __CLASS__, 'add_post_hooks' ) );
|
19 |
add_action('save_post', array(__CLASS__, 'handlePostBack' ) , 10, 2 );
|
20 |
-
add_action( 'add_meta_boxes', array(__CLASS__, 'addMetaBoxMenu' ) );
|
21 |
-
|
22 |
}
|
23 |
|
24 |
static function addMetaBoxMenu() {
|
25 |
-
|
26 |
-
|
27 |
add_meta_box(
|
28 |
'wpXSG-meta', // Unique ID
|
29 |
'XML Sitemap', // Title
|
@@ -36,7 +30,6 @@ class postMetaData
|
|
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 ;
|
@@ -54,9 +47,9 @@ class postMetaData
|
|
54 |
$settings = new metaSettings();
|
55 |
$settings->itemId = $post_id;
|
56 |
$settings->itemType = "post";
|
57 |
-
$settings->exclude = (
|
58 |
-
$settings->priority = (
|
59 |
-
$settings->frequency = (
|
60 |
$settings->news = 0 ;
|
61 |
|
62 |
dataAccess::saveMetaItem($settings);
|
@@ -92,11 +85,10 @@ class postMetaData
|
|
92 |
</div></div></div>
|
93 |
|
94 |
|
95 |
-
<script type="text/javascript" src="<?php echo xsgPluginPath(); ?>assets/scripts.js"></script>
|
96 |
<script>
|
97 |
-
xsg_populate("wpXSG-Exclude" ,excludeSelect, <?php echo $settings->exclude ?>);
|
98 |
-
xsg_populate("wpXSG-Priority" ,prioritySelect, <?php echo $settings->priority ?>);
|
99 |
-
xsg_populate("wpXSG-Frequency" ,frequencySelect, <?php echo $settings->frequency ?>);
|
100 |
|
101 |
</script>
|
102 |
<?php
|
2 |
namespace xmlSitemapGenerator;
|
3 |
|
4 |
include_once 'dataAccess.php';
|
5 |
+
include_once 'helpers.php';
|
6 |
|
7 |
class postMetaData
|
8 |
{
|
9 |
|
10 |
function __construct() {
|
11 |
+
|
|
|
|
|
12 |
}
|
13 |
|
14 |
public static function addHooks() {
|
15 |
+
|
|
|
|
|
16 |
add_action('save_post', array(__CLASS__, 'handlePostBack' ) , 10, 2 );
|
17 |
+
add_action( 'add_meta_boxes', array(__CLASS__, 'addMetaBoxMenu' ) );
|
|
|
18 |
}
|
19 |
|
20 |
static function addMetaBoxMenu() {
|
|
|
|
|
21 |
add_meta_box(
|
22 |
'wpXSG-meta', // Unique ID
|
23 |
'XML Sitemap', // Title
|
30 |
|
31 |
static function handlePostBack( $post_id , $post) {
|
32 |
|
|
|
33 |
/* Verify the nonce before proceeding. */
|
34 |
if ( !isset( $_POST['wpXSG_meta_nonce'] ) || !wp_verify_nonce( $_POST['wpXSG_meta_nonce'], basename( __FILE__ ) ) )
|
35 |
return ;
|
47 |
$settings = new metaSettings();
|
48 |
$settings->itemId = $post_id;
|
49 |
$settings->itemType = "post";
|
50 |
+
$settings->exclude = helpers::getFieldValue('wpXSG-Exclude', '0' );
|
51 |
+
$settings->priority = helpers::getFieldValue('wpXSG-Priority', 'default' );
|
52 |
+
$settings->frequency = helpers::getFieldValue('wpXSG-Frequency', 'default' );
|
53 |
$settings->news = 0 ;
|
54 |
|
55 |
dataAccess::saveMetaItem($settings);
|
85 |
</div></div></div>
|
86 |
|
87 |
|
|
|
88 |
<script>
|
89 |
+
xsg_populate("wpXSG-Exclude" ,excludeSelect, <?php echo esc_attr($settings->exclude); ?>);
|
90 |
+
xsg_populate("wpXSG-Priority" ,prioritySelect, <?php echo esc_attr($settings->priority); ?>);
|
91 |
+
xsg_populate("wpXSG-Frequency" ,frequencySelect, <?php echo esc_attr($settings->frequency); ?>);
|
92 |
|
93 |
</script>
|
94 |
<?php
|
code/providers/ZZZ__postsProvider.php
DELETED
@@ -1,139 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace xmlSitemapGenerator;
|
4 |
-
|
5 |
-
class postsProvider extends providerCore implements iSitemapProvider
|
6 |
-
{
|
7 |
-
|
8 |
-
|
9 |
-
public function getPageCount($pageSize)
|
10 |
-
{
|
11 |
-
global $wpdb;
|
12 |
-
|
13 |
-
$postTypes = self::getPostTypes();
|
14 |
-
$frontPageId = get_option( 'page_on_front' );
|
15 |
-
|
16 |
-
$cmd = "SELECT Count(*)
|
17 |
-
FROM {$wpdb->posts} as posts
|
18 |
-
WHERE (post_status = 'publish' OR post_status = 'future' ) AND (post_type = 'post' {$postTypes})
|
19 |
-
AND posts.post_password = '' AND posts.ID <> {$frontPageId}";
|
20 |
-
|
21 |
-
return self::getPages($wpdb->get_var($cmd),$pageSize);
|
22 |
-
}
|
23 |
-
|
24 |
-
public function getPage($page,$pageSize)
|
25 |
-
{
|
26 |
-
global $wpdb;
|
27 |
-
|
28 |
-
$date = self::getDateField($this->sitemapDefaults->dateField);
|
29 |
-
$postTypes = self::getPostTypes();
|
30 |
-
$frontPageId = get_option( 'page_on_front' );
|
31 |
-
|
32 |
-
$offset = ( $page - 1 ) * $pageSize;
|
33 |
-
|
34 |
-
$cmd = "SELECT
|
35 |
-
posts.*,
|
36 |
-
postmeta.*, Tag_meta.* , UNIX_TIMESTAMP({$date}) as sitemapDate
|
37 |
-
FROM {$wpdb->posts} as posts
|
38 |
-
LEFT JOIN {$this->tablemeta} as postmeta ON posts.Id = postmeta.ItemId AND postmeta.itemId
|
39 |
-
LEFT JOIN
|
40 |
-
(SELECT
|
41 |
-
terms.object_id as Post_id,
|
42 |
-
Max(meta.exclude) as tagExclude,
|
43 |
-
Max(meta.priority) as tagPriority,
|
44 |
-
Max(meta.frequency) as tagFrequency
|
45 |
-
FROM {$this->tablemeta} as meta
|
46 |
-
INNER JOIN {$wpdb->term_relationships} as terms
|
47 |
-
ON meta.itemId = terms.term_taxonomy_id AND meta.itemType = 'posts'
|
48 |
-
WHERE meta.itemType = 'taxonomy' AND meta.inherit = 1
|
49 |
-
|
50 |
-
GROUP BY terms.object_id
|
51 |
-
) as Tag_meta
|
52 |
-
ON posts.Id = Tag_meta.Post_id
|
53 |
-
WHERE (post_status = 'publish' OR post_status = 'future' ) AND ( post_type = 'post' {$postTypes})
|
54 |
-
AND posts.post_password = '' AND posts.ID <> {$frontPageId}
|
55 |
-
ORDER BY ID DESC
|
56 |
-
LIMIT {$offset}, {$pageSize} ";
|
57 |
-
|
58 |
-
|
59 |
-
$results = $wpdb->get_results($cmd);
|
60 |
-
if ($results )
|
61 |
-
{
|
62 |
-
$this->doPopulate($results);
|
63 |
-
}
|
64 |
-
|
65 |
-
return $this->urlsList;
|
66 |
-
|
67 |
-
}
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
private function getPostTypes()
|
72 |
-
{
|
73 |
-
$args = array(
|
74 |
-
'public' => true,
|
75 |
-
'_builtin' => false
|
76 |
-
);
|
77 |
-
|
78 |
-
$output = 'names'; // 'names' or 'objects' (default: 'names')
|
79 |
-
$operator = 'and'; // 'and' or 'or' (default: 'and')
|
80 |
-
|
81 |
-
$post_types = get_post_types( $args, $output, $operator );
|
82 |
-
|
83 |
-
return $postTypes;
|
84 |
-
}
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
private function doPopulate($results)
|
89 |
-
{
|
90 |
-
foreach( $results as $result ) {
|
91 |
-
|
92 |
-
|
93 |
-
// wp_cache_add($result ->ID, $result , 'posts');
|
94 |
-
$defaults = self::postTypeDefault($this->sitemapDefaults,$result->post_type );
|
95 |
-
|
96 |
-
$exlcude = $this->getMetaValue($result->exclude, $result->tagExclude, $defaults->exclude) ;
|
97 |
-
|
98 |
-
if ($exlcude == 2) {$temp = $temp . " - excluded"; continue;}
|
99 |
-
if ( $result->post_status =='future' && $defaults->scheduled == 0) { continue;}
|
100 |
-
|
101 |
-
$pageUrl = get_permalink($result);
|
102 |
-
|
103 |
-
if (!($this->isIncluded($pageUrl,$this->sitemapDefaults->excludeRules ))) {continue;}
|
104 |
-
|
105 |
-
$url = new mapItem();
|
106 |
-
$url->location = $pageUrl ;
|
107 |
-
$url->title = get_the_title( $result ); //$result->post_title;
|
108 |
-
$url->description = $result->post_excerpt;
|
109 |
-
$url->modified = $result->sitemapDate ;
|
110 |
-
$url->priority = $this->getMetaValue($result->priority,$result->tagPriority, $defaults->priority) ;
|
111 |
-
$url->frequency = $this->getMetaValue($result->frequency,$result->tagFrequency,$defaults->frequency) ;
|
112 |
-
$url->images = $this->getImages($result->post_content);
|
113 |
-
$this->addUrls(0, $url);
|
114 |
-
|
115 |
-
}
|
116 |
-
}
|
117 |
-
|
118 |
-
static function postTypeDefault($sitemapDefaults,$name)
|
119 |
-
{
|
120 |
-
if ($name == 'page')
|
121 |
-
{
|
122 |
-
return $sitemapDefaults->pages;
|
123 |
-
}
|
124 |
-
elseif ($name == 'post')
|
125 |
-
{
|
126 |
-
return $sitemapDefaults->posts;
|
127 |
-
}
|
128 |
-
else
|
129 |
-
{
|
130 |
-
return ( isset( $sitemapDefaults->{$name} ) ? $sitemapDefaults->{$name} : $sitemapDefaults->posts );
|
131 |
-
}
|
132 |
-
}
|
133 |
-
|
134 |
-
}
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
code/providers/_pageProvider.php
DELETED
@@ -1,130 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace xmlSitemapGenerator;
|
4 |
-
|
5 |
-
class postProvider extends providerCore implements iSitemapProvider
|
6 |
-
{
|
7 |
-
|
8 |
-
|
9 |
-
public function getPageCount($pageSize)
|
10 |
-
{
|
11 |
-
|
12 |
-
}
|
13 |
-
|
14 |
-
public function getPage($page,$pageSize)
|
15 |
-
{
|
16 |
-
|
17 |
-
}
|
18 |
-
|
19 |
-
function getPosts( $sitemapDefaults, $limit = 0){
|
20 |
-
|
21 |
-
|
22 |
-
$results = dataAccess::getPages( $sitemapDefaults->dateField , $limit);
|
23 |
-
$temp = "";
|
24 |
-
if ($results ) {
|
25 |
-
|
26 |
-
foreach( $results as $result ) {
|
27 |
-
|
28 |
-
|
29 |
-
// wp_cache_add($result ->ID, $result , 'posts');
|
30 |
-
$defaults = self::postTypeDefault($sitemapDefaults,$result->post_type );
|
31 |
-
|
32 |
-
$exlcude = $this->getMetaValue($result->exclude, $result->tagExclude, $defaults->exclude) ;
|
33 |
-
|
34 |
-
if ($exlcude == 2) {$temp = $temp . " - excluded"; continue;}
|
35 |
-
if ( $result->post_status =='future' && $defaults->scheduled == 0) { continue;}
|
36 |
-
|
37 |
-
$pageUrl = get_permalink($result);
|
38 |
-
|
39 |
-
if (!($this->isIncluded($pageUrl,$sitemapDefaults->excludeRules ))) {continue;}
|
40 |
-
|
41 |
-
$url = new mapItem();
|
42 |
-
$url->location = $pageUrl ;
|
43 |
-
$url->title = get_the_title( $result ); //$result->post_title;
|
44 |
-
$url->description = $result->post_excerpt;
|
45 |
-
$url->modified = $result->sitemapDate ;
|
46 |
-
$url->priority = $this->getMetaValue($result->priority,$result->tagPriority, $defaults->priority) ;
|
47 |
-
$url->frequency = $this->getMetaValue($result->frequency,$result->tagFrequency,$defaults->frequency) ;
|
48 |
-
|
49 |
-
$this->addUrls(0, $url);
|
50 |
-
|
51 |
-
}
|
52 |
-
}
|
53 |
-
|
54 |
-
}
|
55 |
-
|
56 |
-
|
57 |
-
// type = "post" or "page" , date = "created" or "updated"
|
58 |
-
//$limit = 0 for no limit.)
|
59 |
-
public static function getPages($date , $limit)
|
60 |
-
{
|
61 |
-
global $wpdb;
|
62 |
-
$date = self::getDateField($date);
|
63 |
-
$frontPageId = get_option( 'page_on_front' );
|
64 |
-
|
65 |
-
$tablemeta = $wpdb->prefix . 'xsg_sitemap_meta';
|
66 |
-
|
67 |
-
$postTypes = "";
|
68 |
-
foreach ( self::getPostTypes() as $post_type )
|
69 |
-
{
|
70 |
-
$postTypes .= " OR post_type = '{$post_type}'";
|
71 |
-
}
|
72 |
-
|
73 |
-
|
74 |
-
$cmd = "SELECT
|
75 |
-
posts.*,
|
76 |
-
postmeta.*, Tag_meta.* , UNIX_TIMESTAMP({$date}) as sitemapDate
|
77 |
-
FROM {$wpdb->posts} as posts
|
78 |
-
LEFT JOIN {$tablemeta} as postmeta ON posts.Id = postmeta.ItemId AND postmeta.itemId
|
79 |
-
LEFT JOIN
|
80 |
-
(SELECT
|
81 |
-
terms.object_id as Post_id,
|
82 |
-
Max(meta.exclude) as tagExclude,
|
83 |
-
Max(meta.priority) as tagPriority,
|
84 |
-
Max(meta.frequency) as tagFrequency
|
85 |
-
FROM {$tablemeta} as meta
|
86 |
-
INNER JOIN {$wpdb->term_relationships} as terms
|
87 |
-
ON meta.itemId = terms.term_taxonomy_id AND meta.itemType = 'posts'
|
88 |
-
WHERE meta.itemType = 'taxonomy' AND meta.inherit = 1
|
89 |
-
|
90 |
-
GROUP BY terms.object_id
|
91 |
-
) as Tag_meta
|
92 |
-
ON posts.Id = Tag_meta.Post_id
|
93 |
-
WHERE (post_status = 'publish' OR post_status = 'future' ) AND (post_type = 'page' OR post_type = 'post' {$postTypes})
|
94 |
-
AND posts.post_password = '' AND posts.ID <> {$frontPageId}
|
95 |
-
ORDER BY {$date} DESC ";
|
96 |
-
|
97 |
-
|
98 |
-
if ($limit > 0 )
|
99 |
-
{
|
100 |
-
$cmd .= " LIMIT {$limit} " ;
|
101 |
-
}
|
102 |
-
|
103 |
-
$results = self::execute($cmd);
|
104 |
-
|
105 |
-
return $results;
|
106 |
-
}
|
107 |
-
|
108 |
-
|
109 |
-
static function postTypeDefault($sitemapDefaults,$name)
|
110 |
-
{
|
111 |
-
if ($name == 'page')
|
112 |
-
{
|
113 |
-
return $sitemapDefaults->pages;
|
114 |
-
}
|
115 |
-
elseif ($name == 'post')
|
116 |
-
{
|
117 |
-
return $sitemapDefaults->posts;
|
118 |
-
}
|
119 |
-
else
|
120 |
-
{
|
121 |
-
return ( isset( $sitemapDefaults->{$name} ) ? $sitemapDefaults->{$name} : $sitemapDefaults->posts );
|
122 |
-
}
|
123 |
-
}
|
124 |
-
|
125 |
-
}
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
code/providers/archiveProvider.php
CHANGED
@@ -9,14 +9,14 @@ namespace xmlSitemapGenerator;
|
|
9 |
|
10 |
public function getSuppportedTypes()
|
11 |
{
|
12 |
-
$types = array( "
|
13 |
|
14 |
return $types;
|
15 |
}
|
16 |
|
17 |
public function getPageCount($type)
|
18 |
{
|
19 |
-
if ($this->exclude()) {return 0;}
|
20 |
return 1;
|
21 |
|
22 |
}
|
@@ -24,21 +24,29 @@ namespace xmlSitemapGenerator;
|
|
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);
|
32 |
|
33 |
$sql = "SELECT DISTINCT YEAR(post_date) AS year,MONTH(post_date) AS month,
|
34 |
UNIX_TIMESTAMP(MAX(posts.{$date})) AS sitemapDate, Count(posts.ID) as posts
|
35 |
FROM {$wpdb->posts} as posts
|
36 |
-
WHERE post_status = 'publish' AND post_type = 'post' AND posts.post_password = ''
|
|
|
37 |
GROUP BY YEAR(post_date), MONTH(post_date)
|
38 |
ORDER BY YEAR(post_date) ,MONTH(post_date)";
|
39 |
|
40 |
|
41 |
-
$cmd = $wpdb->prepare($sql
|
42 |
|
43 |
$results = $wpdb->get_results($cmd);
|
44 |
if ($results )
|
@@ -65,13 +73,13 @@ namespace xmlSitemapGenerator;
|
|
65 |
$defaults = $this->sitemapDefaults->oldArchive;
|
66 |
}
|
67 |
|
68 |
-
$
|
69 |
$posts = $result->posts;
|
70 |
|
71 |
$pageUrl = get_month_link( $result->year , $result->month) ;
|
72 |
|
73 |
|
74 |
-
if ($
|
75 |
{
|
76 |
|
77 |
if ($this->isIncluded($pageUrl,$this->sitemapDefaults->excludeRules ))
|
@@ -93,14 +101,18 @@ namespace xmlSitemapGenerator;
|
|
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 |
|
9 |
|
10 |
public function getSuppportedTypes()
|
11 |
{
|
12 |
+
$types = array( "recentarchive" , "oldarchive");
|
13 |
|
14 |
return $types;
|
15 |
}
|
16 |
|
17 |
public function getPageCount($type)
|
18 |
{
|
19 |
+
if ($this->exclude($type)) {return 0;}
|
20 |
return 1;
|
21 |
|
22 |
}
|
24 |
public function getPage($type,$page)
|
25 |
{
|
26 |
|
27 |
+
if ($this->exclude($type)) {return;}
|
|
|
|
|
28 |
|
29 |
+
if ($type == 'recentarchive') {
|
30 |
+
$clause = " >= now() - interval 30 DAY";
|
31 |
+
}
|
32 |
+
else {
|
33 |
+
$clause = " < now() - interval 30 DAY";
|
34 |
+
}
|
35 |
+
|
36 |
+
global $wpdb;
|
37 |
+
|
38 |
$date = self::getDateField($this->sitemapDefaults->dateField);
|
39 |
|
40 |
$sql = "SELECT DISTINCT YEAR(post_date) AS year,MONTH(post_date) AS month,
|
41 |
UNIX_TIMESTAMP(MAX(posts.{$date})) AS sitemapDate, Count(posts.ID) as posts
|
42 |
FROM {$wpdb->posts} as posts
|
43 |
+
WHERE post_status = 'publish' AND post_type = 'post' AND posts.post_password = '' AND post_date {$clause}
|
44 |
+
|
45 |
GROUP BY YEAR(post_date), MONTH(post_date)
|
46 |
ORDER BY YEAR(post_date) ,MONTH(post_date)";
|
47 |
|
48 |
|
49 |
+
$cmd = $wpdb->prepare($sql) ;
|
50 |
|
51 |
$results = $wpdb->get_results($cmd);
|
52 |
if ($results )
|
73 |
$defaults = $this->sitemapDefaults->oldArchive;
|
74 |
}
|
75 |
|
76 |
+
$exclude = $defaults->exclude ;
|
77 |
$posts = $result->posts;
|
78 |
|
79 |
$pageUrl = get_month_link( $result->year , $result->month) ;
|
80 |
|
81 |
|
82 |
+
if ($exclude != 2)
|
83 |
{
|
84 |
|
85 |
if ($this->isIncluded($pageUrl,$this->sitemapDefaults->excludeRules ))
|
101 |
}
|
102 |
}
|
103 |
|
104 |
+
private function exclude($type)
|
105 |
{
|
106 |
+
|
107 |
+
if ($type == 'recentarchive') {
|
108 |
+
$defaults = $this->sitemapDefaults->recentArchive;
|
109 |
+
}
|
110 |
+
else {
|
111 |
+
$defaults = $this->sitemapDefaults->oldArchive;
|
112 |
+
}
|
113 |
+
|
114 |
+
return $this->isExcluded($defaults->exclude);
|
115 |
|
|
|
|
|
|
|
|
|
|
|
116 |
}
|
117 |
|
118 |
|
code/providers/authorsProvider.php
CHANGED
@@ -17,7 +17,7 @@ namespace xmlSitemapGenerator;
|
|
17 |
|
18 |
public function getPageCount($type)
|
19 |
{
|
20 |
-
if ($this->exclude()) {return 0;}
|
21 |
return 1;
|
22 |
|
23 |
}
|
@@ -40,7 +40,7 @@ namespace xmlSitemapGenerator;
|
|
40 |
ORDER BY users.ID";
|
41 |
|
42 |
|
43 |
-
$cmd = $wpdb->prepare($sql
|
44 |
|
45 |
$results = $wpdb->get_results($cmd);
|
46 |
if ($results )
|
@@ -59,9 +59,9 @@ namespace xmlSitemapGenerator;
|
|
59 |
|
60 |
$defaults = $this->sitemapDefaults->authors;
|
61 |
|
62 |
-
$
|
63 |
|
64 |
-
if ($
|
65 |
{
|
66 |
$pageUrl = get_author_posts_url($result->ID, $result->user_nicename);
|
67 |
|
17 |
|
18 |
public function getPageCount($type)
|
19 |
{
|
20 |
+
if ($this->exclude($type)) {return 0;}
|
21 |
return 1;
|
22 |
|
23 |
}
|
40 |
ORDER BY users.ID";
|
41 |
|
42 |
|
43 |
+
$cmd = $wpdb->prepare($sql) ;
|
44 |
|
45 |
$results = $wpdb->get_results($cmd);
|
46 |
if ($results )
|
59 |
|
60 |
$defaults = $this->sitemapDefaults->authors;
|
61 |
|
62 |
+
$exclude = $this->getMetaValue(null, $result->exclude, $defaults->exclude) ;
|
63 |
|
64 |
+
if ($exclude != 2)
|
65 |
{
|
66 |
$pageUrl = get_author_posts_url($result->ID, $result->user_nicename);
|
67 |
|
code/providers/coreProvider.php
CHANGED
@@ -45,7 +45,7 @@ namespace xmlSitemapGenerator;
|
|
45 |
$types = self::getProviderList();
|
46 |
if (!in_array($type, $types))
|
47 |
{
|
48 |
-
echo 'XML Sitemap Generator Error. <br />Invalid Provider type specified : ' . $type;
|
49 |
exit;
|
50 |
}
|
51 |
}
|
@@ -59,12 +59,12 @@ namespace xmlSitemapGenerator;
|
|
59 |
$file = $type . 'Provider.php';
|
60 |
if (@include_once($file))
|
61 |
{
|
62 |
-
$class = '\\xmlSitemapGenerator\\' . $type . 'Provider';
|
63 |
return new $class();
|
64 |
}
|
65 |
else
|
66 |
{
|
67 |
-
echo 'XML Sitemap Generator Error. <br />Invalid Renderer type specified : ' . $type;
|
68 |
exit;
|
69 |
}
|
70 |
}
|
@@ -102,22 +102,6 @@ namespace xmlSitemapGenerator;
|
|
102 |
$this->format = $format;
|
103 |
}
|
104 |
|
105 |
-
public static function renderTest($msg)
|
106 |
-
{
|
107 |
-
|
108 |
-
|
109 |
-
ob_start();
|
110 |
-
header('Content-Type: text/html; charset=utf-8');
|
111 |
-
|
112 |
-
echo var_dump($msg);
|
113 |
-
|
114 |
-
echo "\n";
|
115 |
-
ob_end_flush();
|
116 |
-
exit;
|
117 |
-
}
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
private function getAttribute($name, $html)
|
122 |
{
|
123 |
preg_match( '@' . $name . '="([^"]+)"@' , $html, $match );
|
@@ -254,7 +238,7 @@ namespace xmlSitemapGenerator;
|
|
254 |
}
|
255 |
|
256 |
|
257 |
-
function getPageLink($url, $pagenum = 1
|
258 |
global $wp_rewrite;
|
259 |
|
260 |
$pagenum = (int) $pagenum;
|
@@ -304,10 +288,8 @@ namespace xmlSitemapGenerator;
|
|
304 |
|
305 |
$result = apply_filters( 'get_pagenum_link', $result );
|
306 |
|
307 |
-
|
308 |
-
|
309 |
-
else
|
310 |
-
return esc_url_raw( $result );
|
311 |
}
|
312 |
|
313 |
}
|
45 |
$types = self::getProviderList();
|
46 |
if (!in_array($type, $types))
|
47 |
{
|
48 |
+
echo 'XML Sitemap Generator Error. <br />Invalid Provider type specified : ' . esc_html($type);
|
49 |
exit;
|
50 |
}
|
51 |
}
|
59 |
$file = $type . 'Provider.php';
|
60 |
if (@include_once($file))
|
61 |
{
|
62 |
+
$class = '\\xmlSitemapGenerator\\' . esc_html($type) . 'Provider';
|
63 |
return new $class();
|
64 |
}
|
65 |
else
|
66 |
{
|
67 |
+
echo 'XML Sitemap Generator Error. <br />Invalid Renderer type specified : ' . esc_html($type);
|
68 |
exit;
|
69 |
}
|
70 |
}
|
102 |
$this->format = $format;
|
103 |
}
|
104 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
private function getAttribute($name, $html)
|
106 |
{
|
107 |
preg_match( '@' . $name . '="([^"]+)"@' , $html, $match );
|
238 |
}
|
239 |
|
240 |
|
241 |
+
function getPageLink($url, $pagenum = 1 ) {
|
242 |
global $wp_rewrite;
|
243 |
|
244 |
$pagenum = (int) $pagenum;
|
288 |
|
289 |
$result = apply_filters( 'get_pagenum_link', $result );
|
290 |
|
291 |
+
return $result ;
|
292 |
+
|
|
|
|
|
293 |
}
|
294 |
|
295 |
}
|
code/providers/indexProvider.php
CHANGED
@@ -35,10 +35,13 @@ namespace xmlSitemapGenerator;
|
|
35 |
{
|
36 |
$providers = sitemapProvider::getProviderList();
|
37 |
$globalSettings = core::getGlobalSettings();
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
|
|
|
|
|
|
42 |
}
|
43 |
|
44 |
public function getPage($type, $page)
|
@@ -64,7 +67,9 @@ namespace xmlSitemapGenerator;
|
|
64 |
foreach($providers as $providerName)
|
65 |
{
|
66 |
|
67 |
-
|
|
|
|
|
68 |
$provider = sitemapProvider::getInstance($providerName);
|
69 |
$types = $provider->getSuppportedTypes();
|
70 |
|
35 |
{
|
36 |
$providers = sitemapProvider::getProviderList();
|
37 |
$globalSettings = core::getGlobalSettings();
|
38 |
+
if (strlen($globalSettings->urlNewsSitemap) > 0) {
|
39 |
+
$url = new mapItem();
|
40 |
+
$url->location = $this->blogUrl . "/" . $globalSettings->urlNewsSitemap;
|
41 |
+
$url->title = "News sitemap.";
|
42 |
+
$this->addUrls(0, $url);
|
43 |
+
}
|
44 |
+
|
45 |
}
|
46 |
|
47 |
public function getPage($type, $page)
|
67 |
foreach($providers as $providerName)
|
68 |
{
|
69 |
|
70 |
+
if ($providerName == "news" || $providerName == "index") {continue;}
|
71 |
+
if ($this->format == "xml" && $providerName == "latest" ) {continue ;}
|
72 |
+
|
73 |
$provider = sitemapProvider::getInstance($providerName);
|
74 |
$types = $provider->getSuppportedTypes();
|
75 |
|
code/providers/latestProvider.php
CHANGED
@@ -82,9 +82,9 @@ namespace xmlSitemapGenerator;
|
|
82 |
// wp_cache_add($result ->ID, $result , 'posts');
|
83 |
$defaults = self::postTypeDefault($this->sitemapDefaults,$result->post_type );
|
84 |
|
85 |
-
// $
|
86 |
|
87 |
-
// if ($
|
88 |
if ( $result->post_status =='future' && $defaults->scheduled == 0) { continue;}
|
89 |
|
90 |
$pageUrl = get_permalink($result);
|
82 |
// wp_cache_add($result ->ID, $result , 'posts');
|
83 |
$defaults = self::postTypeDefault($this->sitemapDefaults,$result->post_type );
|
84 |
|
85 |
+
// $exclude = $this->getMetaValue($result->exclude, $result->tagExclude, $defaults->exclude) ;
|
86 |
|
87 |
+
// if ($exclude == 2) {$temp = $temp . " - excluded"; continue;}
|
88 |
if ( $result->post_status =='future' && $defaults->scheduled == 0) { continue;}
|
89 |
|
90 |
$pageUrl = get_permalink($result);
|
code/providers/newsProvider.php
CHANGED
@@ -10,7 +10,7 @@ namespace xmlSitemapGenerator;
|
|
10 |
|
11 |
public function getSuppportedTypes()
|
12 |
{
|
13 |
-
$types = array( "
|
14 |
|
15 |
return $types;
|
16 |
}
|
10 |
|
11 |
public function getSuppportedTypes()
|
12 |
{
|
13 |
+
$types = array( "news");
|
14 |
|
15 |
return $types;
|
16 |
}
|
code/providers/postsProvider.php
CHANGED
@@ -49,7 +49,7 @@ namespace xmlSitemapGenerator;
|
|
49 |
|
50 |
global $wpdb;
|
51 |
|
52 |
-
if ($page == 1 && $type == 'page') { $this->addHomePage(); }
|
53 |
|
54 |
$date = self::getDateField($this->sitemapDefaults->dateField);
|
55 |
$frontPageId = get_option( 'page_on_front' );
|
@@ -117,9 +117,9 @@ namespace xmlSitemapGenerator;
|
|
117 |
$defaults = $this->sitemapDefaults->homepage;
|
118 |
$pageUrl = get_bloginfo( 'url' );
|
119 |
|
120 |
-
$
|
121 |
|
122 |
-
if ($
|
123 |
{
|
124 |
|
125 |
if ($this->isIncluded($pageUrl,$this->sitemapDefaults->excludeRules ))
|
@@ -148,9 +148,9 @@ namespace xmlSitemapGenerator;
|
|
148 |
|
149 |
// wp_cache_add($result ->ID, $result , 'posts');
|
150 |
$defaults = $this->postTypeDefault( $result->post_type );
|
151 |
-
$
|
152 |
|
153 |
-
if ($
|
154 |
if ( $result->post_status =='future' && $defaults->scheduled == 0) { continue;}
|
155 |
// if (!($this->isIncluded($pageUrl,$this->sitemapDefaults->excludeRules ))) {continue;}
|
156 |
|
49 |
|
50 |
global $wpdb;
|
51 |
|
52 |
+
if ($page == 1 && $type == 'page' ) { $this->addHomePage(); }
|
53 |
|
54 |
$date = self::getDateField($this->sitemapDefaults->dateField);
|
55 |
$frontPageId = get_option( 'page_on_front' );
|
117 |
$defaults = $this->sitemapDefaults->homepage;
|
118 |
$pageUrl = get_bloginfo( 'url' );
|
119 |
|
120 |
+
$exclude = $defaults->exclude ;
|
121 |
|
122 |
+
if ($exclude != 2)
|
123 |
{
|
124 |
|
125 |
if ($this->isIncluded($pageUrl,$this->sitemapDefaults->excludeRules ))
|
148 |
|
149 |
// wp_cache_add($result ->ID, $result , 'posts');
|
150 |
$defaults = $this->postTypeDefault( $result->post_type );
|
151 |
+
$exclude = $this->getMetaValue($result->exclude, $result->tagExclude, $defaults->exclude) ;
|
152 |
|
153 |
+
if ($exclude == 2) { continue;}
|
154 |
if ( $result->post_status =='future' && $defaults->scheduled == 0) { continue;}
|
155 |
// if (!($this->isIncluded($pageUrl,$this->sitemapDefaults->excludeRules ))) {continue;}
|
156 |
|
code/providers/termsProvider.php
CHANGED
@@ -39,8 +39,7 @@ namespace xmlSitemapGenerator;
|
|
39 |
|
40 |
global $wpdb;
|
41 |
|
42 |
-
|
43 |
-
if ($page == 1 && $type == 'page') { $this->addHomePage(); }
|
44 |
|
45 |
$date = self::getDateField($this->sitemapDefaults->dateField);
|
46 |
|
@@ -83,9 +82,9 @@ namespace xmlSitemapGenerator;
|
|
83 |
else
|
84 |
{$defaults = $this->sitemapDefaults->taxonomyTags;}
|
85 |
|
86 |
-
$
|
87 |
|
88 |
-
if ($
|
89 |
{
|
90 |
$pageUrl = get_category_link($result);
|
91 |
|
39 |
|
40 |
global $wpdb;
|
41 |
|
42 |
+
|
|
|
43 |
|
44 |
$date = self::getDateField($this->sitemapDefaults->dateField);
|
45 |
|
82 |
else
|
83 |
{$defaults = $this->sitemapDefaults->taxonomyTags;}
|
84 |
|
85 |
+
$exclude = $this->getMetaValue(null, $result->exclude, $defaults->exclude) ;
|
86 |
|
87 |
+
if ($exclude != 2)
|
88 |
{
|
89 |
$pageUrl = get_category_link($result);
|
90 |
|
code/renderers/coreRenderer.php
CHANGED
@@ -23,7 +23,7 @@ namespace xmlSitemapGenerator;
|
|
23 |
$types = self::getRendererList();
|
24 |
if (!in_array($type, $types))
|
25 |
{
|
26 |
-
echo 'XML Sitemap Generator Error. <br />Invalid Renderer type specified : ' . $type;
|
27 |
exit;
|
28 |
}
|
29 |
}
|
@@ -35,12 +35,12 @@ namespace xmlSitemapGenerator;
|
|
35 |
$file = $type . 'Renderer.php';
|
36 |
if (@include_once($file))
|
37 |
{
|
38 |
-
$class = '\\xmlSitemapGenerator\\' . $type . 'Renderer';
|
39 |
return new $class();
|
40 |
}
|
41 |
else
|
42 |
{
|
43 |
-
echo 'XML Sitemap Generator Error. <br />Renderer not found : ' . $type;
|
44 |
exit;
|
45 |
}
|
46 |
}
|
23 |
$types = self::getRendererList();
|
24 |
if (!in_array($type, $types))
|
25 |
{
|
26 |
+
echo 'XML Sitemap Generator Error. <br />Invalid Renderer type specified : ' . esc_html($type);
|
27 |
exit;
|
28 |
}
|
29 |
}
|
35 |
$file = $type . 'Renderer.php';
|
36 |
if (@include_once($file))
|
37 |
{
|
38 |
+
$class = '\\xmlSitemapGenerator\\' . esc_html($type) . 'Renderer';
|
39 |
return new $class();
|
40 |
}
|
41 |
else
|
42 |
{
|
43 |
+
echo 'XML Sitemap Generator Error. <br />Renderer not found : ' . esc_html($type);
|
44 |
exit;
|
45 |
}
|
46 |
}
|
code/renderers/htmRenderer.php
CHANGED
@@ -12,8 +12,8 @@ namespace xmlSitemapGenerator;
|
|
12 |
{
|
13 |
|
14 |
echo '<li>' ;
|
15 |
-
echo '<a href="' .
|
16 |
-
echo
|
17 |
echo '</a>';
|
18 |
echo "</li>\n" ;
|
19 |
}
|
@@ -78,7 +78,7 @@ namespace xmlSitemapGenerator;
|
|
78 |
</head>
|
79 |
<body>
|
80 |
|
81 |
-
<h1><?php echo
|
82 |
|
83 |
<div id="header">
|
84 |
<p>
|
12 |
{
|
13 |
|
14 |
echo '<li>' ;
|
15 |
+
echo '<a href="' . esc_url($url->location) . '">';
|
16 |
+
echo esc_attr($url->title);
|
17 |
echo '</a>';
|
18 |
echo "</li>\n" ;
|
19 |
}
|
78 |
</head>
|
79 |
<body>
|
80 |
|
81 |
+
<h1><?php echo esc_attr($title) ?></h1>
|
82 |
|
83 |
<div id="header">
|
84 |
<p>
|
code/renderers/newsRenderer.php
CHANGED
@@ -11,9 +11,9 @@ namespace xmlSitemapGenerator;
|
|
11 |
foreach( $images as $image )
|
12 |
{
|
13 |
echo '<image:image>' ;
|
14 |
-
echo '<image:loc>' .
|
15 |
-
echo '<image:caption>' .
|
16 |
-
echo '<image:title>' .
|
17 |
|
18 |
|
19 |
echo "</image:image>\n" ;
|
@@ -23,14 +23,14 @@ namespace xmlSitemapGenerator;
|
|
23 |
private function renderItem($siteName, $url)
|
24 |
{
|
25 |
echo '<url>' ;
|
26 |
-
echo '<loc>' .
|
27 |
echo '<news:news>';
|
28 |
echo '<news:publication>';
|
29 |
-
echo '<news:name>' . $siteName . '</news:name>';
|
30 |
-
echo '<news:language>' . substr(
|
31 |
echo '</news:publication>';
|
32 |
-
echo '<news:publication_date>' . date('Y-m-d\TH:i:s+00:00',
|
33 |
-
echo '<news:title>' .
|
34 |
echo '</news:news>';
|
35 |
|
36 |
$this->renderImages($url->images);
|
@@ -57,7 +57,7 @@ namespace xmlSitemapGenerator;
|
|
57 |
|
58 |
echo '<?xml version="1.0" encoding="UTF-8" ?>';
|
59 |
echo "\n";
|
60 |
-
echo '<?xml-stylesheet type="text/xsl" href="' .
|
61 |
echo "\n";
|
62 |
$this->renderComment();
|
63 |
echo "\n";
|
11 |
foreach( $images as $image )
|
12 |
{
|
13 |
echo '<image:image>' ;
|
14 |
+
echo '<image:loc>' . esc_url($image->location) . '</image:loc>';
|
15 |
+
echo '<image:caption>' . esc_attr($image->caption) . '</image:caption>';
|
16 |
+
echo '<image:title>' . esc_attr($image->title) . '</image:title>';
|
17 |
|
18 |
|
19 |
echo "</image:image>\n" ;
|
23 |
private function renderItem($siteName, $url)
|
24 |
{
|
25 |
echo '<url>' ;
|
26 |
+
echo '<loc>' . esc_url($url->location) . '</loc>';
|
27 |
echo '<news:news>';
|
28 |
echo '<news:publication>';
|
29 |
+
echo '<news:name>' . esc_attr($siteName) . '</news:name>';
|
30 |
+
echo '<news:language>' . substr( esc_attr(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>' . esc_attr($url->title) . '</news:title>';
|
34 |
echo '</news:news>';
|
35 |
|
36 |
$this->renderImages($url->images);
|
57 |
|
58 |
echo '<?xml version="1.0" encoding="UTF-8" ?>';
|
59 |
echo "\n";
|
60 |
+
echo '<?xml-stylesheet type="text/xsl" href="' . esc_url_raw($urlXls) . '"?>';
|
61 |
echo "\n";
|
62 |
$this->renderComment();
|
63 |
echo "\n";
|
code/renderers/rssRenderer.php
CHANGED
@@ -10,10 +10,10 @@ namespace xmlSitemapGenerator;
|
|
10 |
{
|
11 |
|
12 |
echo '<item>' ;
|
13 |
-
echo '<guid>' .
|
14 |
-
echo '<title>' . $url->title . '</title>';
|
15 |
-
echo '<link>' .
|
16 |
-
echo '<description>' . $url->description . '</description>';
|
17 |
|
18 |
if(!$isIndex)
|
19 |
{
|
@@ -44,7 +44,7 @@ namespace xmlSitemapGenerator;
|
|
44 |
|
45 |
echo '<?xml version="1.0" encoding="UTF-8" ?>';
|
46 |
echo "\n";
|
47 |
-
echo '<?xml-stylesheet type="text/xsl" href="' . $urlXls
|
48 |
echo "\n";
|
49 |
|
50 |
$this->renderComment();
|
@@ -55,9 +55,9 @@ namespace xmlSitemapGenerator;
|
|
55 |
echo "\n";
|
56 |
|
57 |
|
58 |
-
echo '<title>' . get_option('blogname') . '</title>';
|
59 |
-
echo '<link>' . get_bloginfo( 'url' ) . '</link>';
|
60 |
-
echo '<description>' . get_option( 'blogdescription'). '</description>';
|
61 |
|
62 |
|
63 |
|
10 |
{
|
11 |
|
12 |
echo '<item>' ;
|
13 |
+
echo '<guid>' . esc_url($url->location) . '</guid>';
|
14 |
+
echo '<title>' .esc_attr( $url->title) . '</title>';
|
15 |
+
echo '<link>' . esc_url($url->location) . '</link>';
|
16 |
+
echo '<description>' . esc_attr($url->description) . '</description>';
|
17 |
|
18 |
if(!$isIndex)
|
19 |
{
|
44 |
|
45 |
echo '<?xml version="1.0" encoding="UTF-8" ?>';
|
46 |
echo "\n";
|
47 |
+
echo '<?xml-stylesheet type="text/xsl" href="' . esc_url_raw($urlXls) . '"?>';
|
48 |
echo "\n";
|
49 |
|
50 |
$this->renderComment();
|
55 |
echo "\n";
|
56 |
|
57 |
|
58 |
+
echo '<title>' . esc_attr(get_option('blogname')) . '</title>';
|
59 |
+
echo '<link>' . esc_url_raw(get_bloginfo( 'url' )) . '</link>';
|
60 |
+
echo '<description>' . esc_attr(get_option( 'blogdescription')). '</description>';
|
61 |
|
62 |
|
63 |
|
code/renderers/xmlRenderer.php
CHANGED
@@ -94,9 +94,9 @@ namespace xmlSitemapGenerator;
|
|
94 |
foreach( $images as $image )
|
95 |
{
|
96 |
echo '<image:image>' ;
|
97 |
-
echo '<image:loc>' . $image->location . '</image:loc>';
|
98 |
-
if (!empty($image->caption)) {echo '<image:caption>' . $image->caption . '</image:caption>';}
|
99 |
-
if (!empty($image->title)) { echo '<image:title>' . $image->title . '</image:title>';}
|
100 |
echo "</image:image>\n" ;
|
101 |
}
|
102 |
|
@@ -106,15 +106,15 @@ namespace xmlSitemapGenerator;
|
|
106 |
{
|
107 |
|
108 |
echo '<url>' ;
|
109 |
-
echo '<loc>' .
|
110 |
-
echo '<lastmod>' . date('Y-m-d\TH:i:s+00:00'
|
111 |
|
112 |
if (!$url->frequency==0) {
|
113 |
-
echo '<changefreq>' . $this->getFrequency($url->frequency) . '</changefreq>';
|
114 |
}
|
115 |
|
116 |
if (!$url->priority==0) {
|
117 |
-
echo "<priority>" . $this->getPriority($url->priority) . "</priority>";
|
118 |
}
|
119 |
|
120 |
if (isset($url->images))
|
@@ -136,7 +136,7 @@ namespace xmlSitemapGenerator;
|
|
136 |
|
137 |
echo '<?xml version="1.0" encoding="UTF-8" ?>';
|
138 |
echo "\n";
|
139 |
-
echo '<?xml-stylesheet type="text/xsl" href="' . $urlXls . '"?>';
|
140 |
echo "\n";
|
141 |
$this->renderComment();
|
142 |
echo "\n";
|
@@ -152,7 +152,7 @@ namespace xmlSitemapGenerator;
|
|
152 |
foreach( $urls as $url )
|
153 |
{
|
154 |
echo '<sitemap>' ;
|
155 |
-
echo '<loc>' .
|
156 |
echo "</sitemap>\n" ;
|
157 |
}
|
158 |
}
|
@@ -177,7 +177,7 @@ namespace xmlSitemapGenerator;
|
|
177 |
|
178 |
echo '<?xml version="1.0" encoding="UTF-8" ?>';
|
179 |
echo "\n";
|
180 |
-
echo '<?xml-stylesheet type="text/xsl" href="' . $urlXls . '"?>';
|
181 |
echo "\n";
|
182 |
$this->renderComment();
|
183 |
echo "\n";
|
94 |
foreach( $images as $image )
|
95 |
{
|
96 |
echo '<image:image>' ;
|
97 |
+
echo '<image:loc>' . esc_url($image->location) . '</image:loc>';
|
98 |
+
if (!empty($image->caption)) {echo '<image:caption>' . esc_attr($image->caption) . '</image:caption>';}
|
99 |
+
if (!empty($image->title)) { echo '<image:title>' . esc_attr($image->title) . '</image:title>';}
|
100 |
echo "</image:image>\n" ;
|
101 |
}
|
102 |
|
106 |
{
|
107 |
|
108 |
echo '<url>' ;
|
109 |
+
echo '<loc>' . esc_url($url->location) . '</loc>';
|
110 |
+
echo '<lastmod>' . date('Y-m-d\TH:i:s+00:00',$url->modified) . '</lastmod>';
|
111 |
|
112 |
if (!$url->frequency==0) {
|
113 |
+
echo '<changefreq>' . esc_attr($this->getFrequency($url->frequency) ). '</changefreq>';
|
114 |
}
|
115 |
|
116 |
if (!$url->priority==0) {
|
117 |
+
echo "<priority>" . esc_attr($this->getPriority($url->priority)) . "</priority>";
|
118 |
}
|
119 |
|
120 |
if (isset($url->images))
|
136 |
|
137 |
echo '<?xml version="1.0" encoding="UTF-8" ?>';
|
138 |
echo "\n";
|
139 |
+
echo '<?xml-stylesheet type="text/xsl" href="' . esc_url($urlXls) . '"?>';
|
140 |
echo "\n";
|
141 |
$this->renderComment();
|
142 |
echo "\n";
|
152 |
foreach( $urls as $url )
|
153 |
{
|
154 |
echo '<sitemap>' ;
|
155 |
+
echo '<loc>' . esc_url($url->location) . '</loc>';
|
156 |
echo "</sitemap>\n" ;
|
157 |
}
|
158 |
}
|
177 |
|
178 |
echo '<?xml version="1.0" encoding="UTF-8" ?>';
|
179 |
echo "\n";
|
180 |
+
echo '<?xml-stylesheet type="text/xsl" href="' . esc_url($urlXls) . '"?>';
|
181 |
echo "\n";
|
182 |
$this->renderComment();
|
183 |
echo "\n";
|
code/settings.php
CHANGED
@@ -12,10 +12,7 @@ class settings
|
|
12 |
{
|
13 |
add_action('admin_menu', array( __CLASS__, 'admin_menu' ) );
|
14 |
add_action('admin_init', array( __CLASS__, 'register_settings' ) );
|
15 |
-
|
16 |
}
|
17 |
-
|
18 |
-
|
19 |
|
20 |
public static function admin_menu()
|
21 |
{
|
@@ -27,8 +24,6 @@ class settings
|
|
27 |
register_setting( XSG_PLUGIN_NAME, XSG_PLUGIN_NAME );
|
28 |
}
|
29 |
|
30 |
-
|
31 |
-
|
32 |
static function getPostTypes()
|
33 |
{
|
34 |
$args = array(
|
@@ -43,27 +38,27 @@ class settings
|
|
43 |
|
44 |
return $post_types;
|
45 |
}
|
|
|
46 |
static function postTypeDefault($sitemapDefaults,$name)
|
47 |
{
|
48 |
|
49 |
return ( isset( $sitemapDefaults->{$name} ) ? $sitemapDefaults->{$name} : $sitemapDefaults->posts );
|
50 |
}
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
|
55 |
static function getDefaults($name){
|
56 |
|
57 |
$settings = new metaSettings();
|
58 |
|
59 |
-
$settings->exclude = (
|
60 |
-
$settings->priority = (
|
61 |
-
$settings->frequency = (
|
62 |
-
$settings->scheduled = (
|
63 |
|
64 |
return $settings;
|
65 |
}
|
66 |
|
|
|
|
|
67 |
static function handlePostBack(){
|
68 |
|
69 |
if (!(strtoupper($_SERVER['REQUEST_METHOD']) == 'POST')){ return; }
|
@@ -78,29 +73,28 @@ class settings
|
|
78 |
|
79 |
$globalSettings = new globalSettings();
|
80 |
|
81 |
-
|
82 |
-
$register = ( isset( $_POST['register'] ) ? $_POST['register'] : 0 );
|
83 |
|
84 |
-
$globalSettings->newsMode = (
|
85 |
-
$globalSettings->enableImages = (
|
86 |
-
$globalSettings->addRssToHead = (
|
87 |
-
$globalSettings->pingSitemap = (
|
88 |
-
$globalSettings->addToRobots = (
|
89 |
-
$globalSettings->sendStats = (
|
90 |
-
$globalSettings->smallCredit = (
|
91 |
-
$globalSettings->robotEntries = (
|
92 |
-
$globalSettings->registerEmail = (
|
93 |
|
94 |
-
$globalSettings->urlXmlSitemap = (
|
95 |
-
$globalSettings->urlNewsSitemap = (
|
96 |
-
$globalSettings->urlRssSitemap = (
|
97 |
-
$globalSettings->urlRssLatest = (
|
98 |
-
$globalSettings->urlHtmlSitemap = (
|
99 |
|
100 |
$globalSettings->register = $register;
|
101 |
|
102 |
|
103 |
-
// if new
|
104 |
if ($register != get_option('wpXSG_registered'))
|
105 |
{
|
106 |
$postData = array(
|
@@ -109,18 +103,25 @@ class settings
|
|
109 |
'register' => $register,
|
110 |
'id' => get_option('wpXSG_MapId')
|
111 |
);
|
|
|
|
|
112 |
$url = 'https://xmlsitemapgenerator.org/services/WordpressOptIn.aspx';
|
113 |
-
// $url = 'http://localhost:51944/services/WordpressOptIn.aspx';
|
114 |
try
|
115 |
{
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
|
|
|
|
|
|
|
|
|
|
121 |
}
|
122 |
catch (Exception $e)
|
123 |
{}
|
|
|
124 |
}
|
125 |
|
126 |
update_option( "wpXSG_global" , $globalSettings , true);
|
@@ -134,7 +135,7 @@ class settings
|
|
134 |
|
135 |
$sitemapDefaults = new sitemapDefaults();
|
136 |
|
137 |
-
$sitemapDefaults->dateField = (
|
138 |
$sitemapDefaults->homepage = self::getDefaults("homepage");
|
139 |
$sitemapDefaults->pages = self::getDefaults("pages");
|
140 |
$sitemapDefaults->posts = self::getDefaults("posts");
|
@@ -145,20 +146,14 @@ class settings
|
|
145 |
$sitemapDefaults->oldArchive = self::getDefaults("oldArchive");
|
146 |
$sitemapDefaults->authors = self::getDefaults("authors");
|
147 |
|
148 |
-
$sitemapDefaults->excludeRules = (
|
149 |
|
150 |
foreach ( self::getPostTypes() as $post_type )
|
151 |
{
|
152 |
$sitemapDefaults->{$post_type} = self::getDefaults($post_type);
|
153 |
}
|
154 |
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
update_option( "wpXSG_sitemapDefaults" , $sitemapDefaults , false);
|
159 |
-
|
160 |
-
core::updateStatistics("Admin", "SaveSettings",0);
|
161 |
-
|
162 |
|
163 |
}
|
164 |
|
@@ -167,12 +162,12 @@ class settings
|
|
167 |
?>
|
168 |
|
169 |
<tr>
|
170 |
-
<td scope="col"><?php echo $title; ?></td>
|
171 |
-
<td scope="col"><select name="<?php echo $name; ?>Exclude" id="<?php echo $name; ?>Exclude" ></select> </td>
|
172 |
-
<td scope="col"><select name="<?php echo $name; ?>Priority" id="<?php echo $name; ?>Priority" ></select> </td>
|
173 |
-
<td scope="col"><select name="<?php echo $name; ?>Frequency" id="<?php echo $name; ?>Frequency" ></select> </td>
|
174 |
<?php if ($scheduled) { ?>
|
175 |
-
<td scope="col"><input type="checkbox" name="<?php echo $name; ?>Scheduled" id="<?php echo $name; ?>Scheduled"
|
176 |
<?php if ($defaults->scheduled) { echo 'checked="checked"';} ?>
|
177 |
></input> </td>
|
178 |
<?php }
|
@@ -181,18 +176,29 @@ class settings
|
|
181 |
?>
|
182 |
</tr>
|
183 |
<script>
|
184 |
-
xsg_populate("<?php echo $name; ?>Exclude" ,excludeDefaults, <?php echo $defaults->exclude ?>);
|
185 |
-
xsg_populate("<?php echo $name; ?>Priority" ,priorityDefaults, <?php echo $defaults->priority ?>);
|
186 |
-
xsg_populate("<?php echo $name; ?>Frequency" ,frequencyDefaults, <?php echo $defaults->frequency ?>);
|
187 |
|
188 |
</script>
|
189 |
|
190 |
<?php
|
191 |
|
192 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
193 |
|
194 |
-
|
195 |
-
|
196 |
public static function render()
|
197 |
{
|
198 |
|
@@ -201,7 +207,6 @@ class settings
|
|
201 |
$globalSettings = core::getGlobalSettings();
|
202 |
$sitemapDefaults = get_option( "wpXSG_sitemapDefaults" , new sitemapDefaults() );
|
203 |
|
204 |
-
core::updateStatistics("Admin", "ViewSettings",0);
|
205 |
|
206 |
?>
|
207 |
|
@@ -222,7 +227,7 @@ class settings
|
|
222 |
|
223 |
|
224 |
<p>Here you can edit your admin settings and defaults. You can override categories, tags, pages and posts when adding and editing them.</p>
|
225 |
-
<p>Please support us with a <a target="_blank" href="<?php echo
|
226 |
suggestions and bugs please <a target="_blank" href="https://xmlsitemapgenerator.org/contact.aspx">contact us</a>.</strong></p>
|
227 |
|
228 |
<div id="poststuff" class="metabox-holder has-right-sidebar">
|
@@ -236,15 +241,11 @@ class settings
|
|
236 |
<p>Pages that are created or modified by Xml Sitemap Generator</p>
|
237 |
<ul>
|
238 |
<?php
|
239 |
-
$
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
echo '<li><a target="_blank" href="' . $url .'/' . $globalSettings->urlRssLatest . '">RSS New Pages</a></li>';
|
245 |
-
echo '<li><a target="_blank" href="' . $url .'/' . $globalSettings->urlHtmlSitemap . '">HTML Sitemap</a></li>';
|
246 |
-
echo '<li><a target="_blank" href="' . $url .'/robots.txt">Robots.txt</a></li>';
|
247 |
-
|
248 |
?>
|
249 |
|
250 |
</ul>
|
@@ -277,7 +278,6 @@ class settings
|
|
277 |
<li><a href="https://webmaster.yandex.com/">Yandex Webmaster tools</a></li>
|
278 |
|
279 |
</ul>
|
280 |
-
|
281 |
</div>
|
282 |
</div>
|
283 |
|
@@ -294,15 +294,10 @@ class settings
|
|
294 |
</ul>
|
295 |
|
296 |
</div>
|
297 |
-
</div>
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
</div>
|
303 |
</div>
|
304 |
|
305 |
-
|
306 |
|
307 |
<div class="has-sidebar">
|
308 |
|
@@ -312,9 +307,8 @@ class settings
|
|
312 |
|
313 |
<div class="meta-box-sortabless">
|
314 |
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
|
319 |
<div class="postbox" <?php if (!get_option('wpXSG_registered')) {echo 'style="border-left:solid 4px #dc3232;"';} ?>">
|
320 |
<h3 class="hndle"><span>Register for important updates</span></h3>
|
@@ -330,46 +324,45 @@ class settings
|
|
330 |
<table><tr><td>
|
331 |
<p>
|
332 |
<label for="email" >Email address</label><br />
|
333 |
-
<input type="text" name="registerEmail" size="40" value="<?php echo
|
334 |
</p>
|
335 |
</td><td> </td><td>
|
336 |
<p>
|
337 |
<label for="website">Website</label><br />
|
338 |
-
<input type="text" name="website" size="40" readonly value="<?php echo site_url(); ?>" />
|
339 |
</p>
|
340 |
</td></tr></table>
|
341 |
</div>
|
342 |
</div>
|
343 |
|
344 |
|
345 |
-
|
346 |
<div class="postbox">
|
347 |
<h3 class="hndle"><span>Output urls</span></h3>
|
348 |
<div class="inside">
|
349 |
-
<p>You can
|
350 |
<p>Caution should be take to avoid conflicts with other plugins which might output similar files. Please ensure it is a simple filename with no slashes and only one dot.</p>
|
351 |
<table><tr><td>
|
352 |
<p>
|
353 |
<label for="email" >XML Sitemap URL</label><br />
|
354 |
-
<input type="text" name="urlXmlSitemap" size="40" value="<?php echo
|
355 |
</p>
|
356 |
|
357 |
<p>
|
358 |
<label for="email" >RSS Sitemap URL</label><br />
|
359 |
-
<input type="text" name="urlRssSitemap" size="40" value="<?php echo
|
360 |
</p>
|
361 |
<p>
|
362 |
<label for="email" >HTML Sitemap URL</label><br />
|
363 |
-
<input type="text" name="urlHtmlSitemap" size="40" value="<?php echo
|
364 |
</p>
|
365 |
</td><td> </td><td style="vertical-align:top">
|
366 |
<p>
|
367 |
<label for="email" >XML News Sitemap URL</label><br />
|
368 |
-
<input type="text" name="urlNewsSitemap" size="40" value="<?php echo
|
369 |
</p>
|
370 |
<p>
|
371 |
<label for="email" >RSS Latest URLs</label><br />
|
372 |
-
<input type="text" name="urlRssLatest" size="40" value="<?php echo
|
373 |
</p>
|
374 |
|
375 |
|
@@ -494,7 +487,7 @@ class settings
|
|
494 |
<h3 class="hndle"><span>Robots.txt</span></h3>
|
495 |
<div class="inside">
|
496 |
<p>Add custom entries to your robots.txt file.</p>
|
497 |
-
<textarea name="robotEntries" id="robotEntries" rows="10" style="width:98%;"><?php echo
|
498 |
|
499 |
</div>
|
500 |
</div>
|
@@ -506,34 +499,21 @@ class settings
|
|
506 |
<h3 class="hndle"><span>Log</span></h3>
|
507 |
<div class="inside">
|
508 |
|
509 |
-
<?php echo
|
510 |
</div>
|
511 |
</div>
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
</div>
|
516 |
|
517 |
</div>
|
518 |
|
519 |
-
|
520 |
-
|
521 |
</div>
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
|
526 |
</div>
|
527 |
</div>
|
528 |
|
529 |
-
|
530 |
</form>
|
531 |
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
<?php
|
538 |
|
539 |
}
|
12 |
{
|
13 |
add_action('admin_menu', array( __CLASS__, 'admin_menu' ) );
|
14 |
add_action('admin_init', array( __CLASS__, 'register_settings' ) );
|
|
|
15 |
}
|
|
|
|
|
16 |
|
17 |
public static function admin_menu()
|
18 |
{
|
24 |
register_setting( XSG_PLUGIN_NAME, XSG_PLUGIN_NAME );
|
25 |
}
|
26 |
|
|
|
|
|
27 |
static function getPostTypes()
|
28 |
{
|
29 |
$args = array(
|
38 |
|
39 |
return $post_types;
|
40 |
}
|
41 |
+
|
42 |
static function postTypeDefault($sitemapDefaults,$name)
|
43 |
{
|
44 |
|
45 |
return ( isset( $sitemapDefaults->{$name} ) ? $sitemapDefaults->{$name} : $sitemapDefaults->posts );
|
46 |
}
|
|
|
|
|
|
|
47 |
|
48 |
static function getDefaults($name){
|
49 |
|
50 |
$settings = new metaSettings();
|
51 |
|
52 |
+
$settings->exclude = helpers::getFieldValue($name . 'Exclude', 0);
|
53 |
+
$settings->priority = helpers::getFieldValue($name . 'Priority' , 0);
|
54 |
+
$settings->frequency = helpers::getFieldValue($name . 'Frequency', 0);
|
55 |
+
$settings->scheduled = helpers::getFieldValue($name . 'Scheduled', 0);
|
56 |
|
57 |
return $settings;
|
58 |
}
|
59 |
|
60 |
+
|
61 |
+
|
62 |
static function handlePostBack(){
|
63 |
|
64 |
if (!(strtoupper($_SERVER['REQUEST_METHOD']) == 'POST')){ return; }
|
73 |
|
74 |
$globalSettings = new globalSettings();
|
75 |
|
76 |
+
$register = helpers::getFieldValue('register', 0);
|
|
|
77 |
|
78 |
+
$globalSettings->newsMode = helpers::getFieldValue('newsMode', 0);
|
79 |
+
$globalSettings->enableImages = helpers::getFieldValue('enableImages', 0);
|
80 |
+
$globalSettings->addRssToHead = helpers::getFieldValue('addRssToHead', 0);
|
81 |
+
$globalSettings->pingSitemap = helpers::getFieldValue('pingSitemap', 0 );
|
82 |
+
$globalSettings->addToRobots = helpers::getFieldValue('addToRobots', 0 );
|
83 |
+
$globalSettings->sendStats = helpers::getFieldValue('sendStats', 0 );
|
84 |
+
$globalSettings->smallCredit = helpers::getFieldValue('smallCredit', 0 );
|
85 |
+
$globalSettings->robotEntries = helpers::getTextAreaValue('robotEntries', "" );
|
86 |
+
$globalSettings->registerEmail = helpers::getEmailValue('registerEmail', "" );
|
87 |
|
88 |
+
$globalSettings->urlXmlSitemap = helpers::getFieldValue('urlXmlSitemap' , "xmlsitemap.xml");
|
89 |
+
$globalSettings->urlNewsSitemap = helpers::getFieldValue('urlNewsSitemap', "newssitemap.xml");
|
90 |
+
$globalSettings->urlRssSitemap = helpers::getFieldValue('urlRssSitemap' , "rsssitemap.xml");
|
91 |
+
$globalSettings->urlRssLatest = helpers::getFieldValue('urlRssLatest', "rsslatest.xml");
|
92 |
+
$globalSettings->urlHtmlSitemap = helpers::getFieldValue('urlHtmlSitemap', "htmlsitemap.htm");
|
93 |
|
94 |
$globalSettings->register = $register;
|
95 |
|
96 |
|
97 |
+
// if new registration status then .....
|
98 |
if ($register != get_option('wpXSG_registered'))
|
99 |
{
|
100 |
$postData = array(
|
103 |
'register' => $register,
|
104 |
'id' => get_option('wpXSG_MapId')
|
105 |
);
|
106 |
+
|
107 |
+
// legacy - to be retired
|
108 |
$url = 'https://xmlsitemapgenerator.org/services/WordpressOptIn.aspx';
|
|
|
109 |
try
|
110 |
{
|
111 |
+
$response = wp_remote_post($url,array('method' => 'POST','body' => $postData));
|
112 |
+
}
|
113 |
+
catch (Exception $e)
|
114 |
+
{}
|
115 |
+
|
116 |
+
$url = 'https://xmlsitemapgenerator.org/newsletter/wordpress';
|
117 |
+
|
118 |
+
try
|
119 |
+
{
|
120 |
+
$response = wp_remote_post($url,array('method' => 'POST','body' => $postData));
|
121 |
}
|
122 |
catch (Exception $e)
|
123 |
{}
|
124 |
+
|
125 |
}
|
126 |
|
127 |
update_option( "wpXSG_global" , $globalSettings , true);
|
135 |
|
136 |
$sitemapDefaults = new sitemapDefaults();
|
137 |
|
138 |
+
$sitemapDefaults->dateField = helpers::getFieldValue('dateField', $sitemapDefaults->dateField );
|
139 |
$sitemapDefaults->homepage = self::getDefaults("homepage");
|
140 |
$sitemapDefaults->pages = self::getDefaults("pages");
|
141 |
$sitemapDefaults->posts = self::getDefaults("posts");
|
146 |
$sitemapDefaults->oldArchive = self::getDefaults("oldArchive");
|
147 |
$sitemapDefaults->authors = self::getDefaults("authors");
|
148 |
|
149 |
+
$sitemapDefaults->excludeRules = helpers::getFieldValue('excludeRules',"" );
|
150 |
|
151 |
foreach ( self::getPostTypes() as $post_type )
|
152 |
{
|
153 |
$sitemapDefaults->{$post_type} = self::getDefaults($post_type);
|
154 |
}
|
155 |
|
156 |
+
update_option( "wpXSG_sitemapDefaults" , $sitemapDefaults , false);
|
|
|
|
|
|
|
|
|
|
|
|
|
157 |
|
158 |
}
|
159 |
|
162 |
?>
|
163 |
|
164 |
<tr>
|
165 |
+
<td scope="col"><?php echo esc_attr($title); ?></td>
|
166 |
+
<td scope="col"><select name="<?php echo esc_attr($name); ?>Exclude" id="<?php echo esc_attr($name); ?>Exclude" ></select> </td>
|
167 |
+
<td scope="col"><select name="<?php echo esc_attr($name); ?>Priority" id="<?php echo esc_attr($name); ?>Priority" ></select> </td>
|
168 |
+
<td scope="col"><select name="<?php echo esc_attr($name); ?>Frequency" id="<?php echo esc_attr($name); ?>Frequency" ></select> </td>
|
169 |
<?php if ($scheduled) { ?>
|
170 |
+
<td scope="col"><input type="checkbox" name="<?php echo esc_attr($name); ?>Scheduled" id="<?php echo esc_attr($name); ?>Scheduled"
|
171 |
<?php if ($defaults->scheduled) { echo 'checked="checked"';} ?>
|
172 |
></input> </td>
|
173 |
<?php }
|
176 |
?>
|
177 |
</tr>
|
178 |
<script>
|
179 |
+
xsg_populate("<?php echo esc_attr($name); ?>Exclude" ,excludeDefaults, <?php echo esc_attr($defaults->exclude); ?>);
|
180 |
+
xsg_populate("<?php echo esc_attr($name); ?>Priority" ,priorityDefaults, <?php echo esc_attr($defaults->priority); ?>);
|
181 |
+
xsg_populate("<?php echo esc_attr($name); ?>Frequency" ,frequencyDefaults, <?php echo esc_attr($defaults->frequency); ?>);
|
182 |
|
183 |
</script>
|
184 |
|
185 |
<?php
|
186 |
|
187 |
}
|
188 |
+
|
189 |
+
public static function renderSitemapLink($globalSettings, $property, $name) {
|
190 |
+
$blogUrl = get_bloginfo( 'url' ) ;
|
191 |
+
$fileUrl = helpers::safeRead($globalSettings,$property) ;
|
192 |
+
if (strlen($fileUrl) > 0 ) {
|
193 |
+
echo '<li><a target="_blank" href="' . esc_url($blogUrl .'/' . $fileUrl) . '">' . $name . '</a></li>';
|
194 |
+
}
|
195 |
+
else {
|
196 |
+
echo '<li>' . $name . ' (disabled)</li>';
|
197 |
+
}
|
198 |
+
|
199 |
+
}
|
200 |
|
201 |
+
|
|
|
202 |
public static function render()
|
203 |
{
|
204 |
|
207 |
$globalSettings = core::getGlobalSettings();
|
208 |
$sitemapDefaults = get_option( "wpXSG_sitemapDefaults" , new sitemapDefaults() );
|
209 |
|
|
|
210 |
|
211 |
?>
|
212 |
|
227 |
|
228 |
|
229 |
<p>Here you can edit your admin settings and defaults. You can override categories, tags, pages and posts when adding and editing them.</p>
|
230 |
+
<p>Please support us with a <a target="_blank" href="<?php echo (XSG_DONATE_URL) ?>">small donation</a>. If you have any comments, questions,
|
231 |
suggestions and bugs please <a target="_blank" href="https://xmlsitemapgenerator.org/contact.aspx">contact us</a>.</strong></p>
|
232 |
|
233 |
<div id="poststuff" class="metabox-holder has-right-sidebar">
|
241 |
<p>Pages that are created or modified by Xml Sitemap Generator</p>
|
242 |
<ul>
|
243 |
<?php
|
244 |
+
self::renderSitemapLink($globalSettings,"urlXmlSitemap", "XML Sitemap");
|
245 |
+
self::renderSitemapLink($globalSettings,"urlRssSitemap", "RSS Sitemap");
|
246 |
+
self::renderSitemapLink($globalSettings,"urlRssLatest", "RSS New Pages");
|
247 |
+
self::renderSitemapLink($globalSettings,"urlHtmlSitemap", "HTML Sitemap");
|
248 |
+
|
|
|
|
|
|
|
|
|
249 |
?>
|
250 |
|
251 |
</ul>
|
278 |
<li><a href="https://webmaster.yandex.com/">Yandex Webmaster tools</a></li>
|
279 |
|
280 |
</ul>
|
|
|
281 |
</div>
|
282 |
</div>
|
283 |
|
294 |
</ul>
|
295 |
|
296 |
</div>
|
297 |
+
</div>
|
|
|
|
|
|
|
|
|
298 |
</div>
|
299 |
</div>
|
300 |
|
|
|
301 |
|
302 |
<div class="has-sidebar">
|
303 |
|
307 |
|
308 |
<div class="meta-box-sortabless">
|
309 |
|
310 |
+
|
311 |
+
|
|
|
312 |
|
313 |
<div class="postbox" <?php if (!get_option('wpXSG_registered')) {echo 'style="border-left:solid 4px #dc3232;"';} ?>">
|
314 |
<h3 class="hndle"><span>Register for important updates</span></h3>
|
324 |
<table><tr><td>
|
325 |
<p>
|
326 |
<label for="email" >Email address</label><br />
|
327 |
+
<input type="text" name="registerEmail" size="40" value="<?php echo helpers::safeRead2($globalSettings,"registerEmail",get_option( 'admin_email' ) ); ?>" />
|
328 |
</p>
|
329 |
</td><td> </td><td>
|
330 |
<p>
|
331 |
<label for="website">Website</label><br />
|
332 |
+
<input type="text" name="website" size="40" readonly value="<?php echo esc_url_raw(site_url()); ?>" />
|
333 |
</p>
|
334 |
</td></tr></table>
|
335 |
</div>
|
336 |
</div>
|
337 |
|
338 |
|
|
|
339 |
<div class="postbox">
|
340 |
<h3 class="hndle"><span>Output urls</span></h3>
|
341 |
<div class="inside">
|
342 |
+
<p>You can change the URL for the various sitemap files using the settings below. Set it to an empty string to disable.</p>
|
343 |
<p>Caution should be take to avoid conflicts with other plugins which might output similar files. Please ensure it is a simple filename with no slashes and only one dot.</p>
|
344 |
<table><tr><td>
|
345 |
<p>
|
346 |
<label for="email" >XML Sitemap URL</label><br />
|
347 |
+
<input type="text" name="urlXmlSitemap" size="40" value="<?php echo helpers::safeRead($globalSettings,"urlXmlSitemap"); ?>" />
|
348 |
</p>
|
349 |
|
350 |
<p>
|
351 |
<label for="email" >RSS Sitemap URL</label><br />
|
352 |
+
<input type="text" name="urlRssSitemap" size="40" value="<?php echo helpers::safeRead($globalSettings,"urlRssSitemap"); ?>" />
|
353 |
</p>
|
354 |
<p>
|
355 |
<label for="email" >HTML Sitemap URL</label><br />
|
356 |
+
<input type="text" name="urlHtmlSitemap" size="40" value="<?php echo helpers::safeRead($globalSettings,"urlHtmlSitemap"); ?>" />
|
357 |
</p>
|
358 |
</td><td> </td><td style="vertical-align:top">
|
359 |
<p>
|
360 |
<label for="email" >XML News Sitemap URL</label><br />
|
361 |
+
<input type="text" name="urlNewsSitemap" size="40" value="<?php echo helpers::safeRead($globalSettings,"urlNewsSitemap"); ?>" />
|
362 |
</p>
|
363 |
<p>
|
364 |
<label for="email" >RSS Latest URLs</label><br />
|
365 |
+
<input type="text" name="urlRssLatest" size="40" value="<?php echo helpers::safeRead($globalSettings,"urlRssLatest"); ?>" />
|
366 |
</p>
|
367 |
|
368 |
|
487 |
<h3 class="hndle"><span>Robots.txt</span></h3>
|
488 |
<div class="inside">
|
489 |
<p>Add custom entries to your robots.txt file.</p>
|
490 |
+
<textarea name="robotEntries" id="robotEntries" rows="10" style="width:98%;"><?php echo helpers::safeRead($globalSettings,"robotEntries"); ?></textarea>
|
491 |
|
492 |
</div>
|
493 |
</div>
|
499 |
<h3 class="hndle"><span>Log</span></h3>
|
500 |
<div class="inside">
|
501 |
|
502 |
+
<?php echo core::getStatusHtml();?>
|
503 |
</div>
|
504 |
</div>
|
505 |
+
|
|
|
|
|
506 |
</div>
|
507 |
|
508 |
</div>
|
509 |
|
|
|
|
|
510 |
</div>
|
|
|
|
|
|
|
511 |
|
512 |
</div>
|
513 |
</div>
|
514 |
|
|
|
515 |
</form>
|
516 |
|
|
|
|
|
|
|
|
|
|
|
517 |
<?php
|
518 |
|
519 |
}
|
readme.txt
CHANGED
@@ -4,6 +4,7 @@ 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.9
|
|
|
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 |
|
@@ -125,12 +126,25 @@ You should now be up and running, but you may also want to :
|
|
125 |
7. XML sitemap page with images
|
126 |
8. Sitemap entries in Robots.txt
|
127 |
|
|
|
128 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
129 |
= 2.0.3 =
|
130 |
Release Date: February 6th, 2022
|
131 |
* New : Tested up to WordPress 5.9
|
132 |
* Fix : security fix - validate sitemap renderer
|
133 |
-
* Fix : multi-site
|
134 |
|
135 |
= 2.0.2 =
|
136 |
Release Date: August 19th, 2021
|
4 |
Donate link: https://xmlsitemapgenerator.org/contribute/subscribeother.aspx?service=wordpress
|
5 |
Requires at least: 5.1.0
|
6 |
Tested up to: 5.9
|
7 |
+
Stable tag: 2.0.4
|
8 |
|
9 |
Improve your websites SEO with a comprehensive, easy to use RSS and XML sitemap plugin. Compatible with Google, Bing, Baidu, Yandex and more.
|
10 |
|
126 |
7. XML sitemap page with images
|
127 |
8. Sitemap entries in Robots.txt
|
128 |
|
129 |
+
|
130 |
== Changelog ==
|
131 |
+
= 2.0.4 =
|
132 |
+
Release Date: April 28th, 2022
|
133 |
+
* New : Set an empty sitemap file to disable a given map.
|
134 |
+
* Fix : Index file showing news twice.
|
135 |
+
* Fix : Archive provider rendered regardless of settings
|
136 |
+
* Fix : Erroneous variables in archive provider.
|
137 |
+
* Fix : Added WP sanitize and esc filters
|
138 |
+
* Fix : Enqueue scripts instead of inline.
|
139 |
+
* Fix : Stable tag.
|
140 |
+
* Fix : Removed analytics.
|
141 |
+
* Fix : Remove latest archive from XML index.
|
142 |
+
|
143 |
= 2.0.3 =
|
144 |
Release Date: February 6th, 2022
|
145 |
* New : Tested up to WordPress 5.9
|
146 |
* Fix : security fix - validate sitemap renderer
|
147 |
+
* Fix : multi-site activation
|
148 |
|
149 |
= 2.0.2 =
|
150 |
Release Date: August 19th, 2021
|
www-xml-sitemap-generator-org.php
CHANGED
@@ -4,7 +4,7 @@ namespace xmlSitemapGenerator;
|
|
4 |
Plugin Name: XML Sitemap Generator for Google
|
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
|
4 |
Plugin Name: XML Sitemap Generator for Google
|
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.4
|
8 |
Author: XmlSitemapGenerator.org
|
9 |
Author URI: https://XmlSitemapGenerator.org
|
10 |
License: GPL2
|