List category posts - Version 0.58.1

Version Description

  • Fixes an error with pagination links. Accessing $_SERVER filtered not working on some servers, have to investigate further for a future version.
  • Addresses warning messages when debug enabled.
Download this release

Release Info

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

Code changes from version 0.58 to 0.58.1

include/lcp-catlist.php CHANGED
@@ -71,15 +71,14 @@ class CatList{
71
 
72
  private function check_pagination($args){
73
  if ( $this->utils->lcp_not_empty('pagination') ){
74
- if( null !== filter_input(INPUT_SERVER, 'QUERY_STRING', FILTER_SANITIZE_STRING) ){
75
- $query = filter_input(INPUT_SERVER, 'QUERY_STRING', FILTER_SANITIZE_STRING);
76
- }
77
-
78
- if ($query !== '' && preg_match('/lcp_page' . preg_quote($this->instance) .
79
- '=([0-9]+)/i', $query, $match) ) {
80
- $this->page = $match[1];
81
- $offset = ($this->page - 1) * $this->params['numberposts'];
82
- $args = array_merge($args, array('offset' => $offset));
83
  }
84
  }
85
  return $args;
71
 
72
  private function check_pagination($args){
73
  if ( $this->utils->lcp_not_empty('pagination') ){
74
+ if( null !== $_SERVER['QUERY_STRING'] ){
75
+ $query = $_SERVER['QUERY_STRING'];
76
+ if ($query !== '' && preg_match('/lcp_page' . preg_quote($this->instance) .
77
+ '=([0-9]+)/i', $query, $match) ) {
78
+ $this->page = $match[1];
79
+ $offset = ($this->page - 1) * $this->params['numberposts'];
80
+ $args = array_merge($args, array('offset' => $offset));
81
+ }
 
82
  }
83
  }
84
  return $args;
include/lcp-catlistdisplayer.php CHANGED
@@ -186,26 +186,25 @@ class CatListDisplayer {
186
  if ($page == $current_page){
187
  $link = "<li>$current_page</li>";
188
  } else {
189
- $request_uri = filter_input(INPUT_SERVER, 'REQUEST_URI', FILTER_SANITIZE_STRING);
190
- $query = filter_input(INPUT_SERVER, 'QUERY_STRING', FILTER_SANITIZE_STRING);
191
  $amp = ( strpos( $request_uri, "?") ) ? "&" : "";
192
  $pattern = "/[&|?]?lcp_page" . preg_quote($this->catlist->get_instance()) . "=([0-9]+)/";
193
  $query = preg_replace($pattern, '', $query);
194
 
195
  $url = strtok($request_uri,'?');
196
  $protocol = "http";
197
- $port = filter_input(INPUT_SERVER, 'SERVER_PORT', FILTER_SANITIZE_STRING);
198
- $https = filter_input(INPUT_SERVER, 'HTTPS', FILTER_SANITIZE_STRING);
199
  if ( (!empty($https) && $https !== 'off') ||
200
  $port == 443){
201
  $protocol = "https";
202
  }
203
- $http_host = filter_input(INPUT_SERVER, 'HTTP_HOST', FILTER_SANITIZE_STRING);
204
  $page_link = "$protocol://$http_host$url?$query" .
205
  $amp . "lcp_page" . $this->catlist->get_instance() . "=". $page .
206
  "#lcp_instance_" . $this->catlist->get_instance();
207
  $link .= "<li><a href='$page_link' title='$page'>";
208
-
209
  ($char != null) ? ($link .= $char) : ($link .= $page);
210
 
211
  $link .= "</a></li>";
186
  if ($page == $current_page){
187
  $link = "<li>$current_page</li>";
188
  } else {
189
+ $request_uri = $_SERVER['REQUEST_URI'];
190
+ $query = $_SERVER['QUERY_STRING'];
191
  $amp = ( strpos( $request_uri, "?") ) ? "&" : "";
192
  $pattern = "/[&|?]?lcp_page" . preg_quote($this->catlist->get_instance()) . "=([0-9]+)/";
193
  $query = preg_replace($pattern, '', $query);
194
 
195
  $url = strtok($request_uri,'?');
196
  $protocol = "http";
197
+ $port = $_SERVER['SERVER_PORT'];
198
+ $https = $_SERVER['HTTPS'];
199
  if ( (!empty($https) && $https !== 'off') ||
200
  $port == 443){
201
  $protocol = "https";
202
  }
203
+ $http_host = $_SERVER['HTTP_HOST'];
204
  $page_link = "$protocol://$http_host$url?$query" .
205
  $amp . "lcp_page" . $this->catlist->get_instance() . "=". $page .
206
  "#lcp_instance_" . $this->catlist->get_instance();
207
  $link .= "<li><a href='$page_link' title='$page'>";
 
208
  ($char != null) ? ($link .= $char) : ($link .= $page);
209
 
210
  $link .= "</a></li>";
list_cat_posts.php CHANGED
@@ -3,7 +3,7 @@
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, the number of posts to display and many more parameters. You can use [catlist] as many times as needed with different arguments. Usage: [catlist argument1=value1 argument2=value2].
6
- Version: 0.58
7
  Author: Fernando Briano
8
  Author URI: http://fernandobriano.com
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, the number of posts to display and many more parameters. You can use [catlist] as many times as needed with different arguments. Usage: [catlist argument1=value1 argument2=value2].
6
+ Version: 0.58.1
7
  Author: Fernando Briano
8
  Author URI: http://fernandobriano.com
9
 
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: 4.1.1
7
- Stable tag: 0.58
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -445,6 +445,10 @@ Template system has changed. Custom templates should be stored in WordPress them
445
 
446
  == Changelog ==
447
 
 
 
 
 
448
  = 0.58 =
449
  * Removes filter interfering with filters set by other plugins. Thanks [zulkamal](https://github.com/zulkamal) for the Pull Request!
450
  * Adds option to display titles without links. Thanks zulkamal for this Pull Request too! :D
4
  Tags: list, categories, posts, cms
5
  Requires at least: 3.3
6
  Tested up to: 4.1.1
7
+ Stable tag: 0.58.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
445
 
446
  == Changelog ==
447
 
448
+ = 0.58.1 =
449
+ * Fixes an error with pagination links. Accessing $_SERVER filtered not working on some servers, have to investigate further for a future version.
450
+ * Addresses warning messages when debug enabled.
451
+
452
  = 0.58 =
453
  * Removes filter interfering with filters set by other plugins. Thanks [zulkamal](https://github.com/zulkamal) for the Pull Request!
454
  * Adds option to display titles without links. Thanks zulkamal for this Pull Request too! :D