WP Realtime Sitemap - Version 1.4

Version Description

  • Hot Fix: Removed comment replacement code in favour of shortcodes instead, this was needed to fix an issue on some blogs where php memory limit is set to 64MB.
  • Added options to choose to have post count and post date output with the sitemap.
  • Streamlined options in the database now instead of several rows for the options in the database, there is now only 1.
  • Added code to clean up database from the old way to the new way, preserving your current options also.
Download this release

Release Info

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

Code changes from version 1.3 to 1.4

Files changed (3) hide show
  1. readme.txt +62 -9
  2. uninstall.php +1 -20
  3. wp-realtime-sitemap.php +224 -775
readme.txt CHANGED
@@ -1,7 +1,7 @@
1
- === Plugin Name ===
2
  Contributors: rincewind
3
  Donate link: http://www.daniel-tweedy.co.uk/redir/wp-realtime-sitemap-donate
4
- Tags: seo, sitemap, navigation
5
  Requires at least: 3.0
6
  Tested up to: 3.0
7
  Stable tag: trunk
@@ -12,29 +12,69 @@ 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 hidden posts and pages.
16
  1. Can show/hide Posts, Pages, Archives, Categories and Tags.
17
  1. All of the above can be ordered in anyway order you want.
18
  1. Can optionally show categories and/or tags as a bullet list, or as a tag cloud.
19
- 1. Hierarchical list of pages.
20
- 1. Hierarchical list of categories.
21
  1. Supports I18n for translation.
 
22
  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.
23
 
 
 
 
 
24
  == Installation ==
25
 
 
 
 
26
  1. Upload the files to `/wp-content/plugins/wp-realtime-sitemap` directory.
27
  1. Activate the plugin through the 'Plugins' menu in WordPress.
 
 
 
 
 
 
 
 
 
 
 
28
  1. Create a page to be your sitemap.
29
- 1. Click the HTML tab in the WYSIWYG editor and paste into the page you created above or an already existing page the following comment `<!--wp-realtime-sitemap-->`.
 
 
 
 
 
 
 
 
 
 
30
 
31
- You can if you wish call it via php using `<?php echo wp_realtime_sitemap('<!--wp-realtime-sitemap-->'); ?>`.
 
 
 
 
 
 
 
 
 
 
 
 
 
32
 
33
  == Frequently Asked Questions ==
34
 
35
  = Do I need to add the &lt;!--wp-realtime-sitemap--&gt; to a Post or a Page? =
36
 
37
- You can add it to either. The text will be substituted with the sitemap links.
38
 
39
  = What should I call the page that I add the sitemap to? =
40
 
@@ -42,10 +82,20 @@ You can call it whatever you like. I would suggest you call it Site Map.
42
 
43
  = Is there a php code so I can add it to a php template file? =
44
 
45
- You can if do this put this php code in the php file you wish to have the sitemap shown on, `<?php echo wp_realtime_sitemap('<!--wp-realtime-sitemap-->'); ?>`.
 
 
 
 
46
 
47
  == Changelog ==
48
 
 
 
 
 
 
 
49
  = 1.3 =
50
  * Hierarchical list of categories.
51
  * Change code for tags to use wordpress inbuilt functions instead.
@@ -64,5 +114,8 @@ You can if do this put this php code in the php file you wish to have the sitema
64
 
65
  == Upgrade Notice ==
66
 
 
 
 
67
  = 1.1 =
68
  Before upgrading you MUST delete the old plugin from your wordpress installation, BEFORE installing the new version! I changed the name of some of the variables stored in the database.
1
+ === WP Realtime Sitemap ===
2
  Contributors: rincewind
3
  Donate link: http://www.daniel-tweedy.co.uk/redir/wp-realtime-sitemap-donate
4
+ Tags: seo, navigation, sitemap, sitemaps
5
  Requires at least: 3.0
6
  Tested up to: 3.0
7
  Stable tag: trunk
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, Pages, Archives, Categories and Tags.
16
  1. All of the above can be ordered in anyway order you want.
17
  1. Can optionally show categories and/or tags as a bullet list, or as a tag cloud.
18
+ 1. Hierarchical list of pages and categories.
 
19
  1. Supports I18n for translation.
20
+ 1. Supports use of the wordpress shortcode for including the sitemap in pages and posts.
21
  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.
22
 
23
+ I am open to ideas as to where to take the plugin next, if anyone has any ideas as to how to make it better then do please let me know and I will see what I can do to accomodate your requests.
24
+
25
+ Please rate this plugin and/or make a donation if you find it useful, thank you.
26
+
27
  == Installation ==
28
 
29
+ = Instructions for installing via download from wordpress.org =
30
+
31
+ 1. Download and extract the Plugin zip file.
32
  1. Upload the files to `/wp-content/plugins/wp-realtime-sitemap` directory.
33
  1. Activate the plugin through the 'Plugins' menu in WordPress.
34
+
35
+ = Instruction for installing from within your own blog =
36
+
37
+ 1. Go to the Plugins => Add New page.
38
+ 1. Enter 'WP Realtime Sitemap' (without quotes) in the textbox and click the 'Search Plugins' button.
39
+ 1. In the list of relevant plugins click the 'Install' link for 'WP Realtime Sitemap' on the right hand side of the page.
40
+ 1. Click the 'Install Now' button on the popup page.
41
+ 1. Click 'Activate Plugin' to finish installation.
42
+
43
+ = Once plugin has been activated please follow one of the install options below to show the sitemap on your blog =
44
+
45
  1. Create a page to be your sitemap.
46
+ 1. Click the HTML tab in the WYSIWYG editor and paste into the page you created above or an already existing page the following shortcode `[wp-realtime-sitemap show="all"]`.
47
+
48
+ = OR =
49
+
50
+ 1. Goto Appearance and click on Editor.
51
+ 1. v1.3: Now choose the php file you wish to add the sitemap to, and add the following code: `<?php echo wp_realtime_sitemap('<!--wp-realtime-sitemap-->'); ?>`.
52
+ 1. v1.3.1+: Now choose the php file you wish to add the sitemap to, and add the following code: `<?php wp_realtime_sitemap(array('show' => 'all'), '', 'wp-realtime-sitemap'); ?>`.
53
+
54
+ == Examples ==
55
+
56
+ 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.
57
 
58
+ Show posts: `[wp-realtime-sitemap show="posts"]`.
59
+
60
+ Show pages: `[wp-realtime-sitemap show="pages"]`.
61
+
62
+ Show archives: `[wp-realtime-sitemap show="archives"]`.
63
+
64
+ Show categories: `[wp-realtime-sitemap show="categories"]`.
65
+
66
+ Show tags: `[wp-realtime-sitemap show="tags"]`.
67
+
68
+ 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"]`.
69
+
70
+ `show_date` only applies to posts.
71
+ `show_count` only applies to archives, categories and tags.
72
 
73
  == Frequently Asked Questions ==
74
 
75
  = Do I need to add the &lt;!--wp-realtime-sitemap--&gt; to a Post or a Page? =
76
 
77
+ This method is no longer supported in anything passed v1.3, please use the shortcode instead.
78
 
79
  = What should I call the page that I add the sitemap to? =
80
 
82
 
83
  = Is there a php code so I can add it to a php template file? =
84
 
85
+ Upto v1.3 you can put this php code into a file that you wish to have the sitemap shown on: `<?php echo wp_realtime_sitemap('<!--wp-realtime-sitemap-->'); ?>`.
86
+
87
+ After v1.3 you can if do this put this php code in the php file you wish to have the sitemap shown on: `<?php echo wp_realtime_sitemap(array('show' => 'pages'), '', 'wp-realtime-sitemap'); ?>`.
88
+
89
+ Please see the installation page for information about the short code usage for more information on the show attribute.
90
 
91
  == Changelog ==
92
 
93
+ = 1.4 =
94
+ * Hot Fix: Removed comment replacement code in favour of shortcodes instead, this was needed to fix an issue on some blogs where php memory limit is set to 64MB.
95
+ * Added options to choose to have post count and post date output with the sitemap.
96
+ * Streamlined options in the database now instead of several rows for the options in the database, there is now only 1.
97
+ * Added code to clean up database from the old way to the new way, preserving your current options also.
98
+
99
  = 1.3 =
100
  * Hierarchical list of categories.
101
  * Change code for tags to use wordpress inbuilt functions instead.
114
 
115
  == Upgrade Notice ==
116
 
117
+ = 1.4 =
118
+ You will need to change the code you have in your pages/posts to show the sitemap, please see plugin page on wordpress.org for more info.
119
+
120
  = 1.1 =
121
  Before upgrading you MUST delete the old plugin from your wordpress installation, BEFORE installing the new version! I changed the name of some of the variables stored in the database.
uninstall.php CHANGED
@@ -3,25 +3,6 @@
3
  if (!defined('ABSPATH') && !defined('WP_UNINSTALL_PLUGIN'))
4
  exit();
5
 
6
- // v1.0
7
- delete_option('wp_realtime_sitemap_orderby');
8
- delete_option('wp_realtime_sitemap_private');
9
- delete_option('wp_realtime_sitemap_pages');
10
- delete_option('wp_realtime_sitemap_posts');
11
- delete_option('wp_realtime_sitemap_tags');
12
- delete_option('wp_realtime_sitemap_archives');
13
- delete_option('wp_realtime_sitemap_displayorder');
14
-
15
- // v1.1
16
- delete_option('wp_realtime_sitemap_orderby');
17
- delete_option('wp_realtime_sitemap_showprivate');
18
- delete_option('wp_realtime_sitemap_showpages');
19
- delete_option('wp_realtime_sitemap_showposts');
20
- delete_option('wp_realtime_sitemap_showarchives');
21
- delete_option('wp_realtime_sitemap_showcategories');
22
- delete_option('wp_realtime_sitemap_showcategoriesastc');
23
- delete_option('wp_realtime_sitemap_showtags');
24
- delete_option('wp_realtime_sitemap_showtagsastc');
25
- delete_option('wp_realtime_sitemap_displayorder');
26
 
27
  ?>
3
  if (!defined('ABSPATH') && !defined('WP_UNINSTALL_PLUGIN'))
4
  exit();
5
 
6
+ delete_option('plugin_wp_realtime_sitemap_settings');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
 
8
  ?>
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-->` to any page or post and the site map will be added there. Use Settings->WP Realtime Sitemap to set options.
7
- Version: 1.3
8
  Author: Daniel Tweedy
9
  Author URI: http://www.daniel-tweedy.co.uk/
10
  License: GPL2
@@ -33,263 +33,120 @@ function wprs_options_form() {
33
  wp_die( __('You do not have sufficient permissions to access this page.', 'wp-realtime-sitemap') );
34
  }
35
 
36
- $orderby = get_option('wp_realtime_sitemap_orderby');
37
- $showprivate = get_option('wp_realtime_sitemap_showprivate');
38
- $showpages = get_option('wp_realtime_sitemap_showpages');
39
- $showposts = get_option('wp_realtime_sitemap_showposts');
40
- $showarchives = get_option('wp_realtime_sitemap_showarchives');
41
- $showcategories = get_option('wp_realtime_sitemap_showcategories');
42
- $showcategoriesastc = get_option('wp_realtime_sitemap_showcategoriesastc');
43
- $showtags = get_option('wp_realtime_sitemap_showtags');
44
- $showtagsastc = get_option('wp_realtime_sitemap_showtagsastc');
45
- $displayorder = get_option('wp_realtime_sitemap_displayorder');
46
-
47
- // Add options if first time running
48
- add_option('wp_realtime_sitemap_orderby', 'datedesc', 'WP Realtime Sitemap Plugin');
49
- add_option('wp_realtime_sitemap_showprivate', 'no', 'WP Realtime Sitemap Plugin');
50
- add_option('wp_realtime_sitemap_showpages', 'yes', 'WP Realtime Sitemap Plugin');
51
- add_option('wp_realtime_sitemap_showposts', 'yes', 'WP Realtime Sitemap Plugin');
52
- add_option('wp_realtime_sitemap_showarchives', 'yes', 'WP Realtime Sitemap Plugin');
53
- add_option('wp_realtime_sitemap_showcategories', 'yes', 'WP Realtime Sitemap Plugin');
54
- add_option('wp_realtime_sitemap_showcategoriesastc', 'no', 'WP Realtime Sitemap Plugin');
55
- add_option('wp_realtime_sitemap_showtags', 'yes', 'WP Realtime Sitemap Plugin');
56
- add_option('wp_realtime_sitemap_showtagsastc', 'no', 'WP Realtime Sitemap Plugin');
57
- add_option('wp_realtime_sitemap_displayorder', '1', 'WP Realtime Sitemap Plugin');
58
-
59
- // Get posted options
60
- $orderby = $_POST['orderby'];
61
-
62
  if (isset($_POST['info_update'])) {
63
- // Update settings
64
- $orderby = $_POST['orderby'];
65
- $showprivate = $_POST['showprivate'];
66
- $showpages = $_POST['showpages'];
67
- $showposts = $_POST['showposts'];
68
- $showarchives = $_POST['showarchives'];
69
- $showcategories = $_POST['showcategories'];
70
- $showcategoriesastc = $_POST['showcategoriesastc'];
71
- $showtags = $_POST['showtags'];
72
- $showtagsastc = $_POST['showtagsastc'];
73
- $displayorder = $_POST['displayorder'];
74
-
75
- update_option('wp_realtime_sitemap_orderby', $orderby);
76
- update_option('wp_realtime_sitemap_showprivate', $showprivate);
77
- update_option('wp_realtime_sitemap_showpages', $showpages);
78
- update_option('wp_realtime_sitemap_showposts', $showposts);
79
- update_option('wp_realtime_sitemap_showarchives', $showarchives);
80
- update_option('wp_realtime_sitemap_showcategories', $showcategories);
81
- update_option('wp_realtime_sitemap_showcategoriesastc', $showcategoriesastc);
82
- update_option('wp_realtime_sitemap_showtags', $showtags);
83
- update_option('wp_realtime_sitemap_showtagsastc', $showtagsastc);
84
- update_option('wp_realtime_sitemap_displayorder', $displayorder);
85
  } else {
86
- // Load settings from database
87
- $orderby = get_option('wp_realtime_sitemap_orderby');
88
- $showprivate = get_option('wp_realtime_sitemap_showprivate');
89
- $showpages = get_option('wp_realtime_sitemap_showpages');
90
- $showposts = get_option('wp_realtime_sitemap_showposts');
91
- $showarchives = get_option('wp_realtime_sitemap_showarchives');
92
- $showcategories = get_option('wp_realtime_sitemap_showcategories');
93
- $showcategoriesastc = get_option('wp_realtime_sitemap_showcategoriesastc');
94
- $showtags = get_option('wp_realtime_sitemap_showtags');
95
- $showtagsastc = get_option('wp_realtime_sitemap_showtagsastc');
96
- $displayorder = get_option('wp_realtime_sitemap_displayorder');
97
  }
98
-
99
  ?>
100
  <div class="wrap">
101
- <h2>WP Realtime Sitemap Options</h2>
102
 
103
  <form method="post">
 
104
  <table class="form-table">
105
  <tr valign="top">
106
- <th scope="row"><label for="orderby">Order Sitemap Pages/Posts By</label></th>
107
- <td><select name="orderby">
108
- <option <?php selected('datedesc', $orderby); ?> value="datedesc">Date descending (Default)</option>
109
- <option <?php selected('dateasc', $orderby); ?> value="dateasc">Date ascending</option>
110
- <option <?php selected('alphadesc', $orderby); ?> value="alphadesc">Alphabetical descending</option>
111
- <option <?php selected('alphaasc', $orderby); ?> value="alphaasc">Alphabetical ascending</option>
 
 
 
 
 
 
 
 
 
 
112
  </select></td>
113
  </tr>
114
  <tr valign="top">
115
- <th scope="row"><label for="showprivate">Show Private Pages/Posts</label></th>
116
- <td><select name="showprivate">
117
- <option value="no" <?php selected('no', $showprivate); ?>>No, leave hidden (Default)</option>
118
- <option value="yes" <?php selected('yes', $showprivate); ?>>Yes, show hidden</option>
119
  </select></td>
120
  </tr>
121
  <tr valign="top">
122
- <th scope="row"><label for="showpages">Show Pages</label></th>
123
- <td><select name="showpages">
124
- <option value="yes" <?php selected('yes', $showpages); ?>>Yes (Default)</option>
125
- <option value="no" <?php selected('no', $showpages); ?>>No</option>
126
  </select></td>
127
  </tr>
128
  <tr valign="top">
129
- <th scope="row"><label for="showposts">Show Posts</label></th>
130
- <td><select name="showposts">
131
- <option value="yes" <?php selected('yes', $showposts); ?>>Yes (Default)</option>
132
- <option value="no" <?php selected('no', $showposts); ?>>No</option>
133
  </select></td>
134
  </tr>
135
  <tr valign="top">
136
- <th scope="row"><label for="showarchives">Show Archives</label></th>
137
- <td><select name="showarchives">
138
- <option value="yes" <?php selected('yes', $showarchives); ?>>Yes (Default)</option>
139
- <option value="no" <?php selected('no', $showarchives); ?>>No</option>
140
  </select></td>
141
  </tr>
142
  <tr valign="top">
143
- <th scope="row"><label for="showcategories">Show Categories</label></th>
144
- <td><select name="showcategories">
145
- <option value="yes" <?php selected('yes', $showcategories); ?>>Yes (Default)</option>
146
- <option value="no" <?php selected('no', $showcategories); ?>>No</option>
147
  </select></td>
148
  </tr>
149
  <tr valign="top">
150
- <th scope="row"><label for="showcategoriesastc">Show Categories As Tag Cloud</label></th>
151
- <td><select name="showcategoriesastc">
152
- <option value="yes" <?php selected('yes', $showcategoriesastc); ?>>Yes</option>
153
- <option value="no" <?php selected('no', $showcategoriesastc); ?>>No (Default)</option>
154
  </select></td>
155
  </tr>
156
  <tr valign="top">
157
- <th scope="row"><label for="showtags">Show Tags</label></th>
158
- <td><select name="showtags">
159
- <option value="yes" <?php selected('yes', $showtags); ?>>Yes (Default)</option>
160
- <option value="no" <?php selected('no', $showtags); ?>>No</option>
161
  </select></td>
162
  </tr>
163
  <tr valign="top">
164
- <th scope="row"><label for="showtagsastc">Show Tags As Tag Cloud</label></th>
165
- <td><select name="showtagsastc">
166
- <option value="yes" <?php selected('yes', $showtagsastc); ?>>Yes</option>
167
- <option value="no" <?php selected('no', $showtagsastc); ?>>No (Default)</option>
168
  </select></td>
169
  </tr>
170
- <tr>
171
- <th scope="row">Display Order</th>
172
- <td><select name="displayorder">
173
- <option <?php selected('1', $displayorder); ?> value='1' /> 1: Pages, Posts, Archives, Categories, Tags</option>
174
- <option <?php selected('2', $displayorder); ?> value='2' /> 2: Pages, Posts, Archives, Tags, Categories</option>
175
- <option <?php selected('3', $displayorder); ?> value='3' /> 3: Pages, Posts, Categories, Archives, Tags</option>
176
- <option <?php selected('4', $displayorder); ?> value='4' /> 4: Pages, Posts, Categories, Tags, Archives</option>
177
- <option <?php selected('5', $displayorder); ?> value='5' /> 5: Pages, Posts, Tags, Archives, Categories</option>
178
- <option <?php selected('6', $displayorder); ?> value='6' /> 6: Pages, Posts, Tags, Categories, Archives</option>
179
- <option <?php selected('7', $displayorder); ?> value='7' /> 7: Pages, Archives, Posts, Categories, Tags</option>
180
- <option <?php selected('8', $displayorder); ?> value='8' /> 8: Pages, Archives, Posts, Tags, Categories</option>
181
- <option <?php selected('9', $displayorder); ?> value='9' /> 9: Pages, Archives, Categories, Posts, Tags</option>
182
- <option <?php selected('10', $displayorder); ?> value='10' /> 10: Pages, Archives, Categories, Tags, Posts</option>
183
- <option <?php selected('11', $displayorder); ?> value='11' /> 11: Pages, Archives, Tags, Posts, Categories</option>
184
- <option <?php selected('12', $displayorder); ?> value='12' /> 12: Pages, Archives, Tags, Categories, Posts</option>
185
- <option <?php selected('13', $displayorder); ?> value='13' /> 13: Pages, Categories, Posts, Archives, Tags</option>
186
- <option <?php selected('14', $displayorder); ?> value='14' /> 14: Pages, Categories, Posts, Tags, Archives</option>
187
- <option <?php selected('15', $displayorder); ?> value='15' /> 15: Pages, Categories, Archives, Posts, Tags</option>
188
- <option <?php selected('16', $displayorder); ?> value='16' /> 16: Pages, Categories, Archives, Tags, Posts</option>
189
- <option <?php selected('17', $displayorder); ?> value='17' /> 17: Pages, Categories, Tags, Posts, Archives</option>
190
- <option <?php selected('18', $displayorder); ?> value='18' /> 18: Pages, Categories, Tags, Archives, Posts</option>
191
- <option <?php selected('19', $displayorder); ?> value='19' /> 19: Pages, Tags, Posts, Archives, Categories</option>
192
- <option <?php selected('20', $displayorder); ?> value='20' /> 20: Pages, Tags, Posts, Categories, Archives</option>
193
- <option <?php selected('21', $displayorder); ?> value='21' /> 21: Pages, Tags, Archives, Posts, Categories</option>
194
- <option <?php selected('22', $displayorder); ?> value='22' /> 22: Pages, Tags, Archives, Categories, Posts</option>
195
- <option <?php selected('23', $displayorder); ?> value='23' /> 23: Pages, Tags, Categories, Posts, Archives</option>
196
- <option <?php selected('24', $displayorder); ?> value='24' /> 24: Pages, Tags, Categories, Archives, Posts</option>
197
- <option <?php selected('25', $displayorder); ?> value='25' /> 25: Posts, Pages, Archives, Categories, Tags</option>
198
- <option <?php selected('26', $displayorder); ?> value='26' /> 26: Posts, Pages, Archives, Tags, Categories</option>
199
- <option <?php selected('27', $displayorder); ?> value='27' /> 27: Posts, Pages, Categories, Archives, Tags</option>
200
- <option <?php selected('28', $displayorder); ?> value='28' /> 28: Posts, Pages, Categories, Tags, Archives</option>
201
- <option <?php selected('29', $displayorder); ?> value='29' /> 29: Posts, Pages, Tags, Archives, Categories</option>
202
- <option <?php selected('30', $displayorder); ?> value='30' /> 30: Posts, Pages, Tags, Categories, Archives</option>
203
- <option <?php selected('31', $displayorder); ?> value='31' /> 31: Posts, Archives, Pages, Categories, Tags</option>
204
- <option <?php selected('32', $displayorder); ?> value='32' /> 32: Posts, Archives, Pages, Tags, Categories</option>
205
- <option <?php selected('33', $displayorder); ?> value='33' /> 33: Posts, Archives, Categories, Pages, Tags</option>
206
- <option <?php selected('34', $displayorder); ?> value='34' /> 34: Posts, Archives, Categories, Tags, Pages</option>
207
- <option <?php selected('35', $displayorder); ?> value='35' /> 35: Posts, Archives, Tags, Pages, Categories</option>
208
- <option <?php selected('36', $displayorder); ?> value='36' /> 36: Posts, Archives, Tags, Categories, Pages</option>
209
- <option <?php selected('37', $displayorder); ?> value='37' /> 37: Posts, Categories, Pages, Archives, Tags</option>
210
- <option <?php selected('38', $displayorder); ?> value='38' /> 38: Posts, Categories, Pages, Tags, Archives</option>
211
- <option <?php selected('39', $displayorder); ?> value='39' /> 39: Posts, Categories, Archives, Pages, Tags</option>
212
- <option <?php selected('40', $displayorder); ?> value='40' /> 40: Posts, Categories, Archives, Tags, Pages</option>
213
- <option <?php selected('41', $displayorder); ?> value='41' /> 41: Posts, Categories, Tags, Pages, Archives</option>
214
- <option <?php selected('42', $displayorder); ?> value='42' /> 42: Posts, Categories, Tags, Archives, Pages</option>
215
- <option <?php selected('43', $displayorder); ?> value='43' /> 43: Posts, Tags, Pages, Archives, Categories</option>
216
- <option <?php selected('44', $displayorder); ?> value='44' /> 44: Posts, Tags, Pages, Categories, Archives</option>
217
- <option <?php selected('45', $displayorder); ?> value='45' /> 45: Posts, Tags, Archives, Pages, Categories</option>
218
- <option <?php selected('46', $displayorder); ?> value='46' /> 46: Posts, Tags, Archives, Categories, Pages</option>
219
- <option <?php selected('47', $displayorder); ?> value='47' /> 47: Posts, Tags, Categories, Pages, Archives</option>
220
- <option <?php selected('48', $displayorder); ?> value='48' /> 48: Posts, Tags, Categories, Archives, Pages</option>
221
- <option <?php selected('49', $displayorder); ?> value='49' /> 49: Archives, Pages, Posts, Categories, Tags</option>
222
- <option <?php selected('50', $displayorder); ?> value='50' /> 50: Archives, Pages, Posts, Tags, Categories</option>
223
- <option <?php selected('51', $displayorder); ?> value='51' /> 51: Archives, Pages, Categories, Posts, Tags</option>
224
- <option <?php selected('52', $displayorder); ?> value='52' /> 52: Archives, Pages, Categories, Tags, Posts</option>
225
- <option <?php selected('53', $displayorder); ?> value='53' /> 53: Archives, Pages, Tags, Posts, Categories</option>
226
- <option <?php selected('54', $displayorder); ?> value='54' /> 54: Archives, Pages, Tags, Categories, Posts</option>
227
- <option <?php selected('55', $displayorder); ?> value='55' /> 55: Archives, Posts, Pages, Categories, Tags</option>
228
- <option <?php selected('56', $displayorder); ?> value='56' /> 56: Archives, Posts, Pages, Tags, Categories</option>
229
- <option <?php selected('57', $displayorder); ?> value='57' /> 57: Archives, Posts, Categories, Pages, Tags</option>
230
- <option <?php selected('58', $displayorder); ?> value='58' /> 58: Archives, Posts, Categories, Tags, Pages</option>
231
- <option <?php selected('59', $displayorder); ?> value='59' /> 59: Archives, Posts, Tags, Pages, Categories</option>
232
- <option <?php selected('60', $displayorder); ?> value='60' /> 60: Archives, Posts, Tags, Categories, Pages</option>
233
- <option <?php selected('61', $displayorder); ?> value='61' /> 61: Archives, Categories, Pages, Posts, Tags</option>
234
- <option <?php selected('62', $displayorder); ?> value='62' /> 62: Archives, Categories, Pages, Tags, Posts</option>
235
- <option <?php selected('63', $displayorder); ?> value='63' /> 63: Archives, Categories, Posts, Pages, Tags</option>
236
- <option <?php selected('64', $displayorder); ?> value='64' /> 64: Archives, Categories, Posts, Tags, Pages</option>
237
- <option <?php selected('65', $displayorder); ?> value='65' /> 65: Archives, Categories, Tags, Pages, Posts</option>
238
- <option <?php selected('66', $displayorder); ?> value='66' /> 66: Archives, Categories, Tags, Posts, Pages</option>
239
- <option <?php selected('67', $displayorder); ?> value='67' /> 67: Archives, Tags, Pages, Posts, Categories</option>
240
- <option <?php selected('68', $displayorder); ?> value='68' /> 68: Archives, Tags, Pages, Categories, Posts</option>
241
- <option <?php selected('69', $displayorder); ?> value='69' /> 69: Archives, Tags, Posts, Pages, Categories</option>
242
- <option <?php selected('70', $displayorder); ?> value='70' /> 70: Archives, Tags, Posts, Categories, Pages</option>
243
- <option <?php selected('71', $displayorder); ?> value='71' /> 71: Archives, Tags, Categories, Pages, Posts</option>
244
- <option <?php selected('72', $displayorder); ?> value='72' /> 72: Archives, Tags, Categories, Posts, Pages</option>
245
- <option <?php selected('73', $displayorder); ?> value='73' /> 73: Categories, Pages, Posts, Archives, Tags</option>
246
- <option <?php selected('74', $displayorder); ?> value='74' /> 74: Categories, Pages, Posts, Tags, Archives</option>
247
- <option <?php selected('75', $displayorder); ?> value='75' /> 75: Categories, Pages, Archives, Posts, Tags</option>
248
- <option <?php selected('76', $displayorder); ?> value='76' /> 76: Categories, Pages, Archives, Tags, Posts</option>
249
- <option <?php selected('77', $displayorder); ?> value='77' /> 77: Categories, Pages, Tags, Posts, Archives</option>
250
- <option <?php selected('78', $displayorder); ?> value='78' /> 78: Categories, Pages, Tags, Archives, Posts</option>
251
- <option <?php selected('79', $displayorder); ?> value='79' /> 79: Categories, Posts, Pages, Archives, Tags</option>
252
- <option <?php selected('80', $displayorder); ?> value='80' /> 80: Categories, Posts, Pages, Tags, Archives</option>
253
- <option <?php selected('81', $displayorder); ?> value='81' /> 81: Categories, Posts, Archives, Pages, Tags</option>
254
- <option <?php selected('82', $displayorder); ?> value='82' /> 82: Categories, Posts, Archives, Tags, Pages</option>
255
- <option <?php selected('83', $displayorder); ?> value='83' /> 83: Categories, Posts, Tags, Pages, Archives</option>
256
- <option <?php selected('84', $displayorder); ?> value='84' /> 84: Categories, Posts, Tags, Archives, Pages</option>
257
- <option <?php selected('85', $displayorder); ?> value='85' /> 85: Categories, Archives, Pages, Posts, Tags</option>
258
- <option <?php selected('86', $displayorder); ?> value='86' /> 86: Categories, Archives, Pages, Tags, Posts</option>
259
- <option <?php selected('87', $displayorder); ?> value='87' /> 87: Categories, Archives, Posts, Pages, Tags</option>
260
- <option <?php selected('88', $displayorder); ?> value='88' /> 88: Categories, Archives, Posts, Tags, Pages</option>
261
- <option <?php selected('89', $displayorder); ?> value='89' /> 89: Categories, Archives, Tags, Pages, Posts</option>
262
- <option <?php selected('90', $displayorder); ?> value='90' /> 90: Categories, Archives, Tags, Posts, Pages</option>
263
- <option <?php selected('91', $displayorder); ?> value='91' /> 91: Categories, Tags, Pages, Posts, Archives</option>
264
- <option <?php selected('92', $displayorder); ?> value='92' /> 92: Categories, Tags, Pages, Archives, Posts</option>
265
- <option <?php selected('93', $displayorder); ?> value='93' /> 93: Categories, Tags, Posts, Pages, Archives</option>
266
- <option <?php selected('94', $displayorder); ?> value='94' /> 94: Categories, Tags, Posts, Archives, Pages</option>
267
- <option <?php selected('95', $displayorder); ?> value='95' /> 95: Categories, Tags, Archives, Pages, Posts</option>
268
- <option <?php selected('96', $displayorder); ?> value='96' /> 96: Categories, Tags, Archives, Posts, Pages</option>
269
- <option <?php selected('97', $displayorder); ?> value='97' /> 97: Tags, Pages, Posts, Archives, Categories</option>
270
- <option <?php selected('98', $displayorder); ?> value='98' /> 98: Tags, Pages, Posts, Categories, Archives</option>
271
- <option <?php selected('99', $displayorder); ?> value='99' /> 99: Tags, Pages, Archives, Posts, Categories</option>
272
- <option <?php selected('100', $displayorder); ?> value='100' /> 100: Tags, Pages, Archives, Categories, Posts</option>
273
- <option <?php selected('101', $displayorder); ?> value='101' /> 101: Tags, Pages, Categories, Posts, Archives</option>
274
- <option <?php selected('102', $displayorder); ?> value='102' /> 102: Tags, Pages, Categories, Archives, Posts</option>
275
- <option <?php selected('103', $displayorder); ?> value='103' /> 103: Tags, Posts, Pages, Archives, Categories</option>
276
- <option <?php selected('104', $displayorder); ?> value='104' /> 104: Tags, Posts, Pages, Categories, Archives</option>
277
- <option <?php selected('105', $displayorder); ?> value='105' /> 105: Tags, Posts, Archives, Pages, Categories</option>
278
- <option <?php selected('106', $displayorder); ?> value='106' /> 106: Tags, Posts, Archives, Categories, Pages</option>
279
- <option <?php selected('107', $displayorder); ?> value='107' /> 107: Tags, Posts, Categories, Pages, Archives</option>
280
- <option <?php selected('108', $displayorder); ?> value='108' /> 108: Tags, Posts, Categories, Archives, Pages</option>
281
- <option <?php selected('109', $displayorder); ?> value='109' /> 109: Tags, Archives, Pages, Posts, Categories</option>
282
- <option <?php selected('110', $displayorder); ?> value='110' /> 110: Tags, Archives, Pages, Categories, Posts</option>
283
- <option <?php selected('111', $displayorder); ?> value='111' /> 111: Tags, Archives, Posts, Pages, Categories</option>
284
- <option <?php selected('112', $displayorder); ?> value='112' /> 112: Tags, Archives, Posts, Categories, Pages</option>
285
- <option <?php selected('113', $displayorder); ?> value='113' /> 113: Tags, Archives, Categories, Pages, Posts</option>
286
- <option <?php selected('114', $displayorder); ?> value='114' /> 114: Tags, Archives, Categories, Posts, Pages</option>
287
- <option <?php selected('115', $displayorder); ?> value='115' /> 115: Tags, Categories, Pages, Posts, Archives</option>
288
- <option <?php selected('116', $displayorder); ?> value='116' /> 116: Tags, Categories, Pages, Archives, Posts</option>
289
- <option <?php selected('117', $displayorder); ?> value='117' /> 117: Tags, Categories, Posts, Pages, Archives</option>
290
- <option <?php selected('118', $displayorder); ?> value='118' /> 118: Tags, Categories, Posts, Archives, Pages</option>
291
- <option <?php selected('119', $displayorder); ?> value='119' /> 119: Tags, Categories, Archives, Pages, Posts</option>
292
- <option <?php selected('120', $displayorder); ?> value='120' /> 120: Tags, Categories, Archives, Posts, Pages</option>
293
  </select></td>
294
  </tr>
295
  </table>
@@ -299,603 +156,145 @@ function wprs_options_form() {
299
  </div>
300
  </form>
301
  </div><?php
302
- }
303
 
304
- function remove_style(&$item, $key) {
305
- $item = preg_replace('/ style=\'font-size: .*;\'/', '', $item);
306
- }
307
-
308
- // To replace the <!--wp-realtime-sitemap--> with the actual sitemap
309
- function wp_realtime_sitemap($text) {
310
  global $wpdb, $table_prefix;
311
 
312
- // Only perform plugin functionality if post/page text has <!--wp-realtime-sitemap-->|
313
- if (preg_match('|<!--wp-realtime-sitemap-->|', $text)) {
314
-
315
- // Get option values
316
- $orderby = get_option('wp_realtime_sitemap_orderby');
317
- $showprivate = get_option('wp_realtime_sitemap_showprivate');
318
- $showpages = get_option('wp_realtime_sitemap_showpages');
319
- $showposts = get_option('wp_realtime_sitemap_showposts');
320
- $showarchives = get_option('wp_realtime_sitemap_showarchives');
321
- $showcategories = get_option('wp_realtime_sitemap_showcategories');
322
- $showcategoriesastc = get_option('wp_realtime_sitemap_showcategoriesastc');
323
- $showtags = get_option('wp_realtime_sitemap_showtags');
324
- $showtagsastc = get_option('wp_realtime_sitemap_showtagsastc');
325
- $displayorder = get_option('wp_realtime_sitemap_displayorder');
326
-
327
- // Do order by
328
- switch ($orderby) {
329
- case 'datedesc':
330
- $sqlorder = 'ORDER BY `post_date` DESC';
331
- break;
332
- case 'dateasc':
333
- $sqlorder = 'ORDER BY `post_date`';
334
- break;
335
- case 'alphadesc':
336
- $sqlorder = 'ORDER BY `post_title` DESC';
337
- break;
338
- case 'alphaasc':
339
- $sqlorder = 'ORDER BY `post_title`';
340
- break;
341
- }
342
 
343
- // Pages: Yes/No?
344
- if ($showpages != 'no') {
345
- if ($orderby == 'datedesc' || $orderby == 'dateasc')
346
- $sort_column = 'post_date';
347
 
348
- if ($orderby == 'alphadesc' || $orderby == 'alphaasc')
349
- $sort_column = 'post_title';
 
 
 
 
 
350
 
351
- if ($orderby == 'datedesc' || $orderby == 'alphadesc')
352
- $sort_order = 'DESC';
 
 
 
353
 
354
- if ($orderby == 'dateasc' || $orderby == 'alphaasc')
355
- $sort_order = 'ASC';
 
 
356
 
357
  $pages = '<h3>'.__('Pages', 'wp-realtime-sitemap').'</h3>';
358
  $pages .= '<ul>' . wp_list_pages(array('sort_column' => $sort_column, 'sort_order' => $sort_order, 'title_li' => '', 'echo' => '0')) . '</ul>';
359
  }
360
 
361
  // Posts: Yes/No?
362
- if ($showposts != 'no') {
363
- // Show private: Yes/No?
364
- if ($showprivate == 'yes') {
365
- $sqlwhere = 'WHERE `post_type`="post" ';
366
- } else {
367
- $sqlwhere = 'WHERE `post_type`="post" AND `post_status`="publish" ';
368
- }
369
 
370
- $sqlposts = 'SELECT * FROM `' . $table_prefix . 'posts` ' . $sqlwhere . $sqlorder;
371
- $allposts = $wpdb->get_results($sqlposts);
 
 
 
 
372
 
373
- if (count($allposts) == 0) {
374
- $posts = '';
375
- } else {
 
376
  $posts = '<h3>'.__('Posts', 'wp-realtime-sitemap').'</h3><ul>';
377
 
378
- foreach($allposts as $thepost) {
379
- $posts .= '<li><a href="' . get_permalink($thepost->ID) . '" title="' . sprintf(esc_attr__('Permalink to %s', 'wp-realtime-sitemap'), $thepost->post_title) . '" rel="bookmark">' . $thepost->post_title . '</a></li>';
380
- }
381
 
382
- $posts .= '</ul>';
 
 
 
383
  }
 
 
 
 
 
 
 
384
  }
385
 
386
- if ($showarchives != 'no') {
 
387
  $archives = '<h3>'.__('Archives', 'wp-realtime-sitemap').'</h3>';
388
- $archives .= '<ul>' . wp_get_archives('type=monthly&echo=0') . '</ul>';
389
  }
390
 
391
- if ($showcategories != 'no') {
 
392
  $categories = '<h3>'.__('Categories', 'wp-realtime-sitemap').'</h3>';
393
 
394
- if ($showcategoriesastc != 'no') {
 
395
  $categories .= wp_tag_cloud(array('format' => 'flat', 'separator' => ' ', 'taxonomy' => 'category', 'echo' => '0'));
396
  } else {
397
- $categories .= '<ul>' . wp_list_categories(array('orderby' => 'name', 'order' => 'ASC', 'hierarchical' => true, 'title_li' => '', 'echo' => '0', 'taxonomy' => 'category')) . '</ul>';
 
 
 
 
398
  }
399
  }
400
 
401
- if ($showtags != 'no') {
 
402
  $tags = '<h3>'.__('Tags', 'wp-realtime-sitemap').'</h3>';
403
 
404
- if ($showtagsastc != 'no') {
 
405
  $tags .= wp_tag_cloud(array('format' => 'flat', 'separator' => ' ', 'echo' => '0'));
406
  } else {
407
- $tags .= '<ul>' . wp_list_categories(array('orderby' => 'name', 'order' => 'ASC', 'hierarchical' => true, 'title_li' => '', 'echo' => '0', 'taxonomy' => 'post_tag')) . '</ul>';
 
 
 
 
408
  }
409
  }
410
 
411
- // 1: Pages, Posts, Archives, Categories, Tags
412
- if ($displayorder == 1)
413
- $data = $pages . $posts . $archives . $categories . $tags;
414
-
415
- // 2: Pages, Posts, Archives, Tags, Categories
416
- if ($displayorder == 2)
417
- $data = $pages . $posts . $archives . $tags . $categories;
418
-
419
- // 3: Pages, Posts, Categories, Archives, Tags
420
- if ($displayorder == 3)
421
- $data = $pages . $posts . $categories . $archives . $tags;
422
-
423
- // 4: Pages, Posts, Categories, Tags, Archives
424
- if ($displayorder == 4)
425
- $data = $pages . $posts . $categories . $tags . $archives;
426
-
427
- // 5: Pages, Posts, Tags, Archives, Categories
428
- if ($displayorder == 5)
429
- $data = $pages . $posts . $tags . $archives . $categories;
430
-
431
- // 6: Pages, Posts, Tags, Categories, Archives
432
- if ($displayorder == 6)
433
- $data = $pages . $posts . $tags . $categories . $archives;
434
-
435
- // 7: Pages, Archives, Posts, Categories, Tags
436
- if ($displayorder == 7)
437
- $data = $pages . $archives . $posts . $categories . $tags;
438
-
439
- // 8: Pages, Archives, Posts, Tags, Categories
440
- if ($displayorder == 8)
441
- $data = $pages . $archives . $posts . $tags . $categories;
442
-
443
- // 9: Pages, Archives, Categories, Posts, Tags
444
- if ($displayorder == 9)
445
- $data = $pages . $archives . $categories . $posts . $tags;
446
-
447
- // 10: Pages, Archives, Categories, Tags, Posts
448
- if ($displayorder == 10)
449
- $data = $pages . $archives . $categories . $tags . $posts;
450
-
451
- // 11: Pages, Archives, Tags, Posts, Categories
452
- if ($displayorder == 11)
453
- $data = $pages . $archives . $tags . $posts . $categories;
454
-
455
- // 12: Pages, Archives, Tags, Categories, Posts
456
- if ($displayorder == 12)
457
- $data = $pages . $archives . $tags . $categories . $posts;
458
-
459
- // 13: Pages, Categories, Posts, Archives, Tags
460
- if ($displayorder == 13)
461
- $data = $pages . $categories . $posts . $archives . $tags;
462
-
463
- // 14: Pages, Categories, Posts, Tags, Archives
464
- if ($displayorder == 14)
465
- $data = $pages . $categories . $posts . $tags . $archives;
466
-
467
- // 15: Pages, Categories, Archives, Posts, Tags
468
- if ($displayorder == 15)
469
- $data = $pages . $categories . $archives . $posts . $tags;
470
-
471
- // 16: Pages, Categories, Archives, Tags, Posts
472
- if ($displayorder == 16)
473
- $data = $pages . $categories . $archives . $tags . $posts;
474
-
475
- // 17: Pages, Categories, Tags, Posts, Archives
476
- if ($displayorder == 17)
477
- $data = $pages . $categories . $tags . $posts . $archives;
478
-
479
- // 18: Pages, Categories, Tags, Archives, Posts
480
- if ($displayorder == 18)
481
- $data = $pages . $categories . $tags . $archives . $posts;
482
-
483
- // 19: Pages, Tags, Posts, Archives, Categories
484
- if ($displayorder == 19)
485
- $data = $pages . $tags . $posts . $archives . $categories;
486
-
487
- // 20: Pages, Tags, Posts, Categories, Archives
488
- if ($displayorder == 20)
489
- $data = $pages . $tags . $posts . $categories . $archives;
490
-
491
- // 21: Pages, Tags, Archives, Posts, Categories
492
- if ($displayorder == 21)
493
- $data = $pages . $tags . $archives . $posts . $categories;
494
-
495
- // 22: Pages, Tags, Archives, Categories, Posts
496
- if ($displayorder == 22)
497
- $data = $pages . $tags . $archives . $categories . $posts;
498
-
499
- // 23: Pages, Tags, Categories, Posts, Archives
500
- if ($displayorder == 23)
501
- $data = $pages . $tags . $categories . $posts . $archives;
502
-
503
- // 24: Pages, Tags, Categories, Archives, Posts
504
- if ($displayorder == 24)
505
- $data = $pages . $tags . $categories . $archives . $posts;
506
-
507
- // 25: Posts, Pages, Archives, Categories, Tags
508
- if ($displayorder == 25)
509
- $data = $posts . $pages . $archives . $categories . $tags;
510
-
511
- // 26: Posts, Pages, Archives, Tags, Categories
512
- if ($displayorder == 26)
513
- $data = $posts . $pages . $archives . $tags . $categories;
514
-
515
- // 27: Posts, Pages, Categories, Archives, Tags
516
- if ($displayorder == 27)
517
- $data = $posts . $pages . $categories . $archives . $tags;
518
-
519
- // 28: Posts, Pages, Categories, Tags, Archives
520
- if ($displayorder == 28)
521
- $data = $posts . $pages . $categories . $tags . $archives;
522
-
523
- // 29: Posts, Pages, Tags, Archives, Categories
524
- if ($displayorder == 29)
525
- $data = $posts . $pages . $tags . $archives . $categories;
526
-
527
- // 30: Posts, Pages, Tags, Categories, Archives
528
- if ($displayorder == 30)
529
- $data = $posts . $pages . $tags . $categories . $archives;
530
-
531
- // 31: Posts, Archives, Pages, Categories, Tags
532
- if ($displayorder == 31)
533
- $data = $posts . $archives . $pages . $categories . $tags;
534
-
535
- // 32: Posts, Archives, Pages, Tags, Categories
536
- if ($displayorder == 32)
537
- $data = $posts . $archives . $pages . $tags . $categories;
538
-
539
- // 33: Posts, Archives, Categories, Pages, Tags
540
- if ($displayorder == 33)
541
- $data = $posts . $archives . $categories . $pages . $tags;
542
-
543
- // 34: Posts, Archives, Categories, Tags, Pages
544
- if ($displayorder == 34)
545
- $data = $posts . $archives . $categories . $tags . $pages;
546
-
547
- // 35: Posts, Archives, Tags, Pages, Categories
548
- if ($displayorder == 35)
549
- $data = $posts . $archives . $tags . $pages . $categories;
550
-
551
- // 36: Posts, Archives, Tags, Categories, Pages
552
- if ($displayorder == 36)
553
- $data = $posts . $archives . $tags . $categories . $pages;
554
-
555
- // 37: Posts, Categories, Pages, Archives, Tags
556
- if ($displayorder == 37)
557
- $data = $posts . $categories . $pages . $archives . $tags;
558
-
559
- // 38: Posts, Categories, Pages, Tags, Archives
560
- if ($displayorder == 38)
561
- $data = $posts . $categories . $pages . $tags . $archives;
562
-
563
- // 39: Posts, Categories, Archives, Pages, Tags
564
- if ($displayorder == 39)
565
- $data = $posts . $categories . $archives . $pages . $tags;
566
-
567
- // 40: Posts, Categories, Archives, Tags, Pages
568
- if ($displayorder == 40)
569
- $data = $posts . $categories . $archives . $tags . $pages;
570
-
571
- // 41: Posts, Categories, Tags, Pages, Archives
572
- if ($displayorder == 41)
573
- $data = $posts . $categories . $tags . $pages . $archives;
574
-
575
- // 42: Posts, Categories, Tags, Archives, Pages
576
- if ($displayorder == 42)
577
- $data = $posts . $categories . $tags . $archives . $pages;
578
-
579
- // 43: Posts, Tags, Pages, Archives, Categories
580
- if ($displayorder == 43)
581
- $data = $posts . $tags . $pages . $archives . $categories;
582
-
583
- // 44: Posts, Tags, Pages, Categories, Archives
584
- if ($displayorder == 44)
585
- $data = $posts . $tags . $pages . $categories . $archives;
586
-
587
- // 45: Posts, Tags, Archives, Pages, Categories
588
- if ($displayorder == 45)
589
- $data = $posts . $tags . $archives . $pages . $categories;
590
-
591
- // 46: Posts, Tags, Archives, Categories, Pages
592
- if ($displayorder == 46)
593
- $data = $posts . $tags . $archives . $categories . $pages;
594
-
595
- // 47: Posts, Tags, Categories, Pages, Archives
596
- if ($displayorder == 47)
597
- $data = $posts . $tags . $categories . $pages . $archives;
598
-
599
- // 48: Posts, Tags, Categories, Archives, Pages
600
- if ($displayorder == 48)
601
- $data = $posts . $tags . $categories . $archives . $pages;
602
-
603
- // 49: Archives, Pages, Posts, Categories, Tags
604
- if ($displayorder == 49)
605
- $data = $archives . $pages . $posts . $categories . $tags;
606
-
607
- // 50: Archives, Pages, Posts, Tags, Categories
608
- if ($displayorder == 50)
609
- $data = $archives . $pages . $posts . $tags . $categories;
610
-
611
- // 51: Archives, Pages, Categories, Posts, Tags
612
- if ($displayorder == 51)
613
- $data = $archives . $pages . $categories . $posts . $tags;
614
-
615
- // 52: Archives, Pages, Categories, Tags, Posts
616
- if ($displayorder == 52)
617
- $data = $archives . $pages . $categories . $tags . $posts;
618
-
619
- // 53: Archives, Pages, Tags, Posts, Categories
620
- if ($displayorder == 53)
621
- $data = $archives . $pages . $tags . $posts . $categories;
622
-
623
- // 54: Archives, Pages, Tags, Categories, Posts
624
- if ($displayorder == 54)
625
- $data = $archives . $pages . $tags . $categories . $posts;
626
-
627
- // 55: Archives, Posts, Pages, Categories, Tags
628
- if ($displayorder == 55)
629
- $data = $archives . $posts . $pages . $categories . $tags;
630
-
631
- // 56: Archives, Posts, Pages, Tags, Categories
632
- if ($displayorder == 56)
633
- $data = $archives . $posts . $pages . $tags . $categories;
634
-
635
- // 57: Archives, Posts, Categories, Pages, Tags
636
- if ($displayorder == 57)
637
- $data = $archives . $posts . $categories . $pages . $tags;
638
-
639
- // 58: Archives, Posts, Categories, Tags, Pages
640
- if ($displayorder == 58)
641
- $data = $archives . $posts . $categories . $tags . $pages;
642
-
643
- // 59: Archives, Posts, Tags, Pages, Categories
644
- if ($displayorder == 59)
645
- $data = $archives . $posts . $tags . $pages . $categories;
646
-
647
- // 60: Archives, Posts, Tags, Categories, Pages
648
- if ($displayorder == 60)
649
- $data = $archives . $posts . $tags . $categories . $pages;
650
-
651
- // 61: Archives, Categories, Pages, Posts, Tags
652
- if ($displayorder == 61)
653
- $data = $archives . $categories . $pages . $posts . $tags;
654
-
655
- // 62: Archives, Categories, Pages, Tags, Posts
656
- if ($displayorder == 62)
657
- $data = $archives . $categories . $pages . $tags . $posts;
658
-
659
- // 63: Archives, Categories, Posts, Pages, Tags
660
- if ($displayorder == 63)
661
- $data = $archives . $categories . $posts . $pages . $tags;
662
-
663
- // 64: Archives, Categories, Posts, Tags, Pages
664
- if ($displayorder == 64)
665
- $data = $archives . $categories . $posts . $tags . $pages;
666
-
667
- // 65: Archives, Categories, Tags, Pages, Posts
668
- if ($displayorder == 65)
669
- $data = $archives . $categories . $tags . $pages . $posts;
670
-
671
- // 66: Archives, Categories, Tags, Posts, Pages
672
- if ($displayorder == 66)
673
- $data = $archives . $categories . $tags . $posts . $pages;
674
-
675
- // 67: Archives, Tags, Pages, Posts, Categories
676
- if ($displayorder == 67)
677
- $data = $archives . $tags . $pages . $posts . $categories;
678
-
679
- // 68: Archives, Tags, Pages, Categories, Posts
680
- if ($displayorder == 68)
681
- $data = $archives . $tags . $pages . $categories . $posts;
682
-
683
- // 69: Archives, Tags, Posts, Pages, Categories
684
- if ($displayorder == 69)
685
- $data = $archives . $tags . $posts . $pages . $categories;
686
-
687
- // 70: Archives, Tags, Posts, Categories, Pages
688
- if ($displayorder == 70)
689
- $data = $archives . $tags . $posts . $categories . $pages;
690
-
691
- // 71: Archives, Tags, Categories, Pages, Posts
692
- if ($displayorder == 71)
693
- $data = $archives . $tags . $categories . $pages . $posts;
694
-
695
- // 72: Archives, Tags, Categories, Posts, Pages
696
- if ($displayorder == 72)
697
- $data = $archives . $tags . $categories . $posts . $pages;
698
-
699
- // 73: Categories, Pages, Posts, Archives, Tags
700
- if ($displayorder == 73)
701
- $data = $categories . $pages . $posts . $archives . $tags;
702
-
703
- // 74: Categories, Pages, Posts, Tags, Archives
704
- if ($displayorder == 74)
705
- $data = $categories . $pages . $posts . $tags . $archives;
706
-
707
- // 75: Categories, Pages, Archives, Posts, Tags
708
- if ($displayorder == 75)
709
- $data = $categories . $pages . $archives . $posts . $tags;
710
-
711
- // 76: Categories, Pages, Archives, Tags, Posts
712
- if ($displayorder == 76)
713
- $data = $categories . $pages . $archives . $tags . $posts;
714
-
715
- // 77: Categories, Pages, Tags, Posts, Archives
716
- if ($displayorder == 77)
717
- $data = $categories . $pages . $tags . $posts . $archives;
718
-
719
- // 78: Categories, Pages, Tags, Archives, Posts
720
- if ($displayorder == 78)
721
- $data = $categories . $pages . $tags . $archives . $posts;
722
-
723
- // 79: Categories, Posts, Pages, Archives, Tags
724
- if ($displayorder == 79)
725
- $data = $categories . $posts . $pages . $archives . $tags;
726
-
727
- // 80: Categories, Posts, Pages, Tags, Archives
728
- if ($displayorder == 80)
729
- $data = $categories . $posts . $pages . $tags . $archives;
730
-
731
- // 81: Categories, Posts, Archives, Pages, Tags
732
- if ($displayorder == 81)
733
- $data = $categories . $posts . $archives . $pages . $tags;
734
-
735
- // 82: Categories, Posts, Archives, Tags, Pages
736
- if ($displayorder == 82)
737
- $data = $categories . $posts . $archives . $tags . $pages;
738
-
739
- // 83: Categories, Posts, Tags, Pages, Archives
740
- if ($displayorder == 83)
741
- $data = $categories . $posts . $tags . $pages . $archives;
742
-
743
- // 84: Categories, Posts, Tags, Archives, Pages
744
- if ($displayorder == 84)
745
- $data = $categories . $posts . $tags . $archives . $pages;
746
-
747
- // 85: Categories, Archives, Pages, Posts, Tags
748
- if ($displayorder == 85)
749
- $data = $categories . $archives . $pages . $posts . $tags;
750
-
751
- // 86: Categories, Archives, Pages, Tags, Posts
752
- if ($displayorder == 86)
753
- $data = $categories . $archives . $pages . $tags . $posts;
754
-
755
- // 87: Categories, Archives, Posts, Pages, Tags
756
- if ($displayorder == 87)
757
- $data = $categories . $archives . $posts . $pages . $tags;
758
-
759
- // 88: Categories, Archives, Posts, Tags, Pages
760
- if ($displayorder == 88)
761
- $data = $categories . $archives . $posts . $tags . $pages;
762
-
763
- // 89: Categories, Archives, Tags, Pages, Posts
764
- if ($displayorder == 89)
765
- $data = $categories . $archives . $tags . $pages . $posts;
766
-
767
- // 90: Categories, Archives, Tags, Posts, Pages
768
- if ($displayorder == 90)
769
- $data = $categories . $archives . $tags . $posts . $pages;
770
-
771
- // 91: Categories, Tags, Pages, Posts, Archives
772
- if ($displayorder == 91)
773
- $data = $categories . $tags . $pages . $posts . $archives;
774
-
775
- // 92: Categories, Tags, Pages, Archives, Posts
776
- if ($displayorder == 92)
777
- $data = $categories . $tags . $pages . $archives . $posts;
778
-
779
- // 93: Categories, Tags, Posts, Pages, Archives
780
- if ($displayorder == 93)
781
- $data = $categories . $tags . $posts . $pages . $archives;
782
-
783
- // 94: Categories, Tags, Posts, Archives, Pages
784
- if ($displayorder == 94)
785
- $data = $categories . $tags . $posts . $archives . $pages;
786
-
787
- // 95: Categories, Tags, Archives, Pages, Posts
788
- if ($displayorder == 95)
789
- $data = $categories . $tags . $archives . $pages . $posts;
790
-
791
- // 96: Categories, Tags, Archives, Posts, Pages
792
- if ($displayorder == 96)
793
- $data = $categories . $tags . $archives . $posts . $pages;
794
-
795
- // 97: Tags, Pages, Posts, Archives, Categories
796
- if ($displayorder == 97)
797
- $data = $tags . $pages . $posts . $archives . $categories;
798
-
799
- // 98: Tags, Pages, Posts, Categories, Archives
800
- if ($displayorder == 98)
801
- $data = $tags . $pages . $posts . $categories . $archives;
802
-
803
- // 99: Tags, Pages, Archives, Posts, Categories
804
- if ($displayorder == 99)
805
- $data = $tags . $pages . $archives . $posts . $categories;
806
-
807
- // 100: Tags, Pages, Archives, Categories, Posts
808
- if ($displayorder == 100)
809
- $data = $tags . $pages . $archives . $categories . $posts;
810
-
811
- // 101: Tags, Pages, Categories, Posts, Archives
812
- if ($displayorder == 101)
813
- $data = $tags . $pages . $categories . $posts . $archives;
814
-
815
- // 102: Tags, Pages, Categories, Archives, Posts
816
- if ($displayorder == 102)
817
- $data = $tags . $pages . $categories . $archives . $posts;
818
-
819
- // 103: Tags, Posts, Pages, Archives, Categories
820
- if ($displayorder == 103)
821
- $data = $tags . $posts . $pages . $archives . $categories;
822
-
823
- // 104: Tags, Posts, Pages, Categories, Archives
824
- if ($displayorder == 104)
825
- $data = $tags . $posts . $pages . $categories . $archives;
826
-
827
- // 105: Tags, Posts, Archives, Pages, Categories
828
- if ($displayorder == 105)
829
- $data = $tags . $posts . $archives . $pages . $categories;
830
-
831
- // 106: Tags, Posts, Archives, Categories, Pages
832
- if ($displayorder == 106)
833
- $data = $tags . $posts . $archives . $categories . $pages;
834
-
835
- // 107: Tags, Posts, Categories, Pages, Archives
836
- if ($displayorder == 107)
837
- $data = $tags . $posts . $categories . $pages . $archives;
838
-
839
- // 108: Tags, Posts, Categories, Archives, Pages
840
- if ($displayorder == 108)
841
- $data = $tags . $posts . $categories . $archives . $pages;
842
-
843
- // 109: Tags, Archives, Pages, Posts, Categories
844
- if ($displayorder == 109)
845
- $data = $tags . $archives . $pages . $posts . $categories;
846
-
847
- // 110: Tags, Archives, Pages, Categories, Posts
848
- if ($displayorder == 110)
849
- $data = $tags . $archives . $pages . $categories . $posts;
850
-
851
- // 111: Tags, Archives, Posts, Pages, Categories
852
- if ($displayorder == 111)
853
- $data = $tags . $archives . $posts . $pages . $categories;
854
-
855
- // 112: Tags, Archives, Posts, Categories, Pages
856
- if ($displayorder == 112)
857
- $data = $tags . $archives . $posts . $categories . $pages;
858
-
859
- // 113: Tags, Archives, Categories, Pages, Posts
860
- if ($displayorder == 113)
861
- $data = $tags . $archives . $categories . $pages . $posts;
862
-
863
- // 114: Tags, Archives, Categories, Posts, Pages
864
- if ($displayorder == 114)
865
- $data = $tags . $archives . $categories . $posts . $pages;
866
-
867
- // 115: Tags, Categories, Pages, Posts, Archives
868
- if ($displayorder == 115)
869
- $data = $tags . $categories . $pages . $posts . $archives;
870
-
871
- // 116: Tags, Categories, Pages, Archives, Posts
872
- if ($displayorder == 116)
873
- $data = $tags . $categories . $pages . $archives . $posts;
874
 
875
- // 117: Tags, Categories, Posts, Pages, Archives
876
- if ($displayorder == 117)
877
- $data = $tags . $categories . $posts . $pages . $archives;
878
 
879
- // 118: Tags, Categories, Posts, Archives, Pages
880
- if ($displayorder == 118)
881
- $data = $tags . $categories . $posts . $archives . $pages;
882
 
883
- // 119: Tags, Categories, Archives, Pages, Posts
884
- if ($displayorder == 119)
885
- $data = $tags . $categories . $archives . $pages . $posts;
886
 
887
- // 120: Tags, Categories, Archives, Posts, Pages
888
- if ($displayorder == 120)
889
- $data = $tags . $categories . $archives . $posts . $pages;
890
 
891
- $text = preg_replace("|<!--wp-realtime-sitemap-->|", $data, $text);
 
 
 
 
 
 
892
  }
893
-
894
- return $text;
895
-
896
  } // End wp_realtime_sitemap()
897
 
898
- add_filter('the_content', 'wp_realtime_sitemap', 2);
899
 
900
  function wprs_plugin_action_links($links, $file) {
901
  $plugin_file = basename(__FILE__);
@@ -936,7 +335,57 @@ function wprs_admin_menu() {
936
  }
937
  add_action('admin_menu', 'wprs_admin_menu');
938
 
939
- function wprs_admin_init() { }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
940
  add_action('admin_init', 'wprs_admin_init');
941
 
942
  function wprs_contextual_help( $help, $screen ) {
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-->` 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
  Author: Daniel Tweedy
9
  Author URI: http://www.daniel-tweedy.co.uk/
10
  License: GPL2
33
  wp_die( __('You do not have sufficient permissions to access this page.', 'wp-realtime-sitemap') );
34
  }
35
 
36
+ // Check if we have a posted form to deal with.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  if (isset($_POST['info_update'])) {
38
+ // Get current options from the database.
39
+ $options = get_option('plugin_wp_realtime_sitemap_settings');
40
+
41
+ // Update current options with options submitted by the form.
42
+ $options['sort_column'] = $_POST['sort_column'];
43
+ $options['sort_order'] = $_POST['sort_order'];
44
+ $options['show_pages'] = $_POST['show_pages'];
45
+ $options['show_posts'] = $_POST['show_posts'];
46
+ $options['show_archives'] = $_POST['show_archives'];
47
+ $options['show_categories'] = $_POST['show_categories'];
48
+ $options['category_tagcloud'] = $_POST['category_tagcloud'];
49
+ $options['show_tags'] = $_POST['show_tags'];
50
+ $options['tags_tagcloud'] = $_POST['tags_tagcloud'];
51
+ $options['show_count'] = $_POST['show_count'];
52
+ $options['show_date'] = $_POST['show_date'];
53
+
54
+ // Update settings posted via the form into the database.
55
+ update_option('plugin_wp_realtime_sitemap_settings', $options);
56
+
57
+ // Get current options from the database.
58
+ extract(get_option('plugin_wp_realtime_sitemap_settings'));
 
59
  } else {
60
+ // Get current options from the database.
61
+ extract(get_option('plugin_wp_realtime_sitemap_settings'));
 
 
 
 
 
 
 
 
 
62
  }
 
63
  ?>
64
  <div class="wrap">
65
+ <h2>WP Realtime Sitemap Default Options</h2>
66
 
67
  <form method="post">
68
+ <h3>Globals</h3>
69
  <table class="form-table">
70
  <tr valign="top">
71
+ <th scope="row"><label for="sort_column">Sort column</label></th>
72
+ <td><select name="sort_column">
73
+ <option <?php selected('title', $sort_column); ?> value="title">Alphabetically (by title) (Default)</option>
74
+ <option <?php selected('menu_order', $sort_column); ?> value="menu_order">Page order</option>
75
+ <option <?php selected('date', $sort_column); ?> value="date">Creation time</option>
76
+ <option <?php selected('modified', $sort_column); ?> value="modified">Time last modified</option>
77
+ <option <?php selected('ID', $sort_order); ?> value="ID">Numeric Page ID</option>
78
+ <option <?php selected('author', $sort_order); ?> value="author">Page author</option>
79
+ <option <?php selected('name', $sort_order); ?> value="name">Alphabetically (by post slug)</option>
80
+ </select></td>
81
+ </tr>
82
+ <tr valign="top">
83
+ <th scope="row"><label for="sort_order">Sort order</label></th>
84
+ <td><select name="sort_order">
85
+ <option <?php selected('ASC', $sort_order); ?> value="ASC">Ascending (Default)</option>
86
+ <option <?php selected('DESC', $sort_order); ?> value="DESC">Descending</option>
87
  </select></td>
88
  </tr>
89
  <tr valign="top">
90
+ <th scope="row"><label for="show_count">Show post count</label></th>
91
+ <td><select name="show_count">
92
+ <option <?php selected('yes', $show_count); ?> value="yes">Yes/On</option>
93
+ <option <?php selected('no', $show_count); ?> value="no">No/Off (Default)</option>
94
  </select></td>
95
  </tr>
96
  <tr valign="top">
97
+ <th scope="row"><label for="show_date">Show date</label></th>
98
+ <td><select name="show_date">
99
+ <option <?php selected('yes', $show_date); ?> value="yes">Yes/On</option>
100
+ <option <?php selected('no', $show_date); ?> value="no">No/Off (Default)</option>
101
  </select></td>
102
  </tr>
103
  <tr valign="top">
104
+ <th scope="row"><label for="show_pages">Show pages</label></th>
105
+ <td><select name="show_pages">
106
+ <option value="yes" <?php selected('yes', $show_pages); ?>>Yes/On (Default)</option>
107
+ <option value="no" <?php selected('no', $show_pages); ?>>No/Off</option>
108
  </select></td>
109
  </tr>
110
  <tr valign="top">
111
+ <th scope="row"><label for="show_posts">Show posts</label></th>
112
+ <td><select name="show_posts">
113
+ <option value="yes" <?php selected('yes', $show_posts); ?>>Yes/On (Default)</option>
114
+ <option value="no" <?php selected('no', $show_posts); ?>>No/Off</option>
115
  </select></td>
116
  </tr>
117
  <tr valign="top">
118
+ <th scope="row"><label for="show_archives">Show archives</label></th>
119
+ <td><select name="show_archives">
120
+ <option value="yes" <?php selected('yes', $show_archives); ?>>Yes/On (Default)</option>
121
+ <option value="no" <?php selected('no', $show_archives); ?>>No/Off</option>
122
  </select></td>
123
  </tr>
124
  <tr valign="top">
125
+ <th scope="row"><label for="show_categories">Show categories</label></th>
126
+ <td><select name="show_categories">
127
+ <option value="yes" <?php selected('yes', $show_categories); ?>>Yes/On (Default)</option>
128
+ <option value="no" <?php selected('no', $show_categories); ?>>No/Off</option>
129
  </select></td>
130
  </tr>
131
  <tr valign="top">
132
+ <th scope="row"><label for="category_tagcloud">Show categories as a tag cloud</label></th>
133
+ <td><select name="category_tagcloud">
134
+ <option value="yes" <?php selected('yes', $category_tagcloud); ?>>Yes/On</option>
135
+ <option value="no" <?php selected('no', $category_tagcloud); ?>>No/Off (Default)</option>
136
  </select></td>
137
  </tr>
138
  <tr valign="top">
139
+ <th scope="row"><label for="show_tags">Show tags</label></th>
140
+ <td><select name="show_tags">
141
+ <option value="yes" <?php selected('yes', $show_tags); ?>>Yes/On (Default)</option>
142
+ <option value="no" <?php selected('no', $show_tags); ?>>No/Off</option>
143
  </select></td>
144
  </tr>
145
+ <tr valign="top">
146
+ <th scope="row"><label for="tags_tagcloud">Show tags as a tag cloud</label></th>
147
+ <td><select name="tags_tagcloud">
148
+ <option value="yes" <?php selected('yes', $tags_tagcloud); ?>>Yes/On</option>
149
+ <option value="no" <?php selected('no', $tags_tagcloud); ?>>No/Off (Default)</option>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
150
  </select></td>
151
  </tr>
152
  </table>
156
  </div>
157
  </form>
158
  </div><?php
159
+ } // End wprs_options_form()
160
 
161
+ // To replace the shortcode with the actual sitemap.
162
+ function wp_realtime_sitemap($atts, $content=null, $code='') {
 
 
 
 
163
  global $wpdb, $table_prefix;
164
 
165
+ // Only perform plugin functionality if post/page text has the shortcode in the page.
166
+ if (preg_match('|wp-realtime-sitemap|', $code)) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
167
 
168
+ // Get option values from the database.
169
+ $all_options = get_option('plugin_wp_realtime_sitemap_settings');
 
 
170
 
171
+ extract(shortcode_atts(array(
172
+ 'show' => 'all',
173
+ 'sort_column' => $all_options['sort_column'],
174
+ 'sort_order' => $all_options['sort_order'],
175
+ 'show_count' => $all_options['show_count'],
176
+ 'show_date' => $all_options['show_date'],
177
+ ), $atts));
178
 
179
+ if ($show == 'categories') {
180
+ $tagcloud = $all_options['category_tagcloud'];
181
+ } elseif ($show == 'tags') {
182
+ $tagcloud = $all_options['tags_tagcloud'];
183
+ }
184
 
185
+ // Pages: Yes/No?
186
+ if ($all_options['show_pages'] != 'no' && $all_options['show_pages'] != 'off') {
187
+ if ($sort_column == 'title' || $sort_column == 'date' || $sort_column == 'modified' || $sort_column == 'author' || $sort_column == 'name')
188
+ $sort_column = 'post_' . $sort_column;
189
 
190
  $pages = '<h3>'.__('Pages', 'wp-realtime-sitemap').'</h3>';
191
  $pages .= '<ul>' . wp_list_pages(array('sort_column' => $sort_column, 'sort_order' => $sort_order, 'title_li' => '', 'echo' => '0')) . '</ul>';
192
  }
193
 
194
  // Posts: Yes/No?
195
+ if ($all_options['show_posts'] != 'no' && $all_options['show_posts'] != 'no') {
196
+ $posts = '';
 
 
 
 
 
197
 
198
+ // Set options for post query
199
+ $post_args = array(
200
+ 'orderby' => $sort_column,
201
+ 'order' => $sort_order,
202
+ 'posts_per_page' => -1
203
+ );
204
 
205
+ // The Query
206
+ query_posts($post_args);
207
+
208
+ if (have_posts())
209
  $posts = '<h3>'.__('Posts', 'wp-realtime-sitemap').'</h3><ul>';
210
 
211
+ // The Loop
212
+ while (have_posts()) {
213
+ the_post();
214
 
215
+ if ($show_date == 'yes')
216
+ $extra = ' ' . get_the_date();
217
+
218
+ $posts .= '<li><a href="' . get_permalink() . '" title="' . sprintf(esc_attr__('Permalink to %s', 'wp-realtime-sitemap'), the_title_attribute('echo=0')) . '" rel="bookmark">' . get_the_title() . '</a>' . $extra . '</li>';
219
  }
220
+
221
+ if (have_posts())
222
+ $posts .= '</ul>';
223
+
224
+ // Reset Query
225
+ wp_reset_query();
226
+
227
  }
228
 
229
+ // Archives: Yes/No?
230
+ if ($all_options['show_archives'] != 'no' && $all_options['show_archives'] != 'no') {
231
  $archives = '<h3>'.__('Archives', 'wp-realtime-sitemap').'</h3>';
232
+ $archives .= '<ul>' . wp_get_archives(array('type' => 'monthly', 'show_post_count' => ($show_count == 'yes') ? true : false, 'echo' => 0)) . '</ul>';
233
  }
234
 
235
+ // Categories: Yes/No?
236
+ if ($all_options['show_categories'] != 'no' && $all_options['show_categories'] != 'no') {
237
  $categories = '<h3>'.__('Categories', 'wp-realtime-sitemap').'</h3>';
238
 
239
+ // Tag Cloud: Yes/No?
240
+ if ($tagcloud != 'no' && $tagcloud != 'no') {
241
  $categories .= wp_tag_cloud(array('format' => 'flat', 'separator' => ' ', 'taxonomy' => 'category', 'echo' => '0'));
242
  } else {
243
+ if ($sort_column != 'ID' || $sort_column != 'name' || $sort_column != 'slug' || $sort_column != 'count' || $sort_column != 'term_group') {
244
+ $sort_column = 'name';
245
+ }
246
+
247
+ $categories .= '<ul>' . wp_list_categories(array('orderby' => $sort_column, 'order' => $sort_order, 'show_count' => ($show_count == 'yes') ? true : false, 'hierarchical' => true, 'title_li' => '', 'echo' => '0', 'taxonomy' => 'category')) . '</ul>';
248
  }
249
  }
250
 
251
+ // Tags: Yes/No?
252
+ if ($all_options['show_tags'] != 'no' && $all_options['show_tags'] != 'no') {
253
  $tags = '<h3>'.__('Tags', 'wp-realtime-sitemap').'</h3>';
254
 
255
+ // Tag Cloud: Yes/No?
256
+ if ($tagcloud != 'no' && $tagcloud != 'no') {
257
  $tags .= wp_tag_cloud(array('format' => 'flat', 'separator' => ' ', 'echo' => '0'));
258
  } else {
259
+ if ($sort_column != 'ID' || $sort_column != 'name' || $sort_column != 'slug' || $sort_column != 'count' || $sort_column != 'term_group') {
260
+ $sort_column = 'name';
261
+ }
262
+
263
+ $tags .= '<ul>' . wp_list_categories(array('orderby' => $sort_column, 'order' => $sort_order, 'show_count' => ($show_count == 'yes') ? true : false, 'hierarchical' => true, 'title_li' => '', 'echo' => '0', 'taxonomy' => 'post_tag')) . '</ul>';
264
  }
265
  }
266
 
267
+ if ($show == 'pages') {
268
+ echo $pages;
269
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
270
 
271
+ if ($show == 'posts') {
272
+ echo $posts;
273
+ }
274
 
275
+ if ($show == 'archives') {
276
+ echo $archives;
277
+ }
278
 
279
+ if ($show == 'categories') {
280
+ echo $categories;
281
+ }
282
 
283
+ if ($show == 'tags') {
284
+ echo $tags;
285
+ }
286
 
287
+ if ($show == 'all') {
288
+ echo $pages;
289
+ echo $posts;
290
+ echo $archives;
291
+ echo $categories;
292
+ echo $tags;
293
+ }
294
  }
 
 
 
295
  } // End wp_realtime_sitemap()
296
 
297
+ add_shortcode('wp-realtime-sitemap', 'wp_realtime_sitemap');
298
 
299
  function wprs_plugin_action_links($links, $file) {
300
  $plugin_file = basename(__FILE__);
335
  }
336
  add_action('admin_menu', 'wprs_admin_menu');
337
 
338
+ function wprs_admin_init() {
339
+ $orderby = get_option('wp_realtime_sitemap_orderby');
340
+
341
+ if ($orderby == 'datedesc' || $orderby == 'dateasc')
342
+ $sort_column = 'post_date';
343
+
344
+ if ($orderby == 'alphadesc' || $orderby == 'alphaasc')
345
+ $sort_column = 'post_title';
346
+
347
+ if ($orderby == 'datedesc' || $orderby == 'alphadesc')
348
+ $sort_order = 'DESC';
349
+
350
+ if ($orderby == 'dateasc' || $orderby == 'alphaasc')
351
+ $sort_order = 'ASC';
352
+
353
+ // Add default options if first time running - http://striderweb.com/nerdaphernalia/2008/07/consolidate-options-with-arrays/
354
+ add_option('plugin_wp_realtime_sitemap_settings', array(
355
+ 'sort_column' => $sort_column,
356
+ 'sort_order' => $sort_order,
357
+ 'show_pages' => get_option('wp_realtime_sitemap_showpages'),
358
+ 'show_posts' => get_option('wp_realtime_sitemap_showposts'),
359
+ 'show_archives' => get_option('wp_realtime_sitemap_showarchives'),
360
+ 'show_categories' => get_option('wp_realtime_sitemap_showcategories'),
361
+ 'category_tagcloud' => get_option('wp_realtime_sitemap_showcategoriesastc'),
362
+ 'show_tags' => get_option('wp_realtime_sitemap_showtags'),
363
+ 'tags_tagcloud' => get_option('wp_realtime_sitemap_showtagsastc'),
364
+ 'show_count' => 'no',
365
+ 'show_date' => 'no',
366
+ ));
367
+
368
+ // Delete old unused database entries - v1.0
369
+ delete_option('wp_realtime_sitemap_orderby');
370
+ delete_option('wp_realtime_sitemap_private');
371
+ delete_option('wp_realtime_sitemap_pages');
372
+ delete_option('wp_realtime_sitemap_posts');
373
+ delete_option('wp_realtime_sitemap_tags');
374
+ delete_option('wp_realtime_sitemap_archives');
375
+ delete_option('wp_realtime_sitemap_displayorder');
376
+
377
+ // Delete old unused database entries - v1.1
378
+ delete_option('wp_realtime_sitemap_orderby');
379
+ delete_option('wp_realtime_sitemap_showprivate');
380
+ delete_option('wp_realtime_sitemap_showpages');
381
+ delete_option('wp_realtime_sitemap_showposts');
382
+ delete_option('wp_realtime_sitemap_showarchives');
383
+ delete_option('wp_realtime_sitemap_showcategories');
384
+ delete_option('wp_realtime_sitemap_showcategoriesastc');
385
+ delete_option('wp_realtime_sitemap_showtags');
386
+ delete_option('wp_realtime_sitemap_showtagsastc');
387
+ delete_option('wp_realtime_sitemap_displayorder');
388
+ }
389
  add_action('admin_init', 'wprs_admin_init');
390
 
391
  function wprs_contextual_help( $help, $screen ) {