Google XML Sitemap Generator - Version 2.0.0

Version Description

Release Date: February 7th, 2021

  • New : Tested up to WordPress 5.6.1
  • New : Support for sitemap index files
  • New : Support for image sitemaps
  • New : Support for news sitemaps
  • New : Support for larger sitemaps
  • New : Rearchitected to improve maintainability and performance
  • Fix : Incorrect robots.txt entries
  • Fix : Category / Tag editing fields

UPGRADE NOTE - After upgrading, some users are reporting issues with the XML sitemap index file giving a 404 error/ redirecting to the homepage. If you have this issue please deactivate then reactive the plugin. If you have any further issues please contact support.

Download this release

Release Info

Developer XmlSitemapGenerator
Plugin Icon 128x128 Google XML Sitemap Generator
Version 2.0.0
Comparing to
See all releases

Code changes from version 1.3.4 to 2.0.0

Files changed (45) hide show
  1. XmlSitemap.xsl +0 -83
  2. assets/1.jpg +0 -0
  3. assets/Screenshot-1.jpg +0 -0
  4. assets/Screenshot-2.jpg +0 -0
  5. assets/Screenshot-3.jpg +0 -0
  6. assets/Screenshot-4.jpg +0 -0
  7. assets/Screenshot-5.jpg +0 -0
  8. assets/Screenshot-6.jpg +0 -0
  9. assets/Screenshot-7.jpg +0 -0
  10. assets/Screenshot-8.jpg +0 -0
  11. assets/SitemapRSS.xsl +77 -0
  12. assets/SitemapXML.xsl +161 -0
  13. assets/SitemapXMLnews.xsl +110 -0
  14. assets/icon-128x128.jpg +0 -0
  15. assets/icon-256x256.jpg +0 -0
  16. assets/placeholder.gif +0 -0
  17. assets/placeholder.png +0 -0
  18. scripts.js → assets/scripts.js +1 -1
  19. code/authorMetaData.php +111 -0
  20. code/categoryMetaData.php +29 -16
  21. code/core.php +240 -81
  22. code/dataAccess.php +16 -145
  23. code/postMetaData.php +1 -1
  24. code/providers/ZZZ__postsProvider.php +139 -0
  25. code/providers/_pageProvider.php +130 -0
  26. code/providers/archiveProvider.php +98 -0
  27. code/providers/authorsProvider.php +86 -0
  28. code/providers/coreProvider.php +305 -0
  29. code/providers/indexProvider.php +109 -0
  30. code/providers/latestProvider.php +128 -0
  31. code/providers/newsProvider.php +126 -0
  32. code/providers/postsProvider.php +209 -0
  33. code/providers/termsProvider.php +117 -0
  34. code/renderers.php +0 -438
  35. code/renderers/coreRenderer.php +41 -0
  36. code/renderers/htmRenderer.php +115 -0
  37. code/renderers/newsRenderer.php +88 -0
  38. code/renderers/rssRenderer.php +86 -0
  39. code/renderers/xmlRenderer.php +198 -0
  40. code/settings.php +180 -50
  41. code/settingsModels.php +17 -3
  42. code/sitemapBuilder.php +0 -487
  43. code/upgrader.php +6 -1
  44. readme.txt +50 -12
  45. www-xml-sitemap-generator-org.php +13 -5
XmlSitemap.xsl DELETED
@@ -1,83 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <xsl:stylesheet version="1.0" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:sitemap="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
3
- <xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes" />
4
- <xsl:template match="/">
5
- <html xmlns="http://www.w3.org/1999/xhtml">
6
- <head>
7
- <title>Wordpress XML Sitemap Generator Plugin</title>
8
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
9
- <meta name="robots" content="index,follow" />
10
- <style type="text/css">
11
- body {font-family:Tahoma, Verdana, Arial, sans-serif;font-size:12px; }
12
- #header { padding:0px; margin-top:10px; margin-bottom:20px;}
13
- a {text-decoration:none; color:blue;}
14
- table {margin-bottom:50px;}
15
- tr:nth-child(odd) { background-color:#eeeeee; }
16
- th {font-size:12px; padding:5px;text-align:left; vertical-align:bottom;}
17
- td {font-size:12px; padding:5px; }
18
- </style>
19
- </head>
20
- <body>
21
- <xsl:apply-templates></xsl:apply-templates>
22
- </body>
23
- </html>
24
- </xsl:template>
25
-
26
-
27
- <xsl:template match="sitemap:urlset">
28
- <h1>Wordpress XML Sitemap</h1>
29
-
30
- <div id="header">
31
- <p>
32
- This is an XML Sitemap comaptible with major search engines such as Google, Bing, Baidu and Yandex.<br />
33
- For more information and support go to <a href="https://xmlsitemapgenerator.org/wordpress-sitemap-generator-plugin.aspx">Wordpress Sitemap Generator Plugin</a> homepage. <br />
34
- You can find more information about XML sitemaps on <a href="http://sitemaps.org">sitemaps.org</a>
35
- </p>
36
- </div>
37
-
38
-
39
-
40
- <table cellspacing="0">
41
- <tr>
42
- <th>Page url</th>
43
- <th style="width:80px;">Relative<br />priority</th>
44
- <th style="width:80px;">Change<br />frequency</th>
45
- <th style="width:130px;">Modified<br />date</th>
46
- </tr>
47
- <xsl:variable name="lower" select="'abcdefghijklmnopqrstuvwxyz'"/>
48
- <xsl:variable name="upper" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
49
- <xsl:for-each select="./sitemap:url">
50
- <tr>
51
- <xsl:if test="position() mod 2 != 1">
52
- <xsl:attribute name="class">high</xsl:attribute>
53
- </xsl:if>
54
- <td>
55
- <xsl:variable name="page">
56
- <xsl:value-of select="sitemap:loc"/>
57
- </xsl:variable>
58
- <a target="_blank" href="{$page}">
59
- <xsl:value-of select="sitemap:loc"/>
60
- </a>
61
- </td>
62
- <td>
63
- <xsl:value-of select="sitemap:priority"/>
64
- </td>
65
- <td>
66
- <xsl:value-of select="sitemap:changefreq"/>
67
- </td>
68
- <td>
69
- <xsl:value-of select="sitemap:lastmod"/>
70
- </td>
71
- </tr>
72
- </xsl:for-each>
73
- </table>
74
-
75
- <div id="xsgFooter">Generated by XmlSitemapGenerator.org -
76
- <a href="https://xmlsitemapgenerator.org/wordpress-sitemap-generator-plugin.aspx" title="WordPress Sitemap Generator Plugin">WordPress XML Sitemap Plugin</a></div>
77
- </div>
78
-
79
- </xsl:template>
80
-
81
-
82
-
83
- </xsl:stylesheet>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/1.jpg ADDED
Binary file
assets/Screenshot-1.jpg CHANGED
Binary file
assets/Screenshot-2.jpg CHANGED
Binary file
assets/Screenshot-3.jpg CHANGED
Binary file
assets/Screenshot-4.jpg CHANGED
Binary file
assets/Screenshot-5.jpg CHANGED
Binary file
assets/Screenshot-6.jpg ADDED
Binary file
assets/Screenshot-7.jpg ADDED
Binary file
assets/Screenshot-8.jpg ADDED
Binary file
assets/SitemapRSS.xsl ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <xsl:stylesheet version="1.0" xmlns:html="http://www.w3.org/TR/REC-html40"
3
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4
+ >
5
+ <xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes" />
6
+
7
+ <xsl:template match="/">
8
+ <html xmlns="http://www.w3.org/1999/xhtml">
9
+ <head>
10
+ <title>Wordpress XML Sitemap Generator Plugin</title>
11
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
12
+ <meta name="robots" content="index,follow" />
13
+ <style type="text/css">
14
+ body {font-family:Tahoma, Verdana, Arial, sans-serif;font-size:1.0em; line-height:2em;}
15
+ #header { padding:0px; margin-top:10px; margin-bottom:20px;}
16
+ a {text-decoration:none; color:blue;}
17
+ table {margin-bottom:50px;}
18
+ tr:nth-child(odd) { background-color:#eeeeee; }
19
+ th {font-size:1.0em; padding:0.5em; text-align:left; vertical-align:bottom;}
20
+ td {font-size:1.0em; padding:0.5em; }
21
+ </style>
22
+ </head>
23
+ <body>
24
+ <xsl:apply-templates></xsl:apply-templates>
25
+ </body>
26
+ </html>
27
+ </xsl:template>
28
+
29
+
30
+
31
+ <xsl:template match="rss/channel">
32
+ <h1>Wordpress RSS Sitemap</h1>
33
+
34
+ <div id="header">
35
+ <p>
36
+ This is an RSS Sitemap which helps search engines find all your pages.<br />
37
+ This is useful for feed aggregators, search engines and spiders that do not support the XML Sitemap format.<br />
38
+ For more information and support go to <a href="https://xmlsitemapgenerator.org/wordpress-sitemap-generator-plugin.aspx">Wordpress Sitemap Generator Plugin</a> homepage. <br />
39
+ </p>
40
+ </div>
41
+
42
+ <table cellspacing="0">
43
+ <tr>
44
+ <th>Page title / link</th>
45
+ <th style="width:130px;">Modified date</th>
46
+ </tr>
47
+ <xsl:for-each select="item">
48
+ <tr>
49
+ <xsl:if test="position() mod 2 != 1">
50
+ <xsl:attribute name="class">high</xsl:attribute>
51
+ </xsl:if>
52
+ <td>
53
+ <xsl:variable name="page">
54
+ <xsl:value-of select="link"/>
55
+ </xsl:variable>
56
+ <a target="_blank" href="{$page}">
57
+ <xsl:value-of select="title"/>
58
+ </a>
59
+ </td>
60
+ <td>
61
+ <xsl:value-of select="pubDate"/>
62
+ </td>
63
+ </tr>
64
+ </xsl:for-each>
65
+ </table>
66
+
67
+ <div id="xsgFooter">Generated by XmlSitemapGenerator.org -
68
+ <a href="https://xmlsitemapgenerator.org/wordpress-sitemap-generator-plugin.aspx"
69
+ title="WordPress XML Sitemap Generator Plugin">
70
+ WordPress XML Sitemap Generator Plugin</a>
71
+ </div>
72
+
73
+ </xsl:template>
74
+
75
+
76
+
77
+ </xsl:stylesheet>
assets/SitemapXML.xsl ADDED
@@ -0,0 +1,161 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <xsl:stylesheet version="1.0"
3
+ xmlns:html="http://www.w3.org/TR/REC-html40"
4
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
5
+ xmlns:sitemapindex="http://www.sitemaps.org/schemas/sitemap/0.9"
6
+ xmlns:sitemap="http://www.sitemaps.org/schemas/sitemap/0.9"
7
+ xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"
8
+ >
9
+ <xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes" />
10
+
11
+ <xsl:template match="/">
12
+ <html xmlns="http://www.w3.org/1999/xhtml">
13
+ <head>
14
+ <title>Wordpress XML Sitemap Generator Plugin</title>
15
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
16
+ <meta name="robots" content="index,follow" />
17
+ <style type="text/css">
18
+ body {font-family:Tahoma, Verdana, Arial, sans-serif;font-size:1.0em; line-height:2em;}
19
+ #header { padding:0px; margin-top:10px; margin-bottom:20px;}
20
+ a {text-decoration:none; color:blue;}
21
+ table {margin-bottom:50px;width:100%;}
22
+
23
+ th {font-size:1.0em; padding:0.5em; text-align:left; vertical-align:bottom; background-color:#CCCCCC; }
24
+ td {font-size:1.0em; padding:0.5em; border-bottom: solid 1px #CCCCCC; }
25
+ div.img {float:left;clear:both; width:90%; font-size:0.8em; vertical:top;}
26
+ span.imgbox{width:65px; height:55px; background-color:#CCCCCC;float:left; margin:0px 5px 5px 0px; text-align:center;vertical-align: middle; line-height:55px; color:#FFFFFF; weight:bold;}
27
+ </style>
28
+ </head>
29
+ <body>
30
+ <xsl:apply-templates></xsl:apply-templates>
31
+ </body>
32
+ </html>
33
+ </xsl:template>
34
+
35
+
36
+
37
+ <xsl:template match="sitemap:sitemapindex">
38
+ <h1>Wordpress XML Sitemap Index</h1>
39
+
40
+ <div id="header">
41
+ <p>
42
+ This is an XML Sitemap compatible with major search engines such as Google, Bing, Baidu and Yandex.<br />
43
+ For more information and support go to <a href="https://xmlsitemapgenerator.org/wordpress-sitemap-generator-plugin.aspx">Wordpress Sitemap Generator Plugin</a> homepage. <br />
44
+ You can find more information about XML sitemaps on <a href="http://sitemaps.org">sitemaps.org</a>
45
+ </p>
46
+ </div>
47
+
48
+
49
+
50
+ <table cellspacing="0">
51
+ <tr>
52
+ <th>Sitemap file url</th>
53
+ </tr>
54
+
55
+ <xsl:for-each select="./sitemapindex:sitemap">
56
+ <tr>
57
+ <td>
58
+ <xsl:variable name="page">
59
+ <xsl:value-of select="sitemapindex:loc"/>
60
+ </xsl:variable>
61
+ <a target="_blank" href="{$page}">
62
+ <xsl:value-of select="sitemapindex:loc"/>
63
+ </a>
64
+ </td>
65
+
66
+ </tr>
67
+ </xsl:for-each>
68
+ </table>
69
+
70
+ <div id="xsgFooter">Generated by XmlSitemapGenerator.org -
71
+ <a href="https://xmlsitemapgenerator.org/wordpress-sitemap-generator-plugin.aspx"
72
+ title="WordPress XML Sitemap Generator Plugin">
73
+ WordPress XML Sitemap Generator Plugin</a>
74
+ </div>
75
+
76
+ </xsl:template>
77
+
78
+
79
+
80
+
81
+ <xsl:template match="sitemap:urlset">
82
+ <h1>Wordpress XML Sitemap</h1>
83
+
84
+ <div id="header">
85
+ <p>
86
+ This is an XML Sitemap compatible with major search engines such as Google, Bing, Baidu and Yandex.<br />
87
+ For more information and support go to <a href="https://xmlsitemapgenerator.org/wordpress-sitemap-generator-plugin.aspx">Wordpress Sitemap Generator Plugin</a> homepage. <br />
88
+ You can find more information about XML sitemaps on <a href="http://sitemaps.org">sitemaps.org</a>
89
+ </p>
90
+ </div>
91
+
92
+
93
+ <table cellspacing="0">
94
+ <tr>
95
+ <th>Page url</th>
96
+ <th style="width:80px;">Relative<br />priority</th>
97
+ <th style="width:80px;">Change<br />frequency</th>
98
+ <th style="width:130px;">Modified<br />date</th>
99
+ </tr>
100
+
101
+ <xsl:for-each select="sitemap:url">
102
+ <tr>
103
+ <xsl:if test="position() mod 2 != 1">
104
+ <xsl:attribute name="class">high</xsl:attribute>
105
+ </xsl:if>
106
+ <td>
107
+ <xsl:variable name="page">
108
+ <xsl:value-of select="sitemap:loc"/>
109
+ </xsl:variable>
110
+ <a target="_blank" href="{$page}">
111
+ <xsl:value-of select="sitemap:loc"/>
112
+ </a>
113
+
114
+
115
+
116
+
117
+
118
+ </td>
119
+ <td>
120
+ <xsl:value-of select="sitemap:priority"/>
121
+ </td>
122
+ <td>
123
+ <xsl:value-of select="sitemap:changefreq"/>
124
+ </td>
125
+ <td>
126
+ <xsl:value-of select="sitemap:lastmod"/>
127
+ </td>
128
+ </tr>
129
+ <xsl:if test="image:image">
130
+ <tr>
131
+ <td colspan="4">
132
+
133
+ <xsl:for-each select="image:image">
134
+ <div class="img">
135
+ <xsl:variable name="loc">
136
+ <xsl:value-of select="image:loc"/>
137
+ </xsl:variable>
138
+ <a href="{$loc}" target="_blank"><span class="imgbox">img</span></a>
139
+ <xsl:value-of select="image:title"/><br />
140
+ <xsl:value-of select="image:caption"/><br />
141
+ <a href="{$loc}" target="_blank"><xsl:value-of select="image:loc"/></a>
142
+
143
+ </div>
144
+ </xsl:for-each>
145
+ </td>
146
+ </tr>
147
+ </xsl:if>
148
+ </xsl:for-each>
149
+ </table>
150
+
151
+ <div id="xsgFooter">Generated by XmlSitemapGenerator.org -
152
+ <a href="https://xmlsitemapgenerator.org/wordpress-sitemap-generator-plugin.aspx"
153
+ title="WordPress XML Sitemap Generator Plugin">
154
+ WordPress XML Sitemap Generator Plugin</a>
155
+ </div>
156
+
157
+ </xsl:template>
158
+
159
+
160
+
161
+ </xsl:stylesheet>
assets/SitemapXMLnews.xsl ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <xsl:stylesheet version="1.0"
3
+ xmlns:html="http://www.w3.org/TR/REC-html40"
4
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
5
+ xmlns:sitemapindex="http://www.sitemaps.org/schemas/sitemap/0.9"
6
+ xmlns:sitemap="http://www.sitemaps.org/schemas/sitemap/0.9"
7
+ xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"
8
+ xmlns:news="http://www.google.com/schemas/sitemap-news/0.9"
9
+ >
10
+ <xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes" />
11
+
12
+ <xsl:template match="/">
13
+ <html xmlns="http://www.w3.org/1999/xhtml">
14
+ <head>
15
+ <title>Wordpress XML Sitemap Generator Plugin</title>
16
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
17
+ <meta name="robots" content="index,follow" />
18
+ <style type="text/css">
19
+ body {font-family:Tahoma, Verdana, Arial, sans-serif;font-size:1.0em; line-height:2em;}
20
+ #header { padding:0px; margin-top:10px; margin-bottom:20px;}
21
+ a {text-decoration:none; color:blue;}
22
+ table {margin-bottom:50px; width:100%;}
23
+
24
+ th {font-size:0.9em; padding:0.5em; text-align:left; vertical-align:bottom; background-color:#CCCCCC; }
25
+ td {font-size:0.9em; padding:0.5em; border-bottom: solid 1px #CCCCCC; }
26
+ div.img {float:left;clear:both; width:90%; font-size:0.8em; vertical:top;}
27
+ span.imgbox{width:65px; height:55px; background-color:#CCCCCC;float:left; margin:0px 5px 5px 0px; text-align:center;vertical-align: middle; line-height:55px; color:#FFFFFF; weight:bold;}
28
+ </style>
29
+ </head>
30
+ <body>
31
+ <xsl:apply-templates></xsl:apply-templates>
32
+ </body>
33
+ </html>
34
+ </xsl:template>
35
+
36
+
37
+
38
+
39
+
40
+ <xsl:template match="sitemap:urlset">
41
+ <h1>Wordpress XML News Sitemap</h1>
42
+
43
+ <div id="header">
44
+ <p>
45
+ This is an XML News Sitemap compatible with major search engines such as Google, Bing, Baidu and Yandex.<br />
46
+ For more information and support go to <a href="https://xmlsitemapgenerator.org/wordpress-sitemap-generator-plugin.aspx">Wordpress Sitemap Generator Plugin</a> homepage.<br />
47
+ You can find more information about XML sitemaps on <a href="http://sitemaps.org">sitemaps.org</a>
48
+ </p>
49
+ </div>
50
+
51
+
52
+ <table cellspacing="0">
53
+ <tr>
54
+ <th>Title / Page url</th>
55
+
56
+ <th style="width:150px;">Publication date</th>
57
+ </tr>
58
+
59
+ <xsl:for-each select="sitemap:url">
60
+ <tr>
61
+ <xsl:if test="position() mod 2 != 1">
62
+ <xsl:attribute name="class">high</xsl:attribute>
63
+ </xsl:if>
64
+ <td>
65
+ <strong><xsl:value-of select="news:news/news:title"/></strong><br />
66
+ <xsl:variable name="page">
67
+ <xsl:value-of select="sitemap:loc"/>
68
+ </xsl:variable>
69
+ <a target="_blank" href="{$page}">
70
+ <xsl:value-of select="sitemap:loc"/>
71
+ </a>
72
+
73
+ </td>
74
+ <td>
75
+ <xsl:value-of select="news:news/news:publication_date"/>
76
+ </td>
77
+ </tr>
78
+ <xsl:if test="image:image">
79
+ <tr>
80
+ <td colspan="4">
81
+
82
+ <xsl:for-each select="image:image">
83
+ <div class="img">
84
+ <xsl:variable name="loc">
85
+ <xsl:value-of select="image:loc"/>
86
+ </xsl:variable>
87
+ <a href="{$loc}" target="_blank"><span class="imgbox">img</span></a>
88
+ <xsl:value-of select="image:title"/><br />
89
+ <xsl:value-of select="image:caption"/><br />
90
+ <a href="{$loc}" target="_blank"><xsl:value-of select="image:loc"/></a>
91
+
92
+ </div>
93
+ </xsl:for-each>
94
+ </td>
95
+ </tr>
96
+ </xsl:if>
97
+ </xsl:for-each>
98
+ </table>
99
+
100
+ <div id="xsgFooter">Generated by XmlSitemapGenerator.org -
101
+ <a href="https://xmlsitemapgenerator.org/wordpress-sitemap-generator-plugin.aspx"
102
+ title="WordPress XML Sitemap Generator Plugin">
103
+ WordPress XML Sitemap Generator Plugin</a>
104
+ </div>
105
+
106
+ </xsl:template>
107
+
108
+
109
+
110
+ </xsl:stylesheet>
assets/icon-128x128.jpg CHANGED
Binary file
assets/icon-256x256.jpg CHANGED
Binary file
assets/placeholder.gif ADDED
Binary file
assets/placeholder.png ADDED
Binary file
scripts.js → assets/scripts.js RENAMED
@@ -25,4 +25,4 @@
25
  var excludeSelect = [ [1,"default"], [2,"exclude"] , [3,"include"] ];
26
  var prioritySelect = [[0,"none"],[1, "default"], [2,"0.0"], [3,"0.1"], [4,"0.2"], [5,"0.3"], [6,"0.4"] , [7,"0.5"] , [8,"0.6"] , [9,"0.7"] , [10,"0.8"] , [11,"0.9"], [12,"1.0"] ];
27
  var frequencySelect = [[0,"none"],[1, "default"], [8,"always"], [7,"hourly"], [6,"daily"], [5,"weekly"], [4,"monthly"], [3,"yearly"] , [2,"never"] ];
28
-
25
  var excludeSelect = [ [1,"default"], [2,"exclude"] , [3,"include"] ];
26
  var prioritySelect = [[0,"none"],[1, "default"], [2,"0.0"], [3,"0.1"], [4,"0.2"], [5,"0.3"], [6,"0.4"] , [7,"0.5"] , [8,"0.6"] , [9,"0.7"] , [10,"0.8"] , [11,"0.9"], [12,"1.0"] ];
27
  var frequencySelect = [[0,"none"],[1, "default"], [8,"always"], [7,"hourly"], [6,"daily"], [5,"weekly"], [4,"monthly"], [3,"yearly"] , [2,"never"] ];
28
+ var newsSelect = [ [0,"exclude"], [1,"include"] ];
code/authorMetaData.php ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace xmlSitemapGenerator;
3
+
4
+ include_once 'dataAccess.php';
5
+
6
+ class authorMetaData
7
+ {
8
+
9
+ public static function addHooks()
10
+ {
11
+
12
+ add_action('edit_user_profile', array( __CLASS__, 'renderEdit' ) );
13
+ add_action( 'profile_update' , array( __CLASS__, 'save_metaData' ), 10, 2);
14
+
15
+ }
16
+
17
+
18
+ static function save_metaData($userId ) {
19
+
20
+ /* Verify the nonce before proceeding. */
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;
28
+
29
+
30
+ $settings = new metaSettings();
31
+
32
+ $settings->id = ( isset( $_POST['wpXSG-metaId'] ) ? $_POST['wpXSG-metaId'] : '0' );
33
+ $settings->itemId = $userId ;
34
+ $settings->itemType = "author";
35
+ $settings->exclude = ( isset( $_POST['wpXSG-Exclude'] ) ? $_POST['wpXSG-Exclude'] : '0' );
36
+ $settings->priority = ( isset( $_POST['wpXSG-Priority'] ) ? $_POST['wpXSG-Priority'] : 'default' );
37
+ $settings->frequency = ( isset( $_POST['wpXSG-Frequency'] ) ? $_POST['wpXSG-Frequency'] : 'default' );
38
+ $settings->inherit = ( isset( $_POST['wpXSG-Inherit'] ) ? $_POST['wpXSG-Inherit'] : 0 );
39
+
40
+ dataAccess::saveMetaItem($settings );
41
+
42
+
43
+
44
+ }
45
+
46
+
47
+
48
+
49
+ static function renderEdit($WP_User )
50
+ {
51
+ $userId = $WP_User->ID;
52
+ self::addHooks();
53
+
54
+ $settings = dataAccess::getMetaItem($userId , "author");
55
+
56
+
57
+ wp_nonce_field( basename( __FILE__ ), 'wpXSG_meta_nonce' );
58
+ ?>
59
+
60
+
61
+ <h3>Sitemap settings : </h3>
62
+
63
+
64
+
65
+
66
+ <table class="form-table">
67
+ <tbody><tr class="form-field form-required term-name-wrap">
68
+ <th scope="row"><label for="name">Sitemap inclusion</label></th>
69
+ <td>
70
+ <select name="wpXSG-Exclude" id="wpXSG-Exclude" ></select>
71
+ <p> Exclude this category/tag from your sitemap.</p>
72
+ </td>
73
+ </tr>
74
+ <tr class="form-field term-slug-wrap">
75
+ <th scope="row"><label for="slug">Relative priority</label></th>
76
+ <td>
77
+ <select name="wpXSG-Priority" id="wpXSG-Priority" ></select>
78
+ <p>Relative priority for this category/tag and related posts.</p>
79
+ </td>
80
+ </tr>
81
+ <tr class="form-field term-description-wrap">
82
+ <th scope="row"><label for="description">Update frequency</label></th>
83
+ <td>
84
+ <select name="wpXSG-Frequency" id="wpXSG-Frequency" ></select>
85
+ <p>Sitemap update frequency for this category/tag.</p>
86
+ </td>
87
+ </tr>
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
+
100
+ <?php
101
+
102
+ }
103
+
104
+
105
+
106
+
107
+
108
+
109
+ }
110
+
111
+ ?>
code/categoryMetaData.php CHANGED
@@ -28,7 +28,6 @@ class categoryMetaData
28
  if ( !current_user_can( 'manage_categories') )
29
  return $term_id;
30
 
31
-
32
  $settings = new metaSettings();
33
 
34
  $settings->id = ( isset( $_POST['wpXSG-metaId'] ) ? $_POST['wpXSG-metaId'] : '0' );
@@ -38,11 +37,9 @@ class categoryMetaData
38
  $settings->priority = ( isset( $_POST['wpXSG-Priority'] ) ? $_POST['wpXSG-Priority'] : 'default' );
39
  $settings->frequency = ( isset( $_POST['wpXSG-Frequency'] ) ? $_POST['wpXSG-Frequency'] : 'default' );
40
  $settings->inherit = ( isset( $_POST['wpXSG-Inherit'] ) ? $_POST['wpXSG-Inherit'] : 0 );
41
-
42
  dataAccess::saveMetaItem($settings );
43
 
44
-
45
-
46
  }
47
 
48
 
@@ -51,9 +48,10 @@ class categoryMetaData
51
  {
52
  self::addHooks();
53
 
54
- $settings = new metaSettings(1,1,1);
 
55
 
56
- wp_nonce_field( basename( __FILE__ ), 'wpXSG_meta_nonce' );
57
  ?>
58
 
59
  <h3>Sitemap settings</h3>
@@ -85,13 +83,23 @@ class categoryMetaData
85
  <select name="wpXSG-Inherit" id="wpXSG-Inherit" ></select>
86
  <p>Immediate child posts/pages inherit these settings.</p>
87
  </div>
 
 
 
 
 
 
 
 
 
88
 
89
- <script type="text/javascript" src="<?php echo xsgPluginPath(); ?>scripts.js"></script>
90
  <script>
91
  xsg_populate("wpXSG-Exclude" ,excludeSelect, <?php echo $settings->exclude ?>);
92
  xsg_populate("wpXSG-Priority" ,prioritySelect, <?php echo $settings->priority ?>);
93
  xsg_populate("wpXSG-Frequency" ,frequencySelect, <?php echo $settings->frequency ?>);
94
  xsg_populate("wpXSG-Inherit" ,inheritSelect, <?php echo $settings->inherit ?>);
 
95
  </script>
96
 
97
  <?php
@@ -104,7 +112,7 @@ class categoryMetaData
104
  self::addHooks();
105
 
106
  $settings = dataAccess::getMetaItem($term_id , "taxonomy");
107
-
108
 
109
  wp_nonce_field( basename( __FILE__ ), 'wpXSG_meta_nonce' );
110
  ?>
@@ -130,28 +138,38 @@ class categoryMetaData
130
  <p>Relative priority for this category/tag and related posts.</p>
131
  </td>
132
  </tr>
133
- <tr class="form-field term-description-wrap">
134
  <th scope="row"><label for="description">Update frequency</label></th>
135
  <td>
136
  <select name="wpXSG-Frequency" id="wpXSG-Frequency" ></select>
137
  <p>Sitemap update frequency for this category/tag.</p>
138
  </td>
139
  </tr>
140
- <tr class="form-field term-description-wrap">
141
  <th scope="row"><label for="description">Post inheritance</label></th>
142
  <td>
143
  <select name="wpXSG-Inherit" id="wpXSG-Inherit" ></select>
144
  <p>Immediate child posts/pages inherit these settings.</p>
145
  </td>
146
  </tr>
 
 
 
 
 
 
 
 
 
147
  </tbody></table>
148
 
149
- <script type="text/javascript" src="<?php echo xsgPluginPath(); ?>scripts.js"></script>
150
  <script>
151
  xsg_populate("wpXSG-Exclude" ,excludeSelect, <?php echo $settings->exclude ?>);
152
  xsg_populate("wpXSG-Priority" ,prioritySelect, <?php echo $settings->priority ?>);
153
  xsg_populate("wpXSG-Frequency" ,frequencySelect, <?php echo $settings->frequency ?>);
154
  xsg_populate("wpXSG-Inherit" ,inheritSelect, <?php echo $settings->inherit ?>);
 
155
  </script>
156
 
157
 
@@ -159,11 +177,6 @@ class categoryMetaData
159
 
160
  }
161
 
162
-
163
-
164
-
165
-
166
-
167
  }
168
 
169
  ?>
28
  if ( !current_user_can( 'manage_categories') )
29
  return $term_id;
30
 
 
31
  $settings = new metaSettings();
32
 
33
  $settings->id = ( isset( $_POST['wpXSG-metaId'] ) ? $_POST['wpXSG-metaId'] : '0' );
37
  $settings->priority = ( isset( $_POST['wpXSG-Priority'] ) ? $_POST['wpXSG-Priority'] : 'default' );
38
  $settings->frequency = ( isset( $_POST['wpXSG-Frequency'] ) ? $_POST['wpXSG-Frequency'] : 'default' );
39
  $settings->inherit = ( isset( $_POST['wpXSG-Inherit'] ) ? $_POST['wpXSG-Inherit'] : 0 );
40
+ $settings->news = ( isset( $_POST['wpXSG-News'] ) ? $_POST['wpXSG-News'] : 0 );
41
  dataAccess::saveMetaItem($settings );
42
 
 
 
43
  }
44
 
45
 
48
  {
49
  self::addHooks();
50
 
51
+ $settings = new metaSettings(1,1,1,0);
52
+ $globalSettings = core::getGlobalSettings();
53
 
54
+ wp_nonce_field( basename( __FILE__ ), 'wpXSG_meta_nonce' );
55
  ?>
56
 
57
  <h3>Sitemap settings</h3>
83
  <select name="wpXSG-Inherit" id="wpXSG-Inherit" ></select>
84
  <p>Immediate child posts/pages inherit these settings.</p>
85
  </div>
86
+
87
+ <?php if ($globalSettings->newsMode == '2') { ?>
88
+ <div class="form-field term-description-wrap">
89
+ <label for="description">Include in news</label>
90
+ <td>
91
+ <select name="wpXSG-News" id="wpXSG-News" ></select>
92
+ <p>Include this category/tag in news feeds.</p>
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
112
  self::addHooks();
113
 
114
  $settings = dataAccess::getMetaItem($term_id , "taxonomy");
115
+ $globalSettings = core::getGlobalSettings();
116
 
117
  wp_nonce_field( basename( __FILE__ ), 'wpXSG_meta_nonce' );
118
  ?>
138
  <p>Relative priority for this category/tag and related posts.</p>
139
  </td>
140
  </tr>
141
+ <tr class="form-field">
142
  <th scope="row"><label for="description">Update frequency</label></th>
143
  <td>
144
  <select name="wpXSG-Frequency" id="wpXSG-Frequency" ></select>
145
  <p>Sitemap update frequency for this category/tag.</p>
146
  </td>
147
  </tr>
148
+ <tr class="form-field">
149
  <th scope="row"><label for="description">Post inheritance</label></th>
150
  <td>
151
  <select name="wpXSG-Inherit" id="wpXSG-Inherit" ></select>
152
  <p>Immediate child posts/pages inherit these settings.</p>
153
  </td>
154
  </tr>
155
+ <?php if ($globalSettings->newsMode == '2') { ?>
156
+ <tr class="form-field">
157
+ <th scope="row"><label for="description">Include in news</label></th>
158
+ <td>
159
+ <select name="wpXSG-News" id="wpXSG-News" ></select>
160
+ <p>Include this category/tag in news feeds.</p>
161
+ </td>
162
+ </tr>
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
 
177
 
178
  }
179
 
 
 
 
 
 
180
  }
181
 
182
  ?>
code/core.php CHANGED
@@ -2,14 +2,15 @@
2
 
3
  namespace xmlSitemapGenerator;
4
 
 
5
  include_once 'settingsModels.php';
6
  include_once 'upgrader.php';
7
 
8
- define ( "XSG_PLUGIN_VERSION" , "1.3.3");
 
 
9
  define ( "XSG_PLUGIN_NAME" , "www-xml-sitemap-generator-org");
10
- define ( "XSG_RULES_VERSION" , "0003"); // increment this if the rewrite rules ever change.
11
- define ( "XSG_RULES_OPTION_NAME" , "wpXSG_rewrite_done");
12
-
13
  // settings for general operation and rendering
14
 
15
 
@@ -25,35 +26,111 @@ class core {
25
  return XSG_PLUGIN_VERSION;
26
  }
27
 
28
-
29
-
30
- public static function activatePlugin(){
31
-
32
- self::upgradeDatabase();
 
 
 
 
 
 
 
33
 
34
- self::addRewriteHooks();
35
- self::activateRewriteRules();
36
- flush_rewrite_rules();
 
 
 
37
 
 
 
 
 
 
 
 
 
 
 
38
  add_option( "wpXSG_MapId", uniqid("",true) );
39
  update_option( "xmsg_LastPing", 0 );
40
 
41
  self::updateStatistics("Plugin","Activate", "");
 
 
 
 
 
 
42
 
43
- core::doPing();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
  }
45
 
46
  public static function deactivatePlugin() {
47
- delete_option("wpXMSG_rewrite_done");
48
  self::updateStatistics("Plugin","Deactivate","");
49
  }
50
- public static function initialisePlugin() {
51
 
52
 
53
- // NB Network activation will not upgrade a site
54
- // do upgrade will check current upgrade script version and apply as necessary
55
- upgrader::checkUpgrade();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  // 2 is required for $file to be populated
58
  add_filter('plugin_row_meta', array(__CLASS__, 'filter_plugin_row_meta'),10,2);
59
  add_action('do_robots', array(__CLASS__, 'addRobotLinks'), 100, 0);
@@ -65,18 +142,16 @@ class core {
65
  include_once 'settings.php';
66
  include_once 'postMetaData.php';
67
  include_once 'categoryMetaData.php';
 
68
 
69
  settings::addHooks();
70
  categoryMetaData::addHooks();
71
  postMetaData::addHooks();
 
72
 
73
  add_action('admin_notices', array(__CLASS__, 'showWarnings'));
74
-
75
-
76
  }
77
 
78
-
79
-
80
  if (!wp_get_schedule('xmsg_ping'))
81
  {
82
  // ping in 2 hours from when setup.
@@ -85,13 +160,32 @@ class core {
85
 
86
  add_action('xmsg_ping', array(__CLASS__, 'doPing'));
87
 
88
- // NB Network activation will not have set up the rules for the site.
89
- // Check if they exist and then reactivate.
90
- if (get_option(XSG_RULES_OPTION_NAME, null) != XSG_RULES_VERSION)
91
- {
92
- add_action('wp_loaded', array(__CLASS__, 'activateRewriteRules'), 99999, 1);
93
- }
94
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95
  }
96
 
97
  static function showWarnings()
@@ -108,13 +202,14 @@ class core {
108
 
109
  if (!get_option('permalink_structure'))
110
  {
111
- $warnings = $warnings . '<p>Permalinks are not enabled. Please check your <i><a href="options-permalink.php">Permalink Settings</a></i> are not set to <i>Plain</i>.</p>';
112
  }
113
 
114
  if ($warnings)
115
  {
116
  echo '<div id="sitemap-warnings" class="error fade"><p><strong>Problems that will prevent your sitemap working correctly :</strong></p>' . $warnings . '</div>';
117
  }
 
118
  }
119
 
120
  }
@@ -122,7 +217,7 @@ class core {
122
  static function doPing()
123
  {
124
  include_once 'pinger.php';
125
- $globalSettings = get_option( "wpXSG_global" , new globalSettings() );
126
 
127
  if ($globalSettings->pingSitemap == true)
128
  {
@@ -132,11 +227,11 @@ class core {
132
 
133
  }
134
 
135
- static function upgradeDatabase()
136
  {
137
  try
138
  {
139
- include_once 'dataAccess.php';
140
  dataAccess::createMetaTable();
141
  update_option( "wpXSG_databaseUpgraded" , 1 , false);
142
  }
@@ -145,39 +240,86 @@ class core {
145
 
146
  }
147
  }
148
- public static function addQueryVariableHooks(){
149
- add_filter('query_vars', array(__CLASS__, 'addQueryVariables'), 1, 1);
150
- add_filter('template_redirect', array(__CLASS__, 'templateRedirect'), 1, 0);
151
- }
152
- public static function addQueryVariables($vars) {
153
- array_push($vars, 'xml-sitemap');
154
- return $vars;
 
155
  }
 
 
 
156
  public static function templateRedirect() {
157
- global $wp_query;
158
- if(!empty($wp_query->query_vars["xml-sitemap"])) {
 
 
 
159
 
 
 
 
 
 
 
 
 
 
160
  $wp_query->is_404 = false;
161
  $wp_query->is_feed = false;
162
- include_once 'sitemapBuilder.php';
163
- $builder = new sitemapBuilder();
164
- $builder->render($wp_query->query_vars["xml-sitemap"]); //$wp_query->query_vars["xml-sitemap"]
 
165
  }
166
  }
 
 
 
 
 
 
 
167
 
168
- static function safeRead($object,$property)
169
- {
170
- return ( isset( $object->{$property} ) ? $object->{$property} : "" );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
171
  }
 
 
172
  public static function addRobotLinks()
173
  {
174
- $globalSettings = get_option( "wpXSG_global" , new globalSettings() );
175
  if($globalSettings->addToRobots == true)
176
  {
177
  $base = trailingslashit( get_bloginfo( 'url' ) );
178
- echo "\nSitemap: " . $base . "xmlsitemap.xml\n";
179
- echo "\nAllow: /rsssitemap.xml";
180
- echo "\nAllow: /htmlsitemap.htm";
 
 
 
181
  }
182
  echo "\n\n";
183
  echo self::safeRead($globalSettings,"robotEntries");
@@ -185,7 +327,7 @@ class core {
185
  }
186
  public static function addRssLink()
187
  {
188
- $globalSettings = get_option( "wpXSG_global" , new globalSettings() );
189
  if($globalSettings->addRssToHead == true)
190
  {
191
  $base = trailingslashit( get_bloginfo( 'url' ) );
@@ -194,42 +336,58 @@ class core {
194
  echo $link;
195
  }
196
  }
197
- public static function addRewriteHooks() {
198
- add_filter('rewrite_rules_array', array(__CLASS__, 'getRewriteRules'), 1, 1);
199
- }
200
-
201
- public static function getRewriteRules($originalRules) {
202
-
203
- $newRules = array();
204
- $newRules['xmlsitemap\.xml$'] = 'index.php?xml-sitemap=xml';
205
- $newRules['rsssitemap\.xml$'] = 'index.php?xml-sitemap=rss';
206
- $newRules['rsslatest\.xml$'] = 'index.php?xml-sitemap=rssnew';
207
- $newRules['htmlsitemap\.htm$'] = 'index.php?xml-sitemap=html';
208
- $newRules['xmlsitemap\.xsl$'] = 'index.php?xml-sitemap=xsl';
209
- return array_merge($newRules,$originalRules);
210
- }
211
-
212
 
213
- public static function activateRewriteRules() {
214
- /** @var $wp_rewrite WP_Rewrite */
215
- global $wp_rewrite;
216
- $wp_rewrite->flush_rules(false);
217
- update_option(XSG_RULES_OPTION_NAME, XSG_RULES_VERSION);
218
  }
 
 
219
 
220
  static function filter_plugin_row_meta($links, $file) {
221
  $plugin = self::pluginFilename();
222
  if ($file == $plugin)
223
  {
224
- $new_links = array(
225
- '<a href="options-general.php?page=' . XSG_PLUGIN_NAME . '">Settings</a>'
226
- );
227
-
228
- $links = array_merge( $links, $new_links );
 
 
 
229
  }
230
  return $links;
231
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
232
 
 
 
 
 
 
233
  static function getStatusHtml()
234
  {
235
  $array = get_option('xmsg_Log',"");
@@ -285,7 +443,7 @@ class core {
285
  }
286
  public static function updateStatistics($eventCategory, $eventAction, $timeBand) {
287
 
288
- $globalSettings = get_option( "wpXSG_global" , new globalSettings() );
289
 
290
  if ($globalSettings->sendStats)
291
  {
@@ -296,11 +454,12 @@ class core {
296
  'v' => 1,
297
  'tid' => 'UA-679276-7',
298
  'cid' => get_option('wpXSG_MapId'),
 
299
  't' => 'event',
300
  'ec' => $eventCategory,
301
  'ea' => $eventAction,
302
  'ev' => 1,
303
- 'cd1' => get_bloginfo( 'url' ),
304
  'cd2' => $wp_version,
305
  'cd3' => self::pluginVersion(),
306
  'cd4' => PHP_VERSION,
@@ -308,7 +467,7 @@ class core {
308
  'cd6' => $timeBand
309
  );
310
 
311
- $url = 'https://ssl.google-analytics.com/collect';
312
 
313
  try
314
  {
2
 
3
  namespace xmlSitemapGenerator;
4
 
5
+ include_once 'dataAccess.php';
6
  include_once 'settingsModels.php';
7
  include_once 'upgrader.php';
8
 
9
+
10
+
11
+ define ( "XSG_PLUGIN_VERSION" , "2.0.0");
12
  define ( "XSG_PLUGIN_NAME" , "www-xml-sitemap-generator-org");
13
+ define ( "XSG_DONATE_URL","https://XmlSitemapGenerator.org/contribute/subscribeOther.aspx?service=wordpress");
 
 
14
  // settings for general operation and rendering
15
 
16
 
26
  return XSG_PLUGIN_VERSION;
27
  }
28
 
29
+ public static function safeRead2($object, $property, $default)
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 = self::safeRead2($globalSettings,"urlXmlSitemap","xmlsitemap.xml");
44
+ $globalSettings->urlNewsSitemap = self::safeRead2($globalSettings,"urlNewsSitemap","newssitemap.xml");
45
+ $globalSettings->urlRssSitemap = self::safeRead2($globalSettings,"urlRssSitemap","rsssitemap.xml");
46
+ $globalSettings->urlRssLatest = self::safeRead2($globalSettings,"urlRssLatest","rsslatest.xml");
47
+ $globalSettings->urlHtmlSitemap = self::safeRead2($globalSettings,"urlHtmlSitemap","htmlsitemap.htm");
48
 
49
+ return $globalSettings;
50
+ }
51
+
52
+ public static function doSiteActivation()
53
+ {
54
+ self::addDatabaseTable();
55
+
56
+ self::add_rewrite_rules();
57
+ flush_rewrite_rules();
58
+
59
  add_option( "wpXSG_MapId", uniqid("",true) );
60
  update_option( "xmsg_LastPing", 0 );
61
 
62
  self::updateStatistics("Plugin","Activate", "");
63
+
64
+ }
65
+
66
+
67
+ public static function activatePlugin($network_wide){
68
+ if ( is_multisite() && $network_wide ) {
69
 
70
+ if ( false == is_super_admin() ) {
71
+ return;
72
+ }
73
+
74
+ global $wpdb;
75
+
76
+ foreach ($wpdb->get_col("SELECT blog_id FROM $wpdb->blogs") as $blog_id) {
77
+ switch_to_blog($blog_id);
78
+ self::doSiteActivation();
79
+ restore_current_blog();
80
+ }
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;
93
+ }
94
  }
95
 
96
  public static function deactivatePlugin() {
 
97
  self::updateStatistics("Plugin","Deactivate","");
98
  }
 
99
 
100
 
101
+ public static function checkUpgrade()
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
+
125
+ self::add_rewrite_rules();
126
+
127
+ add_filter('query_vars', array(__CLASS__, 'add_query_variables'), 1, 1);
128
+ add_filter('template_redirect', array(__CLASS__, 'templateRedirect'), 1, 0);
129
+
130
+ // disable wordpress sitemap
131
+ remove_action( 'init', 'wp_sitemaps_get_server' );
132
+
133
+
134
  // 2 is required for $file to be populated
135
  add_filter('plugin_row_meta', array(__CLASS__, 'filter_plugin_row_meta'),10,2);
136
  add_action('do_robots', array(__CLASS__, 'addRobotLinks'), 100, 0);
142
  include_once 'settings.php';
143
  include_once 'postMetaData.php';
144
  include_once 'categoryMetaData.php';
145
+ include_once 'authorMetaData.php';
146
 
147
  settings::addHooks();
148
  categoryMetaData::addHooks();
149
  postMetaData::addHooks();
150
+ authorMetaData::addHooks();
151
 
152
  add_action('admin_notices', array(__CLASS__, 'showWarnings'));
 
 
153
  }
154
 
 
 
155
  if (!wp_get_schedule('xmsg_ping'))
156
  {
157
  // ping in 2 hours from when setup.
160
 
161
  add_action('xmsg_ping', array(__CLASS__, 'doPing'));
162
 
163
+ }
164
+
165
+ public static function getRewriteUrl($property)
166
+ {
167
+ $url = self::getGlobalProperty($property);
168
+ $url = str_replace(".","\.",$url) . '$';
169
+ return $url;
170
+ }
171
+
172
+ public static function add_rewrite_rules()
173
+ {
174
+
175
+ add_rewrite_rule(self::getRewriteUrl("urlXmlSitemap"), 'index.php?xsg-format=xml&xsg-provider=index&xsg-type=index&xsg-page=1','top');
176
+ add_rewrite_rule(self::getRewriteUrl("urlNewsSitemap"),'index.php?xsg-format=news&xsg-provider=news&xsg-type=news&xsg-page=1','top');
177
+ add_rewrite_rule(self::getRewriteUrl("urlRssSitemap"), 'index.php?xsg-format=rss&xsg-provider=index&xsg-type=index&xsg-page=1','top');
178
+ add_rewrite_rule(self::getRewriteUrl("urlRssLatest"), 'index.php?xsg-format=rss&xsg-provider=latest&xsg-type=latest&xsg-page=1','top');
179
+ add_rewrite_rule(self::getRewriteUrl("urlHtmlSitemap"),'index.php?xsg-format=htm&xsg-provider=index&xsg-type=index&xsg-page=1','top');
180
+ 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');
181
+ }
182
+
183
+ public static function add_query_variables($vars) {
184
+ array_push($vars, 'xsg-format');
185
+ array_push($vars, 'xsg-provider');
186
+ array_push($vars, 'xsg-type');
187
+ array_push($vars, 'xsg-page');
188
+ return $vars;
189
  }
190
 
191
  static function showWarnings()
202
 
203
  if (!get_option('permalink_structure'))
204
  {
205
+ $warnings = $warnings . '<p>Permalinks are not enabled. Please check your <i><a href="options-permalink.php">Permalink Settings</a></i> are NOT set to <i>Plain</i>.</p>';
206
  }
207
 
208
  if ($warnings)
209
  {
210
  echo '<div id="sitemap-warnings" class="error fade"><p><strong>Problems that will prevent your sitemap working correctly :</strong></p>' . $warnings . '</div>';
211
  }
212
+
213
  }
214
 
215
  }
217
  static function doPing()
218
  {
219
  include_once 'pinger.php';
220
+ $globalSettings = self::getGlobalSettings();
221
 
222
  if ($globalSettings->pingSitemap == true)
223
  {
227
 
228
  }
229
 
230
+ static function addDatabaseTable()
231
  {
232
  try
233
  {
234
+
235
  dataAccess::createMetaTable();
236
  update_option( "wpXSG_databaseUpgraded" , 1 , false);
237
  }
240
 
241
  }
242
  }
243
+
244
+ private static function readQueryVar($name)
245
+ { global $wp_query;
246
+ if(!empty($wp_query->query_vars[$name]))
247
+ {
248
+ return $wp_query->query_vars[$name];
249
+ }
250
+ return null;
251
  }
252
+
253
+
254
+
255
  public static function templateRedirect() {
256
+
257
+ $format= self::readQueryVar("xsg-format");
258
+ $provider= self::readQueryVar("xsg-provider");
259
+ $type= self::readQueryVar("xsg-type");
260
+ $page= self::readQueryVar("xsg-page");
261
 
262
+ // echo var_dump($format);
263
+ // exit;
264
+
265
+ if($format !=null && $provider != null && $type !=null && $page !=null)
266
+ {
267
+
268
+ global $wp_query;
269
+ global $wp;
270
+
271
  $wp_query->is_404 = false;
272
  $wp_query->is_feed = false;
273
+
274
+ self::render($format, $provider, $type, $page);
275
+ exit;
276
+
277
  }
278
  }
279
+
280
+ public static function render($format, $provider, $type, $page)
281
+ {
282
+ $startTime = microtime(true) ;
283
+
284
+ include_once 'renderers/coreRenderer.php';
285
+ include_once 'providers/coreProvider.php';
286
 
287
+ $providerInstance = sitemapProvider::getInstance($provider);
288
+ $renderer = sitemapRenderer::getInstance($format);
289
+
290
+ if ($providerInstance == null ||$renderer == null)
291
+ {
292
+ echo 'XML Sitemap Generator Error. <br />no provider or renderer loaded';
293
+ exit;
294
+ }
295
+
296
+ $providerInstance->setFormat($format);
297
+
298
+ $urls = $providerInstance->getPage($type, $page);
299
+
300
+ if ($provider == "index")
301
+ { $renderer->renderIndex($urls);}
302
+ else
303
+ {$renderer->renderPages($urls);}
304
+
305
+ $time = core::getTimeBand($startTime);
306
+ core::updateStatistics("Render", "Render" . $format, $time);
307
+
308
  }
309
+
310
+
311
  public static function addRobotLinks()
312
  {
313
+ $globalSettings = self::getGlobalSettings();
314
  if($globalSettings->addToRobots == true)
315
  {
316
  $base = trailingslashit( get_bloginfo( 'url' ) );
317
+ echo "\nSitemap: " . $base . self::getGlobalProperty("urlXmlSitemap") . "\n";
318
+
319
+ echo "\nAllow: /" . self::getGlobalProperty("urlRssSitemap");
320
+ echo "\nAllow: /" . self::getGlobalProperty("urlRssLatest");
321
+ echo "\nAllow: /" . self::getGlobalProperty("urlHtmlSitemap");
322
+
323
  }
324
  echo "\n\n";
325
  echo self::safeRead($globalSettings,"robotEntries");
327
  }
328
  public static function addRssLink()
329
  {
330
+ $globalSettings = self::getGlobalSettings();
331
  if($globalSettings->addRssToHead == true)
332
  {
333
  $base = trailingslashit( get_bloginfo( 'url' ) );
336
  echo $link;
337
  }
338
  }
339
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
340
 
341
+ public static function getGlobalProperty($property)
342
+ {
343
+ $globalSettings = self::getGlobalSettings();
344
+ $value = self::safeRead( $globalSettings, $property);
345
+ return $value;
346
  }
347
+
348
+
349
 
350
  static function filter_plugin_row_meta($links, $file) {
351
  $plugin = self::pluginFilename();
352
  if ($file == $plugin)
353
  {
354
+ $url = $_SERVER['REQUEST_URI'];
355
+ if (strpos( $url, "network") == false) {
356
+ $new_links = array('<a href="options-general.php?page=' . XSG_PLUGIN_NAME . '">settings</a>');
357
+ $links = array_merge( $links, $new_links );
358
+ }
359
+ $new_links = array('<a href="' . XSG_DONATE_URL . '">Donate</a>');
360
+ $links = array_merge( $links, $new_links );
361
+
362
  }
363
  return $links;
364
  }
365
+
366
+ private static function getCacheFile($cacheKey)
367
+ {
368
+ $file = str_replace('code','cache', __DIR__ ) . '\\' . $cacheKey . '.json';
369
+ return $file;
370
+ }
371
+ public static function getCacheObject($cacheKey)
372
+ {
373
+ $cacheFile = self::getCacheFile($cacheKey);
374
+ $cacheDuration = time() - (60 * 5 ); // 5 minute cache
375
+ if ( file_exists($cacheFile) && (filemtime($cacheFile) > $cacheDuration) )
376
+ {
377
+ $file = file_get_contents($cacheFile);
378
+ return json_decode($file);
379
+ }
380
+ }
381
+
382
+ public static function setCacheObject($cacheKey, $object)
383
+ {
384
+ $cacheFile = self::getCacheFile($cacheKey);
385
 
386
+ file_put_contents($cacheFile , json_encode($object), LOCK_EX);
387
+
388
+ exit;
389
+ }
390
+
391
  static function getStatusHtml()
392
  {
393
  $array = get_option('xmsg_Log',"");
443
  }
444
  public static function updateStatistics($eventCategory, $eventAction, $timeBand) {
445
 
446
+ $globalSettings = self::getGlobalSettings();
447
 
448
  if ($globalSettings->sendStats)
449
  {
454
  'v' => 1,
455
  'tid' => 'UA-679276-7',
456
  'cid' => get_option('wpXSG_MapId'),
457
+ 'aip' => 1,
458
  't' => 'event',
459
  'ec' => $eventCategory,
460
  'ea' => $eventAction,
461
  'ev' => 1,
462
+ 'cd1' => site_url(),
463
  'cd2' => $wp_version,
464
  'cd3' => self::pluginVersion(),
465
  'cd4' => PHP_VERSION,
467
  'cd6' => $timeBand
468
  );
469
 
470
+ $url = 'https://www.google-analytics.com/collect';
471
 
472
  try
473
  {
code/dataAccess.php CHANGED
@@ -65,8 +65,16 @@ class dataAccess {
65
  $cmd = $wpdb->prepare($cmd, $id, $type);
66
 
67
  $settings = $wpdb->get_row($cmd);
68
-
69
- if (!$settings) {return new metaSettings(); }
 
 
 
 
 
 
 
 
70
 
71
  return $settings ;
72
  }
@@ -76,10 +84,10 @@ class dataAccess {
76
  {
77
  global $wpdb;
78
  $tablemeta = $wpdb->prefix . 'xsg_sitemap_meta';
79
- $cmd = " INSERT INTO {$tablemeta} (itemId, itemType, exclude, priority, frequency, inherit)
80
- VALUES(%d, %s, %d, %d, %d, %d)
81
  ON DUPLICATE KEY UPDATE
82
- exclude=VALUES(exclude), priority=VALUES(priority), frequency=VALUES(frequency), inherit=VALUES(inherit) ";
83
 
84
 
85
 
@@ -89,151 +97,14 @@ class dataAccess {
89
  $priority = $metaItem->priority;
90
  $frequency = $metaItem->frequency;
91
  $inherit = $metaItem->inherit;
92
-
93
- $cmd = $wpdb->prepare($cmd, $itemId, $itemType, $exclude, $priority , $frequency,$inherit);
94
 
95
- $settings = $wpdb->query($cmd);
96
-
97
- }
98
-
99
- static function getPostTypes()
100
- {
101
- $args = array(
102
- 'public' => true,
103
- '_builtin' => false
104
- );
105
-
106
- $output = 'names'; // 'names' or 'objects' (default: 'names')
107
- $operator = 'and'; // 'and' or 'or' (default: 'and')
108
-
109
- $post_types = get_post_types( $args, $output, $operator );
110
-
111
- return $post_types;
112
- }
113
-
114
- // type = "post" or "page" , date = "created" or "updated"
115
- //$limit = 0 for no limit.)
116
- public static function getPages($date , $limit)
117
- {
118
- global $wpdb;
119
- $date = self::getDateField($date);
120
- $frontPageId = get_option( 'page_on_front' );
121
-
122
- $tablemeta = $wpdb->prefix . 'xsg_sitemap_meta';
123
-
124
- $postTypes = "";
125
- foreach ( self::getPostTypes() as $post_type )
126
- {
127
- $postTypes .= " OR post_type = '{$post_type}'";
128
- }
129
-
130
-
131
- $cmd = "SELECT
132
- posts.*,
133
- postmeta.*, Tag_meta.* , UNIX_TIMESTAMP({$date}) as sitemapDate
134
- FROM {$wpdb->posts} as posts
135
- LEFT JOIN {$tablemeta} as postmeta ON posts.Id = postmeta.ItemId AND postmeta.itemId
136
- LEFT JOIN
137
- (SELECT
138
- terms.object_id as Post_id,
139
- Max(meta.exclude) as tagExclude,
140
- Max(meta.priority) as tagPriority,
141
- Max(meta.frequency) as tagFrequency
142
- FROM {$tablemeta} as meta
143
- INNER JOIN {$wpdb->term_relationships} as terms
144
- ON meta.itemId = terms.term_taxonomy_id
145
- WHERE meta.itemType = 'taxonomy' AND meta.inherit = 1
146
-
147
- GROUP BY terms.object_id
148
- ) as Tag_meta
149
- ON posts.Id = Tag_meta.Post_id
150
- WHERE post_status = 'publish' AND (post_type = 'page' OR post_type = 'post' {$postTypes})
151
- AND posts.post_password = '' AND posts.ID <> {$frontPageId}
152
- ORDER BY {$date} DESC ";
153
-
154
-
155
- if ($limit > 0 )
156
- {
157
- $cmd .= " LIMIT {$limit} " ;
158
- }
159
-
160
-
161
- $results = self::execute($cmd);
162
 
163
- return $results;
164
- }
165
-
166
- private static function getTaxonomyTypes()
167
- {
168
- $taxonomies = get_taxonomies(array( "public" => "1", "show_ui" =>"1" ), 'names' ,'and');
169
- $taxonomies = "'" . implode("','", $taxonomies) . "'";
170
- return $taxonomies;
171
- }
172
-
173
- public static function getTaxonomy($date = "updated"){
174
-
175
- global $wpdb;
176
- $taxonomies = self::getTaxonomyTypes();
177
- $date = self::getDateField($date);
178
- $tablemeta = $wpdb->prefix . 'xsg_sitemap_meta';
179
- $cmd = "SELECT terms.term_id, terms.name, terms.slug, terms.term_group,
180
- tax.term_taxonomy_id, tax.taxonomy, tax.description, tax.description,
181
- meta.exclude, meta.priority, meta.frequency,
182
- UNIX_TIMESTAMP(Max(posts.{$date})) as sitemapDate, Count(posts.ID) as posts
183
-
184
- FROM {$wpdb->terms} as terms
185
- INNER JOIN {$wpdb->term_relationships} as Relationships ON terms.Term_id = Relationships.term_taxonomy_id
186
- INNER JOIN {$wpdb->posts} as posts ON Relationships.object_id = posts.Id
187
- AND posts.post_status = 'publish' AND posts.post_password = ''
188
- INNER JOIN {$wpdb->term_taxonomy} as tax ON terms.term_id = tax.term_id
189
- LEFT JOIN {$tablemeta} as meta ON terms.term_Id = meta.ItemId
190
- WHERE tax.taxonomy IN ({$taxonomies})
191
- GROUP BY terms.term_id, terms.name, terms.slug, terms.term_group, tax.description, tax.term_taxonomy_id, tax.taxonomy, tax.description, meta.exclude, meta.priority, meta.frequency";
192
-
193
- $results = self::execute($cmd);
194
-
195
- return $results;
196
-
197
- }
198
-
199
- public static function getAuthors($date = "updated") {
200
-
201
- global $wpdb;
202
- $date = self::getDateField($date);
203
- $tablemeta = $wpdb->prefix . 'xsg_sitemap_meta';
204
 
205
- $cmd = "SELECT users.ID, users.user_nicename, users.user_login, users.display_name ,
206
- UNIX_TIMESTAMP(MAX(posts.{$date})) AS sitemapDate, Count(posts.ID) as posts
207
- FROM {$wpdb->users} users LEFT JOIN {$wpdb->posts} as posts ON users.Id = posts.post_author
208
- AND posts.post_type = 'post' AND posts.post_status = 'publish' AND posts.post_password = ''
209
- GROUP BY users.user_nicename, users.user_login, users.display_name ";
210
-
211
- $results = self::execute($cmd);
212
-
213
- return $results;
214
-
215
  }
216
-
217
-
218
-
219
- public static function getArchives($date = "updated"){
220
-
221
- global $wpdb;
222
-
223
- $date = self::getDateField($date);
224
-
225
- $cmd = "SELECT DISTINCT YEAR(post_date) AS year,MONTH(post_date) AS month,
226
- UNIX_TIMESTAMP(MAX(posts.{$date})) AS sitemapDate, Count(posts.ID) as posts
227
- FROM {$wpdb->posts} as posts
228
- WHERE post_status = 'publish' AND post_type = 'post' AND posts.post_password = ''
229
- GROUP BY YEAR(post_date), MONTH(post_date)";
230
-
231
 
232
- $results = self::execute($cmd);
233
-
234
- return $results;
235
-
236
- }
237
 
238
 
239
  public static function getLastModified($date = "updated")
65
  $cmd = $wpdb->prepare($cmd, $id, $type);
66
 
67
  $settings = $wpdb->get_row($cmd);
68
+
69
+ if ($settings)
70
+ {
71
+ $settings->news = core::safeRead2($settings, "news",0); // for older version that didnt have this property.
72
+ }
73
+ else
74
+ {
75
+ return new metaSettings();
76
+
77
+ }
78
 
79
  return $settings ;
80
  }
84
  {
85
  global $wpdb;
86
  $tablemeta = $wpdb->prefix . 'xsg_sitemap_meta';
87
+ $cmd = " INSERT INTO {$tablemeta} (itemId, itemType, exclude, priority, frequency, inherit, news)
88
+ VALUES(%d, %s, %d, %d, %d, %d, %d)
89
  ON DUPLICATE KEY UPDATE
90
+ exclude=VALUES(exclude), priority=VALUES(priority), frequency=VALUES(frequency), inherit=VALUES(inherit), news=VALUES(news) ";
91
 
92
 
93
 
97
  $priority = $metaItem->priority;
98
  $frequency = $metaItem->frequency;
99
  $inherit = $metaItem->inherit;
100
+ $news = $metaItem->news;
 
101
 
102
+ $cmd = $wpdb->prepare($cmd, $itemId, $itemType, $exclude, $priority , $frequency,$inherit, $news);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
103
 
104
+ $settings = $wpdb->query($cmd);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
105
 
 
 
 
 
 
 
 
 
 
 
106
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107
 
 
 
 
 
 
108
 
109
 
110
  public static function getLastModified($date = "updated")
code/postMetaData.php CHANGED
@@ -86,7 +86,7 @@ class postMetaData
86
 
87
 
88
 
89
- <script type="text/javascript" src="<?php echo xsgPluginPath(); ?>scripts.js"></script>
90
  <script>
91
  xsg_populate("wpXSG-Exclude" ,excludeSelect, <?php echo $settings->exclude ?>);
92
  xsg_populate("wpXSG-Priority" ,prioritySelect, <?php echo $settings->priority ?>);
86
 
87
 
88
 
89
+ <script type="text/javascript" src="<?php echo xsgPluginPath(); ?>assets/scripts.js"></script>
90
  <script>
91
  xsg_populate("wpXSG-Exclude" ,excludeSelect, <?php echo $settings->exclude ?>);
92
  xsg_populate("wpXSG-Priority" ,prioritySelect, <?php echo $settings->priority ?>);
code/providers/ZZZ__postsProvider.php ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 ADDED
@@ -0,0 +1,130 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace xmlSitemapGenerator;
4
+
5
+ class archiveProvider extends providerCore implements iSitemapProvider
6
+ {
7
+
8
+ public $maxPageSize = -1;
9
+
10
+ public function getSuppportedTypes()
11
+ {
12
+ $types = array( "archive");
13
+
14
+ return $types;
15
+ }
16
+
17
+ public function getPageCount($type)
18
+ {
19
+ return 1;
20
+
21
+ }
22
+
23
+ public function getPage($type,$page)
24
+ {
25
+
26
+ global $wpdb;
27
+
28
+ $date = self::getDateField($this->sitemapDefaults->dateField);
29
+
30
+ $sql = "SELECT DISTINCT YEAR(post_date) AS year,MONTH(post_date) AS month,
31
+ UNIX_TIMESTAMP(MAX(posts.{$date})) AS sitemapDate, Count(posts.ID) as posts
32
+ FROM {$wpdb->posts} as posts
33
+ WHERE post_status = 'publish' AND post_type = 'post' AND posts.post_password = ''
34
+ GROUP BY YEAR(post_date), MONTH(post_date)
35
+ ORDER BY YEAR(post_date) ,MONTH(post_date)";
36
+
37
+
38
+ $cmd = $wpdb->prepare($sql, $frontPageId, $type , $offset , $this->maxPageSize) ;
39
+
40
+ $results = $wpdb->get_results($cmd);
41
+ if ($results )
42
+ {
43
+ $this->doPopulate($results);
44
+ }
45
+ return $this->urlsList;
46
+
47
+ }
48
+
49
+ private function doPopulate($results)
50
+ {
51
+
52
+ foreach( $results as $result ) {
53
+
54
+ $now = getdate();
55
+
56
+ if($result->month == date("n") && $result->year == date("Y"))
57
+ {
58
+ $defaults = $this->sitemapDefaults->recentArchive;
59
+ }
60
+ else
61
+ {
62
+ $defaults = $this->sitemapDefaults->oldArchive;
63
+ }
64
+
65
+ $exlcude = $defaults->exclude ;
66
+ $posts = $result->posts;
67
+
68
+ $pageUrl = get_month_link( $result->year , $result->month) ;
69
+
70
+
71
+ if ($exlcude != 2)
72
+ {
73
+
74
+ if ($this->isIncluded($pageUrl,$this->sitemapDefaults->excludeRules ))
75
+ {
76
+
77
+ $url = new mapItem();
78
+ $url->location = $pageUrl;
79
+ $url->title = date('F', strtotime("2012-$result->month-01")) . " | " . $result->year ;
80
+ $url->description = "";
81
+ $url->modified = $result->sitemapDate ;
82
+ $url->priority = $defaults->priority ;
83
+ $url->frequency = $defaults->frequency ;
84
+
85
+ $this->addUrls($result->posts, $url);
86
+
87
+ }
88
+ }
89
+
90
+ }
91
+ }
92
+
93
+ }
94
+
95
+
96
+
97
+
98
+ ?>
code/providers/authorsProvider.php ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace xmlSitemapGenerator;
4
+
5
+ class authorsProvider extends providerCore implements iSitemapProvider
6
+ {
7
+
8
+ public $maxPageSize = -1;
9
+
10
+ public function getSuppportedTypes()
11
+ {
12
+ $types = array( "authors");
13
+
14
+ return $types;
15
+ }
16
+
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);
29
+
30
+ $sql = "SELECT users.ID, users.user_nicename, users.user_login, users.display_name ,meta.exclude, meta.priority, meta.frequency,
31
+ UNIX_TIMESTAMP(MAX(posts.{$date})) AS sitemapDate, Count(posts.ID) as posts
32
+ FROM {$wpdb->users} users LEFT JOIN {$wpdb->posts} as posts ON users.Id = posts.post_author
33
+ AND posts.post_type = 'post' AND posts.post_status = 'publish' AND posts.post_password = ''
34
+ LEFT JOIN {$this->tablemeta} as meta ON users.ID = meta.ItemId AND meta.itemType = 'author'
35
+ GROUP BY users.ID, users.user_nicename, users.user_login, users.display_name, meta.exclude, meta.priority, meta.frequency
36
+ ORDER BY users.ID";
37
+
38
+
39
+ $cmd = $wpdb->prepare($sql, $frontPageId, $type , $offset , $this->maxPageSize) ;
40
+
41
+ $results = $wpdb->get_results($cmd);
42
+ if ($results )
43
+ {
44
+ $this->doPopulate($results);
45
+ }
46
+ return $this->urlsList;
47
+
48
+ }
49
+
50
+ private function doPopulate($results)
51
+ {
52
+ foreach( $results as $result ) {
53
+
54
+ // wp_cache_add($result ->ID, $result , 'posts');
55
+
56
+ $defaults = $this->sitemapDefaults->authors;
57
+
58
+ $exlcude = $this->getMetaValue(null, $result->exclude, $defaults->exclude) ;
59
+
60
+ if ($exlcude != 2)
61
+ {
62
+ $pageUrl = get_author_posts_url($result->ID, $result->user_nicename);
63
+
64
+ if ($this->isIncluded($pageUrl,$this->sitemapDefaults->excludeRules ))
65
+ {
66
+
67
+ $url = new mapItem();
68
+ $url->location = $pageUrl;
69
+ $url->title = $result->display_name ;
70
+ $url->description = "";
71
+ $url->modified = $result->sitemapDate ;
72
+ $url->priority = $this->getMetaValue(null,$result->priority,$defaults->priority) ;
73
+ $url->frequency = $this->getMetaValue(null,$result->frequency,$defaults->frequency) ;
74
+
75
+ $this->addUrls($result->posts, $url);
76
+ }
77
+ }
78
+ }
79
+ }
80
+
81
+ }
82
+
83
+
84
+
85
+
86
+ ?>
code/providers/coreProvider.php ADDED
@@ -0,0 +1,305 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace xmlSitemapGenerator;
4
+
5
+ class mapItem
6
+ {
7
+ function __construct() {}
8
+ public $location ;
9
+ public $title ;
10
+ public $description ;
11
+ public $modified = null ;
12
+ public $priority ;
13
+ public $frequency ;
14
+ public $images = null;
15
+ }
16
+
17
+ class mediaItem
18
+ {
19
+ function __construct() {}
20
+ public $location ;
21
+ public $title ;
22
+ public $caption ;
23
+ public $description ;
24
+
25
+ }
26
+
27
+ interface iSitemapProvider
28
+ {
29
+
30
+ public function getSuppportedTypes(); // returns a list of the types supported by this provider
31
+ public function setFormat($format); // sets the base file url for the sitemap
32
+ public function getPageCount($type); // returns the number of sitemap pages for this type.
33
+ public function getPage($type, $page); //
34
+ }
35
+
36
+ class sitemapProvider
37
+ {
38
+
39
+ // returns a list of the core provider types
40
+ static function getProviderList()
41
+ {
42
+ return array( "posts", "terms", "archive", "authors");
43
+ }
44
+
45
+ // creates an instance of the correct provider for the given type
46
+ static function getInstance($type)
47
+ {
48
+ $file = $type . 'Provider.php';
49
+ if (@include_once($file))
50
+ {
51
+ $class = '\\xmlSitemapGenerator\\' . $type . 'Provider';
52
+ return new $class();
53
+ }
54
+ else
55
+ {
56
+ echo 'XML Sitemap Generator Error. <br />Invalid Renderer type specified : ' . $type;
57
+ exit;
58
+ }
59
+ }
60
+ }
61
+
62
+ class providerCore
63
+ {
64
+
65
+
66
+ protected $urlsList = array();
67
+ protected $blogPageSize ;
68
+ protected $isExecuting = false;
69
+ protected $siteName = "";
70
+ protected $blogUrl = "";
71
+ protected $instance;
72
+ protected $sitemapDefaults;
73
+ protected $tablemeta;
74
+ protected $format = "";
75
+ protected $globalSettings;
76
+
77
+ public function __construct() {
78
+ global $wpdb;
79
+ $this->blogPageSize = get_option('posts_per_page');
80
+ $this->urlsList = array();
81
+ $this->siteName = get_option('blogname');
82
+ $this->blogUrl = get_bloginfo( 'url' );
83
+ $this->tablemeta = $wpdb->prefix . 'xsg_sitemap_meta';
84
+ $this->sitemapDefaults = get_option( "wpXSG_sitemapDefaults" , new sitemapDefaults() );
85
+ $this->globalSettings = core::getGlobalSettings();
86
+
87
+ }
88
+
89
+ public function setFormat($format)
90
+ {
91
+ $this->format = $format;
92
+ }
93
+
94
+ public static function renderTest($msg)
95
+ {
96
+
97
+
98
+ ob_start();
99
+ header('Content-Type: text/html; charset=utf-8');
100
+
101
+ echo var_dump($msg);
102
+
103
+ echo "\n";
104
+ ob_end_flush();
105
+ exit;
106
+ }
107
+
108
+
109
+
110
+ private function getAttribute($name, $html)
111
+ {
112
+ preg_match( '@' . $name . '="([^"]+)"@' , $html, $match );
113
+ return array_pop($match);
114
+ }
115
+
116
+
117
+ // get image from post result
118
+ protected function getImage( $result)
119
+ {
120
+ if ( !empty($result->imageUrl) )
121
+ {
122
+ $new = new mediaItem();
123
+ $new->title = $result->imageTitle;
124
+ $new->caption = $result->imageCaption;
125
+ $new->location = $result->imageUrl;
126
+ return $new;
127
+ }
128
+
129
+ }
130
+
131
+ // get images from html
132
+ protected function getImages($content)
133
+ {
134
+ preg_match_all('/<img[^>]+>/i', $content, $matches );
135
+
136
+ $images = array();
137
+ foreach($matches[0] as $match) {
138
+ $url = $this->getAttribute("src",$match);
139
+ // need to validate url is in this site.
140
+ //remove any resizing. -1024x682.
141
+
142
+
143
+ $new = new mediaItem();
144
+ $new->title = $this->getAttribute("title",$match);
145
+ $new->caption = $this->getAttribute("alt",$match);
146
+ $new->location = $url;
147
+ array_push($images, $new);
148
+
149
+ }
150
+ return $images;
151
+
152
+ }
153
+
154
+
155
+
156
+ static function getDateField($name)
157
+ {
158
+ if ($name == "created")
159
+ {
160
+ return "post_date";
161
+ }
162
+ else
163
+ {
164
+ return "post_modified";
165
+ }
166
+ }
167
+
168
+ function getPages($count, $pageSize)
169
+ {
170
+ return ceil($count / $pageSize);
171
+ }
172
+
173
+ function getBlogPageCount($results)
174
+ {
175
+ $totalPages = 0;
176
+ foreach( $results as $result )
177
+ {
178
+ $pages = 1;
179
+ $posts = $result->posts +1;
180
+ if ($posts > $this->blogPageSize)
181
+ {
182
+ $pages = ceil($posts / $this->blogPageSize);
183
+ }
184
+ $totalPages += $pages;
185
+ }
186
+ return $totalPages;
187
+ }
188
+
189
+ function isIncluded($url, $rules)
190
+ {
191
+ //todo
192
+
193
+ return true;
194
+
195
+ }
196
+ function isExcluded($value)
197
+ {
198
+ if (isset($value))
199
+ {
200
+ if (value==2) {return true;}
201
+ }
202
+ return false;
203
+ }
204
+
205
+ function getMetaValue($postValue,$tagValue,$default)
206
+ {
207
+
208
+ if (isset($postValue))
209
+ {
210
+
211
+ if ( $postValue != 1) { return $postValue; }
212
+ }
213
+
214
+ if (isset($tagValue))
215
+ {
216
+ if ( $tagValue != 1) {return $tagValue; }
217
+ }
218
+
219
+ return $default;
220
+
221
+ }
222
+
223
+ function addUrls($postCount, $mapItem)
224
+ {
225
+ $pages = 1;
226
+
227
+ if ($postCount > $this->blogPageSize)
228
+ {
229
+ $pages = ceil($postCount / $this->blogPageSize);
230
+ }
231
+
232
+
233
+ $mapItem->title = $mapItem->title;
234
+ array_push($this->urlsList, $mapItem); // first page
235
+ for ($x = 2; $x <= $pages; $x++)
236
+ {
237
+ $new = clone $mapItem;
238
+ $new->title = $new->title . " | Page " . $x;
239
+ $new->location = $this->getPageLink($mapItem->location,$x);
240
+ array_push($this->urlsList, $new);
241
+ }
242
+
243
+ }
244
+
245
+
246
+ function getPageLink($url, $pagenum = 1, $escape = true ) {
247
+ global $wp_rewrite;
248
+
249
+ $pagenum = (int) $pagenum;
250
+
251
+ $home_root = preg_quote( home_url(), '|' );
252
+ $request = $url;
253
+
254
+
255
+ $request = preg_replace('|^'. $home_root . '|i', '', $request);
256
+ $request = preg_replace('|^/+|', '', $request);
257
+
258
+
259
+ if ( !$wp_rewrite->using_permalinks() || is_admin() ) {
260
+ $base = trailingslashit( $this->$blogUrl );
261
+
262
+ if ( $pagenum > 1 ) {
263
+ $result = add_query_arg( 'paged', $pagenum, $base . $request );
264
+ } else {
265
+ $result = $base . $request;
266
+ }
267
+ } else {
268
+ $qs_regex = '|\?.*?$|';
269
+ preg_match( $qs_regex, $request, $qs_match );
270
+
271
+ if ( !empty( $qs_match[0] ) ) {
272
+ $query_string = $qs_match[0];
273
+ $request = preg_replace( $qs_regex, '', $request );
274
+ } else {
275
+ $query_string = '';
276
+ }
277
+
278
+ $request = preg_replace( "|$wp_rewrite->pagination_base/\d+/?$|", '', $request);
279
+ $request = preg_replace( '|^' . preg_quote( $wp_rewrite->index, '|' ) . '|i', '', $request);
280
+ $request = ltrim($request, '/');
281
+
282
+ $base = trailingslashit( $this->blogUrl );
283
+
284
+ if ( $wp_rewrite->using_index_permalinks() && ( $pagenum > 1 || '' != $request ) )
285
+ $base .= $wp_rewrite->index . '/';
286
+
287
+ if ( $pagenum > 1 ) {
288
+ $request = ( ( !empty( $request ) ) ? trailingslashit( $request ) : $request ) . user_trailingslashit( $wp_rewrite->pagination_base . "/" . $pagenum, 'paged' );
289
+ }
290
+
291
+ $result = $base . $request . $query_string;
292
+ }
293
+
294
+ $result = apply_filters( 'get_pagenum_link', $result );
295
+
296
+ if ( $escape )
297
+ return esc_url( $result );
298
+ else
299
+ return esc_url_raw( $result );
300
+ }
301
+
302
+ }
303
+
304
+
305
+ ?>
code/providers/indexProvider.php ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace xmlSitemapGenerator;
4
+
5
+ class indexProvider extends providerCore implements iSitemapProvider
6
+ {
7
+
8
+ public $maxPageSize = -1;
9
+
10
+ public function getSuppportedTypes()
11
+ {
12
+ $types[] = ("index");
13
+
14
+ return $types;
15
+ }
16
+
17
+
18
+
19
+ public function getPageCount($type)
20
+ {
21
+ return 1;
22
+ }
23
+
24
+
25
+ private function addRssLatest()
26
+ {
27
+ $providers = sitemapProvider::getProviderList();
28
+ $globalSettings = core::getGlobalSettings();
29
+ $url = new mapItem();
30
+ $url->location = $this->blogUrl . "/" . $globalSettings->urlRssLatest;
31
+ $url->title = "Latest posts sitemap.";
32
+ $this->addUrls(0, $url);
33
+ }
34
+ private function addNews()
35
+ {
36
+ $providers = sitemapProvider::getProviderList();
37
+ $globalSettings = core::getGlobalSettings();
38
+ $url = new mapItem();
39
+ $url->location = $this->blogUrl . "/" . $globalSettings->urlNewsSitemap;
40
+ $url->title = "News sitemap.";
41
+ $this->addUrls(0, $url);
42
+ }
43
+
44
+ public function getPage($type, $page)
45
+ {
46
+
47
+ $providers = sitemapProvider::getProviderList();
48
+ $globalSettings = core::getGlobalSettings();
49
+
50
+ if ($this->format == "xml")
51
+ {
52
+ if ($globalSettings->newsMode > 0 )
53
+ {
54
+ $this->addNews();
55
+ }
56
+ }
57
+ elseif ($this->format == "rss")
58
+ {
59
+ $this->addRssLatest();
60
+ }
61
+
62
+
63
+
64
+ foreach($providers as $providerName)
65
+ {
66
+
67
+
68
+ $provider = sitemapProvider::getInstance($providerName);
69
+ $types = $provider->getSuppportedTypes();
70
+
71
+ foreach($types as $typeName)
72
+ {
73
+ $pages = $provider->getPageCount($typeName);
74
+ $this->doPopulate($providerName, $typeName, $pages);
75
+ }
76
+
77
+ }
78
+ return $this->urlsList;
79
+ }
80
+
81
+ private function doPopulate($provider, $type, $pages)
82
+ {
83
+ $urls = array();
84
+ $blogUrl = get_bloginfo( 'url' );
85
+
86
+ $providerT = ucfirst($provider);
87
+ $typeT = ucfirst($type);
88
+
89
+ for ( $i= 1 ; $i <= $pages ; $i++)
90
+ {
91
+ $pageUrl = $blogUrl . "/sitemap-files/{$this->format}/{$provider}/{$type}/{$i}/" ;
92
+
93
+ $url = new mapItem();
94
+ $url->location = $pageUrl;
95
+
96
+
97
+
98
+ if ($provider == $type)
99
+ {$url->title = "{$providerT} sitemap. Page {$i}.";}
100
+ else
101
+ {$url->title = "{$providerT} - {$typeT} sitemap. Page {$i}.";}
102
+
103
+ $this->addUrls(0, $url);
104
+ }
105
+ }
106
+
107
+ }
108
+
109
+ ?>
code/providers/latestProvider.php ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace xmlSitemapGenerator;
4
+
5
+ class latestProvider extends providerCore implements iSitemapProvider
6
+ {
7
+
8
+
9
+ public $maxPageSize = -1;
10
+
11
+ public function getSuppportedTypes()
12
+ {
13
+ $types = array( "archive");
14
+
15
+ return $types;
16
+ }
17
+
18
+ public function getPageCount($type)
19
+ {
20
+ return 1;
21
+
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
+ $pageSize = 50;
33
+ $offset = 0;
34
+
35
+ $cmd = "SELECT posts.*, UNIX_TIMESTAMP({$date}) as sitemapDate
36
+ FROM {$wpdb->posts} as posts
37
+
38
+ WHERE (post_status = 'publish' ) AND ( post_type = 'post' {$postTypes})
39
+ AND posts.post_password = '' AND posts.ID <> {$frontPageId}
40
+ ORDER BY {$date} DESC
41
+ LIMIT {$offset}, {$pageSize} ";
42
+
43
+
44
+ $results = $wpdb->get_results($cmd);
45
+ if ($results )
46
+ {
47
+ $this->doPopulate($results);
48
+ }
49
+ return $this->urlsList;
50
+
51
+ }
52
+
53
+
54
+
55
+ private function getPostTypes()
56
+ {
57
+ $args = array(
58
+ 'public' => true,
59
+ '_builtin' => false
60
+ );
61
+
62
+ $output = 'names'; // 'names' or 'objects' (default: 'names')
63
+ $operator = 'and'; // 'and' or 'or' (default: 'and')
64
+
65
+ $post_types = get_post_types( $args, $output, $operator );
66
+
67
+ $postTypes = "";
68
+ foreach ( $post_types as $post_type )
69
+ {
70
+ $postTypes .= " OR post_type = '{$post_type}'";
71
+ }
72
+ return $postTypes;
73
+ }
74
+
75
+
76
+
77
+ private function doPopulate($results)
78
+ {
79
+ foreach( $results as $result ) {
80
+
81
+
82
+ // wp_cache_add($result ->ID, $result , 'posts');
83
+ $defaults = self::postTypeDefault($this->sitemapDefaults,$result->post_type );
84
+
85
+ // $exlcude = $this->getMetaValue($result->exclude, $result->tagExclude, $defaults->exclude) ;
86
+
87
+ // if ($exlcude == 2) {$temp = $temp . " - excluded"; continue;}
88
+ if ( $result->post_status =='future' && $defaults->scheduled == 0) { continue;}
89
+
90
+ $pageUrl = get_permalink($result);
91
+
92
+ if (!($this->isIncluded($pageUrl,$this->sitemapDefaults->excludeRules ))) {continue;}
93
+
94
+ $url = new mapItem();
95
+ $url->location = $pageUrl ;
96
+ $url->title = get_the_title( $result ); //$result->post_title;
97
+ $url->description = $result->post_excerpt;
98
+ $url->modified = $result->sitemapDate ;
99
+ // $url->priority = $this->getMetaValue($result->priority,$result->tagPriority, $defaults->priority) ;
100
+ // $url->frequency = $this->getMetaValue($result->frequency,$result->tagFrequency,$defaults->frequency) ;
101
+
102
+ $this->addUrls(0, $url);
103
+
104
+ }
105
+ }
106
+
107
+ static function postTypeDefault($sitemapDefaults,$name)
108
+ {
109
+ if ($name == 'page')
110
+ {
111
+ return $sitemapDefaults->pages;
112
+ }
113
+ elseif ($name == 'post')
114
+ {
115
+ return $sitemapDefaults->posts;
116
+ }
117
+ else
118
+ {
119
+ return ( isset( $sitemapDefaults->{$name} ) ? $sitemapDefaults->{$name} : $sitemapDefaults->posts );
120
+ }
121
+ }
122
+
123
+ }
124
+
125
+
126
+
127
+
128
+ ?>
code/providers/newsProvider.php ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace xmlSitemapGenerator;
4
+
5
+ class newsProvider extends providerCore implements iSitemapProvider
6
+ {
7
+
8
+
9
+ public $maxPageSize = -1;
10
+
11
+ public function getSuppportedTypes()
12
+ {
13
+ $types = array( "archive");
14
+
15
+ return $types;
16
+ }
17
+
18
+ public function getPageCount($type)
19
+ {
20
+ $globalSettings = core::getGlobalSettings();
21
+ if ($globalSettings->newsMode == '0')
22
+ {
23
+ return 0;
24
+ }
25
+ else
26
+ {
27
+ return 1;
28
+ }
29
+ }
30
+
31
+ public function getPage($type,$page)
32
+ {
33
+ global $wpdb;
34
+
35
+ $globalSettings = core::getGlobalSettings();
36
+ if ($globalSettings->newsMode == '0') {return;}
37
+
38
+
39
+ $cmdSelect = "SELECT posts.*, UNIX_TIMESTAMP(posts.post_date) as sitemapDate ";
40
+
41
+
42
+ $cmdFrom = " FROM {$wpdb->posts} as posts ";
43
+
44
+
45
+ $cmdWhere = " WHERE (posts.post_status = 'publish' ) AND ( posts.post_type = 'post' )
46
+ AND posts.post_date > (NOW() - INTERVAL 48 HOUR)
47
+ AND posts.post_password = ''
48
+ ";
49
+
50
+ if ($globalSettings->newsMode == '2')
51
+ {
52
+
53
+ $cmdWhere.= " AND posts.ID IN
54
+ (
55
+ SELECT object_id
56
+ FROM {$wpdb->term_relationships} as term_rel
57
+ INNER JOIN {$wpdb->terms} as terms ON term_rel.term_taxonomy_id = terms.term_id
58
+ INNER JOIN {$wpdb->term_taxonomy} as term_tax ON term_rel.term_taxonomy_id = term_tax.term_taxonomy_id
59
+ INNER JOIN {$this->tablemeta} as meta ON meta.itemId = terms.term_id AND meta.itemType = 'taxonomy'
60
+ WHERE meta.news = 1
61
+ ) ";
62
+
63
+ }
64
+
65
+ if ($this->globalSettings->enableImages)
66
+ {
67
+ $cmdSelect .= " , images.guid as imageUrl, images.post_title as imageTitle , images.post_excerpt as imageCaption, images.post_content as imageDescription";
68
+
69
+ $cmdFrom .= " LEFT JOIN {$wpdb->postmeta} as pm
70
+ ON posts.id = pm.post_id AND pm.meta_key = '_thumbnail_id'
71
+ LEFT JOIN {$wpdb->posts} as images
72
+ ON pm.meta_value = images.id ";
73
+ }
74
+
75
+
76
+ $cmd = $cmdSelect . $cmdFrom . $cmdWhere;
77
+ $cmd .= " ORDER BY posts.post_date DESC
78
+ LIMIT 1000 ";
79
+
80
+ // $cmd = $wpdb->prepare($cmd) ;
81
+
82
+ $results = $wpdb->get_results($cmd);
83
+ if ($results )
84
+ {
85
+ $this->doPopulate($results);
86
+ }
87
+
88
+ return $this->urlsList;
89
+ }
90
+
91
+ private function doPopulate($results)
92
+ {
93
+ foreach( $results as $result ) {
94
+
95
+
96
+ $pageUrl = get_permalink($result);
97
+
98
+ $url = new mapItem();
99
+ $url->location = $pageUrl ;
100
+ $url->title = $result->post_title;
101
+ $url->description = $result->post_excerpt;
102
+ $url->modified = $result->sitemapDate ;
103
+
104
+ if ($this->globalSettings->enableImages)
105
+ {
106
+ $url->images = [];
107
+
108
+ $images = $this->getImage($result);
109
+ if (!empty($images)) { array_push($url->images, $images ); }
110
+ $images = $this->getImages($result->post_content) ;
111
+ if (!empty($images)) {$url->images = array_merge($url->images, $images ); }
112
+
113
+ }
114
+
115
+ $this->addUrls(0, $url);
116
+
117
+ }
118
+ }
119
+
120
+
121
+ }
122
+
123
+
124
+
125
+
126
+ ?>
code/providers/postsProvider.php ADDED
@@ -0,0 +1,209 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace xmlSitemapGenerator;
4
+
5
+ class postsProvider extends providerCore implements iSitemapProvider
6
+ {
7
+ function __construct() {
8
+ parent::__construct();
9
+ }
10
+
11
+ public $maxPageSize = 2500;
12
+
13
+ public function getSuppportedTypes()
14
+ {
15
+ $types = array("page", "post");
16
+ $types = array_merge ($types,self::getPostTypes() );
17
+ return $types;
18
+ }
19
+
20
+ public function getPageCount($type)
21
+ {
22
+ global $wpdb;
23
+
24
+ $frontPageId = get_option( 'page_on_front' );
25
+
26
+ $sql = "SELECT Count(*)
27
+ FROM {$wpdb->posts} as posts
28
+ WHERE posts.post_password = ''
29
+ AND posts.ID <> %d
30
+ AND post_type = %s
31
+ AND (post_status = 'publish' OR post_status = 'future' ) ";
32
+
33
+ $cmd = $wpdb->prepare($sql,$frontPageId, $type ) ;
34
+ $count = $wpdb->get_var($cmd)+1;
35
+ return self::getPages($count, $this->maxPageSize);
36
+ }
37
+
38
+ public function getPage($type, $page)
39
+ {
40
+ global $wpdb;
41
+
42
+ if ($page == 1 && $type == 'page') { $this->addHomePage(); }
43
+
44
+ $date = self::getDateField($this->sitemapDefaults->dateField);
45
+ $frontPageId = get_option( 'page_on_front' );
46
+
47
+ $offset = ( $page - 1 ) * $this->maxPageSize;
48
+
49
+ $cmdSelect = "SELECT posts.*, postmeta.*, Tag_meta.* , UNIX_TIMESTAMP(posts.{$date}) as sitemapDate ";
50
+
51
+ $cmdFrom = " FROM {$wpdb->posts} as posts
52
+
53
+ LEFT JOIN {$this->tablemeta} as postmeta ON posts.Id = postmeta.ItemId AND postmeta.itemId
54
+ LEFT JOIN
55
+ (SELECT
56
+ terms.object_id as Post_id,
57
+ Max(meta.exclude) as tagExclude,
58
+ Max(meta.priority) as tagPriority,
59
+ Max(meta.frequency) as tagFrequency
60
+ FROM {$this->tablemeta} as meta
61
+ INNER JOIN {$wpdb->term_relationships} as terms
62
+ ON meta.itemId = terms.term_taxonomy_id AND meta.itemType = 'posts'
63
+ WHERE meta.itemType = 'taxonomy' AND meta.inherit = 1
64
+
65
+ GROUP BY terms.object_id
66
+ ) as Tag_meta
67
+ ON posts.Id = Tag_meta.Post_id ";
68
+
69
+ $cmdWhere = " WHERE posts.post_password = ''
70
+ AND posts.ID <> %d
71
+ AND posts.post_type = %s
72
+ AND (posts.post_status = 'publish' OR posts.post_status = 'future' )
73
+
74
+ ORDER BY ID DESC
75
+ LIMIT %d, %d ";
76
+
77
+ if ($this->globalSettings->enableImages)
78
+ {
79
+ $cmdSelect .= " , images.guid as imageUrl, images.post_title as imageTitle , images.post_excerpt as imageCaption, images.post_content as imageDescription";
80
+
81
+ $cmdFrom .= " LEFT JOIN {$wpdb->postmeta} as pm
82
+ ON posts.id = pm.post_id AND pm.meta_key = '_thumbnail_id'
83
+ LEFT JOIN {$wpdb->posts} as images
84
+ ON pm.meta_value = images.id ";
85
+ }
86
+
87
+
88
+ $cmd = $cmdSelect . $cmdFrom . $cmdWhere;
89
+
90
+ $cmd = $wpdb->prepare($cmd, $frontPageId, $type , $offset , $this->maxPageSize) ;
91
+
92
+ $results = $wpdb->get_results($cmd);
93
+
94
+ if ($results )
95
+ {
96
+ $this->doPopulate($results);
97
+ }
98
+ return $this->urlsList;
99
+
100
+ }
101
+
102
+
103
+
104
+ function addHomePage( )
105
+ {
106
+
107
+ $defaults = $this->sitemapDefaults->homepage;
108
+ $pageUrl = get_bloginfo( 'url' );
109
+
110
+ $exlcude = $defaults->exclude ;
111
+
112
+ if ($exlcude != 2)
113
+ {
114
+
115
+ if ($this->isIncluded($pageUrl,$this->sitemapDefaults->excludeRules ))
116
+ {
117
+
118
+ $url = new mapItem();
119
+ $url->location = $pageUrl;
120
+ $url->title = "Home page" ;
121
+ $url->description = get_option( 'blogdescription');;
122
+ $url->modified = dataAccess::getLastModified() ;
123
+ $url->priority = $defaults->priority ;
124
+ $url->frequency = $defaults->frequency ;
125
+
126
+ $this->addUrls(0, $url);
127
+
128
+ }
129
+ }
130
+ }
131
+
132
+
133
+
134
+
135
+ private function doPopulate($results)
136
+ {
137
+ foreach( $results as $result ) {
138
+
139
+ // wp_cache_add($result ->ID, $result , 'posts');
140
+ $defaults = self::postTypeDefault($this->sitemapDefaults,$result->post_type );
141
+ $exlcude = $this->getMetaValue($result->exclude, $result->tagExclude, $defaults->exclude) ;
142
+
143
+ if ($exlcude == 2) {$temp = $temp . " - excluded"; continue;}
144
+ if ( $result->post_status =='future' && $defaults->scheduled == 0) { continue;}
145
+ // if (!($this->isIncluded($pageUrl,$this->sitemapDefaults->excludeRules ))) {continue;}
146
+
147
+ $pageUrl = get_permalink($result);
148
+
149
+ $url = new mapItem();
150
+ $url->location = $pageUrl ;
151
+ $url->title = get_the_title( $result ); //$result->post_title;
152
+ $url->description = $result->post_excerpt;
153
+ $url->modified = $result->sitemapDate ;
154
+ $url->priority = $this->getMetaValue($result->priority,$result->tagPriority, $defaults->priority) ;
155
+ $url->frequency = $this->getMetaValue($result->frequency,$result->tagFrequency,$defaults->frequency) ;
156
+
157
+
158
+ if ($this->globalSettings->enableImages)
159
+ {
160
+ $url->images = [];
161
+
162
+ $images = $this->getImage($result);
163
+ if (!empty($images)) { array_push($url->images, $images ); }
164
+ $images = $this->getImages($result->post_content) ;
165
+ if (!empty($images)) {$url->images = array_merge($url->images, $images ); }
166
+
167
+ }
168
+ $this->addUrls(0, $url);
169
+
170
+ }
171
+ }
172
+
173
+ private static function postTypeDefault($sitemapDefaults,$name)
174
+ {
175
+ if ($name == 'page')
176
+ {
177
+ return $sitemapDefaults->pages;
178
+ }
179
+ elseif ($name == 'post')
180
+ {
181
+ return $sitemapDefaults->posts;
182
+ }
183
+ else
184
+ {
185
+ return ( isset( $sitemapDefaults->{$name} ) ? $sitemapDefaults->{$name} : $sitemapDefaults->posts );
186
+ }
187
+ }
188
+
189
+ private static function getPostTypes()
190
+ {
191
+ $args = array(
192
+ 'public' => true,
193
+ '_builtin' => false
194
+ );
195
+
196
+ $output = 'names'; // 'names' or 'objects' (default: 'names')
197
+ $operator = 'and'; // 'and' or 'or' (default: 'and')
198
+
199
+ $post_types = get_post_types( $args, $output, $operator );
200
+
201
+ return $post_types;
202
+ }
203
+
204
+ }
205
+
206
+
207
+
208
+
209
+ ?>
code/providers/termsProvider.php ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace xmlSitemapGenerator;
4
+
5
+ class termsProvider extends providerCore implements iSitemapProvider
6
+ {
7
+
8
+
9
+ public $maxPageSize = 10000;
10
+
11
+ public function getSuppportedTypes()
12
+ {
13
+ $types = get_taxonomies(array( "public" => "1", "show_ui" =>"1" ), 'names' ,'and');
14
+
15
+ return $types;
16
+ }
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
24
+ INNER JOIN {$wpdb->term_taxonomy} as tax ON terms.term_id = tax.term_id
25
+ WHERE tax.taxonomy = %s";
26
+
27
+ $cmd = $wpdb->prepare($sql, $type ) ;
28
+
29
+ return self::getPages($wpdb->get_var($cmd),$this->maxPageSize);
30
+ }
31
+
32
+ public function getPage($type, $page)
33
+ {
34
+ global $wpdb;
35
+
36
+ if ($page == 1 && $type == 'page') { $this->addHomePage(); }
37
+
38
+ $date = self::getDateField($this->sitemapDefaults->dateField);
39
+
40
+ $offset = ( $page - 1 ) * $this->maxPageSize;
41
+
42
+ $sql = "SELECT terms.term_id, terms.name, terms.slug, terms.term_group,
43
+ tax.term_taxonomy_id, tax.taxonomy, tax.description, tax.description,
44
+ meta.exclude, meta.priority, meta.frequency,
45
+ UNIX_TIMESTAMP(Max(posts.{$date})) as sitemapDate, Count(posts.ID) as posts
46
+
47
+ FROM {$wpdb->terms} as terms
48
+ INNER JOIN {$wpdb->term_relationships} as Relationships ON terms.Term_id = Relationships.term_taxonomy_id
49
+ INNER JOIN {$wpdb->posts} as posts ON Relationships.object_id = posts.Id
50
+ AND posts.post_status = 'publish' AND posts.post_password = ''
51
+ INNER JOIN {$wpdb->term_taxonomy} as tax ON terms.term_id = tax.term_id
52
+ LEFT JOIN {$this->tablemeta} as meta ON terms.term_Id = meta.ItemId AND meta.itemType = 'taxonomy'
53
+ WHERE tax.taxonomy = %s
54
+ GROUP BY terms.term_id, terms.name, terms.slug, terms.term_group, tax.description, tax.term_taxonomy_id, tax.taxonomy, tax.description, meta.exclude, meta.priority, meta.frequency
55
+ ORDER BY terms.term_id
56
+ LIMIT %d, %d ";
57
+
58
+ $cmd = $wpdb->prepare($sql, $type , $offset , $this->maxPageSize) ;
59
+
60
+ $results = $wpdb->get_results($cmd);
61
+ if ($results )
62
+ {
63
+ $this->doPopulate($results);
64
+ }
65
+ return $this->urlsList;
66
+
67
+ }
68
+
69
+ private function doPopulate($results)
70
+ {
71
+
72
+
73
+ foreach( $results as $result ) {
74
+
75
+
76
+ // wp_cache_add($result ->ID, $result , 'posts');
77
+ if ($result->taxonomy == 'category')
78
+ {$defaults = $this->sitemapDefaults->taxonomyCategories;}
79
+ else
80
+ {$defaults = $this->sitemapDefaults->taxonomyTags;}
81
+
82
+ $exlcude = $this->getMetaValue(null, $result->exclude, $defaults->exclude) ;
83
+
84
+ if ($exlcude != 2)
85
+ {
86
+ $pageUrl = get_category_link($result);
87
+
88
+ if ($this->isIncluded($pageUrl,$this->sitemapDefaults->excludeRules ))
89
+ {
90
+
91
+ $url = new mapItem();
92
+ $url->location = $pageUrl;
93
+ $url->title = $result->name;
94
+ $url->description = $result->description;
95
+ $url->modified = $result->sitemapDate ;
96
+ $url->priority = $this->getMetaValue(null,$result->priority,$defaults->priority) ;
97
+ $url->frequency = $this->getMetaValue(null,$result->frequency,$defaults->frequency) ;
98
+
99
+ $this->addUrls($result->posts, $url);
100
+
101
+ }
102
+ }
103
+ }
104
+
105
+ }
106
+
107
+
108
+
109
+
110
+
111
+
112
+ }
113
+
114
+
115
+
116
+
117
+ ?>
code/renderers.php DELETED
@@ -1,438 +0,0 @@
1
- <?php
2
-
3
- namespace xmlSitemapGenerator;
4
-
5
- interface iSitemapRenderer
6
- {
7
- public function render($urls);
8
- }
9
-
10
- class sitemapRenderer
11
- {
12
-
13
- static function getInstance($type)
14
- {
15
- switch ($type)
16
- {
17
- case 'html':
18
- return new htmlRenderer();
19
- case 'rss':
20
- return new rssRenderer();
21
- case 'xml':
22
- return new xmlRenderer();
23
- case 'xsl':
24
- return new xslRenderer();
25
- default:
26
- return null;
27
- }
28
- }
29
- }
30
-
31
- class rssRenderer implements iSitemapRenderer
32
- {
33
-
34
- function renderItem( $url)
35
- {
36
-
37
- echo '<item>' ;
38
- echo '<guid>' . htmlspecialchars($url->location) . '</guid>';
39
- echo '<title>' . $url->title . '</title>';
40
- echo '<link>' . htmlspecialchars($url->location) . '</link>';
41
- echo '<description>' . $url->description . '</description>';
42
- echo '<pubDate>' . date(DATE_RSS, $url->modified) . '</pubDate>';
43
- echo "</item>\n" ;
44
- }
45
-
46
- function render($urls){
47
-
48
- ob_get_clean();
49
- ob_start();
50
- header('Content-Type: text/xml; charset=utf-8');
51
-
52
- echo '<?xml version="1.0" encoding="UTF-8" ?>';
53
- echo "\n";
54
- sitemapBuilder::renderComment();
55
- echo "\n";
56
- echo '<rss version="2.0">';
57
- echo "\n";
58
- echo '<channel>';
59
- echo "\n";
60
-
61
-
62
-
63
- echo '<title>' . get_option('blogname') . '</title>';
64
- echo '<link>' . get_bloginfo( 'url' ) . '</link>';
65
- echo '<description>' . get_option( 'blogdescription'). '</description>';
66
-
67
- echo "\n";
68
- foreach( $urls as $url )
69
- {
70
-
71
- $this->renderItem($url);
72
- }
73
- echo "\n";
74
- echo '</channel>';
75
- echo "\n";
76
- echo '</rss>';
77
- echo "\n";
78
- sitemapBuilder::renderComment();
79
- echo "\n";
80
- ob_end_flush();
81
-
82
- }
83
-
84
-
85
- }
86
-
87
- class xmlRenderer implements iSitemapRenderer
88
- {
89
-
90
- // $writer;// = new XMLWriter();
91
-
92
- function getFrequency($value)
93
- {
94
- switch ($value) {
95
- case 0:
96
- return "";
97
- break;
98
- case 1:
99
- return "default";
100
- break;
101
- case 2:
102
- return "never";
103
- break;
104
- case 3:
105
- return "yearly";
106
- break;
107
- case 4:
108
- return "monthly";
109
- break;
110
- case 5:
111
- return "weekly";
112
- break;
113
- case 6:
114
- return "daily";
115
- break;
116
- case 7:
117
- return "hourly";
118
- break;
119
- case 8:
120
- return "always";
121
- break;
122
- default:
123
- return "xxx";
124
- }
125
- }
126
-
127
- function getPriority($value)
128
- {
129
- switch ($value) {
130
- case 0:
131
- return "";
132
- break;
133
- case 1:
134
- return "default";
135
- break;
136
- case 2:
137
- return "0.0";
138
- break;
139
- case 3:
140
- return "0.1";
141
- break;
142
- case 4:
143
- return "0.2";
144
- break;
145
- case 5:
146
- return "0.3";
147
- break;
148
- case 6:
149
- return "0.4";
150
- break;
151
- case 7:
152
- return "0.5";
153
- break;
154
- case 8:
155
- return "0.6";
156
- break;
157
- case 9:
158
- return "0.7";
159
- break;
160
- case 10:
161
- return "0.8";
162
- break;
163
- case 11:
164
- return "0.9";
165
- break;
166
- case 12:
167
- return "1.0";
168
- break;
169
- default:
170
- return "xxx";
171
- }
172
- }
173
-
174
- function renderItem( $url)
175
- {
176
-
177
- echo '<url>' ;
178
- echo '<loc>' . htmlspecialchars($url->location) . '</loc>';
179
- echo '<lastmod>' . date('Y-m-d\TH:i:s+00:00', $url->modified) . '</lastmod>';
180
-
181
- if (!$url->frequency==0) {
182
- echo '<changefreq>' . $this->getFrequency($url->frequency) . '</changefreq>';
183
- }
184
-
185
- if (!$url->priority==0) {
186
- echo "<priority>" . $this->getPriority($url->priority) . "</priority>";
187
- }
188
-
189
- echo "</url>\n" ;
190
- }
191
-
192
- function render($urls){
193
-
194
- ob_get_clean();
195
- $url = get_bloginfo( 'url' ) . '/xmlsitemap.xsl';
196
-
197
- ob_start();
198
- header('Content-Type: text/xml; charset=utf-8');
199
-
200
- echo '<?xml version="1.0" encoding="UTF-8" ?>';
201
- echo "\n";
202
- echo '<?xml-stylesheet type="text/xsl" href="' . $url . '"?>';
203
- echo "\n";
204
- sitemapBuilder::renderComment();
205
- echo "\n";
206
- echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
207
- echo "\n";
208
- foreach( $urls as $url )
209
- {
210
- $this->renderItem($url);
211
- }
212
- echo "\n";
213
- echo '</urlset>';
214
- echo "\n";
215
- sitemapBuilder::renderComment();
216
- echo "\n";
217
- ob_end_flush();
218
-
219
- }
220
-
221
-
222
- }
223
-
224
-
225
- class htmlRenderer implements iSitemapRenderer
226
- {
227
-
228
-
229
- function renderItem( $url)
230
- {
231
-
232
- echo '<li>' ;
233
- echo '<a href="' . htmlspecialchars($url->location) . '">';
234
- echo $url->title;
235
- echo '</a>';
236
- echo "</li>\n" ;
237
- }
238
-
239
- function render($urls){
240
-
241
- ob_get_clean();
242
- header('Content-Type: text/html; charset=utf-8');
243
- ob_start();
244
-
245
-
246
- self::renderHeader();
247
-
248
- echo "<ul>\n";
249
- foreach( $urls as $url )
250
- {
251
-
252
- $this->renderItem($url);
253
- }
254
- echo "</ul>\n";
255
- sitemapBuilder::renderCredit();
256
- self::renderFooter();
257
- echo "\n";
258
- sitemapBuilder::renderComment();
259
- echo "\n";
260
- ob_end_flush();
261
-
262
- }
263
-
264
- function renderHeader()
265
- {
266
- ?>
267
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
268
- <html xmlns="http://www.w3.org/1999/xhtml">
269
- <!--Created using XmlSitemapGenerator.org WordPress Plugin - Free HTML, RSS and XML sitemap generator -->
270
- <head>
271
- <title>WordPress Sitemap Generator</title>
272
- <meta id="MetaDescription" name="description" content="WordPress Sitemap created using XmlSitemapGenerator.org - the free online Google XML sitemap generator" />
273
- <meta id="MetaKeywords" name="keywords" content="XML, HTML, Sitemap Generator, Wordpress" />
274
- <meta content="Xml Sitemap Generator .org" name="Author" />
275
- <style>
276
- body, head, #xsg {margin:0px 0px 0px 0px; line-height:22px; color:#666666; width:100%; padding:0px 0px 0px 0px;
277
- font-family : Tahoma, Verdana, Arial, sans-serif; font-size:13px;}
278
-
279
- #xsg ul li a {font-weight:bold; }
280
- #xsg ul ul li a {font-weight:normal; }
281
- #xsg a {text-decoration:none; }
282
- #xsg p {margin:10px 0px 10px 0px;}
283
- #xsg ul {list-style:square; }
284
- #xsg li {}
285
- #xsg th { text-align:left;font-size: 0.9em;padding:2px 10px 2px 2px; border-bottom:1px solid #CCCCCC; border-collapse:collapse;}
286
- #xsg td { text-align:left;font-size: 0.9em; padding:2px 10px 2px 2px; border-bottom:1px solid #CCCCCC; border-collapse:collapse;}
287
-
288
- #xsg .title {font-size: 0.9em; color:#132687; display:inline;}
289
- #xsg .url {font-size: 0.7em; color:#999999;}
290
-
291
- #xsgHeader { width:100%; float:left; margin:0px 0px 5px 0px; border-bottom:2px solid #132687; }
292
- #xsgHeader h1 { padding:0px 0px 0px 20px ; float:left;}
293
- #xsgHeader h1 a {color:#132687; font-size:14px; text-decoration:none;cursor:default;}
294
- #xsgBody {padding:10px;float:left;}
295
- #xsgFooter { color:#999999; width:100%; float:left; margin:20px 0px 15px 0px; border-top:1px solid #999999;padding: 10px 0px 10px 0px; }
296
- #xsgFooter a {color:#999999; font-size:11px; text-decoration:none; }
297
- #xsgFooter span {color:#999999; font-size:11px; text-decoration:none; margin-left:20px; }
298
- </style>
299
- </head>
300
- <body>
301
- <div id="xsg">
302
- <div id="xsgHeader">
303
- <h1><a href="#" title="Wordpress">Wordpress Sitemap</a></h1>
304
- </div>
305
- <div id="xsgBody">
306
-
307
- <?php
308
- }
309
-
310
-
311
- static function renderFooter()
312
- {
313
- ?>
314
-
315
- </div>
316
-
317
-
318
-
319
- </body>
320
- </html>
321
-
322
- <?php
323
- }
324
-
325
- }
326
-
327
- class xslRenderer implements iSitemapRenderer
328
- {
329
- public function render($urls){
330
-
331
- ob_get_clean();
332
- header('Content-Type: text/xsl; charset=utf-8');
333
- ob_start();
334
-
335
-
336
- self::output();
337
-
338
-
339
-
340
- echo "\n";
341
- ob_end_flush();
342
-
343
- }
344
-
345
- function output()
346
- {
347
- echo '<?xml version="1.0" encoding="UTF-8"?>';
348
- ?>
349
- <xsl:stylesheet version="1.0" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:sitemap="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
350
- <xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes" />
351
-
352
- <xsl:template match="/">
353
- <html xmlns="http://www.w3.org/1999/xhtml">
354
- <head>
355
- <title>Wordpress XML Sitemap Generator Plugin</title>
356
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
357
- <meta name="robots" content="index,follow" />
358
- <style type="text/css">
359
- body {font-family:Tahoma, Verdana, Arial, sans-serif;font-size:12px; }
360
- #header { padding:0px; margin-top:10px; margin-bottom:20px;}
361
- a {text-decoration:none; color:blue;}
362
- table {margin-bottom:50px;}
363
- tr:nth-child(odd) { background-color:#eeeeee; }
364
- th {font-size:12px; padding:5px;text-align:left; vertical-align:bottom;}
365
- td {font-size:12px; padding:5px; }
366
- </style>
367
- </head>
368
- <body>
369
- <xsl:apply-templates></xsl:apply-templates>
370
- </body>
371
- </html>
372
- </xsl:template>
373
-
374
-
375
- <xsl:template match="sitemap:urlset">
376
- <h1>Wordpress XML Sitemap</h1>
377
-
378
- <div id="header">
379
- <p>
380
- This is an XML Sitemap comaptible with major search engines such as Google, Bing, Baidu and Yandex.<br />
381
- For more information and support go to <a href="https://xmlsitemapgenerator.org/wordpress-sitemap-generator-plugin.aspx">Wordpress Sitemap Generator Plugin</a> homepage. <br />
382
- You can find more information about XML sitemaps on <a href="http://sitemaps.org">sitemaps.org</a>
383
- </p>
384
- </div>
385
-
386
-
387
-
388
- <table cellspacing="0">
389
- <tr>
390
- <th>Page url</th>
391
- <th style="width:80px;">Relative<br />priority</th>
392
- <th style="width:80px;">Change<br />frequency</th>
393
- <th style="width:130px;">Modified<br />date</th>
394
- </tr>
395
- <xsl:variable name="lower" select="'abcdefghijklmnopqrstuvwxyz'"/>
396
- <xsl:variable name="upper" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
397
- <xsl:for-each select="./sitemap:url">
398
- <tr>
399
- <xsl:if test="position() mod 2 != 1">
400
- <xsl:attribute name="class">high</xsl:attribute>
401
- </xsl:if>
402
- <td>
403
- <xsl:variable name="page">
404
- <xsl:value-of select="sitemap:loc"/>
405
- </xsl:variable>
406
- <a target="_blank" href="{$page}">
407
- <xsl:value-of select="sitemap:loc"/>
408
- </a>
409
- </td>
410
- <td>
411
- <xsl:value-of select="sitemap:priority"/>
412
- </td>
413
- <td>
414
- <xsl:value-of select="sitemap:changefreq"/>
415
- </td>
416
- <td>
417
- <xsl:value-of select="sitemap:lastmod"/>
418
- </td>
419
- </tr>
420
- </xsl:for-each>
421
- </table>
422
-
423
- <?php sitemapBuilder::renderCredit(); ?>
424
-
425
- </xsl:template>
426
-
427
-
428
-
429
- </xsl:stylesheet>
430
-
431
- <?php
432
- }
433
-
434
- }
435
-
436
-
437
-
438
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
code/renderers/coreRenderer.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace xmlSitemapGenerator;
4
+
5
+ interface iSitemapRenderer
6
+ {
7
+ public function renderIndex($page);
8
+ public function renderPages($urls);
9
+ }
10
+
11
+ class sitemapRenderer
12
+ {
13
+
14
+ static function getInstance($type)
15
+ {
16
+ $file = $type . 'Renderer.php';
17
+ if (@include_once($file))
18
+ {
19
+ $class = '\\xmlSitemapGenerator\\' . $type . 'Renderer';
20
+ return new $class();
21
+ }
22
+ else
23
+ {
24
+ echo 'XML Sitemap Generator Error. <br />Invalid Renderer type specified : ' . $type;
25
+ exit;
26
+ }
27
+ }
28
+
29
+ }
30
+
31
+ class rendererCore
32
+ {
33
+ public static function renderComment()
34
+ {
35
+ echo "<!-- Created using XmlSitemapGenerator.org WordPress Plugin - Free HTML, RSS and XML sitemap generator -->";
36
+ }
37
+
38
+ }
39
+
40
+
41
+ ?>
code/renderers/htmRenderer.php ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace xmlSitemapGenerator;
4
+
5
+
6
+
7
+ class htmRenderer extends rendererCore implements iSitemapRenderer
8
+ {
9
+
10
+
11
+ private function renderItem( $url)
12
+ {
13
+
14
+ echo '<li>' ;
15
+ echo '<a href="' . htmlspecialchars($url->location) . '">';
16
+ echo $url->title;
17
+ echo '</a>';
18
+ echo "</li>\n" ;
19
+ }
20
+
21
+ public function renderIndex($urls)
22
+ {
23
+ $this->doRender("Wordpress HTML Sitemap Index", $urls);
24
+ }
25
+ public function renderPages($urls)
26
+ {
27
+ $this->doRender("Wordpress HTML Sitemap", $urls);
28
+ }
29
+ public function doRender($title, $urls){
30
+
31
+ ob_get_clean();
32
+ header('Content-Type: text/html; charset=utf-8');
33
+ ob_start();
34
+
35
+ $this->renderComment();
36
+
37
+ $this->renderHeader($title);
38
+
39
+ echo "<ul>\n";
40
+ foreach( $urls as $url )
41
+ {
42
+
43
+ $this->renderItem($url);
44
+ }
45
+ echo "</ul>\n";
46
+
47
+
48
+ $this->renderFooter();
49
+
50
+ $this->renderComment();
51
+
52
+ echo "\n";
53
+
54
+ ob_end_flush();
55
+
56
+ }
57
+
58
+ function renderHeader($title)
59
+ {
60
+ ?>
61
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
62
+ <html xmlns="http://www.w3.org/1999/xhtml">
63
+ <!--Created using XmlSitemapGenerator.org WordPress Plugin - Free HTML, RSS and XML sitemap generator -->
64
+ <head>
65
+ <title>WordPress Sitemap Generator</title>
66
+ <meta id="MetaDescription" name="description" content="WordPress Sitemap created using XmlSitemapGenerator.org - the free online Google XML sitemap generator" />
67
+ <meta id="MetaKeywords" name="keywords" content="XML, HTML, Sitemap Generator, Wordpress" />
68
+ <meta content="Xml Sitemap Generator .org" name="Author" />
69
+ <style>
70
+ body {font-family:Tahoma, Verdana, Arial, sans-serif;font-size:1.0em; line-height:2em;}
71
+ #header { padding:0px; margin-top:10px; margin-bottom:20px;}
72
+ a {text-decoration:none; color:blue;}
73
+
74
+ </style>
75
+ </head>
76
+ <body>
77
+
78
+ <h1><?php echo $title ?></h1>
79
+
80
+ <div id="header">
81
+ <p>
82
+ This is an HTML Sitemap which helps search engines find all your pages.<br />
83
+ This is useful for search engines and spiders that do not support the XML Sitemap format.<br />
84
+ For more information and support go to <a href="https://xmlsitemapgenerator.org/wordpress-sitemap-generator-plugin.aspx"
85
+ title="WordPress XML Sitemap Generator Plugin" target="_blank" >Wordpress Sitemap Generator Plugin</a> homepage. <br />
86
+ </p>
87
+ </div>
88
+
89
+
90
+ <?php
91
+ }
92
+ static function renderFooter()
93
+ {
94
+ ?>
95
+
96
+
97
+ <div id="xsgFooter">Generated by XmlSitemapGenerator.org -
98
+ <a href="https://xmlsitemapgenerator.org/wordpress-sitemap-generator-plugin.aspx"
99
+ target="_blank" title="WordPress XML Sitemap Generator Plugin">
100
+ WordPress XML Sitemap Generator Plugin</a>
101
+ </div>
102
+
103
+
104
+
105
+ </body>
106
+ </html>
107
+
108
+ <?php
109
+ }
110
+
111
+ }
112
+
113
+
114
+
115
+ ?>
code/renderers/newsRenderer.php ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace xmlSitemapGenerator;
4
+
5
+
6
+ class newsRenderer extends rendererCore implements iSitemapRenderer
7
+ {
8
+
9
+ private function renderImages($images)
10
+ {
11
+ foreach( $images as $image )
12
+ {
13
+ echo '<image:image>' ;
14
+ echo '<image:loc>' . $image->location . '</image:loc>';
15
+ echo '<image:caption>' . $image->caption . '</image:caption>';
16
+ echo '<image:title>' . $image->title . '</image:title>';
17
+
18
+
19
+ echo "</image:image>\n" ;
20
+ }
21
+ }
22
+
23
+ private function renderItem($siteName, $url)
24
+ {
25
+
26
+ echo '<url>' ;
27
+ echo '<loc>' . htmlspecialchars($url->location) . '</loc>';
28
+ echo '<news:publication>';
29
+ echo '<news:name>' . $siteName . '</news:name>';
30
+ echo '</news:publication>';
31
+ echo '<news:news>';
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
+ }
39
+
40
+
41
+ public function renderIndex($urls)
42
+ {
43
+ return ;
44
+
45
+ }
46
+
47
+ public function renderPages($urls){
48
+
49
+ $siteName = get_option('blogname');
50
+
51
+ ob_get_clean();
52
+ $urlXls = xsgPluginPath(). '/assets/SitemapXMLnews.xsl';
53
+
54
+ ob_start();
55
+ header('Content-Type: text/xml; charset=utf-8');
56
+
57
+ echo '<?xml version="1.0" encoding="UTF-8" ?>';
58
+ echo "\n";
59
+ echo '<?xml-stylesheet type="text/xsl" href="' . $urlXls . '"?>';
60
+ echo "\n";
61
+ $this->renderComment();
62
+ echo "\n";
63
+ echo '<urlset ';
64
+ echo ' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ';
65
+ echo ' xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" ';
66
+ echo ' xmlns:news="http://www.google.com/schemas/sitemap-news/0.9"';
67
+ echo ' xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"';
68
+ echo ' >';
69
+ echo "\n";
70
+
71
+ foreach( $urls as $url )
72
+ {
73
+ $this->renderItem($siteName,$url);
74
+ }
75
+
76
+ echo "\n";
77
+ echo '</urlset>';
78
+ echo "\n";
79
+ $this->renderComment();
80
+ echo "\n";
81
+ ob_end_flush();
82
+
83
+ }
84
+
85
+
86
+ }
87
+
88
+ ?>
code/renderers/rssRenderer.php ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace xmlSitemapGenerator;
4
+
5
+
6
+ class rssRenderer extends rendererCore implements iSitemapRenderer
7
+ {
8
+
9
+ function renderItem( $url, $isIndex)
10
+ {
11
+
12
+ echo '<item>' ;
13
+ echo '<guid>' . htmlspecialchars($url->location) . '</guid>';
14
+ echo '<title>' . $url->title . '</title>';
15
+ echo '<link>' . htmlspecialchars($url->location) . '</link>';
16
+ echo '<description>' . $url->description . '</description>';
17
+
18
+ if(!$isIndex)
19
+ {
20
+ echo '<pubDate>' . date(DATE_RSS, $url->modified) . '</pubDate>';
21
+ }
22
+
23
+ echo "</item>\n" ;
24
+ }
25
+
26
+ function renderIndex($urls)
27
+ {
28
+ $this->doRender($urls, true);
29
+ }
30
+
31
+ function renderPages($urls)
32
+ {
33
+ $this->doRender($urls, false);
34
+ }
35
+
36
+ function doRender($urls,$isIndex){
37
+
38
+ $urlXls = xsgPluginPath(). '/assets/SitemapRSS.xsl';
39
+
40
+
41
+ ob_get_clean();
42
+ ob_start();
43
+ header('Content-Type: text/xml; charset=utf-8');
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();
51
+ echo "\n";
52
+ echo '<rss version="2.0">';
53
+ echo "\n";
54
+ echo '<channel>';
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
+
64
+ echo "\n";
65
+ foreach( $urls as $url )
66
+ {
67
+
68
+ $this->renderItem($url, $isIndex);
69
+ }
70
+ echo "\n";
71
+ echo '</channel>';
72
+ echo "\n";
73
+ echo '</rss>';
74
+ echo "\n";
75
+ $this->renderComment();
76
+ echo "\n";
77
+ ob_end_flush();
78
+
79
+ }
80
+
81
+
82
+ }
83
+
84
+
85
+
86
+ ?>
code/renderers/xmlRenderer.php ADDED
@@ -0,0 +1,198 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace xmlSitemapGenerator;
4
+
5
+
6
+ class xmlRenderer extends rendererCore implements iSitemapRenderer
7
+ {
8
+ private function getFrequency($value)
9
+ {
10
+ switch ($value) {
11
+ case 0:
12
+ return "";
13
+ break;
14
+ case 1:
15
+ return "default";
16
+ break;
17
+ case 2:
18
+ return "never";
19
+ break;
20
+ case 3:
21
+ return "yearly";
22
+ break;
23
+ case 4:
24
+ return "monthly";
25
+ break;
26
+ case 5:
27
+ return "weekly";
28
+ break;
29
+ case 6:
30
+ return "daily";
31
+ break;
32
+ case 7:
33
+ return "hourly";
34
+ break;
35
+ case 8:
36
+ return "always";
37
+ break;
38
+ default:
39
+ return "xxx";
40
+ }
41
+ }
42
+
43
+ private function getPriority($value)
44
+ {
45
+ switch ($value) {
46
+ case 0:
47
+ return "";
48
+ break;
49
+ case 1:
50
+ return "default";
51
+ break;
52
+ case 2:
53
+ return "0.0";
54
+ break;
55
+ case 3:
56
+ return "0.1";
57
+ break;
58
+ case 4:
59
+ return "0.2";
60
+ break;
61
+ case 5:
62
+ return "0.3";
63
+ break;
64
+ case 6:
65
+ return "0.4";
66
+ break;
67
+ case 7:
68
+ return "0.5";
69
+ break;
70
+ case 8:
71
+ return "0.6";
72
+ break;
73
+ case 9:
74
+ return "0.7";
75
+ break;
76
+ case 10:
77
+ return "0.8";
78
+ break;
79
+ case 11:
80
+ return "0.9";
81
+ break;
82
+ case 12:
83
+ return "1.0";
84
+ break;
85
+ default:
86
+ return "xxx";
87
+ }
88
+ }
89
+
90
+
91
+ private function renderImages($images)
92
+ {
93
+
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
+ }
103
+
104
+ private function renderItem( $url)
105
+ {
106
+
107
+ echo '<url>' ;
108
+ echo '<loc>' . htmlspecialchars($url->location) . '</loc>';
109
+ echo '<lastmod>' . date('Y-m-d\TH:i:s+00:00', $url->modified) . '</lastmod>';
110
+
111
+ if (!$url->frequency==0) {
112
+ echo '<changefreq>' . $this->getFrequency($url->frequency) . '</changefreq>';
113
+ }
114
+
115
+ if (!$url->priority==0) {
116
+ echo "<priority>" . $this->getPriority($url->priority) . "</priority>";
117
+ }
118
+ $this->renderImages($url->images);
119
+ echo "</url>\n" ;
120
+ }
121
+
122
+
123
+ public function renderIndex($urls)
124
+ {
125
+
126
+ $urlXls = xsgPluginPath(). '/assets/SitemapXML.xsl';
127
+
128
+ ob_start();
129
+ header('Content-Type: text/xml; charset=utf-8');
130
+
131
+ echo '<?xml version="1.0" encoding="UTF-8" ?>';
132
+ echo "\n";
133
+ echo '<?xml-stylesheet type="text/xsl" href="' . $urlXls . '"?>';
134
+ echo "\n";
135
+ $this->renderComment();
136
+ echo "\n";
137
+ echo '<sitemapindex ';
138
+ echo ' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ';
139
+ echo ' xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" ';
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
+ foreach( $urls as $url )
145
+ {
146
+ echo '<sitemap>' ;
147
+ echo '<loc>' . htmlspecialchars($url->location) . '</loc>';
148
+ echo "</sitemap>\n" ;
149
+ }
150
+
151
+ echo "\n";
152
+ echo '</sitemapindex>';
153
+ echo "\n";
154
+ $this->renderComment();
155
+ echo "\n";
156
+ ob_end_flush();
157
+
158
+ }
159
+
160
+ public function renderPages($urls){
161
+
162
+ ob_get_clean();
163
+ $urlXls = xsgPluginPath(). '/assets/SitemapXML.xsl';
164
+
165
+ ob_start();
166
+ header('Content-Type: text/xml; charset=utf-8');
167
+
168
+ echo '<?xml version="1.0" encoding="UTF-8" ?>';
169
+ echo "\n";
170
+ echo '<?xml-stylesheet type="text/xsl" href="' . $urlXls . '"?>';
171
+ echo "\n";
172
+ $this->renderComment();
173
+ echo "\n";
174
+ echo '<urlset ';
175
+ echo ' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ';
176
+ echo ' xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" ';
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
+ foreach( $urls as $url )
182
+ {
183
+ $this->renderItem($url);
184
+ }
185
+
186
+ echo "\n";
187
+ echo '</urlset>';
188
+ echo "\n";
189
+ $this->renderComment();
190
+ echo "\n";
191
+ ob_end_flush();
192
+
193
+ }
194
+
195
+
196
+ }
197
+
198
+ ?>
code/settings.php CHANGED
@@ -12,8 +12,11 @@ class settings
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
  {
19
  add_options_page( 'XML Sitemap Settings','XML Sitemap','manage_options', XSG_PLUGIN_NAME , array( __CLASS__ , 'render' ) );
@@ -24,6 +27,8 @@ class settings
24
  register_setting( XSG_PLUGIN_NAME, XSG_PLUGIN_NAME );
25
  }
26
 
 
 
27
  static function getPostTypes()
28
  {
29
  $args = array(
@@ -44,11 +49,8 @@ class settings
44
  return ( isset( $sitemapDefaults->{$name} ) ? $sitemapDefaults->{$name} : $sitemapDefaults->posts );
45
  }
46
 
47
- static function safeRead($object,$property)
48
- {
49
- return ( isset( $object->{$property} ) ? $object->{$property} : "" );
50
- }
51
-
52
 
53
  static function getDefaults($name){
54
 
@@ -57,7 +59,7 @@ class settings
57
  $settings->exclude = ( isset( $_POST[$name . 'Exclude'] ) ? $_POST[$name . 'Exclude'] : 0 );
58
  $settings->priority = ( isset( $_POST[$name . 'Priority'] ) ? $_POST[$name . 'Priority'] : 0 );
59
  $settings->frequency = ( isset( $_POST[$name . 'Frequency'] ) ? $_POST[$name . 'Frequency'] : 0 );
60
-
61
 
62
  return $settings;
63
  }
@@ -77,16 +79,59 @@ class settings
77
  $globalSettings = new globalSettings();
78
 
79
 
 
80
 
 
 
81
  $globalSettings->addRssToHead = ( isset( $_POST['addRssToHead'] ) ? $_POST['addRssToHead'] : 0 );
82
  $globalSettings->pingSitemap = ( isset( $_POST['pingSitemap'] ) ? $_POST['pingSitemap'] : 0 );
83
  $globalSettings->addToRobots = ( isset( $_POST['addToRobots'] ) ? $_POST['addToRobots'] : 0 );
84
  $globalSettings->sendStats = ( isset( $_POST['sendStats'] ) ? $_POST['sendStats'] : 0 );
85
  $globalSettings->smallCredit = ( isset( $_POST['smallCredit'] ) ? $_POST['smallCredit'] : 0 );
86
  $globalSettings->robotEntries = ( isset( $_POST['robotEntries'] ) ? $_POST['robotEntries'] : "" );
 
87
 
88
- update_option( "wpXSG_global" , $globalSettings , true);
89
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90
  $sitemapDefaults = new sitemapDefaults();
91
 
92
  $sitemapDefaults->dateField = ( isset( $_POST['dateField'] ) ? $_POST['dateField'] : $sitemapDefaults->dateField );
@@ -108,6 +153,8 @@ class settings
108
  }
109
 
110
 
 
 
111
  update_option( "wpXSG_sitemapDefaults" , $sitemapDefaults , false);
112
 
113
  core::updateStatistics("Admin", "SaveSettings",0);
@@ -115,7 +162,7 @@ class settings
115
 
116
  }
117
 
118
- static function RenderDefaultSection($title,$name,$defaults){
119
 
120
  ?>
121
 
@@ -124,6 +171,14 @@ class settings
124
  <td scope="col"><select name="<?php echo $name; ?>Exclude" id="<?php echo $name; ?>Exclude" ></select> </td>
125
  <td scope="col"><select name="<?php echo $name; ?>Priority" id="<?php echo $name; ?>Priority" ></select> </td>
126
  <td scope="col"><select name="<?php echo $name; ?>Frequency" id="<?php echo $name; ?>Frequency" ></select> </td>
 
 
 
 
 
 
 
 
127
  </tr>
128
  <script>
129
  xsg_populate("<?php echo $name; ?>Exclude" ,excludeDefaults, <?php echo $defaults->exclude ?>);
@@ -136,7 +191,6 @@ class settings
136
 
137
  }
138
 
139
-
140
 
141
 
142
  public static function render()
@@ -144,7 +198,7 @@ class settings
144
 
145
  self::handlePostBack();
146
 
147
- $globalSettings = get_option( "wpXSG_global" , new globalSettings() );
148
  $sitemapDefaults = get_option( "wpXSG_sitemapDefaults" , new sitemapDefaults() );
149
 
150
  core::updateStatistics("Admin", "ViewSettings",0);
@@ -152,7 +206,9 @@ class settings
152
  ?>
153
 
154
 
155
-
 
 
156
 
157
  <form method="post" >
158
 
@@ -166,9 +222,8 @@ class settings
166
 
167
 
168
  <p>Here you can edit your admin settings and defaults. You can override categories, tags, pages and posts when adding and editing them.</p>
169
- <p>Sharing is caring, so please support us with a <a target="_blank" href="https://xmlsitemapgenerator.org/donate.aspx">quick share</a> and if possible a <a target="_blank" href="https://xmlsitemapgenerator.org/donate.aspx">small donation</a>.</p>
170
- Please feel free to <a target="_blank" href="https://xmlsitemapgenerator.org/contact.aspx">contact us</a> with any comments,
171
- questions, suggestions and bugs.</strong></p>
172
 
173
  <div id="poststuff" class="metabox-holder has-right-sidebar">
174
 
@@ -183,9 +238,11 @@ class settings
183
  <?php
184
  $url = get_bloginfo( 'url' ) ;
185
 
186
- echo '<li><a target="_blank" href="' . $url .'/xmlsitemap.xml">XML Sitemap</a></li>';
187
- echo '<li><a target="_blank" href="' . $url .'/rsssitemap.xml">RSS Sitemap</a></li>';
188
- echo '<li><a target="_blank" href="' . $url .'/rsslatest.xml">New Pages RSS</a></li>';
 
 
189
  echo '<li><a target="_blank" href="' . $url .'/robots.txt">Robots.txt</a></li>';
190
 
191
  ?>
@@ -195,7 +252,19 @@ class settings
195
  </div>
196
  </div>
197
 
 
 
 
 
 
 
 
198
 
 
 
 
 
 
199
  <div class="postbox">
200
  <h3 class="hndle"><span>Webmaster tools</span></h3>
201
  <div class="inside">
@@ -228,19 +297,7 @@ class settings
228
  </div>
229
 
230
 
231
- <div class="postbox">
232
- <h3 class="hndle"><span>Sharing is caring</span></h3>
233
- <div class="inside">
234
- <p>We take time out of our personal lives to develop and support our sitemap tools and cover costs out of our own pockets.
235
- </p>
236
- <p>Please support us with a <a target="_blank" href="https://xmlsitemapgenerator.org/donate.aspx">quick share</a> and
237
- if possible a <a target="_blank" href="https://xmlsitemapgenerator.org/donate.aspx">small donation</a>.</p>
238
- <p>Please feel free to <a target="_blank" href="https://xmlsitemapgenerator.org/contact.aspx">contact us</a> with any comments,
239
- questions, suggestions and bugs.</strong></p>
240
-
241
-
242
- </div>
243
- </div>
244
 
245
  </div>
246
  </div>
@@ -255,16 +312,88 @@ class settings
255
 
256
  <div class="meta-box-sortabless">
257
 
258
- <script type="text/javascript" src="<?php echo xsgPluginPath(); ?>scripts.js"></script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
259
  <div class="postbox">
260
  <h3 class="hndle"><span>General settings</span></h3>
261
  <div class="inside">
262
 
263
-
264
- <p>General options for your sitemap.
265
- We recommend you enable all of these.</p>
 
 
 
 
 
 
 
 
 
266
 
267
- <ul>
268
  <li>
269
  <input type="checkbox" name="pingSitemap" id="pingSitemap" value="1" <?php checked($globalSettings->pingSitemap, '1'); ?> />
270
  <label for="sm_b_ping">Automatically ping Google / Bing (MSN & Yahoo) daily</label><br>
@@ -281,14 +410,13 @@ class settings
281
  <input type="checkbox" name="sendStats" id="sendStats" value="1" <?php checked($globalSettings->sendStats, '1'); ?> />
282
  <label for="sm_b_ping">Help us improve by allowing basic usage stats (Page count, PHP Version, feature usage, etc.)</label><br>
283
  </li>
284
- <li>
285
- <input type="checkbox" name="smallCredit" id="smallCredit" value="1" <?php checked($globalSettings->smallCredit, '1'); ?> />
286
- <label for="sm_b_ping">Support us by allowing a small credit in the sitemap file footer (Does not appear on your website)</label><br>
287
- </li>
288
  </ul>
289
  </div>
290
  </div>
291
 
 
 
 
292
  <div class="postbox">
293
  <h3 class="hndle"><span>Sitemap defaults</span></h3>
294
  <div class="inside">
@@ -315,6 +443,7 @@ class settings
315
  <th scope="col">Exclude</th>
316
  <th scope="col">Relative priority</th>
317
  <th scope="col">Update frequency</th>
 
318
  </tr>
319
  </thead>
320
  <tbody id="the-list" >
@@ -322,15 +451,15 @@ class settings
322
 
323
  <?php
324
 
325
- self::RenderDefaultSection("Home page","homepage",$sitemapDefaults->homepage);
326
- self::RenderDefaultSection("Regular page","pages",$sitemapDefaults->pages);
327
- self::RenderDefaultSection("Post page","posts",$sitemapDefaults->posts);
328
- self::RenderDefaultSection("Taxonomy - categories","taxonomyCategories",$sitemapDefaults->taxonomyCategories);
329
- self::RenderDefaultSection("Taxonomy - tags","taxonomyTags",$sitemapDefaults->taxonomyTags);
330
 
331
- self::RenderDefaultSection("Archive - recent","recentArchive",$sitemapDefaults->recentArchive);
332
- self::RenderDefaultSection("Archive - old","oldArchive",$sitemapDefaults->oldArchive);
333
- self::RenderDefaultSection("Authors","authors",$sitemapDefaults->authors);
334
  ?>
335
  </table>
336
 
@@ -342,13 +471,14 @@ class settings
342
  <th scope="col">Exclude</th>
343
  <th scope="col">Relative priority</th>
344
  <th scope="col">Update frequency</th>
 
345
  </tr>
346
  </thead>
347
 
348
  <?php
349
  foreach ( self::getPostTypes() as $post_type )
350
  {
351
- self::RenderDefaultSection($post_type,$post_type, self::postTypeDefault($sitemapDefaults,$post_type));
352
  }
353
  ?>
354
 
@@ -364,7 +494,7 @@ class settings
364
  <h3 class="hndle"><span>Robots.txt</span></h3>
365
  <div class="inside">
366
  <p>Add custom entries to your robots.txt file.</p>
367
- <textarea name="robotEntries" id="robotEntries" rows="10" style="width:98%;"><?php echo self::safeRead($globalSettings,"robotEntries"); ?></textarea>
368
 
369
  </div>
370
  </div>
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
  {
22
  add_options_page( 'XML Sitemap Settings','XML Sitemap','manage_options', XSG_PLUGIN_NAME , array( __CLASS__ , 'render' ) );
27
  register_setting( XSG_PLUGIN_NAME, XSG_PLUGIN_NAME );
28
  }
29
 
30
+
31
+
32
  static function getPostTypes()
33
  {
34
  $args = array(
49
  return ( isset( $sitemapDefaults->{$name} ) ? $sitemapDefaults->{$name} : $sitemapDefaults->posts );
50
  }
51
 
52
+
53
+
 
 
 
54
 
55
  static function getDefaults($name){
56
 
59
  $settings->exclude = ( isset( $_POST[$name . 'Exclude'] ) ? $_POST[$name . 'Exclude'] : 0 );
60
  $settings->priority = ( isset( $_POST[$name . 'Priority'] ) ? $_POST[$name . 'Priority'] : 0 );
61
  $settings->frequency = ( isset( $_POST[$name . 'Frequency'] ) ? $_POST[$name . 'Frequency'] : 0 );
62
+ $settings->scheduled = ( isset( $_POST[$name . 'Scheduled'] ) ? 1 : 0 );
63
 
64
  return $settings;
65
  }
79
  $globalSettings = new globalSettings();
80
 
81
 
82
+ $register = ( isset( $_POST['register'] ) ? $_POST['register'] : 0 );
83
 
84
+ $globalSettings->newsMode = ( isset( $_POST['newsMode'] ) ? $_POST['newsMode'] : 0 );
85
+ $globalSettings->enableImages = ( isset( $_POST['enableImages'] ) ? $_POST['enableImages'] : 0 );
86
  $globalSettings->addRssToHead = ( isset( $_POST['addRssToHead'] ) ? $_POST['addRssToHead'] : 0 );
87
  $globalSettings->pingSitemap = ( isset( $_POST['pingSitemap'] ) ? $_POST['pingSitemap'] : 0 );
88
  $globalSettings->addToRobots = ( isset( $_POST['addToRobots'] ) ? $_POST['addToRobots'] : 0 );
89
  $globalSettings->sendStats = ( isset( $_POST['sendStats'] ) ? $_POST['sendStats'] : 0 );
90
  $globalSettings->smallCredit = ( isset( $_POST['smallCredit'] ) ? $_POST['smallCredit'] : 0 );
91
  $globalSettings->robotEntries = ( isset( $_POST['robotEntries'] ) ? $_POST['robotEntries'] : "" );
92
+ $globalSettings->registerEmail = ( isset( $_POST['registerEmail'] ) ? $_POST['registerEmail'] : "" );
93
 
94
+ $globalSettings->urlXmlSitemap = ( isset( $_POST['urlXmlSitemap'] ) ? $_POST['urlXmlSitemap'] : "xmlsitemap.xml" );
95
+ $globalSettings->urlNewsSitemap = ( isset( $_POST['urlNewsSitemap'] ) ? $_POST['urlNewsSitemap'] : "newssitemap.xml" );
96
+ $globalSettings->urlRssSitemap = ( isset( $_POST['urlRssSitemap'] ) ? $_POST['urlRssSitemap'] : "rsssitemap.xml" );
97
+ $globalSettings->urlRssLatest = ( isset( $_POST['urlRssLatest'] ) ? $_POST['urlRssLatest'] : "rsslatest.xml" );
98
+ $globalSettings->urlHtmlSitemap = ( isset( $_POST['urlHtmlSitemap'] ) ? $_POST['urlHtmlSitemap'] : "htmlsitemap.htm" );
99
+
100
+ $globalSettings->register = $register;
101
+
102
+
103
+ // if new register staturs then .....
104
+ if ($register != get_option('wpXSG_registered'))
105
+ {
106
+ $postData = array(
107
+ 'email' => $globalSettings->registerEmail,
108
+ 'website' => get_bloginfo( 'url' ),
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
+ $response = wp_remote_post($url,
117
+ array(
118
+ 'method' => 'POST',
119
+ 'body' => $postData
120
+ ));
121
+ }
122
+ catch (Exception $e)
123
+ {}
124
+ }
125
+
126
+ update_option( "wpXSG_global" , $globalSettings , true);
127
+ update_option( "wpXSG_registered" , $register , true);
128
+
129
+
130
+ core::add_rewrite_rules();
131
+ flush_rewrite_rules();
132
+
133
+
134
+
135
  $sitemapDefaults = new sitemapDefaults();
136
 
137
  $sitemapDefaults->dateField = ( isset( $_POST['dateField'] ) ? $_POST['dateField'] : $sitemapDefaults->dateField );
153
  }
154
 
155
 
156
+
157
+
158
  update_option( "wpXSG_sitemapDefaults" , $sitemapDefaults , false);
159
 
160
  core::updateStatistics("Admin", "SaveSettings",0);
162
 
163
  }
164
 
165
+ static function RenderDefaultSection($title,$name,$defaults,$scheduled){
166
 
167
  ?>
168
 
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 }
179
+ else
180
+ { echo '<td scope="col"></td>';}
181
+ ?>
182
  </tr>
183
  <script>
184
  xsg_populate("<?php echo $name; ?>Exclude" ,excludeDefaults, <?php echo $defaults->exclude ?>);
191
 
192
  }
193
 
 
194
 
195
 
196
  public static function render()
198
 
199
  self::handlePostBack();
200
 
201
+ $globalSettings = core::getGlobalSettings();
202
  $sitemapDefaults = get_option( "wpXSG_sitemapDefaults" , new sitemapDefaults() );
203
 
204
  core::updateStatistics("Admin", "ViewSettings",0);
206
  ?>
207
 
208
 
209
+ <style>
210
+ .defaultsList li {padding: 5px;}
211
+ </style>
212
 
213
  <form method="post" >
214
 
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 XSG_DONATE_URL ?>">small donation</a>. If you have any comments, questions,
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">
229
 
238
  <?php
239
  $url = get_bloginfo( 'url' ) ;
240
 
241
+ echo '<li><a target="_blank" href="' . $url .'/' . $globalSettings->urlXmlSitemap . '">XML Sitemap</a></li>';
242
+ echo '<li><a target="_blank" href="' . $url .'/' . $globalSettings->urlNewsSitemap . '">XML News Sitemap</a></li>';
243
+ echo '<li><a target="_blank" href="' . $url .'/' . $globalSettings->urlRssSitemap . '">RSS Sitemap</a></li>';
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
  ?>
252
  </div>
253
  </div>
254
 
255
+ <div class="postbox">
256
+ <h3 class="hndle"><span>Please support us</span></h3>
257
+ <div class="inside">
258
+ <p>We take time out of our personal lives to develop and support our sitemap tools and cover costs out of our own pockets. </p>
259
+ <p>Please support us with a <a target="_blank" href="<?php echo XSG_DONATE_URL ?>">small donation</a>.</p>
260
+ <p>Please feel free to <a target="_blank" href="https://xmlsitemapgenerator.org/contact.aspx">contact us</a> with any comments,
261
+ questions, suggestions and bugs.</strong></p>
262
 
263
+ </div>
264
+
265
+ </div>
266
+
267
+
268
  <div class="postbox">
269
  <h3 class="hndle"><span>Webmaster tools</span></h3>
270
  <div class="inside">
297
  </div>
298
 
299
 
300
+
 
 
 
 
 
 
 
 
 
 
 
 
301
 
302
  </div>
303
  </div>
312
 
313
  <div class="meta-box-sortabless">
314
 
315
+ <script type="text/javascript" src="<?php echo xsgPluginPath(); ?>/assets/scripts.js"></script>
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>
321
+ <div class="inside">
322
+
323
+
324
+ <?php if (!get_option('wpXSG_registered')) {echo "<p><strong>Please ensure you register for important updates to stay up-to-date.</strong></p>";} ?>
325
+
326
+
327
+ <p>
328
+ <input type="checkbox" name="register" id="register" value="1" <?php checked($globalSettings->register, '1'); ?> /> Recieve important news and updates about the plugin. <a href="/help/privacy.aspx" target="_blank" rel="nofollow">Privacy Policy</a>.
329
+ </p>
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 core::safeRead2($globalSettings,"registerEmail",get_option( 'admin_email' ) ); ?>" />
334
+ </p>
335
+ </td><td>&nbsp;</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 output URLs for the various sitemap files using the settings below.</p>
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 core::safeRead($globalSettings,"urlXmlSitemap"); ?>" />
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 core::safeRead($globalSettings,"urlRssSitemap"); ?>" />
360
+ </p>
361
+ <p>
362
+ <label for="email" >HTML Sitemap URL</label><br />
363
+ <input type="text" name="urlHtmlSitemap" size="40" value="<?php echo core::safeRead($globalSettings,"urlHtmlSitemap"); ?>" />
364
+ </p>
365
+ </td><td>&nbsp;</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 core::safeRead($globalSettings,"urlNewsSitemap"); ?>" />
369
+ </p>
370
+ <p>
371
+ <label for="email" >RSS Latest URLs</label><br />
372
+ <input type="text" name="urlRssLatest" size="40" value="<?php echo core::safeRead($globalSettings,"urlRssLatest"); ?>" />
373
+ </p>
374
+
375
+
376
+ </td></tr></table>
377
+ </div>
378
+ </div>
379
+
380
  <div class="postbox">
381
  <h3 class="hndle"><span>General settings</span></h3>
382
  <div class="inside">
383
 
384
+
385
+ <ul class="defaultsList">
386
+
387
+ <li>News sitemap : <input type="radio" name="newsMode" value="0" <?php checked($globalSettings->newsMode, '0'); ?> >
388
+ Disabled &nbsp;<input type="radio" name="newsMode" value="1" <?php checked($globalSettings->newsMode, '1'); ?> >
389
+ Include all posts &nbsp;<input type="radio" name="newsMode" value="2" <?php checked($globalSettings->newsMode, '2'); ?> > Selected tags / categories
390
+ </li>
391
+
392
+ <li>
393
+ <input type="checkbox" name="enableImages" id="enableImages" value="1" <?php checked($globalSettings->enableImages, '1'); ?> />
394
+ <label for="sm_b_ping">Enable images in sitemap</label><br>
395
+ </li>
396
 
 
397
  <li>
398
  <input type="checkbox" name="pingSitemap" id="pingSitemap" value="1" <?php checked($globalSettings->pingSitemap, '1'); ?> />
399
  <label for="sm_b_ping">Automatically ping Google / Bing (MSN & Yahoo) daily</label><br>
410
  <input type="checkbox" name="sendStats" id="sendStats" value="1" <?php checked($globalSettings->sendStats, '1'); ?> />
411
  <label for="sm_b_ping">Help us improve by allowing basic usage stats (Page count, PHP Version, feature usage, etc.)</label><br>
412
  </li>
 
 
 
 
413
  </ul>
414
  </div>
415
  </div>
416
 
417
+
418
+
419
+
420
  <div class="postbox">
421
  <h3 class="hndle"><span>Sitemap defaults</span></h3>
422
  <div class="inside">
443
  <th scope="col">Exclude</th>
444
  <th scope="col">Relative priority</th>
445
  <th scope="col">Update frequency</th>
446
+ <th scope="col">Include scheduled</th>
447
  </tr>
448
  </thead>
449
  <tbody id="the-list" >
451
 
452
  <?php
453
 
454
+ self::RenderDefaultSection("Home page","homepage",$sitemapDefaults->homepage, false);
455
+ self::RenderDefaultSection("Regular page","pages",$sitemapDefaults->pages, true);
456
+ self::RenderDefaultSection("Post page","posts",$sitemapDefaults->posts, true);
457
+ self::RenderDefaultSection("Taxonomy - categories","taxonomyCategories",$sitemapDefaults->taxonomyCategories, false);
458
+ self::RenderDefaultSection("Taxonomy - tags","taxonomyTags",$sitemapDefaults->taxonomyTags, false);
459
 
460
+ self::RenderDefaultSection("Archive - recent","recentArchive",$sitemapDefaults->recentArchive, false);
461
+ self::RenderDefaultSection("Archive - old","oldArchive",$sitemapDefaults->oldArchive, false);
462
+ self::RenderDefaultSection("Authors","authors",$sitemapDefaults->authors, false);
463
  ?>
464
  </table>
465
 
471
  <th scope="col">Exclude</th>
472
  <th scope="col">Relative priority</th>
473
  <th scope="col">Update frequency</th>
474
+ <th scope="col">Include scheduled</th>
475
  </tr>
476
  </thead>
477
 
478
  <?php
479
  foreach ( self::getPostTypes() as $post_type )
480
  {
481
+ self::RenderDefaultSection($post_type,$post_type, self::postTypeDefault($sitemapDefaults,$post_type), true);
482
  }
483
  ?>
484
 
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 core::safeRead($globalSettings,"robotEntries"); ?></textarea>
498
 
499
  </div>
500
  </div>
code/settingsModels.php CHANGED
@@ -40,19 +40,33 @@ class sitemapDefaults {
40
 
41
  class globalSettings {
42
 
 
43
  public $addRssToHead = true; // add recent files to Rss header
44
  public $pingSitemap = true; // daily sitemap ping
45
  public $addToRobots = true; // add files to robots
46
  public $sendStats = true; // send stats
47
  public $smallCredit = true; //allow a credit in the sitemap footer
 
 
 
 
 
 
 
 
 
 
 
48
  }
49
 
50
  class metaSettings
51
  {
52
- function __construct($exclude1 = 1,$priority1 = 1,$frequency1 = 1, $inherit = 0) {
53
  $this->exclude = $exclude1;
54
  $this->priority = $priority1;
55
  $this->frequency = $frequency1;
 
 
56
  }
57
 
58
  public $id = 0;
@@ -62,8 +76,8 @@ class metaSettings
62
  public $priority = 1;
63
  public $frequency = 1;
64
  public $inherit = 0;
65
-
66
-
67
  }
68
 
69
 
40
 
41
  class globalSettings {
42
 
43
+ public $enableImages = false; // add images to the sitemap
44
  public $addRssToHead = true; // add recent files to Rss header
45
  public $pingSitemap = true; // daily sitemap ping
46
  public $addToRobots = true; // add files to robots
47
  public $sendStats = true; // send stats
48
  public $smallCredit = true; //allow a credit in the sitemap footer
49
+ public $registerEmail = "";
50
+ public $register = false;
51
+
52
+ public $urlXmlSitemap = "xmlsitemap.xml";
53
+ public $urlNewsSitemap = "newssitemap.xml";
54
+ public $urlRssSitemap = "rsssitemap.xml";
55
+ public $urlRssLatest = "rsslatest.xml";
56
+ public $urlHtmlSitemap = "htmlsitemap.htm";
57
+
58
+ public $newsMode = 0; // add news sitemap. 0 = disabled, 1 = all , 2 = selected categories.
59
+
60
  }
61
 
62
  class metaSettings
63
  {
64
+ function __construct($exclude1 = 1,$priority1 = 1,$frequency1 = 1, $inherit1 = 0, $news1 = 0) {
65
  $this->exclude = $exclude1;
66
  $this->priority = $priority1;
67
  $this->frequency = $frequency1;
68
+ $this->inherit = $inherit1;
69
+ $this->news = $news1;
70
  }
71
 
72
  public $id = 0;
76
  public $priority = 1;
77
  public $frequency = 1;
78
  public $inherit = 0;
79
+ public $scheduled = 0;
80
+ public $news = 0;
81
  }
82
 
83
 
code/sitemapBuilder.php DELETED
@@ -1,487 +0,0 @@
1
- <?php
2
-
3
- namespace xmlSitemapGenerator;
4
-
5
- include_once 'dataAccess.php';
6
- include_once 'renderers.php';
7
-
8
- class mapItem
9
- {
10
-
11
- function __construct()
12
- {}
13
-
14
- public $location ;
15
- public $title ;
16
- public $description ;
17
- public $modified ;
18
- public $priority ;
19
- public $frequency ;
20
-
21
- }
22
-
23
- class sitemapBuilder
24
- {
25
-
26
-
27
- private $pageSize ;
28
- private $urlsList = array();
29
- private $isExecuting = false;
30
- private $siteName = "";
31
-
32
- private $instance;
33
-
34
- public function __construct() {
35
-
36
- $this->pageSize = get_option('posts_per_page');
37
- $this->urlsList = array();
38
- $siteName = get_option('blogname');
39
-
40
- }
41
- /*
42
- public static function getInstance();
43
- {
44
- if ($this->instance === null) {
45
- $this->instance = new self();
46
- }
47
- return $this->instance;
48
- }
49
- */
50
- function getValue($value, $default)
51
- {
52
- if (isset($value))
53
- {
54
- if ($value == 'default') return $default;
55
- return $value;
56
- }
57
- else
58
- {
59
- return $default;
60
- }
61
- }
62
-
63
-
64
-
65
-
66
- function isIncluded($url, $rules)
67
- {
68
- //todo
69
-
70
- return true;
71
-
72
- }
73
-
74
- public static function renderComment()
75
- {
76
- echo "<!-- Created using XmlSitemapGenerator.org WordPress Plugin - Free HTML, RSS and XML sitemap generator -->";
77
- }
78
-
79
-
80
- function getPageLink($url, $pagenum = 1, $escape = true ) {
81
- global $wp_rewrite;
82
-
83
- $pagenum = (int) $pagenum;
84
-
85
- $home_root = preg_quote( home_url(), '|' );
86
- $request = $url;
87
-
88
-
89
- $request = preg_replace('|^'. $home_root . '|i', '', $request);
90
- $request = preg_replace('|^/+|', '', $request);
91
-
92
-
93
- if ( !$wp_rewrite->using_permalinks() || is_admin() ) {
94
- $base = trailingslashit( get_bloginfo( 'url' ) );
95
-
96
- if ( $pagenum > 1 ) {
97
- $result = add_query_arg( 'paged', $pagenum, $base . $request );
98
- } else {
99
- $result = $base . $request;
100
- }
101
- } else {
102
- $qs_regex = '|\?.*?$|';
103
- preg_match( $qs_regex, $request, $qs_match );
104
-
105
- if ( !empty( $qs_match[0] ) ) {
106
- $query_string = $qs_match[0];
107
- $request = preg_replace( $qs_regex, '', $request );
108
- } else {
109
- $query_string = '';
110
- }
111
-
112
- $request = preg_replace( "|$wp_rewrite->pagination_base/\d+/?$|", '', $request);
113
- $request = preg_replace( '|^' . preg_quote( $wp_rewrite->index, '|' ) . '|i', '', $request);
114
- $request = ltrim($request, '/');
115
-
116
- $base = trailingslashit( get_bloginfo( 'url' ) );
117
-
118
- if ( $wp_rewrite->using_index_permalinks() && ( $pagenum > 1 || '' != $request ) )
119
- $base .= $wp_rewrite->index . '/';
120
-
121
- if ( $pagenum > 1 ) {
122
- $request = ( ( !empty( $request ) ) ? trailingslashit( $request ) : $request ) . user_trailingslashit( $wp_rewrite->pagination_base . "/" . $pagenum, 'paged' );
123
- }
124
-
125
- $result = $base . $request . $query_string;
126
- }
127
-
128
- /**
129
- * Filter the page number link for the current request.
130
- *
131
- * @since 2.5.0
132
- *
133
- * @param string $result The page number link.
134
- */
135
- $result = apply_filters( 'get_pagenum_link', $result );
136
-
137
- if ( $escape )
138
- return esc_url( $result );
139
- else
140
- return esc_url_raw( $result );
141
- }
142
-
143
- function getMetaValue($postValue,$tagValue,$default)
144
- {
145
-
146
- if (isset($postValue))
147
- {
148
-
149
- if ( $postValue != 1) { return $postValue; }
150
- }
151
-
152
- if (isset($tagValue))
153
- {
154
- if ( $tagValue != 1) {return $tagValue; }
155
- }
156
-
157
- return $default;
158
-
159
-
160
- }
161
-
162
-
163
- function addUrls($postCount, $mapItem)
164
- {
165
- $pages = 1;
166
-
167
- if ($postCount > $this->pageSize)
168
- {
169
- $pages = ceil($postCount / $this->pageSize);
170
- }
171
-
172
- $siteName = get_option('blogname');
173
- $mapItem->title = $mapItem->title . " | " . $siteName ;
174
- array_push($this->urlsList, $mapItem); // first page
175
- for ($x = 2; $x <= $pages; $x++)
176
- {
177
- $new = clone $mapItem;
178
- $new->title = $new->title . " | Page " . $x;
179
- $new->location = $this->getPageLink($mapItem->location,$x);
180
- array_push($this->urlsList, $new);
181
- }
182
-
183
- }
184
-
185
-
186
- static function postTypeDefault($sitemapDefaults,$name)
187
- {
188
- if ($name == 'page')
189
- {
190
- return $sitemapDefaults->pages;
191
- }
192
- elseif ($name == 'post')
193
- {
194
- return $sitemapDefaults->posts;
195
- }
196
- else
197
- {
198
- return ( isset( $sitemapDefaults->{$name} ) ? $sitemapDefaults->{$name} : $sitemapDefaults->posts );
199
- }
200
- }
201
-
202
- function getPosts( $sitemapDefaults, $limit = 0){
203
-
204
-
205
- $results = dataAccess::getPages( $sitemapDefaults->dateField , $limit);
206
-
207
- if ($results ) {
208
-
209
- foreach( $results as $result ) {
210
-
211
-
212
- // wp_cache_add($result ->ID, $result , 'posts');
213
- $defaults = self::postTypeDefault($sitemapDefaults,$result->post_type );
214
-
215
-
216
- $exlcude = $this->getMetaValue($result->exclude, $result->tagExclude, $defaults->exclude) ;
217
-
218
- if ($exlcude != 2)
219
- {
220
- $pageUrl = get_permalink($result);
221
-
222
- if ($this->isIncluded($pageUrl,$sitemapDefaults->excludeRules ))
223
- {
224
-
225
- $url = new mapItem();
226
- $url->location = $pageUrl ;
227
- $url->title = get_the_title( $result ); //$result->post_title;
228
- $url->description = $result->post_excerpt;
229
- $url->modified = $result->sitemapDate ;
230
-
231
- $url->priority = $this->getMetaValue($result->priority,$result->tagPriority, $defaults->priority) ;
232
- $url->frequency = $this->getMetaValue($result->frequency,$result->tagFrequency,$defaults->frequency) ;
233
-
234
- $this->addUrls(0, $url);
235
-
236
- }
237
- }
238
- }
239
- }
240
-
241
- }
242
-
243
- function getTaxonomy($sitemapDefaults)
244
- {
245
-
246
- $results = dataAccess::getTaxonomy( $sitemapDefaults->dateField );
247
-
248
-
249
-
250
- $urls = array();
251
-
252
- if ($results ) {
253
-
254
- foreach( $results as $result ) {
255
-
256
-
257
- // wp_cache_add($result ->ID, $result , 'posts');
258
- if ($result->taxonomy == 'category')
259
- {$defaults = $sitemapDefaults->taxonomyCategories;}
260
- else
261
- {$defaults = $sitemapDefaults->taxonomyTags;}
262
-
263
- $exlcude = $this->getMetaValue(null, $result->exclude, $defaults->exclude) ;
264
-
265
- if ($exlcude != 2)
266
- {
267
- $pageUrl = get_category_link($result);
268
-
269
- if ($this->isIncluded($pageUrl,$sitemapDefaults->excludeRules ))
270
- {
271
-
272
- $url = new mapItem();
273
- $url->location = $pageUrl;
274
- $url->title = $result->name;
275
- $url->description = $result->description;
276
- $url->modified = $result->sitemapDate ;
277
- $url->priority = $this->getMetaValue(null,$result->priority,$defaults->priority) ;
278
- $url->frequency = $this->getMetaValue(null,$result->frequency,$defaults->frequency) ;
279
-
280
- $this->addUrls($result->posts, $url);
281
-
282
- }
283
- }
284
- }
285
- }
286
-
287
- }
288
-
289
- function getAuthors($sitemapDefaults)
290
- {
291
-
292
- $results = dataAccess::getAuthors($sitemapDefaults->dateField );
293
-
294
-
295
- if ($results ) {
296
-
297
-
298
-
299
- foreach( $results as $result ) {
300
-
301
-
302
- // wp_cache_add($result ->ID, $result , 'posts');
303
-
304
- $defaults = $sitemapDefaults->authors;
305
-
306
- $exlcude = $this->getMetaValue(null, $result->exclude, $defaults->exclude) ;
307
-
308
- if ($exlcude != 2)
309
- {
310
- $pageUrl = get_author_posts_url($result->ID, $result->user_nicename);
311
-
312
- if ($this->isIncluded($pageUrl,$sitemapDefaults->excludeRules ))
313
- {
314
-
315
- $url = new mapItem();
316
- $url->location = $pageUrl;
317
- $url->title = $result->display_name ;
318
- // $url->description = $result->description;
319
- $url->modified = $result->sitemapDate ;
320
- $url->priority = $defaults->priority ;
321
- $url->frequency = $defaults->frequency ;
322
-
323
- $this->addUrls($result->posts, $url);
324
- }
325
- }
326
- }
327
- }
328
- }
329
-
330
- function getArchive($sitemapDefaults)
331
- {
332
-
333
- $results = dataAccess::getArchives($sitemapDefaults->dateField );
334
-
335
- if ($results ) {
336
-
337
-
338
- foreach( $results as $result ) {
339
-
340
- $now = getdate();
341
-
342
- if($result->month == date("n") && $result->year == date("Y"))
343
- {
344
- $defaults = $sitemapDefaults->recentArchive;
345
- }
346
- else
347
- {
348
- $defaults = $sitemapDefaults->oldArchive;
349
- }
350
-
351
- $exlcude = $defaults->exclude ;
352
- $posts = $result->posts;
353
-
354
- $pageUrl = get_month_link( $result->year , $result->month) ;
355
-
356
-
357
- if ($exlcude != 2)
358
- {
359
-
360
- if ($this->isIncluded($pageUrl,$sitemapDefaults->excludeRules ))
361
- {
362
-
363
- $url = new mapItem();
364
- $url->location = $pageUrl;
365
- $url->title = date('F', strtotime("2012-$result->month-01")) . " | " . $result->year ;
366
- // $url->description = $result->description;
367
- $url->modified = $result->sitemapDate ;
368
- $url->priority = $defaults->priority ;
369
- $url->frequency = $defaults->frequency ;
370
-
371
- $this->addUrls($result->posts, $url);
372
-
373
- }
374
- }
375
-
376
- }
377
- }
378
-
379
-
380
- }
381
- function addHomePage($sitemapDefaults)
382
- {
383
-
384
- $defaults = $sitemapDefaults->homepage;
385
- $pageUrl = get_bloginfo( 'url' );
386
-
387
-
388
- $exlcude = $defaults->exclude ;
389
-
390
- if ($exlcude != 2)
391
- {
392
-
393
- if ($this->isIncluded($pageUrl,$sitemapDefaults->excludeRules ))
394
- {
395
-
396
- $url = new mapItem();
397
- $url->location = $pageUrl;
398
- $url->title = "Home page" ;
399
- $url->description = get_option( 'blogdescription');;
400
- $url->modified = dataAccess::getLastModified() ;
401
- $url->priority = $defaults->priority ;
402
- $url->frequency = $defaults->frequency ;
403
-
404
- $this->addUrls(0, $url);
405
-
406
- }
407
- }
408
- }
409
-
410
- function getAllUrls()
411
- {
412
-
413
- $settings = get_option( "wpXSG_sitemapDefaults" , new sitemapDefaults() );
414
-
415
- $this->addHomePage($settings);
416
- $this->getPosts($settings, 0);
417
- $this->getTaxonomy($settings);
418
- $this->getAuthors($settings);
419
- $this->getArchive($settings);
420
- }
421
-
422
- function getNewUrls()
423
- {
424
- $settings = get_option( "wpXSG_sitemapDefaults" , new sitemapDefaults() );
425
- $this->getPosts($settings, 20);
426
-
427
- }
428
-
429
- function render($sitemapType)
430
- {
431
- $startTime = microtime(true) ;
432
- $siteName = get_option('blogname');
433
-
434
- $limit = 0;
435
- if ($sitemapType == 'rssnew')
436
- {
437
- $sitemapType = "rss";
438
- $this->getNewUrls();
439
- }
440
- elseif ($sitemapType == 'xsl')
441
- {
442
- // don't load urls for xsl
443
- }
444
- else
445
- {
446
- $this->getAllUrls();
447
- }
448
-
449
-
450
- $renderer = sitemapRenderer::getInstance($sitemapType);
451
-
452
-
453
- $renderer->render($this->urlsList);
454
-
455
- $time = core::getTimeBand($startTime);
456
- core::updateStatistics("Render", "Render" . $sitemapType, $time);
457
-
458
- exit;
459
-
460
-
461
- }
462
-
463
- public static function renderCredit()
464
- {
465
- $globalSettings = get_option( "wpXSG_global" , new globalSettings() );
466
-
467
- if ($globalSettings->smallCredit)
468
- {
469
- echo '<div id="xsgFooter">Generated by XmlSitemapGenerator.org -
470
- <a href="https://xmlsitemapgenerator.org/wordpress-sitemap-generator-plugin.aspx"
471
- title="WordPress XML Sitemap Generator Plugin">
472
- WordPress XML Sitemap Generator Plugin</a>
473
- </div>';
474
-
475
- }
476
-
477
-
478
-
479
-
480
- }
481
-
482
-
483
- }
484
-
485
-
486
-
487
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
code/upgrader.php CHANGED
@@ -11,7 +11,7 @@ class upgrader
11
 
12
  public static function checkUpgrade()
13
  {
14
- $current_update = 00001;
15
  $installed_Update = get_option( "xmsg_Update" , 00000 );
16
 
17
  if ($installed_Update < $current_update )
@@ -31,6 +31,11 @@ class upgrader
31
  $wpdb->query($cmd);
32
  }
33
 
 
 
 
 
 
34
  }
35
 
36
 
11
 
12
  public static function checkUpgrade()
13
  {
14
+ $current_update = 00002;
15
  $installed_Update = get_option( "xmsg_Update" , 00000 );
16
 
17
  if ($installed_Update < $current_update )
31
  $wpdb->query($cmd);
32
  }
33
 
34
+ if ($installed_Update < 00002)
35
+ {
36
+ $cmd = "UPDATE {$tablemeta} ADD COLUMN news not null default 0 ";
37
+ $wpdb->query($cmd);
38
+ }
39
  }
40
 
41
 
readme.txt CHANGED
@@ -1,10 +1,9 @@
1
  === Google XML Sitemap Generator ===
2
  Contributors: XmlSitemapGenerator
3
  Tags: google, google sitemaps, seo, xml sitemap
4
- Donate link: https://XmlSitemapGenerator.org/donate.aspx
5
  Requires at least: 4.0
6
- Tested up to: 5.3.2
7
- Stable tag: 1.3.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
 
@@ -12,17 +11,23 @@ Improve your websites SEO with a comprehensive, easy to use RSS and XML sitemap
12
 
13
  Improve your websites SEO (Search Engine Optimization) and SERP (Search Engine Page Ranking) using an XML Sitemap.
14
 
15
- Originally designed by Google, XML Sitemaps help search engines understand the content of your website, including Google, Bing, Baidu, Yandex and more
16
 
17
- [Google XML Sitemap Generator](https://xmlsitemapgenerator.org/wordpress-sitemap-generator-plugin.aspx) adds powerful and configurable RSS and XML sitemap features to your website.
 
 
18
 
19
  It works across your entire website creating a detailed sitemap, including all custom posts and taxonomy, which makes it a great companion for plugins such as WooCommerce, bbPress, BuddyPress and more.
20
 
21
  A distinct advantage of this plugin is the ability to edit your sitemap defaults for taxonomy and post types, as well as being able to edit individual page and post settings.
22
 
 
 
23
  **Features include:**
24
 
25
  * HTML, RSS and Google XML Sitemap formats.
 
 
26
  * List all your WordPress Pages, Posts, Archives, Authors, Categories and Tags.
27
  * Support for custom post types and taxonomy.
28
  * Includes paged links for posts for Archives, Authors, Categories and Tags.
@@ -49,6 +54,10 @@ Go to the XML sitemap settings page and if we alert you to any problems with per
49
 
50
  That's it, you're up and running.
51
 
 
 
 
 
52
  = Where can I find my sitemap / robots.txt files? =
53
 
54
  We create these pages dynamically so you will not find them in your control panel / file system.
@@ -98,7 +107,7 @@ Simply go to the Reading Settings page and ensure "Discourage search engines fro
98
 
99
  You should now be up and running, but you may also want to :
100
 
101
- 5. Change the global defaults for pages, posts, etc.
102
  4. Configure tag, category, post and page level settings when adding / editing them.
103
 
104
  **Still having problems?**
@@ -107,15 +116,44 @@ You should now be up and running, but you may also want to :
107
 
108
  == Screenshots ==
109
 
110
- 1. Global sitemap settings
111
- 2. Post / page sitemap settings
112
- 3. Category / tag settings
113
- 4. XML Sitemap page
114
- 5. Sitemap entries in Robots.txt
115
-
 
 
116
 
117
  == Changelog ==
118
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
119
  = 1.3.4 =
120
  Release Date: February 28th, 2017
121
 
1
  === Google XML Sitemap Generator ===
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: 4.0
6
+ Tested up to: 5.6.1
 
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
 
11
 
12
  Improve your websites SEO (Search Engine Optimization) and SERP (Search Engine Page Ranking) using an XML Sitemap.
13
 
14
+ XML Sitemaps, RSS feeds, etc. help search engines understand the content of your website, including Google, Bing, Baidu, Yandex and more
15
 
16
+ [Google XML Sitemap Generator](https://xmlsitemapgenerator.org/wordpress-sitemap-generator-plugin.aspx) adds powerful and configurable HTML, RSS and XML sitemap features to your website.
17
+
18
+ The plugin supports sitemap index files for larger sites and the special News and Image sitemap formats to provide comprehensive coverage for your website.
19
 
20
  It works across your entire website creating a detailed sitemap, including all custom posts and taxonomy, which makes it a great companion for plugins such as WooCommerce, bbPress, BuddyPress and more.
21
 
22
  A distinct advantage of this plugin is the ability to edit your sitemap defaults for taxonomy and post types, as well as being able to edit individual page and post settings.
23
 
24
+ UPGRADE NOTE - After upgrading, some users are reporting issues with the XML sitemap index file giving a 404 error/ redirecting to the homepage. If you have this issue please deactivate then reactive the plugin. If you have any further issues please contact support.
25
+
26
  **Features include:**
27
 
28
  * HTML, RSS and Google XML Sitemap formats.
29
+ * News sitemap and image sitemap support.
30
+ * Sitemap index support for larger websites.
31
  * List all your WordPress Pages, Posts, Archives, Authors, Categories and Tags.
32
  * Support for custom post types and taxonomy.
33
  * Includes paged links for posts for Archives, Authors, Categories and Tags.
54
 
55
  That's it, you're up and running.
56
 
57
+ = Do you support the special images and news sitemap formats? =
58
+
59
+ Yes. Both are available simply enable them in the settings.
60
+
61
  = Where can I find my sitemap / robots.txt files? =
62
 
63
  We create these pages dynamically so you will not find them in your control panel / file system.
107
 
108
  You should now be up and running, but you may also want to :
109
 
110
+ 5. Change the sitemap global defaults for pages, posts, etc.
111
  4. Configure tag, category, post and page level settings when adding / editing them.
112
 
113
  **Still having problems?**
116
 
117
  == Screenshots ==
118
 
119
+ 1. Global sitemap settings 1
120
+ 2. Global sitemap settings 2
121
+ 3. Edit settings per category / tag
122
+ 4. Edit settings per post / page
123
+ 5. XML Sitemap index page
124
+ 6. XML Sitemap news page
125
+ 7. XML sitemap page with images
126
+ 8. Sitemap entries in Robots.txt
127
 
128
  == Changelog ==
129
 
130
+ = 2.0.0 =
131
+ Release Date: February 7th, 2021
132
+
133
+ * New : Tested up to WordPress 5.6.1
134
+ * New : Support for sitemap index files
135
+ * New : Support for image sitemaps
136
+ * New : Support for news sitemaps
137
+ * New : Support for larger sitemaps
138
+ * New : Rearchitected to improve maintainability and performance
139
+ * Fix : Incorrect robots.txt entries
140
+ * Fix : Category / Tag editing fields
141
+
142
+ UPGRADE NOTE - After upgrading, some users are reporting issues with the XML sitemap index file giving a 404 error/ redirecting to the homepage. If you have this issue please deactivate then reactive the plugin. If you have any further issues please contact support.
143
+
144
+ = 1.3.5 =
145
+ Release Date: July 11th, 2020
146
+
147
+ * New : Tested up to WordPress 5.4.
148
+ * New : Edit the sitemap filenames
149
+ * New : Set sitemap values per author/user.
150
+ * New : Include scheduled posts.
151
+ * Fix : Authors variable undefined debug output
152
+ * Fix : Page options do not work for multisite/network
153
+ * Fix : Incorrect sitemap values due to ID collisions
154
+ * Fix : Settings link on network plugins
155
+ * Fix : Google ping url
156
+
157
  = 1.3.4 =
158
  Release Date: February 28th, 2017
159
 
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: 1.3.4
8
  Author: XmlSitemapGenerator.org
9
  Author URI: https://XmlSitemapGenerator.org
10
  License: GPL2
@@ -24,12 +24,20 @@ function xsgPluginPath() {
24
 
25
 
26
  if(defined('ABSPATH') && defined('WPINC')) {
27
- add_action("init", 'xmlSitemapGenerator\core::initialisePlugin');
28
  register_activation_hook(__FILE__, 'xmlSitemapGenerator\core::activatePlugin');
 
 
 
 
 
 
 
29
 
30
- // call this here because other plugins in the init might flush.
31
- core::addQueryVariableHooks();
32
- core::addRewriteHooks();
 
33
  }
34
 
35
 
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.0
8
  Author: XmlSitemapGenerator.org
9
  Author URI: https://XmlSitemapGenerator.org
10
  License: GPL2
24
 
25
 
26
  if(defined('ABSPATH') && defined('WPINC')) {
27
+
28
  register_activation_hook(__FILE__, 'xmlSitemapGenerator\core::activatePlugin');
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( 'wpmu_new_blog', 'xmlSitemapGenerator\core::activate_new_blog' );
40
+
41
  }
42
 
43