WP Realtime Sitemap - Version 1.5

Version Description

  • Completely written all of the options in the admin interface.
  • Option to exclude pages, posts, custom post types, archives, categories and tags from the output.
  • Now able to limit posts, custom post types, archives, categories and tags from the output.
  • No option to limit pages as this is currently broken in WordPress.
  • More options for sorting that wasn't included previously.
  • Option to change the archive type no longer fixed to monthly.
  • Removed sorting options from the WordPress shortcode.
  • Fixed code so only runs the code for the section chosen not all sections.
Download this release

Release Info

Developer Rincewind
Plugin Icon wp plugin WP Realtime Sitemap
Version 1.5
Comparing to
See all releases

Code changes from version 1.4.8 to 1.5

Files changed (3) hide show
  1. readme.txt +35 -21
  2. screenshot-1.png +0 -0
  3. wp-realtime-sitemap.php +884 -385
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: Rincewind
3
  Donate link: http://www.daniel-tweedy.co.uk/redir/wordpress-plugins-donation/
4
  Tags: seo, navigation, sitemap, sitemaps, posts, pages, custom, post, types, translation, translated, i18n, wpmu, wordpress, multisite, multiuser, multi-lingual,
5
  Requires at least: 3.0
6
- Tested up to: 3.0.4
7
  Stable tag: trunk
8
 
9
  A sitemap plugin to make it easier for your site to show all your pages, posts, archives, categories and tags in an easy to read format.
@@ -12,15 +12,21 @@ A sitemap plugin to make it easier for your site to show all your pages, posts,
12
 
13
  A sitemap plugin to make it easier for your site to show all your pages, posts, archives, categories and tags in an easy to read format without any need for template modification or html/php knowledge.
14
 
15
- 1. Can show/hide Posts, Custom Post Types, Pages, Archives, Categories and Tags.
16
- 1. Can optionally show categories and/or tags as a bullet list, or as a tag cloud.
17
- 1. All of the above can be ordered in anyway order you want.
18
- 1. Can optionally name the sections different from the default of Pages, Posts, Archives, Categories and Tags.
 
 
 
 
 
 
19
  1. Hierarchical list of pages and categories.
20
  1. Supports I18n for translation.
21
  1. Supports use of the wordpress shortcode for including the sitemap in pages and posts.
22
  1. Works on WordPress Multisite (WPMU) blogs.
23
- 1. It comes with an uninstaller, if you dont want it anymore just deactivate the plugin and delete it from within wordpress and it will delete all of its settings itself.
24
 
25
  I cant think of anything else that I personally would need this plugin to do for my own use, if anyone feels it doesn't meet what they need, or has any suggestions as to how to make it better then do please get in touch with me and I will see what I can do to accomodate your requests.
26
 
@@ -30,7 +36,7 @@ WP Realtime Sitemap is available in:-
30
  * Brazilian Portuguese by Gervasio Antonio.
31
  * Czech by Libor Cerny.
32
  * Russian by ssvictors.
33
- * Spanish by Fran�ois-Xavier Gonzalez.
34
 
35
  Please rate this plugin and/or make a [donation](http://www.daniel-tweedy.co.uk/redir/wordpress-plugins-donation/ "PayPal donation") if you find it useful, thank you.
36
 
@@ -78,23 +84,29 @@ You can call it whatever you like. I would suggest you call it Site Map.
78
 
79
  = I have some pages that I need but are to be hidden and not on the sitemap =
80
 
81
- My plugin only shows posts and pages that have the status as published, so if you wish to have a post of page be published but not to be shown, change its status to "privately published" and it will disappear off the sitemap, you can do this easily when editing a post/page with the Publish box on the left hand side, I have included a screeshot to show what to set this box to.
 
 
 
 
82
 
83
  == Screenshots ==
84
 
 
 
85
  1. Settings page in the admin area.
86
  2. Output as displayed on Twenty Ten theme.
87
- 3. How to hide a post and/or page off the sitemap.
88
 
89
  == Examples ==
90
 
91
  The shortcode will still use the database, this will be the default options now so you can use a small shortcode in your page and not have to put a long line just to get what you want, you can however do this if you wish to change the default options.
92
 
93
- Show posts: `[wp-realtime-sitemap show="posts"]`.
94
-
95
  Show pages: `[wp-realtime-sitemap show="pages"]`.
96
 
97
- Show custom post types: `[wp-realtime-sitemap show="custom-posts"]`.
 
 
98
 
99
  Show archives: `[wp-realtime-sitemap show="archives"]`.
100
 
@@ -102,12 +114,7 @@ Show categories: `[wp-realtime-sitemap show="categories"]`.
102
 
103
  Show tags: `[wp-realtime-sitemap show="tags"]`.
104
 
105
- Show everything (fixed order of: posts, pages, archives, categories, tags): `[wp-realtime-sitemap show="all" sort_column="title" sort_order="ASC" show_count="yes" show_date="yes"]`.
106
-
107
- *sort_column* options: title, menu_order, date, modified, ID, author, name.
108
- *sort_order* options: ASC, DESC.
109
- *show_count* options: yes, on, no, off (only applies to posts).
110
- *show_date* options: yes, on, no, off (only applies to archives, categories and tags).
111
 
112
  == Translations ==
113
 
@@ -137,6 +144,16 @@ Full details of producing a translation can be found in this [guide to translati
137
 
138
  == Changelog ==
139
 
 
 
 
 
 
 
 
 
 
 
140
  = 1.4.8 =
141
  * Added custom post types, if this was something you have been waiting for, or have requested then please consider making a [donation](http://www.daniel-tweedy.co.uk/redir/wordpress-plugins-donation/ "PayPal donation") thank you!
142
  * Added ability to change the names of the sections from the defaults of Pages, Posts, Archives, Categories and Tags, this is optional if there blank/empty will use the defaults.
@@ -206,9 +223,6 @@ Full details of producing a translation can be found in this [guide to translati
206
 
207
  == Upgrade Notice ==
208
 
209
- = 1.4.8 =
210
- All versions prior to this version output html which is not valid, please upgrade to atleast v1.4.8.
211
-
212
  = 1.4.6 =
213
  Renamed form options for Show post count, Show date, Post limit, as a result of this I do regrettably have to tell you you will need to visit the settings page and submit your settings back into the database for these options, otherwise your sitemap will not display on your site.
214
 
3
  Donate link: http://www.daniel-tweedy.co.uk/redir/wordpress-plugins-donation/
4
  Tags: seo, navigation, sitemap, sitemaps, posts, pages, custom, post, types, translation, translated, i18n, wpmu, wordpress, multisite, multiuser, multi-lingual,
5
  Requires at least: 3.0
6
+ Tested up to: 3.0.5
7
  Stable tag: trunk
8
 
9
  A sitemap plugin to make it easier for your site to show all your pages, posts, archives, categories and tags in an easy to read format.
12
 
13
  A sitemap plugin to make it easier for your site to show all your pages, posts, archives, categories and tags in an easy to read format without any need for template modification or html/php knowledge.
14
 
15
+ 1. Order the output anyway you want with the use of the shortcode.
16
+ 1. Order the output of the Pages, Posts, Custom Post Types, Archives, Categories and Tags.
17
+ 1. Show/hide Pages, Posts, Custom Post Types, Archives, Categories and Tags.
18
+ 1. Optionally show categories and/or tags as a bullet list, or as a tag cloud.
19
+ 1. Exclude Pages, Posts, Custom Post Types, Categories and Tags IDs.
20
+ 1. Limit the amount of posts, custom post types, archives, categories and tags displayed.
21
+ 1. Change the archive type from the WordPress default.
22
+ 1. Show/hide Categories and Tags which have no posts associated to them.
23
+ 1. Show/hide how many posts are in each Archive, Category or Tag.
24
+ 1. Optionally name the sections different from the default of Pages, Posts, Archives, Categories and Tags.
25
  1. Hierarchical list of pages and categories.
26
  1. Supports I18n for translation.
27
  1. Supports use of the wordpress shortcode for including the sitemap in pages and posts.
28
  1. Works on WordPress Multisite (WPMU) blogs.
29
+ 1. Comes with an uninstaller, if you dont want it anymore just deactivate the plugin and delete it from within wordpress and it will delete all of its settings itself.
30
 
31
  I cant think of anything else that I personally would need this plugin to do for my own use, if anyone feels it doesn't meet what they need, or has any suggestions as to how to make it better then do please get in touch with me and I will see what I can do to accomodate your requests.
32
 
36
  * Brazilian Portuguese by Gervasio Antonio.
37
  * Czech by Libor Cerny.
38
  * Russian by ssvictors.
39
+ * Spanish by Francois-Xavier Gonzalez.
40
 
41
  Please rate this plugin and/or make a [donation](http://www.daniel-tweedy.co.uk/redir/wordpress-plugins-donation/ "PayPal donation") if you find it useful, thank you.
42
 
84
 
85
  = I have some pages that I need but are to be hidden and not on the sitemap =
86
 
87
+ My plugin only shows posts and pages that have the status as published, so if you wish to have a post of page be published but not to be shown, change its status to "privately published" and it will disappear off the sitemap, you can do this easily when editing a post/page with the Publish box on the left hand side, I have included a screeshot to show what to set this box to. You can also exclude by ID now in the settings.
88
+
89
+ = I cant get the other short code options to work only the show one now works =
90
+
91
+ This has been removed in the latest version due to the options in the admin interface being very complex and is easier to choose how you want it to be sorted here, the shortcode is now only used to be able to sort the options differently.
92
 
93
  == Screenshots ==
94
 
95
+ Here are some screenshots of my plugin in action, due to width constraints of the codex they may not look so good, you can however right click and view the screenshots as intended in most browsers with a view image option on the right click menu.
96
+
97
  1. Settings page in the admin area.
98
  2. Output as displayed on Twenty Ten theme.
99
+ 3. How to hide a post and/or page off the sitemap using the published privately option in WordPress.
100
 
101
  == Examples ==
102
 
103
  The shortcode will still use the database, this will be the default options now so you can use a small shortcode in your page and not have to put a long line just to get what you want, you can however do this if you wish to change the default options.
104
 
 
 
105
  Show pages: `[wp-realtime-sitemap show="pages"]`.
106
 
107
+ Show posts: `[wp-realtime-sitemap show="posts"]`.
108
+
109
+ Show custom post types: `[wp-realtime-sitemap show="customposts"]`.
110
 
111
  Show archives: `[wp-realtime-sitemap show="archives"]`.
112
 
114
 
115
  Show tags: `[wp-realtime-sitemap show="tags"]`.
116
 
117
+ Show everything (fixed order of: pages, posts, custom post types, archives, categories, tags): `[wp-realtime-sitemap show="all"]`.
 
 
 
 
 
118
 
119
  == Translations ==
120
 
144
 
145
  == Changelog ==
146
 
147
+ = 1.5 =
148
+ * Completely written all of the options in the admin interface.
149
+ * Option to exclude pages, posts, custom post types, archives, categories and tags from the output.
150
+ * Now able to limit posts, custom post types, archives, categories and tags from the output.
151
+ * No option to limit pages as this is currently broken in WordPress.
152
+ * More options for sorting that wasn't included previously.
153
+ * Option to change the archive type no longer fixed to monthly.
154
+ * Removed sorting options from the WordPress shortcode.
155
+ * Fixed code so only runs the code for the section chosen not all sections.
156
+
157
  = 1.4.8 =
158
  * Added custom post types, if this was something you have been waiting for, or have requested then please consider making a [donation](http://www.daniel-tweedy.co.uk/redir/wordpress-plugins-donation/ "PayPal donation") thank you!
159
  * Added ability to change the names of the sections from the defaults of Pages, Posts, Archives, Categories and Tags, this is optional if there blank/empty will use the defaults.
223
 
224
  == Upgrade Notice ==
225
 
 
 
 
226
  = 1.4.6 =
227
  Renamed form options for Show post count, Show date, Post limit, as a result of this I do regrettably have to tell you you will need to visit the settings page and submit your settings back into the database for these options, otherwise your sitemap will not display on your site.
228
 
screenshot-1.png CHANGED
Binary file
wp-realtime-sitemap.php CHANGED
@@ -4,7 +4,7 @@
4
  Plugin Name: WP Realtime Sitemap
5
  Plugin URI: http://www.daniel-tweedy.co.uk/redir/wp-realtime-sitemap-home/
6
  Description: Adds a sitemap to your Wordpress blog that is always up-to-date. Add `[wp-realtime-sitemap show="all"]` to any page or post and the site map will be added there. Use Settings->WP Realtime Sitemap to set options.
7
- Version: 1.4.8
8
  Author: Daniel Tweedy
9
  Author URI: http://www.daniel-tweedy.co.uk/
10
  License: GPL2
@@ -135,496 +135,989 @@ if (!class_exists('WPRealtimeSitemap')) {
135
  function addOptionsInit() {
136
  register_setting('update_settings', 'plugin_wp_realtime_sitemap_settings', array($this, '_formValidate'));
137
 
138
- add_settings_section('general_settings', __('General Settings', 'wp-realtime-sitemap'), array($this, 'general_section_text'), __FILE__);
139
- add_settings_field('sort_column', __('Sort Column', 'wp-realtime-sitemap'), array($this, '_formSortColumn'), __FILE__, 'general_settings');
140
- add_settings_field('sort_order', __('Sort Order', 'wp-realtime-sitemap'), array($this, '_formSortOrder'), __FILE__, 'general_settings');
141
-
142
- add_settings_section('post_settings', __('Post Settings', 'wp-realtime-sitemap'), array($this, 'post_section_text'), __FILE__);
143
- add_settings_field('count', __('Count', 'wp-realtime-sitemap'), array($this, '_formCount'), __FILE__, 'post_settings');
144
- add_settings_field('date', __('Date', 'wp-realtime-sitemap'), array($this, '_formDate'), __FILE__, 'post_settings');
145
- add_settings_field('limit', __('Limit', 'wp-realtime-sitemap'), array($this, '_formLimit'), __FILE__, 'post_settings');
146
-
147
- add_settings_section('tagcloud_settings', __('Tag Cloud Settings', 'wp-realtime-sitemap'), array($this, 'tagcloud_section_text'), __FILE__);
148
- add_settings_field('category_tagcloud', __('Show Category as a Tag Cloud', 'wp-realtime-sitemap'), array($this, '_formCategoryTagCloud'), __FILE__, 'tagcloud_settings');
149
- add_settings_field('tags_tagcloud', __('Show Tags as a Tag Cloud', 'wp-realtime-sitemap'), array($this, '_formTagsTagCloud'), __FILE__, 'tagcloud_settings');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
150
 
151
  add_settings_section('header_settings', __('Header Settings', 'wp-realtime-sitemap'), array($this, 'header_section_text'), __FILE__);
152
- add_settings_field('pages_header', __('Pages Header', 'wp-realtime-sitemap'), array($this, '_formPagesHeader'), __FILE__, 'header_settings');
153
- add_settings_field('posts_header', __('Posts Header', 'wp-realtime-sitemap'), array($this, '_formPostsHeader'), __FILE__, 'header_settings');
154
- add_settings_field('archives_header', __('Archives Header', 'wp-realtime-sitemap'), array($this, '_formArchivesHeader'), __FILE__, 'header_settings');
155
- add_settings_field('categories_header', __('Categories Header', 'wp-realtime-sitemap'), array($this, '_formCategoriesHeader'), __FILE__, 'header_settings');
156
- add_settings_field('tags_header', __('Tags Header', 'wp-realtime-sitemap'), array($this, '_formTagsHeader'), __FILE__, 'header_settings');
157
 
158
  add_settings_section('display_settings', __('Display Settings', 'wp-realtime-sitemap'), array($this, 'display_section_text'), __FILE__);
159
- add_settings_field('show_pages', __('Show Pages', 'wp-realtime-sitemap'), array($this, '_formShowPages'), __FILE__, 'display_settings');
160
- add_settings_field('show_posts', __('Show Posts', 'wp-realtime-sitemap'), array($this, '_formShowPosts'), __FILE__, 'display_settings');
161
- add_settings_field('show_custom_post_types', __('Show ALL Custom Post Types', 'wp-realtime-sitemap'), array($this, '_formShowCustomPostTypes'), __FILE__, 'display_settings');
162
- add_settings_field('show_archives', __('Show Archives', 'wp-realtime-sitemap'), array($this, '_formShowArchives'), __FILE__, 'display_settings');
163
- add_settings_field('show_categories', __('Show Categories', 'wp-realtime-sitemap'), array($this, '_formShowCategories'), __FILE__, 'display_settings');
164
- add_settings_field('show_tags', __('Show Tags', 'wp-realtime-sitemap'), array($this, '_formShowTags'), __FILE__, 'display_settings');
165
  }
166
 
167
- function general_section_text() {
168
- echo '<p>' . __('Sort Column and Sort Order are used for sorting Pages, Posts, Categories and Tags.', 'wp-realtime-sitemap') . '</p>';
169
  }
170
 
171
- function _formSortColumn() {
172
- // Get current options from the database.
173
- extract(get_option('plugin_wp_realtime_sitemap_settings'));
174
-
175
- $values = array(
176
- 'title' => __('Alphabetically (by title) (Default)', 'wp-realtime-sitemap'),
177
- 'menu_order' => __('Page order', 'wp-realtime-sitemap'),
178
- 'date' => __('Creation time', 'wp-realtime-sitemap'),
179
- 'modified' => __('Time last modified', 'wp-realtime-sitemap'),
180
- 'ID' => __('Numeric Page ID', 'wp-realtime-sitemap'),
181
- 'author' => __('Page author', 'wp-realtime-sitemap'),
182
- 'name' => __('Alphabetically (by post slug)', 'wp-realtime-sitemap'),
183
- );
184
-
185
- $optionFormat = '<option value="%s"%s>%s</option>';
186
 
187
- $output = '<select name="plugin_wp_realtime_sitemap_settings[sort_column]">';
 
 
188
 
189
- foreach ($values as $key => $label) {
190
- $output .= sprintf($optionFormat, $key, selected($sort_column, $key, false), $label);
191
- }
 
 
192
 
193
- $output .= '</select>';
 
 
 
 
194
 
195
- echo $output;
 
196
  }
197
 
198
- function _formSortOrder() {
199
- // Get current options from the database.
200
- extract(get_option('plugin_wp_realtime_sitemap_settings'));
201
 
202
- $values = array(
203
- 'ASC' => __('Ascending (Default)', 'wp-realtime-sitemap'),
204
- 'DESC' => __('Descending', 'wp-realtime-sitemap'),
205
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
206
 
207
- $optionFormat = '<option value="%s"%s>%s</option>';
 
208
 
209
- $output = '<select name="plugin_wp_realtime_sitemap_settings[sort_order]">';
 
 
 
 
210
 
211
- foreach ($values as $key => $label) {
212
- $output .= sprintf($optionFormat, $key, selected($sort_order, $key, false), $label);
213
- }
214
 
215
- $output .= '</select>';
 
 
216
 
217
- echo $output;
218
- }
 
219
 
220
- function post_section_text() {
221
- echo '<p>' . __('Count is to display the number of posts that a Archive, Category and/or Tag has.', 'wp-realtime-sitemap') . '</p>';
222
- echo '<p>' . __('Date is to show the date that the post itself was created/published.', 'wp-realtime-sitemap') . '</p>';
223
- echo '<p>' . __('Limit is used to apply a limit as to how many posts should be shown on the sitemap, useful for if you have a very large blog and as such a large number of posts, use -1 to show all posts and not apply a limit.', 'wp-realtime-sitemap') . '</p>';
224
- }
225
 
226
- function _formCount() {
227
- // Get current options from the database.
228
- extract(get_option('plugin_wp_realtime_sitemap_settings'));
229
 
230
- $values = array(
231
- 'yes' => __('Yes/On', 'wp-realtime-sitemap'),
232
- 'no' => __('No/Off (Default)', 'wp-realtime-sitemap'),
233
- );
234
 
235
- $optionFormat = '<option value="%s"%s>%s</option>';
 
 
236
 
237
- $output = '<select name="plugin_wp_realtime_sitemap_settings[count]">';
 
 
238
 
239
- foreach ($values as $key => $label) {
240
- $output .= sprintf($optionFormat, $key, selected($count, $key, false), $label);
241
- }
242
 
243
- $output .= '</select>';
 
 
244
 
245
- echo $output;
246
- }
 
247
 
248
- function _formDate() {
249
- // Get current options from the database.
250
- extract(get_option('plugin_wp_realtime_sitemap_settings'));
251
 
252
- $values = array(
253
- 'yes' => __('Yes/On', 'wp-realtime-sitemap'),
254
- 'no' => __('No/Off (Default)', 'wp-realtime-sitemap'),
255
- );
256
 
257
- $optionFormat = '<option value="%s"%s>%s</option>';
 
 
258
 
259
- $output = '<select name="plugin_wp_realtime_sitemap_settings[date]">';
 
 
260
 
261
- foreach ($values as $key => $label) {
262
- $output .= sprintf($optionFormat, $key, selected($date, $key, false), $label);
263
- }
264
 
265
- $output .= '</select>';
 
 
266
 
267
- echo $output;
268
- }
 
269
 
270
- function _formLimit() {
271
- // Get current options from the database.
272
- extract(get_option('plugin_wp_realtime_sitemap_settings'));
273
 
274
- echo '<input name="plugin_wp_realtime_sitemap_settings[limit]" size="4" type="text" value="' . $limit . '" /> -1 to show all posts.';
275
- }
 
276
 
277
- function tagcloud_section_text() {
278
- echo '<p>' . __('To show category and/or tags as a tag cloud instead of a bulletted list.', 'wp-realtime-sitemap') . '</p>';
279
- }
280
 
281
- function _formCategoryTagCloud() {
282
- // Get current options from the database.
283
- extract(get_option('plugin_wp_realtime_sitemap_settings'));
284
 
285
- $values = array(
286
- 'yes' => __('Yes/On', 'wp-realtime-sitemap'),
287
- 'no' => __('No/Off (Default)', 'wp-realtime-sitemap'),
288
- );
289
 
290
- $optionFormat = '<option value="%s"%s>%s</option>';
 
 
 
 
 
 
291
 
292
- $output = '<select name="plugin_wp_realtime_sitemap_settings[category_tagcloud]">';
 
 
293
 
294
- foreach ($values as $key => $label) {
295
- $output .= sprintf($optionFormat, $key, selected($category_tagcloud, $key, false), $label);
296
- }
297
 
298
- $output .= '</select>';
 
 
299
 
300
- echo $output;
301
- }
 
302
 
303
- function _formTagsTagCloud() {
304
- // Get current options from the database.
305
- extract(get_option('plugin_wp_realtime_sitemap_settings'));
306
 
307
- $values = array(
308
- 'yes' => __('Yes/On', 'wp-realtime-sitemap'),
309
- 'no' => __('No/Off (Default)', 'wp-realtime-sitemap'),
310
- );
311
 
312
- $optionFormat = '<option value="%s"%s>%s</option>';
 
 
313
 
314
- $output = '<select name="plugin_wp_realtime_sitemap_settings[tags_tagcloud]">';
 
 
315
 
316
- foreach ($values as $key => $label) {
317
- $output .= sprintf($optionFormat, $key, selected($tags_tagcloud, $key, false), $label);
318
- }
319
 
320
- $output .= '</select>';
 
 
321
 
322
- echo $output;
323
- }
 
324
 
325
- function header_section_text() {
326
- echo '<p>' . __('This section is optional, you can change the names of the sections if you wish from the defaults. Defaults are used when the below options are left blank/empty.', 'wp-realtime-sitemap') . '</p>';
327
- }
328
 
329
- function _formPagesHeader() {
330
- // Get current options from the database.
331
- extract(get_option('plugin_wp_realtime_sitemap_settings'));
332
 
333
- echo '<input name="plugin_wp_realtime_sitemap_settings[pages_header]" size="30" type="text" value="' . $pages_header . '" />';
 
 
 
 
 
334
  }
335
 
336
- function _formPostsHeader() {
337
  // Get current options from the database.
338
  extract(get_option('plugin_wp_realtime_sitemap_settings'));
339
 
340
- echo '<input name="plugin_wp_realtime_sitemap_settings[posts_header]" size="30" type="text" value="' . $posts_header . '" />';
341
- }
342
 
343
- function _formArchivesHeader() {
344
- // Get current options from the database.
345
- extract(get_option('plugin_wp_realtime_sitemap_settings'));
346
 
347
- echo '<input name="plugin_wp_realtime_sitemap_settings[archives_header]" size="30" type="text" value="' . $archives_header . '" />';
348
- }
349
 
350
- function _formCategoriesHeader() {
351
- // Get current options from the database.
352
- extract(get_option('plugin_wp_realtime_sitemap_settings'));
353
 
354
- echo '<input name="plugin_wp_realtime_sitemap_settings[categories_header]" size="30" type="text" value="' . $categories_header . '" />';
 
 
 
 
 
355
  }
356
 
357
- function _formTagsHeader() {
358
  // Get current options from the database.
359
  extract(get_option('plugin_wp_realtime_sitemap_settings'));
360
 
361
- echo '<input name="plugin_wp_realtime_sitemap_settings[tags_header]" size="30" type="text" value="' . $tags_header . '" />';
362
- }
363
 
364
- function display_section_text() {
365
- echo '<p>' . __('Choose what you would like to be displayed on your site map.', 'wp-realtime-sitemap') . '</p>';
 
 
 
366
  }
367
 
368
- function _formShowPages() {
369
- // Get current options from the database.
370
- extract(get_option('plugin_wp_realtime_sitemap_settings'));
371
 
372
- $values = array(
373
- 'yes' => __('Yes/On (Default)', 'wp-realtime-sitemap'),
374
- 'no' => __('No/Off', 'wp-realtime-sitemap'),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
375
  );
376
 
377
- $optionFormat = '<option value="%s"%s>%s</option>';
 
 
378
 
379
- $output = '<select name="plugin_wp_realtime_sitemap_settings[show_pages]">';
380
-
381
- foreach ($values as $key => $label) {
382
- $output .= sprintf($optionFormat, $key, selected($show_pages, $key, false), $label);
383
  }
384
 
385
- $output .= '</select>';
 
386
 
387
- echo $output;
388
- }
 
 
389
 
390
- function _formShowPosts() {
391
- // Get current options from the database.
392
- extract(get_option('plugin_wp_realtime_sitemap_settings'));
393
 
394
- $values = array(
395
- 'yes' => __('Yes/On (Default)', 'wp-realtime-sitemap'),
396
- 'no' => __('No/Off', 'wp-realtime-sitemap'),
397
- );
398
 
399
- $optionFormat = '<option value="%s"%s>%s</option>';
 
 
 
400
 
401
- $output = '<select name="plugin_wp_realtime_sitemap_settings[show_posts]">';
 
402
 
403
- foreach ($values as $key => $label) {
404
- $output .= sprintf($optionFormat, $key, selected($show_posts, $key, false), $label);
 
405
  }
406
 
407
- $output .= '</select>';
 
408
 
409
- echo $output;
410
- }
411
-
412
- function _formShowCustomPostTypes() {
413
- // Get current options from the database.
414
- extract(get_option('plugin_wp_realtime_sitemap_settings'));
415
 
416
- $values = array(
417
- 'yes' => __('Yes/On (Default)', 'wp-realtime-sitemap'),
418
- 'no' => __('No/Off', 'wp-realtime-sitemap'),
419
- );
420
 
421
- $optionFormat = '<option value="%s"%s>%s</option>';
 
 
 
422
 
423
- $output = '<select name="plugin_wp_realtime_sitemap_settings[show_custom_post_types]">';
 
424
 
425
- foreach ($values as $key => $label) {
426
- $output .= sprintf($optionFormat, $key, selected($show_posts, $key, false), $label);
 
427
  }
428
 
429
- $output .= '</select>';
430
 
431
- echo $output;
432
- }
433
 
434
- function _formShowArchives() {
435
- // Get current options from the database.
436
- extract(get_option('plugin_wp_realtime_sitemap_settings'));
 
437
 
438
- $values = array(
439
- 'yes' => __('Yes/On (Default)', 'wp-realtime-sitemap'),
440
- 'no' => __('No/Off', 'wp-realtime-sitemap'),
441
- );
442
 
443
- $optionFormat = '<option value="%s"%s>%s</option>';
 
 
 
444
 
445
- $output = '<select name="plugin_wp_realtime_sitemap_settings[show_archives]">';
 
 
446
 
447
- foreach ($values as $key => $label) {
448
- $output .= sprintf($optionFormat, $key, selected($show_archives, $key, false), $label);
 
449
  }
450
 
451
- $output .= '</select>';
 
452
 
453
- echo $output;
454
- }
455
-
456
- function _formShowCategories() {
457
- // Get current options from the database.
458
- extract(get_option('plugin_wp_realtime_sitemap_settings'));
459
 
460
- $values = array(
461
- 'yes' => __('Yes/On (Default)', 'wp-realtime-sitemap'),
462
- 'no' => __('No/Off', 'wp-realtime-sitemap'),
463
- );
464
 
465
- $optionFormat = '<option value="%s"%s>%s</option>';
 
 
 
466
 
467
- $output = '<select name="plugin_wp_realtime_sitemap_settings[show_categories]">';
 
 
468
 
469
- foreach ($values as $key => $label) {
470
- $output .= sprintf($optionFormat, $key, selected($show_categories, $key, false), $label);
 
471
  }
472
 
473
- $output .= '</select>';
 
474
 
475
- echo $output;
476
- }
477
-
478
- function _formShowTags() {
479
- // Get current options from the database.
480
- extract(get_option('plugin_wp_realtime_sitemap_settings'));
481
 
482
- $values = array(
483
- 'yes' => __('Yes/On', 'wp-realtime-sitemap'),
484
- 'no' => __('No/Off (Default)', 'wp-realtime-sitemap'),
485
- );
486
 
487
- $optionFormat = '<option value="%s"%s>%s</option>';
 
 
 
488
 
489
- $output = '<select name="plugin_wp_realtime_sitemap_settings[show_tags]">';
 
490
 
491
- foreach ($values as $key => $label) {
492
- $output .= sprintf($optionFormat, $key, selected($show_tags, $key, false), $label);
 
493
  }
494
 
495
- $output .= '</select>';
496
-
497
- echo $output;
498
- }
499
 
500
- function _formValidate($input) {
501
- $plugin_wp_realtime_sitemap_settings = get_option('plugin_wp_realtime_sitemap_settings');
 
 
502
 
503
- $validOptions = array(
504
- 'sort_column' => array('title', 'menu_order', 'date', 'modified', 'ID', 'author', 'name'),
505
- 'sort_order' => array('ASC', 'DESC'),
506
- 'count' => array('no', 'yes'),
507
- 'date' => array('no', 'yes'),
508
- 'show_pages' => array('yes', 'no'),
509
- 'show_posts' => array('yes', 'no'),
510
- 'show_custom_post_types' => array('yes', 'no'),
511
- 'show_archives' => array('yes', 'no'),
512
- 'show_categories' => array('yes', 'no'),
513
- 'category_tagcloud' => array('no', 'yes'),
514
- 'show_tags' => array('no', 'yes'),
515
- 'tags_tagcloud' => array('no', 'yes'),
516
- );
517
 
518
- if(!in_array($input['sort_column'], $validOptions['sort_column'])) {
519
- $plugin_wp_realtime_sitemap_settings['sort_column'] = $validOptions['sort_column'][0];
520
 
521
- add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', __('Sort Column: Only Yes/On or No/Off are accepted as valid inputs.', 'wp-realtime-sitemap'));
522
  } else {
523
- $plugin_wp_realtime_sitemap_settings['sort_column'] = $input['sort_column'];
524
  }
525
 
526
- if(!in_array($input['sort_order'], $validOptions['sort_order'])) {
527
- $plugin_wp_realtime_sitemap_settings['sort_order'] = $validOptions['sort_order'][0];
528
 
529
- add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', __('Sort Order: Only Yes/On or No/Off are accepted as valid inputs.', 'wp-realtime-sitemap'));
530
  } else {
531
- $plugin_wp_realtime_sitemap_settings['sort_order'] = $input['sort_order'];
532
  }
533
 
534
- if(!in_array($input['count'], $validOptions['count'])) {
535
- $plugin_wp_realtime_sitemap_settings['count'] = $validOptions['count'][0];
 
536
 
537
- add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', __('Count: Only Yes/On or No/Off are accepted as valid inputs.', 'wp-realtime-sitemap'));
538
  } else {
539
- $plugin_wp_realtime_sitemap_settings['count'] = $input['count'];
540
  }
541
 
542
- if(!in_array($input['date'], $validOptions['date'])) {
543
- $plugin_wp_realtime_sitemap_settings['date'] = $validOptions['date'][0];
544
 
545
- add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', __('Date: Only Yes/On or No/Off are accepted as valid inputs.', 'wp-realtime-sitemap'));
546
  } else {
547
- $plugin_wp_realtime_sitemap_settings['date'] = $input['date'];
548
  }
549
 
550
- if(!is_numeric($input['limit']) || $input['limit'] < '-1') {
551
- $plugin_wp_realtime_sitemap_settings['limit'] = '-1';
552
 
553
- add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', __('Limit: Only integers or -1 are accepted as valid inputs.', 'wp-realtime-sitemap'));
554
  } else {
555
- $plugin_wp_realtime_sitemap_settings['limit'] = $input['limit'];
556
  }
557
 
558
- if(!in_array($input['show_pages'], $validOptions['show_pages'])) {
559
- $plugin_wp_realtime_sitemap_settings['show_pages'] = $validOptions['show_pages'][0];
560
 
561
- add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', __('Show Pages: Only Yes/On or No/Off are accepted as valid inputs.', 'wp-realtime-sitemap'));
562
  } else {
563
- $plugin_wp_realtime_sitemap_settings['show_pages'] = $input['show_pages'];
564
  }
565
 
566
- if(!in_array($input['show_posts'], $validOptions['show_posts'])) {
567
- $plugin_wp_realtime_sitemap_settings['show_posts'] = $validOptions['show_posts'][0];
568
 
569
- add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', __('Show Posts: Only Yes/On or No/Off are accepted as valid inputs.', 'wp-realtime-sitemap'));
570
  } else {
571
- $plugin_wp_realtime_sitemap_settings['show_posts'] = $input['show_posts'];
572
  }
573
 
574
- if(!in_array($input['show_custom_post_types'], $validOptions['show_custom_post_types'])) {
575
- $plugin_wp_realtime_sitemap_settings['show_custom_post_types'] = $validOptions['show_custom_post_types'][0];
 
 
576
 
577
- add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', __('Show Custom Post Types: Only Yes/On or No/Off are accepted as valid inputs.', 'wp-realtime-sitemap'));
578
  } else {
579
- $plugin_wp_realtime_sitemap_settings['show_custom_post_types'] = $input['show_custom_post_types'];
580
  }
581
 
582
- if(!in_array($input['show_archives'], $validOptions['show_archives'])) {
583
- $plugin_wp_realtime_sitemap_settings['show_archives'] = $validOptions['show_archives'][0];
 
 
 
 
584
 
585
- add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', __('Show Archives: Only Yes/On or No/Off are accepted as valid inputs.', 'wp-realtime-sitemap'));
 
 
 
 
586
  } else {
587
- $plugin_wp_realtime_sitemap_settings['show_archives'] = $input['show_archives'];
588
  }
589
 
590
- if(!in_array($input['show_categories'], $validOptions['show_categories'])) {
591
- $plugin_wp_realtime_sitemap_settings['show_categories'] = $validOptions['show_categories'][0];
592
 
593
- add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', __('Show Categories: Only Yes/On or No/Off are accepted as valid inputs.', 'wp-realtime-sitemap'));
594
  } else {
595
- $plugin_wp_realtime_sitemap_settings['show_categories'] = $input['show_categories'];
596
  }
597
 
598
- if(!in_array($input['category_tagcloud'], $validOptions['category_tagcloud'])) {
599
- $plugin_wp_realtime_sitemap_settings['category_tagcloud'] = $validOptions['category_tagcloud'][0];
600
 
601
- add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', __('Show Category as a Tag Cloud: Only Yes/On or No/Off are accepted as valid inputs.', 'wp-realtime-sitemap'));
602
  } else {
603
- $plugin_wp_realtime_sitemap_settings['category_tagcloud'] = $input['category_tagcloud'];
604
  }
605
 
606
- if(!in_array($input['show_tags'], $validOptions['show_tags'])) {
607
- $plugin_wp_realtime_sitemap_settings['show_tags'] = $validOptions['show_tags'][0];
608
 
609
- add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', __('Show Tags: Only Yes/On or No/Off are accepted as valid inputs.', 'wp-realtime-sitemap'));
610
  } else {
611
- $plugin_wp_realtime_sitemap_settings['show_tags'] = $input['show_tags'];
612
  }
613
 
614
- if(!in_array($input['tags_tagcloud'], $validOptions['tags_tagcloud'])) {
615
- $plugin_wp_realtime_sitemap_settings['tags_tagcloud'] = $validOptions['tags_tagcloud'][0];
616
 
617
- add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', __('Show Tags as a Tag Cloud: Only Yes/On or No/Off are accepted as valid inputs.', 'wp-realtime-sitemap'));
618
  } else {
619
- $plugin_wp_realtime_sitemap_settings['tags_tagcloud'] = $input['tags_tagcloud'];
620
  }
621
 
622
- // No Validation Here
623
- $plugin_wp_realtime_sitemap_settings['pages_header'] = $input['pages_header'];
624
- $plugin_wp_realtime_sitemap_settings['posts_header'] = $input['posts_header'];
625
- $plugin_wp_realtime_sitemap_settings['archives_header'] = $input['archives_header'];
626
- $plugin_wp_realtime_sitemap_settings['categories_header'] = $input['categories_header'];
627
- $plugin_wp_realtime_sitemap_settings['tags_header'] = $input['tags_header'];
 
628
 
629
  return $plugin_wp_realtime_sitemap_settings;
630
  }
@@ -635,8 +1128,6 @@ if (!class_exists('WPRealtimeSitemap')) {
635
  wp_die( __('You do not have sufficient permissions to access this page.', 'wp-realtime-sitemap') );
636
  }
637
 
638
- $path = $this->plugin_base_url;
639
-
640
  $post_types = get_post_types(array('public' => true, '_builtin' => false), 'objects');
641
  ?>
642
  <div class="wrap">
@@ -654,7 +1145,7 @@ if (!class_exists('WPRealtimeSitemap')) {
654
  <area border="1" shape="rect" coords="113,0,221,54" href="http://www.daniel-tweedy.co.uk/redir/wordpress-plugins-amazon-wishlist/" alt="Amazon WishList" />
655
  <area border="1" shape="rect" coords="226,0,334,54" href="http://www.daniel-tweedy.co.uk/redir/wordpress-plugins-twitter/" alt="Twitter" />
656
  </map>
657
- <img border="1" src="<?php echo $path; ?>/images/donate.jpg" usemap="#donatemap" />
658
  </div>
659
 
660
  <div style="width:450px; border:1px solid #dddddd; background:#fff; padding:20px 20px; float: left; margin-left: 20px;">
@@ -699,42 +1190,29 @@ if (!class_exists('WPRealtimeSitemap')) {
699
  // Only perform plugin functionality if post/page text has the shortcode in the page.
700
  if (preg_match('|wp-realtime-sitemap|', $code)) {
701
  // Get option values from the database.
702
- $all_options = get_option('plugin_wp_realtime_sitemap_settings');
 
703
 
704
- extract(shortcode_atts(array(
705
- 'show' => 'all',
706
- 'sort_column' => $all_options['sort_column'],
707
- 'sort_order' => $all_options['sort_order'],
708
- 'limit' => $all_options['limit'],
709
- 'count' => $all_options['count'],
710
- 'date' => $all_options['date'],
711
- ), $atts));
712
-
713
- $pagesort_column = ($sort_column == 'title' || $sort_column == 'date' || $sort_column == 'modified' || $sort_column == 'author' || $sort_column == 'name') ? 'post_' . $sort_column : $sort_column;
714
-
715
- if ($show == 'categories') {
716
- $tagcloud = $all_options['category_tagcloud'];
717
- } else if ($show == 'tags') {
718
- $tagcloud = $all_options['tags_tagcloud'];
719
- }
720
 
721
  // Pages: Yes/No?
722
- if ($all_options['show_pages'] != 'no' && $all_options['show_pages'] != 'off') {
723
  $pages_header = (empty($pages_header)) ? __('Pages') : $pages_header;
724
 
725
  $pages = '<div id="wp-realtime-sitemap-pages"><h3>' . $pages_header . '</h3>';
726
- $pages .= '<ul>' . wp_list_pages(array('sort_column' => $pagesort_column, 'sort_order' => $sort_order, 'title_li' => '', 'echo' => '0')) . '</ul></div>';
727
  }
728
 
729
  // Posts: Yes/No?
730
- if ($all_options['show_posts'] != 'no' && $all_options['show_posts'] != 'off') {
731
  $posts = '';
732
 
733
  // Set options for post query
734
  $theposts = get_posts(array(
735
- 'orderby' => $sort_column,
736
- 'order' => $sort_order,
737
- 'numberposts' => $limit,
 
738
  'post_type' => 'post',
739
  ));
740
 
@@ -744,7 +1222,7 @@ if (!class_exists('WPRealtimeSitemap')) {
744
 
745
  $extra = '';
746
 
747
- if ($date == 'yes')
748
  $extra = ' <span>' . get_the_date() . '</span>';
749
 
750
  $posts .= '<li><a href="' . get_permalink() . '" title="' . sprintf(esc_attr__('Permalink to %s'), the_title_attribute('echo=0')) . '" rel="bookmark">' . get_the_title() . '</a>' . $extra . '</li>';
@@ -757,7 +1235,7 @@ if (!class_exists('WPRealtimeSitemap')) {
757
  }
758
 
759
  // Custom Post Types: Yes/No?
760
- if ($all_options['show_custom_post_types'] != 'no' && $all_options['show_custom_post_types'] != 'off') {
761
  $custom_post_types = array();
762
 
763
  $post_types = get_post_types(array('public' => true, '_builtin' => false), 'objects');
@@ -767,9 +1245,10 @@ if (!class_exists('WPRealtimeSitemap')) {
767
 
768
  // Set options for post query
769
  $theposts = get_posts(array(
770
- 'orderby' => $sort_column,
771
- 'order' => $sort_order,
772
- 'numberposts' => $limit,
 
773
  'post_type' => $post_type->name,
774
  ));
775
 
@@ -779,7 +1258,7 @@ if (!class_exists('WPRealtimeSitemap')) {
779
 
780
  $extra = '';
781
 
782
- if ($date == 'yes')
783
  $extra = ' <span>' . get_the_date() . '</span>';
784
 
785
  $custom_post_type_posts .= '<li><a href="' . get_permalink() . '" title="' . sprintf(esc_attr__('Permalink to %s'), the_title_attribute('echo=0')) . '" rel="bookmark">' . get_the_title() . '</a>' . $extra . '</li>';
@@ -793,48 +1272,40 @@ if (!class_exists('WPRealtimeSitemap')) {
793
  }
794
 
795
  // Archives: Yes/No?
796
- if ($all_options['show_archives'] != 'no' && $all_options['show_archives'] != 'off') {
797
  $archives_header = (empty($archives_header)) ? __('Archives') : $archives_header;
798
 
799
  $archives = '<div id="wp-realtime-sitemap-archives"><h3>' . $archives_header . '</h3>';
800
- $archives .= '<ul>' . wp_get_archives(array('type' => 'monthly', 'show_post_count' => ($count == 'yes') ? true : false, 'echo' => 0)) . '</ul></div>';
801
  }
802
 
803
  // Categories: Yes/No?
804
- if ($all_options['show_categories'] != 'no' && $all_options['show_categories'] != 'off') {
805
  $categories_header = (empty($categories_header)) ? __('Categories') : $categories_header;
806
 
807
  $categories = '<div id="wp-realtime-sitemap-categories"><h3>' . $categories_header . '</h3>';
808
 
809
  // Tag Cloud: Yes/No?
810
- if ($all_options['category_tagcloud'] != 'no' && $all_options['category_tagcloud'] != 'off') {
811
- $categories .= '<p>' . wp_tag_cloud(array('format' => 'flat', 'separator' => ' ', 'taxonomy' => 'category', 'echo' => '0')) . '</p>';
812
  } else {
813
- if ($sort_column != 'ID' || $sort_column != 'name' || $sort_column != 'slug' || $sort_column != 'count' || $sort_column != 'term_group') {
814
- $categories_sort_column = 'name';
815
- }
816
-
817
- $categories .= '<ul>' . wp_list_categories(array('orderby' => (!isset($categories_sort_column)) ? $sort_column : $categories_sort_column, 'order' => $sort_order, 'show_count' => ($count == 'yes') ? true : false, 'hierarchical' => true, 'title_li' => '', 'echo' => '0', 'taxonomy' => 'category')) . '</ul>';
818
  }
819
 
820
  $categories .= '</div>';
821
  }
822
 
823
  // Tags: Yes/No?
824
- if ($all_options['show_tags'] != 'no' && $all_options['show_tags'] != 'off') {
825
  $tags_header = (empty($tags_header)) ? __('Tags', 'wp-realtime-sitemap') : $tags_header;
826
 
827
  $tags = '<div id="wp-realtime-sitemap-tags"><h3>' . $tags_header . '</h3>';
828
 
829
  // Tag Cloud: Yes/No?
830
- if ($all_options['tags_tagcloud'] != 'no' && $all_options['tags_tagcloud'] != 'off') {
831
- $tags .= '<p>' . wp_tag_cloud(array('format' => 'flat', 'separator' => ' ', 'echo' => '0')) . '</p>';
832
  } else {
833
- if ($sort_column != 'ID' || $sort_column != 'name' || $sort_column != 'slug' || $sort_column != 'count' || $sort_column != 'term_group') {
834
- $tags_sort_column = 'name';
835
- }
836
-
837
- $tags .= '<ul>' . wp_list_categories(array('orderby' => (!isset($tags_sort_column)) ? $sort_column : $tags_sort_column, 'order' => $sort_order, 'show_count' => ($count == 'yes') ? true : false, 'hierarchical' => true, 'title_li' => '', 'echo' => '0', 'taxonomy' => 'post_tag')) . '</ul>';
838
  }
839
 
840
  $tags .= '</div>';
@@ -881,29 +1352,57 @@ if (!class_exists('WPRealtimeSitemap')) {
881
  $options = get_option('plugin_wp_realtime_sitemap_settings');
882
  // set the default settings, if we didn't upgrade
883
  if (empty($options))
884
- $this->_defaultSettings();
885
  }
886
 
887
  function _defaultSettings () {
888
  $defaults = array(
889
- 'sort_column' => 'post_date',
890
- 'sort_order' => 'ASC',
891
- 'count' => 'no',
892
- 'date' => 'no',
893
- 'limit' => '-1',
894
- 'show_pages' => 'yes',
895
- 'show_posts' => 'yes',
896
- 'show_custom_post_types' => 'yes',
897
- 'show_archives' => 'yes',
898
- 'show_categories' => 'yes',
899
- 'category_tagcloud' => 'no',
900
- 'show_tags' => 'no',
901
- 'tags_tagcloud' => 'no',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
902
  'pages_header' => '',
903
  'posts_header' => '',
904
  'archives_header' => '',
905
  'categories_header' => '',
906
  'tags_header' => '',
 
 
 
 
 
 
 
907
  );
908
 
909
  update_option('plugin_wp_realtime_sitemap_settings', $defaults);
4
  Plugin Name: WP Realtime Sitemap
5
  Plugin URI: http://www.daniel-tweedy.co.uk/redir/wp-realtime-sitemap-home/
6
  Description: Adds a sitemap to your Wordpress blog that is always up-to-date. Add `[wp-realtime-sitemap show="all"]` to any page or post and the site map will be added there. Use Settings->WP Realtime Sitemap to set options.
7
+ Version: 1.5
8
  Author: Daniel Tweedy
9
  Author URI: http://www.daniel-tweedy.co.uk/
10
  License: GPL2
135
  function addOptionsInit() {
136
  register_setting('update_settings', 'plugin_wp_realtime_sitemap_settings', array($this, '_formValidate'));
137
 
138
+ add_settings_section('page_settings', __('Page Settings', 'wp-realtime-sitemap'), array($this, 'page_section_text'), __FILE__);
139
+ add_settings_field('page_sort_column', __('Order By', 'wp-realtime-sitemap'), array($this, '_formSelectInput'), __FILE__, 'page_settings', array('dbfield' => 'page_sort_column', 'section' => 'page'));
140
+ add_settings_field('page_sort_order', __('Order', 'wp-realtime-sitemap'), array($this, '_formSelectInput'), __FILE__, 'page_settings', array('dbfield' => 'page_sort_order', 'section' => 'page'));
141
+ add_settings_field('page_exclude', __('Exclude IDs', 'wp-realtime-sitemap'), array($this, '_formTextInput'), __FILE__, 'page_settings', array('dbfield' => 'page_exclude', 'section' => 'page'));
142
+ add_settings_field('page_depth', __('Hierarchy Depth', 'wp-realtime-sitemap'), array($this, '_formSelectInput'), __FILE__, 'page_settings', array('dbfield' => 'page_depth', 'section' => 'page'));
143
+ add_settings_field('page_show_date', __('Display Date', 'wp-realtime-sitemap'), array($this, '_formSelectInput'), __FILE__, 'page_settings', array('dbfield' => 'page_show_date', 'section' => 'page'));
144
+ // add_settings_field('page_number', __('Limit', 'wp-realtime-sitemap'), array($this, '_formTextInput'), __FILE__, 'page_settings', array('dbfield' => 'page_number', 'section' => 'page'));
145
+
146
+ add_settings_section('post_settings', __('Post & Custom Post Type Settings', 'wp-realtime-sitemap'), array($this, 'post_section_text'), __FILE__);
147
+ add_settings_field('post_orderby', __('Order By', 'wp-realtime-sitemap'), array($this, '_formSelectInput'), __FILE__, 'post_settings', array('dbfield' => 'post_orderby', 'section' => 'post'));
148
+ add_settings_field('post_order', __('Order', 'wp-realtime-sitemap'), array($this, '_formSelectInput'), __FILE__, 'post_settings', array('dbfield' => 'post_order', 'section' => 'post'));
149
+ add_settings_field('post_exclude', __('Exclude IDs', 'wp-realtime-sitemap'), array($this, '_formTextInput'), __FILE__, 'post_settings', array('dbfield' => 'post_exclude', 'section' => 'post'));
150
+ add_settings_field('post_show_date', __('Display Date', 'wp-realtime-sitemap'), array($this, '_formSelectInput'), __FILE__, 'post_settings', array('dbfield' => 'post_show_date', 'section' => 'post'));
151
+ add_settings_field('post_numberposts', __('Limit', 'wp-realtime-sitemap'), array($this, '_formTextInput'), __FILE__, 'post_settings', array('dbfield' => 'post_numberposts', 'section' => 'post'));
152
+
153
+ add_settings_section('archive_settings', __('Archive Settings', 'wp-realtime-sitemap'), array($this, 'archive_section_text'), __FILE__);
154
+ add_settings_field('archive_type', __('Type', 'wp-realtime-sitemap'), array($this, '_formSelectInput'), __FILE__, 'archive_settings', array('dbfield' => 'archive_type', 'section' => 'archive'));
155
+ add_settings_field('archive_limit', __('Limit', 'wp-realtime-sitemap'), array($this, '_formTextInput'), __FILE__, 'archive_settings', array('dbfield' => 'archive_limit', 'section' => 'archive'));
156
+ add_settings_field('archive_show_post_count', __('Post Count', 'wp-realtime-sitemap'), array($this, '_formSelectInput'), __FILE__, 'archive_settings', array('dbfield' => 'archive_show_post_count', 'section' => 'archive'));
157
+
158
+ add_settings_section('category_settings', __('Category Settings', 'wp-realtime-sitemap'), array($this, 'category_section_text'), __FILE__);
159
+ add_settings_field('category_tagcloud', __('Show as a Tag Cloud', 'wp-realtime-sitemap'), array($this, '_formSelectInput'), __FILE__, 'category_settings', array('dbfield' => 'category_tagcloud', 'section' => 'category'));
160
+ add_settings_field('category_orderby', __('Order By', 'wp-realtime-sitemap'), array($this, '_formSelectInput'), __FILE__, 'category_settings', array('dbfield' => 'category_orderby', 'section' => 'category'));
161
+ add_settings_field('category_order', __('Order', 'wp-realtime-sitemap'), array($this, '_formSelectInput'), __FILE__, 'category_settings', array('dbfield' => 'category_order', 'section' => 'category'));
162
+ add_settings_field('category_show_post_count', __('Post Count', 'wp-realtime-sitemap'), array($this, '_formSelectInput'), __FILE__, 'category_settings', array('dbfield' => 'category_show_post_count', 'section' => 'category'));
163
+ add_settings_field('category_hide_empty', __('Hide Empty', 'wp-realtime-sitemap'), array($this, '_formSelectInput'), __FILE__, 'category_settings', array('dbfield' => 'category_hide_empty', 'section' => 'category'));
164
+ add_settings_field('category_exclude', __('Exclude IDs', 'wp-realtime-sitemap'), array($this, '_formTextInput'), __FILE__, 'category_settings', array('dbfield' => 'category_exclude', 'section' => 'category'));
165
+ add_settings_field('category_number', __('Limit', 'wp-realtime-sitemap'), array($this, '_formTextInput'), __FILE__, 'category_settings', array('dbfield' => 'category_number', 'section' => 'category'));
166
+ add_settings_field('category_depth', __('Hierarchy Depth', 'wp-realtime-sitemap'), array($this, '_formSelectInput'), __FILE__, 'category_settings', array('dbfield' => 'category_depth', 'section' => 'category'));
167
+
168
+ add_settings_section('tag_settings', __('Tag Settings', 'wp-realtime-sitemap'), array($this, 'tag_section_text'), __FILE__);
169
+ add_settings_field('tags_tagcloud', __('Show as a Tag Cloud', 'wp-realtime-sitemap'), array($this, '_formSelectInput'), __FILE__, 'tag_settings', array('dbfield' => 'tags_tagcloud', 'section' => 'tag'));
170
+ add_settings_field('tags_orderby', __('Order By', 'wp-realtime-sitemap'), array($this, '_formSelectInput'), __FILE__, 'tag_settings', array('dbfield' => 'tags_orderby', 'section' => 'tag'));
171
+ add_settings_field('tags_order', __('Order', 'wp-realtime-sitemap'), array($this, '_formSelectInput'), __FILE__, 'tag_settings', array('dbfield' => 'tags_order', 'section' => 'tag'));
172
+ add_settings_field('tags_show_post_count', __('Post Count', 'wp-realtime-sitemap'), array($this, '_formSelectInput'), __FILE__, 'tag_settings', array('dbfield' => 'tags_show_post_count', 'section' => 'tag'));
173
+ add_settings_field('tags_hide_empty', __('Hide Empty', 'wp-realtime-sitemap'), array($this, '_formSelectInput'), __FILE__, 'tag_settings', array('dbfield' => 'tags_hide_empty', 'section' => 'tag'));
174
+ add_settings_field('tags_exclude', __('Exclude IDs', 'wp-realtime-sitemap'), array($this, '_formTextInput'), __FILE__, 'tag_settings', array('dbfield' => 'tags_exclude', 'section' => 'tag'));
175
+ add_settings_field('tags_number', __('Limit', 'wp-realtime-sitemap'), array($this, '_formTextInput'), __FILE__, 'tag_settings', array('dbfield' => 'tags_number', 'section' => 'tag'));
176
 
177
  add_settings_section('header_settings', __('Header Settings', 'wp-realtime-sitemap'), array($this, 'header_section_text'), __FILE__);
178
+ add_settings_field('pages_header', __('Pages Header', 'wp-realtime-sitemap'), array($this, '_formTextInput'), __FILE__, 'header_settings', array('dbfield' => 'pages_header', 'section' => 'header'));
179
+ add_settings_field('posts_header', __('Posts Header', 'wp-realtime-sitemap'), array($this, '_formTextInput'), __FILE__, 'header_settings', array('dbfield' => 'posts_header', 'section' => 'header'));
180
+ add_settings_field('archives_header', __('Archives Header', 'wp-realtime-sitemap'), array($this, '_formTextInput'), __FILE__, 'header_settings', array('dbfield' => 'archives_header', 'section' => 'header'));
181
+ add_settings_field('categories_header', __('Categories Header', 'wp-realtime-sitemap'), array($this, '_formTextInput'), __FILE__, 'header_settings', array('dbfield' => 'categories_header', 'section' => 'header'));
182
+ add_settings_field('tags_header', __('Tags Header', 'wp-realtime-sitemap'), array($this, '_formTextInput'), __FILE__, 'header_settings', array('dbfield' => 'tags_header', 'section' => 'header'));
183
 
184
  add_settings_section('display_settings', __('Display Settings', 'wp-realtime-sitemap'), array($this, 'display_section_text'), __FILE__);
185
+ add_settings_field('show_pages', __('Show Pages', 'wp-realtime-sitemap'), array($this, '_formSelectInput'), __FILE__, 'display_settings', array('dbfield' => 'show_pages', 'section' => 'display'));
186
+ add_settings_field('show_posts', __('Show Posts', 'wp-realtime-sitemap'), array($this, '_formSelectInput'), __FILE__, 'display_settings', array('dbfield' => 'show_posts', 'section' => 'display'));
187
+ add_settings_field('show_custom_post_types', __('Show ALL Custom Post Types', 'wp-realtime-sitemap'), array($this, '_formSelectInput'), __FILE__, 'display_settings', array('dbfield' => 'show_custom_post_types', 'section' => 'display'));
188
+ add_settings_field('show_archives', __('Show Archives', 'wp-realtime-sitemap'), array($this, '_formSelectInput'), __FILE__, 'display_settings', array('dbfield' => 'show_archives', 'section' => 'display'));
189
+ add_settings_field('show_categories', __('Show Categories', 'wp-realtime-sitemap'), array($this, '_formSelectInput'), __FILE__, 'display_settings', array('dbfield' => 'show_categories', 'section' => 'display'));
190
+ add_settings_field('show_tags', __('Show Tags', 'wp-realtime-sitemap'), array($this, '_formSelectInput'), __FILE__, 'display_settings', array('dbfield' => 'show_tags', 'section' => 'display'));
191
  }
192
 
193
+ function page_section_text($args) {
194
+ echo '<p>' . __('Exclude IDs must be either left blank, or be a comma seperated list of IDs.', 'wp-realtime-sitemap') . '</p>';
195
  }
196
 
197
+ function post_section_text() {
198
+ echo '<p>' . __('Exclude IDs must be either left blank, or be a comma seperated list of IDs.', 'wp-realtime-sitemap') . '</p>';
199
+ echo '<p>' . __('Display Date is to show the date that the post itself was created/published.', 'wp-realtime-sitemap') . '</p>';
200
+ echo '<p>' . __('Limit is used to apply a limit as to how many posts should be shown on the sitemap, useful for if you have a very large blog and as such a large number of posts, use -1 to show all posts and not apply a limit.', 'wp-realtime-sitemap') . '</p>';
201
+ }
 
 
 
 
 
 
 
 
 
 
202
 
203
+ function archive_section_text($args) {
204
+ echo '<p>' . __('Limit is used to apply a limit as to how many archives should be shown on the sitemap, useful for if you have a very large blog and as such a large number of archives, leave blank to show all archives and not apply a limit.', 'wp-realtime-sitemap') . '</p>';
205
+ }
206
 
207
+ function category_section_text($args) {
208
+ echo '<p>' . __('All options apply to the tag cloud, unless otherwise explicity stated.', 'wp-realtime-sitemap') . '</p>';
209
+ echo '<p>' . __('Exclude IDs must be either left blank, or be a comma seperated list of IDs.', 'wp-realtime-sitemap') . '</p>';
210
+ echo '<p>' . __('Limit is used to apply a limit as to how many categories should be shown on the sitemap, useful for if you have a very large blog and as such a large number of categories, use 0 to show all categories and not apply a limit.', 'wp-realtime-sitemap') . '</p>';
211
+ }
212
 
213
+ function tag_section_text($args) {
214
+ echo '<p>' . __('All options apply to the tag cloud, unless otherwise explicity stated.', 'wp-realtime-sitemap') . '</p>';
215
+ echo '<p>' . __('Exclude IDs must be either left blank, or be a comma seperated list of IDs.', 'wp-realtime-sitemap') . '</p>';
216
+ echo '<p>' . __('Limit is used to apply a limit as to how many tags should be shown on the sitemap, useful for if you have a very large blog and as such a large number of tags, use 0 to show all tags and not apply a limit.', 'wp-realtime-sitemap') . '</p>';
217
+ }
218
 
219
+ function header_section_text() {
220
+ echo '<p>' . __('This section is optional, you can change the names of the sections if you wish from the defaults. Defaults are used when the below options are left blank/empty.', 'wp-realtime-sitemap') . '</p>';
221
  }
222
 
223
+ function display_section_text() {
224
+ echo '<p>' . __('Choose what you would like to be displayed on your site map.', 'wp-realtime-sitemap') . '</p>';
225
+ }
226
 
227
+ function _formValidDefaults($args) {
228
+ $values = false;
229
+
230
+ switch($args['dbfield']) {
231
+ case 'page_sort_column':
232
+ $values = array(
233
+ 'post_title' => __('Alphabetically (by title) (Default)', 'wp-realtime-sitemap'),
234
+ 'menu_order' => __('Page order', 'wp-realtime-sitemap'),
235
+ 'post_date' => __('Creation time', 'wp-realtime-sitemap'),
236
+ 'post_modified' => __('Time last modified', 'wp-realtime-sitemap'),
237
+ 'ID' => __('Numeric Page ID', 'wp-realtime-sitemap'),
238
+ 'post_author' => __('Page author', 'wp-realtime-sitemap'),
239
+ 'post_name' => __('Alphabetically (by post slug)', 'wp-realtime-sitemap'),
240
+ );
241
+ break;
242
+
243
+ case 'page_sort_order':
244
+ $values = array(
245
+ 'ASC' => __('Sort from lowest to highest (Default)', 'wp-realtime-sitemap'),
246
+ 'DESC' => __('Sort from highest to lowest', 'wp-realtime-sitemap'),
247
+ );
248
+ break;
249
+
250
+ case 'page_depth':
251
+ $values = array(
252
+ '0' => __('Displays pages at any depth and arranges them hierarchically in nested lists (Default)', 'wp-realtime-sitemap'),
253
+ '-1' => __('Displays pages at any depth and arranges them in a single, flat list', 'wp-realtime-sitemap'),
254
+ '1' => __('Displays top-level Pages only', 'wp-realtime-sitemap'),
255
+ );
256
+ break;
257
+
258
+ case 'page_show_date':
259
+ $values = array(
260
+ '' => __('Display no date (Default)', 'wp-realtime-sitemap'),
261
+ 'modified' => __('Display the date last modified', 'wp-realtime-sitemap'),
262
+ 'created' => __('Display the date first created', 'wp-realtime-sitemap'),
263
+ );
264
+ break;
265
+
266
+ /* case 'page_number':
267
+ $values = array('numeric' => 'numeric');
268
+ break; */
269
+
270
+ case 'post_orderby':
271
+ $values = array(
272
+ 'post_date' => __('Sort by post date (Default)', 'wp-realtime-sitemap'),
273
+ 'author' => __('Sort by the numeric author IDs', 'wp-realtime-sitemap'),
274
+ 'category' => __('Sort by the numeric category IDs', 'wp-realtime-sitemap'),
275
+ 'content' => __('Sort by content', 'wp-realtime-sitemap'),
276
+ 'date' => __('Sort by creation date', 'wp-realtime-sitemap'),
277
+ 'ID' => __('Sort by numeric Post ID', 'wp-realtime-sitemap'),
278
+ 'modified' => __('Sort by last modified date', 'wp-realtime-sitemap'),
279
+ 'name' => __('Sort by stub', 'wp-realtime-sitemap'),
280
+ 'parent' => __('Sort by parent ID', 'wp-realtime-sitemap'),
281
+ 'password' => __('Sort by password', 'wp-realtime-sitemap'),
282
+ 'rand' => __('Randomly sort results', 'wp-realtime-sitemap'),
283
+ 'status' => __('Sort by status', 'wp-realtime-sitemap'),
284
+ 'title' => __('Sort by title', 'wp-realtime-sitemap'),
285
+ 'type' => __('Sort by type', 'wp-realtime-sitemap'),
286
+ );
287
+ break;
288
+
289
+ case 'post_order':
290
+ $values = array(
291
+ 'ASC' => __('Sort from lowest to highest (Default)', 'wp-realtime-sitemap'),
292
+ 'DESC' => __('Sort from highest to lowest', 'wp-realtime-sitemap'),
293
+ );
294
+ break;
295
+
296
+ case 'post_show_date':
297
+ $values = array(
298
+ 'Yes' => __('Yes/On', 'wp-realtime-sitemap'),
299
+ 'No' => __('No/Off (Default)', 'wp-realtime-sitemap'),
300
+ );
301
+ break;
302
+
303
+ case 'post_numberposts':
304
+ $values = array('numeric' => 'numeric');
305
+ break;
306
+
307
+ case 'archive_type':
308
+ $values = array(
309
+ 'yearly' => __('Yearly', 'wp-realtime-sitemap'),
310
+ 'monthly' => __('Monthly (Default)', 'wp-realtime-sitemap'),
311
+ 'daily' => __('Daily', 'wp-realtime-sitemap'),
312
+ 'weekly' => __('Weekly', 'wp-realtime-sitemap'),
313
+ );
314
+ break;
315
+
316
+ case 'archive_limit':
317
+ $values = array('numeric' => 'numeric');
318
+ break;
319
+
320
+ case 'archive_show_post_count':
321
+ $values = array(
322
+ true => __('True (Default)', 'wp-realtime-sitemap'),
323
+ false => __('False', 'wp-realtime-sitemap'),
324
+ );
325
+ break;
326
+
327
+ case 'category_tagcloud':
328
+ $values = array(
329
+ 'Yes' => __('Yes/On', 'wp-realtime-sitemap'),
330
+ 'No' => __('No/Off (Default)', 'wp-realtime-sitemap'),
331
+ );
332
+ break;
333
+
334
+ case 'category_orderby':
335
+ $values = array(
336
+ 'ID' => __('ID', 'wp-realtime-sitemap'),
337
+ 'name' => __('Name (Default)', 'wp-realtime-sitemap'),
338
+ 'slug' => __('Slug', 'wp-realtime-sitemap'),
339
+ 'count' => __('Count', 'wp-realtime-sitemap'),
340
+ 'term_group' => __('Term Group', 'wp-realtime-sitemap'),
341
+ );
342
+ break;
343
+
344
+ case 'category_order':
345
+ $values = array(
346
+ 'ASC' => __('Sort from lowest to highest (Default)', 'wp-realtime-sitemap'),
347
+ 'DESC' => __('Sort from highest to lowest', 'wp-realtime-sitemap'),
348
+ );
349
+ break;
350
+
351
+ case 'category_show_post_count':
352
+ $values = array(
353
+ true => __('True', 'wp-realtime-sitemap'),
354
+ false => __('False (Default)', 'wp-realtime-sitemap'),
355
+ );
356
+ break;
357
+
358
+ case 'category_hide_empty':
359
+ $values = array(
360
+ true => __('True (Default)', 'wp-realtime-sitemap'),
361
+ false => __('False', 'wp-realtime-sitemap'),
362
+ );
363
+ break;
364
+
365
+ case 'category_number':
366
+ $values = array('numeric' => 'numeric');
367
+ break;
368
+
369
+ case 'category_depth':
370
+ $values = array(
371
+ '0' => __('All Categories and child Categories (Default)', 'wp-realtime-sitemap'),
372
+ '-1' => __('All Categories displayed in flat (no indent) form', 'wp-realtime-sitemap'),
373
+ '1' => __('Show only top level Categories ', 'wp-realtime-sitemap'),
374
+ );
375
+ break;
376
+
377
+ case 'tags_tagcloud':
378
+ $values = array(
379
+ 'Yes' => __('Yes/On', 'wp-realtime-sitemap'),
380
+ 'No' => __('No/Off (Default)', 'wp-realtime-sitemap'),
381
+ );
382
+ break;
383
+
384
+ case 'tags_orderby':
385
+ $values = array(
386
+ 'ID' => __('ID', 'wp-realtime-sitemap'),
387
+ 'name' => __('Name (Default)', 'wp-realtime-sitemap'),
388
+ 'slug' => __('Slug', 'wp-realtime-sitemap'),
389
+ 'count' => __('Count', 'wp-realtime-sitemap'),
390
+ 'term_group' => __('Term Group', 'wp-realtime-sitemap'),
391
+ );
392
+ break;
393
+
394
+ case 'tags_order':
395
+ $values = array(
396
+ 'ASC' => __('Sort ascending (Default)', 'wp-realtime-sitemap'),
397
+ 'DESC' => __('Sort descending', 'wp-realtime-sitemap'),
398
+ );
399
+ break;
400
+
401
+ case 'tags_show_post_count':
402
+ $values = array(
403
+ true => __('True', 'wp-realtime-sitemap'),
404
+ false => __('False (Default)', 'wp-realtime-sitemap'),
405
+ );
406
+ break;
407
+
408
+ case 'tags_hide_empty':
409
+ $values = array(
410
+ true => __('True (Default)', 'wp-realtime-sitemap'),
411
+ false => __('False', 'wp-realtime-sitemap'),
412
+ );
413
+ break;
414
+
415
+ case 'tags_number':
416
+ $values = array('numeric' => 'numeric');
417
+ break;
418
+
419
+ case 'show_pages':
420
+ $values = array(
421
+ 'Yes' => __('Yes/On (Default)', 'wp-realtime-sitemap'),
422
+ 'No' => __('No/Off', 'wp-realtime-sitemap'),
423
+ );
424
+ break;
425
+
426
+ case 'show_posts':
427
+ $values = array(
428
+ 'Yes' => __('Yes/On (Default)', 'wp-realtime-sitemap'),
429
+ 'No' => __('No/Off', 'wp-realtime-sitemap'),
430
+ );
431
+ break;
432
+
433
+ case 'show_custom_post_types':
434
+ $values = array(
435
+ 'Yes' => __('Yes/On', 'wp-realtime-sitemap'),
436
+ 'No' => __('No/Off (Default)', 'wp-realtime-sitemap'),
437
+ );
438
+ break;
439
+
440
+ case 'show_archives':
441
+ $values = array(
442
+ 'Yes' => __('Yes/On (Default)', 'wp-realtime-sitemap'),
443
+ 'No' => __('No/Off', 'wp-realtime-sitemap'),
444
+ );
445
+ break;
446
+
447
+ case 'show_categories':
448
+ $values = array(
449
+ 'Yes' => __('Yes/On (Default)', 'wp-realtime-sitemap'),
450
+ 'No' => __('No/Off', 'wp-realtime-sitemap'),
451
+ );
452
+ break;
453
+
454
+ case 'show_tags':
455
+ $values = array(
456
+ 'Yes' => __('Yes/On', 'wp-realtime-sitemap'),
457
+ 'No' => __('No/Off (Default)', 'wp-realtime-sitemap'),
458
+ );
459
+ break;
460
+ }
461
 
462
+ return $values;
463
+ }
464
 
465
+ function _formInfoText($args) {
466
+ switch($args['dbfield']) {
467
+ case 'page_sort_column':
468
+ $infotext = '';
469
+ break;
470
 
471
+ case 'page_sort_order':
472
+ $infotext = '';
473
+ break;
474
 
475
+ case 'page_exclude':
476
+ $infotext = __('Comma separated list of IDs.', 'wp-realtime-sitemap');
477
+ break;
478
 
479
+ case 'page_depth':
480
+ $infotext = '';
481
+ break;
482
 
483
+ case 'page_show_date':
484
+ $infotext = '';
485
+ break;
 
 
486
 
487
+ /* case 'page_number':
488
+ $infotext = __('leave blank to show all.', 'wp-realtime-sitemap');
489
+ break; */
490
 
491
+ case 'post_orderby':
492
+ $infotext = '';
493
+ break;
 
494
 
495
+ case 'post_order':
496
+ $infotext = '';
497
+ break;
498
 
499
+ case 'post_exclude':
500
+ $infotext = __('Comma separated list of IDs.', 'wp-realtime-sitemap');
501
+ break;
502
 
503
+ case 'post_show_date':
504
+ $infotext = '';
505
+ break;
506
 
507
+ case 'post_numberposts':
508
+ $infotext = __('-1 to show all.', 'wp-realtime-sitemap');
509
+ break;
510
 
511
+ case 'archive_type':
512
+ $infotext = '';
513
+ break;
514
 
515
+ case 'archive_limit':
516
+ $infotext = __('leave blank to show all.', 'wp-realtime-sitemap');
517
+ break;
518
 
519
+ case 'archive_show_post_count':
520
+ $infotext = '';
521
+ break;
 
522
 
523
+ case 'category_tagcloud':
524
+ $infotext = '';
525
+ break;
526
 
527
+ case 'category_orderby':
528
+ $infotext = '';
529
+ break;
530
 
531
+ case 'category_order':
532
+ $infotext = '';
533
+ break;
534
 
535
+ case 'category_show_post_count':
536
+ $infotext = __('This is ignored with the tag cloud setting.', 'wp-realtime-sitemap');
537
+ break;
538
 
539
+ case 'category_hide_empty':
540
+ $infotext = __('This is ignored with the tag cloud setting.', 'wp-realtime-sitemap');
541
+ break;
542
 
543
+ case 'category_exclude':
544
+ $infotext = __('Comma separated list of IDs.', 'wp-realtime-sitemap');
545
+ break;
546
 
547
+ case 'category_number':
548
+ $infotext = __('0 to show all.', 'wp-realtime-sitemap');
549
+ break;
550
 
551
+ case 'category_depth':
552
+ $infotext = '';
553
+ break;
554
 
555
+ case 'tags_tagcloud':
556
+ $infotext = '';
557
+ break;
558
 
559
+ case 'tags_orderby':
560
+ $infotext = '';
561
+ break;
 
562
 
563
+ case 'tags_order':
564
+ $infotext = '';
565
+ break;
566
+
567
+ case 'tags_show_post_count':
568
+ $infotext = __('This is ignored with the tag cloud setting.', 'wp-realtime-sitemap');
569
+ break;
570
 
571
+ case 'tags_hide_empty':
572
+ $infotext = __('This is ignored with the tag cloud setting.', 'wp-realtime-sitemap');
573
+ break;
574
 
575
+ case 'tags_exclude':
576
+ $infotext = __('Comma separated list of IDs.', 'wp-realtime-sitemap');
577
+ break;
578
 
579
+ case 'tags_number':
580
+ $infotext = __('0 to show all tags.', 'wp-realtime-sitemap');
581
+ break;
582
 
583
+ case 'pages_header':
584
+ $infotext = '';
585
+ break;
586
 
587
+ case 'posts_header':
588
+ $infotext = '';
589
+ break;
590
 
591
+ case 'archives_header':
592
+ $infotext = '';
593
+ break;
 
594
 
595
+ case 'categories_header':
596
+ $infotext = '';
597
+ break;
598
 
599
+ case 'tags_header':
600
+ $infotext = '';
601
+ break;
602
 
603
+ case 'show_pages':
604
+ $infotext = '';
605
+ break;
606
 
607
+ case 'show_posts':
608
+ $infotext = '';
609
+ break;
610
 
611
+ case 'show_custom_post_types':
612
+ $infotext = '';
613
+ break;
614
 
615
+ case 'show_archives':
616
+ $infotext = '';
617
+ break;
618
 
619
+ case 'show_categories':
620
+ $infotext = '';
621
+ break;
622
 
623
+ case 'show_tags':
624
+ $infotext = '';
625
+ break;
626
+ }
627
+
628
+ return $infotext;
629
  }
630
 
631
+ function _formSelectInput($args) {
632
  // Get current options from the database.
633
  extract(get_option('plugin_wp_realtime_sitemap_settings'));
634
 
635
+ $values = $this->_formValidDefaults($args);
636
+ $infotext = $this->_formInfoText($args);
637
 
638
+ if (isset($values) && is_array($values)) {
639
+ $optionFormat = '<option value="%s"%s>%s</option>';
 
640
 
641
+ $output = '<select name="plugin_wp_realtime_sitemap_settings[' . $args['dbfield'] . ']">';
 
642
 
643
+ foreach ($values as $key => $label) {
644
+ $output .= sprintf($optionFormat, $key, selected($$args['dbfield'], $key, false), $label);
645
+ }
646
 
647
+ $output .= '</select> ' . $infotext;
648
+ } else {
649
+ $output = '$values not set or not an array.';
650
+ }
651
+
652
+ echo $output;
653
  }
654
 
655
+ function _formTextInput($args) {
656
  // Get current options from the database.
657
  extract(get_option('plugin_wp_realtime_sitemap_settings'));
658
 
659
+ $infotext = $this->_formInfoText($args);
 
660
 
661
+ if (array_key_exists('dbfield', $args) && isset($infotext)) {
662
+ echo '<input name="plugin_wp_realtime_sitemap_settings[' . $args['dbfield'] . ']" size="30" type="text" value="' . $$args['dbfield'] . '" /> ' . $infotext;
663
+ } else {
664
+ echo 'no dbfield in array found or infotext not been set';
665
+ }
666
  }
667
 
668
+ function _formValidate($inputs) {
669
+ $plugin_wp_realtime_sitemap_settings = get_option('plugin_wp_realtime_sitemap_settings');
 
670
 
671
+ $validInputs = array(
672
+ // PAGE SETTINGS
673
+ 'page_sort_column' => array(
674
+ 'valid' => array_keys($this->_formValidDefaults(array('dbfield' => 'page_sort_column'))),
675
+ 'default' => '',
676
+ 'errormsg' => __('Page Settings', 'wp-realtime-sitemap') . ' > ' . __('Order By', 'wp-realtime-sitemap') . ': ' . __('The option choosen is not valid, please try again.', 'wp-realtime-sitemap'),
677
+ ),
678
+ 'page_sort_order' => array(
679
+ 'valid' => array_keys($this->_formValidDefaults(array('dbfield' => 'page_sort_order'))),
680
+ 'default' => '',
681
+ 'errormsg' => __('Page Settings', 'wp-realtime-sitemap') . ' > ' . __('Order', 'wp-realtime-sitemap') . ': ' . __('The option choosen is not valid, please try again.', 'wp-realtime-sitemap'),
682
+ ),
683
+ 'page_exclude' => array(
684
+ 'valid' => array(),
685
+ 'default' => '',
686
+ 'errormsg' => __('Page Settings', 'wp-realtime-sitemap') . ' > ' . __('Exclude', 'wp-realtime-sitemap') . ': ' . __('This must be comment seperated for it to be valid, please try again.', 'wp-realtime-sitemap'),
687
+ ),
688
+ 'page_depth' => array(
689
+ 'valid' => array_keys($this->_formValidDefaults(array('dbfield' => 'page_depth'))),
690
+ 'default' => '',
691
+ 'errormsg' => __('Page Settings', 'wp-realtime-sitemap') . ' > ' . __('Hierarchy Depth', 'wp-realtime-sitemap') . ': ' . __('The option choosen is not valid, please try again.', 'wp-realtime-sitemap'),
692
+ ),
693
+ 'page_show_date' => array(
694
+ 'valid' => array_keys($this->_formValidDefaults(array('dbfield' => 'page_show_date'))),
695
+ 'default' => '',
696
+ 'errormsg' => __('Page Settings', 'wp-realtime-sitemap') . ' > ' . __('Display Date', 'wp-realtime-sitemap') . ': ' . __('The option choosen is not valid, please try again.', 'wp-realtime-sitemap'),
697
+ ),
698
+ /* 'page_number' => array(
699
+ 'valid' => array_keys($this->_formValidDefaults(array('dbfield' => 'page_number'))),
700
+ 'default' => '',
701
+ 'errormsg' => __('Page Settings', 'wp-realtime-sitemap') . ' > ' . __('Limit', 'wp-realtime-sitemap') . ': ' . __('Only integers or -1 are accepted as valid inputs.', 'wp-realtime-sitemap'),
702
+ ), */
703
+
704
+ // POST SETTINGS
705
+ 'post_orderby' => array(
706
+ 'valid' => array_keys($this->_formValidDefaults(array('dbfield' => 'post_orderby'))),
707
+ 'default' => '',
708
+ 'errormsg' => __('Post Settings', 'wp-realtime-sitemap') . ' > ' . __('Order By', 'wp-realtime-sitemap') . ': ' . __('The option choosen is not valid, please try again.', 'wp-realtime-sitemap'),
709
+ ),
710
+ 'post_order' => array(
711
+ 'valid' => array_keys($this->_formValidDefaults(array('dbfield' => 'post_order'))),
712
+ 'default' => '',
713
+ 'errormsg' => __('Post Settings', 'wp-realtime-sitemap') . ' > ' . __('Order', 'wp-realtime-sitemap') . ': ' . __('The option choosen is not valid, please try again.', 'wp-realtime-sitemap'),
714
+ ),
715
+ 'post_exclude' => array(
716
+ 'valid' => array(),
717
+ 'default' => '',
718
+ 'errormsg' => __('Post Settings', 'wp-realtime-sitemap') . ' > ' . __('Exclude', 'wp-realtime-sitemap') . ': ' . __('This must be comment seperated list of IDs for it to be valid, please try again.', 'wp-realtime-sitemap'),
719
+ ),
720
+ 'post_show_date' => array(
721
+ 'valid' => array_keys($this->_formValidDefaults(array('dbfield' => 'post_show_date'))),
722
+ 'default' => '',
723
+ 'errormsg' => __('Post Settings', 'wp-realtime-sitemap') . ' > ' . __('Display Date', 'wp-realtime-sitemap') . ': ' . __('Only Yes/On or No/Off are accepted as valid inputs.', 'wp-realtime-sitemap'),
724
+ ),
725
+ 'post_numberposts' => array(
726
+ 'valid' => array_keys($this->_formValidDefaults(array('dbfield' => 'post_numberposts'))),
727
+ 'default' => '',
728
+ 'errormsg' => __('Post Settings', 'wp-realtime-sitemap') . ' > ' . __('Limit', 'wp-realtime-sitemap') . ': ' . __('Only integers are accepted as valid inputs.', 'wp-realtime-sitemap'),
729
+ ),
730
+
731
+ // ARCHIVE SETTINGS
732
+ 'archive_type' => array(
733
+ 'valid' => array_keys($this->_formValidDefaults(array('dbfield' => 'archive_type'))),
734
+ 'default' => '',
735
+ 'errormsg' => __('Archive Settings', 'wp-realtime-sitemap') . ' > ' . __('Archive Type', 'wp-realtime-sitemap') . ': ' . __('', 'wp-realtime-sitemap'),
736
+ ),
737
+ 'archive_limit' => array(
738
+ 'valid' => array_keys($this->_formValidDefaults(array('dbfield' => 'archive_limit'))),
739
+ 'default' => '',
740
+ 'errormsg' => __('Archive Settings', 'wp-realtime-sitemap') . ' > ' . __('Limit', 'wp-realtime-sitemap') . ': ' . __('Only integers are accepted as valid inputs.', 'wp-realtime-sitemap'),
741
+ ),
742
+ 'archive_show_post_count' => array(
743
+ 'valid' => array_keys($this->_formValidDefaults(array('dbfield' => 'archive_show_post_count'))),
744
+ 'default' => '',
745
+ 'errormsg' => __('Archive Settings', 'wp-realtime-sitemap') . ' > ' . __('Post Count', 'wp-realtime-sitemap') . ': ' . __('', 'wp-realtime-sitemap'),
746
+ ),
747
+
748
+ // CATEGORY SETTINGS
749
+ 'category_tagcloud' => array(
750
+ 'valid' => array_keys($this->_formValidDefaults(array('dbfield' => 'category_tagcloud'))),
751
+ 'default' => '',
752
+ 'errormsg' => 'category_tagcloud',
753
+ ),
754
+ 'category_orderby' => array(
755
+ 'valid' => array_keys($this->_formValidDefaults(array('dbfield' => 'category_orderby'))),
756
+ 'default' => '',
757
+ 'errormsg' => __('Category Settings', 'wp-realtime-sitemap') . ' > ' . __('Order By', 'wp-realtime-sitemap') . ': ' . __('The option choosen is not valid, please try again.', 'wp-realtime-sitemap'),
758
+ ),
759
+ 'category_order' => array(
760
+ 'valid' => array_keys($this->_formValidDefaults(array('dbfield' => 'category_order'))),
761
+ 'default' => '',
762
+ 'errormsg' => __('Category Settings', 'wp-realtime-sitemap') . ' > ' . __('Order', 'wp-realtime-sitemap') . ': ' . __('The option choosen is not valid, please try again.', 'wp-realtime-sitemap'),
763
+ ),
764
+ 'category_show_post_count' => array(
765
+ 'valid' => array_keys($this->_formValidDefaults(array('dbfield' => 'category_show_post_count'))),
766
+ 'default' => '',
767
+ 'errormsg' => __('Category Settings', 'wp-realtime-sitemap') . ' > ' . __('Post Count', 'wp-realtime-sitemap') . ': ' . __('The option choosen is not valid, please try again.', 'wp-realtime-sitemap'),
768
+ ),
769
+ 'category_hide_empty' => array(
770
+ 'valid' => array_keys($this->_formValidDefaults(array('dbfield' => 'category_hide_empty'))),
771
+ 'default' => '',
772
+ 'errormsg' => __('Category Settings', 'wp-realtime-sitemap') . ' > ' . __('Hide Empty', 'wp-realtime-sitemap') . ': ' . __('The option choosen is not valid, please try again.', 'wp-realtime-sitemap'),
773
+ ),
774
+ 'category_exclude' => array(
775
+ 'valid' => array(),
776
+ 'default' => '',
777
+ 'errormsg' => 'category_exclude',
778
+ ),
779
+ 'category_number' => array(
780
+ 'valid' => array_keys($this->_formValidDefaults(array('dbfield' => 'category_number'))),
781
+ 'default' => '',
782
+ 'errormsg' => __('Category Settings', 'wp-realtime-sitemap') . ' > ' . __('Limit', 'wp-realtime-sitemap') . ': ' . __('Only integers or -1 are accepted as valid inputs.', 'wp-realtime-sitemap'),
783
+ ),
784
+
785
+ // TAG SETTINGS
786
+ 'tags_tagcloud' => array(
787
+ 'valid' => array_keys($this->_formValidDefaults(array('dbfield' => 'tags_tagcloud'))),
788
+ 'default' => '',
789
+ 'errormsg' => 'tags_tagcloud',
790
+ ),
791
+ 'tags_orderby' => array(
792
+ 'valid' => array_keys($this->_formValidDefaults(array('dbfield' => 'tags_orderby'))),
793
+ 'default' => '',
794
+ 'errormsg' => __('Tag Settings', 'wp-realtime-sitemap') . ' > ' . __('Order By', 'wp-realtime-sitemap') . ': ' . __('The option choosen is not valid, please try again.', 'wp-realtime-sitemap'),
795
+ ),
796
+ 'tags_order' => array(
797
+ 'valid' => array_keys($this->_formValidDefaults(array('dbfield' => 'tags_order'))),
798
+ 'default' => '',
799
+ 'errormsg' => __('Tag Settings', 'wp-realtime-sitemap') . ' > ' . __('Order', 'wp-realtime-sitemap') . ': ' . __('The option choosen is not valid, please try again.', 'wp-realtime-sitemap'),
800
+ ),
801
+ 'tags_show_post_count' => array(
802
+ 'valid' => array_keys($this->_formValidDefaults(array('dbfield' => 'tags_show_post_count'))),
803
+ 'default' => '',
804
+ 'errormsg' => __('Tag Settings', 'wp-realtime-sitemap') . ' > ' . __('Post Count', 'wp-realtime-sitemap') . ': ' . __('The option choosen is not valid, please try again.', 'wp-realtime-sitemap'),
805
+ ),
806
+ 'tags_hide_empty' => array(
807
+ 'valid' => array_keys($this->_formValidDefaults(array('dbfield' => 'tags_hide_empty'))),
808
+ 'default' => '',
809
+ 'errormsg' => __('Tag Settings', 'wp-realtime-sitemap') . ' > ' . __('Order By', 'wp-realtime-sitemap') . ': ' . __('The option choosen is not valid, please try again.', 'wp-realtime-sitemap'),
810
+ ),
811
+ 'tags_number' => array(
812
+ 'valid' => array_keys($this->_formValidDefaults(array('dbfield' => 'tags_number'))),
813
+ 'default' => '',
814
+ 'errormsg' => __('Tag Settings', 'wp-realtime-sitemap') . ' > ' . __('Limit', 'wp-realtime-sitemap') . ': ' . __('Only integers or -1 are accepted as valid inputs.', 'wp-realtime-sitemap'),
815
+ ),
816
+
817
+ // HEADER SETTINGS
818
+
819
+
820
+ // DISPLAY SETTINGS
821
+ 'show_pages' => array(
822
+ 'valid' => array_keys($this->_formValidDefaults(array('dbfield' => 'show_pages'))),
823
+ 'default' => '',
824
+ 'errormsg' => __('Display Settings', 'wp-realtime-sitemap') . ' > ' . __('Show Pages', 'wp-realtime-sitemap') . ': ' . __('Only Yes/On or No/Off are accepted as valid inputs.', 'wp-realtime-sitemap'),
825
+ ),
826
+ 'show_posts' => array(
827
+ 'valid' => array_keys($this->_formValidDefaults(array('dbfield' => 'show_posts'))),
828
+ 'default' => '',
829
+ 'errormsg' => __('Display Settings', 'wp-realtime-sitemap') . ' > ' . __('Show Posts', 'wp-realtime-sitemap') . ': ' . __('Only Yes/On or No/Off are accepted as valid inputs.', 'wp-realtime-sitemap'),
830
+ ),
831
+ 'show_custom_post_types' => array(
832
+ 'valid' => array_keys($this->_formValidDefaults(array('dbfield' => 'show_custom_post_types'))),
833
+ 'default' => '',
834
+ 'errormsg' => __('Display Settings', 'wp-realtime-sitemap') . ' > ' . __('Show Custom Post Types', 'wp-realtime-sitemap') . ': ' . __('Only Yes/On or No/Off are accepted as valid inputs.', 'wp-realtime-sitemap'),
835
+ ),
836
+ 'show_archives' => array(
837
+ 'valid' => array_keys($this->_formValidDefaults(array('dbfield' => 'show_archives'))),
838
+ 'default' => '',
839
+ 'errormsg' => __('Display Settings', 'wp-realtime-sitemap') . ' > ' . __('Show Archives', 'wp-realtime-sitemap') . ': ' . __('Only Yes/On or No/Off are accepted as valid inputs.', 'wp-realtime-sitemap'),
840
+ ),
841
+ 'show_categories' => array(
842
+ 'valid' => array_keys($this->_formValidDefaults(array('dbfield' => 'show_categories'))),
843
+ 'default' => '',
844
+ 'errormsg' => __('Display Settings', 'wp-realtime-sitemap') . ' > ' . __('Show Categories', 'wp-realtime-sitemap') . ': ' . __('Only Yes/On or No/Off are accepted as valid inputs.', 'wp-realtime-sitemap'),
845
+ ),
846
+ 'show_tags' => array(
847
+ 'valid' => array_keys($this->_formValidDefaults(array('dbfield' => 'show_tags'))),
848
+ 'default' => '',
849
+ 'errormsg' => __('Display Settings', 'wp-realtime-sitemap') . ' > ' . __('Show Tags', 'wp-realtime-sitemap') . ': ' . __('Only Yes/On or No/Off are accepted as valid inputs.', 'wp-realtime-sitemap'),
850
+ ),
851
  );
852
 
853
+ // PAGE SETTINGS
854
+ if(!in_array($inputs['page_sort_column'], $validInputs['page_sort_column']['valid'])) {
855
+ $plugin_wp_realtime_sitemap_settings['page_sort_column'] = $validInputs['page_sort_column']['default'];
856
 
857
+ add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', $validInputs['page_sort_column']['errormsg']);
858
+ } else {
859
+ $plugin_wp_realtime_sitemap_settings['page_sort_column'] = $inputs['page_sort_column'];
 
860
  }
861
 
862
+ if(!in_array($inputs['page_sort_order'], $validInputs['page_sort_order']['valid'])) {
863
+ $plugin_wp_realtime_sitemap_settings['page_sort_order'] = $validInputs['page_sort_order']['default'];
864
 
865
+ add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', $validInputs['page_sort_order']['errormsg']);
866
+ } else {
867
+ $plugin_wp_realtime_sitemap_settings['page_sort_order'] = $inputs['page_sort_order'];
868
+ }
869
 
870
+ $plugin_wp_realtime_sitemap_settings['page_exclude'] = $inputs['page_exclude'];
 
 
871
 
872
+ if(!is_numeric($inputs['page_depth'])) {
873
+ $plugin_wp_realtime_sitemap_settings['page_depth'] = $validInputs['page_depth']['default'];
 
 
874
 
875
+ add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', $validInputs['page_depth']['errormsg']);
876
+ } else {
877
+ $plugin_wp_realtime_sitemap_settings['page_depth'] = $inputs['page_depth'];
878
+ }
879
 
880
+ if(!in_array($inputs['page_show_date'], $validInputs['page_show_date']['valid'])) {
881
+ $plugin_wp_realtime_sitemap_settings['page_show_date'] = $validInputs['page_show_date']['default'];
882
 
883
+ add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', $validInputs['page_show_date']['errormsg']);
884
+ } else {
885
+ $plugin_wp_realtime_sitemap_settings['page_show_date'] = $inputs['page_show_date'];
886
  }
887
 
888
+ /* if(!is_numeric($inputs['page_number']) && !empty($inputs['page_number'])) {
889
+ $plugin_wp_realtime_sitemap_settings['page_number'] = $validInputs['page_number']['default'];
890
 
891
+ add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', $validInputs['page_number']['errormsg']);
892
+ } else {
893
+ $plugin_wp_realtime_sitemap_settings['page_number'] = $inputs['page_number'];
894
+ } */
 
 
895
 
896
+ // POST SETTINGS
897
+ if(!in_array($inputs['post_order'], $validInputs['post_order']['valid'])) {
898
+ $plugin_wp_realtime_sitemap_settings['post_order'] = $validInputs['post_order']['default'];
 
899
 
900
+ add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', $validInputs['post_order']['errormsg']);
901
+ } else {
902
+ $plugin_wp_realtime_sitemap_settings['post_order'] = $inputs['post_order'];
903
+ }
904
 
905
+ if(!in_array($inputs['post_orderby'], $validInputs['post_orderby']['valid'])) {
906
+ $plugin_wp_realtime_sitemap_settings['post_orderby'] = $validInputs['post_orderby']['default'];
907
 
908
+ add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', $validInputs['post_orderby']['errormsg']);
909
+ } else {
910
+ $plugin_wp_realtime_sitemap_settings['post_orderby'] = $inputs['post_orderby'];
911
  }
912
 
913
+ $plugin_wp_realtime_sitemap_settings['post_exclude'] = $inputs['post_exclude'];
914
 
915
+ if(!in_array($inputs['post_show_date'], $validInputs['post_show_date']['valid'])) {
916
+ $plugin_wp_realtime_sitemap_settings['post_show_date'] = $validInputs['post_show_date']['default'];
917
 
918
+ add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', $validInputs['post_show_date']['errormsg']);
919
+ } else {
920
+ $plugin_wp_realtime_sitemap_settings['post_show_date'] = $inputs['post_show_date'];
921
+ }
922
 
923
+ if(!is_numeric($inputs['post_numberposts'])) {
924
+ $plugin_wp_realtime_sitemap_settings['post_numberposts'] = $validInputs['post_numberposts']['default'];
 
 
925
 
926
+ add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', $validInputs['post_numberposts']['errormsg']);
927
+ } else {
928
+ $plugin_wp_realtime_sitemap_settings['post_numberposts'] = $inputs['post_numberposts'];
929
+ }
930
 
931
+ // ARCHIVE SETTINGS
932
+ if(!in_array($inputs['archive_type'], $validInputs['archive_type']['valid'])) {
933
+ $plugin_wp_realtime_sitemap_settings['archive_type'] = $validInputs['archive_type']['default'];
934
 
935
+ add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', $validInputs['archive_type']['errormsg']);
936
+ } else {
937
+ $plugin_wp_realtime_sitemap_settings['archive_type'] = $inputs['archive_type'];
938
  }
939
 
940
+ if(!is_numeric($inputs['archive_limit']) && !empty($inputs['archive_limit'])) {
941
+ $plugin_wp_realtime_sitemap_settings['archive_limit'] = $validInputs['archive_limit']['default'];
942
 
943
+ add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', $validInputs['archive_limit']['errormsg']);
944
+ } else {
945
+ $plugin_wp_realtime_sitemap_settings['archive_limit'] = $inputs['archive_limit'];
946
+ }
 
 
947
 
948
+ if(!in_array($inputs['archive_show_post_count'], $validInputs['archive_show_post_count']['valid'])) {
949
+ $plugin_wp_realtime_sitemap_settings['archiveshow_post_count'] = $validInputs['archive_show_post_count']['default'];
 
 
950
 
951
+ add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', $validInputs['archive_show_post_count']['errormsg']);
952
+ } else {
953
+ $plugin_wp_realtime_sitemap_settings['archive_show_post_count'] = $inputs['archive_show_post_count'];
954
+ }
955
 
956
+ // CATEGORY SETTINGS
957
+ if(!in_array($inputs['category_tagcloud'], $validInputs['category_tagcloud']['valid'])) {
958
+ $plugin_wp_realtime_sitemap_settings['category_tagcloud'] = $validInputs['category_tagcloud']['default'];
959
 
960
+ add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', $validInputs['category_tagcloud']['errormsg']);
961
+ } else {
962
+ $plugin_wp_realtime_sitemap_settings['category_tagcloud'] = $inputs['category_tagcloud'];
963
  }
964
 
965
+ if(!in_array($inputs['category_orderby'], $validInputs['category_orderby']['valid'])) {
966
+ $plugin_wp_realtime_sitemap_settings['category_orderby'] = $validInputs['category_orderby']['default'];
967
 
968
+ add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', $validInputs['category_orderby']['errormsg']);
969
+ } else {
970
+ $plugin_wp_realtime_sitemap_settings['category_orderby'] = $inputs['category_orderby'];
971
+ }
 
 
972
 
973
+ if(!in_array($inputs['category_order'], $validInputs['category_order']['valid'])) {
974
+ $plugin_wp_realtime_sitemap_settings['category_order'] = $validInputs['category_order']['default'];
 
 
975
 
976
+ add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', $validInputs['category_order']['errormsg']);
977
+ } else {
978
+ $plugin_wp_realtime_sitemap_settings['category_order'] = $inputs['category_order'];
979
+ }
980
 
981
+ if(!in_array($inputs['category_show_post_count'], $validInputs['category_show_post_count']['valid'])) {
982
+ $plugin_wp_realtime_sitemap_settings['category_show_post_count'] = $validInputs['category_show_post_count']['default'];
983
 
984
+ add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', $validInputs['category_show_post_count']['errormsg']);
985
+ } else {
986
+ $plugin_wp_realtime_sitemap_settings['category_show_post_count'] = $inputs['category_show_post_count'];
987
  }
988
 
989
+ if(!in_array($inputs['category_hide_empty'], $validInputs['category_hide_empty']['valid'])) {
990
+ $plugin_wp_realtime_sitemap_settings['category_hide_empty'] = $validInputs['category_hide_empty']['default'];
 
 
991
 
992
+ add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', $validInputs['category_hide_empty']['errormsg']);
993
+ } else {
994
+ $plugin_wp_realtime_sitemap_settings['category_hide_empty'] = $inputs['category_hide_empty'];
995
+ }
996
 
997
+ $plugin_wp_realtime_sitemap_settings['category_exclude'] = $inputs['category_exclude'];
 
 
 
 
 
 
 
 
 
 
 
 
 
998
 
999
+ if(!is_numeric($inputs['category_depth'])) {
1000
+ $plugin_wp_realtime_sitemap_settings['category_depth'] = $validInputs['category_depth']['default'];
1001
 
1002
+ add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', $validInputs['category_depth']['errormsg']);
1003
  } else {
1004
+ $plugin_wp_realtime_sitemap_settings['category_depth'] = $inputs['category_depth'];
1005
  }
1006
 
1007
+ if(!is_numeric($inputs['category_number'])) {
1008
+ $plugin_wp_realtime_sitemap_settings['category_number'] = $validInputs['category_number']['default'];
1009
 
1010
+ add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', $validInputs['category_number']['errormsg']);
1011
  } else {
1012
+ $plugin_wp_realtime_sitemap_settings['category_number'] = $inputs['category_number'];
1013
  }
1014
 
1015
+ // TAG SETTINGS
1016
+ if(!in_array($inputs['tags_tagcloud'], $validInputs['tags_tagcloud']['valid'])) {
1017
+ $plugin_wp_realtime_sitemap_settings['tags_tagcloud'] = $validInputs['tags_tagcloud']['default'];
1018
 
1019
+ add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', $validInputs['tags_tagcloud']['errormsg']);
1020
  } else {
1021
+ $plugin_wp_realtime_sitemap_settings['tags_tagcloud'] = $inputs['tags_tagcloud'];
1022
  }
1023
 
1024
+ if(!in_array($inputs['tags_orderby'], $validInputs['tags_orderby']['valid'])) {
1025
+ $plugin_wp_realtime_sitemap_settings['tags_orderby'] = $validInputs['tags_orderby']['default'];
1026
 
1027
+ add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', $validInputs['tags_orderby']['errormsg']);
1028
  } else {
1029
+ $plugin_wp_realtime_sitemap_settings['tags_orderby'] = $inputs['tags_orderby'];
1030
  }
1031
 
1032
+ if(!in_array($inputs['tags_order'], $validInputs['tags_order']['valid'])) {
1033
+ $plugin_wp_realtime_sitemap_settings['tags_order'] = $validInputs['tags_order']['default'];
1034
 
1035
+ add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', $validInputs['tags_order']['errormsg']);
1036
  } else {
1037
+ $plugin_wp_realtime_sitemap_settings['tags_order'] = $inputs['tags_order'];
1038
  }
1039
 
1040
+ if(!in_array($inputs['tags_show_post_count'], $validInputs['tags_show_post_count']['valid'])) {
1041
+ $plugin_wp_realtime_sitemap_settings['tags_show_post_count'] = $validInputs['tags_show_post_count']['default'];
1042
 
1043
+ add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', $validInputs['tags_show_post_count']['errormsg']);
1044
  } else {
1045
+ $plugin_wp_realtime_sitemap_settings['tags_show_post_count'] = $inputs['tags_show_post_count'];
1046
  }
1047
 
1048
+ if(!in_array($inputs['tags_hide_empty'], $validInputs['tags_hide_empty']['valid'])) {
1049
+ $plugin_wp_realtime_sitemap_settings['tags_hide_empty'] = $validInputs['tags_hide_empty']['default'];
1050
 
1051
+ add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', $validInputs['tags_hide_empty']['errormsg']);
1052
  } else {
1053
+ $plugin_wp_realtime_sitemap_settings['tags_hide_empty'] = $inputs['tags_hide_empty'];
1054
  }
1055
 
1056
+ $plugin_wp_realtime_sitemap_settings['tags_exclude'] = $inputs['tags_exclude'];
1057
+
1058
+ if(!is_numeric($inputs['tags_number'])) {
1059
+ $plugin_wp_realtime_sitemap_settings['tags_number'] = $validInputs['tags_number']['default'];
1060
 
1061
+ add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', $validInputs['tags_number']['errormsg']);
1062
  } else {
1063
+ $plugin_wp_realtime_sitemap_settings['tags_number'] = $inputs['tags_number'];
1064
  }
1065
 
1066
+ // HEADER SETTINGS
1067
+ $plugin_wp_realtime_sitemap_settings['pages_header'] = mysql_real_escape_string($inputs['pages_header']);
1068
+ $plugin_wp_realtime_sitemap_settings['posts_header'] = mysql_real_escape_string($inputs['posts_header']);
1069
+ $plugin_wp_realtime_sitemap_settings['archives_header'] = mysql_real_escape_string($inputs['archives_header']);
1070
+ $plugin_wp_realtime_sitemap_settings['categories_header'] = mysql_real_escape_string($inputs['categories_header']);
1071
+ $plugin_wp_realtime_sitemap_settings['tags_header'] = mysql_real_escape_string($inputs['tags_header']);
1072
 
1073
+ // DISPLAY SETTINGS
1074
+ if(!in_array($inputs['show_pages'], $validInputs['show_pages']['valid'])) {
1075
+ $plugin_wp_realtime_sitemap_settings['show_pages'] = $validInputs['show_pages']['default'];
1076
+
1077
+ add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', $validInputs['show_pages']['errormsg']);
1078
  } else {
1079
+ $plugin_wp_realtime_sitemap_settings['show_pages'] = $inputs['show_pages'];
1080
  }
1081
 
1082
+ if(!in_array($inputs['show_posts'], $validInputs['show_posts']['valid'])) {
1083
+ $plugin_wp_realtime_sitemap_settings['show_posts'] = $validInputs['show_posts']['default'];
1084
 
1085
+ add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', $validInputs['show_posts']['errormsg']);
1086
  } else {
1087
+ $plugin_wp_realtime_sitemap_settings['show_posts'] = $inputs['show_posts'];
1088
  }
1089
 
1090
+ if(!in_array($inputs['show_custom_post_types'], $validInputs['show_custom_post_types']['valid'])) {
1091
+ $plugin_wp_realtime_sitemap_settings['show_custom_post_types'] = $validInputs['show_custom_post_types']['default'];
1092
 
1093
+ add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', $validInputs['show_custom_post_types']['errormsg']);
1094
  } else {
1095
+ $plugin_wp_realtime_sitemap_settings['show_custom_post_types'] = $inputs['show_custom_post_types'];
1096
  }
1097
 
1098
+ if(!in_array($inputs['show_archives'], $validInputs['show_archives']['valid'])) {
1099
+ $plugin_wp_realtime_sitemap_settings['show_archives'] = $validInputs['show_archives']['default'];
1100
 
1101
+ add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', $validInputs['show_archives']['errormsg']);
1102
  } else {
1103
+ $plugin_wp_realtime_sitemap_settings['show_archives'] = $inputs['show_archives'];
1104
  }
1105
 
1106
+ if(!in_array($inputs['show_categories'], $validInputs['show_categories']['valid'])) {
1107
+ $plugin_wp_realtime_sitemap_settings['show_categories'] = $validInputs['show_categories']['default'];
1108
 
1109
+ add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', $validInputs['show_categories']['errormsg']);
1110
  } else {
1111
+ $plugin_wp_realtime_sitemap_settings['show_categories'] = $inputs['show_categories'];
1112
  }
1113
 
1114
+ if(!in_array($inputs['show_tags'], $validInputs['show_tags']['valid'])) {
1115
+ $plugin_wp_realtime_sitemap_settings['show_tags'] = $validInputs['show_tags']['default'];
1116
+
1117
+ add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', $validInputs['show_tags']['errormsg']);
1118
+ } else {
1119
+ $plugin_wp_realtime_sitemap_settings['show_tags'] = $inputs['show_tags'];
1120
+ }
1121
 
1122
  return $plugin_wp_realtime_sitemap_settings;
1123
  }
1128
  wp_die( __('You do not have sufficient permissions to access this page.', 'wp-realtime-sitemap') );
1129
  }
1130
 
 
 
1131
  $post_types = get_post_types(array('public' => true, '_builtin' => false), 'objects');
1132
  ?>
1133
  <div class="wrap">
1145
  <area border="1" shape="rect" coords="113,0,221,54" href="http://www.daniel-tweedy.co.uk/redir/wordpress-plugins-amazon-wishlist/" alt="Amazon WishList" />
1146
  <area border="1" shape="rect" coords="226,0,334,54" href="http://www.daniel-tweedy.co.uk/redir/wordpress-plugins-twitter/" alt="Twitter" />
1147
  </map>
1148
+ <img border="1" src="<?php echo $this->plugin_base_url; ?>/images/donate.jpg" usemap="#donatemap" />
1149
  </div>
1150
 
1151
  <div style="width:450px; border:1px solid #dddddd; background:#fff; padding:20px 20px; float: left; margin-left: 20px;">
1190
  // Only perform plugin functionality if post/page text has the shortcode in the page.
1191
  if (preg_match('|wp-realtime-sitemap|', $code)) {
1192
  // Get option values from the database.
1193
+ $all_options = get_option('plugin_wp_realtime_sitemap_settings');
1194
+ extract($all_options);
1195
 
1196
+ extract(shortcode_atts(array('show' => 'all'), $atts));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1197
 
1198
  // Pages: Yes/No?
1199
+ if (($all_options['show_pages'] != 'No' && $all_options['show_pages'] != 'Off') && ($show == 'pages' || $show == 'all')) {
1200
  $pages_header = (empty($pages_header)) ? __('Pages') : $pages_header;
1201
 
1202
  $pages = '<div id="wp-realtime-sitemap-pages"><h3>' . $pages_header . '</h3>';
1203
+ $pages .= '<ul>' . wp_list_pages(array('sort_column' => $page_sort_column, 'sort_order' => $page_sort_order, 'exclude' => $page_exclude, 'depth' => $page_depth, 'show_date' => $page_show_date, 'title_li' => '', 'echo' => '0')) . '</ul></div>';
1204
  }
1205
 
1206
  // Posts: Yes/No?
1207
+ if (($all_options['show_posts'] != 'No' && $all_options['show_posts'] != 'Off') && ($show == 'posts' || $show == 'all')) {
1208
  $posts = '';
1209
 
1210
  // Set options for post query
1211
  $theposts = get_posts(array(
1212
+ 'numberposts' => $post_numberposts,
1213
+ 'orderby' => $post_orderby,
1214
+ 'order' => $post_order,
1215
+ 'exclude' => $post_exclude,
1216
  'post_type' => 'post',
1217
  ));
1218
 
1222
 
1223
  $extra = '';
1224
 
1225
+ if ($post_show_date == 'Yes')
1226
  $extra = ' <span>' . get_the_date() . '</span>';
1227
 
1228
  $posts .= '<li><a href="' . get_permalink() . '" title="' . sprintf(esc_attr__('Permalink to %s'), the_title_attribute('echo=0')) . '" rel="bookmark">' . get_the_title() . '</a>' . $extra . '</li>';
1235
  }
1236
 
1237
  // Custom Post Types: Yes/No?
1238
+ if (($all_options['show_custom_post_types'] != 'No' && $all_options['show_custom_post_types'] != 'Off') && ($show == 'customposts' || $show == 'all')) {
1239
  $custom_post_types = array();
1240
 
1241
  $post_types = get_post_types(array('public' => true, '_builtin' => false), 'objects');
1245
 
1246
  // Set options for post query
1247
  $theposts = get_posts(array(
1248
+ 'numberposts' => $post_numberposts,
1249
+ 'orderby' => $post_orderby,
1250
+ 'order' => $post_order,
1251
+ 'exclude' => $post_exclude,
1252
  'post_type' => $post_type->name,
1253
  ));
1254
 
1258
 
1259
  $extra = '';
1260
 
1261
+ if ($post_show_date == 'Yes')
1262
  $extra = ' <span>' . get_the_date() . '</span>';
1263
 
1264
  $custom_post_type_posts .= '<li><a href="' . get_permalink() . '" title="' . sprintf(esc_attr__('Permalink to %s'), the_title_attribute('echo=0')) . '" rel="bookmark">' . get_the_title() . '</a>' . $extra . '</li>';
1272
  }
1273
 
1274
  // Archives: Yes/No?
1275
+ if (($all_options['show_archives'] != 'No' && $all_options['show_archives'] != 'Off') && ($show == 'archives' || $show == 'all')) {
1276
  $archives_header = (empty($archives_header)) ? __('Archives') : $archives_header;
1277
 
1278
  $archives = '<div id="wp-realtime-sitemap-archives"><h3>' . $archives_header . '</h3>';
1279
+ $archives .= '<ul>' . wp_get_archives(array('type' => $archive_type, 'limit' => $archive_limit, 'show_post_count' => $archive_show_post_count, 'echo' => 0)) . '</ul></div>';
1280
  }
1281
 
1282
  // Categories: Yes/No?
1283
+ if (($all_options['show_categories'] != 'No' && $all_options['show_categories'] != 'Off') && ($show == 'categories' || $show == 'all')) {
1284
  $categories_header = (empty($categories_header)) ? __('Categories') : $categories_header;
1285
 
1286
  $categories = '<div id="wp-realtime-sitemap-categories"><h3>' . $categories_header . '</h3>';
1287
 
1288
  // Tag Cloud: Yes/No?
1289
+ if ($all_options['category_tagcloud'] != 'No' && $all_options['category_tagcloud'] != 'Off') {
1290
+ $categories .= '<p>' . wp_tag_cloud(array('number' => $category_number, 'format' => 'flat', 'orderby' => $category_orderby, 'order' => $category_order, 'taxonomy' => 'category', 'echo' => '0')) . '</p>';
1291
  } else {
1292
+ $categories .= '<ul>' . wp_list_categories(array('orderby' => $category_orderby, 'order' => $category_order, 'show_count' => $category_show_post_count, 'hide_empty' => $category_hide_empty, 'exclude' => $category_exclude, 'hierarchical' => '1', 'title_li' => '', 'number' => $category_number, 'echo' => '0', 'depth' => $category_depth, 'taxonomy' => 'category')) . '</ul>';
 
 
 
 
1293
  }
1294
 
1295
  $categories .= '</div>';
1296
  }
1297
 
1298
  // Tags: Yes/No?
1299
+ if (($all_options['show_tags'] != 'No' && $all_options['show_tags'] != 'Off') && ($show == 'tags' || $show == 'all')) {
1300
  $tags_header = (empty($tags_header)) ? __('Tags', 'wp-realtime-sitemap') : $tags_header;
1301
 
1302
  $tags = '<div id="wp-realtime-sitemap-tags"><h3>' . $tags_header . '</h3>';
1303
 
1304
  // Tag Cloud: Yes/No?
1305
+ if ($all_options['tags_tagcloud'] != 'No' && $all_options['tags_tagcloud'] != 'Off') {
1306
+ $tags .= '<p>' . wp_tag_cloud(array('number' => $tags_number, 'format' => 'flat', 'orderby' => $tags_orderby, 'order' => $tags_order, 'taxonomy' => 'category', 'echo' => '0')) . '</p>';
1307
  } else {
1308
+ $tags .= '<ul>' . wp_list_categories(array('orderby' => $tags_orderby, 'order' => $tags_order, 'show_count' => $tags_show_post_count, 'hide_empty' => (boolean)$tags_hide_empty, 'exclude' => $tags_exclude, 'hierarchical' => '1', 'title_li' => '', 'number' => $tags_number, 'echo' => '0', 'taxonomy' => 'post_tag')) . '</ul>';
 
 
 
 
1309
  }
1310
 
1311
  $tags .= '</div>';
1352
  $options = get_option('plugin_wp_realtime_sitemap_settings');
1353
  // set the default settings, if we didn't upgrade
1354
  if (empty($options))
1355
+ $this->_defaultSettings();
1356
  }
1357
 
1358
  function _defaultSettings () {
1359
  $defaults = array(
1360
+ 'page_sort_column' => 'post_date',
1361
+ 'page_sort_order' => 'DESC',
1362
+ 'page_exclude' => '',
1363
+ 'page_depth' => '0',
1364
+ 'page_show_date' => '',
1365
+ // 'page_number' => '',
1366
+
1367
+ 'post_orderby' => 'post_date',
1368
+ 'post_order' => 'DESC',
1369
+ 'post_exclude' => '',
1370
+ 'post_show_date' => 'Yes',
1371
+ 'post_numberposts' => '-1',
1372
+
1373
+ 'archive_type' => 'monthly',
1374
+ 'archive_limit' => '',
1375
+ 'archive_show_post_count' => false,
1376
+
1377
+ 'category_tagcloud' => 'No',
1378
+ 'category_orderby' => 'name',
1379
+ 'category_order' => 'name',
1380
+ 'category_show_post_count' => false,
1381
+ 'category_hide_empty' => true,
1382
+ 'category_exclude' => '',
1383
+ 'category_number' => '0',
1384
+ 'category_depth' => '0',
1385
+
1386
+ 'tags_tagcloud' => 'No',
1387
+ 'tags_orderby' => 'name',
1388
+ 'tags_order' => 'name',
1389
+ 'tags_show_post_count' => false,
1390
+ 'tags_hide_empty' => true,
1391
+ 'tags_exclude' => '',
1392
+ 'tags_number' => '0',
1393
+
1394
  'pages_header' => '',
1395
  'posts_header' => '',
1396
  'archives_header' => '',
1397
  'categories_header' => '',
1398
  'tags_header' => '',
1399
+
1400
+ 'show_pages' => 'Yes',
1401
+ 'show_posts' => 'Yes',
1402
+ 'show_custom_post_types' => 'No',
1403
+ 'show_archives' => 'Yes',
1404
+ 'show_categories' => 'Yes',
1405
+ 'show_tags' => 'No',
1406
  );
1407
 
1408
  update_option('plugin_wp_realtime_sitemap_settings', $defaults);