Sitemap - 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 Sitemap
Version 3.3
Comparing to
See all releases

Code changes from version 3.2 to 3.3

Files changed (2) hide show
  1. readme.txt +51 -36
  2. sitemap.php +30 -34
readme.txt CHANGED
@@ -5,13 +5,13 @@ 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
 
14
- **Code moved to [page-list plugin](http://wordpress.org/extend/plugins/page-list/).**
15
 
16
  = shortcodes: =
17
 
@@ -24,11 +24,14 @@ Plugin shows list of pages with [pagelist], [subpages], [siblings] and [pagelist
24
 
25
  * `[pagelist depth="2" child_of="4" exclude="6,7,8"]`
26
  * `[pagelist_ext child_of="4" exclude="6,7,8" image_width="50" image_height="50"]`
27
- * visit [other notes](http://wordpress.org/extend/plugins/sitemap/other_notes/) section to see all params
28
 
29
  [Page-list plugin page](http://web-profile.com.ua/wordpress/plugins/page-list/)
30
 
31
- [CMS WordPress](http://web-profile.com.ua/wordpress/)
 
 
 
32
 
33
  == Other Notes ==
34
 
@@ -99,85 +102,97 @@ Shortcodes [pagelist], [subpages] and [siblings] accept the same parameters. The
99
  = How to create sitemap.xml? =
100
  To create sitemap.xml you can use [Google XML Sitemaps](http://wordpress.org/extend/plugins/google-sitemap-generator/) plugin.
101
 
 
 
 
 
 
 
 
 
 
102
  == Screenshots ==
103
 
104
- 1. [pagelist] shortcode;
105
- 2. [pagelist_ext] shortcode;
106
 
107
  == Changelog ==
108
 
 
 
 
109
  = 3.2 =
110
- * fixed bug with "more_tag" and non english chars;
111
 
112
  = 3.1 =
113
- * fixed bug with empty image in "show_first_image" parameter;
114
- * added "more_tag" higher priority than "limit_content" (thanks to BobyDimitrov);
115
 
116
  = 3.0 =
117
- * added "show_first_image" parameter for showing first image from content if there is no featured image;
118
 
119
  = 2.9 =
120
- * added "more_tag" parameter and more tag support;
121
- * hiding password protected content of the pages;
122
 
123
  = 2.8 =
124
- * added "strip_shortcodes" parameter;
125
 
126
  = 2.7 =
127
- * make excerpt link if there is no title;
128
 
129
  = 2.6 =
130
- * fixed [pagelist_ext] "parent" parameter;
131
 
132
  = 2.5 =
133
- * adding spaces between lines when tags are stripped in [pagelist_ext];
134
 
135
  = 2.4 =
136
- * escaping attributes in title in [pagelist_ext];
137
 
138
  = 2.3 =
139
- * fixed [pagelist_ext] with showing excerpt of the page if it is not empty, else showing content;
140
 
141
  = 2.2 =
142
- * fixed offset parameter;
143
 
144
  = 2.1 =
145
- * fixed number parameter;
146
 
147
  = 2.0 =
148
- * fixed crash bug with [pagelist_ext] if theme does not have thumbnail feature;
149
 
150
  = 1.9 =
151
- * added show_child_count parameter;
152
- * added show_meta_key parameter;
153
 
154
  = 1.8 =
155
- * added screenshots;
156
- * improved parameter parsing;
157
 
158
  = 1.7 =
159
- * added strip_tags parameter;
160
 
161
  = 1.6 =
162
- * improved [pagelist_ext] shortcode: added content to list, added toggle show and limit content parameters;
163
 
164
  = 1.5 =
165
- * added [pagelist_ext] shortcode - list of pages with featured image;
166
 
167
  = 1.4 =
168
- * added exclude="current" parameter;
169
 
170
  = 1.3.0 =
171
- * added class to ul elements by default;
172
- * added "class" option (thanks to Arvind);
173
 
174
  = 1.2.0 =
175
- * added [subpages] and [siblings] shortcodes;
176
 
177
  = 1.0.0 =
178
- * initial release;
179
 
180
  == Installation ==
181
 
182
- 1. Install and activate the plugin on the Plugins page;
183
- 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
 
14
+ **Code moved to [page-list plugin](http://wordpress.org/extend/plugins/page-list/)** Please, delete Sitemap plugin and install [Page-list plugin](http://wordpress.org/extend/plugins/page-list/). Don't be afraid, the functionality of these plugins is the same.
15
 
16
  = shortcodes: =
17
 
24
 
25
  * `[pagelist depth="2" child_of="4" exclude="6,7,8"]`
26
  * `[pagelist_ext child_of="4" exclude="6,7,8" image_width="50" image_height="50"]`
27
+ * [all Page-list params](http://wordpress.org/extend/plugins/page-list/other_notes/)
28
 
29
  [Page-list plugin page](http://web-profile.com.ua/wordpress/plugins/page-list/)
30
 
31
+ = Try other useful plugins: =
32
+ * [Iframe](http://wordpress.org/extend/plugins/iframe/) - embed iframe with shortcode
33
+ * [Login Logout](http://wordpress.org/extend/plugins/login-logout/) - default Meta widget replacement
34
+ * [Filenames to latin](http://wordpress.org/extend/plugins/filenames-to-latin/) - sanitize filenames to latin during upload
35
 
36
  == Other Notes ==
37
 
102
  = How to create sitemap.xml? =
103
  To create sitemap.xml you can use [Google XML Sitemaps](http://wordpress.org/extend/plugins/google-sitemap-generator/) plugin.
104
 
105
+ = Is there "more-link" feature in the plugin? =
106
+ No, there is no "more-link" feature in the plugin. Because "more-link":
107
+
108
+ * **not good for SEO.** Nobody will search your site with the word "more". "rel=nofollow" will not solve it too.
109
+ * **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.
110
+
111
+ I am trying to keep plugin's code and list of pages on the sites light and clean.
112
+ 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.
113
+
114
  == Screenshots ==
115
 
116
+ 1. [pagelist] shortcode
117
+ 2. [pagelist_ext] shortcode
118
 
119
  == Changelog ==
120
 
121
+ = 3.3 =
122
+ * rename "get_first_image" function to "page_list_get_first_image" for avoiding conflicts
123
+
124
  = 3.2 =
125
+ * fixed bug with "more_tag" and non english chars
126
 
127
  = 3.1 =
128
+ * fixed bug with empty image in "show_first_image" parameter
129
+ * added "more_tag" higher priority than "limit_content" (thanks to BobyDimitrov)
130
 
131
  = 3.0 =
132
+ * added "show_first_image" parameter for showing first image from content if there is no featured image
133
 
134
  = 2.9 =
135
+ * added "more_tag" parameter and more tag support
136
+ * hiding password protected content of the pages
137
 
138
  = 2.8 =
139
+ * added "strip_shortcodes" parameter
140
 
141
  = 2.7 =
142
+ * make excerpt link if there is no title
143
 
144
  = 2.6 =
145
+ * fixed [pagelist_ext] "parent" parameter
146
 
147
  = 2.5 =
148
+ * adding spaces between lines when tags are stripped in [pagelist_ext]
149
 
150
  = 2.4 =
151
+ * escaping attributes in title in [pagelist_ext]
152
 
153
  = 2.3 =
154
+ * fixed [pagelist_ext] with showing excerpt of the page if it is not empty, else showing content
155
 
156
  = 2.2 =
157
+ * fixed offset parameter
158
 
159
  = 2.1 =
160
+ * fixed number parameter
161
 
162
  = 2.0 =
163
+ * fixed crash bug with [pagelist_ext] if theme does not have thumbnail feature
164
 
165
  = 1.9 =
166
+ * added show_child_count parameter
167
+ * added show_meta_key parameter
168
 
169
  = 1.8 =
170
+ * added screenshots
171
+ * improved parameter parsing
172
 
173
  = 1.7 =
174
+ * added strip_tags parameter
175
 
176
  = 1.6 =
177
+ * improved [pagelist_ext] shortcode: added content to list, added toggle show and limit content parameters
178
 
179
  = 1.5 =
180
+ * added [pagelist_ext] shortcode - list of pages with featured image
181
 
182
  = 1.4 =
183
+ * added exclude="current" parameter
184
 
185
  = 1.3.0 =
186
+ * added class to ul elements by default
187
+ * added "class" option (thanks to Arvind)
188
 
189
  = 1.2.0 =
190
+ * added [subpages] and [siblings] shortcodes
191
 
192
  = 1.0.0 =
193
+ * initial release
194
 
195
  == Installation ==
196
 
197
+ 1. Install and activate the plugin on the Plugins page
198
+ 2. Add shortcodes to pages: `[pagelist]`, `[subpages]`, `[siblings]`, `[pagelist_ext]`
sitemap.php CHANGED
@@ -2,24 +2,19 @@
2
  /*
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: 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".'<!-- Sitemap 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: Sitemap
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
  }