WP-Paginate - Version 2.0.6

Version Description

  • Fixed issue with slashes added to URLs containing query strings
Download this release

Release Info

Developer AlanP57
Plugin Icon 128x128 WP-Paginate
Version 2.0.6
Comparing to
See all releases

Code changes from version 2.0.5 to 2.0.6

Files changed (2) hide show
  1. readme.txt +5 -2
  2. wp-paginate.php +16 -9
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: maxfoundry, emartin24, AlanP57
3
  Tags: paginate, pagination, navigation, page, wp-paginate, comments, rtl, seo, usability
4
  Requires at least: 2.6.0 (2.7.0 for comments pagination)
5
- Tested up to: 4.9.8
6
- Stable tag: 2.0.5
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -159,6 +159,9 @@ Example (also applies to `wp_paginate_comments()`):
159
  When calling `wp_paginate_comments()`, WP-Paginate adds an extra class to the `ol` element, `wp-paginate-comments`.
160
 
161
  == Changelog ==
 
 
 
162
  = 2.0.5 =
163
  * Added option to add trailing slash to pagination links when needed
164
 
2
  Contributors: maxfoundry, emartin24, AlanP57
3
  Tags: paginate, pagination, navigation, page, wp-paginate, comments, rtl, seo, usability
4
  Requires at least: 2.6.0 (2.7.0 for comments pagination)
5
+ Tested up to: 5.2.3
6
+ Stable tag: 2.0.6
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
159
  When calling `wp_paginate_comments()`, WP-Paginate adds an extra class to the `ol` element, `wp-paginate-comments`.
160
 
161
  == Changelog ==
162
+ = 2.0.6 =
163
+ * Fixed issue with slashes added to URLs containing query strings
164
+
165
  = 2.0.5 =
166
  * Added option to add trailing slash to pagination links when needed
167
 
wp-paginate.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: WP-Paginate
4
  Plugin URI: https://wordpress.org/plugins/wp-paginate/
5
  Description: A simple and flexible pagination plugin for WordPress posts and comments.
6
- Version: 2.0.5
7
  Author: Max Foundry
8
  Author URI: http://maxfoundry.com
9
  Text Domain: 'wp-paginate'
@@ -60,7 +60,7 @@ if (!class_exists('WPPaginate')) {
60
  /**
61
  * @var string The plugin version
62
  */
63
- public $version = '2.0.5';
64
 
65
  /**
66
  * @var string The options string name for this plugin
@@ -340,10 +340,10 @@ if (!class_exists('WPPaginate')) {
340
  ? rtrim(esc_url(get_pagenum_link($page + 1)), '/')
341
  : get_comments_pagenum_link($page + 1);
342
 
343
- if($slash_option == true) {
344
- $prevlink . '/';
345
- $nextlink . '/';
346
- }
347
 
348
  $output = stripslashes(wp_kses_decode_entities($before));
349
  if ($pages > 1) {
@@ -359,7 +359,9 @@ if (!class_exists('WPPaginate')) {
359
  $ellipsis = "<li><span class='gap'>...</span></li>";
360
 
361
  if ($page > 1 && !empty($previouspage)) {
362
- if($slash_option)
 
 
363
  $output .= sprintf('<li><a href="%s/" class="prev">%s</a></li>', $prevlink, stripslashes($previouspage));
364
  else
365
  $output .= sprintf('<li><a href="%s" class="prev">%s</a></li>', $prevlink, stripslashes($previouspage));
@@ -397,15 +399,20 @@ if (!class_exists('WPPaginate')) {
397
  else {
398
  $output .= $this->paginate_loop(1, $pages, $page, $slash_option);
399
  }
400
-
401
  if ($page < $pages && !empty($nextpage)) {
402
- if($slash_option)
 
 
403
  $output .= sprintf('<li><a href="%s/" class="next">%s</a></li>', $nextlink, stripslashes($nextpage));
404
  else
405
  $output .= sprintf('<li><a href="%s" class="next">%s</a></li>', $nextlink, stripslashes($nextpage));
406
  }
407
  $output .= "</ol>";
408
  }
 
 
 
409
  $output .= stripslashes(wp_kses_decode_entities($after));
410
 
411
  if ($pages > 1 || $empty) {
3
  Plugin Name: WP-Paginate
4
  Plugin URI: https://wordpress.org/plugins/wp-paginate/
5
  Description: A simple and flexible pagination plugin for WordPress posts and comments.
6
+ Version: 2.0.6
7
  Author: Max Foundry
8
  Author URI: http://maxfoundry.com
9
  Text Domain: 'wp-paginate'
60
  /**
61
  * @var string The plugin version
62
  */
63
+ public $version = '2.0.6';
64
 
65
  /**
66
  * @var string The options string name for this plugin
340
  ? rtrim(esc_url(get_pagenum_link($page + 1)), '/')
341
  : get_comments_pagenum_link($page + 1);
342
 
343
+ //if($slash_option == true) {
344
+ // $prevlink . '/';
345
+ // $nextlink . '/';
346
+ //}
347
 
348
  $output = stripslashes(wp_kses_decode_entities($before));
349
  if ($pages > 1) {
359
  $ellipsis = "<li><span class='gap'>...</span></li>";
360
 
361
  if ($page > 1 && !empty($previouspage)) {
362
+ $prevlink = rtrim($prevlink, '/');
363
+ $contains_param = (strpos($prevlink, '?') !== false) ? true : false;
364
+ if($slash_option && !$contains_param)
365
  $output .= sprintf('<li><a href="%s/" class="prev">%s</a></li>', $prevlink, stripslashes($previouspage));
366
  else
367
  $output .= sprintf('<li><a href="%s" class="prev">%s</a></li>', $prevlink, stripslashes($previouspage));
399
  else {
400
  $output .= $this->paginate_loop(1, $pages, $page, $slash_option);
401
  }
402
+
403
  if ($page < $pages && !empty($nextpage)) {
404
+ $nextlink = rtrim($nextlink, '/');
405
+ $contains_param = (strpos($nextlink, '?') !== false) ? true : false;
406
+ if($slash_option && !$contains_param)
407
  $output .= sprintf('<li><a href="%s/" class="next">%s</a></li>', $nextlink, stripslashes($nextpage));
408
  else
409
  $output .= sprintf('<li><a href="%s" class="next">%s</a></li>', $nextlink, stripslashes($nextpage));
410
  }
411
  $output .= "</ol>";
412
  }
413
+ //error_log($output);
414
+
415
+
416
  $output .= stripslashes(wp_kses_decode_entities($after));
417
 
418
  if ($pages > 1 || $empty) {