Page-list - Version 3.3

Version Description

  • rename "get_first_image" function to "page_list_get_first_image" for avoiding conflicts
Download this release

Release Info

Developer webvitaly
Plugin Icon wp plugin Page-list
Version 3.3
Comparing to
See all releases

Code changes from version 3.2 to 3.3

Files changed (2) hide show
  1. page-list.php +30 -34
  2. readme.txt +50 -35
page-list.php CHANGED
@@ -2,24 +2,19 @@
2
  /*
3
  Plugin Name: Page-list
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: 3.2
7
  Author: webvitaly
8
  Author Email: webvitaly(at)gmail.com
9
  Author URI: http://web-profile.com.ua/wordpress/
10
-
11
- Future features:
12
- - exclude_by_alias;
13
- - exclude_front_page;
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, '3.2', 'all' );
20
  }
21
 
22
- $pagelist_powered_line = "\n".'<!-- Page-list plugin v.3.2 (wordpress.org/extend/plugins/page-list/) -->'."\n";
23
 
24
  if ( !function_exists('pagelist_shortcode') ) {
25
  function pagelist_shortcode( $atts ) {
@@ -43,7 +38,7 @@ if ( !function_exists('pagelist_shortcode') ) {
43
  'link_after' => '',
44
  'class' => ''
45
  ), $atts ) );
46
-
47
  $page_list_args = array(
48
  'depth' => $depth,
49
  'child_of' => pagelist_norm_params($child_of),
@@ -66,7 +61,7 @@ if ( !function_exists('pagelist_shortcode') ) {
66
  'walker' => ''
67
  );
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>';
@@ -103,7 +98,7 @@ if ( !function_exists('subpages_shortcode') ) {
103
  'link_after' => '',
104
  'class' => ''
105
  ), $atts ) );
106
-
107
  $page_list_args = array(
108
  'depth' => $depth,
109
  'child_of' => $post->ID,
@@ -126,7 +121,7 @@ if ( !function_exists('subpages_shortcode') ) {
126
  'walker' => ''
127
  );
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>';
@@ -163,11 +158,11 @@ if ( !function_exists('siblings_shortcode') ) {
163
  'link_after' => '',
164
  'class' => ''
165
  ), $atts ) );
166
-
167
  if( $exclude == 'current' || $exclude == 'this' ){
168
  $exclude = $post->ID;
169
  }
170
-
171
  $page_list_args = array(
172
  'depth' => $depth,
173
  'child_of' => $post->post_parent,
@@ -190,7 +185,7 @@ if ( !function_exists('siblings_shortcode') ) {
190
  'walker' => ''
191
  );
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>';
@@ -238,11 +233,11 @@ if ( !function_exists('pagelist_ext_shortcode') ) {
238
  'show_meta_key' => '',
239
  'meta_template' => '%meta%'
240
  ), $atts ) );
241
-
242
  if( $child_of == '0' ){
243
  $child_of = $post->ID;
244
  }
245
-
246
  $page_list_ext_args = array(
247
  'show_image' => $show_image,
248
  'show_first_image' => $show_first_image,
@@ -297,7 +292,7 @@ if ( !function_exists('pagelist_ext_shortcode') ) {
297
  $list_pages_html .= '</a></div> ';
298
  }else{
299
  if( $show_first_image == 1 ){
300
- $img_scr = get_first_image( $page->post_content );
301
  if( !empty( $img_scr ) ){
302
  $list_pages_html .= '<div class="page-list-ext-image"><a href="'.$link.'" title="'.esc_attr($page->post_title).'">';
303
  $list_pages_html .= '<img src="'.$img_scr.'" width="'.$image_width.'" />'; // not using height="'.$image_height.'" because images could be not square shaped and they will be stretched
@@ -307,7 +302,7 @@ if ( !function_exists('pagelist_ext_shortcode') ) {
307
  }
308
  }else{
309
  if( $show_first_image == 1 ){
310
- $img_scr = get_first_image( $page->post_content );
311
  if( !empty( $img_scr ) ){
312
  $list_pages_html .= '<div class="page-list-ext-image"><a href="'.$link.'" title="'.esc_attr($page->post_title).'">';
313
  $list_pages_html .= '<img src="'.$img_scr.'" width="'.$image_width.'" />'; // not using height="'.$image_height.'" because images could be not square shaped and they will be stretched
@@ -317,7 +312,6 @@ if ( !function_exists('pagelist_ext_shortcode') ) {
317
  }
318
  }
319
 
320
- // get_first_image()
321
 
322
  if( $show_title == 1 ){
323
  $list_pages_html .= '<h3 class="page-list-ext-title"><a href="'.$link.'" title="'.esc_attr($page->post_title).'">'.esc_attr($page->post_title).'</a></h3>';
@@ -325,25 +319,25 @@ if ( !function_exists('pagelist_ext_shortcode') ) {
325
  if( $show_content == 1 ){
326
  //$content = apply_filters('the_content', $page->post_content);
327
  //$content = str_replace(']]>', ']]&gt;', $content); // both used in default the_content() function
328
-
329
  if( !empty( $page->post_excerpt ) ){
330
  $text_content = $page->post_excerpt;
331
  }else{
332
  $text_content = $page->post_content;
333
  }
334
-
335
  if ( post_password_required($page) ) {
336
  $content = '<!-- password protected -->';
337
  }else{
338
  $content = page_list_parse_content( $text_content, $limit_content, $strip_tags, $strip_shortcodes, $more_tag );
339
-
340
  if( $show_title == 0 ){ // make content as a link if there is no title
341
  $content = '<a href="'.$link.'">'.$content.'</a>';
342
  }
343
  }
344
-
345
  $list_pages_html .= '<div class="page-list-ext-item-content">'.$content.'</div>';
346
-
347
  }
348
  if( $show_child_count == 1 ){
349
  $count_subpages = count(get_pages("child_of=".$page->ID));
@@ -456,14 +450,16 @@ if ( !function_exists('page_list_parse_content') ) {
456
  }
457
  }
458
 
459
- function get_first_image( $content='' ) {
460
- $first_img = '';
461
- //ob_start();
462
- //ob_end_clean();
463
- $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $content, $matches);
464
- $first_img = $matches[1][0];
465
- if(empty($first_img)){ // no image found
466
  $first_img = '';
 
 
 
 
 
 
 
 
467
  }
468
- return $first_img;
469
  }
2
  /*
3
  Plugin Name: Page-list
4
  Plugin URI: http://web-profile.com.ua/wordpress/plugins/page-list/
5
+ Description: [pagelist], [subpages], [siblings] and [pagelist_ext] shortcodes
6
+ Version: 3.3
7
  Author: webvitaly
8
  Author Email: webvitaly(at)gmail.com
9
  Author URI: http://web-profile.com.ua/wordpress/
 
 
 
 
 
10
  */
11
 
12
  add_action('wp_print_styles', 'pagelist_add_stylesheet');
13
  function pagelist_add_stylesheet() {
14
+ wp_enqueue_style( 'page-list-style', plugins_url( '/css/page-list.css', __FILE__ ), false, '3.3', 'all' );
15
  }
16
 
17
+ $pagelist_powered_line = "\n".'<!-- Page-list plugin v.3.3 (wordpress.org/extend/plugins/page-list/) -->'."\n";
18
 
19
  if ( !function_exists('pagelist_shortcode') ) {
20
  function pagelist_shortcode( $atts ) {
38
  'link_after' => '',
39
  'class' => ''
40
  ), $atts ) );
41
+
42
  $page_list_args = array(
43
  'depth' => $depth,
44
  'child_of' => pagelist_norm_params($child_of),
61
  'walker' => ''
62
  );
63
  $list_pages = wp_list_pages( $page_list_args );
64
+
65
  if ($list_pages) {
66
  $return = $pagelist_powered_line;
67
  $return .= '<ul class="page-list '.$class.'">'."\n".$list_pages."\n".'</ul>';
98
  'link_after' => '',
99
  'class' => ''
100
  ), $atts ) );
101
+
102
  $page_list_args = array(
103
  'depth' => $depth,
104
  'child_of' => $post->ID,
121
  'walker' => ''
122
  );
123
  $list_pages = wp_list_pages( $page_list_args );
124
+
125
  if ($list_pages) {
126
  $return = $pagelist_powered_line;
127
  $return .= '<ul class="page-list subpages-page-list '.$class.'">'."\n".$list_pages."\n".'</ul>';
158
  'link_after' => '',
159
  'class' => ''
160
  ), $atts ) );
161
+
162
  if( $exclude == 'current' || $exclude == 'this' ){
163
  $exclude = $post->ID;
164
  }
165
+
166
  $page_list_args = array(
167
  'depth' => $depth,
168
  'child_of' => $post->post_parent,
185
  'walker' => ''
186
  );
187
  $list_pages = wp_list_pages( $page_list_args );
188
+
189
  if ($list_pages) {
190
  $return = $pagelist_powered_line;
191
  $return .= '<ul class="page-list siblings-page-list '.$class.'">'."\n".$list_pages."\n".'</ul>';
233
  'show_meta_key' => '',
234
  'meta_template' => '%meta%'
235
  ), $atts ) );
236
+
237
  if( $child_of == '0' ){
238
  $child_of = $post->ID;
239
  }
240
+
241
  $page_list_ext_args = array(
242
  'show_image' => $show_image,
243
  'show_first_image' => $show_first_image,
292
  $list_pages_html .= '</a></div> ';
293
  }else{
294
  if( $show_first_image == 1 ){
295
+ $img_scr = page_list_get_first_image( $page->post_content );
296
  if( !empty( $img_scr ) ){
297
  $list_pages_html .= '<div class="page-list-ext-image"><a href="'.$link.'" title="'.esc_attr($page->post_title).'">';
298
  $list_pages_html .= '<img src="'.$img_scr.'" width="'.$image_width.'" />'; // not using height="'.$image_height.'" because images could be not square shaped and they will be stretched
302
  }
303
  }else{
304
  if( $show_first_image == 1 ){
305
+ $img_scr = page_list_get_first_image( $page->post_content );
306
  if( !empty( $img_scr ) ){
307
  $list_pages_html .= '<div class="page-list-ext-image"><a href="'.$link.'" title="'.esc_attr($page->post_title).'">';
308
  $list_pages_html .= '<img src="'.$img_scr.'" width="'.$image_width.'" />'; // not using height="'.$image_height.'" because images could be not square shaped and they will be stretched
312
  }
313
  }
314
 
 
315
 
316
  if( $show_title == 1 ){
317
  $list_pages_html .= '<h3 class="page-list-ext-title"><a href="'.$link.'" title="'.esc_attr($page->post_title).'">'.esc_attr($page->post_title).'</a></h3>';
319
  if( $show_content == 1 ){
320
  //$content = apply_filters('the_content', $page->post_content);
321
  //$content = str_replace(']]>', ']]&gt;', $content); // both used in default the_content() function
322
+
323
  if( !empty( $page->post_excerpt ) ){
324
  $text_content = $page->post_excerpt;
325
  }else{
326
  $text_content = $page->post_content;
327
  }
328
+
329
  if ( post_password_required($page) ) {
330
  $content = '<!-- password protected -->';
331
  }else{
332
  $content = page_list_parse_content( $text_content, $limit_content, $strip_tags, $strip_shortcodes, $more_tag );
333
+
334
  if( $show_title == 0 ){ // make content as a link if there is no title
335
  $content = '<a href="'.$link.'">'.$content.'</a>';
336
  }
337
  }
338
+
339
  $list_pages_html .= '<div class="page-list-ext-item-content">'.$content.'</div>';
340
+
341
  }
342
  if( $show_child_count == 1 ){
343
  $count_subpages = count(get_pages("child_of=".$page->ID));
450
  }
451
  }
452
 
453
+ if ( !function_exists('page_list_get_first_image') ) {
454
+ function page_list_get_first_image( $content='' ) {
 
 
 
 
 
455
  $first_img = '';
456
+ //ob_start();
457
+ //ob_end_clean();
458
+ $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $content, $matches);
459
+ $first_img = $matches[1][0];
460
+ if(empty($first_img)){ // no image found
461
+ $first_img = '';
462
+ }
463
+ return $first_img;
464
  }
 
465
  }
readme.txt CHANGED
@@ -5,9 +5,9 @@ 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: 3.2
9
 
10
- Plugin shows list of pages with [pagelist], [subpages], [siblings] and [pagelist_ext] shortcodes.
11
 
12
  == Description ==
13
 
@@ -22,11 +22,14 @@ Plugin shows list of pages with [pagelist], [subpages], [siblings] and [pagelist
22
 
23
  * `[pagelist depth="2" child_of="4" exclude="6,7,8"]`
24
  * `[pagelist_ext child_of="4" exclude="6,7,8" image_width="50" image_height="50"]`
25
- * visit [other notes](http://wordpress.org/extend/plugins/page-list/other_notes/) section to see all params
26
 
27
  [Page-list plugin page](http://web-profile.com.ua/wordpress/plugins/page-list/)
28
 
29
- [CMS WordPress](http://web-profile.com.ua/wordpress/)
 
 
 
30
 
31
  == Other Notes ==
32
 
@@ -97,85 +100,97 @@ Shortcodes [pagelist], [subpages] and [siblings] accept the same parameters. The
97
  = How to create sitemap.xml? =
98
  To create sitemap.xml you can use [Google XML Sitemaps](http://wordpress.org/extend/plugins/google-sitemap-generator/) plugin.
99
 
 
 
 
 
 
 
 
 
 
100
  == Screenshots ==
101
 
102
- 1. [pagelist] shortcode;
103
- 2. [pagelist_ext] shortcode;
104
 
105
  == Changelog ==
106
 
 
 
 
107
  = 3.2 =
108
- * fixed bug with "more_tag" and non english chars;
109
 
110
  = 3.1 =
111
- * fixed bug with empty image in "show_first_image" parameter;
112
- * added "more_tag" higher priority than "limit_content" (thanks to BobyDimitrov);
113
 
114
  = 3.0 =
115
- * added "show_first_image" parameter for showing first image from content if there is no featured image;
116
 
117
  = 2.9 =
118
- * added "more_tag" parameter and more tag support;
119
- * hiding password protected content of the pages;
120
 
121
  = 2.8 =
122
- * added "strip_shortcodes" parameter;
123
 
124
  = 2.7 =
125
- * make excerpt link if there is no title;
126
 
127
  = 2.6 =
128
- * fixed [pagelist_ext] "parent" parameter;
129
 
130
  = 2.5 =
131
- * adding spaces between lines when tags are stripped in [pagelist_ext];
132
 
133
  = 2.4 =
134
- * escaping attributes in title in [pagelist_ext];
135
 
136
  = 2.3 =
137
- * fixed [pagelist_ext] with showing excerpt of the page if it is not empty, else showing content;
138
 
139
  = 2.2 =
140
- * fixed offset parameter;
141
 
142
  = 2.1 =
143
- * fixed number parameter;
144
 
145
  = 2.0 =
146
- * fixed crash bug with [pagelist_ext] if theme does not have thumbnail feature;
147
 
148
  = 1.9 =
149
- * added show_child_count parameter;
150
- * added show_meta_key parameter;
151
 
152
  = 1.8 =
153
- * added screenshots;
154
- * improved parameter parsing;
155
 
156
  = 1.7 =
157
- * added strip_tags parameter;
158
 
159
  = 1.6 =
160
- * improved [pagelist_ext] shortcode: added content to list, added toggle show and limit content parameters;
161
 
162
  = 1.5 =
163
- * added [pagelist_ext] shortcode - list of pages with featured image;
164
 
165
  = 1.4 =
166
- * added exclude="current" parameter;
167
 
168
  = 1.3.0 =
169
- * added class to ul elements by default;
170
- * added "class" option (thanks to Arvind);
171
 
172
  = 1.2.0 =
173
- * added [subpages] and [siblings] shortcodes;
174
 
175
  = 1.0.0 =
176
- * initial release;
177
 
178
  == Installation ==
179
 
180
- 1. Install and activate the plugin on the Plugins page;
181
- 2. Add shortcodes to pages: `[pagelist]`, `[subpages]`, `[siblings]`, `[pagelist_ext]`;
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: 3.3
9
 
10
+ [pagelist], [subpages], [siblings] and [pagelist_ext] shortcodes
11
 
12
  == Description ==
13
 
22
 
23
  * `[pagelist depth="2" child_of="4" exclude="6,7,8"]`
24
  * `[pagelist_ext child_of="4" exclude="6,7,8" image_width="50" image_height="50"]`
25
+ * [all Page-list params](http://wordpress.org/extend/plugins/page-list/other_notes/)
26
 
27
  [Page-list plugin page](http://web-profile.com.ua/wordpress/plugins/page-list/)
28
 
29
+ = Try other useful plugins: =
30
+ * [Iframe](http://wordpress.org/extend/plugins/iframe/) - embed iframe with shortcode
31
+ * [Login Logout](http://wordpress.org/extend/plugins/login-logout/) - default Meta widget replacement
32
+ * [Filenames to latin](http://wordpress.org/extend/plugins/filenames-to-latin/) - sanitize filenames to latin during upload
33
 
34
  == Other Notes ==
35
 
100
  = How to create sitemap.xml? =
101
  To create sitemap.xml you can use [Google XML Sitemaps](http://wordpress.org/extend/plugins/google-sitemap-generator/) plugin.
102
 
103
+ = Is there "more-link" feature in the plugin? =
104
+ No, there is no "more-link" feature in the plugin. Because "more-link":
105
+
106
+ * **not good for SEO.** Nobody will search your site with the word "more". "rel=nofollow" will not solve it too.
107
+ * **not good for usability.** There is already link on title and "more-link" is an extra no needed element on page. If user cannot understand that the title is the link, than there is a problem in css styles and not in plugin's templates.
108
+
109
+ I am trying to keep plugin's code and list of pages on the sites light and clean.
110
+ But if you still need "more-link" feature and you will add it by yourself, than you should also change the plugin version to ver.100 (for example) to avoid updating of the plugin, what could override and delete your code.
111
+
112
  == Screenshots ==
113
 
114
+ 1. [pagelist] shortcode
115
+ 2. [pagelist_ext] shortcode
116
 
117
  == Changelog ==
118
 
119
+ = 3.3 =
120
+ * rename "get_first_image" function to "page_list_get_first_image" for avoiding conflicts
121
+
122
  = 3.2 =
123
+ * fixed bug with "more_tag" and non english chars
124
 
125
  = 3.1 =
126
+ * fixed bug with empty image in "show_first_image" parameter
127
+ * added "more_tag" higher priority than "limit_content" (thanks to BobyDimitrov)
128
 
129
  = 3.0 =
130
+ * added "show_first_image" parameter for showing first image from content if there is no featured image
131
 
132
  = 2.9 =
133
+ * added "more_tag" parameter and more tag support
134
+ * hiding password protected content of the pages
135
 
136
  = 2.8 =
137
+ * added "strip_shortcodes" parameter
138
 
139
  = 2.7 =
140
+ * make excerpt link if there is no title
141
 
142
  = 2.6 =
143
+ * fixed [pagelist_ext] "parent" parameter
144
 
145
  = 2.5 =
146
+ * adding spaces between lines when tags are stripped in [pagelist_ext]
147
 
148
  = 2.4 =
149
+ * escaping attributes in title in [pagelist_ext]
150
 
151
  = 2.3 =
152
+ * fixed [pagelist_ext] with showing excerpt of the page if it is not empty, else showing content
153
 
154
  = 2.2 =
155
+ * fixed offset parameter
156
 
157
  = 2.1 =
158
+ * fixed number parameter
159
 
160
  = 2.0 =
161
+ * fixed crash bug with [pagelist_ext] if theme does not have thumbnail feature
162
 
163
  = 1.9 =
164
+ * added show_child_count parameter
165
+ * added show_meta_key parameter
166
 
167
  = 1.8 =
168
+ * added screenshots
169
+ * improved parameter parsing
170
 
171
  = 1.7 =
172
+ * added strip_tags parameter
173
 
174
  = 1.6 =
175
+ * improved [pagelist_ext] shortcode: added content to list, added toggle show and limit content parameters
176
 
177
  = 1.5 =
178
+ * added [pagelist_ext] shortcode - list of pages with featured image
179
 
180
  = 1.4 =
181
+ * added exclude="current" parameter
182
 
183
  = 1.3.0 =
184
+ * added class to ul elements by default
185
+ * added "class" option (thanks to Arvind)
186
 
187
  = 1.2.0 =
188
+ * added [subpages] and [siblings] shortcodes
189
 
190
  = 1.0.0 =
191
+ * initial release
192
 
193
  == Installation ==
194
 
195
+ 1. Install and activate the plugin on the Plugins page
196
+ 2. Add shortcodes to pages: `[pagelist]`, `[subpages]`, `[siblings]`, `[pagelist_ext]`