Sitemap - Version 2.8

Version Description

  • added "strip_shortcodes" parameter;
Download this release

Release Info

Developer webvitaly
Plugin Icon wp plugin Sitemap
Version 2.8
Comparing to
See all releases

Code changes from version 2.6 to 2.8

Files changed (2) hide show
  1. readme.txt +27 -20
  2. sitemap.php +40 -38
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: page, page-list, pagelist, sitemap, subpages, siblings
5
  Author URI: http://web-profile.com.ua/wordpress/
6
  Requires at least: 3.0
7
  Tested up to: 3.3
8
- Stable tag: 2.6
9
 
10
  "Sitemap" plugin helps you to show list of pages with [pagelist], [subpages], [siblings] and [pagelist_ext] shortcodes.
11
 
@@ -74,6 +74,7 @@ You can use aditional parameters: **`[pagelist_ext child_of="4" exclude="6,7,8"
74
  * **post_status** - `[pagelist_ext post_status="publish"]`;
75
  * **class** - if you want to specify the CSS class for list of pages you can use this shortcode: `[pagelist_ext class="listclass"]`; by default the class is empty (class="");
76
  * **strip_tags** - if you want to output the content with tags use this shortcode: `[pagelist_ext strip_tags="0"]`; by default the strip_tags is enabled (strip_tags="1");
 
77
  * **show_child_count** - if you want to show child count you can use this shortcode: `[pagelist_ext show_child_count="1"]`; by default the child_count is disabled (show_child_count="0"); If show_child_count="1", but count of subpages=0, than child count is not showing;
78
  * **child_count_template** - if you want to specify the template of child_count you can use this shortcode: `[pagelist_ext show_child_count="1" child_count_template="Subpages: %child_count%"]`; by default child_count_template="Subpages: %child_count%";
79
  * **show_meta_key** - if you want to show meta key you can use this shortcode: `[pagelist_ext show_meta_key="your_meta_key"]`; by default the show_meta_key is empty (show_meta_key=""); If show_meta_key is enabled, but meta_value is empty, than meta_key is not showing;
@@ -86,56 +87,62 @@ You can use aditional parameters: **`[pagelist_ext child_of="4" exclude="6,7,8"
86
 
87
  == Changelog ==
88
 
 
 
 
 
 
 
89
  = 2.6 =
90
- * Fixed [pagelist_ext] "parent" parameter;
91
 
92
  = 2.5 =
93
- * Adding spaces between lines when tags are stripped in [pagelist_ext];
94
 
95
  = 2.4 =
96
- * Escaping attributes in title in [pagelist_ext];
97
 
98
  = 2.3 =
99
- * Fixed [pagelist_ext] with showing excerpt of the page if it is not empty, else showing content;
100
 
101
  = 2.2 =
102
- * Fixed offset parameter;
103
 
104
  = 2.1 =
105
- * Fixed number parameter;
106
 
107
  = 2.0 =
108
- * Fixed crash bug with [pagelist_ext] if theme does not have thumbnail feature;
109
 
110
  = 1.9 =
111
- * Added show_child_count parameter;
112
- * Added show_meta_key parameter;
113
 
114
  = 1.8 =
115
- * Added screenshots;
116
- * Improved parameter parsing;
117
 
118
  = 1.7 =
119
- * Added strip_tags parameter;
120
 
121
  = 1.6 =
122
- * Improved [pagelist_ext] shortcode: added content to list, added toggle show and limit content parameters;
123
 
124
  = 1.5 =
125
- * Added [pagelist_ext] shortcode - list of pages with featured image;
126
 
127
  = 1.4 =
128
- * Added exclude="current" parameter;
129
 
130
  = 1.3.0 =
131
- * Added class to ul elements by default;
132
- * Added "class" option (thanks to Arvind);
133
 
134
  = 1.2.0 =
135
- * Added [subpages] and [siblings] shortcodes;
136
 
137
  = 1.0.0 =
138
- * Initial release;
139
 
140
  == Installation ==
141
 
5
  Author URI: http://web-profile.com.ua/wordpress/
6
  Requires at least: 3.0
7
  Tested up to: 3.3
8
+ Stable tag: 2.8
9
 
10
  "Sitemap" plugin helps you to show list of pages with [pagelist], [subpages], [siblings] and [pagelist_ext] shortcodes.
11
 
74
  * **post_status** - `[pagelist_ext post_status="publish"]`;
75
  * **class** - if you want to specify the CSS class for list of pages you can use this shortcode: `[pagelist_ext class="listclass"]`; by default the class is empty (class="");
76
  * **strip_tags** - if you want to output the content with tags use this shortcode: `[pagelist_ext strip_tags="0"]`; by default the strip_tags is enabled (strip_tags="1");
77
+ * **strip_shortcodes** - if you want to output the content with shortcode use this shortcode: `[pagelist_ext strip_shortcodes="0"]`; by default the strip_shortcodes is enabled (strip_shortcodes="1") and all registered shortcodes are removed;
78
  * **show_child_count** - if you want to show child count you can use this shortcode: `[pagelist_ext show_child_count="1"]`; by default the child_count is disabled (show_child_count="0"); If show_child_count="1", but count of subpages=0, than child count is not showing;
79
  * **child_count_template** - if you want to specify the template of child_count you can use this shortcode: `[pagelist_ext show_child_count="1" child_count_template="Subpages: %child_count%"]`; by default child_count_template="Subpages: %child_count%";
80
  * **show_meta_key** - if you want to show meta key you can use this shortcode: `[pagelist_ext show_meta_key="your_meta_key"]`; by default the show_meta_key is empty (show_meta_key=""); If show_meta_key is enabled, but meta_value is empty, than meta_key is not showing;
87
 
88
  == Changelog ==
89
 
90
+ = 2.8 =
91
+ * added "strip_shortcodes" parameter;
92
+
93
+ = 2.7 =
94
+ * make excerpt link if there is no title;
95
+
96
  = 2.6 =
97
+ * fixed [pagelist_ext] "parent" parameter;
98
 
99
  = 2.5 =
100
+ * adding spaces between lines when tags are stripped in [pagelist_ext];
101
 
102
  = 2.4 =
103
+ * escaping attributes in title in [pagelist_ext];
104
 
105
  = 2.3 =
106
+ * fixed [pagelist_ext] with showing excerpt of the page if it is not empty, else showing content;
107
 
108
  = 2.2 =
109
+ * fixed offset parameter;
110
 
111
  = 2.1 =
112
+ * fixed number parameter;
113
 
114
  = 2.0 =
115
+ * fixed crash bug with [pagelist_ext] if theme does not have thumbnail feature;
116
 
117
  = 1.9 =
118
+ * added show_child_count parameter;
119
+ * added show_meta_key parameter;
120
 
121
  = 1.8 =
122
+ * added screenshots;
123
+ * improved parameter parsing;
124
 
125
  = 1.7 =
126
+ * added strip_tags parameter;
127
 
128
  = 1.6 =
129
+ * improved [pagelist_ext] shortcode: added content to list, added toggle show and limit content parameters;
130
 
131
  = 1.5 =
132
+ * added [pagelist_ext] shortcode - list of pages with featured image;
133
 
134
  = 1.4 =
135
+ * added exclude="current" parameter;
136
 
137
  = 1.3.0 =
138
+ * added class to ul elements by default;
139
+ * added "class" option (thanks to Arvind);
140
 
141
  = 1.2.0 =
142
+ * added [subpages] and [siblings] shortcodes;
143
 
144
  = 1.0.0 =
145
+ * initial release;
146
 
147
  == Installation ==
148
 
sitemap.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Sitemap
4
  Plugin URI: http://web-profile.com.ua/wordpress/plugins/page-list/
5
  Description: Show list of pages with [pagelist], [subpages], [siblings] and [pagelist_ext] shortcodes.
6
- Version: 2.6
7
  Author: webvitaly
8
  Author Email: webvitaly(at)gmail.com
9
  Author URI: http://web-profile.com.ua/wordpress/
@@ -14,14 +14,16 @@ Future features:
14
  - exclude_post_page;
15
  */
16
 
17
- add_action('wp_print_styles', 'page_list_add_stylesheet');
18
- function page_list_add_stylesheet() {
19
- wp_enqueue_style( 'page-list-style', plugins_url( '/css/page-list.css', __FILE__ ), false, '2.6', 'all' );
20
  }
21
 
 
 
22
  if ( !function_exists('pagelist_shortcode') ) {
23
  function pagelist_shortcode( $atts ) {
24
- global $post;
25
  $return = '';
26
  extract( shortcode_atts( array(
27
  'depth' => '0',
@@ -66,7 +68,7 @@ if ( !function_exists('pagelist_shortcode') ) {
66
  $list_pages = wp_list_pages( $page_list_args );
67
 
68
  if ($list_pages) {
69
- $return = "\n".'<!-- powered by Page-list plugin ver.2.6 (wordpress.org/extend/plugins/page-list/) -->'."\n";
70
  $return .= '<ul class="page-list '.$class.'">'."\n".$list_pages."\n".'</ul>';
71
  }else{
72
  $return = '';
@@ -81,7 +83,7 @@ if ( !function_exists('pagelist_shortcode') ) {
81
 
82
  if ( !function_exists('subpages_shortcode') ) {
83
  function subpages_shortcode( $atts ) {
84
- global $post;
85
  $return = '';
86
  extract( shortcode_atts( array(
87
  'depth' => '0',
@@ -126,7 +128,7 @@ if ( !function_exists('subpages_shortcode') ) {
126
  $list_pages = wp_list_pages( $page_list_args );
127
 
128
  if ($list_pages) {
129
- $return = "\n".'<!-- powered by Page-list plugin ver.2.6 (wordpress.org/extend/plugins/page-list/) -->'."\n";
130
  $return .= '<ul class="page-list subpages-page-list '.$class.'">'."\n".$list_pages."\n".'</ul>';
131
  }else{
132
  $return = '';
@@ -141,7 +143,7 @@ if ( !function_exists('subpages_shortcode') ) {
141
 
142
  if ( !function_exists('siblings_shortcode') ) {
143
  function siblings_shortcode( $atts ) {
144
- global $post;
145
  $return = '';
146
  extract( shortcode_atts( array(
147
  'depth' => '0',
@@ -190,7 +192,7 @@ if ( !function_exists('siblings_shortcode') ) {
190
  $list_pages = wp_list_pages( $page_list_args );
191
 
192
  if ($list_pages) {
193
- $return = "\n".'<!-- powered by Page-list plugin ver.2.6 (wordpress.org/extend/plugins/page-list/) -->'."\n";
194
  $return .= '<ul class="page-list siblings-page-list '.$class.'">'."\n".$list_pages."\n".'</ul>';
195
  }else{
196
  $return = '';
@@ -202,7 +204,7 @@ if ( !function_exists('siblings_shortcode') ) {
202
 
203
  if ( !function_exists('pagelist_ext_shortcode') ) {
204
  function pagelist_ext_shortcode( $atts ) {
205
- global $post;
206
  $return = '';
207
  extract( shortcode_atts( array(
208
  'show_image' => 1,
@@ -228,6 +230,7 @@ if ( !function_exists('pagelist_ext_shortcode') ) {
228
  'post_status' => 'publish',
229
  'class' => '',
230
  'strip_tags' => 1,
 
231
  'show_child_count' => 0,
232
  'child_count_template' => 'Subpages: %child_count%',
233
  'show_meta_key' => '',
@@ -262,6 +265,7 @@ if ( !function_exists('pagelist_ext_shortcode') ) {
262
  'post_status' => $post_status,
263
  'class' => $class,
264
  'strip_tags' => $strip_tags,
 
265
  'show_child_count' => $show_child_count,
266
  'child_count_template' => $child_count_template,
267
  'show_meta_key' => $show_meta_key,
@@ -301,8 +305,12 @@ if ( !function_exists('pagelist_ext_shortcode') ) {
301
  }else{
302
  $text_content = $page->post_content;
303
  }
304
- $content = page_list_parse_content( $text_content, $limit_content, $strip_tags );
 
 
 
305
  $list_pages_html .= '<div class="page-list-ext-item-content">'.$content.'</div>';
 
306
  }
307
  if( $show_child_count == 1 ){
308
  $count_subpages = count(get_pages("child_of=".$page->ID));
@@ -335,7 +343,7 @@ if ( !function_exists('pagelist_ext_shortcode') ) {
335
  }
336
  }
337
  if ($list_pages_html) {
338
- $return = "\n".'<!-- powered by Page-list plugin ver.2.6 (wordpress.org/extend/plugins/page-list/) -->'."\n";
339
  $return .= '<div class="page-list page-list-ext '.$class.'">'."\n".$list_pages_html."\n".'</div>';
340
  }else{
341
  $return = '';
@@ -358,35 +366,29 @@ if ( !function_exists('pagelist_norm_params') ) {
358
  }
359
 
360
  if ( !function_exists('page_list_parse_content') ) {
361
- function page_list_parse_content($content, $limit_content = 250, $strip_tags = 1) {
362
  $output = '';
363
- if ( preg_match('/<!--more(.*?)?-->/', $content, $matches) ) {
364
- $content = explode($matches[0], $content, 2);
365
-
366
- } else {
367
- if( $strip_tags ){
368
- $content = str_replace('</', ' </', $content);
369
- $content_stripped = strip_tags($content); // ,'<p>'
370
- }else{
371
- $content_stripped = $content;
372
- }
373
-
374
- if( strlen($content_stripped) > $limit_content ){
375
- $pos = strpos($content_stripped, ' ', $limit_content);
376
- if ($pos !== false) {
377
- $first_space_pos = $pos;
378
- }else{
379
- $first_space_pos = $limit_content;
380
- }
381
- $content_cut = mb_substr($content_stripped, 0, $first_space_pos,'UTF-8');
382
- $content = $content_cut.'...';
383
  }else{
384
- $content = $content_stripped;
385
  }
386
- $content = array($content);
387
  }
388
- $output .= $content[0];
389
- $output = force_balance_tags($output);
390
  return $output;
391
  }
392
  }
3
  Plugin Name: Sitemap
4
  Plugin URI: http://web-profile.com.ua/wordpress/plugins/page-list/
5
  Description: Show list of pages with [pagelist], [subpages], [siblings] and [pagelist_ext] shortcodes.
6
+ Version: 2.8
7
  Author: webvitaly
8
  Author Email: webvitaly(at)gmail.com
9
  Author URI: http://web-profile.com.ua/wordpress/
14
  - exclude_post_page;
15
  */
16
 
17
+ add_action('wp_print_styles', 'pagelist_add_stylesheet');
18
+ function pagelist_add_stylesheet() {
19
+ wp_enqueue_style( 'page-list-style', plugins_url( '/css/page-list.css', __FILE__ ), false, '2.8', 'all' );
20
  }
21
 
22
+ $pagelist_powered_line = "\n".'<!-- powered by Page-list plugin ver.2.8 (wordpress.org/extend/plugins/page-list/) -->'."\n";
23
+
24
  if ( !function_exists('pagelist_shortcode') ) {
25
  function pagelist_shortcode( $atts ) {
26
+ global $post, $pagelist_powered_line;
27
  $return = '';
28
  extract( shortcode_atts( array(
29
  'depth' => '0',
68
  $list_pages = wp_list_pages( $page_list_args );
69
 
70
  if ($list_pages) {
71
+ $return = $pagelist_powered_line;
72
  $return .= '<ul class="page-list '.$class.'">'."\n".$list_pages."\n".'</ul>';
73
  }else{
74
  $return = '';
83
 
84
  if ( !function_exists('subpages_shortcode') ) {
85
  function subpages_shortcode( $atts ) {
86
+ global $post, $pagelist_powered_line;
87
  $return = '';
88
  extract( shortcode_atts( array(
89
  'depth' => '0',
128
  $list_pages = wp_list_pages( $page_list_args );
129
 
130
  if ($list_pages) {
131
+ $return = $pagelist_powered_line;
132
  $return .= '<ul class="page-list subpages-page-list '.$class.'">'."\n".$list_pages."\n".'</ul>';
133
  }else{
134
  $return = '';
143
 
144
  if ( !function_exists('siblings_shortcode') ) {
145
  function siblings_shortcode( $atts ) {
146
+ global $post, $pagelist_powered_line;
147
  $return = '';
148
  extract( shortcode_atts( array(
149
  'depth' => '0',
192
  $list_pages = wp_list_pages( $page_list_args );
193
 
194
  if ($list_pages) {
195
+ $return = $pagelist_powered_line;
196
  $return .= '<ul class="page-list siblings-page-list '.$class.'">'."\n".$list_pages."\n".'</ul>';
197
  }else{
198
  $return = '';
204
 
205
  if ( !function_exists('pagelist_ext_shortcode') ) {
206
  function pagelist_ext_shortcode( $atts ) {
207
+ global $post, $pagelist_powered_line;
208
  $return = '';
209
  extract( shortcode_atts( array(
210
  'show_image' => 1,
230
  'post_status' => 'publish',
231
  'class' => '',
232
  'strip_tags' => 1,
233
+ 'strip_shortcodes' => 1,
234
  'show_child_count' => 0,
235
  'child_count_template' => 'Subpages: %child_count%',
236
  'show_meta_key' => '',
265
  'post_status' => $post_status,
266
  'class' => $class,
267
  'strip_tags' => $strip_tags,
268
+ 'strip_shortcodes' => $strip_shortcodes,
269
  'show_child_count' => $show_child_count,
270
  'child_count_template' => $child_count_template,
271
  'show_meta_key' => $show_meta_key,
305
  }else{
306
  $text_content = $page->post_content;
307
  }
308
+ $content = page_list_parse_content( $text_content, $limit_content, $strip_tags, $strip_shortcodes );
309
+ if( $show_title == 0 ){ // make excerpt link if there is no title
310
+ $content = '<a href="'.$link.'">'.$content.'</a>';
311
+ }
312
  $list_pages_html .= '<div class="page-list-ext-item-content">'.$content.'</div>';
313
+
314
  }
315
  if( $show_child_count == 1 ){
316
  $count_subpages = count(get_pages("child_of=".$page->ID));
343
  }
344
  }
345
  if ($list_pages_html) {
346
+ $return = $pagelist_powered_line;
347
  $return .= '<div class="page-list page-list-ext '.$class.'">'."\n".$list_pages_html."\n".'</div>';
348
  }else{
349
  $return = '';
366
  }
367
 
368
  if ( !function_exists('page_list_parse_content') ) {
369
+ function page_list_parse_content($content, $limit_content = 250, $strip_tags = 1, $strip_shortcodes = 1) {
370
  $output = '';
371
+
372
+ if( $strip_shortcodes ){
373
+ $content = strip_shortcodes( $content );
374
+ }
375
+
376
+ if( $strip_tags ){
377
+ $content = str_replace('</', ' </', $content); // <p>aaa</p><p>bbb</p> - adding space between lines
378
+ $content = strip_tags($content); // ,'<p>'
379
+ }
380
+
381
+ if( strlen($content) > $limit_content ){
382
+ $pos = strpos($content, ' ', $limit_content);
383
+ if ($pos !== false) {
384
+ $first_space_pos = $pos;
 
 
 
 
 
 
385
  }else{
386
+ $first_space_pos = $limit_content;
387
  }
388
+ $content = mb_substr($content, 0, $first_space_pos, 'UTF-8') . '...';
389
  }
390
+
391
+ $output = force_balance_tags($content);
392
  return $output;
393
  }
394
  }