Page-list - Version 5.1

Version Description

  • 2015.07.01 =
  • added columns feature
Download this release

Release Info

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

Code changes from version 5.0 to 5.1

Files changed (5) hide show
  1. .gitattributes +17 -0
  2. .gitignore +43 -0
  3. css/page-list.css +44 -0
  4. page-list.php +496 -493
  5. readme.txt +17 -11
.gitattributes ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Auto detect text files and perform LF normalization
2
+ * text=auto
3
+
4
+ # Custom for Visual Studio
5
+ *.cs diff=csharp
6
+
7
+ # Standard to msysgit
8
+ *.doc diff=astextplain
9
+ *.DOC diff=astextplain
10
+ *.docx diff=astextplain
11
+ *.DOCX diff=astextplain
12
+ *.dot diff=astextplain
13
+ *.DOT diff=astextplain
14
+ *.pdf diff=astextplain
15
+ *.PDF diff=astextplain
16
+ *.rtf diff=astextplain
17
+ *.RTF diff=astextplain
.gitignore ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Windows image file caches
2
+ Thumbs.db
3
+ ehthumbs.db
4
+
5
+ # Folder config file
6
+ Desktop.ini
7
+
8
+ # Recycle Bin used on file shares
9
+ $RECYCLE.BIN/
10
+
11
+ # Windows Installer files
12
+ *.cab
13
+ *.msi
14
+ *.msm
15
+ *.msp
16
+
17
+ # Windows shortcuts
18
+ *.lnk
19
+
20
+ # =========================
21
+ # Operating System Files
22
+ # =========================
23
+
24
+ # OSX
25
+ # =========================
26
+
27
+ .DS_Store
28
+ .AppleDouble
29
+ .LSOverride
30
+
31
+ # Thumbnails
32
+ ._*
33
+
34
+ # Files that might appear on external disk
35
+ .Spotlight-V100
36
+ .Trashes
37
+
38
+ # Directories potentially created on remote AFP share
39
+ .AppleDB
40
+ .AppleDesktop
41
+ Network Trash Folder
42
+ Temporary Items
43
+ .apdisk
css/page-list.css CHANGED
@@ -27,6 +27,9 @@ http://wordpress.org/plugins/page-list/
27
  .page-list-ext .page-list-ext-item {
28
  clear: both;
29
  margin: 10px 0 30px 0;
 
 
 
30
  }
31
  .page-list-ext .page-list-ext-image {
32
  float: left;
@@ -36,3 +39,44 @@ http://wordpress.org/plugins/page-list/
36
  .page-list-ext .page-list-ext-title {
37
  clear: none;
38
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  .page-list-ext .page-list-ext-item {
28
  clear: both;
29
  margin: 10px 0 30px 0;
30
+ -webkit-column-break-inside: avoid;
31
+ page-break-inside: avoid;
32
+ break-inside: avoid;
33
  }
34
  .page-list-ext .page-list-ext-image {
35
  float: left;
39
  .page-list-ext .page-list-ext-title {
40
  clear: none;
41
  }
42
+
43
+ .page-list-cols-2,
44
+ .page-list-cols-3,
45
+ .page-list-cols-4,
46
+ .page-list-cols-5 {
47
+ -webkit-column-gap: 30px;
48
+ -moz-column-gap: 30px;
49
+ column-gap: 30px;
50
+ }
51
+ .page-list-cols-2 {
52
+ -webkit-column-count: 2;
53
+ -moz-column-count: 2;
54
+ column-count: 2;
55
+ }
56
+ .page-list-cols-3 {
57
+ -webkit-column-count: 3;
58
+ -moz-column-count: 3;
59
+ column-count: 3;
60
+ }
61
+ .page-list-cols-4 {
62
+ -webkit-column-count: 4;
63
+ -moz-column-count: 4;
64
+ column-count: 4;
65
+ }
66
+ .page-list-cols-5 {
67
+ -webkit-column-count: 5;
68
+ -moz-column-count: 5;
69
+ column-count: 5;
70
+ }
71
+
72
+ /* Extra small devices (phones, less than 768px) */
73
+ @media (max-width: 767px) { /* Responsive columns */
74
+ .page-list-cols-2,
75
+ .page-list-cols-3,
76
+ .page-list-cols-4,
77
+ .page-list-cols-5 {
78
+ -webkit-column-count: 1;
79
+ -moz-column-count: 1;
80
+ column-count: 1;
81
+ }
82
+ }
page-list.php CHANGED
@@ -1,493 +1,496 @@
1
- <?php
2
- /*
3
- Plugin Name: Page-list
4
- Plugin URI: http://wordpress.org/plugins/page-list/
5
- Description: [pagelist], [subpages], [siblings] and [pagelist_ext] shortcodes
6
- Version: 5.0
7
- Author: webvitaly
8
- Author URI: http://web-profile.com.ua/wordpress/plugins/
9
- License: GPLv3
10
- */
11
-
12
- define('PAGE_LIST_VERSION', '5.0');
13
-
14
- $pagelist_unq_settings = array(
15
- 'version' => PAGE_LIST_VERSION,
16
- 'powered_by' => "\n".'<!-- Page-list plugin v.'.PAGE_LIST_VERSION.' wordpress.org/plugins/page-list/ -->'."\n",
17
- 'page_list_defaults' => array(
18
- 'depth' => '0',
19
- 'child_of' => '0',
20
- 'exclude' => '0',
21
- 'exclude_tree' => '',
22
- 'include' => '0',
23
- 'title_li' => '',
24
- 'number' => '',
25
- 'offset' => '',
26
- 'meta_key' => '',
27
- 'meta_value' => '',
28
- 'show_date' => '',
29
- 'date_format' => get_option('date_format'),
30
- 'authors' => '',
31
- 'sort_column' => 'menu_order, post_title',
32
- 'sort_order' => 'ASC',
33
- 'link_before' => '',
34
- 'link_after' => '',
35
- 'post_type' => 'page',
36
- 'post_status' => 'publish',
37
- 'class' => ''
38
- )
39
- );
40
-
41
-
42
- if ( !function_exists('pagelist_unqprfx_add_stylesheet') ) {
43
- function pagelist_unqprfx_add_stylesheet() {
44
- wp_enqueue_style( 'page-list-style', plugins_url( '/css/page-list.css', __FILE__ ), false, PAGE_LIST_VERSION, 'all' );
45
- }
46
- add_action('wp_enqueue_scripts', 'pagelist_unqprfx_add_stylesheet');
47
- }
48
-
49
-
50
- if ( !function_exists('pagelist_unqprfx_shortcode') ) {
51
- function pagelist_unqprfx_shortcode( $atts ) {
52
- global $post, $pagelist_unq_settings;
53
- $return = '';
54
- extract( shortcode_atts( $pagelist_unq_settings['page_list_defaults'], $atts ) );
55
-
56
- $page_list_args = array(
57
- 'depth' => $depth,
58
- 'child_of' => pagelist_unqprfx_norm_params($child_of),
59
- 'exclude' => pagelist_unqprfx_norm_params($exclude),
60
- 'exclude_tree' => $exclude_tree,
61
- 'include' => $include,
62
- 'title_li' => $title_li,
63
- 'number' => $number,
64
- 'offset' => $offset,
65
- 'meta_key' => $meta_key,
66
- 'meta_value' => $meta_value,
67
- 'show_date' => $show_date,
68
- 'date_format' => $date_format,
69
- 'echo' => 0,
70
- 'authors' => $authors,
71
- 'sort_column' => $sort_column,
72
- 'sort_order' => $sort_order,
73
- 'link_before' => $link_before,
74
- 'link_after' => $link_after,
75
- 'post_type' => $post_type,
76
- 'post_status' => $post_status
77
- );
78
- $list_pages = wp_list_pages( $page_list_args );
79
-
80
- $return .= $pagelist_unq_settings['powered_by'];
81
- if ($list_pages) {
82
- $return .= '<ul class="page-list '.$class.'">'."\n".$list_pages."\n".'</ul>';
83
- } else {
84
- $return .= '<!-- no pages to show -->';
85
- }
86
- return $return;
87
- }
88
- add_shortcode( 'pagelist', 'pagelist_unqprfx_shortcode' );
89
- add_shortcode( 'page_list', 'pagelist_unqprfx_shortcode' );
90
- add_shortcode( 'page-list', 'pagelist_unqprfx_shortcode' ); // not good (Shortcode names should be all lowercase and use all letters, but numbers and underscores (not dashes!) should work fine too.)
91
- add_shortcode( 'sitemap', 'pagelist_unqprfx_shortcode' );
92
- }
93
-
94
-
95
- if ( !function_exists('subpages_unqprfx_shortcode') ) {
96
- function subpages_unqprfx_shortcode( $atts ) {
97
- global $post, $pagelist_unq_settings;
98
- $return = '';
99
- extract( shortcode_atts( $pagelist_unq_settings['page_list_defaults'], $atts ) );
100
-
101
- $page_list_args = array(
102
- 'depth' => $depth,
103
- 'child_of' => $post->ID,
104
- 'exclude' => pagelist_unqprfx_norm_params($exclude),
105
- 'exclude_tree' => $exclude_tree,
106
- 'include' => $include,
107
- 'title_li' => $title_li,
108
- 'number' => $number,
109
- 'offset' => $offset,
110
- 'meta_key' => $meta_key,
111
- 'meta_value' => $meta_value,
112
- 'show_date' => $show_date,
113
- 'date_format' => $date_format,
114
- 'echo' => 0,
115
- 'authors' => $authors,
116
- 'sort_column' => $sort_column,
117
- 'sort_order' => $sort_order,
118
- 'link_before' => $link_before,
119
- 'link_after' => $link_after,
120
- 'post_type' => $post_type,
121
- 'post_status' => $post_status
122
- );
123
- $list_pages = wp_list_pages( $page_list_args );
124
-
125
- $return .= $pagelist_unq_settings['powered_by'];
126
- if ($list_pages) {
127
- $return .= '<ul class="page-list subpages-page-list '.$class.'">'."\n".$list_pages."\n".'</ul>';
128
- } else {
129
- $return .= '<!-- no pages to show -->';
130
- }
131
- return $return;
132
- }
133
- add_shortcode( 'subpages', 'subpages_unqprfx_shortcode' );
134
- add_shortcode( 'sub_pages', 'subpages_unqprfx_shortcode' );
135
- }
136
-
137
-
138
- if ( !function_exists('siblings_unqprfx_shortcode') ) {
139
- function siblings_unqprfx_shortcode( $atts ) {
140
- global $post, $pagelist_unq_settings;
141
- $return = '';
142
- extract( shortcode_atts( $pagelist_unq_settings['page_list_defaults'], $atts ) );
143
-
144
- if ( $exclude == 'current' || $exclude == 'this' ) {
145
- $exclude = $post->ID;
146
- }
147
-
148
- $page_list_args = array(
149
- 'depth' => $depth,
150
- 'child_of' => $post->post_parent,
151
- 'exclude' => pagelist_unqprfx_norm_params($exclude),
152
- 'exclude_tree' => $exclude_tree,
153
- 'include' => $include,
154
- 'title_li' => $title_li,
155
- 'number' => $number,
156
- 'offset' => $offset,
157
- 'meta_key' => $meta_key,
158
- 'meta_value' => $meta_value,
159
- 'show_date' => $show_date,
160
- 'date_format' => $date_format,
161
- 'echo' => 0,
162
- 'authors' => $authors,
163
- 'sort_column' => $sort_column,
164
- 'sort_order' => $sort_order,
165
- 'link_before' => $link_before,
166
- 'link_after' => $link_after,
167
- 'post_type' => $post_type,
168
- 'post_status' => $post_status
169
- );
170
- $list_pages = wp_list_pages( $page_list_args );
171
-
172
- $return .= $pagelist_unq_settings['powered_by'];
173
- if ($list_pages) {
174
- $return .= '<ul class="page-list siblings-page-list '.$class.'">'."\n".$list_pages."\n".'</ul>';
175
- } else {
176
- $return .= '<!-- no pages to show -->';
177
- }
178
- return $return;
179
- }
180
- add_shortcode( 'siblings', 'siblings_unqprfx_shortcode' );
181
- }
182
-
183
-
184
- if ( !function_exists('pagelist_unqprfx_ext_shortcode') ) {
185
- function pagelist_unqprfx_ext_shortcode( $atts ) {
186
- global $post, $pagelist_unq_settings;
187
- $return = '';
188
- extract( shortcode_atts( array(
189
- 'show_image' => 1,
190
- 'show_first_image' => 0,
191
- 'show_title' => 1,
192
- 'show_content' => 1,
193
- 'more_tag' => 1,
194
- 'limit_content' => 250,
195
- 'image_width' => '150',
196
- 'image_height' => '150',
197
- 'child_of' => '',
198
- 'sort_order' => 'ASC',
199
- 'sort_column' => 'menu_order, post_title',
200
- 'hierarchical' => 1,
201
- 'exclude' => '0',
202
- 'include' => '0',
203
- 'meta_key' => '',
204
- 'meta_value' => '',
205
- 'authors' => '',
206
- 'parent' => -1,
207
- 'exclude_tree' => '',
208
- 'number' => '',
209
- 'offset' => 0,
210
- 'post_type' => 'page',
211
- 'post_status' => 'publish',
212
- 'class' => '',
213
- 'strip_tags' => 1,
214
- 'strip_shortcodes' => 1,
215
- 'show_child_count' => 0,
216
- 'child_count_template' => 'Subpages: %child_count%',
217
- 'show_meta_key' => '',
218
- 'meta_template' => '%meta%'
219
- ), $atts ) );
220
-
221
- if ( $child_of == '' ) { // show subpages if child_of is empty
222
- $child_of = $post->ID;
223
- }
224
-
225
- $page_list_ext_args = array(
226
- 'show_image' => $show_image,
227
- 'show_first_image' => $show_first_image,
228
- 'show_title' => $show_title,
229
- 'show_content' => $show_content,
230
- 'more_tag' => $more_tag,
231
- 'limit_content' => $limit_content,
232
- 'image_width' => $image_width,
233
- 'image_height' => $image_height,
234
- 'sort_order' => $sort_order,
235
- 'sort_column' => $sort_column,
236
- 'hierarchical' => $hierarchical,
237
- 'exclude' => pagelist_unqprfx_norm_params($exclude),
238
- 'include' => $include,
239
- 'meta_key' => $meta_key,
240
- 'meta_value' => $meta_value,
241
- 'authors' => $authors,
242
- 'child_of' => pagelist_unqprfx_norm_params($child_of),
243
- 'parent' => pagelist_unqprfx_norm_params($parent),
244
- 'exclude_tree' => $exclude_tree,
245
- 'number' => '', // $number - own counter
246
- 'offset' => 0, // $offset - own offset
247
- 'post_type' => $post_type,
248
- 'post_status' => $post_status,
249
- 'class' => $class,
250
- 'strip_tags' => $strip_tags,
251
- 'strip_shortcodes' => $strip_shortcodes,
252
- 'show_child_count' => $show_child_count,
253
- 'child_count_template' => $child_count_template,
254
- 'show_meta_key' => $show_meta_key,
255
- 'meta_template' => $meta_template
256
- );
257
- $page_list_ext_args_all = array(
258
- 'show_image' => $show_image,
259
- 'show_first_image' => $show_first_image,
260
- 'show_title' => $show_title,
261
- 'show_content' => $show_content,
262
- 'more_tag' => $more_tag,
263
- 'limit_content' => $limit_content,
264
- 'image_width' => $image_width,
265
- 'image_height' => $image_height,
266
- 'sort_order' => $sort_order,
267
- 'sort_column' => $sort_column,
268
- 'hierarchical' => $hierarchical,
269
- 'exclude' => pagelist_unqprfx_norm_params($exclude),
270
- 'include' => $include,
271
- 'meta_key' => $meta_key,
272
- 'meta_value' => $meta_value,
273
- 'authors' => $authors,
274
- 'child_of' => 0, // for showing all pages
275
- 'parent' => pagelist_unqprfx_norm_params($parent),
276
- 'exclude_tree' => $exclude_tree,
277
- 'number' => '', // $number - own counter
278
- 'offset' => 0, // $offset - own offset
279
- 'post_type' => $post_type,
280
- 'post_status' => $post_status,
281
- 'class' => $class,
282
- 'strip_tags' => $strip_tags,
283
- 'strip_shortcodes' => $strip_shortcodes,
284
- 'show_child_count' => $show_child_count,
285
- 'child_count_template' => $child_count_template,
286
- 'show_meta_key' => $show_meta_key,
287
- 'meta_template' => $meta_template
288
- );
289
- $list_pages = get_pages( $page_list_ext_args );
290
- if ( count( $list_pages ) == 0 ) { // if there is no subpages
291
- $list_pages = get_pages( $page_list_ext_args_all ); // we are showing all pages
292
- }
293
- $list_pages_html = '';
294
- $count = 0;
295
- $offset_count = 0;
296
- if ( $list_pages !== false && count( $list_pages ) > 0 ) {
297
- foreach($list_pages as $page){
298
- $count++;
299
- $offset_count++;
300
- if ( !empty( $offset ) && is_numeric( $offset ) && $offset_count <= $offset ) {
301
- $count = 0; // number counter to zero if offset is not finished
302
- }
303
- if ( ( !empty( $offset ) && is_numeric( $offset ) && $offset_count > $offset ) || ( empty( $offset ) ) || ( !empty( $offset ) && !is_numeric( $offset ) ) ) {
304
- if ( ( !empty( $number ) && is_numeric( $number ) && $count <= $number ) || ( empty( $number ) ) || ( !empty( $number ) && !is_numeric( $number ) ) ) {
305
- $link = get_permalink( $page->ID );
306
- $list_pages_html .= '<div class="page-list-ext-item">';
307
- if ( $show_image == 1 ) {
308
- if ( get_the_post_thumbnail( $page->ID ) ) { // if there is a featured image
309
- $list_pages_html .= '<div class="page-list-ext-image"><a href="'.$link.'" title="'.esc_attr($page->post_title).'">';
310
- //$list_pages_html .= get_the_post_thumbnail($page->ID, array($image_width,$image_height)); // doesn't work good with image size
311
-
312
- $image = wp_get_attachment_image_src( get_post_thumbnail_id( $page->ID ), array($image_width,$image_height) ); // get featured img; 'large'
313
- $img_url = $image[0]; // get the src of the featured image
314
- $list_pages_html .= '<img src="'.$img_url.'" width="'.$image_width.'" alt="'.esc_attr($page->post_title).'" />'; // not using height="'.$image_height.'" because images could be not square shaped and they will be stretched
315
-
316
- $list_pages_html .= '</a></div> ';
317
- } else {
318
- if ( $show_first_image == 1 ) {
319
- $img_scr = pagelist_unqprfx_get_first_image( $page->post_content );
320
- if ( !empty( $img_scr ) ) {
321
- $list_pages_html .= '<div class="page-list-ext-image"><a href="'.$link.'" title="'.esc_attr($page->post_title).'">';
322
- $list_pages_html .= '<img src="'.$img_scr.'" width="'.$image_width.'" alt="'.esc_attr($page->post_title).'" />'; // not using height="'.$image_height.'" because images could be not square shaped and they will be stretched
323
- $list_pages_html .= '</a></div> ';
324
- }
325
- }
326
- }
327
- }
328
-
329
-
330
- if ( $show_title == 1 ) {
331
- $list_pages_html .= '<h3 class="page-list-ext-title"><a href="'.$link.'" title="'.esc_attr($page->post_title).'">'.$page->post_title.'</a></h3>';
332
- }
333
- if ( $show_content == 1 ) {
334
- //$content = apply_filters('the_content', $page->post_content);
335
- //$content = str_replace(']]>', ']]&gt;', $content); // both used in default the_content() function
336
-
337
- if ( !empty( $page->post_excerpt ) ) {
338
- $text_content = $page->post_excerpt;
339
- } else {
340
- $text_content = $page->post_content;
341
- }
342
-
343
- if ( post_password_required($page) ) {
344
- $content = '<!-- password protected -->';
345
- } else {
346
- $content = pagelist_unqprfx_parse_content( $text_content, $limit_content, $strip_tags, $strip_shortcodes, $more_tag );
347
- $content = do_shortcode( $content );
348
-
349
- if ( $show_title == 0 ) { // make content as a link if there is no title
350
- $content = '<a href="'.$link.'">'.$content.'</a>';
351
- }
352
- }
353
-
354
- $list_pages_html .= '<div class="page-list-ext-item-content">'.$content.'</div>';
355
-
356
- }
357
- if ( $show_child_count == 1 ) {
358
- $count_subpages = count(get_pages("child_of=".$page->ID));
359
- if ( $count_subpages > 0 ) { // hide empty
360
- $child_count_pos = strpos($child_count_template, '%child_count%'); // check if we have %child_count% marker in template
361
- if ($child_count_pos === false) { // %child_count% not found in template
362
- $child_count_template_html = $child_count_template.' '.$count_subpages;
363
- $list_pages_html .= '<div class="page-list-ext-child-count">'.$child_count_template_html.'</div>';
364
- } else { // %child_count% found in template
365
- $child_count_template_html = str_replace('%child_count%', $count_subpages, $child_count_template);
366
- $list_pages_html .= '<div class="page-list-ext-child-count">'.$child_count_template_html.'</div>';
367
- }
368
- }
369
- }
370
- if ( $show_meta_key != '' ) {
371
- $post_meta = get_post_meta($page->ID, $show_meta_key, true);
372
- if ( !empty($post_meta) ) { // hide empty
373
- $meta_pos = strpos($meta_template, '%meta%'); // check if we have %meta% marker in template
374
- if ($meta_pos === false) { // %meta% not found in template
375
- $meta_template_html = $meta_template.' '.$post_meta;
376
- $list_pages_html .= '<div class="page-list-ext-meta">'.$meta_template_html.'</div>';
377
- } else { // %meta% found in template
378
- $meta_template_html = str_replace('%meta%', $post_meta, $meta_template);
379
- $list_pages_html .= '<div class="page-list-ext-meta">'.$meta_template_html.'</div>';
380
- }
381
- }
382
- }
383
- $list_pages_html .= '</div>'."\n";
384
- }
385
- }
386
- }
387
- }
388
- $return .= $pagelist_unq_settings['powered_by'];
389
- if ($list_pages_html) {
390
- $return .= '<div class="page-list page-list-ext '.$class.'">'."\n".$list_pages_html."\n".'</div>';
391
- } else {
392
- $return .= '<!-- no pages to show -->'; // this line will not work, because we show all pages if there is no pages to show
393
- }
394
- return $return;
395
- }
396
- add_shortcode( 'pagelist_ext', 'pagelist_unqprfx_ext_shortcode' );
397
- add_shortcode( 'pagelistext', 'pagelist_unqprfx_ext_shortcode' );
398
- }
399
-
400
-
401
- if ( !function_exists('pagelist_unqprfx_norm_params') ) {
402
- function pagelist_unqprfx_norm_params( $str ) {
403
- global $post;
404
- $new_str = $str;
405
- $new_str = str_replace('this', $post->ID, $new_str); // exclude this page
406
- $new_str = str_replace('current', $post->ID, $new_str); // exclude current page
407
- $new_str = str_replace('curent', $post->ID, $new_str); // exclude curent page with mistake
408
- $new_str = str_replace('parent', $post->post_parent, $new_str); // exclude parent page
409
- return $new_str;
410
- }
411
- }
412
-
413
-
414
- if ( !function_exists('pagelist_unqprfx_parse_content') ) {
415
- function pagelist_unqprfx_parse_content($content, $limit_content = 250, $strip_tags = 1, $strip_shortcodes = 1, $more_tag = 1) {
416
-
417
- $more_tag_found = 0;
418
-
419
- if ( $more_tag ) { // "more_tag" have higher priority than "limit_content"
420
- if ( preg_match('/<!--more(.*?)?-->/', $content, $matches) ) {
421
- $more_tag_found = 1;
422
- $more_tag = $matches[0];
423
- $content_temp = explode($matches[0], $content);
424
- $content_temp = $content_temp[0];
425
- $content_before_more_tag_length = strlen($content_temp);
426
- $content = substr_replace($content, '###more###', $content_before_more_tag_length, 0);
427
- }
428
- }
429
-
430
- // replace php and comments tags so they do not get stripped
431
- //$content = preg_replace("@<\?@", "#?#", $content);
432
- //$content = preg_replace("@<!--@", "#!--#", $content); // save html comments
433
- // strip tags normally
434
- //$content = strip_tags($content);
435
- if ( $strip_tags ) {
436
- $content = str_replace('</', ' </', $content); // <p>line1</p><p>line2</p> - adding space between lines
437
- $content = strip_tags($content); // ,'<p>'
438
- }
439
- // return php and comments tags to their origial form
440
- //$content = preg_replace("@#\?#@", "<?", $content);
441
- //$content = preg_replace("@#!--#@", "<!--", $content);
442
-
443
- if ( $strip_shortcodes ) {
444
- $content = strip_shortcodes( $content );
445
- }
446
-
447
- if ( $more_tag && $more_tag_found ) { // "more_tag" have higher priority than "limit_content"
448
- $fake_more_pos = mb_strpos($content, '###more###', 0, 'UTF-8');
449
- if ( $fake_more_pos === false ) {
450
- // substring not found in string and this is strange :)
451
- } else {
452
- $content = mb_substr($content, 0, $fake_more_pos, 'UTF-8');
453
- }
454
- } else {
455
- if ( strlen($content) > $limit_content ) { // limiting content
456
- $pos = strpos($content, ' ', $limit_content); // find first space position
457
- if ($pos !== false) {
458
- $first_space_pos = $pos;
459
- } else {
460
- $first_space_pos = $limit_content;
461
- }
462
- $content = mb_substr($content, 0, $first_space_pos, 'UTF-8') . '...';
463
- }
464
- }
465
-
466
- $output = force_balance_tags($content);
467
- return $output;
468
- }
469
- }
470
-
471
-
472
- if ( !function_exists('pagelist_unqprfx_get_first_image') ) {
473
- function pagelist_unqprfx_get_first_image( $content='' ) {
474
- $first_img = '';
475
- $matchCount = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $content, $matches);
476
- if ( $matchCount !== 0 ) { // if we found first image
477
- $first_img = $matches[1][0];
478
- }
479
- return $first_img;
480
- }
481
- }
482
-
483
- if ( ! function_exists('pagelist_unqprfx_plugin_meta') ) {
484
- function pagelist_unqprfx_plugin_meta( $links, $file ) { // add 'Plugin page' and 'Donate' links to plugin meta row
485
- if ( strpos( $file, 'page-list.php' ) !== false ) {
486
- $links = array_merge( $links, array( '<a href="http://web-profile.com.ua/wordpress/plugins/page-list/" title="Plugin page">Page-list</a>' ) );
487
- $links = array_merge( $links, array( '<a href="http://web-profile.com.ua/donate/" title="Support the development">Donate</a>' ) );
488
- $links = array_merge( $links, array( '<a href="http://codecanyon.net/popular_item/by_category?category=wordpress&ref=webvitaly">WordPress Pro plugins</a>' ) );
489
- }
490
- return $links;
491
- }
492
- add_filter( 'plugin_row_meta', 'pagelist_unqprfx_plugin_meta', 10, 2 );
493
- }
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: Page-list
4
+ Plugin URI: http://wordpress.org/plugins/page-list/
5
+ Description: [pagelist], [subpages], [siblings] and [pagelist_ext] shortcodes
6
+ Version: 5.1
7
+ Author: webvitaly
8
+ Author URI: http://web-profile.net/wordpress/plugins/
9
+ License: GPLv3
10
+ */
11
+
12
+ define('PAGE_LIST_PLUGIN_VERSION', '5.1');
13
+
14
+ $pagelist_unq_settings = array(
15
+ 'version' => PAGE_LIST_PLUGIN_VERSION,
16
+ 'powered_by' => "\n".'<!-- Page-list plugin v.'.PAGE_LIST_PLUGIN_VERSION.' wordpress.org/plugins/page-list/ -->'."\n",
17
+ 'page_list_defaults' => array(
18
+ 'depth' => '0',
19
+ 'child_of' => '0',
20
+ 'exclude' => '0',
21
+ 'exclude_tree' => '',
22
+ 'include' => '0',
23
+ 'title_li' => '',
24
+ 'number' => '',
25
+ 'offset' => '',
26
+ 'meta_key' => '',
27
+ 'meta_value' => '',
28
+ 'show_date' => '',
29
+ 'date_format' => get_option('date_format'),
30
+ 'authors' => '',
31
+ 'sort_column' => 'menu_order, post_title',
32
+ 'sort_order' => 'ASC',
33
+ 'link_before' => '',
34
+ 'link_after' => '',
35
+ 'post_type' => 'page',
36
+ 'post_status' => 'publish',
37
+ 'class' => ''
38
+ )
39
+ );
40
+
41
+
42
+ if ( !function_exists('pagelist_unqprfx_add_stylesheet') ) {
43
+ function pagelist_unqprfx_add_stylesheet() {
44
+ wp_enqueue_style( 'page-list-style', plugins_url( '/css/page-list.css', __FILE__ ), false, PAGE_LIST_PLUGIN_VERSION, 'all' );
45
+ }
46
+ add_action('wp_enqueue_scripts', 'pagelist_unqprfx_add_stylesheet');
47
+ }
48
+
49
+
50
+ if ( !function_exists('pagelist_unqprfx_shortcode') ) {
51
+ function pagelist_unqprfx_shortcode( $atts ) {
52
+ global $post, $pagelist_unq_settings;
53
+ $return = '';
54
+ extract( shortcode_atts( $pagelist_unq_settings['page_list_defaults'], $atts ) );
55
+
56
+ $page_list_args = array(
57
+ 'depth' => $depth,
58
+ 'child_of' => pagelist_unqprfx_norm_params($child_of),
59
+ 'exclude' => pagelist_unqprfx_norm_params($exclude),
60
+ 'exclude_tree' => $exclude_tree,
61
+ 'include' => $include,
62
+ 'title_li' => $title_li,
63
+ 'number' => $number,
64
+ 'offset' => $offset,
65
+ 'meta_key' => $meta_key,
66
+ 'meta_value' => $meta_value,
67
+ 'show_date' => $show_date,
68
+ 'date_format' => $date_format,
69
+ 'echo' => 0,
70
+ 'authors' => $authors,
71
+ 'sort_column' => $sort_column,
72
+ 'sort_order' => $sort_order,
73
+ 'link_before' => $link_before,
74
+ 'link_after' => $link_after,
75
+ 'post_type' => $post_type,
76
+ 'post_status' => $post_status
77
+ );
78
+ $list_pages = wp_list_pages( $page_list_args );
79
+
80
+ $return .= $pagelist_unq_settings['powered_by'];
81
+ if ($list_pages) {
82
+ $return .= '<ul class="page-list '.$class.'">'."\n".$list_pages."\n".'</ul>';
83
+ } else {
84
+ $return .= '<!-- no pages to show -->';
85
+ }
86
+ return $return;
87
+ }
88
+ add_shortcode( 'pagelist', 'pagelist_unqprfx_shortcode' );
89
+ add_shortcode( 'page_list', 'pagelist_unqprfx_shortcode' );
90
+ add_shortcode( 'page-list', 'pagelist_unqprfx_shortcode' ); // not good (Shortcode names should be all lowercase and use all letters, but numbers and underscores (not dashes!) should work fine too.)
91
+ add_shortcode( 'sitemap', 'pagelist_unqprfx_shortcode' );
92
+ }
93
+
94
+
95
+ if ( !function_exists('subpages_unqprfx_shortcode') ) {
96
+ function subpages_unqprfx_shortcode( $atts ) {
97
+ global $post, $pagelist_unq_settings;
98
+ $return = '';
99
+ extract( shortcode_atts( $pagelist_unq_settings['page_list_defaults'], $atts ) );
100
+
101
+ $page_list_args = array(
102
+ 'depth' => $depth,
103
+ 'child_of' => $post->ID,
104
+ 'exclude' => pagelist_unqprfx_norm_params($exclude),
105
+ 'exclude_tree' => $exclude_tree,
106
+ 'include' => $include,
107
+ 'title_li' => $title_li,
108
+ 'number' => $number,
109
+ 'offset' => $offset,
110
+ 'meta_key' => $meta_key,
111
+ 'meta_value' => $meta_value,
112
+ 'show_date' => $show_date,
113
+ 'date_format' => $date_format,
114
+ 'echo' => 0,
115
+ 'authors' => $authors,
116
+ 'sort_column' => $sort_column,
117
+ 'sort_order' => $sort_order,
118
+ 'link_before' => $link_before,
119
+ 'link_after' => $link_after,
120
+ 'post_type' => $post_type,
121
+ 'post_status' => $post_status
122
+ );
123
+ $list_pages = wp_list_pages( $page_list_args );
124
+
125
+ $return .= $pagelist_unq_settings['powered_by'];
126
+ if ($list_pages) {
127
+ $return .= '<ul class="page-list subpages-page-list '.$class.'">'."\n".$list_pages."\n".'</ul>';
128
+ } else {
129
+ $return .= '<!-- no pages to show -->';
130
+ }
131
+ return $return;
132
+ }
133
+ add_shortcode( 'subpages', 'subpages_unqprfx_shortcode' );
134
+ add_shortcode( 'sub_pages', 'subpages_unqprfx_shortcode' );
135
+ }
136
+
137
+
138
+ if ( !function_exists('siblings_unqprfx_shortcode') ) {
139
+ function siblings_unqprfx_shortcode( $atts ) {
140
+ global $post, $pagelist_unq_settings;
141
+ $return = '';
142
+ extract( shortcode_atts( $pagelist_unq_settings['page_list_defaults'], $atts ) );
143
+
144
+ if ( $exclude == 'current' || $exclude == 'this' ) {
145
+ $exclude = $post->ID;
146
+ }
147
+
148
+ $page_list_args = array(
149
+ 'depth' => $depth,
150
+ 'child_of' => $post->post_parent,
151
+ 'exclude' => pagelist_unqprfx_norm_params($exclude),
152
+ 'exclude_tree' => $exclude_tree,
153
+ 'include' => $include,
154
+ 'title_li' => $title_li,
155
+ 'number' => $number,
156
+ 'offset' => $offset,
157
+ 'meta_key' => $meta_key,
158
+ 'meta_value' => $meta_value,
159
+ 'show_date' => $show_date,
160
+ 'date_format' => $date_format,
161
+ 'echo' => 0,
162
+ 'authors' => $authors,
163
+ 'sort_column' => $sort_column,
164
+ 'sort_order' => $sort_order,
165
+ 'link_before' => $link_before,
166
+ 'link_after' => $link_after,
167
+ 'post_type' => $post_type,
168
+ 'post_status' => $post_status
169
+ );
170
+ $list_pages = wp_list_pages( $page_list_args );
171
+
172
+ $return .= $pagelist_unq_settings['powered_by'];
173
+ if ($list_pages) {
174
+ $return .= '<ul class="page-list siblings-page-list '.$class.'">'."\n".$list_pages."\n".'</ul>';
175
+ } else {
176
+ $return .= '<!-- no pages to show -->';
177
+ }
178
+ return $return;
179
+ }
180
+ add_shortcode( 'siblings', 'siblings_unqprfx_shortcode' );
181
+ }
182
+
183
+
184
+ if ( !function_exists('pagelist_unqprfx_ext_shortcode') ) {
185
+ function pagelist_unqprfx_ext_shortcode( $atts ) {
186
+ global $post, $pagelist_unq_settings;
187
+ $return = '';
188
+ extract( shortcode_atts( array(
189
+ 'show_image' => 1,
190
+ 'show_first_image' => 0,
191
+ 'show_title' => 1,
192
+ 'show_content' => 1,
193
+ 'more_tag' => 1,
194
+ 'limit_content' => 250,
195
+ 'image_width' => '150',
196
+ 'image_height' => '150',
197
+ 'child_of' => '',
198
+ 'sort_order' => 'ASC',
199
+ 'sort_column' => 'menu_order, post_title',
200
+ 'hierarchical' => 1,
201
+ 'exclude' => '0',
202
+ 'include' => '0',
203
+ 'meta_key' => '',
204
+ 'meta_value' => '',
205
+ 'authors' => '',
206
+ 'parent' => -1,
207
+ 'exclude_tree' => '',
208
+ 'number' => '',
209
+ 'offset' => 0,
210
+ 'post_type' => 'page',
211
+ 'post_status' => 'publish',
212
+ 'class' => '',
213
+ 'strip_tags' => 1,
214
+ 'strip_shortcodes' => 1,
215
+ 'show_child_count' => 0,
216
+ 'child_count_template' => 'Subpages: %child_count%',
217
+ 'show_meta_key' => '',
218
+ 'meta_template' => '%meta%'
219
+ ), $atts ) );
220
+
221
+ if ( $child_of == '' ) { // show subpages if child_of is empty
222
+ $child_of = $post->ID;
223
+ }
224
+
225
+ $page_list_ext_args = array(
226
+ 'show_image' => $show_image,
227
+ 'show_first_image' => $show_first_image,
228
+ 'show_title' => $show_title,
229
+ 'show_content' => $show_content,
230
+ 'more_tag' => $more_tag,
231
+ 'limit_content' => $limit_content,
232
+ 'image_width' => $image_width,
233
+ 'image_height' => $image_height,
234
+ 'sort_order' => $sort_order,
235
+ 'sort_column' => $sort_column,
236
+ 'hierarchical' => $hierarchical,
237
+ 'exclude' => pagelist_unqprfx_norm_params($exclude),
238
+ 'include' => $include,
239
+ 'meta_key' => $meta_key,
240
+ 'meta_value' => $meta_value,
241
+ 'authors' => $authors,
242
+ 'child_of' => pagelist_unqprfx_norm_params($child_of),
243
+ 'parent' => pagelist_unqprfx_norm_params($parent),
244
+ 'exclude_tree' => $exclude_tree,
245
+ 'number' => '', // $number - own counter
246
+ 'offset' => 0, // $offset - own offset
247
+ 'post_type' => $post_type,
248
+ 'post_status' => $post_status,
249
+ 'class' => $class,
250
+ 'strip_tags' => $strip_tags,
251
+ 'strip_shortcodes' => $strip_shortcodes,
252
+ 'show_child_count' => $show_child_count,
253
+ 'child_count_template' => $child_count_template,
254
+ 'show_meta_key' => $show_meta_key,
255
+ 'meta_template' => $meta_template
256
+ );
257
+ $page_list_ext_args_all = array(
258
+ 'show_image' => $show_image,
259
+ 'show_first_image' => $show_first_image,
260
+ 'show_title' => $show_title,
261
+ 'show_content' => $show_content,
262
+ 'more_tag' => $more_tag,
263
+ 'limit_content' => $limit_content,
264
+ 'image_width' => $image_width,
265
+ 'image_height' => $image_height,
266
+ 'sort_order' => $sort_order,
267
+ 'sort_column' => $sort_column,
268
+ 'hierarchical' => $hierarchical,
269
+ 'exclude' => pagelist_unqprfx_norm_params($exclude),
270
+ 'include' => $include,
271
+ 'meta_key' => $meta_key,
272
+ 'meta_value' => $meta_value,
273
+ 'authors' => $authors,
274
+ 'child_of' => 0, // for showing all pages
275
+ 'parent' => pagelist_unqprfx_norm_params($parent),
276
+ 'exclude_tree' => $exclude_tree,
277
+ 'number' => '', // $number - own counter
278
+ 'offset' => 0, // $offset - own offset
279
+ 'post_type' => $post_type,
280
+ 'post_status' => $post_status,
281
+ 'class' => $class,
282
+ 'strip_tags' => $strip_tags,
283
+ 'strip_shortcodes' => $strip_shortcodes,
284
+ 'show_child_count' => $show_child_count,
285
+ 'child_count_template' => $child_count_template,
286
+ 'show_meta_key' => $show_meta_key,
287
+ 'meta_template' => $meta_template
288
+ );
289
+ $list_pages = get_pages( $page_list_ext_args );
290
+ if ( count( $list_pages ) == 0 ) { // if there is no subpages
291
+ $list_pages = get_pages( $page_list_ext_args_all ); // we are showing all pages
292
+ }
293
+ $list_pages_html = '';
294
+ $count = 0;
295
+ $offset_count = 0;
296
+ if ( $list_pages !== false && count( $list_pages ) > 0 ) {
297
+ foreach($list_pages as $page){
298
+ $count++;
299
+ $offset_count++;
300
+ if ( !empty( $offset ) && is_numeric( $offset ) && $offset_count <= $offset ) {
301
+ $count = 0; // number counter to zero if offset is not finished
302
+ }
303
+ if ( ( !empty( $offset ) && is_numeric( $offset ) && $offset_count > $offset ) || ( empty( $offset ) ) || ( !empty( $offset ) && !is_numeric( $offset ) ) ) {
304
+ if ( ( !empty( $number ) && is_numeric( $number ) && $count <= $number ) || ( empty( $number ) ) || ( !empty( $number ) && !is_numeric( $number ) ) ) {
305
+ $link = get_permalink( $page->ID );
306
+ $list_pages_html .= '<div class="page-list-ext-item">';
307
+ if ( $show_image == 1 ) {
308
+ if ( get_the_post_thumbnail( $page->ID ) ) { // if there is a featured image
309
+ $list_pages_html .= '<div class="page-list-ext-image"><a href="'.$link.'" title="'.esc_attr($page->post_title).'">';
310
+ //$list_pages_html .= get_the_post_thumbnail($page->ID, array($image_width,$image_height)); // doesn't work good with image size
311
+
312
+ $image = wp_get_attachment_image_src( get_post_thumbnail_id( $page->ID ), array($image_width,$image_height) ); // get featured img; 'large'
313
+ $img_url = $image[0]; // get the src of the featured image
314
+ $list_pages_html .= '<img src="'.$img_url.'" width="'.$image_width.'" alt="'.esc_attr($page->post_title).'" />'; // not using height="'.$image_height.'" because images could be not square shaped and they will be stretched
315
+
316
+ $list_pages_html .= '</a></div> ';
317
+ } else {
318
+ if ( $show_first_image == 1 ) {
319
+ $img_scr = pagelist_unqprfx_get_first_image( $page->post_content );
320
+ if ( !empty( $img_scr ) ) {
321
+ $list_pages_html .= '<div class="page-list-ext-image"><a href="'.$link.'" title="'.esc_attr($page->post_title).'">';
322
+ $list_pages_html .= '<img src="'.$img_scr.'" width="'.$image_width.'" alt="'.esc_attr($page->post_title).'" />'; // not using height="'.$image_height.'" because images could be not square shaped and they will be stretched
323
+ $list_pages_html .= '</a></div> ';
324
+ }
325
+ }
326
+ }
327
+ }
328
+
329
+
330
+ if ( $show_title == 1 ) {
331
+ $list_pages_html .= '<h3 class="page-list-ext-title"><a href="'.$link.'" title="'.esc_attr($page->post_title).'">'.$page->post_title.'</a></h3>';
332
+ }
333
+ if ( $show_content == 1 ) {
334
+ //$content = apply_filters('the_content', $page->post_content);
335
+ //$content = str_replace(']]>', ']]&gt;', $content); // both used in default the_content() function
336
+
337
+ if ( !empty( $page->post_excerpt ) ) {
338
+ $text_content = $page->post_excerpt;
339
+ } else {
340
+ $text_content = $page->post_content;
341
+ }
342
+
343
+ if ( post_password_required($page) ) {
344
+ $content = '<!-- password protected -->';
345
+ } else {
346
+ $content = pagelist_unqprfx_parse_content( $text_content, $limit_content, $strip_tags, $strip_shortcodes, $more_tag );
347
+ $content = do_shortcode( $content );
348
+
349
+ if ( $show_title == 0 ) { // make content as a link if there is no title
350
+ $content = '<a href="'.$link.'">'.$content.'</a>';
351
+ }
352
+ }
353
+
354
+ $list_pages_html .= '<div class="page-list-ext-item-content">'.$content.'</div>';
355
+
356
+ }
357
+ if ( $show_child_count == 1 ) {
358
+ $count_subpages = count(get_pages("child_of=".$page->ID));
359
+ if ( $count_subpages > 0 ) { // hide empty
360
+ $child_count_pos = strpos($child_count_template, '%child_count%'); // check if we have %child_count% marker in template
361
+ if ($child_count_pos === false) { // %child_count% not found in template
362
+ $child_count_template_html = $child_count_template.' '.$count_subpages;
363
+ $list_pages_html .= '<div class="page-list-ext-child-count">'.$child_count_template_html.'</div>';
364
+ } else { // %child_count% found in template
365
+ $child_count_template_html = str_replace('%child_count%', $count_subpages, $child_count_template);
366
+ $list_pages_html .= '<div class="page-list-ext-child-count">'.$child_count_template_html.'</div>';
367
+ }
368
+ }
369
+ }
370
+ if ( $show_meta_key != '' ) {
371
+ $post_meta = get_post_meta($page->ID, $show_meta_key, true);
372
+ if ( !empty($post_meta) ) { // hide empty
373
+ $meta_pos = strpos($meta_template, '%meta%'); // check if we have %meta% marker in template
374
+ if ($meta_pos === false) { // %meta% not found in template
375
+ $meta_template_html = $meta_template.' '.$post_meta;
376
+ $list_pages_html .= '<div class="page-list-ext-meta">'.$meta_template_html.'</div>';
377
+ } else { // %meta% found in template
378
+ $meta_template_html = str_replace('%meta%', $post_meta, $meta_template);
379
+ $list_pages_html .= '<div class="page-list-ext-meta">'.$meta_template_html.'</div>';
380
+ }
381
+ }
382
+ }
383
+ $list_pages_html .= '</div>'."\n";
384
+ }
385
+ }
386
+ }
387
+ }
388
+ $return .= $pagelist_unq_settings['powered_by'];
389
+ if ($list_pages_html) {
390
+ $return .= '<div class="page-list page-list-ext '.$class.'">'."\n".$list_pages_html."\n".'</div>';
391
+ } else {
392
+ $return .= '<!-- no pages to show -->'; // this line will not work, because we show all pages if there is no pages to show
393
+ }
394
+ return $return;
395
+ }
396
+ add_shortcode( 'pagelist_ext', 'pagelist_unqprfx_ext_shortcode' );
397
+ add_shortcode( 'pagelistext', 'pagelist_unqprfx_ext_shortcode' );
398
+ }
399
+
400
+
401
+ if ( !function_exists('pagelist_unqprfx_norm_params') ) {
402
+ function pagelist_unqprfx_norm_params( $str ) {
403
+ global $post;
404
+ $new_str = $str;
405
+ $new_str = str_replace('this', $post->ID, $new_str); // exclude this page
406
+ $new_str = str_replace('current', $post->ID, $new_str); // exclude current page
407
+ $new_str = str_replace('curent', $post->ID, $new_str); // exclude curent page with mistake
408
+ $new_str = str_replace('parent', $post->post_parent, $new_str); // exclude parent page
409
+ return $new_str;
410
+ }
411
+ }
412
+
413
+
414
+ if ( !function_exists('pagelist_unqprfx_parse_content') ) {
415
+ function pagelist_unqprfx_parse_content($content, $limit_content = 250, $strip_tags = 1, $strip_shortcodes = 1, $more_tag = 1) {
416
+
417
+ $more_tag_found = 0;
418
+
419
+ if ( $more_tag ) { // "more_tag" have higher priority than "limit_content"
420
+ if ( preg_match('/<!--more(.*?)?-->/', $content, $matches) ) {
421
+ $more_tag_found = 1;
422
+ $more_tag = $matches[0];
423
+ $content_temp = explode($matches[0], $content);
424
+ $content_temp = $content_temp[0];
425
+ $content_before_more_tag_length = strlen($content_temp);
426
+ $content = substr_replace($content, '###more###', $content_before_more_tag_length, 0);
427
+ }
428
+ }
429
+
430
+ // replace php and comments tags so they do not get stripped
431
+ //$content = preg_replace("@<\?@", "#?#", $content);
432
+ //$content = preg_replace("@<!--@", "#!--#", $content); // save html comments
433
+ // strip tags normally
434
+ //$content = strip_tags($content);
435
+ if ( $strip_tags ) {
436
+ $content = str_replace('</', ' </', $content); // <p>line1</p><p>line2</p> - adding space between lines
437
+ $content = strip_tags($content); // ,'<p>'
438
+ }
439
+ // return php and comments tags to their origial form
440
+ //$content = preg_replace("@#\?#@", "<?", $content);
441
+ //$content = preg_replace("@#!--#@", "<!--", $content);
442
+
443
+ if ( $strip_shortcodes ) {
444
+ $content = strip_shortcodes( $content );
445
+ }
446
+
447
+ if ( $more_tag && $more_tag_found ) { // "more_tag" have higher priority than "limit_content"
448
+ $fake_more_pos = mb_strpos($content, '###more###', 0, 'UTF-8');
449
+ if ( $fake_more_pos === false ) {
450
+ // substring not found in string and this is strange :)
451
+ } else {
452
+ $content = mb_substr($content, 0, $fake_more_pos, 'UTF-8');
453
+ }
454
+ } else {
455
+ if ( strlen($content) > $limit_content ) { // limiting content
456
+ $pos = strpos($content, ' ', $limit_content); // find first space position
457
+ if ($pos !== false) {
458
+ $first_space_pos = $pos;
459
+ } else {
460
+ $first_space_pos = $limit_content;
461
+ }
462
+ $content = mb_substr($content, 0, $first_space_pos, 'UTF-8') . '...';
463
+ }
464
+ }
465
+
466
+ $output = force_balance_tags($content);
467
+ return $output;
468
+ }
469
+ }
470
+
471
+
472
+ if ( !function_exists('pagelist_unqprfx_get_first_image') ) {
473
+ function pagelist_unqprfx_get_first_image( $content='' ) {
474
+ $first_img = '';
475
+ $matchCount = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $content, $matches);
476
+ if ( $matchCount !== 0 ) { // if we found first image
477
+ $first_img = $matches[1][0];
478
+ }
479
+ return $first_img;
480
+ }
481
+ }
482
+
483
+ if ( ! function_exists('pagelist_unqprfx_plugin_meta') ) {
484
+ function pagelist_unqprfx_plugin_meta( $links, $file ) { // add links to plugin meta row
485
+ if ( $file == plugin_basename( __FILE__ ) ) {
486
+ $row_meta = array(
487
+ 'support' => '<a href="http://web-profile.net/wordpress/plugins/page-list/" target="_blank"><span class="dashicons dashicons-editor-help"></span> ' . __( 'Page-list', 'page-list' ) . '</a>',
488
+ 'donate' => '<a href="http://web-profile.net/donate/" target="_blank"><span class="dashicons dashicons-heart"></span> ' . __( 'Donate', 'page-list' ) . '</a>',
489
+ 'pro' => '<a href="http://codecanyon.net/item/antispam-pro/6491169?ref=webvitalii" target="_blank" title="Speedup and protect WordPress in a smart way"><span class="dashicons dashicons-star-filled"></span> ' . __( 'Silver Bullet Pro', 'page-list' ) . '</a>'
490
+ );
491
+ $links = array_merge( $links, $row_meta );
492
+ }
493
+ return (array) $links;
494
+ }
495
+ add_filter( 'plugin_row_meta', 'pagelist_unqprfx_plugin_meta', 10, 2 );
496
+ }
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === Page-list ===
2
  Contributors: webvitaly
3
- Donate link: http://web-profile.com.ua/donate/
4
  Tags: page, page-list, pagelist, sitemap, subpages, siblings
5
  Requires at least: 3.0
6
- Tested up to: 4.1
7
- Stable tag: 5.0
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl.html
10
 
@@ -12,10 +12,11 @@ License URI: http://www.gnu.org/licenses/gpl.html
12
 
13
  == Description ==
14
 
15
- > **[WordPress Pro plugins](http://codecanyon.net/popular_item/by_category?category=wordpress&ref=webvitaly)** |
16
- > **[Page-list](http://web-profile.com.ua/wordpress/plugins/page-list/ "Plugin page")** |
17
  > **[all Page-list params](http://wordpress.org/plugins/page-list/other_notes/ "Page-list params")** |
18
- > **[Donate](http://web-profile.com.ua/donate/ "Support the development")**
 
19
 
20
  = shortcodes: =
21
 
@@ -31,9 +32,9 @@ License URI: http://www.gnu.org/licenses/gpl.html
31
  * **[all Page-list params](http://wordpress.org/plugins/page-list/other_notes/ "Page-list params")**
32
 
33
  = Useful: =
34
- * ["Anti-spam" - block spam in comments](http://wordpress.org/plugins/anti-spam/ "no spam, no captcha")
35
- * ["Iframe" - embed iframe with shortcode](http://wordpress.org/plugins/iframe/ "embed iframe")
36
- * [WordPress Pro plugins](http://codecanyon.net/popular_item/by_category?category=wordpress&ref=webvitaly)
37
 
38
  == Other Notes ==
39
 
@@ -60,6 +61,7 @@ License URI: http://www.gnu.org/licenses/gpl.html
60
  * **link_before** - sets the text or html that precedes the link text inside link tag: `[pagelist link_before="<span>"]`; you may specify html tags only in the `HTML` tab in your Rich-text editor;
61
  * **link_after** - sets the text or html that follows the link text inside link tag: `[pagelist link_after="</span>"]`; you may specify html tags only in the `HTML` tab in your Rich-text editor;
62
  * **class** - the CSS class for list of pages: `[pagelist class="listclass"]`; by default the class is empty (class="");
 
63
 
64
  More [info about params](http://codex.wordpress.org/Function_Reference/wp_list_pages#Parameters) for [pagelist], [subpages], [siblings].
65
 
@@ -94,6 +96,7 @@ More [info about params](http://codex.wordpress.org/Function_Reference/wp_list_p
94
  * **child_count_template** - the template of child_count: `[pagelist_ext show_child_count="1" child_count_template="Subpages: %child_count%"]`; by default child_count_template="Subpages: %child_count%";
95
  * **show_meta_key** - show or hide meta key: `[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 shown;
96
  * **meta_template** - the template of meta: `[pagelist_ext show_meta_key="your_meta_key" meta_template="Meta: %meta%"]`; by default meta_template="%meta%";
 
97
 
98
  More [info about params](http://codex.wordpress.org/Function_Reference/get_pages#Parameters) for [pagelist_ext].
99
 
@@ -116,7 +119,7 @@ Shortcodes [pagelist], [subpages] and [siblings] accept the same parameters. The
116
  To create sitemap.xml you can use [Google XML Sitemaps](http://wordpress.org/plugins/google-sitemap-generator/) plugin.
117
 
118
  = Is there "more-link" feature in the plugin? =
119
- No, there is no "more-link" feature in the plugin. Because "[more-link](http://web-profile.com.ua/web/web-principles/more-link/ "do not use more-link")":
120
 
121
  * **bad for SEO.** Nobody will search your site with the word "more". "rel=nofollow" will not solve it too.
122
  * **bad 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.
@@ -131,8 +134,11 @@ When you changed the plugin's code you should also change the plugin's version t
131
 
132
  == Changelog ==
133
 
 
 
 
134
  = 5.0 - 2015.01.25 =
135
- * code refactor
136
  * update docs
137
  * added 'authors', 'post_type', 'post_status', 'date_format' params to [pagelist], [subpages], [siblings] shortcodes (thanks to Nick Ciske)
138
 
1
  === Page-list ===
2
  Contributors: webvitaly
3
+ Donate link: http://web-profile.net/donate/
4
  Tags: page, page-list, pagelist, sitemap, subpages, siblings
5
  Requires at least: 3.0
6
+ Tested up to: 5.0
7
+ Stable tag: 5.1
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl.html
10
 
12
 
13
  == Description ==
14
 
15
+ > **[Silver Bullet Pro](http://codecanyon.net/item/silver-bullet-pro/15171769?ref=webvitalii "Speedup and protect WordPress in a smart way")** |
16
+ > **[Page-list](http://web-profile.net/wordpress/plugins/page-list/ "Plugin page")** |
17
  > **[all Page-list params](http://wordpress.org/plugins/page-list/other_notes/ "Page-list params")** |
18
+ > **[Donate](http://web-profile.net/donate/ "Support the development")** |
19
+ > **[GitHub](https://github.com/webvitalii/page-list "Fork")**
20
 
21
  = shortcodes: =
22
 
32
  * **[all Page-list params](http://wordpress.org/plugins/page-list/other_notes/ "Page-list params")**
33
 
34
  = Useful: =
35
+ * **[Silver Bullet Pro - Speedup and protect WordPress in a smart way](http://codecanyon.net/item/silver-bullet-pro/15171769?ref=webvitalii "Speedup and protect WordPress in a smart way")**
36
+ * **[Anti-spam Pro - Block spam in comments](http://codecanyon.net/item/antispam-pro/6491169?ref=webvitalii "Block spam in comments")**
37
+
38
 
39
  == Other Notes ==
40
 
61
  * **link_before** - sets the text or html that precedes the link text inside link tag: `[pagelist link_before="<span>"]`; you may specify html tags only in the `HTML` tab in your Rich-text editor;
62
  * **link_after** - sets the text or html that follows the link text inside link tag: `[pagelist link_after="</span>"]`; you may specify html tags only in the `HTML` tab in your Rich-text editor;
63
  * **class** - the CSS class for list of pages: `[pagelist class="listclass"]`; by default the class is empty (class="");
64
+ * columns - for splitting list of pages into columns: `[pagelist class="page-list-cols-2"]`; available classes: page-list-cols-2, page-list-cols-3, page-list-cols-4, page-list-cols-5; works in all modern browsers and IE10+; columns are responsive and become 1 column at less than 768px;
65
 
66
  More [info about params](http://codex.wordpress.org/Function_Reference/wp_list_pages#Parameters) for [pagelist], [subpages], [siblings].
67
 
96
  * **child_count_template** - the template of child_count: `[pagelist_ext show_child_count="1" child_count_template="Subpages: %child_count%"]`; by default child_count_template="Subpages: %child_count%";
97
  * **show_meta_key** - show or hide meta key: `[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 shown;
98
  * **meta_template** - the template of meta: `[pagelist_ext show_meta_key="your_meta_key" meta_template="Meta: %meta%"]`; by default meta_template="%meta%";
99
+ * columns - for splitting list of pages into columns: `[pagelist_ext class="page-list-cols-2"]`; available classes: page-list-cols-2, page-list-cols-3, page-list-cols-4, page-list-cols-5; works in all modern browsers and IE10+; columns are responsive and become 1 column at less than 768px;
100
 
101
  More [info about params](http://codex.wordpress.org/Function_Reference/get_pages#Parameters) for [pagelist_ext].
102
 
119
  To create sitemap.xml you can use [Google XML Sitemaps](http://wordpress.org/plugins/google-sitemap-generator/) plugin.
120
 
121
  = Is there "more-link" feature in the plugin? =
122
+ No, there is no "more-link" feature in the plugin. Because "[more-link](http://web-profile.net/web/web-principles/more-link/ "do not use more-link")":
123
 
124
  * **bad for SEO.** Nobody will search your site with the word "more". "rel=nofollow" will not solve it too.
125
  * **bad 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.
134
 
135
  == Changelog ==
136
 
137
+ = 5.1 - 2015.07.01 =
138
+ * added columns feature
139
+
140
  = 5.0 - 2015.01.25 =
141
+ * code refactoring
142
  * update docs
143
  * added 'authors', 'post_type', 'post_status', 'date_format' params to [pagelist], [subpages], [siblings] shortcodes (thanks to Nick Ciske)
144