List category posts - Version 0.50.3

Version Description

  • Addresses some warnings / scandir on Displayer and catname on widget
    • Fixes lcp_paginator.css path
    • Some small sanitations
Download this release

Release Info

Developer fernandobt
Plugin Icon 128x128 List category posts
Version 0.50.3
Comparing to
See all releases

Code changes from version 0.50.2 to 0.50.3

include/CatList.php CHANGED
@@ -317,7 +317,9 @@ class CatList{
317
  * Load category name and link to the category:
318
  */
319
  public function get_category_link(){
320
- if( ($this->params['catlink'] == 'yes' ||
 
 
321
  $this->params['catname'] == 'yes') &&
322
  $this->lcp_category_id != 0):
323
  // Check for one id or several:
@@ -581,7 +583,8 @@ class CatList{
581
  $lcp_thumb_size = 'thumbnail';
582
  endif;
583
 
584
- $lcp_thumbnail = '<a href="' . get_permalink($single->ID).'" title="' . $single->post_title . '">';
 
585
 
586
  $lcp_thumbnail .= get_the_post_thumbnail(
587
  $single->ID,
317
  * Load category name and link to the category:
318
  */
319
  public function get_category_link(){
320
+ if(($this->lcp_not_empty('catlink') &&
321
+ $this->params['catlink'] == 'yes' ||
322
+ $this->lcp_not_empty('catname') &&
323
  $this->params['catname'] == 'yes') &&
324
  $this->lcp_category_id != 0):
325
  // Check for one id or several:
583
  $lcp_thumb_size = 'thumbnail';
584
  endif;
585
 
586
+ $lcp_thumbnail = '<a href="' . esc_url(get_permalink($single->ID)) .
587
+ '" title="' . esc_attr($single->post_title) . '">';
588
 
589
  $lcp_thumbnail .= get_the_post_thumbnail(
590
  $single->ID,
include/CatListDisplayer.php CHANGED
@@ -77,19 +77,21 @@ class CatListDisplayer {
77
  public static function get_templates($param = null){
78
  $templates = array();
79
  $paths = self::getTemplatePaths();
80
- foreach ($paths as $templatePath) :
81
- foreach (scandir($templatePath) as $file) :
82
- // Check that the files found are well formed
83
- if ( ($file[0] != '.') && (substr($file, -4) == '.php') &&
84
- is_file($templatePath.$file) && is_readable($templatePath.$file) ) :
85
- $templateName = substr($file, 0, strlen($file)-4);
86
- // Add the template only if necessary
87
- if (!in_array($templateName, $templates)) :
88
- $templates[] = $templateName;
89
- endif;
90
- endif;
91
- endforeach;
92
- endforeach;
 
 
93
  return $templates;
94
  }
95
 
@@ -314,7 +316,7 @@ class CatListDisplayer {
314
  endif;
315
 
316
  if (!empty($this->params['posts_morelink'])) :
317
- $href = 'href="'.get_permalink($single->ID) . '"';
318
  $class = "";
319
  if (!empty($this->params['posts_morelink_class'])) :
320
  $class = 'class="' . $this->params['posts_morelink_class'] . '" ';
@@ -486,6 +488,7 @@ class CatListDisplayer {
486
  elseif (!empty($tag) && empty($css_class)) :
487
  return '<' . $tag . '>' . $info . '</' . $tag . '>';
488
  endif;
 
489
  return '<' . $tag . ' class="' . $css_class . '">' . $info . '</' . $tag . '>';
490
  endif;
491
  }
77
  public static function get_templates($param = null){
78
  $templates = array();
79
  $paths = self::getTemplatePaths();
80
+ foreach ($paths as $templatePath){
81
+ if (is_dir($templatePath) && scandir($templatePath)){
82
+ foreach ($templatePath as $file){
83
+ // Check that the files found are well formed
84
+ if ( ($file[0] != '.') && (substr($file, -4) == '.php') &&
85
+ is_file($templatePath.$file) && is_readable($templatePath.$file) ){
86
+ $templateName = substr($file, 0, strlen($file)-4);
87
+ // Add the template only if necessary
88
+ if (!in_array($templateName, $templates)){
89
+ $templates[] = $templateName;
90
+ }
91
+ }
92
+ }
93
+ }
94
+ }
95
  return $templates;
96
  }
97
 
316
  endif;
317
 
318
  if (!empty($this->params['posts_morelink'])) :
319
+ $href = 'href="' . get_permalink($single->ID) . '"';
320
  $class = "";
321
  if (!empty($this->params['posts_morelink_class'])) :
322
  $class = 'class="' . $this->params['posts_morelink_class'] . '" ';
488
  elseif (!empty($tag) && empty($css_class)) :
489
  return '<' . $tag . '>' . $info . '</' . $tag . '>';
490
  endif;
491
+ $css_class = sanitize_html_class($css_class);
492
  return '<' . $tag . ' class="' . $css_class . '">' . $info . '</' . $tag . '>';
493
  endif;
494
  }
list_cat_posts.php CHANGED
@@ -3,9 +3,9 @@
3
  Plugin Name: List category posts
4
  Plugin URI: https://github.com/picandocodigo/List-Category-Posts
5
  Description: List Category Posts allows you to list posts by category in a post/page using the [catlist] shortcode. This shortcode accepts a category name or id, the order in which you want the posts to display, and the number of posts to display. You can use [catlist] as many times as needed with different arguments. Usage: [catlist argument1=value1 argument2=value2].
6
- Version: 0.50.2
7
  Author: Fernando Briano
8
- Author URI: http://picandocodigo.net/
9
 
10
  Text Domain: list-category-posts
11
  Domain Path: /languages/
@@ -157,7 +157,7 @@ function lcp_pagination_css(){
157
  elseif ( @file_exists( get_template_directory() . '/lcp_paginator.css' ) ):
158
  $css_file = get_template_directory_uri() . '/lcp_paginator.css';
159
  else:
160
- $css_file = WP_PLUGIN_URL . '/' . basename( __DIR__ ) . '/lcp_paginator.css';
161
  endif;
162
 
163
  wp_enqueue_style( 'lcp_paginator', $css_file);
3
  Plugin Name: List category posts
4
  Plugin URI: https://github.com/picandocodigo/List-Category-Posts
5
  Description: List Category Posts allows you to list posts by category in a post/page using the [catlist] shortcode. This shortcode accepts a category name or id, the order in which you want the posts to display, and the number of posts to display. You can use [catlist] as many times as needed with different arguments. Usage: [catlist argument1=value1 argument2=value2].
6
+ Version: 0.50.3
7
  Author: Fernando Briano
8
+ Author URI: http://fernandobriano.com
9
 
10
  Text Domain: list-category-posts
11
  Domain Path: /languages/
157
  elseif ( @file_exists( get_template_directory() . '/lcp_paginator.css' ) ):
158
  $css_file = get_template_directory_uri() . '/lcp_paginator.css';
159
  else:
160
+ $css_file = plugin_dir_url(__FILE__) . '/lcp_paginator.css';
161
  endif;
162
 
163
  wp_enqueue_style( 'lcp_paginator', $css_file);
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate Link: http://picandocodigo.net/programacion/wordpress/list-category-posts
4
  Tags: list, categories, posts, cms
5
  Requires at least: 3.3
6
  Tested up to: 3.9.1
7
- Stable tag: 0.50.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -422,6 +422,12 @@ Template system has changed. Custom templates should be stored in WordPress them
422
 
423
  == Changelog ==
424
 
 
 
 
 
 
 
425
  = 0.50.2 =
426
 
427
  * Small fix on templates
4
  Tags: list, categories, posts, cms
5
  Requires at least: 3.3
6
  Tested up to: 3.9.1
7
+ Stable tag: 0.50.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
422
 
423
  == Changelog ==
424
 
425
+ = 0.50.3 =
426
+
427
+ * Addresses some warnings / scandir on Displayer and catname on widget
428
+ * Fixes lcp_paginator.css path
429
+ * Some small sanitations
430
+
431
  = 0.50.2 =
432
 
433
  * Small fix on templates