Simple Sitemap – Automatically Generate a Responsive Sitemap - Version 1.53

Version Description

Download this release

Release Info

Developer dgwyer
Plugin Icon Simple Sitemap – Automatically Generate a Responsive Sitemap
Version 1.53
Comparing to
See all releases

Code changes from version 1.52 to 1.53

Files changed (2) hide show
  1. readme.txt +7 -2
  2. simple-sitemap.php +15 -11
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: dgwyer
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=UUFZZU35RZPW8
4
  Tags: sitemap, html, global, sort, shortcode, pages, posts
5
  Requires at least: 2.7
6
- Tested up to: 3.5.1
7
- Stable tag: 1.52
8
 
9
  HTML sitemap to display content as a single linked list of posts and pages, or as groups sorted by taxonomy (via a drop-down box).
10
 
@@ -67,6 +67,11 @@ The Plugin can also be installed directly from the main WordPress Plugin page.
67
 
68
  == Changelog ==
69
 
 
 
 
 
 
70
  *1.52*
71
 
72
  * Updated Plugin options page text.
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=UUFZZU35RZPW8
4
  Tags: sitemap, html, global, sort, shortcode, pages, posts
5
  Requires at least: 2.7
6
+ Tested up to: 3.7
7
+ Stable tag: 1.53
8
 
9
  HTML sitemap to display content as a single linked list of posts and pages, or as groups sorted by taxonomy (via a drop-down box).
10
 
67
 
68
  == Changelog ==
69
 
70
+ *1.53*
71
+
72
+ * All functions now properly name-spaced.
73
+ * Added $wpdb->prepare() to SQL query.
74
+
75
  *1.52*
76
 
77
  * Updated Plugin options page text.
simple-sitemap.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Simple Sitemap
4
  Plugin URI: http://www.presscoders.com/plugins/free-plugins/simple-sitemap/
5
  Description: HTML sitemap to display content as a single linked list of posts and pages, or as groups sorted by taxonomy (via a drop-down box).
6
- Version: 1.52
7
  Author: David Gwyer
8
  Author URI: http://www.presscoders.com
9
  */
@@ -26,21 +26,25 @@ Author URI: http://www.presscoders.com
26
  */
27
 
28
  /* @todo:
 
 
 
29
  - Be able to sort ascending/descending in addition to the sort drop down options for each list.
30
  - Add all Plugin options page in-line styles to external style sheet.
31
  - Options to display custom post types, with ability to show which custom post types to display or not display, and in what order?
32
- - Consider adding a drop down in Plugin options to show the page hierchy as it appears in 'Pages' (i.e. the way it works now), or to show it via a defined custom menu hierarchy.
33
  - Add option to remove certain tags, categories, or posts.
34
  - Use the 'prepare' WP feature when querying the db directly.
35
- - Use translation functions _e(), __() etc.
36
  - Show all the posts in each category not just the maximum allowed in Settings -> Reading.
37
  - Update Plugin description and other sections, as well as the images which are out of date (show the single column working on the sidebar).
38
  - Maybe support shortcode attributes so that users can specify to add custom behaviour for individual sitemaps if more than one is needed on a site. Any attributes would override global Plugin settings that affects all sitemaps by default.
 
39
  */
40
 
41
  /* wpss_ prefix is derived from [W]ord[P]ress [s]imple [s]itemap. */
42
  add_shortcode('simple-sitemap', 'wpss_gen');
43
- add_filter('query_vars', 'parameter_queryvars' );
44
 
45
  register_activation_hook(__FILE__, 'wpss_add_defaults');
46
  register_uninstall_hook(__FILE__, 'wpss_delete_plugin_options');
@@ -112,7 +116,7 @@ function wpss_render_form() {
112
  <h2>Simple Sitemap Options</h2>
113
 
114
  <div style="margin-top:15px;">
115
- <p>Here's a little a bonus AVAILABLE ONLY to our free Plugin users! <strong>Get $20 OFF</strong> the price of our fully responsive, cutting edge <a href="http://www.presscoders.com/designfolio-offer/" target="_blank">Designfolio</a> theme.<br /><a style="margin-top:4px;" class="button" href="http://www.presscoders.com/designfolio-offer#buy" target="_blank"><strong>GET $20 OFF DESIGNFOLIO PRO NOW!!</strong></a></p>
116
  </div>
117
 
118
  <div style="background:#eee;border: 1px dashed #ccc;font-size: 13px;margin: 20px 0 10px 0;padding: 5px 0 5px 8px;">To display the Simple Sitemap on a post, page, or sidebar (via a Text widget), enter the following <a href="http://codex.wordpress.org/Shortcode_API" target="_blank">shortcode</a>: <b>[simple-sitemap]</b></div>
@@ -217,20 +221,20 @@ function wpss_validate_options($input) {
217
  // *** START - Plugin Core Functions ***
218
  // ***************************************
219
 
220
- function parameter_queryvars( $qvars ) {
221
  $qvars[] = 'pagesort';
222
  $qvars[] = 'postsort';
223
  return $qvars;
224
  }
225
 
226
- function page_params() {
227
  global $wp_query;
228
  if (isset($wp_query->query_vars['pagesort'])) {
229
  return $wp_query->query_vars['pagesort'];
230
  }
231
  }
232
 
233
- function post_params() {
234
  global $wp_query;
235
  if (isset($wp_query->query_vars['postsort'])) {
236
  return $wp_query->query_vars['postsort'];
@@ -257,8 +261,8 @@ function wpss_gen() {
257
  }
258
 
259
  /* Sort by value in drop down box (make sure drop down default is title which is the default used by wp_list_pages). */
260
- $page_params = page_params();
261
- $post_params = post_params();
262
 
263
  $opt = get_option('wpss_options');
264
  //echo '$opt[\'drp_pages_default\'] = '.$opt['drp_pages_default'].'<br />';
@@ -481,7 +485,7 @@ function wpss_gen() {
481
  ?><div class="ss_date_header">
482
  <?php
483
  global $wpdb;
484
- $months = $wpdb->get_results("SELECT DISTINCT MONTH(post_date) AS month , YEAR(post_date) AS year FROM $wpdb->posts WHERE post_status = 'publish' and post_date <= now( ) and post_type = 'post' GROUP BY month, year ORDER BY post_date DESC");
485
  foreach($months as $curr_month){
486
  query_posts('posts_per_page=-1&post_status=publish&monthnum='.$curr_month->month.'&year='.$curr_month->year); // show posts ?>
487
  <?php
3
  Plugin Name: Simple Sitemap
4
  Plugin URI: http://www.presscoders.com/plugins/free-plugins/simple-sitemap/
5
  Description: HTML sitemap to display content as a single linked list of posts and pages, or as groups sorted by taxonomy (via a drop-down box).
6
+ Version: 1.53
7
  Author: David Gwyer
8
  Author URI: http://www.presscoders.com
9
  */
26
  */
27
 
28
  /* @todo:
29
+ - Get rid of query_posts().
30
+ - Enable responsive wrapping so that if there is space multiple columns will span across the page and automatically wrap to the next line when not enough space.
31
+ - Add archive pages to sitemap: http://wordpress.org/support/topic/include-archive-urls.
32
  - Be able to sort ascending/descending in addition to the sort drop down options for each list.
33
  - Add all Plugin options page in-line styles to external style sheet.
34
  - Options to display custom post types, with ability to show which custom post types to display or not display, and in what order?
35
+ - Consider adding a drop down in Plugin options to show the page hierarchy as it appears in 'Pages' (i.e. the way it works now), or to show it via a defined custom menu hierarchy.
36
  - Add option to remove certain tags, categories, or posts.
37
  - Use the 'prepare' WP feature when querying the db directly.
38
+ - Use translation functions _e(), __() etc. Add Plugin text domain too.
39
  - Show all the posts in each category not just the maximum allowed in Settings -> Reading.
40
  - Update Plugin description and other sections, as well as the images which are out of date (show the single column working on the sidebar).
41
  - Maybe support shortcode attributes so that users can specify to add custom behaviour for individual sitemaps if more than one is needed on a site. Any attributes would override global Plugin settings that affects all sitemaps by default.
42
+ - Be able to exclude certain categories from showing.
43
  */
44
 
45
  /* wpss_ prefix is derived from [W]ord[P]ress [s]imple [s]itemap. */
46
  add_shortcode('simple-sitemap', 'wpss_gen');
47
+ add_filter('query_vars', 'wpss_parameter_queryvars' );
48
 
49
  register_activation_hook(__FILE__, 'wpss_add_defaults');
50
  register_uninstall_hook(__FILE__, 'wpss_delete_plugin_options');
116
  <h2>Simple Sitemap Options</h2>
117
 
118
  <div style="margin-top:15px;">
119
+ <p>Here's a little a bonus AVAILABLE ONLY to our free Plugin users! <a href="http://www.presscoders.com/designfolio-offer/" target="_blank"><strong>Get $20 OFF</strong></a> the price of our fully responsive, cutting edge <a href="http://www.presscoders.com/designfolio-offer/" target="_blank">Designfolio</a> theme.</p>
120
  </div>
121
 
122
  <div style="background:#eee;border: 1px dashed #ccc;font-size: 13px;margin: 20px 0 10px 0;padding: 5px 0 5px 8px;">To display the Simple Sitemap on a post, page, or sidebar (via a Text widget), enter the following <a href="http://codex.wordpress.org/Shortcode_API" target="_blank">shortcode</a>: <b>[simple-sitemap]</b></div>
221
  // *** START - Plugin Core Functions ***
222
  // ***************************************
223
 
224
+ function wpss_parameter_queryvars( $qvars ) {
225
  $qvars[] = 'pagesort';
226
  $qvars[] = 'postsort';
227
  return $qvars;
228
  }
229
 
230
+ function wpss_page_params() {
231
  global $wp_query;
232
  if (isset($wp_query->query_vars['pagesort'])) {
233
  return $wp_query->query_vars['pagesort'];
234
  }
235
  }
236
 
237
+ function wpss_post_params() {
238
  global $wp_query;
239
  if (isset($wp_query->query_vars['postsort'])) {
240
  return $wp_query->query_vars['postsort'];
261
  }
262
 
263
  /* Sort by value in drop down box (make sure drop down default is title which is the default used by wp_list_pages). */
264
+ $page_params = wpss_page_params();
265
+ $post_params = wpss_post_params();
266
 
267
  $opt = get_option('wpss_options');
268
  //echo '$opt[\'drp_pages_default\'] = '.$opt['drp_pages_default'].'<br />';
485
  ?><div class="ss_date_header">
486
  <?php
487
  global $wpdb;
488
+ $months = $wpdb->get_results($wpdb->prepare( "SELECT DISTINCT MONTH(post_date) AS month , YEAR(post_date) AS year FROM $wpdb->posts WHERE post_status = %s and post_date <= now( ) and post_type = %s GROUP BY month, year ORDER BY post_date DESC", 'publish', 'post' ));
489
  foreach($months as $curr_month){
490
  query_posts('posts_per_page=-1&post_status=publish&monthnum='.$curr_month->month.'&year='.$curr_month->year); // show posts ?>
491
  <?php