Version Description
- Temporary fix for 1.1.5's broken custom post type URL issue. Expect a 1.1.7 real soon.
Download this release
Release Info
Developer | OddOneOut |
Plugin | Better WordPress Google XML Sitemaps (support Sitemap Index, Multi-site and Google News) |
Version | 1.1.6 |
Comparing to | |
See all releases |
Code changes from version 1.0.5 to 1.1.6
- bwp-simple-gxs.php +6 -1
- bwp-simple-gxs.pot +266 -135
- includes/bwp-option-page/css/bwp-option-page.css +36 -4
- includes/bwp-option-page/images/icon-rss.png +0 -0
- includes/bwp-option-page/images/icon-twitter.png +0 -0
- includes/bwp-option-page/includes/class-bwp-option-page.php +9 -2
- includes/bwp-option-page/js/paypal.js +11 -0
- includes/class-bwp-framework.php +53 -23
- includes/class-bwp-gxs-cache.php +8 -18
- includes/class-bwp-gxs-module.php +229 -22
- includes/class-bwp-simple-gxs.php +335 -123
- includes/modules/archive.php +43 -51
- includes/modules/author.php +59 -0
- includes/modules/page.php +12 -9
- includes/modules/page_external.php +43 -0
- includes/modules/post.php +41 -18
- includes/modules/post_attachment.php +4 -0
- includes/modules/post_most_popular.php +10 -10
- includes/modules/site.php +76 -0
- includes/modules/sitemapindex.php +58 -6
- includes/modules/taxonomy.php +58 -28
- readme.txt +147 -22
- screenshot-1.gif +0 -0
- screenshot-3.gif +0 -0
- screenshot-4.gif +0 -0
- xsl/bwp-sitemapindex.xsl +2 -2
bwp-simple-gxs.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: BWP Google XML Sitemaps
|
4 |
Plugin URI: http://betterwp.net/wordpress-plugins/google-xml-sitemaps/
|
5 |
Description: A more lightweight Google XML Sitemap WordPress plugin that generates a <a href="http://en.wikipedia.org/wiki/Sitemap_index">Sitemap index</a> rather than a single sitemap. Despite its simplicity, it is still very powerful and has plenty of options to choose.
|
6 |
-
Version: 1.
|
7 |
Text Domain: bwp-simple-gxs
|
8 |
Domain Path: /languages/
|
9 |
Author: Khang Minh
|
@@ -11,8 +11,13 @@ Author URI: http://betterwp.net
|
|
11 |
License: GPLv3
|
12 |
*/
|
13 |
|
|
|
|
|
|
|
|
|
14 |
// Frontend
|
15 |
require_once(dirname(__FILE__) . '/includes/class-bwp-simple-gxs.php');
|
|
|
16 |
$bwp_gxs = new BWP_SIMPLE_GXS();
|
17 |
|
18 |
// Backend
|
3 |
Plugin Name: BWP Google XML Sitemaps
|
4 |
Plugin URI: http://betterwp.net/wordpress-plugins/google-xml-sitemaps/
|
5 |
Description: A more lightweight Google XML Sitemap WordPress plugin that generates a <a href="http://en.wikipedia.org/wiki/Sitemap_index">Sitemap index</a> rather than a single sitemap. Despite its simplicity, it is still very powerful and has plenty of options to choose.
|
6 |
+
Version: 1.1.6
|
7 |
Text Domain: bwp-simple-gxs
|
8 |
Domain Path: /languages/
|
9 |
Author: Khang Minh
|
11 |
License: GPLv3
|
12 |
*/
|
13 |
|
14 |
+
// Pre-emptive
|
15 |
+
$bwp_gxs_ob_level = @ob_get_level();
|
16 |
+
$bwp_gxs_ob_start = ob_start();
|
17 |
+
|
18 |
// Frontend
|
19 |
require_once(dirname(__FILE__) . '/includes/class-bwp-simple-gxs.php');
|
20 |
+
$bwp_gxs_gzipped = (!BWP_SIMPLE_GXS::is_gzipped()) ? false : true;
|
21 |
$bwp_gxs = new BWP_SIMPLE_GXS();
|
22 |
|
23 |
// Backend
|
bwp-simple-gxs.pot
CHANGED
@@ -2,8 +2,8 @@ msgid ""
|
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: BWP Google XML Sitemaps\n"
|
4 |
"Report-Msgid-Bugs-To: \n"
|
5 |
-
"POT-Creation-Date: 2011-
|
6 |
-
"PO-Revision-Date: 2011-
|
7 |
"Last-Translator: \n"
|
8 |
"Language-Team: \n"
|
9 |
"MIME-Version: 1.0\n"
|
@@ -19,20 +19,68 @@ msgstr ""
|
|
19 |
msgid "%s requires WordPress <strong>%s</strong> or higher and PHP <strong>%s</strong> or higher. The plugin will not function until you update your software. Please deactivate this plugin."
|
20 |
msgstr ""
|
21 |
|
22 |
-
#: includes/class-bwp-framework.php:
|
23 |
-
msgid "
|
24 |
msgstr ""
|
25 |
|
26 |
-
#: includes/class-bwp-framework.php:
|
27 |
-
msgid "
|
28 |
msgstr ""
|
29 |
|
30 |
-
#: includes/class-bwp-framework.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
#, php-format
|
32 |
msgid "You are using version %s!"
|
33 |
msgstr ""
|
34 |
|
35 |
-
#: includes/class-bwp-framework.php:
|
36 |
msgid "Settings"
|
37 |
msgstr ""
|
38 |
|
@@ -46,439 +94,522 @@ msgstr ""
|
|
46 |
msgid "Cache file for module <em>%s</em> is not found and will be built right away."
|
47 |
msgstr ""
|
48 |
|
49 |
-
#: includes/class-bwp-gxs-cache.php:
|
50 |
-
#: includes/class-bwp-simple-gxs.php:
|
51 |
#, php-format
|
52 |
msgid "Successfully served a cached version of <em>%s.xml</em>."
|
53 |
msgstr ""
|
54 |
|
55 |
-
#: includes/class-bwp-simple-gxs.php:
|
56 |
-
#: includes/class-bwp-simple-gxs.php:
|
57 |
msgid "Sitemap Statistics"
|
58 |
msgstr ""
|
59 |
|
60 |
-
#: includes/class-bwp-simple-gxs.php:
|
61 |
-
#: includes/class-bwp-simple-gxs.php:
|
62 |
msgid "Sitemap Generator"
|
63 |
msgstr ""
|
64 |
|
65 |
-
#: includes/class-bwp-simple-gxs.php:
|
66 |
#, php-format
|
67 |
msgid "This sitemap was originally generated in %s second(s) (Memory usage: %s) - %s queries - %s URL(s) listed"
|
68 |
msgstr ""
|
69 |
|
70 |
-
#: includes/class-bwp-simple-gxs.php:
|
71 |
msgid "BWP Google XML Sitemaps"
|
72 |
msgstr ""
|
73 |
|
74 |
-
#: includes/class-bwp-simple-gxs.php:
|
75 |
msgid "BWP Google XML Sitemaps Statistics"
|
76 |
msgstr ""
|
77 |
|
78 |
-
#: includes/class-bwp-simple-gxs.php:
|
79 |
msgid "BWP Google XML Sitemaps Generator"
|
80 |
msgstr ""
|
81 |
|
82 |
-
#: includes/class-bwp-simple-gxs.php:
|
83 |
msgid "You do not have sufficient permissions to access this page."
|
84 |
msgstr ""
|
85 |
|
86 |
-
#: includes/class-bwp-simple-gxs.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
msgid "What are Sitemaps?"
|
88 |
msgstr ""
|
89 |
|
90 |
-
#: includes/class-bwp-simple-gxs.php:
|
91 |
msgid "Your sitemaps"
|
92 |
msgstr ""
|
93 |
|
94 |
-
#: includes/class-bwp-simple-gxs.php:
|
95 |
msgid "Submit your sitemaps"
|
96 |
msgstr ""
|
97 |
|
98 |
-
#: includes/class-bwp-simple-gxs.php:
|
99 |
msgid "Pinging search engines"
|
100 |
msgstr ""
|
101 |
|
102 |
-
#: includes/class-bwp-simple-gxs.php:
|
103 |
msgid "Enable pinging functionality?"
|
104 |
msgstr ""
|
105 |
|
106 |
-
#: includes/class-bwp-simple-gxs.php:
|
107 |
msgid "Enable pinging individual SE"
|
108 |
msgstr ""
|
109 |
|
110 |
-
#: includes/class-bwp-simple-gxs.php:
|
111 |
msgid "Sitemap Generator's Log"
|
112 |
msgstr ""
|
113 |
|
114 |
-
#: includes/class-bwp-simple-gxs.php:
|
115 |
msgid "Enable logging?"
|
116 |
msgstr ""
|
117 |
|
118 |
-
#: includes/class-bwp-simple-gxs.php:
|
119 |
msgid "Enable debugging?"
|
120 |
msgstr ""
|
121 |
|
122 |
-
#: includes/class-bwp-simple-gxs.php:
|
123 |
msgid "In its simplest form, a Sitemap is an XML file that lists URLs for a site along with additional metadata about each URL (when it was last updated, how often it usually changes, and how important it is, relative to other URLs in the site) so that search engines can more intelligently crawl the site — <em>http://www.sitemaps.org/</em>"
|
124 |
msgstr ""
|
125 |
|
126 |
-
#: includes/class-bwp-simple-gxs.php:
|
|
|
|
|
|
|
|
|
127 |
msgid "<em>Basic information about all your sitemaps.</em>"
|
128 |
msgstr ""
|
129 |
|
130 |
-
#: includes/class-bwp-simple-gxs.php:
|
131 |
msgid "<em>More detailed information about how your sitemaps are generated including <span style=\"color: #999999;\">notices</span>, <span style=\"color: #FF0000;\">errors</span> and <span style=\"color: #009900;\">success messages</span>.</em>"
|
132 |
msgstr ""
|
133 |
|
134 |
-
#: includes/class-bwp-simple-gxs.php:
|
135 |
#, php-format
|
136 |
msgid "<em>Submit your sitemapindex to major search engines like <a href=\"%s\" target=\"_blank\">Google</a>, <a href=\"%s\" target=\"_blank\">Yahoo</a>, <a href=\"%s\" target=\"_blank\">Bing</a> or <a href=\"%s\" target=\"_blank\">Ask</a>.</em>"
|
137 |
msgstr ""
|
138 |
|
139 |
-
#: includes/class-bwp-simple-gxs.php:
|
140 |
msgid "<em>Now when you post something new to your blog, you can <em>ping</em> those search engines to tell them your blog just got updated. Pinging could be less effective than you think it is but you should enable such feature anyway.</em>"
|
141 |
msgstr ""
|
142 |
|
143 |
-
#: includes/class-bwp-simple-gxs.php:
|
144 |
msgid "Selected SE below will be pinged when you publish new posts."
|
145 |
msgstr ""
|
146 |
|
147 |
-
#: includes/class-bwp-simple-gxs.php:
|
148 |
msgid "No additional load is needed so enabling this is recommended."
|
149 |
msgstr ""
|
150 |
|
151 |
-
#: includes/class-bwp-simple-gxs.php:
|
152 |
msgid "Minor errors will be printed on screen. Also, when debug is on, no caching is used, useful when you develop new modules."
|
153 |
msgstr ""
|
154 |
|
155 |
-
#: includes/class-bwp-simple-gxs.php:
|
156 |
msgid "Google"
|
157 |
msgstr ""
|
158 |
|
159 |
-
#: includes/class-bwp-simple-gxs.php:
|
160 |
#, php-format
|
161 |
msgid "Yahoo — <a href=\"%s\" target=\"_blank\">important</a>"
|
162 |
msgstr ""
|
163 |
|
164 |
-
#: includes/class-bwp-simple-gxs.php:
|
165 |
msgid "Bing"
|
166 |
msgstr ""
|
167 |
|
168 |
-
#: includes/class-bwp-simple-gxs.php:
|
169 |
msgid "Ask.com"
|
170 |
msgstr ""
|
171 |
|
172 |
-
#: includes/class-bwp-simple-gxs.php:
|
173 |
#, php-format
|
174 |
msgid "After you activate this plugin, all sitemaps should be available right away. The next step is to submit the sitemapindex to major search engines. You only need the <strong>sitemapindex</strong> and nothing else, those search engines will automatically recognize other included sitemaps. You can read a small <a href=\"%s\">How-to</a> if you are interested."
|
175 |
msgstr ""
|
176 |
|
177 |
-
#: includes/class-bwp-simple-gxs.php:
|
178 |
msgid "Output no more than"
|
179 |
msgstr ""
|
180 |
|
181 |
-
#: includes/class-bwp-simple-gxs.php:
|
182 |
msgid "Default change frequency"
|
183 |
msgstr ""
|
184 |
|
185 |
-
#: includes/class-bwp-simple-gxs.php:
|
186 |
msgid "Default priority"
|
187 |
msgstr ""
|
188 |
|
189 |
-
#: includes/class-bwp-simple-gxs.php:
|
190 |
msgid "Minimum priority"
|
191 |
msgstr ""
|
192 |
|
193 |
-
#: includes/class-bwp-simple-gxs.php:
|
194 |
-
msgid "
|
195 |
-
msgstr ""
|
196 |
-
|
197 |
-
#: includes/class-bwp-simple-gxs.php:365
|
198 |
-
msgid "In sitemapindex, include"
|
199 |
msgstr ""
|
200 |
|
201 |
-
#: includes/class-bwp-simple-gxs.php:
|
202 |
msgid "Style your sitemaps with an XSLT stylesheet?"
|
203 |
msgstr ""
|
204 |
|
205 |
-
#: includes/class-bwp-simple-gxs.php:
|
206 |
msgid "Custom XSLT stylesheet URL"
|
207 |
msgstr ""
|
208 |
|
209 |
-
#: includes/class-bwp-simple-gxs.php:
|
210 |
msgid "Show build stats in sitemaps?"
|
211 |
msgstr ""
|
212 |
|
213 |
-
#: includes/class-bwp-simple-gxs.php:
|
214 |
msgid "Enable credit?"
|
215 |
msgstr ""
|
216 |
|
217 |
-
#: includes/class-bwp-simple-gxs.php:
|
218 |
msgid "Enable Gzip?"
|
219 |
msgstr ""
|
220 |
|
221 |
-
#: includes/class-bwp-simple-gxs.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
222 |
msgid "Module Options"
|
223 |
msgstr ""
|
224 |
|
225 |
-
#: includes/class-bwp-simple-gxs.php:
|
226 |
msgid "Alternate module directory"
|
227 |
msgstr ""
|
228 |
|
229 |
-
#: includes/class-bwp-simple-gxs.php:
|
230 |
msgid "Get no more than"
|
231 |
msgstr ""
|
232 |
|
233 |
-
#: includes/class-bwp-simple-gxs.php:
|
234 |
msgid "Caching Options"
|
235 |
msgstr ""
|
236 |
|
237 |
-
#: includes/class-bwp-simple-gxs.php:
|
238 |
msgid "Enable caching?"
|
239 |
msgstr ""
|
240 |
|
241 |
-
#: includes/class-bwp-simple-gxs.php:
|
242 |
msgid "Enable auto cache re-generation?"
|
243 |
msgstr ""
|
244 |
|
245 |
-
#: includes/class-bwp-simple-gxs.php:
|
246 |
msgid "Cached sitemaps will last for"
|
247 |
msgstr ""
|
248 |
|
249 |
-
#: includes/class-bwp-simple-gxs.php:
|
250 |
msgid "Cached sitemaps are stored in (auto detected)"
|
251 |
msgstr ""
|
252 |
|
253 |
-
#: includes/class-bwp-simple-gxs.php:
|
254 |
msgid "<em>Cache your sitemaps for better performance.</em>"
|
255 |
msgstr ""
|
256 |
|
257 |
-
#: includes/class-bwp-simple-gxs.php:
|
258 |
#, php-format
|
259 |
msgid "<em>This plugin uses modules to build sitemap data so it is recommended that you extend this plugin using modules rather than hooks. Some of the settings below only affect modules extending the base module class. Read more about using modules <a href=\"%s#using-modules\">here</a>.</em>"
|
260 |
msgstr ""
|
261 |
|
262 |
-
#: includes/class-bwp-simple-gxs.php:
|
263 |
-
|
|
|
|
|
|
|
|
|
264 |
msgid "second(s)"
|
265 |
msgstr ""
|
266 |
|
267 |
-
#: includes/class-bwp-simple-gxs.php:
|
268 |
-
#: includes/class-bwp-simple-gxs.php:
|
269 |
msgid "minute(s)"
|
270 |
msgstr ""
|
271 |
|
272 |
-
#: includes/class-bwp-simple-gxs.php:
|
273 |
-
#: includes/class-bwp-simple-gxs.php:
|
274 |
msgid "hour(s)"
|
275 |
msgstr ""
|
276 |
|
277 |
-
#: includes/class-bwp-simple-gxs.php:
|
278 |
-
#: includes/class-bwp-simple-gxs.php:
|
279 |
msgid "day(s)"
|
280 |
msgstr ""
|
281 |
|
282 |
-
#: includes/class-bwp-simple-gxs.php:
|
283 |
-
#: includes/class-bwp-simple-gxs.php:
|
284 |
-
#: includes/class-bwp-simple-gxs.php:
|
285 |
msgid "read more"
|
286 |
msgstr ""
|
287 |
|
288 |
-
#: includes/class-bwp-simple-gxs.php:
|
289 |
msgid "your sitemaps are generated and then cached to reduce unnecessary work."
|
290 |
msgstr ""
|
291 |
|
292 |
-
#: includes/class-bwp-simple-gxs.php:
|
293 |
msgid "when a cached sitemap expires, this plugin will try to generate the cache again. If you disable this, remember to manually flush the cache once in a while."
|
294 |
msgstr ""
|
295 |
|
296 |
-
#: includes/class-bwp-simple-gxs.php:
|
297 |
msgid "Flush the cache"
|
298 |
msgstr ""
|
299 |
|
300 |
-
#: includes/class-bwp-simple-gxs.php:
|
301 |
msgid "tell you useful information such as build time, memory usage, SQL queries, etc."
|
302 |
msgstr ""
|
303 |
|
304 |
-
#: includes/class-bwp-simple-gxs.php:
|
305 |
#, php-format
|
306 |
-
msgid "make your sitemaps ~ 70% smaller."
|
307 |
msgstr ""
|
308 |
|
309 |
-
#: includes/class-bwp-simple-gxs.php:
|
310 |
-
msgid "
|
311 |
msgstr ""
|
312 |
|
313 |
-
#: includes/class-bwp-simple-gxs.php:
|
314 |
-
|
|
|
315 |
msgstr ""
|
316 |
|
317 |
-
#: includes/class-bwp-simple-gxs.php:
|
318 |
-
msgid "
|
319 |
msgstr ""
|
320 |
|
321 |
-
#: includes/class-bwp-simple-gxs.php:
|
322 |
msgid "date archives' sitemaps."
|
323 |
msgstr ""
|
324 |
|
325 |
-
#: includes/class-bwp-simple-gxs.php:
|
|
|
|
|
|
|
|
|
326 |
msgid "some copyrighted info is also added to your sitemaps. Thanks!"
|
327 |
msgstr ""
|
328 |
|
329 |
-
#: includes/class-bwp-simple-gxs.php:
|
330 |
-
msgid "This will load the default
|
331 |
msgstr ""
|
332 |
|
333 |
-
#: includes/class-bwp-simple-gxs.php:
|
334 |
#, php-format
|
335 |
msgid "If you're on a Multi-site installation with Sub-domain enabled, each site will have its own robots.txt, sites in sub-directory will not. Please read the <a href=\"%s#toc-robots\" target=\"_blank\">documentation</a> for more info."
|
336 |
msgstr ""
|
337 |
|
338 |
-
#: includes/class-bwp-simple-gxs.php:
|
339 |
-
msgid "
|
340 |
msgstr ""
|
341 |
|
342 |
-
#: includes/class-bwp-simple-gxs.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
343 |
msgid "Input a full path to the directory where you put your own modules (e.g. <code>/home/mysite/public_html/gxs-modules/</code>), you can also override a built-in module by having a module with the same filename in this directory. A filter is also available if you would like to use PHP instead."
|
344 |
msgstr ""
|
345 |
|
346 |
-
#: includes/class-bwp-simple-gxs.php:
|
347 |
msgid "The cache directory must be writable (i.e. CHMOD to 755 or 777)."
|
348 |
msgstr ""
|
349 |
|
350 |
-
#: includes/class-bwp-simple-gxs.php:
|
351 |
msgid "item(s) in one SQL query. This helps you avoid running too heavy queries."
|
352 |
msgstr ""
|
353 |
|
354 |
-
#: includes/class-bwp-simple-gxs.php:
|
355 |
msgid "expected to be an absolute URL, e.g. <code>http://example.com/my-stylesheet.xsl</code>. You must also have a style sheet for the sitemapindex that can be accessed through the above URL, e.g. <code>my-stylesheet.xsl</code> and <code>my-stylesheetindex.xsl</code>). Please leave blank if you do not wish to use."
|
356 |
msgstr ""
|
357 |
|
358 |
-
#: includes/class-bwp-simple-gxs.php:
|
359 |
-
|
360 |
-
msgid "
|
361 |
msgstr ""
|
362 |
|
363 |
-
#: includes/class-bwp-simple-gxs.php:
|
364 |
#, php-format
|
365 |
msgid "<strong>%d</strong> cached sitemaps have been flushed successfully!"
|
366 |
msgstr ""
|
367 |
|
368 |
-
#: includes/class-bwp-simple-gxs.php:
|
369 |
msgid "Could not delete any cached sitemaps. Please manually check the cache directory."
|
370 |
msgstr ""
|
371 |
|
372 |
-
#: includes/class-bwp-simple-gxs.php:
|
373 |
msgid "Warning"
|
374 |
msgstr ""
|
375 |
|
376 |
-
#: includes/class-bwp-simple-gxs.php:
|
377 |
msgid "Cache directory does not exist or is not writable. Please read more about directory permission <a href='http://www.zzee.com/solutions/unix-permissions.shtml'>here</a> (Unix)."
|
378 |
msgstr ""
|
379 |
|
380 |
-
#: includes/class-bwp-simple-gxs.php:
|
|
|
|
|
|
|
|
|
381 |
msgid "(Debug is on)"
|
382 |
msgstr ""
|
383 |
|
384 |
-
#: includes/class-bwp-simple-gxs.php:
|
385 |
msgid "<strong>BWP Google XML Sitemaps Error:</strong> "
|
386 |
msgstr ""
|
387 |
|
388 |
-
#: includes/class-bwp-simple-gxs.php:
|
389 |
msgid "BWP Google XML Sitemaps Error"
|
390 |
msgstr ""
|
391 |
|
392 |
-
#: includes/class-bwp-simple-gxs.php:
|
393 |
#, php-format
|
394 |
msgid "Nothing here... yet! Try submitting your <a href=\"%s\">sitemapindex</a> first!"
|
395 |
msgstr ""
|
396 |
|
397 |
-
#: includes/class-bwp-simple-gxs.php:
|
398 |
msgid "No log yet!"
|
399 |
msgstr ""
|
400 |
|
401 |
-
#: includes/class-bwp-simple-gxs.php:
|
402 |
-
#, php-format
|
403 |
-
msgid "%s"
|
404 |
-
msgstr ""
|
405 |
-
|
406 |
-
#: includes/class-bwp-simple-gxs.php:614
|
407 |
#, php-format
|
408 |
msgid "<a href=\"%s\" target=\"_blank\">%s</a> has been successfully built on <strong>%s</strong>."
|
409 |
msgstr ""
|
410 |
|
411 |
-
#: includes/class-bwp-simple-gxs.php:
|
412 |
-
#: includes/class-bwp-simple-gxs.php:
|
413 |
msgid "M j, Y : H:i:s"
|
414 |
msgstr ""
|
415 |
|
416 |
-
#: includes/class-bwp-simple-gxs.php:
|
417 |
#, php-format
|
418 |
msgid "Requested module (<em>%s</em>) not found or not allowed."
|
419 |
msgstr ""
|
420 |
|
421 |
-
#: includes/class-bwp-simple-gxs.php:
|
422 |
-
#: includes/class-bwp-simple-gxs.php:
|
423 |
#, php-format
|
424 |
msgid "Loaded a custom sub-module file: <strong>%s</strong>."
|
425 |
msgstr ""
|
426 |
|
427 |
-
#: includes/class-bwp-simple-gxs.php:
|
428 |
#, php-format
|
429 |
msgid "Mapped sub-module file: <strong>%s</strong> is not available in both default and custom module directory. The plugin will now try loading the requested sub-module instead."
|
430 |
msgstr ""
|
431 |
|
432 |
-
#: includes/class-bwp-simple-gxs.php:
|
433 |
#, php-format
|
434 |
msgid "Sub-module file: <strong>%s</strong> is not available in both default and custom module directory. The plugin will now try loading the parent module instead."
|
435 |
msgstr ""
|
436 |
|
437 |
-
#: includes/class-bwp-simple-gxs.php:
|
438 |
#, php-format
|
439 |
msgid "Loaded a custom module file: <strong>%s</strong>."
|
440 |
msgstr ""
|
441 |
|
442 |
-
#: includes/class-bwp-simple-gxs.php:
|
443 |
#, php-format
|
444 |
msgid "Could not load module file: <strong>%s</strong> in both default and custom module directory. Please recheck if that module file exists."
|
445 |
msgstr ""
|
446 |
|
447 |
-
#: includes/class-bwp-simple-gxs.php:
|
448 |
#, php-format
|
449 |
msgid "There is no class named <strong>%s</strong> in the module file <strong>%s</strong>."
|
450 |
msgstr ""
|
451 |
|
452 |
-
#: includes/class-bwp-simple-gxs.php:
|
453 |
#, php-format
|
454 |
msgid "Loaded a custom sitemapindex module file: <strong>%s</strong>."
|
455 |
msgstr ""
|
456 |
|
457 |
-
#: includes/class-bwp-simple-gxs.php:
|
458 |
#, php-format
|
459 |
msgid "Successfully generated <em>%s.xml</em> using module <em>%s</em>."
|
460 |
msgstr ""
|
461 |
|
462 |
-
#: includes/class-bwp-simple-gxs.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
463 |
#, php-format
|
464 |
msgid "Pinged %s successfully!"
|
465 |
msgstr ""
|
466 |
|
467 |
-
#: includes/class-bwp-simple-gxs.php:
|
|
|
|
|
|
|
|
|
|
|
468 |
#, php-format
|
469 |
msgid "Ping limit for today to %s has been reached, sorry!"
|
470 |
msgstr ""
|
471 |
|
472 |
-
#: includes/class-bwp-simple-gxs.php:
|
473 |
#, php-format
|
474 |
msgid "<em>%s.xml</em> does not have any item. The plugin has fired a 404 header to the search engine that requests it. You should check the module that generates that sitemap (<em>%s.php</em>)."
|
475 |
msgstr ""
|
476 |
|
477 |
-
#: includes/bwp-option-page/includes/class-bwp-option-page.php:
|
478 |
msgid "Plugin Configurations"
|
479 |
msgstr ""
|
480 |
|
481 |
-
#: includes/bwp-option-page/includes/class-bwp-option-page.php:
|
482 |
msgid "Save Changes"
|
483 |
msgstr ""
|
484 |
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: BWP Google XML Sitemaps\n"
|
4 |
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: 2011-09-20 12:59+0700\n"
|
6 |
+
"PO-Revision-Date: 2011-09-20 12:59+0700\n"
|
7 |
"Last-Translator: \n"
|
8 |
"Language-Team: \n"
|
9 |
"MIME-Version: 1.0\n"
|
19 |
msgid "%s requires WordPress <strong>%s</strong> or higher and PHP <strong>%s</strong> or higher. The plugin will not function until you update your software. Please deactivate this plugin."
|
20 |
msgstr ""
|
21 |
|
22 |
+
#: includes/class-bwp-framework.php:183
|
23 |
+
msgid "Development Log"
|
24 |
msgstr ""
|
25 |
|
26 |
+
#: includes/class-bwp-framework.php:183
|
27 |
+
msgid "Frequently Asked Questions"
|
28 |
msgstr ""
|
29 |
|
30 |
+
#: includes/class-bwp-framework.php:183
|
31 |
+
msgid "FAQ"
|
32 |
+
msgstr ""
|
33 |
+
|
34 |
+
#: includes/class-bwp-framework.php:183
|
35 |
+
msgid "Got a problem? Send me a feedback!"
|
36 |
+
msgstr ""
|
37 |
+
|
38 |
+
#: includes/class-bwp-framework.php:183
|
39 |
+
msgid "Contact"
|
40 |
+
msgstr ""
|
41 |
+
|
42 |
+
#: includes/class-bwp-framework.php:190
|
43 |
+
msgid "You can buy me some special coffees if you appreciate my work, thank you!"
|
44 |
+
msgstr ""
|
45 |
+
|
46 |
+
#: includes/class-bwp-framework.php:204
|
47 |
+
msgid "Donate to "
|
48 |
+
msgstr ""
|
49 |
+
|
50 |
+
#: includes/class-bwp-framework.php:206
|
51 |
+
msgid "One cup $5.00"
|
52 |
+
msgstr ""
|
53 |
+
|
54 |
+
#: includes/class-bwp-framework.php:207
|
55 |
+
msgid "Two cups $10.00"
|
56 |
+
msgstr ""
|
57 |
+
|
58 |
+
#: includes/class-bwp-framework.php:208
|
59 |
+
msgid "Five cups! $25.00"
|
60 |
+
msgstr ""
|
61 |
+
|
62 |
+
#: includes/class-bwp-framework.php:209
|
63 |
+
msgid "One LL-cup!!! $50.00"
|
64 |
+
msgstr ""
|
65 |
+
|
66 |
+
#: includes/class-bwp-framework.php:210
|
67 |
+
msgid "... or any amount!"
|
68 |
+
msgstr ""
|
69 |
+
|
70 |
+
#: includes/class-bwp-framework.php:225
|
71 |
+
msgid "Latest updates from BetterWP.net!"
|
72 |
+
msgstr ""
|
73 |
+
|
74 |
+
#: includes/class-bwp-framework.php:226
|
75 |
+
msgid "Follow me on Twitter!"
|
76 |
+
msgstr ""
|
77 |
+
|
78 |
+
#: includes/class-bwp-framework.php:235
|
79 |
#, php-format
|
80 |
msgid "You are using version %s!"
|
81 |
msgstr ""
|
82 |
|
83 |
+
#: includes/class-bwp-framework.php:372
|
84 |
msgid "Settings"
|
85 |
msgstr ""
|
86 |
|
94 |
msgid "Cache file for module <em>%s</em> is not found and will be built right away."
|
95 |
msgstr ""
|
96 |
|
97 |
+
#: includes/class-bwp-gxs-cache.php:108
|
98 |
+
#: includes/class-bwp-simple-gxs.php:1121
|
99 |
#, php-format
|
100 |
msgid "Successfully served a cached version of <em>%s.xml</em>."
|
101 |
msgstr ""
|
102 |
|
103 |
+
#: includes/class-bwp-simple-gxs.php:129
|
104 |
+
#: includes/class-bwp-simple-gxs.php:310
|
105 |
msgid "Sitemap Statistics"
|
106 |
msgstr ""
|
107 |
|
108 |
+
#: includes/class-bwp-simple-gxs.php:130
|
109 |
+
#: includes/class-bwp-simple-gxs.php:311
|
110 |
msgid "Sitemap Generator"
|
111 |
msgstr ""
|
112 |
|
113 |
+
#: includes/class-bwp-simple-gxs.php:149
|
114 |
#, php-format
|
115 |
msgid "This sitemap was originally generated in %s second(s) (Memory usage: %s) - %s queries - %s URL(s) listed"
|
116 |
msgstr ""
|
117 |
|
118 |
+
#: includes/class-bwp-simple-gxs.php:308
|
119 |
msgid "BWP Google XML Sitemaps"
|
120 |
msgstr ""
|
121 |
|
122 |
+
#: includes/class-bwp-simple-gxs.php:310
|
123 |
msgid "BWP Google XML Sitemaps Statistics"
|
124 |
msgstr ""
|
125 |
|
126 |
+
#: includes/class-bwp-simple-gxs.php:311
|
127 |
msgid "BWP Google XML Sitemaps Generator"
|
128 |
msgstr ""
|
129 |
|
130 |
+
#: includes/class-bwp-simple-gxs.php:322
|
131 |
msgid "You do not have sufficient permissions to access this page."
|
132 |
msgstr ""
|
133 |
|
134 |
+
#: includes/class-bwp-simple-gxs.php:343
|
135 |
+
#: includes/class-bwp-simple-gxs.php:587
|
136 |
+
#: includes/class-bwp-simple-gxs.php:589
|
137 |
+
msgid "Notice"
|
138 |
+
msgstr ""
|
139 |
+
|
140 |
+
#: includes/class-bwp-simple-gxs.php:343
|
141 |
+
msgid "All logs have been cleared successfully!"
|
142 |
+
msgstr ""
|
143 |
+
|
144 |
+
#: includes/class-bwp-simple-gxs.php:350
|
145 |
msgid "What are Sitemaps?"
|
146 |
msgstr ""
|
147 |
|
148 |
+
#: includes/class-bwp-simple-gxs.php:351
|
149 |
msgid "Your sitemaps"
|
150 |
msgstr ""
|
151 |
|
152 |
+
#: includes/class-bwp-simple-gxs.php:352
|
153 |
msgid "Submit your sitemaps"
|
154 |
msgstr ""
|
155 |
|
156 |
+
#: includes/class-bwp-simple-gxs.php:353
|
157 |
msgid "Pinging search engines"
|
158 |
msgstr ""
|
159 |
|
160 |
+
#: includes/class-bwp-simple-gxs.php:354
|
161 |
msgid "Enable pinging functionality?"
|
162 |
msgstr ""
|
163 |
|
164 |
+
#: includes/class-bwp-simple-gxs.php:355
|
165 |
msgid "Enable pinging individual SE"
|
166 |
msgstr ""
|
167 |
|
168 |
+
#: includes/class-bwp-simple-gxs.php:356
|
169 |
msgid "Sitemap Generator's Log"
|
170 |
msgstr ""
|
171 |
|
172 |
+
#: includes/class-bwp-simple-gxs.php:357
|
173 |
msgid "Enable logging?"
|
174 |
msgstr ""
|
175 |
|
176 |
+
#: includes/class-bwp-simple-gxs.php:358
|
177 |
msgid "Enable debugging?"
|
178 |
msgstr ""
|
179 |
|
180 |
+
#: includes/class-bwp-simple-gxs.php:368
|
181 |
msgid "In its simplest form, a Sitemap is an XML file that lists URLs for a site along with additional metadata about each URL (when it was last updated, how often it usually changes, and how important it is, relative to other URLs in the site) so that search engines can more intelligently crawl the site — <em>http://www.sitemaps.org/</em>"
|
182 |
msgstr ""
|
183 |
|
184 |
+
#: includes/class-bwp-simple-gxs.php:368
|
185 |
+
msgid "This plugin helps you generate both Sitemap Index files as well as normal Sitemap files. A Sitemap Index, as its name suggests, is one kind of sitemaps that allows you to group multiple sitemap files inside it."
|
186 |
+
msgstr ""
|
187 |
+
|
188 |
+
#: includes/class-bwp-simple-gxs.php:369
|
189 |
msgid "<em>Basic information about all your sitemaps.</em>"
|
190 |
msgstr ""
|
191 |
|
192 |
+
#: includes/class-bwp-simple-gxs.php:370
|
193 |
msgid "<em>More detailed information about how your sitemaps are generated including <span style=\"color: #999999;\">notices</span>, <span style=\"color: #FF0000;\">errors</span> and <span style=\"color: #009900;\">success messages</span>.</em>"
|
194 |
msgstr ""
|
195 |
|
196 |
+
#: includes/class-bwp-simple-gxs.php:371
|
197 |
#, php-format
|
198 |
msgid "<em>Submit your sitemapindex to major search engines like <a href=\"%s\" target=\"_blank\">Google</a>, <a href=\"%s\" target=\"_blank\">Yahoo</a>, <a href=\"%s\" target=\"_blank\">Bing</a> or <a href=\"%s\" target=\"_blank\">Ask</a>.</em>"
|
199 |
msgstr ""
|
200 |
|
201 |
+
#: includes/class-bwp-simple-gxs.php:372
|
202 |
msgid "<em>Now when you post something new to your blog, you can <em>ping</em> those search engines to tell them your blog just got updated. Pinging could be less effective than you think it is but you should enable such feature anyway.</em>"
|
203 |
msgstr ""
|
204 |
|
205 |
+
#: includes/class-bwp-simple-gxs.php:377
|
206 |
msgid "Selected SE below will be pinged when you publish new posts."
|
207 |
msgstr ""
|
208 |
|
209 |
+
#: includes/class-bwp-simple-gxs.php:378
|
210 |
msgid "No additional load is needed so enabling this is recommended."
|
211 |
msgstr ""
|
212 |
|
213 |
+
#: includes/class-bwp-simple-gxs.php:379
|
214 |
msgid "Minor errors will be printed on screen. Also, when debug is on, no caching is used, useful when you develop new modules."
|
215 |
msgstr ""
|
216 |
|
217 |
+
#: includes/class-bwp-simple-gxs.php:380
|
218 |
msgid "Google"
|
219 |
msgstr ""
|
220 |
|
221 |
+
#: includes/class-bwp-simple-gxs.php:381
|
222 |
#, php-format
|
223 |
msgid "Yahoo — <a href=\"%s\" target=\"_blank\">important</a>"
|
224 |
msgstr ""
|
225 |
|
226 |
+
#: includes/class-bwp-simple-gxs.php:382
|
227 |
msgid "Bing"
|
228 |
msgstr ""
|
229 |
|
230 |
+
#: includes/class-bwp-simple-gxs.php:383
|
231 |
msgid "Ask.com"
|
232 |
msgstr ""
|
233 |
|
234 |
+
#: includes/class-bwp-simple-gxs.php:386
|
235 |
#, php-format
|
236 |
msgid "After you activate this plugin, all sitemaps should be available right away. The next step is to submit the sitemapindex to major search engines. You only need the <strong>sitemapindex</strong> and nothing else, those search engines will automatically recognize other included sitemaps. You can read a small <a href=\"%s\">How-to</a> if you are interested."
|
237 |
msgstr ""
|
238 |
|
239 |
+
#: includes/class-bwp-simple-gxs.php:414
|
240 |
msgid "Output no more than"
|
241 |
msgstr ""
|
242 |
|
243 |
+
#: includes/class-bwp-simple-gxs.php:415
|
244 |
msgid "Default change frequency"
|
245 |
msgstr ""
|
246 |
|
247 |
+
#: includes/class-bwp-simple-gxs.php:416
|
248 |
msgid "Default priority"
|
249 |
msgstr ""
|
250 |
|
251 |
+
#: includes/class-bwp-simple-gxs.php:417
|
252 |
msgid "Minimum priority"
|
253 |
msgstr ""
|
254 |
|
255 |
+
#: includes/class-bwp-simple-gxs.php:418
|
256 |
+
msgid "Use GMT for Last Modified date?"
|
|
|
|
|
|
|
|
|
257 |
msgstr ""
|
258 |
|
259 |
+
#: includes/class-bwp-simple-gxs.php:419
|
260 |
msgid "Style your sitemaps with an XSLT stylesheet?"
|
261 |
msgstr ""
|
262 |
|
263 |
+
#: includes/class-bwp-simple-gxs.php:420
|
264 |
msgid "Custom XSLT stylesheet URL"
|
265 |
msgstr ""
|
266 |
|
267 |
+
#: includes/class-bwp-simple-gxs.php:421
|
268 |
msgid "Show build stats in sitemaps?"
|
269 |
msgstr ""
|
270 |
|
271 |
+
#: includes/class-bwp-simple-gxs.php:422
|
272 |
msgid "Enable credit?"
|
273 |
msgstr ""
|
274 |
|
275 |
+
#: includes/class-bwp-simple-gxs.php:423
|
276 |
msgid "Enable Gzip?"
|
277 |
msgstr ""
|
278 |
|
279 |
+
#: includes/class-bwp-simple-gxs.php:424
|
280 |
+
msgid "Clean unexpected output before sitemap generation?"
|
281 |
+
msgstr ""
|
282 |
+
|
283 |
+
#: includes/class-bwp-simple-gxs.php:425
|
284 |
+
msgid "Sitemap Index Options"
|
285 |
+
msgstr ""
|
286 |
+
|
287 |
+
#: includes/class-bwp-simple-gxs.php:426
|
288 |
+
msgid "Automatically split post-based sitemaps into smaller sitemaps?"
|
289 |
+
msgstr ""
|
290 |
+
|
291 |
+
#: includes/class-bwp-simple-gxs.php:427
|
292 |
+
msgid "Add sitemapindex to individual blog's virtual robots.txt?"
|
293 |
+
msgstr ""
|
294 |
+
|
295 |
+
#: includes/class-bwp-simple-gxs.php:428
|
296 |
+
msgid "Add sitemapindex from all blogs within network to primary blog's virtual robots.txt?"
|
297 |
+
msgstr ""
|
298 |
+
|
299 |
+
#: includes/class-bwp-simple-gxs.php:429
|
300 |
+
msgid "In sitemapindex, include"
|
301 |
+
msgstr ""
|
302 |
+
|
303 |
+
#: includes/class-bwp-simple-gxs.php:430
|
304 |
+
msgid "Exclude following post types:"
|
305 |
+
msgstr ""
|
306 |
+
|
307 |
+
#: includes/class-bwp-simple-gxs.php:431
|
308 |
+
msgid "Exclude following taxonomies:"
|
309 |
+
msgstr ""
|
310 |
+
|
311 |
+
#: includes/class-bwp-simple-gxs.php:432
|
312 |
msgid "Module Options"
|
313 |
msgstr ""
|
314 |
|
315 |
+
#: includes/class-bwp-simple-gxs.php:433
|
316 |
msgid "Alternate module directory"
|
317 |
msgstr ""
|
318 |
|
319 |
+
#: includes/class-bwp-simple-gxs.php:434
|
320 |
msgid "Get no more than"
|
321 |
msgstr ""
|
322 |
|
323 |
+
#: includes/class-bwp-simple-gxs.php:435
|
324 |
msgid "Caching Options"
|
325 |
msgstr ""
|
326 |
|
327 |
+
#: includes/class-bwp-simple-gxs.php:436
|
328 |
msgid "Enable caching?"
|
329 |
msgstr ""
|
330 |
|
331 |
+
#: includes/class-bwp-simple-gxs.php:437
|
332 |
msgid "Enable auto cache re-generation?"
|
333 |
msgstr ""
|
334 |
|
335 |
+
#: includes/class-bwp-simple-gxs.php:438
|
336 |
msgid "Cached sitemaps will last for"
|
337 |
msgstr ""
|
338 |
|
339 |
+
#: includes/class-bwp-simple-gxs.php:439
|
340 |
msgid "Cached sitemaps are stored in (auto detected)"
|
341 |
msgstr ""
|
342 |
|
343 |
+
#: includes/class-bwp-simple-gxs.php:443
|
344 |
msgid "<em>Cache your sitemaps for better performance.</em>"
|
345 |
msgstr ""
|
346 |
|
347 |
+
#: includes/class-bwp-simple-gxs.php:444
|
348 |
#, php-format
|
349 |
msgid "<em>This plugin uses modules to build sitemap data so it is recommended that you extend this plugin using modules rather than hooks. Some of the settings below only affect modules extending the base module class. Read more about using modules <a href=\"%s#using-modules\">here</a>.</em>"
|
350 |
msgstr ""
|
351 |
|
352 |
+
#: includes/class-bwp-simple-gxs.php:445
|
353 |
+
msgid "<em>Here you can change some settings that affect the default Sitemap Index file.</em>"
|
354 |
+
msgstr ""
|
355 |
+
|
356 |
+
#: includes/class-bwp-simple-gxs.php:459
|
357 |
+
#: includes/class-bwp-simple-gxs.php:465
|
358 |
msgid "second(s)"
|
359 |
msgstr ""
|
360 |
|
361 |
+
#: includes/class-bwp-simple-gxs.php:460
|
362 |
+
#: includes/class-bwp-simple-gxs.php:466
|
363 |
msgid "minute(s)"
|
364 |
msgstr ""
|
365 |
|
366 |
+
#: includes/class-bwp-simple-gxs.php:461
|
367 |
+
#: includes/class-bwp-simple-gxs.php:467
|
368 |
msgid "hour(s)"
|
369 |
msgstr ""
|
370 |
|
371 |
+
#: includes/class-bwp-simple-gxs.php:462
|
372 |
+
#: includes/class-bwp-simple-gxs.php:468
|
373 |
msgid "day(s)"
|
374 |
msgstr ""
|
375 |
|
376 |
+
#: includes/class-bwp-simple-gxs.php:475
|
377 |
+
#: includes/class-bwp-simple-gxs.php:476
|
378 |
+
#: includes/class-bwp-simple-gxs.php:477
|
379 |
msgid "read more"
|
380 |
msgstr ""
|
381 |
|
382 |
+
#: includes/class-bwp-simple-gxs.php:480
|
383 |
msgid "your sitemaps are generated and then cached to reduce unnecessary work."
|
384 |
msgstr ""
|
385 |
|
386 |
+
#: includes/class-bwp-simple-gxs.php:481
|
387 |
msgid "when a cached sitemap expires, this plugin will try to generate the cache again. If you disable this, remember to manually flush the cache once in a while."
|
388 |
msgstr ""
|
389 |
|
390 |
+
#: includes/class-bwp-simple-gxs.php:481
|
391 |
msgid "Flush the cache"
|
392 |
msgstr ""
|
393 |
|
394 |
+
#: includes/class-bwp-simple-gxs.php:482
|
395 |
msgid "tell you useful information such as build time, memory usage, SQL queries, etc."
|
396 |
msgstr ""
|
397 |
|
398 |
+
#: includes/class-bwp-simple-gxs.php:483
|
399 |
#, php-format
|
400 |
+
msgid "make your sitemaps ~ 70% smaller. <strong>Important:</strong> If you see an error after enabling this, it's very likely that you have gzip active on your server already."
|
401 |
msgstr ""
|
402 |
|
403 |
+
#: includes/class-bwp-simple-gxs.php:484
|
404 |
+
msgid "only disable this when sitemaps appear in either blank page or plain text."
|
405 |
msgstr ""
|
406 |
|
407 |
+
#: includes/class-bwp-simple-gxs.php:485
|
408 |
+
#, php-format
|
409 |
+
msgid "If you have like 50 blogs, 50 <code>Sitemap: http://example.com/sitemapindex.xml</code> entries will be added to your primary blog's robots.txt, i.e. <code>%s</code>."
|
410 |
msgstr ""
|
411 |
|
412 |
+
#: includes/class-bwp-simple-gxs.php:486
|
413 |
+
msgid "taxonomy archives' sitemaps, including custom taxonomies."
|
414 |
msgstr ""
|
415 |
|
416 |
+
#: includes/class-bwp-simple-gxs.php:488
|
417 |
msgid "date archives' sitemaps."
|
418 |
msgstr ""
|
419 |
|
420 |
+
#: includes/class-bwp-simple-gxs.php:489
|
421 |
+
msgid "external pages' sitemap. This allows you to add links to pages that do not belong to WordPress to the sitemap."
|
422 |
+
msgstr ""
|
423 |
+
|
424 |
+
#: includes/class-bwp-simple-gxs.php:490
|
425 |
msgid "some copyrighted info is also added to your sitemaps. Thanks!"
|
426 |
msgstr ""
|
427 |
|
428 |
+
#: includes/class-bwp-simple-gxs.php:491
|
429 |
+
msgid "This will load the default style sheet provided by this plugin. You can set a custom style sheet below or filter the <code>bwp_gxs_xslt</code> hook."
|
430 |
msgstr ""
|
431 |
|
432 |
+
#: includes/class-bwp-simple-gxs.php:492
|
433 |
#, php-format
|
434 |
msgid "If you're on a Multi-site installation with Sub-domain enabled, each site will have its own robots.txt, sites in sub-directory will not. Please read the <a href=\"%s#toc-robots\" target=\"_blank\">documentation</a> for more info."
|
435 |
msgstr ""
|
436 |
|
437 |
+
#: includes/class-bwp-simple-gxs.php:493
|
438 |
+
msgid "e.g. post1.xml, post2.xml, etc. And each sitemap will contain"
|
439 |
msgstr ""
|
440 |
|
441 |
+
#: includes/class-bwp-simple-gxs.php:494
|
442 |
+
msgid "If you disable this, make sure you also use <code>date_default_timezone_set</code> to correctly set up a timezone for your application."
|
443 |
+
msgstr ""
|
444 |
+
|
445 |
+
#: includes/class-bwp-simple-gxs.php:495
|
446 |
+
msgid "author archives' sitemap."
|
447 |
+
msgstr ""
|
448 |
+
|
449 |
+
#: includes/class-bwp-simple-gxs.php:496
|
450 |
+
msgid "site's home URL sitemap. For a multi-site installation of WordPress, this sitemap will list all domains within your network, not just the main blog. This also supports WPMU Domain Mapping plugin."
|
451 |
+
msgstr ""
|
452 |
+
|
453 |
+
#: includes/class-bwp-simple-gxs.php:499
|
454 |
+
msgid "item(s) in one sitemap. You can not go over 50,000."
|
455 |
+
msgstr ""
|
456 |
+
|
457 |
+
#: includes/class-bwp-simple-gxs.php:500
|
458 |
+
msgid "item(s). Again , you can not go over 50,000."
|
459 |
+
msgstr ""
|
460 |
+
|
461 |
+
#: includes/class-bwp-simple-gxs.php:501
|
462 |
msgid "Input a full path to the directory where you put your own modules (e.g. <code>/home/mysite/public_html/gxs-modules/</code>), you can also override a built-in module by having a module with the same filename in this directory. A filter is also available if you would like to use PHP instead."
|
463 |
msgstr ""
|
464 |
|
465 |
+
#: includes/class-bwp-simple-gxs.php:502
|
466 |
msgid "The cache directory must be writable (i.e. CHMOD to 755 or 777)."
|
467 |
msgstr ""
|
468 |
|
469 |
+
#: includes/class-bwp-simple-gxs.php:503
|
470 |
msgid "item(s) in one SQL query. This helps you avoid running too heavy queries."
|
471 |
msgstr ""
|
472 |
|
473 |
+
#: includes/class-bwp-simple-gxs.php:506
|
474 |
msgid "expected to be an absolute URL, e.g. <code>http://example.com/my-stylesheet.xsl</code>. You must also have a style sheet for the sitemapindex that can be accessed through the above URL, e.g. <code>my-stylesheet.xsl</code> and <code>my-stylesheetindex.xsl</code>). Please leave blank if you do not wish to use."
|
475 |
msgstr ""
|
476 |
|
477 |
+
#: includes/class-bwp-simple-gxs.php:513
|
478 |
+
#, php-format
|
479 |
+
msgid "<em><strong>Note:</strong> If you encounter white page problem, please refer to the <a target=\"_blank\" href=\"%s\">FAQ section</a> to know how to change this limit appropriately to make this plugin work. Also note that, for post-based sitemaps, this option will be overridden by the limit you set in the Sitemap Index Options below.</em>"
|
480 |
msgstr ""
|
481 |
|
482 |
+
#: includes/class-bwp-simple-gxs.php:587
|
483 |
#, php-format
|
484 |
msgid "<strong>%d</strong> cached sitemaps have been flushed successfully!"
|
485 |
msgstr ""
|
486 |
|
487 |
+
#: includes/class-bwp-simple-gxs.php:589
|
488 |
msgid "Could not delete any cached sitemaps. Please manually check the cache directory."
|
489 |
msgstr ""
|
490 |
|
491 |
+
#: includes/class-bwp-simple-gxs.php:658
|
492 |
msgid "Warning"
|
493 |
msgstr ""
|
494 |
|
495 |
+
#: includes/class-bwp-simple-gxs.php:658
|
496 |
msgid "Cache directory does not exist or is not writable. Please read more about directory permission <a href='http://www.zzee.com/solutions/unix-permissions.shtml'>here</a> (Unix)."
|
497 |
msgstr ""
|
498 |
|
499 |
+
#: includes/class-bwp-simple-gxs.php:669
|
500 |
+
msgid "Clear All Logs"
|
501 |
+
msgstr ""
|
502 |
+
|
503 |
+
#: includes/class-bwp-simple-gxs.php:723
|
504 |
msgid "(Debug is on)"
|
505 |
msgstr ""
|
506 |
|
507 |
+
#: includes/class-bwp-simple-gxs.php:736
|
508 |
msgid "<strong>BWP Google XML Sitemaps Error:</strong> "
|
509 |
msgstr ""
|
510 |
|
511 |
+
#: includes/class-bwp-simple-gxs.php:736
|
512 |
msgid "BWP Google XML Sitemaps Error"
|
513 |
msgstr ""
|
514 |
|
515 |
+
#: includes/class-bwp-simple-gxs.php:759
|
516 |
#, php-format
|
517 |
msgid "Nothing here... yet! Try submitting your <a href=\"%s\">sitemapindex</a> first!"
|
518 |
msgstr ""
|
519 |
|
520 |
+
#: includes/class-bwp-simple-gxs.php:759
|
521 |
msgid "No log yet!"
|
522 |
msgstr ""
|
523 |
|
524 |
+
#: includes/class-bwp-simple-gxs.php:769
|
|
|
|
|
|
|
|
|
|
|
525 |
#, php-format
|
526 |
msgid "<a href=\"%s\" target=\"_blank\">%s</a> has been successfully built on <strong>%s</strong>."
|
527 |
msgstr ""
|
528 |
|
529 |
+
#: includes/class-bwp-simple-gxs.php:779
|
530 |
+
#: includes/class-bwp-simple-gxs.php:796
|
531 |
msgid "M j, Y : H:i:s"
|
532 |
msgstr ""
|
533 |
|
534 |
+
#: includes/class-bwp-simple-gxs.php:1089
|
535 |
#, php-format
|
536 |
msgid "Requested module (<em>%s</em>) not found or not allowed."
|
537 |
msgstr ""
|
538 |
|
539 |
+
#: includes/class-bwp-simple-gxs.php:1148
|
540 |
+
#: includes/class-bwp-simple-gxs.php:1168
|
541 |
#, php-format
|
542 |
msgid "Loaded a custom sub-module file: <strong>%s</strong>."
|
543 |
msgstr ""
|
544 |
|
545 |
+
#: includes/class-bwp-simple-gxs.php:1157
|
546 |
#, php-format
|
547 |
msgid "Mapped sub-module file: <strong>%s</strong> is not available in both default and custom module directory. The plugin will now try loading the requested sub-module instead."
|
548 |
msgstr ""
|
549 |
|
550 |
+
#: includes/class-bwp-simple-gxs.php:1176
|
551 |
#, php-format
|
552 |
msgid "Sub-module file: <strong>%s</strong> is not available in both default and custom module directory. The plugin will now try loading the parent module instead."
|
553 |
msgstr ""
|
554 |
|
555 |
+
#: includes/class-bwp-simple-gxs.php:1189
|
556 |
#, php-format
|
557 |
msgid "Loaded a custom module file: <strong>%s</strong>."
|
558 |
msgstr ""
|
559 |
|
560 |
+
#: includes/class-bwp-simple-gxs.php:1195
|
561 |
#, php-format
|
562 |
msgid "Could not load module file: <strong>%s</strong> in both default and custom module directory. Please recheck if that module file exists."
|
563 |
msgstr ""
|
564 |
|
565 |
+
#: includes/class-bwp-simple-gxs.php:1213
|
566 |
#, php-format
|
567 |
msgid "There is no class named <strong>%s</strong> in the module file <strong>%s</strong>."
|
568 |
msgstr ""
|
569 |
|
570 |
+
#: includes/class-bwp-simple-gxs.php:1222
|
571 |
#, php-format
|
572 |
msgid "Loaded a custom sitemapindex module file: <strong>%s</strong>."
|
573 |
msgstr ""
|
574 |
|
575 |
+
#: includes/class-bwp-simple-gxs.php:1245
|
576 |
#, php-format
|
577 |
msgid "Successfully generated <em>%s.xml</em> using module <em>%s</em>."
|
578 |
msgstr ""
|
579 |
|
580 |
+
#: includes/class-bwp-simple-gxs.php:1276
|
581 |
+
msgid "<strong>BWP Google XML Sitemap Message:</strong> Unexpected output (most of the time PHP errors) is preventing BWP GXS from showing any sitemap contents. Try disabling <code>WP_DEBUG</code> or this plugin's debug mode, whichever is on. All unexpected outputs should be shown just above this message. If you don't see any, contact me and I might be able to help."
|
582 |
+
msgstr ""
|
583 |
+
|
584 |
+
#: includes/class-bwp-simple-gxs.php:1382
|
585 |
+
msgid "Unknown response code from search engines. Ping failed."
|
586 |
+
msgstr ""
|
587 |
+
|
588 |
+
#: includes/class-bwp-simple-gxs.php:1384
|
589 |
#, php-format
|
590 |
msgid "Pinged %s successfully!"
|
591 |
msgstr ""
|
592 |
|
593 |
+
#: includes/class-bwp-simple-gxs.php:1389
|
594 |
+
#, php-format
|
595 |
+
msgid "Error %s from %s"
|
596 |
+
msgstr ""
|
597 |
+
|
598 |
+
#: includes/class-bwp-simple-gxs.php:1394
|
599 |
#, php-format
|
600 |
msgid "Ping limit for today to %s has been reached, sorry!"
|
601 |
msgstr ""
|
602 |
|
603 |
+
#: includes/class-bwp-simple-gxs.php:1422
|
604 |
#, php-format
|
605 |
msgid "<em>%s.xml</em> does not have any item. The plugin has fired a 404 header to the search engine that requests it. You should check the module that generates that sitemap (<em>%s.php</em>)."
|
606 |
msgstr ""
|
607 |
|
608 |
+
#: includes/bwp-option-page/includes/class-bwp-option-page.php:80
|
609 |
msgid "Plugin Configurations"
|
610 |
msgstr ""
|
611 |
|
612 |
+
#: includes/bwp-option-page/includes/class-bwp-option-page.php:398
|
613 |
msgid "Save Changes"
|
614 |
msgstr ""
|
615 |
|
includes/bwp-option-page/css/bwp-option-page.css
CHANGED
@@ -83,16 +83,24 @@ p.bwp-option-page-inputs {
|
|
83 |
width: 36px;
|
84 |
}
|
85 |
|
86 |
-
#bwp-
|
87 |
float: right;
|
88 |
-
|
89 |
-
|
|
|
|
|
|
|
|
|
90 |
background-color: #ffffff;
|
91 |
border: 1px solid #cccccc;
|
92 |
text-align: center;
|
93 |
}
|
94 |
|
95 |
-
#bwp-donation
|
|
|
|
|
|
|
|
|
96 |
font-size: 0.8em;
|
97 |
}
|
98 |
|
@@ -101,4 +109,28 @@ p.bwp-option-page-inputs {
|
|
101 |
display: inline-block;
|
102 |
margin: 0 0 1px 2px;
|
103 |
padding: 0px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
}
|
83 |
width: 36px;
|
84 |
}
|
85 |
|
86 |
+
#bwp-info-place {
|
87 |
float: right;
|
88 |
+
margin: 0 0 10px 10px;
|
89 |
+
}
|
90 |
+
|
91 |
+
#bwp-donation, #bwp-contact {
|
92 |
+
width: 255px;
|
93 |
+
padding: 7px; padding-bottom: 0px;
|
94 |
background-color: #ffffff;
|
95 |
border: 1px solid #cccccc;
|
96 |
text-align: center;
|
97 |
}
|
98 |
|
99 |
+
#bwp-donation p {
|
100 |
+
margin: 0.5em 0 1em 0;
|
101 |
+
}
|
102 |
+
|
103 |
+
#bwp-info-place small {
|
104 |
font-size: 0.8em;
|
105 |
}
|
106 |
|
109 |
display: inline-block;
|
110 |
margin: 0 0 1px 2px;
|
111 |
padding: 0px;
|
112 |
+
}
|
113 |
+
|
114 |
+
#bwp-seperator {
|
115 |
+
width: 271px;
|
116 |
+
}
|
117 |
+
|
118 |
+
#bwp-contact {
|
119 |
+
text-align: left;
|
120 |
+
padding: 7px;
|
121 |
+
}
|
122 |
+
|
123 |
+
#bwp-contact a {
|
124 |
+
display: block;
|
125 |
+
height: 20px;
|
126 |
+
font-size: 0.8em;
|
127 |
+
padding-left: 25px;
|
128 |
+
}
|
129 |
+
|
130 |
+
#bwp-contact .bwp-rss {
|
131 |
+
background: transparent url("../images/icon-rss.png") no-repeat left center;
|
132 |
+
}
|
133 |
+
|
134 |
+
#bwp-contact .bwp-twitter {
|
135 |
+
background: transparent url("../images/icon-twitter.png") no-repeat left center;
|
136 |
}
|
includes/bwp-option-page/images/icon-rss.png
ADDED
Binary file
|
includes/bwp-option-page/images/icon-twitter.png
ADDED
Binary file
|
includes/bwp-option-page/includes/class-bwp-option-page.php
CHANGED
@@ -46,13 +46,19 @@ class BWP_OPTION_PAGE {
|
|
46 |
*/
|
47 |
var $form_options = array(), $site_options = array();
|
48 |
|
|
|
|
|
|
|
|
|
|
|
49 |
/**
|
50 |
* Constructor
|
51 |
*/
|
52 |
-
function __construct($form_name = 'bwp_option_page', $site_options = array())
|
53 |
{
|
54 |
$this->form_name = $form_name;
|
55 |
$this->site_options = $site_options;
|
|
|
56 |
}
|
57 |
|
58 |
/**
|
@@ -154,6 +160,7 @@ class BWP_OPTION_PAGE {
|
|
154 |
$checked = 'checked="checked" ';
|
155 |
$selected = 'selected="selected" ';
|
156 |
$value = (isset($this->form_options[$name])) ? $this->form_options[$name] : '';
|
|
|
157 |
$value = ('textarea' == $type) ? esc_html($value) : esc_attr($value);
|
158 |
$array_replace = array();
|
159 |
$array_search = array('size', 'name', 'value', 'cols', 'rows', 'label', 'disabled', 'pre', 'post');
|
@@ -333,7 +340,7 @@ class BWP_OPTION_PAGE {
|
|
333 |
*/
|
334 |
function generate_html_form()
|
335 |
{
|
336 |
-
$return_str = '<div class="wrap">' . "\n";
|
337 |
if (sizeof($this->form_tabs) >= 2)
|
338 |
$return_str .= apply_filters('bwp-admin-form-icon', '<div class="icon32" id="icon-options-general"><br></div>' . "\n");
|
339 |
else
|
46 |
*/
|
47 |
var $form_options = array(), $site_options = array();
|
48 |
|
49 |
+
/**
|
50 |
+
* Other things
|
51 |
+
*/
|
52 |
+
var $domain;
|
53 |
+
|
54 |
/**
|
55 |
* Constructor
|
56 |
*/
|
57 |
+
function __construct($form_name = 'bwp_option_page', $site_options = array(), $domain = '')
|
58 |
{
|
59 |
$this->form_name = $form_name;
|
60 |
$this->site_options = $site_options;
|
61 |
+
$this->domain = $domain;
|
62 |
}
|
63 |
|
64 |
/**
|
160 |
$checked = 'checked="checked" ';
|
161 |
$selected = 'selected="selected" ';
|
162 |
$value = (isset($this->form_options[$name])) ? $this->form_options[$name] : '';
|
163 |
+
$value = (!empty($this->domain) && ('textarea' == $type || 'input' == $type)) ? __($value, $this->domain) : $value;
|
164 |
$value = ('textarea' == $type) ? esc_html($value) : esc_attr($value);
|
165 |
$array_replace = array();
|
166 |
$array_search = array('size', 'name', 'value', 'cols', 'rows', 'label', 'disabled', 'pre', 'post');
|
340 |
*/
|
341 |
function generate_html_form()
|
342 |
{
|
343 |
+
$return_str = '<div class="wrap" style="padding-bottom: 20px;">' . "\n";
|
344 |
if (sizeof($this->form_tabs) >= 2)
|
345 |
$return_str .= apply_filters('bwp-admin-form-icon', '<div class="icon32" id="icon-options-general"><br></div>' . "\n");
|
346 |
else
|
includes/bwp-option-page/js/paypal.js
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
jQuery(document).ready(function(){
|
2 |
+
/* Paypal form */
|
3 |
+
jQuery('.paypal-form select[name="amount"]').change(function() {
|
4 |
+
if (jQuery(this).val() == '100.00')
|
5 |
+
{
|
6 |
+
jQuery(this).hide();
|
7 |
+
jQuery('.paypal-alternate-input').append('<input type="text" style="padding: 3px; width: 70px; text-align: right; line-height: 1;" name="amount" value="15.00" /> <code>$</code>');
|
8 |
+
jQuery('.paypal-alternate-input').show();
|
9 |
+
}
|
10 |
+
});
|
11 |
+
});
|
includes/class-bwp-framework.php
CHANGED
@@ -176,32 +176,56 @@ class BWP_FRAMEWORK {
|
|
176 |
{
|
177 |
$showable = apply_filters('bwp_donation_showable', true);
|
178 |
?>
|
179 |
-
<div id="bwp-
|
180 |
-
<
|
181 |
-
<
|
|
|
|
|
|
|
|
|
182 |
<?php
|
183 |
if (true == $showable || ($this->is_multisite() && is_super_admin()))
|
184 |
{
|
185 |
?>
|
186 |
-
<small><?php _e('You can buy me some coffees if you appreciate my work, thank you!', $this->plugin_dkey); ?></small>
|
187 |
-
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
|
188 |
<p>
|
189 |
-
<input type="hidden" name="cmd" value="
|
190 |
-
<input type="hidden" name="
|
191 |
-
<
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
<input
|
|
|
197 |
<input type="hidden" name="currency_code" value="USD">
|
198 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
199 |
</p>
|
200 |
</form>
|
201 |
<?php
|
202 |
}
|
203 |
?>
|
204 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
205 |
<?php
|
206 |
}
|
207 |
|
@@ -285,16 +309,21 @@ class BWP_FRAMEWORK {
|
|
285 |
$db_option = get_option($option);
|
286 |
if ($db_option && is_array($db_option))
|
287 |
$options = array_merge($options, $db_option);
|
288 |
-
|
289 |
-
|
290 |
-
if ($
|
291 |
{
|
292 |
-
|
|
|
293 |
{
|
294 |
-
|
295 |
-
|
|
|
|
|
|
|
|
|
|
|
296 |
}
|
297 |
-
$options = array_merge($options, $this->site_options);
|
298 |
}
|
299 |
}
|
300 |
$this->options = $options;
|
@@ -354,8 +383,9 @@ class BWP_FRAMEWORK {
|
|
354 |
// Load option page builder
|
355 |
if (!class_exists('BWP_OPTION_PAGE'))
|
356 |
require_once(dirname(__FILE__) . '/bwp-option-page/bwp-option-page.php');
|
357 |
-
// Enqueue style for the option page
|
358 |
-
wp_enqueue_style('bwp-option-page', plugin_dir_url($this->plugin_file) . 'includes/bwp-option-page/css/bwp-option-page.css');
|
|
|
359 |
}
|
360 |
$this->build_menus();
|
361 |
}
|
176 |
{
|
177 |
$showable = apply_filters('bwp_donation_showable', true);
|
178 |
?>
|
179 |
+
<div id="bwp-info-place">
|
180 |
+
<div id="bwp-donation" style="margin-bottom: 0px;">
|
181 |
+
<a href="<?php echo $this->plugin_url; ?>"><?php echo $this->plugin_title; ?></a> <small>v<?php echo $this->plugin_ver; ?></small><br />
|
182 |
+
<small>
|
183 |
+
<a href="<?php echo str_replace('/wordpress-plugins/', '/topic/', $this->plugin_url); ?>"><?php _e('Development Log', $this->plugin_dkey); ?></a> – <a href="<?php echo $this->plugin_url . 'faq/'; ?>" title="<?php _e('Frequently Asked Questions', $this->plugin_dkey) ?>"><?php _e('FAQ', $this->plugin_dkey); ?></a> – <a href="http://betterwp.net/contact/" title="<?php _e('Got a problem? Send me a feedback!', $this->plugin_dkey) ?>"><?php _e('Contact', $this->plugin_dkey); ?></a>
|
184 |
+
</small>
|
185 |
+
<br />
|
186 |
<?php
|
187 |
if (true == $showable || ($this->is_multisite() && is_super_admin()))
|
188 |
{
|
189 |
?>
|
190 |
+
<small><?php _e('You can buy me some special coffees if you appreciate my work, thank you!', $this->plugin_dkey); ?></small>
|
191 |
+
<form class="paypal-form" action="https://www.paypal.com/cgi-bin/webscr" method="post">
|
192 |
<p>
|
193 |
+
<input type="hidden" name="cmd" value="_xclick">
|
194 |
+
<input type="hidden" name="business" value="NWBB8JUDW5VSY">
|
195 |
+
<input type="hidden" name="lc" value="VN">
|
196 |
+
<input type="hidden" name="button_subtype" value="services">
|
197 |
+
<input type="hidden" name="no_note" value="0">
|
198 |
+
<input type="hidden" name="cn" value="Would you like to say anything to me?">
|
199 |
+
<input type="hidden" name="no_shipping" value="1">
|
200 |
+
<input type="hidden" name="rm" value="1">
|
201 |
+
<input type="hidden" name="return" value="http://betterwp.net">
|
202 |
<input type="hidden" name="currency_code" value="USD">
|
203 |
+
<input type="hidden" name="bn" value="PP-BuyNowBF:icon-paypal.gif:NonHosted">
|
204 |
+
<input type="hidden" name="item_name" value="<?php echo __('Donate to ' . $this->plugin_title, $this->plugin_dkey); ?>" />
|
205 |
+
<select name="amount">
|
206 |
+
<option value="5.00"><?php _e('One cup $5.00', $this->plugin_dkey); ?></option>
|
207 |
+
<option value="10.00"><?php _e('Two cups $10.00', $this->plugin_dkey); ?></option>
|
208 |
+
<option value="25.00"><?php _e('Five cups! $25.00', $this->plugin_dkey); ?></option>
|
209 |
+
<option value="50.00"><?php _e('One LL-cup!!! $50.00', $this->plugin_dkey); ?></option>
|
210 |
+
<option value="100.00"><?php _e('... or any amount!', $this->plugin_dkey); ?></option>
|
211 |
+
</select>
|
212 |
+
<span class="paypal-alternate-input" style="display: none;"><!-- --></span>
|
213 |
+
<input class="paypal-submit" type="image" src="<?php echo plugin_dir_url($this->plugin_file) . 'includes/bwp-option-page/images/icon-paypal.gif'; ?>" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!" />
|
214 |
+
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
|
215 |
</p>
|
216 |
</form>
|
217 |
<?php
|
218 |
}
|
219 |
?>
|
220 |
</div>
|
221 |
+
<div id="bwp-seperator">
|
222 |
+
<div style="height: 10px; width: 5px; background-color: #cccccc; margin: 0 auto;"><!-- --></div>
|
223 |
+
</div>
|
224 |
+
<div id="bwp-contact">
|
225 |
+
<a class="bwp-rss" href="http://feeds.feedburner.com/BetterWPnet"><?php _e('Latest updates from BetterWP.net!', $this->plugin_dkey); ?></a>
|
226 |
+
<a class="bwp-twitter" href="http://twitter.com/0dd0ne0ut"><?php _e('Follow me on Twitter!', $this->plugin_dkey); ?></a>
|
227 |
+
</div>
|
228 |
+
</div>
|
229 |
<?php
|
230 |
}
|
231 |
|
309 |
$db_option = get_option($option);
|
310 |
if ($db_option && is_array($db_option))
|
311 |
$options = array_merge($options, $db_option);
|
312 |
+
unset($db_option);
|
313 |
+
// Also check for global options if in Multi-site
|
314 |
+
if ($this->is_multisite())
|
315 |
{
|
316 |
+
$db_option = get_site_option($option);
|
317 |
+
if ($db_option && is_array($db_option))
|
318 |
{
|
319 |
+
$temp = array();
|
320 |
+
foreach ($db_option as $k => $o)
|
321 |
+
{
|
322 |
+
if (in_array($k, $this->site_options))
|
323 |
+
$temp[$k] = $o;
|
324 |
+
}
|
325 |
+
$options = array_merge($options, $temp);
|
326 |
}
|
|
|
327 |
}
|
328 |
}
|
329 |
$this->options = $options;
|
383 |
// Load option page builder
|
384 |
if (!class_exists('BWP_OPTION_PAGE'))
|
385 |
require_once(dirname(__FILE__) . '/bwp-option-page/bwp-option-page.php');
|
386 |
+
// Enqueue style sheets and scripts for the option page
|
387 |
+
wp_enqueue_style('bwp-option-page', plugin_dir_url($this->plugin_file) . 'includes/bwp-option-page/css/bwp-option-page.css', array(), '1.0.1');
|
388 |
+
wp_enqueue_script('bwp-paypal-js', plugin_dir_url($this->plugin_file) . 'includes/bwp-option-page/js/paypal.js', array('jquery'));
|
389 |
}
|
390 |
$this->build_menus();
|
391 |
}
|
includes/class-bwp-gxs-cache.php
CHANGED
@@ -66,7 +66,9 @@ class BWP_GXS_CACHE {
|
|
66 |
global $bwp_gxs;
|
67 |
// Build cache file name, WPMS compatible
|
68 |
$file_name = 'gxs_' . md5($this->module . '_' . get_option('home'));
|
69 |
-
$file_name .= (true == $this->gzip) ? '.xml.gz' : '.xml';
|
|
|
|
|
70 |
$this->cache_file = trailingslashit($this->cache_dir) . $file_name;
|
71 |
$this->cache_ok = true;
|
72 |
|
@@ -106,7 +108,6 @@ class BWP_GXS_CACHE {
|
|
106 |
$bwp_gxs->slog(sprintf(__('Successfully served a cached version of <em>%s.xml</em>.', 'bwp-simple-gxs'), $this->module_name), true);
|
107 |
$bwp_gxs->commit_logs();
|
108 |
header('HTTP/1.1 304 Not Modified');
|
109 |
-
ob_end_clean();
|
110 |
exit();
|
111 |
}
|
112 |
}
|
@@ -119,22 +120,11 @@ class BWP_GXS_CACHE {
|
|
119 |
|
120 |
$file = $this->cache_file;
|
121 |
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
@flock($handle, LOCK_UN);
|
128 |
-
@gzclose($handle);
|
129 |
-
}
|
130 |
-
else
|
131 |
-
{
|
132 |
-
$handle = @fopen($file, 'wb');
|
133 |
-
@flock($handle, LOCK_EX);
|
134 |
-
@fwrite($handle, $bwp_gxs->output);
|
135 |
-
@flock($handle, LOCK_UN);
|
136 |
-
@fclose($handle);
|
137 |
-
}
|
138 |
|
139 |
@umask(0000);
|
140 |
@chmod($file, 0666);
|
66 |
global $bwp_gxs;
|
67 |
// Build cache file name, WPMS compatible
|
68 |
$file_name = 'gxs_' . md5($this->module . '_' . get_option('home'));
|
69 |
+
// $file_name .= (true == $this->gzip) ? '.xml.gz' : '.xml';
|
70 |
+
// Use gz all the time to save space
|
71 |
+
$file_name .= '.xml.gz';
|
72 |
$this->cache_file = trailingslashit($this->cache_dir) . $file_name;
|
73 |
$this->cache_ok = true;
|
74 |
|
108 |
$bwp_gxs->slog(sprintf(__('Successfully served a cached version of <em>%s.xml</em>.', 'bwp-simple-gxs'), $this->module_name), true);
|
109 |
$bwp_gxs->commit_logs();
|
110 |
header('HTTP/1.1 304 Not Modified');
|
|
|
111 |
exit();
|
112 |
}
|
113 |
}
|
120 |
|
121 |
$file = $this->cache_file;
|
122 |
|
123 |
+
$handle = @gzopen($file, 'wb');
|
124 |
+
@flock($handle, LOCK_EX);
|
125 |
+
@gzwrite($handle, $bwp_gxs->output);
|
126 |
+
@flock($handle, LOCK_UN);
|
127 |
+
@gzclose($handle);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
|
129 |
@umask(0000);
|
130 |
@chmod($file, 0666);
|
includes/class-bwp-gxs-module.php
CHANGED
@@ -21,11 +21,12 @@ class BWP_GXS_MODULE {
|
|
21 |
*/
|
22 |
var $freq_to_pri = array('always' => 1.0, 'hourly' => 0.8, 'daily' => 0.7, 'weekly' => 0.6, 'monthly' => 0.4, 'yearly' => 0.3, 'never' => 0.2);
|
23 |
|
24 |
-
var $comment_count = 0, $now, $url_sofar = 0, $circle = 0;
|
|
|
25 |
|
26 |
function __contruct()
|
27 |
{
|
28 |
-
|
29 |
}
|
30 |
|
31 |
function set_current_time()
|
@@ -37,15 +38,16 @@ class BWP_GXS_MODULE {
|
|
37 |
{
|
38 |
global $bwp_gxs;
|
39 |
|
40 |
-
if (empty($pre_data) || sizeof($pre_data) == 0)
|
41 |
-
return array();
|
42 |
-
|
43 |
if (empty($this->now))
|
44 |
$this->set_current_time();
|
45 |
|
46 |
$data['location'] = '';
|
47 |
$data['lastmod'] = (!empty($pre_data['lastmod'])) ? strtotime($pre_data['lastmod']) - $bwp_gxs->oldest_time : $this->now - $bwp_gxs->oldest_time;
|
48 |
$data['lastmod'] = $this->format_lastmod($data['lastmod']);
|
|
|
|
|
|
|
|
|
49 |
if (isset($pre_data['freq'])) $data['freq'] = $pre_data['freq'];
|
50 |
if (isset($pre_data['priority'])) $data['priority'] = $pre_data['priority'];
|
51 |
|
@@ -59,7 +61,12 @@ class BWP_GXS_MODULE {
|
|
59 |
if (!$bwp_gxs->use_permalink)
|
60 |
return get_option('home') . '/?' . $bwp_gxs->query_var_non_perma . '=' . $slug;
|
61 |
else
|
62 |
-
|
|
|
|
|
|
|
|
|
|
|
63 |
}
|
64 |
|
65 |
/**
|
@@ -67,18 +74,20 @@ class BWP_GXS_MODULE {
|
|
67 |
*
|
68 |
* @copyright (c) 2006 - 2009 www.phpbb-seo.com
|
69 |
*/
|
70 |
-
function cal_frequency($item = '')
|
71 |
{
|
72 |
global $bwp_gxs;
|
73 |
|
74 |
if (empty($this->now))
|
75 |
$this->now = $this->set_current_time();
|
76 |
|
77 |
-
|
78 |
-
|
|
|
|
|
79 |
else
|
80 |
{
|
81 |
-
$time = $this->now -
|
82 |
$freq = $time > 30000000 ? 'yearly' : ($time > 2592000 ? 'monthly' : ($time > 604800 ? 'weekly' : ($time > 86400 ? 'daily' : ($time > 43200 ? 'hourly' : 'always'))));
|
83 |
}
|
84 |
return apply_filters('bwp_gxs_freq', $freq, $item);
|
@@ -117,7 +126,11 @@ class BWP_GXS_MODULE {
|
|
117 |
|
118 |
function format_lastmod($lastmod)
|
119 |
{
|
120 |
-
|
|
|
|
|
|
|
|
|
121 |
}
|
122 |
|
123 |
function post_type_uses($post_type, $taxonomy_object)
|
@@ -132,8 +145,9 @@ class BWP_GXS_MODULE {
|
|
132 |
if (!isset($result) || !is_array($result))
|
133 |
return false;
|
134 |
|
135 |
-
|
136 |
{
|
|
|
137 |
if ($post_type == $post->post_type)
|
138 |
return $post;
|
139 |
}
|
@@ -147,13 +161,198 @@ class BWP_GXS_MODULE {
|
|
147 |
return false;
|
148 |
// Obtain a list of columns
|
149 |
$lastmod = array();
|
150 |
-
|
151 |
-
$lastmod[$
|
152 |
-
// Sort the data with volume descending, edition ascending
|
153 |
// Add $data as the last parameter, to sort by the common key
|
154 |
array_multisort($lastmod, SORT_DESC, $this->data);
|
155 |
}
|
156 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
157 |
/**
|
158 |
* Always call this function when you query for something.
|
159 |
*
|
@@ -163,12 +362,15 @@ class BWP_GXS_MODULE {
|
|
163 |
{
|
164 |
global $bwp_gxs, $wpdb;
|
165 |
|
166 |
-
$start = (!empty($this->url_sofar)) ?
|
167 |
$end = (int) $bwp_gxs->options['input_sql_limit'];
|
|
|
|
|
|
|
|
|
168 |
$query_str = trim($query_str);
|
169 |
$query_str .= ' LIMIT ' . $start . ',' . $end;
|
170 |
-
|
171 |
-
|
172 |
return $wpdb->get_results($query_str);
|
173 |
}
|
174 |
|
@@ -200,15 +402,20 @@ class BWP_GXS_MODULE {
|
|
200 |
return false;
|
201 |
}
|
202 |
|
203 |
-
function build_data()
|
204 |
{
|
205 |
global $bwp_gxs;
|
206 |
|
207 |
-
|
|
|
|
|
|
|
|
|
208 |
$this->url_sofar = sizeof($this->data);
|
209 |
|
210 |
-
// Sort the data by
|
211 |
-
|
|
|
212 |
}
|
213 |
}
|
214 |
?>
|
21 |
*/
|
22 |
var $freq_to_pri = array('always' => 1.0, 'hourly' => 0.8, 'daily' => 0.7, 'weekly' => 0.6, 'monthly' => 0.4, 'yearly' => 0.3, 'never' => 0.2);
|
23 |
|
24 |
+
var $comment_count = 0, $now, $offset = 0, $url_sofar = 0, $circle = 0;
|
25 |
+
var $perma_struct = '', $post_type = NULL;
|
26 |
|
27 |
function __contruct()
|
28 |
{
|
29 |
+
/* Intetionally left blank */
|
30 |
}
|
31 |
|
32 |
function set_current_time()
|
38 |
{
|
39 |
global $bwp_gxs;
|
40 |
|
|
|
|
|
|
|
41 |
if (empty($this->now))
|
42 |
$this->set_current_time();
|
43 |
|
44 |
$data['location'] = '';
|
45 |
$data['lastmod'] = (!empty($pre_data['lastmod'])) ? strtotime($pre_data['lastmod']) - $bwp_gxs->oldest_time : $this->now - $bwp_gxs->oldest_time;
|
46 |
$data['lastmod'] = $this->format_lastmod($data['lastmod']);
|
47 |
+
|
48 |
+
if (empty($pre_data) || sizeof($pre_data) == 0)
|
49 |
+
return $data;
|
50 |
+
|
51 |
if (isset($pre_data['freq'])) $data['freq'] = $pre_data['freq'];
|
52 |
if (isset($pre_data['priority'])) $data['priority'] = $pre_data['priority'];
|
53 |
|
61 |
if (!$bwp_gxs->use_permalink)
|
62 |
return get_option('home') . '/?' . $bwp_gxs->query_var_non_perma . '=' . $slug;
|
63 |
else
|
64 |
+
{
|
65 |
+
$permalink = get_option('permalink_structure');
|
66 |
+
// If user is using index.php in their permalink structure, we will have to include it also
|
67 |
+
$indexphp = (strpos($permalink, 'index.php') === false) ? '' : '/index.php';
|
68 |
+
return get_option('home') . $indexphp . '/' . $slug . '.xml';
|
69 |
+
}
|
70 |
}
|
71 |
|
72 |
/**
|
74 |
*
|
75 |
* @copyright (c) 2006 - 2009 www.phpbb-seo.com
|
76 |
*/
|
77 |
+
function cal_frequency($item = '', $lastmod = '')
|
78 |
{
|
79 |
global $bwp_gxs;
|
80 |
|
81 |
if (empty($this->now))
|
82 |
$this->now = $this->set_current_time();
|
83 |
|
84 |
+
$lastmod = (is_object($item)) ? $item->post_modified : $lastmod;
|
85 |
+
|
86 |
+
if (empty($lastmod))
|
87 |
+
$freq = $bwp_gxs->options['select_default_freq'];
|
88 |
else
|
89 |
{
|
90 |
+
$time = $this->now - strtotime($lastmod);
|
91 |
$freq = $time > 30000000 ? 'yearly' : ($time > 2592000 ? 'monthly' : ($time > 604800 ? 'weekly' : ($time > 86400 ? 'daily' : ($time > 43200 ? 'hourly' : 'always'))));
|
92 |
}
|
93 |
return apply_filters('bwp_gxs_freq', $freq, $item);
|
126 |
|
127 |
function format_lastmod($lastmod)
|
128 |
{
|
129 |
+
global $bwp_gxs;
|
130 |
+
if ('yes' == $bwp_gxs->options['enable_gmt'])
|
131 |
+
return gmdate('Y-m-d\TH:i:s' . '+00:00', (int) $lastmod);
|
132 |
+
else
|
133 |
+
return date('Y-m-d\TH:i:s' . '+00:00', (int) $lastmod);
|
134 |
}
|
135 |
|
136 |
function post_type_uses($post_type, $taxonomy_object)
|
145 |
if (!isset($result) || !is_array($result))
|
146 |
return false;
|
147 |
|
148 |
+
for ($i = 0; $i < sizeof($result); $i++)
|
149 |
{
|
150 |
+
$post = $result[$i];
|
151 |
if ($post_type == $post->post_type)
|
152 |
return $post;
|
153 |
}
|
161 |
return false;
|
162 |
// Obtain a list of columns
|
163 |
$lastmod = array();
|
164 |
+
for ($i = 0; $i < sizeof($this->data); $i++)
|
165 |
+
$lastmod[$i] = $this->data[$i][$column];
|
|
|
166 |
// Add $data as the last parameter, to sort by the common key
|
167 |
array_multisort($lastmod, SORT_DESC, $this->data);
|
168 |
}
|
169 |
|
170 |
+
/**
|
171 |
+
* Get term links without using any SQL queries and the cache.
|
172 |
+
*/
|
173 |
+
function get_term_link($term, $taxonomy = '')
|
174 |
+
{
|
175 |
+
global $wp_rewrite;
|
176 |
+
|
177 |
+
$taxonomy = $term->taxonomy;
|
178 |
+
$termlink = $wp_rewrite->get_extra_permastruct($taxonomy);
|
179 |
+
$slug = $term->slug;
|
180 |
+
$t = get_taxonomy($taxonomy);
|
181 |
+
|
182 |
+
if (empty($termlink))
|
183 |
+
{
|
184 |
+
if ('category' == $taxonomy)
|
185 |
+
$termlink = '?cat=' . $term->term_id;
|
186 |
+
elseif ($t->query_var)
|
187 |
+
$termlink = "?$t->query_var=$slug";
|
188 |
+
else
|
189 |
+
$termlink = "?taxonomy=$taxonomy&term=$slug";
|
190 |
+
$termlink = home_url($termlink);
|
191 |
+
}
|
192 |
+
else
|
193 |
+
{
|
194 |
+
if ($t->rewrite['hierarchical'] && !empty($term->parent))
|
195 |
+
{
|
196 |
+
$hierarchical_slugs = array();
|
197 |
+
$ancestors = get_ancestors($term->term_id, $taxonomy);
|
198 |
+
foreach ((array)$ancestors as $ancestor)
|
199 |
+
{
|
200 |
+
$ancestor_term = get_term($ancestor, $taxonomy);
|
201 |
+
$hierarchical_slugs[] = $ancestor_term->slug;
|
202 |
+
}
|
203 |
+
$hierarchical_slugs = array_reverse($hierarchical_slugs);
|
204 |
+
$hierarchical_slugs[] = $slug;
|
205 |
+
$termlink = str_replace("%$taxonomy%", implode('/', $hierarchical_slugs), $termlink);
|
206 |
+
}
|
207 |
+
else
|
208 |
+
{
|
209 |
+
$termlink = str_replace("%$taxonomy%", $slug, $termlink);
|
210 |
+
}
|
211 |
+
$termlink = home_url( user_trailingslashit($termlink, 'category') );
|
212 |
+
}
|
213 |
+
|
214 |
+
// Back Compat filters.
|
215 |
+
if ('post_tag' == $taxonomy)
|
216 |
+
$termlink = apply_filters('tag_link', $termlink, $term->term_id);
|
217 |
+
elseif ('category' == $taxonomy)
|
218 |
+
$termlink = apply_filters('category_link', $termlink, $term->term_id);
|
219 |
+
|
220 |
+
return apply_filters('term_link', $termlink, $term, $taxonomy);
|
221 |
+
}
|
222 |
+
|
223 |
+
function get_post_permalink($leavename = false, $sample = false)
|
224 |
+
{
|
225 |
+
global $wp_rewrite, $post;
|
226 |
+
|
227 |
+
if (is_wp_error($post))
|
228 |
+
return $post;
|
229 |
+
|
230 |
+
$post_link = $wp_rewrite->get_extra_permastruct($post->post_type);
|
231 |
+
$slug = $post->post_name;
|
232 |
+
$draft_or_pending = isset($post->post_status) && in_array($post->post_status, array('draft', 'pending', 'auto-draft'));
|
233 |
+
$post_type = get_post_type_object($post->post_type);
|
234 |
+
|
235 |
+
if (!empty($post_link) && (!$draft_or_pending || $sample))
|
236 |
+
{
|
237 |
+
if (!$leavename)
|
238 |
+
$post_link = str_replace("%$post->post_type%", $slug, $post_link);
|
239 |
+
$post_link = home_url(user_trailingslashit($post_link));
|
240 |
+
}
|
241 |
+
else
|
242 |
+
{
|
243 |
+
if ($post_type->query_var && (isset($post->post_status) && !$draft_or_pending))
|
244 |
+
$post_link = add_query_arg($post_type->query_var, $slug, '');
|
245 |
+
else
|
246 |
+
$post_link = add_query_arg(array('post_type' => $post->post_type, 'p' => $post->ID), '');
|
247 |
+
$post_link = home_url($post_link);
|
248 |
+
}
|
249 |
+
|
250 |
+
return apply_filters('post_type_link', $post_link, $post, $leavename, $sample);
|
251 |
+
}
|
252 |
+
|
253 |
+
function get_permalink($leavename = false)
|
254 |
+
{
|
255 |
+
global $post;
|
256 |
+
|
257 |
+
$rewritecode = array(
|
258 |
+
'%year%',
|
259 |
+
'%monthnum%',
|
260 |
+
'%day%',
|
261 |
+
'%hour%',
|
262 |
+
'%minute%',
|
263 |
+
'%second%',
|
264 |
+
$leavename? '' : '%postname%',
|
265 |
+
'%post_id%',
|
266 |
+
'%category%',
|
267 |
+
'%author%',
|
268 |
+
$leavename? '' : '%pagename%',
|
269 |
+
);
|
270 |
+
|
271 |
+
if (!isset($post) || !is_object($post))
|
272 |
+
return '';
|
273 |
+
|
274 |
+
$custom_post_types = get_post_types(array('_builtin' => false));
|
275 |
+
if (!isset($this->post_type))
|
276 |
+
$this->post_type = get_post_type_object($post->post_type);
|
277 |
+
|
278 |
+
if ('post' != $post->post_type && !in_array($post->post_type, $custom_post_types))
|
279 |
+
return '';
|
280 |
+
|
281 |
+
if (in_array($post->post_type, $custom_post_types))
|
282 |
+
{
|
283 |
+
if ($this->post_type->hierarchical)
|
284 |
+
{
|
285 |
+
wp_cache_add($post->ID, $post, 'posts');
|
286 |
+
return get_post_permalink($post->ID, $leavename);
|
287 |
+
}
|
288 |
+
else
|
289 |
+
return $this->get_post_permalink();
|
290 |
+
}
|
291 |
+
|
292 |
+
// In case module author doesn't initialize this variable
|
293 |
+
$permalink = (empty($this->perma_struct)) ? get_option('permalink_structure') : $this->perma_struct;
|
294 |
+
$permalink = apply_filters('pre_post_link', $permalink, $post, $leavename);
|
295 |
+
if ('' != $permalink && !in_array($post->post_status, array('draft', 'pending', 'auto-draft')))
|
296 |
+
{
|
297 |
+
$unixtime = strtotime($post->post_date);
|
298 |
+
$category = '';
|
299 |
+
if (strpos($permalink, '%category%') !== false)
|
300 |
+
{
|
301 |
+
// If this post belongs to a category with a parent, we have to rely on WordPress to build our permalinks
|
302 |
+
// This can cause white page for sites that have a lot of posts, don't blame this plugin, blame WordPress ;)
|
303 |
+
if (empty($post->slug) || !empty($post->parent))
|
304 |
+
{
|
305 |
+
$cats = get_the_category($post->ID);
|
306 |
+
if ($cats)
|
307 |
+
{
|
308 |
+
usort($cats, '_usort_terms_by_ID'); // order by ID
|
309 |
+
$category = $cats[0]->slug;
|
310 |
+
if ($parent = $cats[0]->parent)
|
311 |
+
$category = get_category_parents($parent, false, '/', true) . $category;
|
312 |
+
}
|
313 |
+
}
|
314 |
+
else
|
315 |
+
$category = (strpos($permalink, '%category%') !== false) ? $post->slug : '';
|
316 |
+
|
317 |
+
if (empty($category))
|
318 |
+
{
|
319 |
+
$default_category = get_category( get_option( 'default_category' ) );
|
320 |
+
$category = is_wp_error($default_category) ? '' : $default_category->slug;
|
321 |
+
}
|
322 |
+
}
|
323 |
+
|
324 |
+
$author = '';
|
325 |
+
if (strpos($permalink, '%author%') !== false)
|
326 |
+
{
|
327 |
+
$authordata = get_userdata($post->post_author);
|
328 |
+
$author = $authordata->user_nicename;
|
329 |
+
}
|
330 |
+
|
331 |
+
$date = explode(' ', date('Y m d H i s', $unixtime));
|
332 |
+
$rewritereplace =
|
333 |
+
array(
|
334 |
+
$date[0],
|
335 |
+
$date[1],
|
336 |
+
$date[2],
|
337 |
+
$date[3],
|
338 |
+
$date[4],
|
339 |
+
$date[5],
|
340 |
+
$post->post_name,
|
341 |
+
$post->ID,
|
342 |
+
$category,
|
343 |
+
$author,
|
344 |
+
$post->post_name
|
345 |
+
);
|
346 |
+
|
347 |
+
$permalink = home_url(str_replace($rewritecode, $rewritereplace, $permalink));
|
348 |
+
$permalink = user_trailingslashit($permalink, 'single');
|
349 |
+
}
|
350 |
+
else // if they're not using the fancy permalink option
|
351 |
+
$permalink = home_url('?p=' . $post->ID);
|
352 |
+
|
353 |
+
return apply_filters('post_link', $permalink, $post, $leavename);
|
354 |
+
}
|
355 |
+
|
356 |
/**
|
357 |
* Always call this function when you query for something.
|
358 |
*
|
362 |
{
|
363 |
global $bwp_gxs, $wpdb;
|
364 |
|
365 |
+
$start = (!empty($this->url_sofar)) ? $this->offset + (int) $this->url_sofar : $this->offset;
|
366 |
$end = (int) $bwp_gxs->options['input_sql_limit'];
|
367 |
+
$limit = (empty($this->part)) ? $bwp_gxs->options['input_item_limit'] : $bwp_gxs->options['input_split_limit_post'];
|
368 |
+
// If we exceed the actual limit, limit $end to the correct limit - @since 1.1.5
|
369 |
+
if ($this->url_sofar + $end > $limit)
|
370 |
+
$end = $limit - $this->url_sofar;
|
371 |
$query_str = trim($query_str);
|
372 |
$query_str .= ' LIMIT ' . $start . ',' . $end;
|
373 |
+
|
|
|
374 |
return $wpdb->get_results($query_str);
|
375 |
}
|
376 |
|
402 |
return false;
|
403 |
}
|
404 |
|
405 |
+
function build_data($sort_column = '')
|
406 |
{
|
407 |
global $bwp_gxs;
|
408 |
|
409 |
+
// Use part limit or global item limit - @since 1.1.0
|
410 |
+
$limit = (empty($this->part)) ? $bwp_gxs->options['input_item_limit'] : $bwp_gxs->options['input_split_limit_post'];
|
411 |
+
$this->offset = (empty($this->part)) ? 0 : ($this->part - 1) * $bwp_gxs->options['input_split_limit_post'];
|
412 |
+
|
413 |
+
while ($this->url_sofar < $limit && false != $this->generate_data())
|
414 |
$this->url_sofar = sizeof($this->data);
|
415 |
|
416 |
+
// Sort the data by preference
|
417 |
+
if (!empty($sort_column))
|
418 |
+
$this->sort_data_by($sort_column);
|
419 |
}
|
420 |
}
|
421 |
?>
|
includes/class-bwp-simple-gxs.php
CHANGED
@@ -50,7 +50,7 @@ class BWP_SIMPLE_GXS extends BWP_FRAMEWORK {
|
|
50 |
/**
|
51 |
* Other properties
|
52 |
*/
|
53 |
-
var $post_types, $taxonomies, $terms, $cache_time, $module_data, $output, $num_log = 25;
|
54 |
var $templates = array(), $module_map = array();
|
55 |
var $sitemap_alias = array(), $use_permalink = true, $query_var_non_perma = '';
|
56 |
var $ping_per_day = 100, $timeout = 3;
|
@@ -61,7 +61,7 @@ class BWP_SIMPLE_GXS extends BWP_FRAMEWORK {
|
|
61 |
/**
|
62 |
* Constructor
|
63 |
*/
|
64 |
-
function __construct($version = '1.
|
65 |
{
|
66 |
// Plugin's title
|
67 |
$this->plugin_title = 'BWP Google XML Sitemaps';
|
@@ -76,12 +76,15 @@ class BWP_SIMPLE_GXS extends BWP_FRAMEWORK {
|
|
76 |
$options = array(
|
77 |
'enable_cache' => 'yes',
|
78 |
'enable_cache_auto_gen' => 'yes',
|
79 |
-
'enable_gzip' => '
|
|
|
80 |
'enable_xslt' => 'yes',
|
81 |
-
'enable_sitemap_page' => 'yes',
|
82 |
'enable_sitemap_date' => '',
|
83 |
'enable_sitemap_taxonomy' => 'yes',
|
84 |
-
'
|
|
|
|
|
|
|
85 |
'enable_stats' => 'yes',
|
86 |
'enable_credit' => 'yes',
|
87 |
'enable_ping' => 'yes',
|
@@ -92,15 +95,20 @@ class BWP_SIMPLE_GXS extends BWP_FRAMEWORK {
|
|
92 |
'enable_log' => 'yes',
|
93 |
'enable_debug' => '',
|
94 |
'enable_robots' => 'yes',
|
|
|
|
|
|
|
|
|
95 |
'input_cache_age' => 1,
|
96 |
-
'input_item_limit' =>
|
|
|
97 |
'input_alt_module_dir' => $this->uni_path_sep(ABSPATH),
|
98 |
-
'input_oldest' =>
|
99 |
'input_sql_limit' => 1000,
|
100 |
'input_custom_xslt' => '',
|
101 |
'select_output_type' => 'concise',
|
102 |
'select_time_type' => 3600,
|
103 |
-
'select_oldest_type' =>
|
104 |
'select_default_freq' => 'daily',
|
105 |
'select_default_pri' => 1.0,
|
106 |
'select_min_pri' => 0.1,
|
@@ -114,25 +122,21 @@ class BWP_SIMPLE_GXS extends BWP_FRAMEWORK {
|
|
114 |
'input_sitemap_struct' => ''
|
115 |
);
|
116 |
// Super admin only options
|
117 |
-
$this->site_options = array('enable_robots', 'enable_log', 'enable_debug', 'enable_ping', 'enable_ping_google', 'enable_ping_yahoo', 'enable_ping_bing', 'enable_ping_ask', 'enable_gzip', 'enable_cache', 'enable_cache_auto_gen', 'input_cache_age', 'input_alt_module_dir', 'input_sql_limit', 'input_cache_dir', 'select_time_type');
|
118 |
-
|
119 |
$this->build_properties('BWP_GXS', 'bwp-simple-gxs', $options, 'BWP Google XML Sitemaps', dirname(dirname(__FILE__)) . '/bwp-simple-gxs.php', 'http://betterwp.net/wordpress-plugins/google-xml-sitemaps/', false);
|
120 |
|
121 |
$this->add_option_key('BWP_GXS_STATS', 'bwp_gxs_stats', __('Sitemap Statistics', 'bwp-simple-gxs'));
|
122 |
$this->add_option_key('BWP_GXS_OPTION_GENERATOR', 'bwp_gxs_generator', __('Sitemap Generator', 'bwp-simple-gxs'));
|
123 |
-
|
124 |
define('BWP_GXS_LOG', 'bwp_gxs_log');
|
125 |
define('BWP_GXS_PING', 'bwp_gxs_ping_data');
|
126 |
-
|
127 |
$this->init();
|
128 |
}
|
129 |
|
130 |
function init_properties()
|
131 |
{
|
132 |
-
// Try to surpress all errors so we don't have an encoding error page, don't do this when debug is on
|
133 |
-
if ('yes' != $this->options['enable_debug'])
|
134 |
-
error_reporting(0);
|
135 |
-
|
136 |
$this->module_directory = plugin_dir_path($this->plugin_file) . 'includes/modules/';
|
137 |
|
138 |
$this->templates = array(
|
@@ -168,35 +172,60 @@ class BWP_SIMPLE_GXS extends BWP_FRAMEWORK {
|
|
168 |
}
|
169 |
|
170 |
// Sitemap based on permastruct
|
171 |
-
|
|
|
172 |
{
|
173 |
$this->use_permalink = false;
|
174 |
$this->query_var_non_perma = apply_filters('bwp_gxs_query_var_non_perma', 'bwpsitemap');
|
175 |
-
$this->options['input_sitemap_url'] =
|
176 |
-
$this->options['input_sitemap_struct'] =
|
177 |
}
|
178 |
else
|
179 |
{
|
180 |
-
|
181 |
-
$
|
|
|
|
|
182 |
}
|
183 |
|
184 |
-
// No more than 50000
|
185 |
if (50000 < (int) $this->options['input_item_limit'])
|
186 |
$this->options['input_item_limit'] = 50000;
|
187 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
188 |
// XSLT style sheet
|
189 |
if ('yes' == $this->options['enable_xslt'])
|
190 |
{
|
191 |
-
|
192 |
-
|
193 |
-
$
|
|
|
|
|
|
|
|
|
|
|
194 |
}
|
195 |
-
|
196 |
// Some stats
|
197 |
$this->build_stats['mem'] = memory_get_usage();
|
198 |
}
|
199 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
200 |
function enqueue_media()
|
201 |
{
|
202 |
if (is_admin())
|
@@ -215,26 +244,16 @@ class BWP_SIMPLE_GXS extends BWP_FRAMEWORK {
|
|
215 |
return $vars;
|
216 |
}
|
217 |
|
218 |
-
function check_rewrite_rules()
|
219 |
-
{
|
220 |
-
global $wp_rewrite;
|
221 |
-
// Check rewrite rules - @since 1.0.3
|
222 |
-
$rules = get_option('rewrite_rules');
|
223 |
-
if (!empty($rules) && is_array($rules) && (!isset($rules['sitemapindex\.xml$']) || !isset($rules['post\.xml$'])))
|
224 |
-
{
|
225 |
-
add_filter('rewrite_rules_array', array($this, 'insert_rewrite_rules'));
|
226 |
-
$wp_rewrite->flush_rules();
|
227 |
-
}
|
228 |
-
}
|
229 |
-
|
230 |
function insert_rewrite_rules($rules)
|
231 |
{
|
232 |
// More compatible with blogs that are set up with sitemap.xml - @since 1.0.1
|
233 |
$rewrite_rules = array(
|
234 |
'sitemap\.xml$' => 'index.php?gxs_module=sitemapindex',
|
235 |
'sitemapindex\.xml$' => 'index.php?gxs_module=sitemapindex',
|
|
|
236 |
'page\.xml$' => 'index.php?gxs_module=page',
|
237 |
'post\.xml$' => 'index.php?gxs_module=post',
|
|
|
238 |
'([a-z0-9]+)_([a-z0-9_-]+)\.xml$' => 'index.php?gxs_module=$matches[1]&gxs_sub_module=$matches[2]'
|
239 |
);
|
240 |
// @since 1.0.3
|
@@ -243,9 +262,15 @@ class BWP_SIMPLE_GXS extends BWP_FRAMEWORK {
|
|
243 |
return $rules;
|
244 |
}
|
245 |
|
|
|
|
|
|
|
|
|
|
|
|
|
246 |
function add_hooks()
|
247 |
{
|
248 |
-
|
249 |
add_filter('query_vars', array($this, 'insert_query_vars'));
|
250 |
add_action('parse_request', array($this, 'request_sitemap'));
|
251 |
if ('yes' == $this->options['enable_ping'])
|
@@ -264,7 +289,6 @@ class BWP_SIMPLE_GXS extends BWP_FRAMEWORK {
|
|
264 |
function install()
|
265 |
{
|
266 |
global $wp_rewrite;
|
267 |
-
add_filter('rewrite_rules_array', array($this, 'insert_rewrite_rules'));
|
268 |
$wp_rewrite->flush_rules();
|
269 |
}
|
270 |
|
@@ -302,6 +326,7 @@ class BWP_SIMPLE_GXS extends BWP_FRAMEWORK {
|
|
302 |
$bwp_option_page = new BWP_OPTION_PAGE($page, $this->site_options);
|
303 |
|
304 |
$options = array();
|
|
|
305 |
|
306 |
if (!empty($page))
|
307 |
{
|
@@ -309,6 +334,15 @@ if (!empty($page))
|
|
309 |
{
|
310 |
$bwp_option_page->set_current_tab(1);
|
311 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
312 |
$form = array(
|
313 |
'items' => array('heading', 'heading', 'heading', 'heading', 'checkbox', 'section', 'heading', 'checkbox', 'checkbox'),
|
314 |
'item_labels' => array
|
@@ -331,7 +365,7 @@ if (!empty($page))
|
|
331 |
array('checkbox', 'name' => 'cb7')
|
332 |
),
|
333 |
'heading' => array(
|
334 |
-
'h1' => __('In its simplest form, a Sitemap is an XML file that lists URLs for a site along with additional metadata about each URL (when it was last updated, how often it usually changes, and how important it is, relative to other URLs in the site) so that search engines can more intelligently crawl the site — <em>http://www.sitemaps.org/</em>', 'bwp-simple-gxs'),
|
335 |
'h2' => __('<em>Basic information about all your sitemaps.</em>', 'bwp-simple-gxs'),
|
336 |
'h3' => __('<em>More detailed information about how your sitemaps are generated including <span style="color: #999999;">notices</span>, <span style="color: #FF0000;">errors</span> and <span style="color: #009900;">success messages</span>.</em>', 'bwp-simple-gxs'),
|
337 |
'h4' => sprintf(__('<em>Submit your sitemapindex to major search engines like <a href="%s" target="_blank">Google</a>, <a href="%s" target="_blank">Yahoo</a>, <a href="%s" target="_blank">Bing</a> or <a href="%s" target="_blank">Ask</a>.</em>', 'bwp-simple-gxs'), 'https://www.google.com/webmasters/tools/home?hl=en', 'https://siteexplorer.search.yahoo.com/mysites', 'http://www.bing.com/toolbox/webmasters/', 'http://about.ask.com/en/docs/about/webmasters.shtml#22'),
|
@@ -355,6 +389,10 @@ if (!empty($page))
|
|
355 |
)
|
356 |
);
|
357 |
|
|
|
|
|
|
|
|
|
358 |
// Get the options
|
359 |
$options = $bwp_option_page->get_options(array('enable_ping', 'enable_ping_google', 'enable_ping_yahoo', 'enable_ping_bing', 'enable_ping_ask', 'enable_log', 'enable_debug'), $this->options);
|
360 |
|
@@ -370,20 +408,27 @@ if (!empty($page))
|
|
370 |
$bwp_option_page->set_current_tab(2);
|
371 |
|
372 |
$form = array(
|
373 |
-
'items' => array('input', 'select', 'select', 'select', 'checkbox', '
|
374 |
'item_labels' => array
|
375 |
(
|
376 |
__('Output no more than', 'bwp-simple-gxs'),
|
377 |
__('Default change frequency', 'bwp-simple-gxs'),
|
378 |
__('Default priority', 'bwp-simple-gxs'),
|
379 |
__('Minimum priority', 'bwp-simple-gxs'),
|
380 |
-
__('
|
381 |
-
__('In sitemapindex, include', 'bwp-simple-gxs'),
|
382 |
__('Style your sitemaps with an XSLT stylesheet?', 'bwp-simple-gxs'),
|
383 |
__('Custom XSLT stylesheet URL', 'bwp-simple-gxs'),
|
384 |
__('Show build stats in sitemaps?', 'bwp-simple-gxs'),
|
385 |
__('Enable credit?', 'bwp-simple-gxs'),
|
386 |
__('Enable Gzip?', 'bwp-simple-gxs'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
387 |
__('Module Options', 'bwp-simple-gxs'),
|
388 |
__('Alternate module directory', 'bwp-simple-gxs'),
|
389 |
__('Get no more than', 'bwp-simple-gxs'),
|
@@ -393,17 +438,22 @@ if (!empty($page))
|
|
393 |
__('Cached sitemaps will last for', 'bwp-simple-gxs'),
|
394 |
__('Cached sitemaps are stored in (auto detected)', 'bwp-simple-gxs')
|
395 |
),
|
396 |
-
'item_names' => array('input_item_limit', 'select_default_freq', 'select_default_pri', 'select_min_pri', '
|
397 |
'heading' => array(
|
398 |
'h3' => __('<em>Cache your sitemaps for better performance.</em>', 'bwp-simple-gxs'),
|
399 |
-
'h4' => sprintf(__('<em>This plugin uses modules to build sitemap data so it is recommended that you extend this plugin using modules rather than hooks. Some of the settings below only affect modules extending the base module class. Read more about using modules <a href="%s#using-modules">here</a>.</em>', 'bwp-simple-gxs'), $this->plugin_url)
|
|
|
400 |
),
|
401 |
'sec1' => array(
|
402 |
-
array('checkbox', 'name' => 'cb5'),
|
403 |
array('checkbox', 'name' => 'cb7'),
|
404 |
-
array('checkbox', 'name' => 'cb8'),
|
405 |
-
array('checkbox', 'name' => 'cb9')
|
|
|
|
|
|
|
406 |
),
|
|
|
|
|
407 |
'select' => array(
|
408 |
'select_time_type' => array(
|
409 |
__('second(s)', 'bwp-simple-gxs') => 1,
|
@@ -430,17 +480,24 @@ if (!empty($page))
|
|
430 |
'cb1' => array(__('your sitemaps are generated and then cached to reduce unnecessary work.', 'bwp-simple-gxs') => 'enable_cache'),
|
431 |
'cb2' => array(__('when a cached sitemap expires, this plugin will try to generate the cache again. If you disable this, remember to manually flush the cache once in a while.', 'bwp-simple-gxs') . ' <input type="submit" class="button-secondary action" name="flush_cache" value="' . __('Flush the cache', 'bwp-simple-gxs') . '" />' => 'enable_cache_auto_gen'),
|
432 |
'cb3' => array(__('tell you useful information such as build time, memory usage, SQL queries, etc.', 'bwp-simple-gxs') => 'enable_stats'),
|
433 |
-
'cb4' => array(__('make your sitemaps ~ 70% smaller.', 'bwp-simple-gxs') => 'enable_gzip'),
|
434 |
-
'
|
|
|
435 |
'cb7' => array(__("taxonomy archives' sitemaps, including custom taxonomies.", 'bwp-simple-gxs') => 'enable_sitemap_taxonomy'),
|
436 |
-
'cb8' => array(__("tag archives'
|
437 |
'cb9' => array(__("date archives' sitemaps.", 'bwp-simple-gxs') => 'enable_sitemap_date'),
|
|
|
438 |
'cb6' => array(__('some copyrighted info is also added to your sitemaps. Thanks!', 'bwp-simple-gxs') => 'enable_credit'),
|
439 |
-
'cb10' => array(__('This will load the default
|
440 |
-
'cb11' => array(sprintf(__('If you\'re on a Multi-site installation with Sub-domain enabled, each site will have its own robots.txt, sites in sub-directory will not. Please read the <a href="%s#toc-robots" target="_blank">documentation</a> for more info.', 'bwp-simple-gxs'), $this->plugin_url) => 'enable_robots')
|
|
|
|
|
|
|
|
|
441 |
),
|
442 |
'input' => array(
|
443 |
-
'input_item_limit' => array('size' => 5, 'label' => __('item(s) in one sitemap.
|
|
|
444 |
'input_alt_module_dir' => array('size' => 91, 'label' => __('Input a full path to the directory where you put your own modules (e.g. <code>/home/mysite/public_html/gxs-modules/</code>), you can also override a built-in module by having a module with the same filename in this directory. A filter is also available if you would like to use PHP instead.', 'bwp-simple-gxs')),
|
445 |
'input_cache_dir' => array('size' => 91, 'disabled' => ' disabled="disabled"', 'label' => __('The cache directory must be writable (i.e. CHMOD to 755 or 777).', 'bwp-simple-gxs')),
|
446 |
'input_sql_limit' => array('size' => 5, 'label' => __('item(s) in one SQL query. This helps you avoid running too heavy queries.', 'bwp-simple-gxs')),
|
@@ -449,7 +506,11 @@ if (!empty($page))
|
|
449 |
'input_custom_xslt' => array('size' => 90, 'label' => __('expected to be an absolute URL, e.g. <code>http://example.com/my-stylesheet.xsl</code>. You must also have a style sheet for the sitemapindex that can be accessed through the above URL, e.g. <code>my-stylesheet.xsl</code> and <code>my-stylesheetindex.xsl</code>). Please leave blank if you do not wish to use.', 'bwp-simple-gxs'))
|
450 |
),
|
451 |
'inline_fields' => array(
|
452 |
-
'input_cache_age' => array('select_time_type' => 'select')
|
|
|
|
|
|
|
|
|
453 |
)
|
454 |
);
|
455 |
|
@@ -458,13 +519,62 @@ if (!empty($page))
|
|
458 |
$form['select']['select_default_freq'] = $changefreq;
|
459 |
|
460 |
// Get the options
|
461 |
-
$options = $bwp_option_page->get_options(array('input_item_limit', 'input_alt_module_dir', 'input_cache_dir', 'input_sql_limit', 'input_cache_age', 'input_custom_xslt', 'enable_robots', 'enable_xslt', 'enable_cache', 'enable_cache_auto_gen', 'enable_stats', 'enable_credit', '
|
462 |
|
463 |
// Get option from the database
|
464 |
$options = $bwp_option_page->get_db_options($page, $options);
|
465 |
|
466 |
-
|
467 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
468 |
// [WPMS Compatible]
|
469 |
$option_super_admin = $this->site_options;
|
470 |
}
|
@@ -472,17 +582,27 @@ if (!empty($page))
|
|
472 |
// Flush the cache
|
473 |
if (isset($_POST['flush_cache']) && !$this->is_normal_admin())
|
474 |
{
|
|
|
475 |
if ($deleted = $this->flush_cache())
|
476 |
$this->add_notice('<strong>' . __('Notice', 'bwp-simple-gxs') . ':</strong> ' . sprintf(__("<strong>%d</strong> cached sitemaps have been flushed successfully!", 'bwp-simple-gxs'), $deleted));
|
477 |
else
|
478 |
$this->add_notice('<strong>' . __('Notice', 'bwp-simple-gxs') . ':</strong> ' . __("Could not delete any cached sitemaps. Please manually check the cache directory.", 'bwp-simple-gxs'));
|
479 |
}
|
|
|
480 |
// Get option from user input
|
481 |
if (isset($_POST['submit_' . $bwp_option_page->get_form_name()]) && isset($options) && is_array($options))
|
482 |
{
|
483 |
check_admin_referer($page);
|
|
|
484 |
foreach ($options as $key => &$option)
|
485 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
486 |
// [WPMS Compatible]
|
487 |
if ($this->is_normal_admin() && in_array($key, $option_super_admin))
|
488 |
{}
|
@@ -502,21 +622,29 @@ if (!empty($page))
|
|
502 |
$option = trim(stripslashes($_POST[$key]));
|
503 |
else
|
504 |
$option = $this->options_default[$key];
|
|
|
|
|
|
|
505 |
}
|
506 |
}
|
507 |
update_option($page, $options);
|
|
|
|
|
|
|
508 |
// [WPMS Compatible]
|
509 |
if (!$this->is_normal_admin())
|
510 |
update_site_option($page, $options);
|
511 |
}
|
512 |
|
513 |
// [WPMS Compatible]
|
|
|
|
|
514 |
if ($this->is_normal_admin())
|
515 |
{
|
516 |
switch ($page)
|
517 |
{
|
518 |
case BWP_GXS_OPTION_GENERATOR:
|
519 |
-
$bwp_option_page->kill_html_fields($form, array(
|
520 |
break;
|
521 |
|
522 |
case BWP_GXS_STATS:
|
@@ -530,12 +658,18 @@ if (!empty($page))
|
|
530 |
$this->add_notice('<strong>' . __('Warning') . ':</strong> ' . __("Cache directory does not exist or is not writable. Please read more about directory permission <a href='http://www.zzee.com/solutions/unix-permissions.shtml'>here</a> (Unix).", 'bwp-simple-gxs'));
|
531 |
|
532 |
// Assign the form and option array
|
533 |
-
$bwp_option_page->init($form, $options, $this->form_tabs);
|
534 |
|
535 |
// Build the option page
|
536 |
echo $bwp_option_page->generate_html_form();
|
537 |
}
|
538 |
|
|
|
|
|
|
|
|
|
|
|
|
|
539 |
function flush_cache()
|
540 |
{
|
541 |
$dir = trailingslashit($this->options['input_cache_dir']);
|
@@ -632,7 +766,7 @@ if (!empty($page))
|
|
632 |
$log_time[$key] = $row['time'];
|
633 |
array_multisort($log_time, SORT_DESC, $logs);
|
634 |
}
|
635 |
-
$log_str = (!$sitemap) ? '<li class="clear" style="margin-top: 5px; line-height: 1.7;"><span style="float: left; margin-right: 5px;">%s —</span> <span style="color: #%s;"
|
636 |
$output = '<ul class="bwp-gxs-log">' . "\n";
|
637 |
foreach ($logs as $log)
|
638 |
{
|
@@ -645,12 +779,27 @@ if (!empty($page))
|
|
645 |
$output .= sprintf($log_str, date(__('M j, Y : H:i:s', 'bwp-simple-gxs'), $log['time']), $color, $log['log']) . "\n";
|
646 |
}
|
647 |
else
|
648 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
649 |
}
|
650 |
-
|
651 |
return $output . '</ul>' . "\n";
|
652 |
}
|
653 |
-
|
654 |
function format_label($label)
|
655 |
{
|
656 |
return str_replace(' ', '_', strtolower($label));
|
@@ -658,15 +807,31 @@ if (!empty($page))
|
|
658 |
|
659 |
function do_robots($output, $public)
|
660 |
{
|
661 |
-
global $blog_id;
|
|
|
662 |
if ('0' == $public)
|
663 |
return $output;
|
|
|
664 |
if ((defined('SUBDOMAIN_INSTALL') && true == SUBDOMAIN_INSTALL) || (isset($blog_id) && 1 == $blog_id))
|
665 |
{
|
666 |
$output .= "\n";
|
667 |
$output .= 'Sitemap: ' . $this->options['input_sitemap_url'];
|
668 |
$output .= "\n";
|
669 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
670 |
return $output;
|
671 |
}
|
672 |
|
@@ -694,8 +859,6 @@ if (!empty($page))
|
|
694 |
$host = $original['host'];
|
695 |
else
|
696 |
{
|
697 |
-
$xml_slug = ('post' == $xml_slug) ? $xml_slug = 'posts' : $xml_slug;
|
698 |
-
$xml_slug = ('page' == $xml_slug) ? $xml_slug = 'pages' : $xml_slug;
|
699 |
wp_redirect(sprintf($this->options['input_sitemap_struct'], $xml_slug), 301);
|
700 |
exit;
|
701 |
}
|
@@ -751,16 +914,23 @@ if (!empty($page))
|
|
751 |
function allowed_modules()
|
752 |
{
|
753 |
$allowed_modules = array();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
754 |
// Add public post types to module list
|
755 |
$post_types = $this->post_types = get_post_types(array('public' => true), 'objects');
|
756 |
foreach ($this->post_types as $post_type)
|
757 |
{
|
758 |
// Page will have its own
|
759 |
-
if ('page' != $post_type->name)
|
760 |
$allowed_modules['post'][] = $post_type->name;
|
761 |
}
|
762 |
// Add pages to module list
|
763 |
-
if ('
|
764 |
$allowed_modules['page'] = array('page');
|
765 |
// Add archive pages to module list
|
766 |
if ('yes' == $this->options['enable_sitemap_date'])
|
@@ -770,20 +940,20 @@ if (!empty($page))
|
|
770 |
if ('yes' == $this->options['enable_sitemap_taxonomy'])
|
771 |
{
|
772 |
foreach ($this->taxonomies as $taxonomy)
|
773 |
-
|
774 |
-
|
775 |
-
// Save this for future versions
|
776 |
-
/*foreach ($this->terms as $term)
|
777 |
-
$allowed_modules['term'][] = $term->slug;*/
|
778 |
}
|
779 |
-
// Our global module list
|
780 |
-
$this->allowed_modules = $allowed_modules;
|
781 |
// Remove some unnecessary sitemap
|
782 |
$this->remove_module('post', 'attachment');
|
783 |
$this->remove_module('taxonomy', 'post_format');
|
784 |
$this->remove_module('taxonomy', 'nav_menu');
|
|
|
|
|
|
|
|
|
|
|
785 |
// Hook for a custom module list
|
786 |
-
do_action('bwp_gxs_modules_built', $this->allowed_modules, $this->post_types, $this->taxonomies
|
787 |
return $this->allowed_modules;
|
788 |
}
|
789 |
|
@@ -873,15 +1043,21 @@ if (!empty($page))
|
|
873 |
// Remember to use $wpdb->prepare or $wpdb->escape when developing module
|
874 |
$module = stripslashes($module);
|
875 |
$sub_module = stripslashes($sub_module);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
876 |
$true_sub_module = $sub_module;
|
877 |
$pre_module = $module;
|
878 |
$pre_module .= (!empty($sub_module)) ? '_' . $sub_module : '';
|
879 |
// @since 1.0.1 - Redirect to correct domain, with or without www
|
880 |
$this->canonical_redirect($pre_module);
|
881 |
-
// Begin building module key
|
882 |
-
/*if (!get_option('permalink_structure') && ('post' == $module || 'page' == $module) && empty($sub_module)) $module = '';
|
883 |
-
$module = ('pages' == $module) ? 'page' : $module;
|
884 |
-
$module = ('posts' == $module) ? 'post' : $module;*/
|
885 |
// Allowed modules
|
886 |
$allowed_modules = $this->allowed_modules();
|
887 |
$this->build_requested_modules($allowed_modules);
|
@@ -890,7 +1066,7 @@ if (!empty($page))
|
|
890 |
{
|
891 |
if (!empty($sub_module))
|
892 |
{
|
893 |
-
if (in_array($sub_module, $allowed_modules[$module]))
|
894 |
$module_key = $module . '_' . $sub_module;
|
895 |
else
|
896 |
$module_key = '';
|
@@ -898,21 +1074,22 @@ if (!empty($page))
|
|
898 |
else
|
899 |
$module_key = $module;
|
900 |
$module_name = str_replace($sub_module, $true_sub_module, $module_key);
|
901 |
-
/*$module_name = ('page' == $module && empty($sub_module)) ? 'pages' : $module_name;
|
902 |
-
$module_name = ('post' == $module && empty($sub_module)) ? 'posts' : $module_name;*/
|
903 |
}
|
904 |
else if ('sitemapindex' == $module)
|
905 |
{
|
906 |
$module_key = 'sitemapindex';
|
907 |
$module_name = 'sitemapindex';
|
908 |
}
|
909 |
-
|
|
|
|
|
|
|
910 |
if (empty($module_key))
|
911 |
{
|
912 |
$this->elog(sprintf(__('Requested module (<em>%s</em>) not found or not allowed.', 'bwp-simple-gxs'), $pre_module), true, 404);
|
913 |
$this->commit_logs();
|
914 |
// If debugging is not enabled, redirect to homepage
|
915 |
-
wp_redirect(
|
916 |
exit;
|
917 |
}
|
918 |
|
@@ -920,6 +1097,10 @@ if (!empty($page))
|
|
920 |
timer_start();
|
921 |
$this->build_stats['query'] = get_num_queries();
|
922 |
|
|
|
|
|
|
|
|
|
923 |
// If cache is enabled, we check the cache first
|
924 |
if ('yes' == $this->options['enable_cache'])
|
925 |
{
|
@@ -930,12 +1111,13 @@ if (!empty($page))
|
|
930 |
{
|
931 |
$this->send_header($bwp_gxs_cache->get_header());
|
932 |
$file = $bwp_gxs_cache->get_cache_file();
|
933 |
-
//
|
934 |
-
//
|
935 |
-
if ($this->is_gzipped())
|
936 |
-
readgzfile($file);
|
937 |
-
else
|
938 |
readfile($file);
|
|
|
|
|
|
|
939 |
$this->slog(sprintf(__('Successfully served a cached version of <em>%s.xml</em>.', 'bwp-simple-gxs'), $module_name), true);
|
940 |
$this->commit_logs();
|
941 |
exit;
|
@@ -1015,7 +1197,7 @@ if (!empty($page))
|
|
1015 |
}
|
1016 |
}
|
1017 |
|
1018 |
-
$this->module_data = array('module' => $module, 'sub_module' => $sub_module, 'module_key' => $module_key, 'module_name' => $module_name);
|
1019 |
|
1020 |
if (class_exists('BWP_GXS_MODULE_' . $module_key))
|
1021 |
{
|
@@ -1025,7 +1207,7 @@ if (!empty($page))
|
|
1025 |
$success = $this->generate_sitemap($the_module->data);
|
1026 |
else
|
1027 |
$success = $this->generate_sitemap_index($the_module->data);
|
1028 |
-
unset($the_module);
|
1029 |
}
|
1030 |
else
|
1031 |
$this->elog(sprintf(__('There is no class named <strong>%s</strong> in the module file <strong>%s</strong>.', 'bwp-simple-gxs'), 'BWP_GXS_MODULE_' . strtoupper($module_key), $module_file), true);
|
@@ -1045,15 +1227,18 @@ if (!empty($page))
|
|
1045 |
{
|
1046 |
$the_module = new BWP_GXS_MODULE_INDEX($this->requested_modules);
|
1047 |
$success = $this->generate_sitemap_index($the_module->data);
|
1048 |
-
unset($the_module);
|
1049 |
}
|
1050 |
}
|
1051 |
|
1052 |
// Output succeeded
|
1053 |
if (true == $success)
|
1054 |
{
|
|
|
|
|
|
|
|
|
1055 |
if ('yes' == $this->options['enable_cache'] && true == $bwp_gxs_cache->cache_ok)
|
1056 |
-
// Now cache the sitemap if we have to
|
1057 |
$bwp_gxs_cache->write_cache();
|
1058 |
// Output the requested sitemap
|
1059 |
$this->output_sitemap();
|
@@ -1068,6 +1253,28 @@ if (!empty($page))
|
|
1068 |
|
1069 |
function send_header($header = array())
|
1070 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1071 |
if (!empty($_SERVER['SERVER_SOFTWARE']) && strstr($_SERVER['SERVER_SOFTWARE'], 'Apache/2'))
|
1072 |
header ('Cache-Control: no-cache, pre-check=0, post-check=0, max-age=0');
|
1073 |
else
|
@@ -1095,13 +1302,17 @@ if (!empty($page))
|
|
1095 |
if ('yes' == $this->options['enable_gzip'])
|
1096 |
header('Content-Encoding: ' . $this->check_gzip_type());
|
1097 |
|
|
|
|
|
|
|
1098 |
return;
|
1099 |
}
|
1100 |
|
1101 |
-
function is_gzipped()
|
1102 |
{
|
1103 |
-
if (ini_get('zlib.output_compression') || ini_get('output_handler') == 'ob_gzhandler' || in_array('ob_gzhandler', ob_list_handlers()))
|
1104 |
return true;
|
|
|
1105 |
}
|
1106 |
|
1107 |
function init_gzip()
|
@@ -1160,24 +1371,31 @@ if (!empty($page))
|
|
1160 |
$response = wp_remote_post($url, array('timeout' => $this->timeout));
|
1161 |
if (is_wp_error($response))
|
1162 |
{
|
1163 |
-
$errno
|
1164 |
-
$errorstr
|
1165 |
$this->elog($errorstr);
|
1166 |
-
$this->commit_logs();
|
1167 |
}
|
1168 |
-
else
|
1169 |
{
|
1170 |
-
$
|
1171 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1172 |
}
|
1173 |
}
|
1174 |
else
|
1175 |
-
{
|
1176 |
$this->elog(sprintf(__('Ping limit for today to %s has been reached, sorry!', 'bwp-simple-gxs'), ucfirst($key)));
|
1177 |
-
$this->commit_logs();
|
1178 |
-
}
|
1179 |
}
|
1180 |
}
|
|
|
|
|
1181 |
update_option(BWP_GXS_PING, $ping_data);
|
1182 |
}
|
1183 |
|
@@ -1185,7 +1403,7 @@ if (!empty($page))
|
|
1185 |
{
|
1186 |
if ('yes' == $this->options['enable_gzip'])
|
1187 |
{
|
1188 |
-
$this->output = (
|
1189 |
$this->send_header();
|
1190 |
echo $this->output;
|
1191 |
}
|
@@ -1208,13 +1426,13 @@ if (!empty($page))
|
|
1208 |
return true;
|
1209 |
}
|
1210 |
|
1211 |
-
function sitemap_stats($
|
1212 |
{
|
1213 |
$time = timer_stop(0, 3);
|
1214 |
$sql = get_num_queries() - $this->build_stats['query'];
|
1215 |
$memory = size_format(memory_get_usage() - $this->build_stats['mem'], 2);
|
1216 |
if (empty($type))
|
1217 |
-
$this->output .= "\n" . sprintf($this->templates['stats'], $time, $memory, $sql,
|
1218 |
else
|
1219 |
echo "\n" . sprintf($this->templates['stats_cached'], $time, $memory, $sql);
|
1220 |
}
|
@@ -1253,26 +1471,23 @@ if (!empty($page))
|
|
1253 |
$xml .= '<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' . "\n\t" . 'xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9' . "\n\t" . 'http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"' . "\n\t" . 'xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . "\n";
|
1254 |
if ('yes' != $this->options['enable_xslt'] && 'yes' == $this->options['enable_credit'])
|
1255 |
$xml .= $this->credit();
|
1256 |
-
|
1257 |
if (!$this->check_output($output))
|
1258 |
return false;
|
1259 |
|
1260 |
-
foreach ($output as
|
1261 |
{
|
1262 |
$url['location'] = (!empty($url['location'])) ? $url['location'] : '';
|
1263 |
$url['lastmod'] = (!empty($url['lastmod'])) ? $url['lastmod'] : '';
|
1264 |
-
$url['freq'] = in_array($url['freq'], $this->frequency) ? $url['freq'] : $this->options['select_default_freq'];
|
1265 |
-
$url['priority'] = ($url['priority'] <= 1 && $url['priority'] > 0) ? $url['priority'] : $this->options['select_default_pri'];
|
1266 |
$xml .= $this->generate_url_item(htmlspecialchars($url['location']), $url['priority'], $url['freq'], $url['lastmod']);
|
1267 |
-
|
1268 |
}
|
1269 |
|
1270 |
$xml .= "\n" . '</urlset>';
|
1271 |
$this->output = $xml;
|
1272 |
|
1273 |
-
if ('yes' == $this->options['enable_stats'])
|
1274 |
-
$this->sitemap_stats($output);
|
1275 |
-
|
1276 |
return true;
|
1277 |
}
|
1278 |
|
@@ -1287,20 +1502,17 @@ if (!empty($page))
|
|
1287 |
if (!$this->check_output($output))
|
1288 |
return false;
|
1289 |
|
1290 |
-
foreach ($output as
|
1291 |
{
|
1292 |
$sitemap['location'] = (!empty($sitemap['location'])) ? $sitemap['location'] : '';
|
1293 |
$sitemap['lastmod'] = (!empty($sitemap['lastmod'])) ? $sitemap['lastmod'] : '';
|
1294 |
$xml .= $this->generate_sitemap_item(htmlspecialchars($sitemap['location']), $sitemap['lastmod']);
|
1295 |
-
|
1296 |
}
|
1297 |
|
1298 |
$xml .= "\n" . '</sitemapindex>';
|
1299 |
$this->output = $xml;
|
1300 |
|
1301 |
-
if ('yes' == $this->options['enable_stats'])
|
1302 |
-
$this->sitemap_stats($output);
|
1303 |
-
|
1304 |
return true;
|
1305 |
}
|
1306 |
}
|
50 |
/**
|
51 |
* Other properties
|
52 |
*/
|
53 |
+
var $post_types, $taxonomies, $terms, $cache_time, $module_data, $output, $output_num = 0, $num_log = 25;
|
54 |
var $templates = array(), $module_map = array();
|
55 |
var $sitemap_alias = array(), $use_permalink = true, $query_var_non_perma = '';
|
56 |
var $ping_per_day = 100, $timeout = 3;
|
61 |
/**
|
62 |
* Constructor
|
63 |
*/
|
64 |
+
function __construct($version = '1.1.5')
|
65 |
{
|
66 |
// Plugin's title
|
67 |
$this->plugin_title = 'BWP Google XML Sitemaps';
|
76 |
$options = array(
|
77 |
'enable_cache' => 'yes',
|
78 |
'enable_cache_auto_gen' => 'yes',
|
79 |
+
'enable_gzip' => '',
|
80 |
+
'enable_php_clean' => 'yes',
|
81 |
'enable_xslt' => 'yes',
|
|
|
82 |
'enable_sitemap_date' => '',
|
83 |
'enable_sitemap_taxonomy' => 'yes',
|
84 |
+
'enable_sitemap_external' => '',
|
85 |
+
'enable_sitemap_split_post' => 'yes',
|
86 |
+
'enable_sitemap_author' => '',
|
87 |
+
'enable_sitemap_site' => 'yes',
|
88 |
'enable_stats' => 'yes',
|
89 |
'enable_credit' => 'yes',
|
90 |
'enable_ping' => 'yes',
|
95 |
'enable_log' => 'yes',
|
96 |
'enable_debug' => '',
|
97 |
'enable_robots' => 'yes',
|
98 |
+
'enable_global_robots' => '',
|
99 |
+
'enable_gmt' => 'yes',
|
100 |
+
'input_exclude_post_type' => '',
|
101 |
+
'input_exclude_taxonomy' => 'post_tag',
|
102 |
'input_cache_age' => 1,
|
103 |
+
'input_item_limit' => 5000,
|
104 |
+
'input_split_limit_post' => 5000,
|
105 |
'input_alt_module_dir' => $this->uni_path_sep(ABSPATH),
|
106 |
+
'input_oldest' => 7,
|
107 |
'input_sql_limit' => 1000,
|
108 |
'input_custom_xslt' => '',
|
109 |
'select_output_type' => 'concise',
|
110 |
'select_time_type' => 3600,
|
111 |
+
'select_oldest_type' => 16400,
|
112 |
'select_default_freq' => 'daily',
|
113 |
'select_default_pri' => 1.0,
|
114 |
'select_min_pri' => 0.1,
|
122 |
'input_sitemap_struct' => ''
|
123 |
);
|
124 |
// Super admin only options
|
125 |
+
$this->site_options = array('enable_robots', 'enable_global_robots', 'enable_log', 'enable_debug', 'enable_ping', 'enable_ping_google', 'enable_ping_yahoo', 'enable_ping_bing', 'enable_ping_ask', 'enable_gzip', 'enable_php_clean', 'enable_cache', 'enable_cache_auto_gen', 'input_cache_age', 'input_alt_module_dir', 'input_sql_limit', 'input_cache_dir', 'select_time_type');
|
126 |
+
|
127 |
$this->build_properties('BWP_GXS', 'bwp-simple-gxs', $options, 'BWP Google XML Sitemaps', dirname(dirname(__FILE__)) . '/bwp-simple-gxs.php', 'http://betterwp.net/wordpress-plugins/google-xml-sitemaps/', false);
|
128 |
|
129 |
$this->add_option_key('BWP_GXS_STATS', 'bwp_gxs_stats', __('Sitemap Statistics', 'bwp-simple-gxs'));
|
130 |
$this->add_option_key('BWP_GXS_OPTION_GENERATOR', 'bwp_gxs_generator', __('Sitemap Generator', 'bwp-simple-gxs'));
|
131 |
+
|
132 |
define('BWP_GXS_LOG', 'bwp_gxs_log');
|
133 |
define('BWP_GXS_PING', 'bwp_gxs_ping_data');
|
134 |
+
|
135 |
$this->init();
|
136 |
}
|
137 |
|
138 |
function init_properties()
|
139 |
{
|
|
|
|
|
|
|
|
|
140 |
$this->module_directory = plugin_dir_path($this->plugin_file) . 'includes/modules/';
|
141 |
|
142 |
$this->templates = array(
|
172 |
}
|
173 |
|
174 |
// Sitemap based on permastruct
|
175 |
+
$permalink = get_option('permalink_structure');
|
176 |
+
if (!$permalink)
|
177 |
{
|
178 |
$this->use_permalink = false;
|
179 |
$this->query_var_non_perma = apply_filters('bwp_gxs_query_var_non_perma', 'bwpsitemap');
|
180 |
+
$this->options['input_sitemap_url'] = home_url() . '/?' . $this->query_var_non_perma . '=sitemapindex';
|
181 |
+
$this->options['input_sitemap_struct'] = home_url() . '/?' . $this->query_var_non_perma . '=%s';
|
182 |
}
|
183 |
else
|
184 |
{
|
185 |
+
// If user is using index.php in their permalink structure, we will have to include it also
|
186 |
+
$indexphp = (strpos($permalink, 'index.php') === false) ? '' : '/index.php';
|
187 |
+
$this->options['input_sitemap_url'] = home_url() . $indexphp . '/sitemapindex.xml';
|
188 |
+
$this->options['input_sitemap_struct'] = home_url() . $indexphp . '/%s.xml';
|
189 |
}
|
190 |
|
191 |
+
// No more than 50000 URLs per sitemap
|
192 |
if (50000 < (int) $this->options['input_item_limit'])
|
193 |
$this->options['input_item_limit'] = 50000;
|
194 |
|
195 |
+
// Limit per split sitemap - @since 1.1.0
|
196 |
+
// Not higher than 50000 URLs and must be >= SQL cycling limit
|
197 |
+
if ($this->options['input_split_limit_post'] < $this->options['input_sql_limit'])
|
198 |
+
$this->options['input_split_limit_post'] = $this->options['input_sql_limit'];
|
199 |
+
if (50000 < (int) $this->options['input_split_limit_post'])
|
200 |
+
$this->options['input_split_limit_post'] = 50000;
|
201 |
+
|
202 |
// XSLT style sheet
|
203 |
if ('yes' == $this->options['enable_xslt'])
|
204 |
{
|
205 |
+
// If the host the user is using is different from what we get from 'home' option, we need to use the host
|
206 |
+
// so user won't see a style sheet error, which is most of the time mistaken as broken sitemaps - @since 1.1.0
|
207 |
+
$user_host = strtolower($_SERVER['HTTP_HOST']);
|
208 |
+
$blog_home = @parse_url(home_url());
|
209 |
+
$blog_host = strtolower($blog_home['host']);
|
210 |
+
$this->xslt = (!empty($this->options['input_custom_xslt'])) ? $this->options['input_custom_xslt'] : plugin_dir_url($this->plugin_file) . 'xsl/bwp-sitemap.xsl';
|
211 |
+
$this->xslt = ($user_host == $blog_host) ? $this->xslt : str_replace($blog_host, $user_host, $this->xslt);
|
212 |
+
add_action('init', array($this, 'late_init'), 99999);
|
213 |
}
|
214 |
+
|
215 |
// Some stats
|
216 |
$this->build_stats['mem'] = memory_get_usage();
|
217 |
}
|
218 |
|
219 |
+
function late_init()
|
220 |
+
{
|
221 |
+
$this->xslt = apply_filters('bwp_gxs_xslt', $this->xslt);
|
222 |
+
$this->xslt_index = (empty($this->xslt)) ? '' : str_replace('.xsl', 'index.xsl', $this->xslt);
|
223 |
+
// Update from 1.1.4 to 1.1.5
|
224 |
+
/*$db_options = get_option(BWP_GXS_OPTION_GENERATOR);
|
225 |
+
if (!isset($db_options['enable_sitemap_site']))
|
226 |
+
self::flush_rewrite_rules();*/
|
227 |
+
}
|
228 |
+
|
229 |
function enqueue_media()
|
230 |
{
|
231 |
if (is_admin())
|
244 |
return $vars;
|
245 |
}
|
246 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
247 |
function insert_rewrite_rules($rules)
|
248 |
{
|
249 |
// More compatible with blogs that are set up with sitemap.xml - @since 1.0.1
|
250 |
$rewrite_rules = array(
|
251 |
'sitemap\.xml$' => 'index.php?gxs_module=sitemapindex',
|
252 |
'sitemapindex\.xml$' => 'index.php?gxs_module=sitemapindex',
|
253 |
+
'site\.xml$' => 'index.php?gxs_module=site',
|
254 |
'page\.xml$' => 'index.php?gxs_module=page',
|
255 |
'post\.xml$' => 'index.php?gxs_module=post',
|
256 |
+
'author\.xml$' => 'index.php?gxs_module=author',
|
257 |
'([a-z0-9]+)_([a-z0-9_-]+)\.xml$' => 'index.php?gxs_module=$matches[1]&gxs_sub_module=$matches[2]'
|
258 |
);
|
259 |
// @since 1.0.3
|
262 |
return $rules;
|
263 |
}
|
264 |
|
265 |
+
private static function flush_rewrite_rules()
|
266 |
+
{
|
267 |
+
global $wp_rewrite;
|
268 |
+
$wp_rewrite->flush_rules();
|
269 |
+
}
|
270 |
+
|
271 |
function add_hooks()
|
272 |
{
|
273 |
+
add_filter('rewrite_rules_array', array($this, 'insert_rewrite_rules'));
|
274 |
add_filter('query_vars', array($this, 'insert_query_vars'));
|
275 |
add_action('parse_request', array($this, 'request_sitemap'));
|
276 |
if ('yes' == $this->options['enable_ping'])
|
289 |
function install()
|
290 |
{
|
291 |
global $wp_rewrite;
|
|
|
292 |
$wp_rewrite->flush_rules();
|
293 |
}
|
294 |
|
326 |
$bwp_option_page = new BWP_OPTION_PAGE($page, $this->site_options);
|
327 |
|
328 |
$options = array();
|
329 |
+
$dynamic_options = array();
|
330 |
|
331 |
if (!empty($page))
|
332 |
{
|
334 |
{
|
335 |
$bwp_option_page->set_current_tab(1);
|
336 |
|
337 |
+
// Clear logs = @since 1.1.0
|
338 |
+
if (isset($_POST['clear_log']) && !$this->is_normal_admin())
|
339 |
+
{
|
340 |
+
check_admin_referer($page);
|
341 |
+
$this->logs = array('log' => array(), 'sitemap' => array());
|
342 |
+
$this->commit_logs();
|
343 |
+
$this->add_notice('<strong>' . __('Notice', 'bwp-simple-gxs') . ':</strong> ' . __("All logs have been cleared successfully!", 'bwp-simple-gxs'));
|
344 |
+
}
|
345 |
+
|
346 |
$form = array(
|
347 |
'items' => array('heading', 'heading', 'heading', 'heading', 'checkbox', 'section', 'heading', 'checkbox', 'checkbox'),
|
348 |
'item_labels' => array
|
365 |
array('checkbox', 'name' => 'cb7')
|
366 |
),
|
367 |
'heading' => array(
|
368 |
+
'h1' => __('In its simplest form, a Sitemap is an XML file that lists URLs for a site along with additional metadata about each URL (when it was last updated, how often it usually changes, and how important it is, relative to other URLs in the site) so that search engines can more intelligently crawl the site — <em>http://www.sitemaps.org/</em>', 'bwp-simple-gxs') . '<br /><br />' . __('This plugin helps you generate both Sitemap Index files as well as normal Sitemap files. A Sitemap Index, as its name suggests, is one kind of sitemaps that allows you to group multiple sitemap files inside it.', 'bwp-simple-gxs'),
|
369 |
'h2' => __('<em>Basic information about all your sitemaps.</em>', 'bwp-simple-gxs'),
|
370 |
'h3' => __('<em>More detailed information about how your sitemaps are generated including <span style="color: #999999;">notices</span>, <span style="color: #FF0000;">errors</span> and <span style="color: #009900;">success messages</span>.</em>', 'bwp-simple-gxs'),
|
371 |
'h4' => sprintf(__('<em>Submit your sitemapindex to major search engines like <a href="%s" target="_blank">Google</a>, <a href="%s" target="_blank">Yahoo</a>, <a href="%s" target="_blank">Bing</a> or <a href="%s" target="_blank">Ask</a>.</em>', 'bwp-simple-gxs'), 'https://www.google.com/webmasters/tools/home?hl=en', 'https://siteexplorer.search.yahoo.com/mysites', 'http://www.bing.com/toolbox/webmasters/', 'http://about.ask.com/en/docs/about/webmasters.shtml#22'),
|
389 |
)
|
390 |
);
|
391 |
|
392 |
+
// Add a clear log button - @since 1.1.0
|
393 |
+
if (!$this->is_normal_admin())
|
394 |
+
add_filter('bwp_option_submit_button', array($this, 'add_clear_log_button'));
|
395 |
+
|
396 |
// Get the options
|
397 |
$options = $bwp_option_page->get_options(array('enable_ping', 'enable_ping_google', 'enable_ping_yahoo', 'enable_ping_bing', 'enable_ping_ask', 'enable_log', 'enable_debug'), $this->options);
|
398 |
|
408 |
$bwp_option_page->set_current_tab(2);
|
409 |
|
410 |
$form = array(
|
411 |
+
'items' => array('input', 'select', 'select', 'select', 'checkbox', 'checkbox', 'input', 'checkbox', 'checkbox', 'checkbox', 'checkbox', 'heading', 'checkbox', 'checkbox', 'checkbox', 'section', 'section', 'section', 'heading', 'input', 'input', 'heading', 'checkbox', 'checkbox', 'input', 'input'),
|
412 |
'item_labels' => array
|
413 |
(
|
414 |
__('Output no more than', 'bwp-simple-gxs'),
|
415 |
__('Default change frequency', 'bwp-simple-gxs'),
|
416 |
__('Default priority', 'bwp-simple-gxs'),
|
417 |
__('Minimum priority', 'bwp-simple-gxs'),
|
418 |
+
__('Use GMT for Last Modified date?', 'bwp-simple-gxs'),
|
|
|
419 |
__('Style your sitemaps with an XSLT stylesheet?', 'bwp-simple-gxs'),
|
420 |
__('Custom XSLT stylesheet URL', 'bwp-simple-gxs'),
|
421 |
__('Show build stats in sitemaps?', 'bwp-simple-gxs'),
|
422 |
__('Enable credit?', 'bwp-simple-gxs'),
|
423 |
__('Enable Gzip?', 'bwp-simple-gxs'),
|
424 |
+
__('Clean unexpected output before sitemap generation?', 'bwp-simple-gxs'),
|
425 |
+
__('Sitemap Index Options', 'bwp-simple-gxs'),
|
426 |
+
__('Automatically split post-based sitemaps into smaller sitemaps?', 'bwp-simple-gxs'),
|
427 |
+
__('Add sitemapindex to individual blog\'s virtual robots.txt?', 'bwp-simple-gxs'),
|
428 |
+
__('Add sitemapindex from all blogs within network to primary blog\'s virtual robots.txt?', 'bwp-simple-gxs'),
|
429 |
+
__('In sitemapindex, include', 'bwp-simple-gxs'),
|
430 |
+
__('Exclude following post types:', 'bwp-simple-gxs'),
|
431 |
+
__('Exclude following taxonomies:', 'bwp-simple-gxs'),
|
432 |
__('Module Options', 'bwp-simple-gxs'),
|
433 |
__('Alternate module directory', 'bwp-simple-gxs'),
|
434 |
__('Get no more than', 'bwp-simple-gxs'),
|
438 |
__('Cached sitemaps will last for', 'bwp-simple-gxs'),
|
439 |
__('Cached sitemaps are stored in (auto detected)', 'bwp-simple-gxs')
|
440 |
),
|
441 |
+
'item_names' => array('input_item_limit', 'select_default_freq', 'select_default_pri', 'select_min_pri', 'cb14', 'cb10', 'input_custom_xslt', 'cb3', 'cb6', 'cb4', 'cb15', 'h5', 'cb12', 'cb11', 'cb5', 'sec1', 'sec2', 'sec3', 'h4', 'input_alt_module_dir', 'input_sql_limit', 'h3', 'cb1', 'cb2', 'input_cache_age', 'input_cache_dir'),
|
442 |
'heading' => array(
|
443 |
'h3' => __('<em>Cache your sitemaps for better performance.</em>', 'bwp-simple-gxs'),
|
444 |
+
'h4' => sprintf(__('<em>This plugin uses modules to build sitemap data so it is recommended that you extend this plugin using modules rather than hooks. Some of the settings below only affect modules extending the base module class. Read more about using modules <a href="%s#using-modules">here</a>.</em>', 'bwp-simple-gxs'), $this->plugin_url),
|
445 |
+
'h5' => __('<em>Here you can change some settings that affect the default Sitemap Index file.</em>', 'bwp-simple-gxs')
|
446 |
),
|
447 |
'sec1' => array(
|
|
|
448 |
array('checkbox', 'name' => 'cb7'),
|
449 |
+
//array('checkbox', 'name' => 'cb8'),
|
450 |
+
array('checkbox', 'name' => 'cb9'),
|
451 |
+
array('checkbox', 'name' => 'cb13'),
|
452 |
+
array('checkbox', 'name' => 'cb16'),
|
453 |
+
array('checkbox', 'name' => 'cb17')
|
454 |
),
|
455 |
+
'sec2' => array(),
|
456 |
+
'sec3' => array(),
|
457 |
'select' => array(
|
458 |
'select_time_type' => array(
|
459 |
__('second(s)', 'bwp-simple-gxs') => 1,
|
480 |
'cb1' => array(__('your sitemaps are generated and then cached to reduce unnecessary work.', 'bwp-simple-gxs') => 'enable_cache'),
|
481 |
'cb2' => array(__('when a cached sitemap expires, this plugin will try to generate the cache again. If you disable this, remember to manually flush the cache once in a while.', 'bwp-simple-gxs') . ' <input type="submit" class="button-secondary action" name="flush_cache" value="' . __('Flush the cache', 'bwp-simple-gxs') . '" />' => 'enable_cache_auto_gen'),
|
482 |
'cb3' => array(__('tell you useful information such as build time, memory usage, SQL queries, etc.', 'bwp-simple-gxs') => 'enable_stats'),
|
483 |
+
'cb4' => array(__('make your sitemaps ~ 70% smaller. <strong>Important:</strong> If you see an error after enabling this, it\'s very likely that you have gzip active on your server already.', 'bwp-simple-gxs') => 'enable_gzip'),
|
484 |
+
'cb15' => array(__('only disable this when sitemaps appear in either blank page or plain text.', 'bwp-simple-gxs') => 'enable_php_clean'),
|
485 |
+
'cb5' => array(sprintf(__("If you have like 50 blogs, 50 <code>Sitemap: http://example.com/sitemapindex.xml</code> entries will be added to your primary blog's robots.txt, i.e. <code>%s</code>.", 'bwp-simple-gxs'), get_site_option('home') . '/robots.txt') => 'enable_global_robots'),
|
486 |
'cb7' => array(__("taxonomy archives' sitemaps, including custom taxonomies.", 'bwp-simple-gxs') => 'enable_sitemap_taxonomy'),
|
487 |
+
//'cb8' => array(__("tag archives' sitemap.", 'bwp-simple-gxs') => 'enable_sitemap_tag'),
|
488 |
'cb9' => array(__("date archives' sitemaps.", 'bwp-simple-gxs') => 'enable_sitemap_date'),
|
489 |
+
'cb13' => array(__("external pages' sitemap. This allows you to add links to pages that do not belong to WordPress to the sitemap.", 'bwp-simple-gxs') => 'enable_sitemap_external'),
|
490 |
'cb6' => array(__('some copyrighted info is also added to your sitemaps. Thanks!', 'bwp-simple-gxs') => 'enable_credit'),
|
491 |
+
'cb10' => array(__('This will load the default style sheet provided by this plugin. You can set a custom style sheet below or filter the <code>bwp_gxs_xslt</code> hook.', 'bwp-simple-gxs') => 'enable_xslt'),
|
492 |
+
'cb11' => array(sprintf(__('If you\'re on a Multi-site installation with Sub-domain enabled, each site will have its own robots.txt, sites in sub-directory will not. Please read the <a href="%s#toc-robots" target="_blank">documentation</a> for more info.', 'bwp-simple-gxs'), $this->plugin_url) => 'enable_robots'),
|
493 |
+
'cb12' => array(__('e.g. post1.xml, post2.xml, etc. And each sitemap will contain', 'bwp-simple-gxs') => 'enable_sitemap_split_post'),
|
494 |
+
'cb14' => array(__('If you disable this, make sure you also use <code>date_default_timezone_set</code> to correctly set up a timezone for your application.', 'bwp-simple-gxs') => 'enable_gmt'),
|
495 |
+
'cb16' => array(__('author archives\' sitemap.', 'bwp-simple-gxs') => 'enable_sitemap_author'),
|
496 |
+
'cb17' => array(__('site\'s home URL sitemap. For a multi-site installation of WordPress, this sitemap will list all domains within your network, not just the main blog. This also supports WPMU Domain Mapping plugin.', 'bwp-simple-gxs') => 'enable_sitemap_site')
|
497 |
),
|
498 |
'input' => array(
|
499 |
+
'input_item_limit' => array('size' => 5, 'label' => __('item(s) in one sitemap. You can not go over 50,000.', 'bwp-simple-gxs')),
|
500 |
+
'input_split_limit_post' => array('size' => 5, 'label' => __('item(s). Again , you can not go over 50,000.', 'bwp-simple-gxs')),
|
501 |
'input_alt_module_dir' => array('size' => 91, 'label' => __('Input a full path to the directory where you put your own modules (e.g. <code>/home/mysite/public_html/gxs-modules/</code>), you can also override a built-in module by having a module with the same filename in this directory. A filter is also available if you would like to use PHP instead.', 'bwp-simple-gxs')),
|
502 |
'input_cache_dir' => array('size' => 91, 'disabled' => ' disabled="disabled"', 'label' => __('The cache directory must be writable (i.e. CHMOD to 755 or 777).', 'bwp-simple-gxs')),
|
503 |
'input_sql_limit' => array('size' => 5, 'label' => __('item(s) in one SQL query. This helps you avoid running too heavy queries.', 'bwp-simple-gxs')),
|
506 |
'input_custom_xslt' => array('size' => 90, 'label' => __('expected to be an absolute URL, e.g. <code>http://example.com/my-stylesheet.xsl</code>. You must also have a style sheet for the sitemapindex that can be accessed through the above URL, e.g. <code>my-stylesheet.xsl</code> and <code>my-stylesheetindex.xsl</code>). Please leave blank if you do not wish to use.', 'bwp-simple-gxs'))
|
507 |
),
|
508 |
'inline_fields' => array(
|
509 |
+
'input_cache_age' => array('select_time_type' => 'select'),
|
510 |
+
'cb12' => array('input_split_limit_post' => 'input')
|
511 |
+
),
|
512 |
+
'container' => array(
|
513 |
+
'input_item_limit' => sprintf(__('<em><strong>Note:</strong> If you encounter white page problem, please refer to the <a target="_blank" href="%s">FAQ section</a> to know how to change this limit appropriately to make this plugin work. Also note that, for post-based sitemaps, this option will be overridden by the limit you set in the Sitemap Index Options below.</em>', 'bwp-simple-gxs'), $this->plugin_url . 'faq/')
|
514 |
)
|
515 |
);
|
516 |
|
519 |
$form['select']['select_default_freq'] = $changefreq;
|
520 |
|
521 |
// Get the options
|
522 |
+
$options = $bwp_option_page->get_options(array('input_item_limit', 'input_split_limit_post', 'input_alt_module_dir', 'input_cache_dir', 'input_sql_limit', 'input_cache_age', 'input_custom_xslt', 'input_exclude_post_type', 'input_exclude_taxonomy', 'enable_gmt', 'enable_robots', 'enable_xslt', 'enable_cache', 'enable_cache_auto_gen', 'enable_stats', 'enable_credit', 'enable_sitemap_split_post', 'enable_global_robots', 'enable_sitemap_date', 'enable_sitemap_taxonomy', 'enable_sitemap_external', 'enable_sitemap_author', 'enable_sitemap_site', 'enable_gzip', 'enable_php_clean', 'select_time_type', 'select_default_freq', 'select_default_pri', 'select_min_pri'), $this->options);
|
523 |
|
524 |
// Get option from the database
|
525 |
$options = $bwp_option_page->get_db_options($page, $options);
|
526 |
|
527 |
+
// Get dynamic options
|
528 |
+
if (isset($_POST['submit_' . $bwp_option_page->get_form_name()]))
|
529 |
+
{
|
530 |
+
check_admin_referer($page);
|
531 |
+
$ept = array(); $etax = array();
|
532 |
+
foreach ($_POST as $o => $v)
|
533 |
+
{
|
534 |
+
if (strpos($o, 'ept_') === 0)
|
535 |
+
$ept[] = trim(str_replace('ept_', '', $o));
|
536 |
+
else if (strpos($o, 'etax_') === 0)
|
537 |
+
$etax[] = trim(str_replace('etax_', '', $o));
|
538 |
+
}
|
539 |
+
$options['input_exclude_post_type'] = implode(',', $ept);
|
540 |
+
$options['input_exclude_taxonomy'] = implode(',', $etax);
|
541 |
+
}
|
542 |
+
|
543 |
+
// Build dynamic options
|
544 |
+
$post_types = get_post_types(array('public' => true), 'objects');
|
545 |
+
$taxonomies = get_taxonomies(array('public' => true), '');
|
546 |
+
$exclude_options = array(
|
547 |
+
'post_types' => explode(',', $options['input_exclude_post_type']),
|
548 |
+
'taxonomies' => explode(',', $options['input_exclude_taxonomy'])
|
549 |
+
);
|
550 |
+
$dynamic_options = array();
|
551 |
+
foreach ($post_types as $post_type)
|
552 |
+
{
|
553 |
+
if ('attachment' == $post_type->name)
|
554 |
+
continue;
|
555 |
+
$key = 'ept_' . $post_type->name;
|
556 |
+
$form['sec2'][] = array('checkbox', 'name' => $key);
|
557 |
+
$form['checkbox'][$key] = array(__($post_type->label) => $key);
|
558 |
+
if (in_array($post_type->name, $exclude_options['post_types']))
|
559 |
+
$dynamic_options[$key] = 'yes';
|
560 |
+
else
|
561 |
+
$dynamic_options[$key] = '';
|
562 |
+
}
|
563 |
+
foreach ($taxonomies as $taxonomy)
|
564 |
+
{
|
565 |
+
if ('post_format' == $taxonomy->name)
|
566 |
+
continue;
|
567 |
+
$key = 'etax_' . $taxonomy->name;
|
568 |
+
$form['sec3'][] = array('checkbox', 'name' => $key);
|
569 |
+
$form['checkbox'][$key] = array(__($taxonomy->label) => $key);
|
570 |
+
if (in_array($taxonomy->name, $exclude_options['taxonomies']))
|
571 |
+
$dynamic_options[$key] = 'yes';
|
572 |
+
else
|
573 |
+
$dynamic_options[$key] = '';
|
574 |
+
}
|
575 |
+
|
576 |
+
$option_formats = array('input_item_limit' => 'int', 'input_split_limit_post' => 'int', 'input_sql_limit' => 'int', 'input_cache_age' => 'int', 'select_time_type' => 'int');
|
577 |
+
$option_ignore = array('input_cache_dir', 'input_exclude_post_type', 'input_exclude_taxonomy');
|
578 |
// [WPMS Compatible]
|
579 |
$option_super_admin = $this->site_options;
|
580 |
}
|
582 |
// Flush the cache
|
583 |
if (isset($_POST['flush_cache']) && !$this->is_normal_admin())
|
584 |
{
|
585 |
+
check_admin_referer($page);
|
586 |
if ($deleted = $this->flush_cache())
|
587 |
$this->add_notice('<strong>' . __('Notice', 'bwp-simple-gxs') . ':</strong> ' . sprintf(__("<strong>%d</strong> cached sitemaps have been flushed successfully!", 'bwp-simple-gxs'), $deleted));
|
588 |
else
|
589 |
$this->add_notice('<strong>' . __('Notice', 'bwp-simple-gxs') . ':</strong> ' . __("Could not delete any cached sitemaps. Please manually check the cache directory.", 'bwp-simple-gxs'));
|
590 |
}
|
591 |
+
|
592 |
// Get option from user input
|
593 |
if (isset($_POST['submit_' . $bwp_option_page->get_form_name()]) && isset($options) && is_array($options))
|
594 |
{
|
595 |
check_admin_referer($page);
|
596 |
+
$need_flushed = false;
|
597 |
foreach ($options as $key => &$option)
|
598 |
{
|
599 |
+
$pre_option = $option;
|
600 |
+
// Get rid of options that do not have a key
|
601 |
+
if (preg_match('/^[0-9]+$/i', $key))
|
602 |
+
{
|
603 |
+
unset($options[$key]);
|
604 |
+
continue;
|
605 |
+
}
|
606 |
// [WPMS Compatible]
|
607 |
if ($this->is_normal_admin() && in_array($key, $option_super_admin))
|
608 |
{}
|
622 |
$option = trim(stripslashes($_POST[$key]));
|
623 |
else
|
624 |
$option = $this->options_default[$key];
|
625 |
+
// Mark that we need to flush rewrite rules
|
626 |
+
if (false !== strpos($key, 'enable_sitemap_') && $pre_option != $option)
|
627 |
+
$need_flushed = true;
|
628 |
}
|
629 |
}
|
630 |
update_option($page, $options);
|
631 |
+
// Flush rewrite rules if needed
|
632 |
+
if ($need_flushed)
|
633 |
+
self::flush_rewrite_rules();
|
634 |
// [WPMS Compatible]
|
635 |
if (!$this->is_normal_admin())
|
636 |
update_site_option($page, $options);
|
637 |
}
|
638 |
|
639 |
// [WPMS Compatible]
|
640 |
+
if (!$this->is_multisite() && $page == BWP_GXS_OPTION_GENERATOR)
|
641 |
+
$bwp_option_page->kill_html_fields($form, array(14));
|
642 |
if ($this->is_normal_admin())
|
643 |
{
|
644 |
switch ($page)
|
645 |
{
|
646 |
case BWP_GXS_OPTION_GENERATOR:
|
647 |
+
$bwp_option_page->kill_html_fields($form, array(9,10,13,14,18,19,20,21,22,23,24,25));
|
648 |
break;
|
649 |
|
650 |
case BWP_GXS_STATS:
|
658 |
$this->add_notice('<strong>' . __('Warning') . ':</strong> ' . __("Cache directory does not exist or is not writable. Please read more about directory permission <a href='http://www.zzee.com/solutions/unix-permissions.shtml'>here</a> (Unix).", 'bwp-simple-gxs'));
|
659 |
|
660 |
// Assign the form and option array
|
661 |
+
$bwp_option_page->init($form, $options + $dynamic_options, $this->form_tabs);
|
662 |
|
663 |
// Build the option page
|
664 |
echo $bwp_option_page->generate_html_form();
|
665 |
}
|
666 |
|
667 |
+
function add_clear_log_button($button)
|
668 |
+
{
|
669 |
+
$button = str_replace('</p>', ' <input type="submit" class="button-secondary action" name="clear_log" value="' . __('Clear All Logs', 'bwp-simple-gxs') . '" /></p>', $button);
|
670 |
+
return $button;
|
671 |
+
}
|
672 |
+
|
673 |
function flush_cache()
|
674 |
{
|
675 |
$dir = trailingslashit($this->options['input_cache_dir']);
|
766 |
$log_time[$key] = $row['time'];
|
767 |
array_multisort($log_time, SORT_DESC, $logs);
|
768 |
}
|
769 |
+
$log_str = (!$sitemap) ? '<li class="clear" style="margin-top: 5px; line-height: 1.7;"><span style="float: left; margin-right: 5px;">%s —</span> <span style="color: #%s;">%s</span></li>' : '<span style="margin-top: 5px; display: inline-block;">' . __('<a href="%s" target="_blank">%s</a> has been successfully built on <strong>%s</strong>.', 'bwp-simple-gxs') . '</span><br />';
|
770 |
$output = '<ul class="bwp-gxs-log">' . "\n";
|
771 |
foreach ($logs as $log)
|
772 |
{
|
779 |
$output .= sprintf($log_str, date(__('M j, Y : H:i:s', 'bwp-simple-gxs'), $log['time']), $color, $log['log']) . "\n";
|
780 |
}
|
781 |
else
|
782 |
+
{
|
783 |
+
// @since 1.1.5 - check for mapped domain
|
784 |
+
global $wpdb, $blog_id;
|
785 |
+
if (!empty($wpdb->dmtable) && !empty($wpdb->blogs) && $this->is_multisite())
|
786 |
+
{
|
787 |
+
$mapped_domain = $wpdb->get_var($wpdb->prepare('
|
788 |
+
SELECT wpdm.domain as mapped_domain FROM ' . $wpdb->blogs . ' wpblogs
|
789 |
+
INNER JOIN ' . $wpdb->dmtable . ' wpdm
|
790 |
+
ON wpblogs.blog_id = wpdm.blog_id
|
791 |
+
WHERE wpblogs.public = 1 AND wpblogs.spam = 0 AND wpblogs.deleted = 0 AND wpblogs.blog_id = %d', $blog_id));
|
792 |
+
}
|
793 |
+
// Default to the main site's scheme
|
794 |
+
$home = @parse_url(home_url());
|
795 |
+
$sitemap_struct = (!empty($mapped_domain)) ? str_replace($home['host'], str_replace(array('http', 'https'), '', $mapped_domain), $this->options['input_sitemap_struct']) : $this->options['input_sitemap_struct'];
|
796 |
+
$output .= sprintf($log_str, sprintf($sitemap_struct, $log['url']), $log['url'], date(__('M j, Y : H:i:s', 'bwp-simple-gxs'), $log['time'])) . "\n";
|
797 |
+
}
|
798 |
}
|
799 |
+
|
800 |
return $output . '</ul>' . "\n";
|
801 |
}
|
802 |
+
|
803 |
function format_label($label)
|
804 |
{
|
805 |
return str_replace(' ', '_', strtolower($label));
|
807 |
|
808 |
function do_robots($output, $public)
|
809 |
{
|
810 |
+
global $blog_id, $wpdb;
|
811 |
+
|
812 |
if ('0' == $public)
|
813 |
return $output;
|
814 |
+
|
815 |
if ((defined('SUBDOMAIN_INSTALL') && true == SUBDOMAIN_INSTALL) || (isset($blog_id) && 1 == $blog_id))
|
816 |
{
|
817 |
$output .= "\n";
|
818 |
$output .= 'Sitemap: ' . $this->options['input_sitemap_url'];
|
819 |
$output .= "\n";
|
820 |
}
|
821 |
+
// Add all other sitemapindex within the network into the primary blog's robots.txt
|
822 |
+
if ($this->is_multisite() && 'yes' == $this->options['enable_global_robots'] && isset($blog_id) && 1 == $blog_id)
|
823 |
+
{
|
824 |
+
$blogs = $wpdb->get_results("SELECT * FROM $wpdb->blogs WHERE public = 1 AND spam = 0 AND deleted = 0");
|
825 |
+
foreach ($blogs as $blog)
|
826 |
+
{
|
827 |
+
if (1 == $blog->blog_id)
|
828 |
+
continue;
|
829 |
+
$scheme = is_ssl() ? 'https://' : 'http://';
|
830 |
+
$path = rtrim($blog->path, '/');
|
831 |
+
$output .= 'Sitemap: ' . str_replace(home_url(), $scheme . $blog->domain . $path, $this->options['input_sitemap_url']) . "\n";
|
832 |
+
}
|
833 |
+
$output .= "\n";
|
834 |
+
}
|
835 |
return $output;
|
836 |
}
|
837 |
|
859 |
$host = $original['host'];
|
860 |
else
|
861 |
{
|
|
|
|
|
862 |
wp_redirect(sprintf($this->options['input_sitemap_struct'], $xml_slug), 301);
|
863 |
exit;
|
864 |
}
|
914 |
function allowed_modules()
|
915 |
{
|
916 |
$allowed_modules = array();
|
917 |
+
$this->allowed_modules = &$allowed_modules;
|
918 |
+
// Site home URL sitemap - @since 1.1.5
|
919 |
+
if ('yes' == $this->options['enable_sitemap_site'])
|
920 |
+
$this->add_module('site');
|
921 |
+
// Module exclusion list
|
922 |
+
$excluded_post_types = explode(',', $this->options['input_exclude_post_type']);
|
923 |
+
$excluded_taxonomies = explode(',', $this->options['input_exclude_taxonomy']);
|
924 |
// Add public post types to module list
|
925 |
$post_types = $this->post_types = get_post_types(array('public' => true), 'objects');
|
926 |
foreach ($this->post_types as $post_type)
|
927 |
{
|
928 |
// Page will have its own
|
929 |
+
if ('page' != $post_type->name && !in_array($post_type->name, $excluded_post_types))
|
930 |
$allowed_modules['post'][] = $post_type->name;
|
931 |
}
|
932 |
// Add pages to module list
|
933 |
+
if (!in_array('page', $excluded_post_types))
|
934 |
$allowed_modules['page'] = array('page');
|
935 |
// Add archive pages to module list
|
936 |
if ('yes' == $this->options['enable_sitemap_date'])
|
940 |
if ('yes' == $this->options['enable_sitemap_taxonomy'])
|
941 |
{
|
942 |
foreach ($this->taxonomies as $taxonomy)
|
943 |
+
if (!in_array($taxonomy->name, $excluded_taxonomies))
|
944 |
+
$allowed_modules['taxonomy'][] = $taxonomy->name;
|
|
|
|
|
|
|
945 |
}
|
|
|
|
|
946 |
// Remove some unnecessary sitemap
|
947 |
$this->remove_module('post', 'attachment');
|
948 |
$this->remove_module('taxonomy', 'post_format');
|
949 |
$this->remove_module('taxonomy', 'nav_menu');
|
950 |
+
// Add / Remove modules based on users' preferences
|
951 |
+
if ('yes' == $this->options['enable_sitemap_author'])
|
952 |
+
$this->add_module('author');
|
953 |
+
if ('yes' == $this->options['enable_sitemap_external'])
|
954 |
+
$this->add_module('page', 'external');
|
955 |
// Hook for a custom module list
|
956 |
+
do_action('bwp_gxs_modules_built', $this->allowed_modules, $this->post_types, $this->taxonomies);
|
957 |
return $this->allowed_modules;
|
958 |
}
|
959 |
|
1043 |
// Remember to use $wpdb->prepare or $wpdb->escape when developing module
|
1044 |
$module = stripslashes($module);
|
1045 |
$sub_module = stripslashes($sub_module);
|
1046 |
+
// Check whether or not splitting is enabled and the sub_module has a 'part' part,
|
1047 |
+
// if so, remove it and pass a parameter to let the module knows that it must produce a split sitemap
|
1048 |
+
$module_part = 0;
|
1049 |
+
$module_virtual = '';
|
1050 |
+
if ('yes' == $this->options['enable_sitemap_split_post'] && preg_match('/part([0-9]+)$/i', $sub_module, $matches))
|
1051 |
+
{
|
1052 |
+
$module_virtual = str_replace($matches[0], '', $sub_module);
|
1053 |
+
$module_virtual = rtrim($module_virtual, '_');
|
1054 |
+
$module_part = (int) $matches[1];
|
1055 |
+
}
|
1056 |
$true_sub_module = $sub_module;
|
1057 |
$pre_module = $module;
|
1058 |
$pre_module .= (!empty($sub_module)) ? '_' . $sub_module : '';
|
1059 |
// @since 1.0.1 - Redirect to correct domain, with or without www
|
1060 |
$this->canonical_redirect($pre_module);
|
|
|
|
|
|
|
|
|
1061 |
// Allowed modules
|
1062 |
$allowed_modules = $this->allowed_modules();
|
1063 |
$this->build_requested_modules($allowed_modules);
|
1066 |
{
|
1067 |
if (!empty($sub_module))
|
1068 |
{
|
1069 |
+
if (in_array($sub_module, $allowed_modules[$module]) || (empty($module_virtual) && !empty($module_part) && in_array($module, $allowed_modules[$module])) || (!empty($module_virtual) && in_array($module_virtual, $allowed_modules[$module])))
|
1070 |
$module_key = $module . '_' . $sub_module;
|
1071 |
else
|
1072 |
$module_key = '';
|
1074 |
else
|
1075 |
$module_key = $module;
|
1076 |
$module_name = str_replace($sub_module, $true_sub_module, $module_key);
|
|
|
|
|
1077 |
}
|
1078 |
else if ('sitemapindex' == $module)
|
1079 |
{
|
1080 |
$module_key = 'sitemapindex';
|
1081 |
$module_name = 'sitemapindex';
|
1082 |
}
|
1083 |
+
|
1084 |
+
// Pass the real sub_module back
|
1085 |
+
$sub_module = (!empty($module_part)) ? $module_virtual : $sub_module;
|
1086 |
+
|
1087 |
if (empty($module_key))
|
1088 |
{
|
1089 |
$this->elog(sprintf(__('Requested module (<em>%s</em>) not found or not allowed.', 'bwp-simple-gxs'), $pre_module), true, 404);
|
1090 |
$this->commit_logs();
|
1091 |
// If debugging is not enabled, redirect to homepage
|
1092 |
+
wp_redirect(home_url());
|
1093 |
exit;
|
1094 |
}
|
1095 |
|
1097 |
timer_start();
|
1098 |
$this->build_stats['query'] = get_num_queries();
|
1099 |
|
1100 |
+
// Don't let other instrusive plugins mess up our permalnks - @since 1.1.4
|
1101 |
+
remove_filter('post_link', 'syndication_permalink', 1, 3);
|
1102 |
+
remove_filter('page_link', 'suffusion_unlink_page', 10, 2);
|
1103 |
+
|
1104 |
// If cache is enabled, we check the cache first
|
1105 |
if ('yes' == $this->options['enable_cache'])
|
1106 |
{
|
1111 |
{
|
1112 |
$this->send_header($bwp_gxs_cache->get_header());
|
1113 |
$file = $bwp_gxs_cache->get_cache_file();
|
1114 |
+
// Decompress the gz file only if the server or script is not already gzipping, and gzip is enabled
|
1115 |
+
// This is to avoid double compression
|
1116 |
+
if ('yes' == $this->options['enable_gzip'] && !self::is_gzipped())
|
|
|
|
|
1117 |
readfile($file);
|
1118 |
+
else
|
1119 |
+
readgzfile($file);
|
1120 |
+
// Get from cache successfully
|
1121 |
$this->slog(sprintf(__('Successfully served a cached version of <em>%s.xml</em>.', 'bwp-simple-gxs'), $module_name), true);
|
1122 |
$this->commit_logs();
|
1123 |
exit;
|
1197 |
}
|
1198 |
}
|
1199 |
|
1200 |
+
$this->module_data = array('module' => $module, 'sub_module' => $sub_module, 'module_key' => $module_key, 'module_name' => $module_name, 'module_part' => $module_part);
|
1201 |
|
1202 |
if (class_exists('BWP_GXS_MODULE_' . $module_key))
|
1203 |
{
|
1207 |
$success = $this->generate_sitemap($the_module->data);
|
1208 |
else
|
1209 |
$success = $this->generate_sitemap_index($the_module->data);
|
1210 |
+
unset($the_module->data);
|
1211 |
}
|
1212 |
else
|
1213 |
$this->elog(sprintf(__('There is no class named <strong>%s</strong> in the module file <strong>%s</strong>.', 'bwp-simple-gxs'), 'BWP_GXS_MODULE_' . strtoupper($module_key), $module_file), true);
|
1227 |
{
|
1228 |
$the_module = new BWP_GXS_MODULE_INDEX($this->requested_modules);
|
1229 |
$success = $this->generate_sitemap_index($the_module->data);
|
1230 |
+
unset($the_module->data);
|
1231 |
}
|
1232 |
}
|
1233 |
|
1234 |
// Output succeeded
|
1235 |
if (true == $success)
|
1236 |
{
|
1237 |
+
// Output additional stats
|
1238 |
+
if ('yes' == $this->options['enable_stats'])
|
1239 |
+
$this->sitemap_stats();
|
1240 |
+
// Now cache the sitemap if we have to
|
1241 |
if ('yes' == $this->options['enable_cache'] && true == $bwp_gxs_cache->cache_ok)
|
|
|
1242 |
$bwp_gxs_cache->write_cache();
|
1243 |
// Output the requested sitemap
|
1244 |
$this->output_sitemap();
|
1253 |
|
1254 |
function send_header($header = array())
|
1255 |
{
|
1256 |
+
global $bwp_gxs_ob_start, $bwp_gxs_ob_level, $bwp_gxs_gzipped;
|
1257 |
+
|
1258 |
+
// If debug is not enabled and gzip is not turned on in between,
|
1259 |
+
// we try to clean all errors before sending new headers - @since 1.1.2
|
1260 |
+
$clean_ok = ((int) $bwp_gxs_gzipped == (int) self::is_gzipped() && 'yes' == $this->options['enable_php_clean']) ? true : false;
|
1261 |
+
$ob_contents = '';
|
1262 |
+
if ($bwp_gxs_ob_start && @ob_get_level())
|
1263 |
+
{
|
1264 |
+
$ob_level = @ob_get_level() - $bwp_gxs_ob_level;
|
1265 |
+
while ($ob_level > 0)
|
1266 |
+
{
|
1267 |
+
$ob_level -= 1;
|
1268 |
+
$ob_contents .= ob_get_contents();
|
1269 |
+
if ('yes' != $this->options['enable_debug'] && $clean_ok)
|
1270 |
+
@ob_end_clean();
|
1271 |
+
}
|
1272 |
+
}
|
1273 |
+
|
1274 |
+
// If there are some contents but we can't clean them, show a friendly error
|
1275 |
+
if (!empty($ob_contents) && (!$clean_ok || 'yes' == $this->options['enable_debug']))
|
1276 |
+
wp_die(__('<strong>BWP Google XML Sitemap Message:</strong> Unexpected output (most of the time PHP errors) is preventing BWP GXS from showing any sitemap contents. Try disabling <code>WP_DEBUG</code> or this plugin\'s debug mode, whichever is on. All unexpected outputs should be shown just above this message. If you don\'t see any, contact me and I might be able to help.', 'bwp-simple-gxs'));
|
1277 |
+
|
1278 |
if (!empty($_SERVER['SERVER_SOFTWARE']) && strstr($_SERVER['SERVER_SOFTWARE'], 'Apache/2'))
|
1279 |
header ('Cache-Control: no-cache, pre-check=0, post-check=0, max-age=0');
|
1280 |
else
|
1302 |
if ('yes' == $this->options['enable_gzip'])
|
1303 |
header('Content-Encoding: ' . $this->check_gzip_type());
|
1304 |
|
1305 |
+
// Everything's cool
|
1306 |
+
status_header(200);
|
1307 |
+
|
1308 |
return;
|
1309 |
}
|
1310 |
|
1311 |
+
public static function is_gzipped()
|
1312 |
{
|
1313 |
+
if (ini_get('zlib.output_compression') || ini_get('output_handler') == 'ob_gzhandler' || in_array('ob_gzhandler', @ob_list_handlers()))
|
1314 |
return true;
|
1315 |
+
return false;
|
1316 |
}
|
1317 |
|
1318 |
function init_gzip()
|
1371 |
$response = wp_remote_post($url, array('timeout' => $this->timeout));
|
1372 |
if (is_wp_error($response))
|
1373 |
{
|
1374 |
+
$errno = $response->get_error_code();
|
1375 |
+
$errorstr = $response->get_error_message();
|
1376 |
$this->elog($errorstr);
|
|
|
1377 |
}
|
1378 |
+
else if (isset($response['response']))
|
1379 |
{
|
1380 |
+
$the_response = $response['response'];
|
1381 |
+
if (empty($the_response['code']))
|
1382 |
+
$this->elog(__('Unknown response code from search engines. Ping failed.', 'bwp-simple-gxs'));
|
1383 |
+
else if (200 == (int) $the_response['code'])
|
1384 |
+
$this->slog(sprintf(__('Pinged %s successfully!', 'bwp-simple-gxs'), ucfirst($key)));
|
1385 |
+
else if (200 != (int) $the_response['code'])
|
1386 |
+
{
|
1387 |
+
$errno = $the_response['code'];
|
1388 |
+
$errorstr = $the_response['message'];
|
1389 |
+
$this->elog(sprintf(__('Error %s from %s', 'bwp-simple-gxs'), $errno, ucfirst($key)) . ': ' . $errorstr);
|
1390 |
+
}
|
1391 |
}
|
1392 |
}
|
1393 |
else
|
|
|
1394 |
$this->elog(sprintf(__('Ping limit for today to %s has been reached, sorry!', 'bwp-simple-gxs'), ucfirst($key)));
|
|
|
|
|
1395 |
}
|
1396 |
}
|
1397 |
+
// Update statistics
|
1398 |
+
$this->commit_logs();
|
1399 |
update_option(BWP_GXS_PING, $ping_data);
|
1400 |
}
|
1401 |
|
1403 |
{
|
1404 |
if ('yes' == $this->options['enable_gzip'])
|
1405 |
{
|
1406 |
+
$this->output = (!self::is_gzipped()) ? gzencode($this->output, 6) : $this->output;
|
1407 |
$this->send_header();
|
1408 |
echo $this->output;
|
1409 |
}
|
1426 |
return true;
|
1427 |
}
|
1428 |
|
1429 |
+
function sitemap_stats($type = '')
|
1430 |
{
|
1431 |
$time = timer_stop(0, 3);
|
1432 |
$sql = get_num_queries() - $this->build_stats['query'];
|
1433 |
$memory = size_format(memory_get_usage() - $this->build_stats['mem'], 2);
|
1434 |
if (empty($type))
|
1435 |
+
$this->output .= "\n" . sprintf($this->templates['stats'], $time, $memory, $sql, $this->output_num);
|
1436 |
else
|
1437 |
echo "\n" . sprintf($this->templates['stats_cached'], $time, $memory, $sql);
|
1438 |
}
|
1471 |
$xml .= '<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' . "\n\t" . 'xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9' . "\n\t" . 'http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"' . "\n\t" . 'xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . "\n";
|
1472 |
if ('yes' != $this->options['enable_xslt'] && 'yes' == $this->options['enable_credit'])
|
1473 |
$xml .= $this->credit();
|
1474 |
+
|
1475 |
if (!$this->check_output($output))
|
1476 |
return false;
|
1477 |
|
1478 |
+
foreach ($output as &$url)
|
1479 |
{
|
1480 |
$url['location'] = (!empty($url['location'])) ? $url['location'] : '';
|
1481 |
$url['lastmod'] = (!empty($url['lastmod'])) ? $url['lastmod'] : '';
|
1482 |
+
$url['freq'] = (isset($url['freq']) && in_array($url['freq'], $this->frequency)) ? $url['freq'] : $this->options['select_default_freq'];
|
1483 |
+
$url['priority'] = (isset($url['priority']) && $url['priority'] <= 1 && $url['priority'] > 0) ? $url['priority'] : $this->options['select_default_pri'];
|
1484 |
$xml .= $this->generate_url_item(htmlspecialchars($url['location']), $url['priority'], $url['freq'], $url['lastmod']);
|
1485 |
+
$this->output_num++;
|
1486 |
}
|
1487 |
|
1488 |
$xml .= "\n" . '</urlset>';
|
1489 |
$this->output = $xml;
|
1490 |
|
|
|
|
|
|
|
1491 |
return true;
|
1492 |
}
|
1493 |
|
1502 |
if (!$this->check_output($output))
|
1503 |
return false;
|
1504 |
|
1505 |
+
foreach ($output as &$sitemap)
|
1506 |
{
|
1507 |
$sitemap['location'] = (!empty($sitemap['location'])) ? $sitemap['location'] : '';
|
1508 |
$sitemap['lastmod'] = (!empty($sitemap['lastmod'])) ? $sitemap['lastmod'] : '';
|
1509 |
$xml .= $this->generate_sitemap_item(htmlspecialchars($sitemap['location']), $sitemap['lastmod']);
|
1510 |
+
$this->output_num++;
|
1511 |
}
|
1512 |
|
1513 |
$xml .= "\n" . '</sitemapindex>';
|
1514 |
$this->output = $xml;
|
1515 |
|
|
|
|
|
|
|
1516 |
return true;
|
1517 |
}
|
1518 |
}
|
includes/modules/archive.php
CHANGED
@@ -6,69 +6,61 @@
|
|
6 |
|
7 |
class BWP_GXS_MODULE_ARCHIVE extends BWP_GXS_MODULE {
|
8 |
|
|
|
|
|
9 |
function __construct()
|
10 |
{
|
|
|
|
|
11 |
$this->set_current_time();
|
|
|
12 |
$this->build_data();
|
13 |
}
|
14 |
|
15 |
-
function
|
16 |
{
|
17 |
-
global $wpdb
|
18 |
|
19 |
-
|
20 |
-
// We will just call wp_get_archives and get the cache it creates
|
21 |
-
$requested = $bwp_gxs->module_data['sub_module'];
|
22 |
-
wp_get_archives(array('echo' => 0, 'type' => $requested));
|
23 |
-
$archives = current(wp_cache_get('wp_get_archives' , 'general'));
|
24 |
-
|
25 |
-
$top_date = $archives[0]->year . '-12-31 12:00:00';
|
26 |
-
$bottom_date = $archives[count($archives)-1]->year . '-01-01 00:00:00';
|
27 |
-
$latest_post_query = '
|
28 |
-
SELECT * FROM ' . $wpdb->posts . "
|
29 |
-
WHERE post_status = 'publish' AND post_type <> 'page'
|
30 |
-
AND post_modified >= '$bottom_date' AND post_modified <= '$top_date'" . '
|
31 |
-
ORDER BY post_modified DESC';
|
32 |
-
$latest_posts = $wpdb->get_results($latest_post_query);
|
33 |
|
34 |
if ('monthly' == $requested)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
{
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
$data['location'] = get_month_link($
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
$data['priority'] = $this->cal_priority($post, $data['freq']);
|
47 |
-
break;
|
48 |
-
}
|
49 |
-
}
|
50 |
-
$this->data[] = $data;
|
51 |
-
}
|
52 |
-
}
|
53 |
-
else if ('yearly' == $requested)
|
54 |
-
{
|
55 |
-
foreach ($archives as $archive)
|
56 |
-
{
|
57 |
-
$data = array();
|
58 |
-
$data['location'] = get_year_link($archive->year);
|
59 |
-
foreach ($latest_posts as $post)
|
60 |
-
{
|
61 |
-
if ($archive->year == (int) date('Y', strtotime($post->post_modified)))
|
62 |
-
{
|
63 |
-
$data['lastmod'] = $this->format_lastmod(strtotime($post->post_modified));
|
64 |
-
$data['freq'] = $this->cal_frequency($post);
|
65 |
-
$data['priority'] = $this->cal_priority($post, $data['freq']);
|
66 |
-
break;
|
67 |
-
}
|
68 |
-
}
|
69 |
-
$this->data[] = $data;
|
70 |
-
}
|
71 |
}
|
|
|
|
|
|
|
|
|
72 |
}
|
73 |
}
|
74 |
?>
|
6 |
|
7 |
class BWP_GXS_MODULE_ARCHIVE extends BWP_GXS_MODULE {
|
8 |
|
9 |
+
var $requested = '';
|
10 |
+
|
11 |
function __construct()
|
12 |
{
|
13 |
+
global $bwp_gxs;
|
14 |
+
|
15 |
$this->set_current_time();
|
16 |
+
$this->requested = $bwp_gxs->module_data['sub_module'];
|
17 |
$this->build_data();
|
18 |
}
|
19 |
|
20 |
+
function generate_data()
|
21 |
{
|
22 |
+
global $wpdb;
|
23 |
|
24 |
+
$requested = $this->requested;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
|
26 |
if ('monthly' == $requested)
|
27 |
+
$latest_post_query = '
|
28 |
+
SELECT YEAR(post_date) AS year, MONTH(post_date) as month, COUNT(ID) as posts, comment_count, post_modified
|
29 |
+
FROM ' . $wpdb->posts . "
|
30 |
+
WHERE post_status = 'publish' AND post_type <> 'page'" . '
|
31 |
+
GROUP BY YEAR(post_date), MONTH(post_date)
|
32 |
+
ORDER BY post_modified DESC';
|
33 |
+
else
|
34 |
+
$latest_post_query = '
|
35 |
+
SELECT YEAR(post_date) AS year, COUNT(ID) as posts, comment_count, post_modified
|
36 |
+
FROM ' . $wpdb->posts . "
|
37 |
+
WHERE post_status = 'publish' AND post_type <> 'page'" . '
|
38 |
+
GROUP BY YEAR(post_date)
|
39 |
+
ORDER BY post_modified DESC';
|
40 |
+
|
41 |
+
$latest_posts = $this->get_results($latest_post_query);
|
42 |
+
|
43 |
+
if (!isset($latest_posts) || 0 == sizeof($latest_posts))
|
44 |
+
return false;
|
45 |
+
|
46 |
+
$data = array();
|
47 |
+
for ($i = 0; $i < sizeof($latest_posts); $i++)
|
48 |
{
|
49 |
+
$post = $latest_posts[$i];
|
50 |
+
$data = $this->init_data($data);
|
51 |
+
if ('monthly' == $requested)
|
52 |
+
$data['location'] = get_month_link($post->year, $post->month);
|
53 |
+
else if ('yearly' == $requested)
|
54 |
+
$data['location'] = get_year_link($post->year);
|
55 |
+
$data['lastmod'] = $this->format_lastmod(strtotime($post->post_modified));
|
56 |
+
$data['freq'] = $this->cal_frequency($post);
|
57 |
+
$data['priority'] = $this->cal_priority($post, $data['freq']);
|
58 |
+
$this->data[] = $data;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
}
|
60 |
+
|
61 |
+
unset($latest_posts);
|
62 |
+
|
63 |
+
return true;
|
64 |
}
|
65 |
}
|
66 |
?>
|
includes/modules/author.php
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2011 Khang Minh <betterwp.net>
|
4 |
+
* @license http://www.gnu.org/licenses/gpl.html GNU GENERAL PUBLIC LICENSE
|
5 |
+
*/
|
6 |
+
|
7 |
+
class BWP_GXS_MODULE_AUTHOR extends BWP_GXS_MODULE {
|
8 |
+
|
9 |
+
function __construct()
|
10 |
+
{
|
11 |
+
$this->set_current_time();
|
12 |
+
$this->build_data();
|
13 |
+
}
|
14 |
+
|
15 |
+
function generate_data()
|
16 |
+
{
|
17 |
+
global $wpdb, $bwp_gxs;
|
18 |
+
|
19 |
+
// An array of what roles to include in sitemap
|
20 |
+
$roles = array('administrator', 'editor', 'author');
|
21 |
+
// The SQL query
|
22 |
+
$author_sql = 'SELECT wp_u.ID, wp_u.user_nicename, MAX(wp_p.post_modified) as lastmod, wp_um.meta_value as role
|
23 |
+
FROM ' . $wpdb->users . ' wp_u
|
24 |
+
INNER JOIN ' . $wpdb->usermeta . ' wp_um
|
25 |
+
ON wp_um.user_id = wp_u.ID
|
26 |
+
INNER JOIN ' . $wpdb->posts . ' wp_p
|
27 |
+
ON wp_p.post_author = wp_u.ID' . "
|
28 |
+
WHERE wp_p.post_status = 'publish' AND wp_um.meta_key = '" . $wpdb->prefix . "capabilities'" . '
|
29 |
+
GROUP BY wp_u.ID, wp_u.user_nicename, wp_um.meta_value
|
30 |
+
ORDER BY lastmod DESC';
|
31 |
+
// Get all authors
|
32 |
+
$authors = $this->get_results($author_sql);
|
33 |
+
|
34 |
+
if (!isset($authors) || 0 == sizeof($authors))
|
35 |
+
return false;
|
36 |
+
|
37 |
+
$data = array();
|
38 |
+
for ($i = 0; $i < sizeof($authors); $i++)
|
39 |
+
{
|
40 |
+
// If user is not considered an author, pass
|
41 |
+
$author = $authors[$i];
|
42 |
+
$data = $this->init_data($data);
|
43 |
+
$role = maybe_unserialize($author->role);
|
44 |
+
$role = array_keys($role);
|
45 |
+
if (!in_array($role[0], $roles))
|
46 |
+
continue;
|
47 |
+
$data['location'] = get_author_posts_url($author->ID, $author->user_nicename);
|
48 |
+
$data['lastmod'] = $this->format_lastmod(strtotime($author->lastmod));
|
49 |
+
$data['freq'] = $this->cal_frequency(NULL, $author->lastmod);
|
50 |
+
$data['priority'] = $this->cal_priority(NULL, $data['freq']);
|
51 |
+
$this->data[] = $data;
|
52 |
+
}
|
53 |
+
|
54 |
+
unset($authors);
|
55 |
+
|
56 |
+
return true;
|
57 |
+
}
|
58 |
+
}
|
59 |
+
?>
|
includes/modules/page.php
CHANGED
@@ -8,7 +8,10 @@ class BWP_GXS_MODULE_PAGE extends BWP_GXS_MODULE {
|
|
8 |
|
9 |
function __construct()
|
10 |
{
|
|
|
|
|
11 |
$this->set_current_time();
|
|
|
12 |
$this->build_data();
|
13 |
}
|
14 |
|
@@ -16,10 +19,12 @@ class BWP_GXS_MODULE_PAGE extends BWP_GXS_MODULE {
|
|
16 |
{
|
17 |
global $wpdb, $bwp_gxs, $post;
|
18 |
|
|
|
|
|
19 |
$latest_post_query = '
|
20 |
-
SELECT * FROM ' . $wpdb->posts . "
|
21 |
-
WHERE post_status = 'publish' AND post_type = 'page'" . '
|
22 |
-
ORDER BY post_modified DESC';
|
23 |
|
24 |
$latest_posts = $this->get_results($latest_post_query);
|
25 |
|
@@ -27,23 +32,21 @@ class BWP_GXS_MODULE_PAGE extends BWP_GXS_MODULE {
|
|
27 |
return false;
|
28 |
|
29 |
$data = array();
|
30 |
-
|
31 |
{
|
32 |
-
$post = $
|
33 |
$data = $this->init_data($data);
|
34 |
-
// Benefit from WP Caching
|
35 |
wp_cache_add($post->ID, $post, 'posts');
|
36 |
$data['location'] = get_permalink();
|
37 |
$data['lastmod'] = $this->format_lastmod(strtotime($post->post_modified));
|
38 |
$data['freq'] = $this->cal_frequency($post);
|
39 |
$data['priority'] = $this->cal_priority($post, $data['freq']);
|
40 |
$this->data[] = $data;
|
41 |
-
unset($item);
|
42 |
}
|
43 |
|
44 |
-
//
|
45 |
unset($latest_posts);
|
46 |
-
|
47 |
// Always return true if we can get here, otherwise you're stuck at the SQL cycling limit
|
48 |
return true;
|
49 |
}
|
8 |
|
9 |
function __construct()
|
10 |
{
|
11 |
+
global $bwp_gxs;
|
12 |
+
|
13 |
$this->set_current_time();
|
14 |
+
$this->part = $bwp_gxs->module_data['module_part'];
|
15 |
$this->build_data();
|
16 |
}
|
17 |
|
19 |
{
|
20 |
global $wpdb, $bwp_gxs, $post;
|
21 |
|
22 |
+
$sql_where = apply_filters('bwp_gxs_post_where', '', 'page');
|
23 |
+
|
24 |
$latest_post_query = '
|
25 |
+
SELECT * FROM ' . $wpdb->posts . " wposts
|
26 |
+
WHERE wposts.post_status = 'publish' AND wposts.post_type = 'page' $sql_where" . '
|
27 |
+
ORDER BY wposts.post_modified DESC';
|
28 |
|
29 |
$latest_posts = $this->get_results($latest_post_query);
|
30 |
|
32 |
return false;
|
33 |
|
34 |
$data = array();
|
35 |
+
for ($i = 0; $i < sizeof($latest_posts); $i++)
|
36 |
{
|
37 |
+
$post = $latest_posts[$i];
|
38 |
$data = $this->init_data($data);
|
|
|
39 |
wp_cache_add($post->ID, $post, 'posts');
|
40 |
$data['location'] = get_permalink();
|
41 |
$data['lastmod'] = $this->format_lastmod(strtotime($post->post_modified));
|
42 |
$data['freq'] = $this->cal_frequency($post);
|
43 |
$data['priority'] = $this->cal_priority($post, $data['freq']);
|
44 |
$this->data[] = $data;
|
|
|
45 |
}
|
46 |
|
47 |
+
// Probably save some memory ;)
|
48 |
unset($latest_posts);
|
49 |
+
|
50 |
// Always return true if we can get here, otherwise you're stuck at the SQL cycling limit
|
51 |
return true;
|
52 |
}
|
includes/modules/page_external.php
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2011 Khang Minh <betterwp.net>
|
4 |
+
* @license http://www.gnu.org/licenses/gpl.html GNU GENERAL PUBLIC LICENSE
|
5 |
+
*/
|
6 |
+
|
7 |
+
class BWP_GXS_MODULE_PAGE_EXTERNAL extends BWP_GXS_MODULE {
|
8 |
+
|
9 |
+
function __construct()
|
10 |
+
{
|
11 |
+
global $bwp_gxs;
|
12 |
+
|
13 |
+
$this->set_current_time();
|
14 |
+
$this->build_data();
|
15 |
+
}
|
16 |
+
|
17 |
+
function build_data()
|
18 |
+
{
|
19 |
+
global $wpdb, $bwp_gxs;
|
20 |
+
|
21 |
+
// The structure of your external pages should be like the below sample item
|
22 |
+
// array('location' => '', 'lastmod' => '', 'priority' => '')
|
23 |
+
// Frequency will be calculated based on lastmod
|
24 |
+
$sample_pages = array(
|
25 |
+
array('location' => home_url('a-page-not-belong-to-wordpress.html'), 'lastmod' => '06/02/2011', 'priority' => '1.0'),
|
26 |
+
array('location' => home_url('another-page-not-belong-to-wordpress.html'), 'lastmod' => '05/02/2011', 'priority' => '0.8')
|
27 |
+
);
|
28 |
+
$external_pages = (array) apply_filters('bwp_gxs_external_pages', $sample_pages);
|
29 |
+
|
30 |
+
$data = array();
|
31 |
+
for ($i = 0; $i < sizeof($external_pages); $i++)
|
32 |
+
{
|
33 |
+
$page = $external_pages[$i];
|
34 |
+
$data = $this->init_data($data);
|
35 |
+
$data['location'] = $page['location'];
|
36 |
+
$data['lastmod'] = $this->format_lastmod(strtotime($page['lastmod']));
|
37 |
+
$data['freq'] = $this->cal_frequency(NULL, $page['lastmod']);
|
38 |
+
$data['priority'] = $page['priority'];
|
39 |
+
$this->data[] = $data;
|
40 |
+
}
|
41 |
+
}
|
42 |
+
}
|
43 |
+
?>
|
includes/modules/post.php
CHANGED
@@ -18,11 +18,20 @@ class BWP_GXS_MODULE_POST extends BWP_GXS_MODULE {
|
|
18 |
// $this->set_current_time() should always be called, it will allow you to use $this->now (the current Unix Timestamp).
|
19 |
$this->set_current_time();
|
20 |
// $bwp_gxs->module_data hold four things, but you only need to take note of 'sub_module' and 'module_key'
|
21 |
-
// For example when you are browsing to http://example.com/
|
22 |
// $bwp_gxs->module_data['sub_module'] is 'category' (the singular name) and $bwp_gxs->module_data['module_key'] is
|
23 |
// 'taxonomy_category' (also singular). If you have a custom module for taxonomy_category, you must name your class
|
24 |
// BWP_GXS_MODULE_TAXONOMY_CATEGORY and save the file as taxonomy_category.php (similar to taxonomy_post_tag.php).
|
25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
// Always call this to start building data
|
27 |
// If you want to make use of SQL cycling (a method to reduce heavy queries), don't use build_data() like other modules.
|
28 |
// Just call it here and use function generate_data() to build actual data, just like below. Use SQL cycling when
|
@@ -44,20 +53,35 @@ class BWP_GXS_MODULE_POST extends BWP_GXS_MODULE {
|
|
44 |
|
45 |
$requested = $this->requested;
|
46 |
|
47 |
-
//
|
48 |
-
|
49 |
-
$requested = 'post';
|
50 |
|
51 |
// A standard custom query to fetch posts from database, sorted by their lastmod
|
52 |
// You can use any type of queries for your modules
|
53 |
-
$
|
54 |
-
|
55 |
-
|
56 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
// Use $this->get_results instead of $wpdb->get_results, remember to escape your query
|
58 |
// using $wpdb->prepare or $wpdb->escape, @see http://codex.wordpress.org/Function_Reference/wpdb_Class
|
59 |
$latest_posts = $this->get_results($wpdb->prepare($latest_post_query, $requested));
|
60 |
-
|
61 |
// This check helps you stop the cycling sooner
|
62 |
// It basically means if there is nothing to loop through anymore we return false so the cycling can stop.
|
63 |
if (!isset($latest_posts) || 0 == sizeof($latest_posts))
|
@@ -65,24 +89,23 @@ class BWP_GXS_MODULE_POST extends BWP_GXS_MODULE {
|
|
65 |
|
66 |
// Always init your $data
|
67 |
$data = array();
|
68 |
-
|
69 |
{
|
70 |
-
$post = $
|
71 |
// Init your $data with the previous item's data. This makes sure no item is mal-formed.
|
72 |
$data = $this->init_data($data);
|
73 |
-
//
|
74 |
-
|
75 |
-
$data['location'] = get_permalink();
|
76 |
$data['lastmod'] = $this->format_lastmod(strtotime($post->post_modified));
|
77 |
$data['freq'] = $this->cal_frequency($post);
|
78 |
$data['priority'] = $this->cal_priority($post, $data['freq']);
|
|
|
79 |
$this->data[] = $data;
|
80 |
-
unset($item);
|
81 |
}
|
82 |
|
83 |
-
//
|
84 |
unset($latest_posts);
|
85 |
-
|
86 |
// Always return true if we can get here, otherwise you're stuck at the SQL cycling limit
|
87 |
return true;
|
88 |
}
|
18 |
// $this->set_current_time() should always be called, it will allow you to use $this->now (the current Unix Timestamp).
|
19 |
$this->set_current_time();
|
20 |
// $bwp_gxs->module_data hold four things, but you only need to take note of 'sub_module' and 'module_key'
|
21 |
+
// For example when you are browsing to http://example.com/taxonomy_category.xml
|
22 |
// $bwp_gxs->module_data['sub_module'] is 'category' (the singular name) and $bwp_gxs->module_data['module_key'] is
|
23 |
// 'taxonomy_category' (also singular). If you have a custom module for taxonomy_category, you must name your class
|
24 |
// BWP_GXS_MODULE_TAXONOMY_CATEGORY and save the file as taxonomy_category.php (similar to taxonomy_post_tag.php).
|
25 |
+
// If no custom post type is requested, use the default post type
|
26 |
+
$this->requested = (!empty($bwp_gxs->module_data['sub_module'])) ? $bwp_gxs->module_data['sub_module'] : 'post';
|
27 |
+
// module_part let you determine whether or not to build a post sitemap as part of a large post sitemap. If this value is
|
28 |
+
// greater than 0, for example 2, or 3 it means that we are building part 2, or part 3 of that large sitemap, and we
|
29 |
+
// will have to modify our SQL query accordingly - @since 1.1.0
|
30 |
+
$this->part = $bwp_gxs->module_data['module_part'];
|
31 |
+
// Get the permalink this website uses, apply to normal posts
|
32 |
+
$this->perma_struct = get_option('permalink_structure');
|
33 |
+
// See if the current post_type is a hierarchical one or not
|
34 |
+
$this->post_type = get_post_type_object($this->requested);
|
35 |
// Always call this to start building data
|
36 |
// If you want to make use of SQL cycling (a method to reduce heavy queries), don't use build_data() like other modules.
|
37 |
// Just call it here and use function generate_data() to build actual data, just like below. Use SQL cycling when
|
53 |
|
54 |
$requested = $this->requested;
|
55 |
|
56 |
+
// Can be something like: ` AND wposts.ID NOT IN (1,2,3,4) `
|
57 |
+
$sql_where = apply_filters('bwp_gxs_post_where', '', $requested);
|
|
|
58 |
|
59 |
// A standard custom query to fetch posts from database, sorted by their lastmod
|
60 |
// You can use any type of queries for your modules
|
61 |
+
// If $requested is 'post' and this site uses %category% in permalink structure,
|
62 |
+
// we will have to use a complex SQL query so this plugin can scale up to millions of posts.
|
63 |
+
if ('post' == $requested && strpos($this->perma_struct, '%category%') !== false)
|
64 |
+
$latest_post_query = '
|
65 |
+
SELECT * FROM ' . $wpdb->term_relationships . ' wprel
|
66 |
+
INNER JOIN ' . $wpdb->posts . ' wposts
|
67 |
+
ON wprel.object_id = wposts.ID' . "
|
68 |
+
AND wposts.post_status = 'publish'" . '
|
69 |
+
INNER JOIN ' . $wpdb->term_taxonomy . ' wptax
|
70 |
+
ON wprel.term_taxonomy_id = wptax.term_taxonomy_id' . "
|
71 |
+
AND wptax.taxonomy = 'category'" . '
|
72 |
+
, ' . $wpdb->terms . ' wpterms
|
73 |
+
WHERE wptax.term_id = wpterms.term_id '
|
74 |
+
. "$sql_where" . '
|
75 |
+
GROUP BY wposts.ID
|
76 |
+
ORDER BY wposts.post_modified DESC';
|
77 |
+
else
|
78 |
+
$latest_post_query = '
|
79 |
+
SELECT * FROM ' . $wpdb->posts . " wposts
|
80 |
+
WHERE wposts.post_status = 'publish' AND wposts.post_type = %s $sql_where" . '
|
81 |
+
ORDER BY wposts.post_modified DESC';
|
82 |
// Use $this->get_results instead of $wpdb->get_results, remember to escape your query
|
83 |
// using $wpdb->prepare or $wpdb->escape, @see http://codex.wordpress.org/Function_Reference/wpdb_Class
|
84 |
$latest_posts = $this->get_results($wpdb->prepare($latest_post_query, $requested));
|
|
|
85 |
// This check helps you stop the cycling sooner
|
86 |
// It basically means if there is nothing to loop through anymore we return false so the cycling can stop.
|
87 |
if (!isset($latest_posts) || 0 == sizeof($latest_posts))
|
89 |
|
90 |
// Always init your $data
|
91 |
$data = array();
|
92 |
+
for ($i = 0; $i < sizeof($latest_posts); $i++)
|
93 |
{
|
94 |
+
$post = $latest_posts[$i];
|
95 |
// Init your $data with the previous item's data. This makes sure no item is mal-formed.
|
96 |
$data = $this->init_data($data);
|
97 |
+
// @since 1.1.0 - get permalink independently, as we don't need caching or some complicated stuff
|
98 |
+
$data['location'] = $this->get_permalink();
|
|
|
99 |
$data['lastmod'] = $this->format_lastmod(strtotime($post->post_modified));
|
100 |
$data['freq'] = $this->cal_frequency($post);
|
101 |
$data['priority'] = $this->cal_priority($post, $data['freq']);
|
102 |
+
// Pass data back to the plugin to handle
|
103 |
$this->data[] = $data;
|
|
|
104 |
}
|
105 |
|
106 |
+
// Probably save some memory ;)
|
107 |
unset($latest_posts);
|
108 |
+
|
109 |
// Always return true if we can get here, otherwise you're stuck at the SQL cycling limit
|
110 |
return true;
|
111 |
}
|
includes/modules/post_attachment.php
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
echo 'Intentionally left blank.';
|
3 |
+
exit;
|
4 |
+
?>
|
includes/modules/post_most_popular.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Copyright (c) 2011 Khang Minh <betterwp.net>
|
4 |
* @license http://www.gnu.org/licenses/gpl.html GNU GENERAL PUBLIC LICENSE
|
5 |
*
|
6 |
-
* This is a sample custom module
|
7 |
*/
|
8 |
|
9 |
class BWP_GXS_MODULE_POST_MOST_POPULAR extends BWP_GXS_MODULE {
|
@@ -13,6 +13,7 @@ class BWP_GXS_MODULE_POST_MOST_POPULAR extends BWP_GXS_MODULE {
|
|
13 |
// Give your properties value here
|
14 |
// $this->set_current_time() should always be called, it will allow you to use $this->now (the current Unix Timestamp).
|
15 |
$this->set_current_time();
|
|
|
16 |
// Always call this to start building data
|
17 |
// If you want to make use of SQL cycling (a method to reduce heavy queries), don't use build_data() like other modules.
|
18 |
// Just call it here and use function generate_data() to build actual data, just like below. Use SQL cycling when
|
@@ -32,11 +33,11 @@ class BWP_GXS_MODULE_POST_MOST_POPULAR extends BWP_GXS_MODULE {
|
|
32 |
{
|
33 |
global $wpdb, $bwp_gxs, $post;
|
34 |
|
35 |
-
// A query for posts with most comments
|
36 |
$latest_post_query = '
|
37 |
SELECT * FROM ' . $wpdb->posts . "
|
38 |
WHERE post_status = 'publish' AND post_type = 'post' AND comment_count > 2" . '
|
39 |
ORDER BY comment_count, post_modified DESC';
|
|
|
40 |
// Use $this->get_results instead of $wpdb->get_results, remember to escape your query
|
41 |
// using $wpdb->prepare or $wpdb->escape, @see http://codex.wordpress.org/Function_Reference/wpdb_Class
|
42 |
$latest_posts = $this->get_results($latest_post_query);
|
@@ -46,24 +47,23 @@ class BWP_GXS_MODULE_POST_MOST_POPULAR extends BWP_GXS_MODULE {
|
|
46 |
if (!isset($latest_posts) || 0 == sizeof($latest_posts))
|
47 |
return false;
|
48 |
|
|
|
49 |
$data = array();
|
50 |
-
|
51 |
{
|
52 |
-
$post = $
|
|
|
53 |
$data = $this->init_data($data);
|
54 |
-
// Make use of WP's cache
|
55 |
-
wp_cache_add($post->ID, $post, 'posts');
|
56 |
$data['location'] = get_permalink();
|
57 |
$data['lastmod'] = $this->format_lastmod(strtotime($post->post_modified));
|
58 |
$data['freq'] = $this->cal_frequency($post);
|
59 |
$data['priority'] = $this->cal_priority($post, $data['freq']);
|
60 |
$this->data[] = $data;
|
61 |
-
unset($item);
|
62 |
}
|
63 |
-
|
64 |
-
//
|
65 |
unset($latest_posts);
|
66 |
-
|
67 |
// Always return true if we can get here, otherwise you're stuck at the SQL cycling limit
|
68 |
return true;
|
69 |
}
|
3 |
* Copyright (c) 2011 Khang Minh <betterwp.net>
|
4 |
* @license http://www.gnu.org/licenses/gpl.html GNU GENERAL PUBLIC LICENSE
|
5 |
*
|
6 |
+
* This is a sample custom module. Some if about the module developer here would be nice!
|
7 |
*/
|
8 |
|
9 |
class BWP_GXS_MODULE_POST_MOST_POPULAR extends BWP_GXS_MODULE {
|
13 |
// Give your properties value here
|
14 |
// $this->set_current_time() should always be called, it will allow you to use $this->now (the current Unix Timestamp).
|
15 |
$this->set_current_time();
|
16 |
+
$this->perma_struct = get_option('permalink_structure');
|
17 |
// Always call this to start building data
|
18 |
// If you want to make use of SQL cycling (a method to reduce heavy queries), don't use build_data() like other modules.
|
19 |
// Just call it here and use function generate_data() to build actual data, just like below. Use SQL cycling when
|
33 |
{
|
34 |
global $wpdb, $bwp_gxs, $post;
|
35 |
|
|
|
36 |
$latest_post_query = '
|
37 |
SELECT * FROM ' . $wpdb->posts . "
|
38 |
WHERE post_status = 'publish' AND post_type = 'post' AND comment_count > 2" . '
|
39 |
ORDER BY comment_count, post_modified DESC';
|
40 |
+
|
41 |
// Use $this->get_results instead of $wpdb->get_results, remember to escape your query
|
42 |
// using $wpdb->prepare or $wpdb->escape, @see http://codex.wordpress.org/Function_Reference/wpdb_Class
|
43 |
$latest_posts = $this->get_results($latest_post_query);
|
47 |
if (!isset($latest_posts) || 0 == sizeof($latest_posts))
|
48 |
return false;
|
49 |
|
50 |
+
// Always init your $data
|
51 |
$data = array();
|
52 |
+
for ($i = 0; $i < sizeof($latest_posts); $i++)
|
53 |
{
|
54 |
+
$post = $latest_posts[$i];
|
55 |
+
// Init your $data with the previous item's data. This makes sure no item is mal-formed.
|
56 |
$data = $this->init_data($data);
|
|
|
|
|
57 |
$data['location'] = get_permalink();
|
58 |
$data['lastmod'] = $this->format_lastmod(strtotime($post->post_modified));
|
59 |
$data['freq'] = $this->cal_frequency($post);
|
60 |
$data['priority'] = $this->cal_priority($post, $data['freq']);
|
61 |
$this->data[] = $data;
|
|
|
62 |
}
|
63 |
+
|
64 |
+
// Probably save some memory ;)
|
65 |
unset($latest_posts);
|
66 |
+
|
67 |
// Always return true if we can get here, otherwise you're stuck at the SQL cycling limit
|
68 |
return true;
|
69 |
}
|
includes/modules/site.php
ADDED
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2011 Khang Minh <betterwp.net>
|
4 |
+
* @license http://www.gnu.org/licenses/gpl.html GNU GENERAL PUBLIC LICENSE
|
5 |
+
*/
|
6 |
+
|
7 |
+
class BWP_GXS_MODULE_SITE extends BWP_GXS_MODULE {
|
8 |
+
|
9 |
+
function __construct()
|
10 |
+
{
|
11 |
+
$this->set_current_time();
|
12 |
+
$this->build_data();
|
13 |
+
}
|
14 |
+
|
15 |
+
function generate_data()
|
16 |
+
{
|
17 |
+
global $wpdb, $blog_id;
|
18 |
+
|
19 |
+
// If this is simply not a multisite installation, or a multisite installation, but not on main site,
|
20 |
+
// just show the lonely domain
|
21 |
+
if (empty($wpdb->blogs) || (!empty($blog_id) && 1 < $blog_id))
|
22 |
+
{
|
23 |
+
$last_mod = $wpdb->get_var('SELECT post_modified FROM ' . $wpdb->posts . " WHERE post_status = 'publish' ORDER BY post_modified DESC");
|
24 |
+
$data = array();
|
25 |
+
$data['location'] = trailingslashit(home_url());
|
26 |
+
$data['lastmod'] = $this->format_lastmod(strtotime($last_mod));
|
27 |
+
$data['freq'] = apply_filters('bwp_gxs_freq_site', $this->cal_frequency(NULL, $last_mod), $blog_id);
|
28 |
+
$data['freq'] = ('always' == $data['freq']) ? 'hourly' : $data['freq'];
|
29 |
+
$data['priority'] = 1;
|
30 |
+
$this->data[] = $data;
|
31 |
+
return false;
|
32 |
+
}
|
33 |
+
else if (isset($blog_id) && 1 == $blog_id)
|
34 |
+
{
|
35 |
+
if (!empty($wpdb->dmtable))
|
36 |
+
// If domain mapping is active
|
37 |
+
$blog_sql = 'SELECT wpblogs.*, wpdm.domain as mapped_domain FROM ' . $wpdb->blogs . ' wpblogs
|
38 |
+
LEFT JOIN ' . $wpdb->dmtable . ' wpdm
|
39 |
+
ON wpblogs.blog_id = wpdm.blog_id
|
40 |
+
WHERE wpblogs.public = 1 AND wpblogs.spam = 0 AND wpblogs.deleted = 0';
|
41 |
+
else
|
42 |
+
// Otherwise
|
43 |
+
$blog_sql = 'SELECT * FROM ' . $wpdb->blogs . ' WHERE public = 1 AND spam = 0 AND deleted = 0';
|
44 |
+
|
45 |
+
// Get all blogs
|
46 |
+
$blogs = $this->get_results($blog_sql);
|
47 |
+
|
48 |
+
if (!isset($blogs) || 0 == sizeof($blogs))
|
49 |
+
return false;
|
50 |
+
|
51 |
+
$data = array();
|
52 |
+
for ($i = 0; $i < sizeof($blogs); $i++)
|
53 |
+
{
|
54 |
+
$blog = $blogs[$i];
|
55 |
+
$data = $this->init_data($data);
|
56 |
+
// Get the correct domain
|
57 |
+
$scheme = is_ssl() ? 'https://' : 'http://';
|
58 |
+
$path = $blog->path;
|
59 |
+
$data['location'] = (empty($blog->mapped_domain)) ? $scheme . $blog->domain . $path : $scheme . str_replace(array('http', 'https'), '', $blog->mapped_domain) . '/';
|
60 |
+
$data['lastmod'] = $this->format_lastmod(strtotime($blog->last_updated));
|
61 |
+
$data['freq'] = apply_filters('bwp_gxs_freq_site', $this->cal_frequency(NULL, $blog->last_updated), $blog->blog_id);
|
62 |
+
$data['freq'] = ('always' == $data['freq']) ? 'hourly' : $data['freq'];
|
63 |
+
// Always give primary blog a priority of 1
|
64 |
+
$data['priority'] = (0 == $i) ? 1 : $this->cal_priority(NULL, $data['freq']);
|
65 |
+
$this->data[] = $data;
|
66 |
+
}
|
67 |
+
|
68 |
+
unset($blogs);
|
69 |
+
|
70 |
+
return true;
|
71 |
+
}
|
72 |
+
else
|
73 |
+
return false;
|
74 |
+
}
|
75 |
+
}
|
76 |
+
?>
|
includes/modules/sitemapindex.php
CHANGED
@@ -43,16 +43,34 @@ class BWP_GXS_MODULE_INDEX extends BWP_GXS_MODULE {
|
|
43 |
INNER JOIN ' . $wpdb->posts . ' AS s ON s.post_type = f.post_type
|
44 |
AND s.post_modified = f.mpmd
|
45 |
LIMIT ' . (int) $limit;
|
46 |
-
|
47 |
$latest_posts = $wpdb->get_results($latest_post_query);
|
48 |
|
|
|
|
|
|
|
49 |
// Build a temporary array holding post type and their latest modified date, sorted by post_modified
|
50 |
foreach ($latest_posts as $a_post)
|
51 |
-
{
|
52 |
$temp_posts[$a_post->post_type] = $this->format_lastmod(strtotime($a_post->post_modified));
|
53 |
-
}
|
54 |
arsort($temp_posts);
|
55 |
$prime_lastmod = current($temp_posts);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
|
57 |
$taxonomies = $bwp_gxs->taxonomies;
|
58 |
|
@@ -61,13 +79,46 @@ class BWP_GXS_MODULE_INDEX extends BWP_GXS_MODULE {
|
|
61 |
{
|
62 |
$data = $this->init_data($data);
|
63 |
$data['location'] = $this->get_xml_link($item[0]);
|
64 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
{
|
66 |
if (isset($item[1]['post']))
|
67 |
{
|
68 |
$the_post = $this->get_post_by_post_type($item[1]['post'], $latest_posts);
|
69 |
if ($the_post)
|
70 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
}
|
72 |
else if (isset($item[1]['taxonomy']))
|
73 |
{
|
@@ -84,7 +135,8 @@ class BWP_GXS_MODULE_INDEX extends BWP_GXS_MODULE {
|
|
84 |
if (empty($data['lastmod']))
|
85 |
$data['lastmod'] = $prime_lastmod;
|
86 |
// Pass data back to the plugin
|
87 |
-
|
|
|
88 |
}
|
89 |
}
|
90 |
}
|
43 |
INNER JOIN ' . $wpdb->posts . ' AS s ON s.post_type = f.post_type
|
44 |
AND s.post_modified = f.mpmd
|
45 |
LIMIT ' . (int) $limit;
|
|
|
46 |
$latest_posts = $wpdb->get_results($latest_post_query);
|
47 |
|
48 |
+
if (!isset($latest_posts) || !is_array($latest_posts) || 0 == sizeof($latest_posts))
|
49 |
+
return false;
|
50 |
+
|
51 |
// Build a temporary array holding post type and their latest modified date, sorted by post_modified
|
52 |
foreach ($latest_posts as $a_post)
|
|
|
53 |
$temp_posts[$a_post->post_type] = $this->format_lastmod(strtotime($a_post->post_modified));
|
|
|
54 |
arsort($temp_posts);
|
55 |
$prime_lastmod = current($temp_posts);
|
56 |
+
|
57 |
+
// Determine whether or not to split post-based sitemaps - @since 1.1.0
|
58 |
+
$post_count_array = array();
|
59 |
+
if ('yes' == $bwp_gxs->options['enable_sitemap_split_post'])
|
60 |
+
{
|
61 |
+
$post_count_query = '
|
62 |
+
SELECT COUNT(ID) as total, post_type
|
63 |
+
FROM ' . $wpdb->posts . "
|
64 |
+
WHERE post_status = 'publish'" . '
|
65 |
+
GROUP BY post_type
|
66 |
+
';
|
67 |
+
$post_counts = $wpdb->get_results($post_count_query);
|
68 |
+
// Make the result array friendly
|
69 |
+
foreach ($post_counts as $count)
|
70 |
+
$post_count_array[$count->post_type] = $count->total;
|
71 |
+
unset($post_counts);
|
72 |
+
unset($count);
|
73 |
+
}
|
74 |
|
75 |
$taxonomies = $bwp_gxs->taxonomies;
|
76 |
|
79 |
{
|
80 |
$data = $this->init_data($data);
|
81 |
$data['location'] = $this->get_xml_link($item[0]);
|
82 |
+
$passed = false; // Whether or not to pass data back at the end
|
83 |
+
if ('site' == $item[0])
|
84 |
+
{
|
85 |
+
// Site home URL sitemap - @since 1.1.5
|
86 |
+
$data['lastmod'] = $prime_lastmod;
|
87 |
+
}
|
88 |
+
else if (isset($item[1]))
|
89 |
{
|
90 |
if (isset($item[1]['post']))
|
91 |
{
|
92 |
$the_post = $this->get_post_by_post_type($item[1]['post'], $latest_posts);
|
93 |
if ($the_post)
|
94 |
+
{
|
95 |
+
// If we have a matching post_type and the total number of posts reach the split limit,
|
96 |
+
// we will split this post sitemap accordingly
|
97 |
+
if ('yes' == $bwp_gxs->options['enable_sitemap_split_post'] && sizeof($post_count_array) > 0 && isset($post_count_array[$the_post->post_type]) && $post_count_array[$the_post->post_type] > $bwp_gxs->options['input_split_limit_post'])
|
98 |
+
{
|
99 |
+
$num_part = floor($post_count_array[$the_post->post_type] / $bwp_gxs->options['input_split_limit_post']) + 1;
|
100 |
+
if (1 < $num_part)
|
101 |
+
{
|
102 |
+
$data['location'] = $this->get_xml_link($item[0] . '_part1');
|
103 |
+
$data['lastmod'] = $this->format_lastmod(strtotime($the_post->post_modified));
|
104 |
+
$this->data[] = $data;
|
105 |
+
$time_step = round(7776000 / $num_part);
|
106 |
+
$time_step = (20000 > $time_step) ? 20000 : $time_step;
|
107 |
+
for ($i = 2; $i <= $num_part; $i++)
|
108 |
+
{
|
109 |
+
$part_data['location'] = $this->get_xml_link($item[0] . '_part' . $i);
|
110 |
+
// Reduce the lastmod for about 1 month
|
111 |
+
$part_data['lastmod'] = $this->format_lastmod(strtotime($the_post->post_modified) - $i * $time_step);
|
112 |
+
$this->data[] = $part_data;
|
113 |
+
}
|
114 |
+
$passed = true;
|
115 |
+
}
|
116 |
+
else
|
117 |
+
$data['lastmod'] = $this->format_lastmod(strtotime($the_post->post_modified));
|
118 |
+
}
|
119 |
+
else
|
120 |
+
$data['lastmod'] = $this->format_lastmod(strtotime($the_post->post_modified));
|
121 |
+
}
|
122 |
}
|
123 |
else if (isset($item[1]['taxonomy']))
|
124 |
{
|
135 |
if (empty($data['lastmod']))
|
136 |
$data['lastmod'] = $prime_lastmod;
|
137 |
// Pass data back to the plugin
|
138 |
+
if (false == $passed)
|
139 |
+
$this->data[] = $data;
|
140 |
}
|
141 |
}
|
142 |
}
|
includes/modules/taxonomy.php
CHANGED
@@ -10,55 +10,85 @@ class BWP_GXS_MODULE_TAXONOMY extends BWP_GXS_MODULE {
|
|
10 |
function __construct()
|
11 |
{
|
12 |
$this->set_current_time();
|
13 |
-
$this->build_data();
|
14 |
}
|
15 |
|
16 |
-
function
|
17 |
{
|
18 |
global $wpdb, $bwp_gxs;
|
19 |
|
20 |
$requested = $bwp_gxs->module_data['sub_module'];
|
21 |
-
$the_taxonomy = $bwp_gxs->taxonomies[$requested];
|
22 |
-
$object_types = $the_taxonomy->object_type;
|
23 |
-
$post_type_in = array();
|
24 |
-
foreach ($object_types as $post_type)
|
25 |
-
$post_type_in[] = "wpost.post_type = '$post_type'";
|
26 |
-
$post_type_in = implode(' OR ', $post_type_in);
|
27 |
|
28 |
$latest_post_query = '
|
29 |
-
SELECT
|
30 |
-
INNER JOIN ' . $wpdb->posts . '
|
31 |
-
ON wprel.object_id =
|
32 |
INNER JOIN ' . $wpdb->term_taxonomy . ' wptax
|
33 |
ON wprel.term_taxonomy_id = wptax.term_taxonomy_id' . "
|
34 |
-
WHERE
|
35 |
-
AND
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
|
42 |
$data = array();
|
43 |
-
|
44 |
{
|
45 |
-
$
|
|
|
|
|
46 |
$data = $this->init_data($data);
|
47 |
-
|
48 |
-
|
49 |
-
$data['location'] = get_term_link($term, $requested);
|
50 |
-
if (isset($latest_posts[$count - 1]))
|
51 |
{
|
52 |
-
$post = $
|
53 |
$data['lastmod'] = $this->format_lastmod(strtotime($post->post_modified));
|
54 |
$data['freq'] = $this->cal_frequency($post);
|
55 |
$data['priority'] = $this->cal_priority($post, $data['freq']);
|
56 |
}
|
|
|
|
|
|
|
|
|
|
|
57 |
$this->data[] = $data;
|
|
|
|
|
58 |
}
|
59 |
-
|
60 |
-
|
61 |
-
$
|
|
|
|
|
|
|
62 |
}
|
63 |
}
|
64 |
?>
|
10 |
function __construct()
|
11 |
{
|
12 |
$this->set_current_time();
|
13 |
+
$this->build_data('lastmod');
|
14 |
}
|
15 |
|
16 |
+
function generate_data()
|
17 |
{
|
18 |
global $wpdb, $bwp_gxs;
|
19 |
|
20 |
$requested = $bwp_gxs->module_data['sub_module'];
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
|
22 |
$latest_post_query = '
|
23 |
+
SELECT MAX(wposts.post_modified) as post_modified, MAX(wposts.comment_count) as comment_count, wptax.term_id FROM ' . $wpdb->term_relationships . ' wprel
|
24 |
+
INNER JOIN ' . $wpdb->posts . ' wposts
|
25 |
+
ON wprel.object_id = wposts.ID
|
26 |
INNER JOIN ' . $wpdb->term_taxonomy . ' wptax
|
27 |
ON wprel.term_taxonomy_id = wptax.term_taxonomy_id' . "
|
28 |
+
WHERE wposts.post_status = 'publish'" . '
|
29 |
+
AND wptax.taxonomy = %s
|
30 |
+
AND wptax.count > 0
|
31 |
+
GROUP BY wptax.term_id
|
32 |
+
ORDER BY wptax.term_id DESC';
|
33 |
+
$latest_posts = $this->get_results($wpdb->prepare($latest_post_query, $requested));
|
34 |
+
|
35 |
+
if (!isset($latest_posts) || 0 == sizeof($latest_posts))
|
36 |
+
return false;
|
37 |
+
|
38 |
+
$term_query = '
|
39 |
+
SELECT t.*, tt.*
|
40 |
+
FROM ' . $wpdb->terms . ' AS t
|
41 |
+
INNER JOIN ' . $wpdb->term_taxonomy . ' AS tt
|
42 |
+
ON t.term_id = tt.term_id
|
43 |
+
WHERE tt.taxonomy = %s AND tt.count > 0
|
44 |
+
ORDER BY t.term_id DESC';
|
45 |
+
$terms = $this->get_results($wpdb->prepare($term_query, $requested));
|
46 |
+
|
47 |
+
if (!isset($terms) || 0 == sizeof($terms))
|
48 |
+
return false;
|
49 |
+
|
50 |
+
// Can be something like array('cat1', 'cat2', 'cat3')
|
51 |
+
$exclude_terms = (array) apply_filters('bwp_gxs_term_exclude', array(''), $requested);
|
52 |
+
// Build an array with term_id as key
|
53 |
+
$term2post = array();
|
54 |
+
for ($i = 0; $i < sizeof($latest_posts); $i++)
|
55 |
+
{
|
56 |
+
$post = $latest_posts[$i];
|
57 |
+
if (!empty($post->term_id) && !isset($term2post[$post->term_id]))
|
58 |
+
$term2post[$post->term_id] = $post;
|
59 |
+
unset($post);
|
60 |
+
}
|
61 |
|
62 |
$data = array();
|
63 |
+
for ($i = 0; $i < sizeof($terms); $i++)
|
64 |
{
|
65 |
+
$term = $terms[$i];
|
66 |
+
if (in_array($term->slug, $exclude_terms))
|
67 |
+
continue;
|
68 |
$data = $this->init_data($data);
|
69 |
+
$data['location'] = $this->get_term_link($term, $requested);
|
70 |
+
if (isset($term2post[$term->term_id]))
|
|
|
|
|
71 |
{
|
72 |
+
$post = $term2post[$term->term_id];
|
73 |
$data['lastmod'] = $this->format_lastmod(strtotime($post->post_modified));
|
74 |
$data['freq'] = $this->cal_frequency($post);
|
75 |
$data['priority'] = $this->cal_priority($post, $data['freq']);
|
76 |
}
|
77 |
+
else
|
78 |
+
{
|
79 |
+
$data['freq'] = $this->cal_frequency('', $data['lastmod']);
|
80 |
+
$data['priority'] = $this->cal_priority('', $data['freq']);
|
81 |
+
}
|
82 |
$this->data[] = $data;
|
83 |
+
unset($post);
|
84 |
+
unset($term);
|
85 |
}
|
86 |
+
|
87 |
+
unset($latest_posts);
|
88 |
+
unset($term2post);
|
89 |
+
unset($terms);
|
90 |
+
|
91 |
+
return true;
|
92 |
}
|
93 |
}
|
94 |
?>
|
readme.txt
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
=== Better WordPress Google XML Sitemaps (with sitemapindex and Multi-site support) ===
|
2 |
Contributors: OddOneOut
|
3 |
Donate link: http://betterwp.net/wordpress-plugins/google-xml-sitemaps/#contributions
|
4 |
-
Tags: xml sitemaps, google xml sitemaps, sitemapindex, sitemap, bing, google, msn, ask, multi-site, multisite
|
5 |
Requires at least: 3.0
|
6 |
-
Tested up to: 3.
|
7 |
-
Stable tag: 1.
|
8 |
|
9 |
The first WordPress XML Sitemap plugin that comes with comprehensive support for Sitemapindex and Multi-site.
|
10 |
|
@@ -12,6 +12,13 @@ The first WordPress XML Sitemap plugin that comes with comprehensive support for
|
|
12 |
|
13 |
Welcome to the first WordPress sitemap plugin that has support for both sitemapindex and Multi-site websites! You will no longer have to worry about the 50,000 URL limit or the time it takes for a sitemap to be generated. This plugin is fast, consumes much fewer resources and can be extended via your very own modules (yes, no hooks needed!). Here's a [demo](http://betterwp.net/sitemapindex.xml) of the sitemapindex if you are interested.
|
14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
**Sitemapindex Support**
|
16 |
|
17 |
What's so great about a sitemapindex you might say? Sitemapindex, as its name suggests, is one kind of sitemaps that allows you to group multiple sitemaps files inside it. Sitemapindex, therefore, gives you many benefits, such as: possibility to bypass the 50,000 URL limit (you can have 10 custom sitemaps, each has 10000 URLs), or possibility to make the generation time much faster (because each sitemap is requested separately and is built by its own module), etc.
|
@@ -31,7 +38,13 @@ Developing modules needs debugging and this plugin makes that so easy for any de
|
|
31 |
**For a complete feature list, please visit this [plugin's official page](http://betterwp.net/wordpress-plugins/google-xml-sitemaps/)**
|
32 |
|
33 |
**Important Notes**
|
34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
|
36 |
**Languages**
|
37 |
|
@@ -40,10 +53,6 @@ If you encounter the 'Content Encoding Error' error page when trying to view a s
|
|
40 |
|
41 |
Please [help translate](http://betterwp.net/wordpress-tips/create-pot-file-using-poedit/) this plugin!
|
42 |
|
43 |
-
**Get in touch**
|
44 |
-
|
45 |
-
I'm available at [BetterWP.net](http://betterwp.net) and you can also follow me on [Twitter](http://twitter.com/0dd0ne0ut).
|
46 |
-
|
47 |
== Installation ==
|
48 |
|
49 |
1. Upload the `bwp-google-xml-sitemaps` folder to the `/wp-content/plugins/` directory
|
@@ -56,19 +65,24 @@ I'm available at [BetterWP.net](http://betterwp.net) and you can also follow me
|
|
56 |
|
57 |
== Frequently Asked Questions ==
|
58 |
|
59 |
-
**
|
60 |
|
61 |
-
|
62 |
|
63 |
-
|
|
|
|
|
|
|
64 |
|
65 |
-
|
66 |
|
67 |
-
|
68 |
|
69 |
-
|
70 |
|
71 |
-
|
|
|
|
|
72 |
|
73 |
If you are enabling this plugin's debug mode and/or WP_DEBUG, this error is very normal because the module you use might print errors on pages, thus corrupting your xml sitemaps. To view the actual errors without being greeted with the 'Content Encoding Error', please follow these steps:
|
74 |
|
@@ -76,26 +90,137 @@ If you are enabling this plugin's debug mode and/or WP_DEBUG, this error is very
|
|
76 |
2. Open the file `class-bwp-simple-gxs.php` inside `bwp-google-xml-sitemaps/includes/` and look for this function: `output_sitemap()`.
|
77 |
3. Place an `exit;` right after the opening bracket, like so:
|
78 |
<pre><code>
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
</code></pre>
|
83 |
4. Refresh the sitemaps with problems.
|
84 |
5. Kindly report the errors you see by commenting or through the [contact form](http://betterwp.net/contact/). Thanks!
|
85 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
[Check plugin news and ask questions](http://betterwp.net/topic/google-xml-sitemaps/).
|
87 |
|
88 |
== Screenshots ==
|
89 |
|
90 |
-
1.
|
91 |
-
2. A
|
92 |
-
3.
|
|
|
93 |
|
94 |
== Changelog ==
|
95 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
= 1.0.5 =
|
97 |
* Unregistered modules (such as redundant modules from 1.0.3) will now have a 404 HTTP status to prevent search engines from requesting them again.
|
98 |
-
* Time for each log
|
99 |
* And other minor fixes.
|
100 |
|
101 |
**Thanks everyone for using this plugin!**
|
1 |
=== Better WordPress Google XML Sitemaps (with sitemapindex and Multi-site support) ===
|
2 |
Contributors: OddOneOut
|
3 |
Donate link: http://betterwp.net/wordpress-plugins/google-xml-sitemaps/#contributions
|
4 |
+
Tags: xml sitemaps, xml sitemap, google xml sitemaps, sitemapindex, sitemap, sitemaps, seo, bing, google, msn, ask, multi-site, multisite
|
5 |
Requires at least: 3.0
|
6 |
+
Tested up to: 3.3
|
7 |
+
Stable tag: 1.1.6
|
8 |
|
9 |
The first WordPress XML Sitemap plugin that comes with comprehensive support for Sitemapindex and Multi-site.
|
10 |
|
12 |
|
13 |
Welcome to the first WordPress sitemap plugin that has support for both sitemapindex and Multi-site websites! You will no longer have to worry about the 50,000 URL limit or the time it takes for a sitemap to be generated. This plugin is fast, consumes much fewer resources and can be extended via your very own modules (yes, no hooks needed!). Here's a [demo](http://betterwp.net/sitemapindex.xml) of the sitemapindex if you are interested.
|
14 |
|
15 |
+
**New in 1.1.0!**
|
16 |
+
|
17 |
+
* This plugin can now automatically split large post sitemaps into smaller ones. You can set a limit for each small sitemap. For example if you have 200K posts and would like to have 10K posts for each sitemap, BWP GXS will then split `post.xml` into 20 parts (i.e. from `post_part1.xml` to `post_part20.xml`). This helps you bypass the 50,000 URLs limit without having to build your custom modules, and also helps make your sitemaps smaller, lighter, and of course faster to generate. This plugin has been tested on sites that have nearly 200K posts and it took less than 1 second to generate the sitemapindex.
|
18 |
+
* Added a new sitemap, called External Pages' sitemap, using which you can easily add links to pages that do not belong to WordPress to the Sitemap Index. Please refer to the [customization section](http://betterwp.net/wordpress-plugins/google-xml-sitemaps/#external_sitemap) for more details.
|
19 |
+
* Added options in the Generator to exclude certain post types, taxonomies without having to use filters.
|
20 |
+
* Added new hooks to default post-based and taxonomy-based modules to allow easier SQL query customization (you don't have to develop custom modules anymore just to change minor things). Read [here](http://betterwp.net/wordpress-plugins/google-xml-sitemaps/#exclude_items) for more details.
|
21 |
+
|
22 |
**Sitemapindex Support**
|
23 |
|
24 |
What's so great about a sitemapindex you might say? Sitemapindex, as its name suggests, is one kind of sitemaps that allows you to group multiple sitemaps files inside it. Sitemapindex, therefore, gives you many benefits, such as: possibility to bypass the 50,000 URL limit (you can have 10 custom sitemaps, each has 10000 URLs), or possibility to make the generation time much faster (because each sitemap is requested separately and is built by its own module), etc.
|
38 |
**For a complete feature list, please visit this [plugin's official page](http://betterwp.net/wordpress-plugins/google-xml-sitemaps/)**
|
39 |
|
40 |
**Important Notes**
|
41 |
+
|
42 |
+
If you have any problem using this plugin, refer to the [FAQ section](http://betterwp.net/wordpress-plugins/google-xml-sitemaps/faq/) for possible solutions, and workarounds.
|
43 |
+
|
44 |
+
**Get in touch**
|
45 |
+
|
46 |
+
* I'm available at [BetterWP.net](http://betterwp.net) and you can also follow me on [Twitter](http://twitter.com/0dd0ne0ut).
|
47 |
+
* Check out [latest WordPress Tips and Ideas](http://feeds.feedburner.com/BetterWPnet) from BetterWP.net.
|
48 |
|
49 |
**Languages**
|
50 |
|
53 |
|
54 |
Please [help translate](http://betterwp.net/wordpress-tips/create-pot-file-using-poedit/) this plugin!
|
55 |
|
|
|
|
|
|
|
|
|
56 |
== Installation ==
|
57 |
|
58 |
1. Upload the `bwp-google-xml-sitemaps` folder to the `/wp-content/plugins/` directory
|
65 |
|
66 |
== Frequently Asked Questions ==
|
67 |
|
68 |
+
**Q1: I got white pages and/or 'Content Encoding Error' error?**
|
69 |
|
70 |
+
1. PHP error messages from other plugins or from this plugin itself can cause this issue, especially when you have `WP_DEBUG` set to true (try commenting out this line in your `wp-config.php` file: `define(WP_DEBUG, true);`). Refer to the second question to know how to trace the actual errors.
|
71 |
|
72 |
+
2. BWP GXS runs out of memory or reaches maximum execution time. This often happens when you try to build large sitemaps. I've tried to optimize this plugin a lot since the first version, but if you are using a lot of memory eating plugins on your website, it is very hard for BWP GXS to build huge sitemaps (containing thousands of items). Anyway, to resolve this issue, try decreasing the three limit options in the Generator tab: max number of items per sitemap (first option), max number of items per split sitemap (first option in Sitemap Index Options) and max items to get in one SQL query (second option in Module Options). You might try the following presets (in the same order as above):
|
73 |
+
* 1000, 1000, 100 (for sites with low memory limit like 32MB)
|
74 |
+
* 5000, 5000, 500 (for sites with lots of posts, tags, categories, etc.)
|
75 |
+
* 5000, 5000, 2500 (if you have problem with max execution time)
|
76 |
|
77 |
+
Also, you can try the tips mentioned in [this post of mine](http://betterwp.net/6-wordpress-memory-usage/).
|
78 |
|
79 |
+
3. A caching plugin is interfering. Tell that caching plugin to ignore `.xml` file. For example, if you use WP Super Cache, on the Advanced Tab, scroll to the 'Accepted Filenames & Rejected URIs' section, and then in the first textarea, type in `\.xml`. Now save the changes and flush the all caches. See if that works for you.
|
80 |
|
81 |
+
**Q2: I've tried the tips mentioned in Question #1, but still got white pages / plain text sitemaps?**
|
82 |
|
83 |
+
It's very likely that you're enabling this option: 'Clean unexpected output before sitemap generation', try disabling it and your sitemaps will show up as expected.
|
84 |
+
|
85 |
+
**Q3: I got the error 'Content Encoding Error', what should I do?**
|
86 |
|
87 |
If you are enabling this plugin's debug mode and/or WP_DEBUG, this error is very normal because the module you use might print errors on pages, thus corrupting your xml sitemaps. To view the actual errors without being greeted with the 'Content Encoding Error', please follow these steps:
|
88 |
|
90 |
2. Open the file `class-bwp-simple-gxs.php` inside `bwp-google-xml-sitemaps/includes/` and look for this function: `output_sitemap()`.
|
91 |
3. Place an `exit;` right after the opening bracket, like so:
|
92 |
<pre><code>
|
93 |
+
function output_sitemap()
|
94 |
+
{
|
95 |
+
exit;
|
96 |
</code></pre>
|
97 |
4. Refresh the sitemaps with problems.
|
98 |
5. Kindly report the errors you see by commenting or through the [contact form](http://betterwp.net/contact/). Thanks!
|
99 |
|
100 |
+
Note that, however, some error messages will never show up. In such case, you might want to locate the `error_log` file within your WordPress installation's root directory and read its contents for the error messages.
|
101 |
+
|
102 |
+
**Q4: I got an 'Error loading stylesheet' error, what should I do?**
|
103 |
+
|
104 |
+
As of version 1.1.0 it is almost impossible for such error to show up, but if you set the site url and the home url differently (one with `www` and one isn't), you will see this error. Just choose to disable stylesheet in Generator tab or change your site / home URL settings.
|
105 |
+
|
106 |
+
**Q5: I got a HTTP parse error when I submit sitemap to Google Webmaster Tools, what should I do?**
|
107 |
+
|
108 |
+
Please first see the answer to the first question, if it didn't work, and you are using a cache plugin such as W3 Total Cache, it is possible that such plugin wrongly assigns HTTP status headers to my sitemaps.
|
109 |
+
|
110 |
+
For example, in W3 Total Cache 0.9.2.2 or possibly older, go to **Performance -> Browser Cache**, and then go to '404 error exception list' in the 'General' option block, and find this line:
|
111 |
+
|
112 |
+
<pre><code>sitemap(_index|[0-9]+)?\.xml(\.gz)?</code></pre>
|
113 |
+
|
114 |
+
OR this line:
|
115 |
+
|
116 |
+
<pre><code>sitemap\.xml(\.gz)?</code></pre>
|
117 |
+
|
118 |
+
and change it to:
|
119 |
+
|
120 |
+
<pre><code>(sitemapindex|[a-z0-9_-]+)\.xml</code></pre>
|
121 |
+
|
122 |
+
Save the changes and then tell W3TC to auto-install the rewrite rules to your `.htaccess` file.
|
123 |
+
|
124 |
+
BWP GXS's sitemaps will now have correct HTTP status headers.
|
125 |
+
|
126 |
+
**Q6: When I visit `http://example.com/sitemapindex.xml` , WordPress returns a 404 page. What should I do?**
|
127 |
+
|
128 |
+
This might be caused by unflushed rewrite rules, which should have been flushed when you activate this plugin. You can try flushing them manually by visiting Settings -> Permalinks and then clicking Save Changes.
|
129 |
+
|
130 |
+
**Q7: When I visit any sitemap, a plain (no theme) 404 error page appears, what's the problem?**
|
131 |
+
|
132 |
+
You are possibly using some caching plugins that redirect all non-existent pages to 404 error page. Sitemaps produced by this plugin are virtual sitemaps so they will all be redirected. Just open the .htaccess file and change the `sitemap\.xml` part to something like `[a-z0-9-_]+\.xml` and you're fine.
|
133 |
+
|
134 |
+
**Q8: I choose not to display certain sitemaps but the sitemapindex still displays the them?**
|
135 |
+
|
136 |
+
What you see is actually a cached version of the sitemapindex. You can wait for it to be refreshed automatically or simply choose to 'Flush the Cache'.
|
137 |
+
|
138 |
+
**Q9: BWP GXS tells me that 'Requested module not found or not allowed', what should I do?**
|
139 |
+
|
140 |
+
This depends on specific situations and your current settings. Basically this means that the module you're trying to access has not been registered with BWP GXS or that module has been disabled but the cached sitemapindex still displays it (which is related to the question above). For a list of default modules (or sitemaps), please read this section.
|
141 |
+
|
142 |
+
**Q10: Is there anyway to rename sitemapindex.xml to sitemap.xml?**
|
143 |
+
|
144 |
+
You don't have to. A visit to `http://example.com/sitemap.xml` will show you the same sitemapindex. This is done to make BWP GXS more compatible with blogs that have lots of real `robots.txt`. Please note that you must remove any real sitemap.xml file in your website's root for this feature to work.
|
145 |
+
|
146 |
+
**Q11: The custom sitemapindex I create seems to be nested inside the default sitemapindex, is that a bug or something?**
|
147 |
+
|
148 |
+
That's the default behaviour of this plugin and I plan to improve it in future versions. Don't worry, though, you might see a red X next to your sitemapindex's name in Google's Webmaster Tools but that's only because you haven't submitted your custom sitemapindex. If you submit it separately, the error will go away :).
|
149 |
+
|
150 |
[Check plugin news and ask questions](http://betterwp.net/topic/google-xml-sitemaps/).
|
151 |
|
152 |
== Screenshots ==
|
153 |
|
154 |
+
1. A sample Sitemap Index this plugin produces. Large post-based sitemap was split into two parts.
|
155 |
+
2. A Custom Post Type Sitemap
|
156 |
+
3. An External Pages' Sitemap
|
157 |
+
4. The Configuration Page
|
158 |
|
159 |
== Changelog ==
|
160 |
|
161 |
+
= 1.1.6 =
|
162 |
+
* Temporary fix for 1.1.5's broken custom post type URL issue. Expect a 1.1.7 real soon.
|
163 |
+
|
164 |
+
= 1.1.5 =
|
165 |
+
* Added a new 'site.xml' sitemap that lists all blogs within your site / network.
|
166 |
+
* Added a new 'author.xml' sitemap that lists all authors contributing to a blog.
|
167 |
+
* BWP GXS should now show the correct mapped sitemap URLs in the Statistics tab if you use WPMU Domain Mapping plugin.
|
168 |
+
* Fixed a bug that causes duplicate items to appear on sitemap parts, thanks to Aahan for reporting!
|
169 |
+
* Fixed a bug that causes the `post` post type sitemaps to show up even when disabled.
|
170 |
+
|
171 |
+
**Note that the site sitemap will be enabled, while the author sitemap will be disabled by default.**
|
172 |
+
|
173 |
+
= 1.1.4 =
|
174 |
+
* Changed some options' descriptions.
|
175 |
+
* Fixed a possible incompatibility issue with FeedWordPress plugin and Suffusion theme.
|
176 |
+
* Other minor bug fixes.
|
177 |
+
|
178 |
+
= 1.1.3 =
|
179 |
+
* Gzip is now off by default as it was causing issue on some hosts.
|
180 |
+
* In previous versions, this plugin automatically cleaned unexpected outputs before sitemap generation so that sitemaps are generated properly. Such feature also causes issues on certain hosts. As of 1.1.3 this is an option in Generator tab, and it is enabled by default.
|
181 |
+
* Fixed a possible bug in the taxonomy module that could cause a maximum execution time error. Thanks to David Killingsworth for reporting this bug!
|
182 |
+
* Other minor bug fixes and improvements.
|
183 |
+
|
184 |
+
= 1.1.2 =
|
185 |
+
* Fixed a possible memory leak.
|
186 |
+
* Clear PHP errors in a friendlier way.
|
187 |
+
* Other minor bug fixes and improvements.
|
188 |
+
|
189 |
+
= 1.1.1 =
|
190 |
+
* Added an option for users to choose whether to use GMT for Last Modified time or not.
|
191 |
+
* Improved the taxonomy module a bit.
|
192 |
+
* Fixed a minor bug in the page module.
|
193 |
+
* Fixed a bug that affects rewrite rules of custom post types and taxonomies in some cases. A big thanks to crowinck!
|
194 |
+
* Other minor bug fixes and improvements.
|
195 |
+
|
196 |
+
= 1.1.0 =
|
197 |
+
|
198 |
+
**New Features:**
|
199 |
+
|
200 |
+
* This plugin can now automatically split large post sitemaps into smaller ones. You can set a limit for each small sitemap. For example if you have 200K posts and would like to have 10K posts for each sitemap, BWP GXS will then split `post.xml` into 20 parts (i.e. from `post_part1.xml` to `post_part20.xml`). This helps you bypass the 50,000 URLs limit without having to build your custom modules, and also helps make your sitemaps smaller, lighter, and of course faster to generate. This plugin has been tested on sites that have nearly 200K posts and it took less than 1 second to generate the sitemapindex.
|
201 |
+
* Added a new sitemap, called External Pages' sitemap, using which you can easily add links to pages that do not belong to WordPress to the Sitemap Index. Please refer to the [customization section](http://betterwp.net/wordpress-plugins/google-xml-sitemaps/#external_sitemap) for more details.
|
202 |
+
* Added options in the Generator to exclude certain post types, taxonomies without having to use filters.
|
203 |
+
* Added new hooks to default post-based and taxonomy-based modules to allow easier SQL query customization (you don't have to develop custom modules anymore just to change minor things). Read [here](http://betterwp.net/wordpress-plugins/google-xml-sitemaps/#exclude_items) for more details.
|
204 |
+
|
205 |
+
**Improvements:**
|
206 |
+
|
207 |
+
* Major overhaul of all modules to make them faster, more efficient, more accurate, and of course, consume much less memory. This version should eliminate most white page problems happened in previous versions.
|
208 |
+
* Improved compatibility with cache plugins.
|
209 |
+
* Improved support for sites that uses `%category%` in permalink structure.
|
210 |
+
* The plugin should now display style sheet correctly in tight situations.
|
211 |
+
* Added a clear log button to clear redundant log (available to network admin only).
|
212 |
+
* Added an option to include links to all sitemapindex.xml files in your network in the primary website's `robots.txt`.
|
213 |
+
* Tag archive sitemap can now be disabled properly.
|
214 |
+
* Fixed permalinks for people using index.php in permalink structure.
|
215 |
+
* Other minor bug fixes and improvements.
|
216 |
+
|
217 |
+
For a detailed description of each new feature, please refer to the [release announcement](http://betterwp.net/257-bwp-google-xml-sitemaps-1-1-0/).
|
218 |
+
|
219 |
+
**Due to major changes in core it is suggested that you clear the logs using the new 'Clear All Logs' button and double-check the Generator's settings. Have fun and please [rate this plugin](http://wordpress.org/extend/plugins/bwp-google-xml-sitemaps/) 5 stars if you like it, thanks!**
|
220 |
+
|
221 |
= 1.0.5 =
|
222 |
* Unregistered modules (such as redundant modules from 1.0.3) will now have a 404 HTTP status to prevent search engines from requesting them again.
|
223 |
+
* Time for each log will now make use of your current timezone setting in Settings -> General.
|
224 |
* And other minor fixes.
|
225 |
|
226 |
**Thanks everyone for using this plugin!**
|
screenshot-1.gif
CHANGED
Binary file
|
screenshot-3.gif
CHANGED
Binary file
|
screenshot-4.gif
ADDED
Binary file
|
xsl/bwp-sitemapindex.xsl
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
<xsl:template match="/">
|
5 |
<html xmlns="http://www.w3.org/1999/xhtml">
|
6 |
<head>
|
7 |
-
<title>XML
|
8 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
9 |
<style type="text/css">
|
10 |
body {
|
@@ -49,7 +49,7 @@
|
|
49 |
</style>
|
50 |
</head>
|
51 |
<body>
|
52 |
-
<h1>XML
|
53 |
<div id="header">
|
54 |
<p>
|
55 |
This sitemapindex was created using <a href="http://betterwp.net/wordpress-plugins/google-xml-sitemaps/" title="Better WordPress Google XML Sitemaps">Better WordPress Google XML Sitemaps</a>, a WordPress plugin that has support for sitemapindex and Multi-site blogs, you can also build custom sitemaps if you want.
|
4 |
<xsl:template match="/">
|
5 |
<html xmlns="http://www.w3.org/1999/xhtml">
|
6 |
<head>
|
7 |
+
<title>XML Sitemap Index</title>
|
8 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
9 |
<style type="text/css">
|
10 |
body {
|
49 |
</style>
|
50 |
</head>
|
51 |
<body>
|
52 |
+
<h1>XML Sitemap Index</h1>
|
53 |
<div id="header">
|
54 |
<p>
|
55 |
This sitemapindex was created using <a href="http://betterwp.net/wordpress-plugins/google-xml-sitemaps/" title="Better WordPress Google XML Sitemaps">Better WordPress Google XML Sitemaps</a>, a WordPress plugin that has support for sitemapindex and Multi-site blogs, you can also build custom sitemaps if you want.
|