Simple Sitemap – Automatically Generate a Responsive Sitemap - Version 1.7

Version Description

Download this release

Release Info

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

Code changes from version 1.65 to 1.7

Files changed (2) hide show
  1. readme.txt +5 -1
  2. simple-sitemap.php +48 -35
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: dgwyer
3
  Tags: sitemap, html, global, sort, shortcode, pages, posts
4
  Requires at least: 2.7
5
  Tested up to: 4.0
6
- Stable tag: 1.65
7
 
8
  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).
9
 
@@ -59,6 +59,10 @@ See our <a href="http://www.wpgothemes.com" target="_blank">WordPress developmen
59
 
60
  == Changelog ==
61
 
 
 
 
 
62
  *1.65 update*
63
 
64
  * More settings page updates.
3
  Tags: sitemap, html, global, sort, shortcode, pages, posts
4
  Requires at least: 2.7
5
  Tested up to: 4.0
6
+ Stable tag: 1.7
7
 
8
  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).
9
 
59
 
60
  == Changelog ==
61
 
62
+ *1.7 update*
63
+
64
+ * Translation support added!
65
+
66
  *1.65 update*
67
 
68
  * More settings page updates.
simple-sitemap.php CHANGED
@@ -3,9 +3,10 @@
3
  Plugin Name: Simple Sitemap
4
  Plugin URI: http://wordpress.org/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.65
7
  Author: David Gwyer
8
  Author URI: http://www.wpgothemes.com
 
9
  */
10
 
11
  /* Copyright 2009 David Gwyer (email : david@wpgothemes.com)
@@ -26,6 +27,9 @@ Author URI: http://www.wpgothemes.com
26
  */
27
 
28
  /* @todo:
 
 
 
29
  * - Redo Plugin screenshots.
30
  * - Add text box that allows you to enter a comma separated list of custom post type names to exclude from the front end sitemap. Maybe only show this text box if the checkbox to show cpt is selected. For convenience, show a current list of cpt names that can be excluded.
31
  * - Add option that if a page ID is excluded, it also excludes its children?
@@ -54,6 +58,7 @@ add_action( 'admin_init', 'wpss_init' );
54
  add_action( 'admin_menu', 'wpss_add_options_page' );
55
  add_filter( 'plugin_action_links', 'wpss_plugin_action_links', 10, 2 );
56
  add_filter( 'widget_text', 'do_shortcode' ); // make sitemap shortcode work in text widgets
 
57
 
58
  /* Delete options table entries ONLY when plugin deactivated AND deleted. */
59
  function wpss_delete_plugin_options() {
@@ -98,95 +103,95 @@ function wpss_init() {
98
 
99
  /* Add menu page. */
100
  function wpss_add_options_page() {
101
- add_options_page( 'Simple Sitemap Options Page', 'Simple Sitemap', 'manage_options', __FILE__, 'wpss_render_form' );
102
  }
103
 
104
  /* Draw the menu page itself. */
105
  function wpss_render_form() {
106
  ?>
107
  <div class="wrap">
108
- <h2>Simple Sitemap Options</h2>
109
 
110
- <div style="background:#fff;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
111
- <a href="http://codex.wordpress.org/Shortcode_API" target="_blank">shortcode</a>: <b><code>[simple-sitemap]</code></b>
112
  </div>
113
  <form method="post" action="options.php">
114
  <?php settings_fields( 'wpss_plugin_options' ); ?>
115
  <?php $options = get_option( 'wpss_options' ); ?>
116
  <table class="form-table">
117
  <tr>
118
- <th scope="row">Pages Default List Type</th>
119
  <td>
120
  <select style="width:90px;" name='wpss_options[drp_pages_default]'>
121
- <option value='post_title' <?php selected( 'post_title', $options['drp_pages_default'] ); ?>>Title</option>
122
- <option value='post_date' <?php selected( 'post_date', $options['drp_pages_default'] ); ?>>Date</option>
123
- <option value='post_author' <?php selected( 'post_author', $options['drp_pages_default'] ); ?>>Author</option>
124
  </select>
125
  </td>
126
  </tr>
127
 
128
  <tr>
129
- <th scope="row">Posts Default List Type</th>
130
  <td>
131
  <select style="width:90px;" name='wpss_options[drp_posts_default]'>
132
- <option value='title' <?php selected( 'title', $options['drp_posts_default'] ); ?>>Title</option>
133
- <option value='date' <?php selected( 'date', $options['drp_posts_default'] ); ?>>Date</option>
134
- <option value='author' <?php selected( 'author', $options['drp_posts_default'] ); ?>>Author</option>
135
- <option value='category' <?php selected( 'category', $options['drp_posts_default'] ); ?>>Category</option>
136
- <option value='tags' <?php selected( 'tags', $options['drp_posts_default'] ); ?>>Tags</option>
137
  </select>
138
  </td>
139
  </tr>
140
 
141
  <tr>
142
- <th scope="row">Exclude Pages</th>
143
  <td>
144
- <input type="text" size="30" name="wpss_options[txt_page_ids]" value="<?php echo $options['txt_page_ids']; ?>" />
145
 
146
- <p class="description">Enter a comma separated list of Page ID's.</p>
147
  </td>
148
  </tr>
149
 
150
  <tr>
151
- <th scope="row">Show Pages</th>
152
  <td>
153
  <label><input name="wpss_options[chk_show_pages]" type="checkbox" value="1" <?php if ( isset( $options['chk_show_pages'] ) ) {
154
  checked( '1', $options['chk_show_pages'] );
155
- } ?> /> Display pages on front end sitemap?</label>
156
  </td>
157
  </tr>
158
 
159
  <tr>
160
- <th scope="row">Show Posts</th>
161
  <td>
162
  <label><input name="wpss_options[chk_show_posts]" type="checkbox" value="1" <?php if ( isset( $options['chk_show_posts'] ) ) {
163
  checked( '1', $options['chk_show_posts'] );
164
- } ?> /> Display posts on front end sitemap?</label>
165
  </td>
166
  </tr>
167
 
168
  <tr>
169
- <th scope="row">Show Custom Post Types</th>
170
  <td>
171
  <label><input name="wpss_options[chk_show_cpts]" type="checkbox" value="1" <?php if ( isset( $options['chk_show_cpts'] ) ) {
172
  checked( '1', $options['chk_show_cpts'] );
173
- } ?> /> Display Custom Post Types on front end sitemap?</label>
174
  </td>
175
  </tr>
176
 
177
  <tr valign="top" style="border-top:#dddddd 1px solid;">
178
- <th scope="row">Database Options</th>
179
  <td>
180
  <label><input name="wpss_options[chk_default_options_db]" type="checkbox" value="1" <?php if ( isset( $options['chk_default_options_db'] ) ) {
181
  checked( '1', $options['chk_default_options_db'] );
182
- } ?> /> Restore Plugin defaults upon deactivation/reactivation</label>
183
 
184
- <p class="description">Only check this if you want to reset plugin settings upon reactivation</p>
185
  </td>
186
  </tr>
187
  </table>
188
  <p class="submit">
189
- <input type="submit" class="button-primary" value="<?php _e( 'Save Changes' ) ?>" />
190
  </p>
191
  </form>
192
 
@@ -194,16 +199,16 @@ function wpss_render_form() {
194
 
195
  $discount_date = "14th August 2014";
196
  if( strtotime($discount_date) > strtotime('now') ) {
197
- echo '<p style="background: #fff;border: 1px dashed #ccc;font-size: 13px;margin: 0 0 10px 0;padding: 5px 0 5px 8px;">For a limited time only! <strong>Get 50% OFF</strong> the price of our brand new mobile ready, fully responsive <a href="http://www.wpgothemes.com/themes/minn/" target="_blank"><strong>Minn WordPress theme</strong></a>. Simply enter the following code at checkout: <code>MINN50OFF</code></p>';
198
  } else {
199
- echo '<p style="background: #eee;border: 1px dashed #ccc;font-size: 13px;margin: 0 0 10px 0;padding: 5px 0 5px 8px;">As a user of our free plugins here\'s a bonus just for you! <strong>Get 30% OFF</strong> the price of our brand new mobile ready, fully responsive <a href="http://www.wpgothemes.com/themes/minn/" target="_blank"><strong>Minn WordPress theme</strong></a>. Simply enter the following code at checkout: <code>WPGO30OFF</code></p>';
200
  }
201
 
202
  ?>
203
 
204
  <div style="clear:both;">
205
  <p>
206
- <a href="http://www.twitter.com/dgwyer" title="Follow me Twitter!" target="_blank"><img src="<?php echo plugins_url(); ?>/simple-sitemap/images/twitter.png" /></a>&nbsp;&nbsp;
207
  <input class="button" style="vertical-align:12px;" type="button" value="Visit Our NEW Site!" onClick="window.open('http://www.wpgothemes.com')">
208
  <input class="button" style="vertical-align:12px;" type="button" value="Minn, Our Latest Theme" onClick="window.open('http://www.wpgothemes.com/themes/minn')">
209
  </p>
@@ -267,7 +272,7 @@ function wpss_gen() {
267
 
268
  <div id="ss_pages">
269
 
270
- <h2 class='page_heading'>Pages</h2>
271
 
272
  <?php
273
  if ( strpos( $page_params, 'post_date' ) !== false ) {
@@ -295,7 +300,7 @@ function wpss_gen() {
295
  wp_list_pages( $page_args );
296
  echo "</ul></div>";
297
  } else {
298
- echo "<div class='page_author'>$author->display_name <span class=\"ss_sticky\">(no pages published)</span></div>";
299
  }
300
  } ?>
301
  <?php
@@ -315,7 +320,7 @@ function wpss_gen() {
315
  <?php if ( isset( $opt['chk_show_posts'] ) && $opt['chk_show_posts'] ) : ?>
316
 
317
  <div id="ss_posts">
318
- <h2 class='post_heading'>Posts</h2>
319
 
320
  <?php
321
  if ( strpos( $post_params, 'category' ) !== false ) {
@@ -495,7 +500,7 @@ function wpss_gen() {
495
  function wpss_plugin_action_links( $links, $file ) {
496
 
497
  if ( $file == plugin_basename( __FILE__ ) ) {
498
- $posk_links = '<a href="' . get_admin_url() . 'options-general.php?page=simple-sitemap/simple-sitemap.php">' . __( 'Settings' ) . '</a>';
499
  // make the 'Settings' link appear first
500
  array_unshift( $links, $posk_links );
501
  }
@@ -511,4 +516,12 @@ function wpss_validate_options( $input ) {
511
  $input['txt_page_ids'] = sanitize_text_field( $input['txt_page_ids'] );
512
 
513
  return $input;
 
 
 
 
 
 
 
 
514
  }
3
  Plugin Name: Simple Sitemap
4
  Plugin URI: http://wordpress.org/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.7
7
  Author: David Gwyer
8
  Author URI: http://www.wpgothemes.com
9
+ Text Domain: simple-sitemap
10
  */
11
 
12
  /* Copyright 2009 David Gwyer (email : david@wpgothemes.com)
27
  */
28
 
29
  /* @todo:
30
+ * - If bbPress is activated then it indexes my bbpress forums as: forums, topics, replies. When I add options to show a list of CPT to display/hide
31
+ * then make sure these three are showing in the list so users can manage visibility.
32
+ * - Change the exclude page ID setting to be valid for all post types, just input a list of post id's to exclude.
33
  * - Redo Plugin screenshots.
34
  * - Add text box that allows you to enter a comma separated list of custom post type names to exclude from the front end sitemap. Maybe only show this text box if the checkbox to show cpt is selected. For convenience, show a current list of cpt names that can be excluded.
35
  * - Add option that if a page ID is excluded, it also excludes its children?
58
  add_action( 'admin_menu', 'wpss_add_options_page' );
59
  add_filter( 'plugin_action_links', 'wpss_plugin_action_links', 10, 2 );
60
  add_filter( 'widget_text', 'do_shortcode' ); // make sitemap shortcode work in text widgets
61
+ add_action( 'plugins_loaded', 'wpss_localize_plugin' );
62
 
63
  /* Delete options table entries ONLY when plugin deactivated AND deleted. */
64
  function wpss_delete_plugin_options() {
103
 
104
  /* Add menu page. */
105
  function wpss_add_options_page() {
106
+ add_options_page( __( 'Simple Sitemap Options Page', 'simple-sitemap' ), __( 'Simple Sitemap', 'simple-sitemap' ), 'manage_options', __FILE__, 'wpss_render_form' );
107
  }
108
 
109
  /* Draw the menu page itself. */
110
  function wpss_render_form() {
111
  ?>
112
  <div class="wrap">
113
+ <h2><?php _e( 'Simple Sitemap Options', 'simple-sitemap' ); ?></h2>
114
 
115
+ <div style="background:#fff;border: 1px dashed #ccc;font-size: 13px;margin: 20px 0 10px 0;padding: 5px 0 5px 8px;">
116
+ <?php printf( __( 'To display the Simple Sitemap on a post, page, or sidebar (via a Text widget), enter the following %1$s shortcode %2$s:', 'simple-sitemap' ), '<a href="http://codex.wordpress.org/Shortcode_API" target="_blank">', '</a>' ); ?> <b><code>[simple-sitemap]</code></b>
117
  </div>
118
  <form method="post" action="options.php">
119
  <?php settings_fields( 'wpss_plugin_options' ); ?>
120
  <?php $options = get_option( 'wpss_options' ); ?>
121
  <table class="form-table">
122
  <tr>
123
+ <th scope="row"><?php _e( 'Pages Default List Type', 'simple-sitemap' ); ?></th>
124
  <td>
125
  <select style="width:90px;" name='wpss_options[drp_pages_default]'>
126
+ <option value='post_title' <?php selected( 'post_title', $options['drp_pages_default'] ); ?>><?php _e( 'Title', 'simple-sitemap' ); ?></option>
127
+ <option value='post_date' <?php selected( 'post_date', $options['drp_pages_default'] ); ?>><?php _e( 'Date', 'simple-sitemap' ); ?></option>
128
+ <option value='post_author' <?php selected( 'post_author', $options['drp_pages_default'] ); ?>><?php _e( 'Author', 'simple-sitemap' ); ?></option>
129
  </select>
130
  </td>
131
  </tr>
132
 
133
  <tr>
134
+ <th scope="row"><?php _e( 'Posts Default List Type', 'simple-sitemap' ); ?></th>
135
  <td>
136
  <select style="width:90px;" name='wpss_options[drp_posts_default]'>
137
+ <option value='title' <?php selected( 'title', $options['drp_posts_default'] ); ?>><?php _e( 'Title', 'simple-sitemap' ); ?></option>
138
+ <option value='date' <?php selected( 'date', $options['drp_posts_default'] ); ?>><?php _e( 'Date', 'simple-sitemap' ); ?></option>
139
+ <option value='author' <?php selected( 'author', $options['drp_posts_default'] ); ?>><?php _e( 'Author', 'simple-sitemap' ); ?></option>
140
+ <option value='category' <?php selected( 'category', $options['drp_posts_default'] ); ?>><?php _e( 'Category', 'simple-sitemap' ); ?></option>
141
+ <option value='tags' <?php selected( 'tags', $options['drp_posts_default'] ); ?>><?php _e( 'Tags', 'simple-sitemap' ); ?></option>
142
  </select>
143
  </td>
144
  </tr>
145
 
146
  <tr>
147
+ <th scope="row"><?php _e( 'Exclude Pages', 'simple-sitemap' ); ?></th>
148
  <td>
149
+ <input type="text" size="30" name="wpss_options[txt_page_ids]" value="<?php echo $options['txt_page_ids']; ?>">
150
 
151
+ <p class="description"><?php _e( 'Enter a comma separated list of Page ID\'s.', 'simple-sitemap' ); ?></p>
152
  </td>
153
  </tr>
154
 
155
  <tr>
156
+ <th scope="row"><?php _e( 'Show Pages', 'simple-sitemap' ); ?></th>
157
  <td>
158
  <label><input name="wpss_options[chk_show_pages]" type="checkbox" value="1" <?php if ( isset( $options['chk_show_pages'] ) ) {
159
  checked( '1', $options['chk_show_pages'] );
160
+ } ?>> <?php _e( 'Display pages on front end sitemap?', 'simple-sitemap' ); ?></label>
161
  </td>
162
  </tr>
163
 
164
  <tr>
165
+ <th scope="row"><?php _e( 'Show Posts', 'simple-sitemap' ); ?></th>
166
  <td>
167
  <label><input name="wpss_options[chk_show_posts]" type="checkbox" value="1" <?php if ( isset( $options['chk_show_posts'] ) ) {
168
  checked( '1', $options['chk_show_posts'] );
169
+ } ?>> <?php _e( 'Display posts on front end sitemap?', 'simple-sitemap' ); ?></label>
170
  </td>
171
  </tr>
172
 
173
  <tr>
174
+ <th scope="row"><?php _e( 'Show Custom Post Types', 'simple-sitemap' ); ?></th>
175
  <td>
176
  <label><input name="wpss_options[chk_show_cpts]" type="checkbox" value="1" <?php if ( isset( $options['chk_show_cpts'] ) ) {
177
  checked( '1', $options['chk_show_cpts'] );
178
+ } ?>> <?php _e( 'Display Custom Post Types on front end sitemap?', 'simple-sitemap' ); ?></label>
179
  </td>
180
  </tr>
181
 
182
  <tr valign="top" style="border-top:#dddddd 1px solid;">
183
+ <th scope="row"><?php _e( 'Database Options', 'simple-sitemap' ); ?></th>
184
  <td>
185
  <label><input name="wpss_options[chk_default_options_db]" type="checkbox" value="1" <?php if ( isset( $options['chk_default_options_db'] ) ) {
186
  checked( '1', $options['chk_default_options_db'] );
187
+ } ?>> <?php _e( 'Restore Plugin defaults upon deactivation/reactivation', 'simple-sitemap' ); ?></label>
188
 
189
+ <p class="description"><?php _e( 'Only check this if you want to reset plugin settings upon reactivation', 'simple-sitemap' ); ?></p>
190
  </td>
191
  </tr>
192
  </table>
193
  <p class="submit">
194
+ <input type="submit" class="button-primary" value="<?php _e( 'Save Changes', 'simple-sitemap' ) ?>">
195
  </p>
196
  </form>
197
 
199
 
200
  $discount_date = "14th August 2014";
201
  if( strtotime($discount_date) > strtotime('now') ) {
202
+ echo '<p style="background: #fff;border: 1px dashed #ccc;font-size: 13px;margin: 0 0 10px 0;padding: 5px 0 5px 8px;">' . __( 'For a limited time only! <strong>Get 50% OFF</strong> the price of our brand new mobile ready, fully responsive <a href="http://www.wpgothemes.com/themes/minn/" target="_blank"><strong>Minn WordPress theme</strong></a>. Simply enter the following code at checkout: <code>MINN50OFF</code>', 'simple-sitemap' ) . '</p>';
203
  } else {
204
+ echo '<p style="background: #eee;border: 1px dashed #ccc;font-size: 13px;margin: 0 0 10px 0;padding: 5px 0 5px 8px;">' . __( 'As a user of our free plugins here\'s a bonus just for you! <strong>Get 30% OFF</strong> the price of our brand new mobile ready, fully responsive <a href="http://www.wpgothemes.com/themes/minn/" target="_blank"><strong>Minn WordPress theme</strong></a>. Simply enter the following code at checkout: <code>WPGO30OFF</code>', 'simple-sitemap' ) . '</p>';
205
  }
206
 
207
  ?>
208
 
209
  <div style="clear:both;">
210
  <p>
211
+ <a href="http://www.twitter.com/dgwyer" title="Follow me Twitter!" target="_blank"><img src="<?php echo plugins_url(); ?>/simple-sitemap/images/twitter.png"></a>&nbsp;&nbsp;
212
  <input class="button" style="vertical-align:12px;" type="button" value="Visit Our NEW Site!" onClick="window.open('http://www.wpgothemes.com')">
213
  <input class="button" style="vertical-align:12px;" type="button" value="Minn, Our Latest Theme" onClick="window.open('http://www.wpgothemes.com/themes/minn')">
214
  </p>
272
 
273
  <div id="ss_pages">
274
 
275
+ <h2 class='page_heading'><?php _e( 'Pages', 'simple-sitemap' ); ?></h2>
276
 
277
  <?php
278
  if ( strpos( $page_params, 'post_date' ) !== false ) {
300
  wp_list_pages( $page_args );
301
  echo "</ul></div>";
302
  } else {
303
+ echo "<div class='page_author'>$author->display_name <span class=\"ss_sticky\">" . __( '(no pages published)', 'simple-sitemap' ) . "</span></div>";
304
  }
305
  } ?>
306
  <?php
320
  <?php if ( isset( $opt['chk_show_posts'] ) && $opt['chk_show_posts'] ) : ?>
321
 
322
  <div id="ss_posts">
323
+ <h2 class='post_heading'><?php _e( 'Posts', 'simple-sitemap' ); ?></h2>
324
 
325
  <?php
326
  if ( strpos( $post_params, 'category' ) !== false ) {
500
  function wpss_plugin_action_links( $links, $file ) {
501
 
502
  if ( $file == plugin_basename( __FILE__ ) ) {
503
+ $posk_links = '<a href="' . get_admin_url() . 'options-general.php?page=simple-sitemap/simple-sitemap.php">' . __( 'Settings', 'simple-sitemap' ) . '</a>';
504
  // make the 'Settings' link appear first
505
  array_unshift( $links, $posk_links );
506
  }
516
  $input['txt_page_ids'] = sanitize_text_field( $input['txt_page_ids'] );
517
 
518
  return $input;
519
+ }
520
+
521
+ /**
522
+ * Add Plugin localization support.
523
+ */
524
+ function wpss_localize_plugin() {
525
+
526
+ load_plugin_textdomain( 'simple-sitemap', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
527
  }