Sitemap - Version 2.9

Version Description

  • added "more_tag" parameter and more tag support;
  • hiding password protected content of the pages;
Download this release

Release Info

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

Code changes from version 2.8 to 2.9

Files changed (2) hide show
  1. readme.txt +9 -4
  2. sitemap.php +28 -11
readme.txt CHANGED
@@ -4,8 +4,8 @@ Plugin URI: http://web-profile.com.ua/wordpress/plugins/page-list/
4
  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.8
9
 
10
  "Sitemap" plugin helps you to show list of pages with [pagelist], [subpages], [siblings] and [pagelist_ext] shortcodes.
11
 
@@ -75,6 +75,7 @@ You can use aditional parameters: **`[pagelist_ext child_of="4" exclude="6,7,8"
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,6 +88,10 @@ You can use aditional parameters: **`[pagelist_ext child_of="4" exclude="6,7,8"
87
 
88
  == Changelog ==
89
 
 
 
 
 
90
  = 2.8 =
91
  * added "strip_shortcodes" parameter;
92
 
@@ -146,5 +151,5 @@ You can use aditional parameters: **`[pagelist_ext child_of="4" exclude="6,7,8"
146
 
147
  == Installation ==
148
 
149
- 1. Install plugin and activate it on the Plugins page;
150
- 2. Add shortcode `[pagelist]`, `[subpages]`, `[siblings]` or `[pagelist_ext]` to page content;
4
  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.1
8
+ Stable tag: 2.9
9
 
10
  "Sitemap" plugin helps you to show list of pages with [pagelist], [subpages], [siblings] and [pagelist_ext] shortcodes.
11
 
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
+ * **more_tag** - if you want to output all content before and after more tag use this shortcode: `[pagelist_ext more_tag="0"]`; by default the more_tag is enabled (more_tag="1") and showing only content before more tag;
79
  * **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;
80
  * **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%";
81
  * **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;
88
 
89
  == Changelog ==
90
 
91
+ = 2.9 =
92
+ * added "more_tag" parameter and more tag support;
93
+ * hiding password protected content of the pages;
94
+
95
  = 2.8 =
96
  * added "strip_shortcodes" parameter;
97
 
151
 
152
  == Installation ==
153
 
154
+ 1. Install and activate the plugin on the Plugins page;
155
+ 2. Add shortcodes to pages: `[pagelist]`, `[subpages]`, `[siblings]`, `[pagelist_ext]`;
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.8
7
  Author: webvitaly
8
  Author Email: webvitaly(at)gmail.com
9
  Author URI: http://web-profile.com.ua/wordpress/
@@ -16,10 +16,10 @@ Future features:
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 ) {
@@ -231,6 +231,7 @@ if ( !function_exists('pagelist_ext_shortcode') ) {
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' => '',
@@ -266,6 +267,7 @@ if ( !function_exists('pagelist_ext_shortcode') ) {
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,
@@ -299,16 +301,24 @@ if ( !function_exists('pagelist_ext_shortcode') ) {
299
  }
300
  if( $show_content == 1 ){
301
  //$content = apply_filters('the_content', $page->post_content);
302
- //$content = str_replace(']]>', ']]&gt;', $content);
 
303
  if( !empty( $page->post_excerpt ) ){
304
  $text_content = $page->post_excerpt;
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
  }
@@ -366,20 +376,27 @@ if ( !function_exists('pagelist_norm_params') ) {
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{
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.9
7
  Author: webvitaly
8
  Author Email: webvitaly(at)gmail.com
9
  Author URI: http://web-profile.com.ua/wordpress/
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.9', 'all' );
20
  }
21
 
22
+ $pagelist_powered_line = "\n".'<!-- Page-list plugin v.2.9 (wordpress.org/extend/plugins/page-list/) -->'."\n";
23
 
24
  if ( !function_exists('pagelist_shortcode') ) {
25
  function pagelist_shortcode( $atts ) {
231
  'class' => '',
232
  'strip_tags' => 1,
233
  'strip_shortcodes' => 1,
234
+ 'more_tag' => 1,
235
  'show_child_count' => 0,
236
  'child_count_template' => 'Subpages: %child_count%',
237
  'show_meta_key' => '',
267
  'class' => $class,
268
  'strip_tags' => $strip_tags,
269
  'strip_shortcodes' => $strip_shortcodes,
270
+ 'more_tag' => $more_tag,
271
  'show_child_count' => $show_child_count,
272
  'child_count_template' => $child_count_template,
273
  'show_meta_key' => $show_meta_key,
301
  }
302
  if( $show_content == 1 ){
303
  //$content = apply_filters('the_content', $page->post_content);
304
+ //$content = str_replace(']]>', ']]&gt;', $content); // both used in default the_content() function
305
+
306
  if( !empty( $page->post_excerpt ) ){
307
  $text_content = $page->post_excerpt;
308
  }else{
309
  $text_content = $page->post_content;
310
  }
311
+
312
+ if ( post_password_required($page) ) {
313
+ $content = '<!-- password protected -->';
314
+ }else{
315
+ $content = page_list_parse_content( $text_content, $limit_content, $strip_tags, $strip_shortcodes, $more_tag );
316
+
317
+ if( $show_title == 0 ){ // make content as a link if there is no title
318
+ $content = '<a href="'.$link.'">'.$content.'</a>';
319
+ }
320
  }
321
+
322
  $list_pages_html .= '<div class="page-list-ext-item-content">'.$content.'</div>';
323
 
324
  }
376
  }
377
 
378
  if ( !function_exists('page_list_parse_content') ) {
379
+ function page_list_parse_content($content, $limit_content = 250, $strip_tags = 1, $strip_shortcodes = 1, $more_tag = 1) {
 
380
 
381
+ if( $more_tag ){
382
+ if ( preg_match('/<!--more(.*?)?-->/', $content, $matches) ) {
383
+ $more_tag = $matches[0];
384
+ $content = explode($matches[0], $content);
385
+ $content = $content[0];
386
+ }
387
+ }
388
+
389
  if( $strip_shortcodes ){
390
  $content = strip_shortcodes( $content );
391
  }
392
 
393
  if( $strip_tags ){
394
+ $content = str_replace('</', ' </', $content); // <p>line1</p><p>line2</p> - adding space between lines
395
  $content = strip_tags($content); // ,'<p>'
396
  }
397
 
398
  if( strlen($content) > $limit_content ){
399
+ $pos = strpos($content, ' ', $limit_content); // find first space position
400
  if ($pos !== false) {
401
  $first_space_pos = $pos;
402
  }else{