WordPress Popular Posts - Version 4.0.1

Version Description

This is a hotfix release.

  • Fixes a warning message triggered on old PHP versions.
  • Fixes undefined default_thumbnail_sizes warning message.
  • Removes a hardcoded table prefix causing issues on sites that uses a different prefix than the stock one.
Download this release

Release Info

Developer hcabrera
Plugin Icon 128x128 WordPress Popular Posts
Version 4.0.1
Comparing to
See all releases

Code changes from version 4.0.0 to 4.0.1

admin/class-wordpress-popular-posts-admin.php CHANGED
@@ -299,7 +299,8 @@ class WPP_Admin {
299
  public function chart_query_table( $table, $options ){
300
 
301
  if ( 'comments' == $options['order_by'] ) {
302
- return "`wp_comments` c";
 
303
  }
304
 
305
  return $table;
@@ -309,7 +310,8 @@ class WPP_Admin {
309
  public function chart_query_join( $join, $options ){
310
 
311
  if ( 'comments' == $options['order_by'] ) {
312
- return "INNER JOIN `wp_posts` p ON c.comment_post_ID = p.ID";
 
313
  }
314
 
315
  return $table;
@@ -653,8 +655,8 @@ class WPP_Admin {
653
 
654
  jQuery("#<?php echo $containter_id; ?> p").remove();
655
 
656
- var wpp_chart_views_color = '<?php echo $color_scheme->colors[2]; ?>';
657
- var wpp_chart_comments_color = '<?php echo $color_scheme->colors[3]; ?>';
658
 
659
  var wpp_chart_data = {
660
  labels: [ <?php foreach( $data['dates'] as $date => $date_data ) : echo "'" . date_i18n( 'D d', strtotime( $date ) ) . "', "; endforeach; ?>],
@@ -846,18 +848,14 @@ class WPP_Admin {
846
  $color_scheme = 'fresh';
847
  }
848
 
849
- if ( isset($_wp_admin_css_colors[ $color_scheme ]) ) {
850
- return $_wp_admin_css_colors[ $color_scheme ];
851
  }
852
 
853
  }
854
 
855
  // Fallback, just in case
856
-
857
- $theme = new stdClass;
858
- $theme->colors = ['#333', '#999', '#881111', '#a80000'];
859
-
860
- return $theme;
861
 
862
  }
863
 
299
  public function chart_query_table( $table, $options ){
300
 
301
  if ( 'comments' == $options['order_by'] ) {
302
+ global $wpdb;
303
+ return "`{$wpdb->prefix}comments` c";
304
  }
305
 
306
  return $table;
310
  public function chart_query_join( $join, $options ){
311
 
312
  if ( 'comments' == $options['order_by'] ) {
313
+ global $wpdb;
314
+ return "INNER JOIN `{$wpdb->prefix}posts` p ON c.comment_post_ID = p.ID";
315
  }
316
 
317
  return $table;
655
 
656
  jQuery("#<?php echo $containter_id; ?> p").remove();
657
 
658
+ var wpp_chart_views_color = '<?php echo $color_scheme[2]; ?>';
659
+ var wpp_chart_comments_color = '<?php echo $color_scheme[3]; ?>';
660
 
661
  var wpp_chart_data = {
662
  labels: [ <?php foreach( $data['dates'] as $date => $date_data ) : echo "'" . date_i18n( 'D d', strtotime( $date ) ) . "', "; endforeach; ?>],
848
  $color_scheme = 'fresh';
849
  }
850
 
851
+ if ( isset($_wp_admin_css_colors[ $color_scheme ]) && isset($_wp_admin_css_colors[ $color_scheme ]->colors) ) {
852
+ return $_wp_admin_css_colors[ $color_scheme ]->colors;
853
  }
854
 
855
  }
856
 
857
  // Fallback, just in case
858
+ return array( '#333', '#999', '#881111', '#a80000' );
 
 
 
 
859
 
860
  }
861
 
includes/class-wordpress-popular-posts-output.php CHANGED
@@ -22,12 +22,23 @@ class WPP_Output {
22
  */
23
  private $admin_options = array();
24
 
 
 
 
 
 
 
 
 
25
  public function __construct( array $popular_posts = array(), array $options = array() ) {
26
 
27
  $this->data = $popular_posts;
28
  $this->options = $options;
29
  $this->admin_options = WPP_Settings::get( 'admin_options' );
30
 
 
 
 
31
  $this->build_output();
32
 
33
  }
22
  */
23
  private $admin_options = array();
24
 
25
+ /**
26
+ * Default thumbnail sizes
27
+ *
28
+ * @since 3.2.2
29
+ * @var array
30
+ */
31
+ private $default_thumbnail_sizes = array();
32
+
33
  public function __construct( array $popular_posts = array(), array $options = array() ) {
34
 
35
  $this->data = $popular_posts;
36
  $this->options = $options;
37
  $this->admin_options = WPP_Settings::get( 'admin_options' );
38
 
39
+ $wpp_image = WPP_Image::get_instance();
40
+ $this->default_thumbnail_sizes = $wpp_image->get_image_sizes();
41
+
42
  $this->build_output();
43
 
44
  }
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=hcabr
4
  Tags: popular, posts, widget, popularity, top
5
  Requires at least: 4.1
6
  Tested up to: 4.8.2
7
- Stable tag: 4.0.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -82,6 +82,14 @@ The FAQ section has been moved [here](https://github.com/cabrerahector/wordpress
82
  4. WordPress Popular Posts Stats panel.
83
 
84
  == Changelog ==
 
 
 
 
 
 
 
 
85
  = 4.0.0 =
86
 
87
  **If you're using a caching plugin, flushing its cache after installing / upgrading to this version is highly recommended.**
4
  Tags: popular, posts, widget, popularity, top
5
  Requires at least: 4.1
6
  Tested up to: 4.8.2
7
+ Stable tag: 4.0.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
82
  4. WordPress Popular Posts Stats panel.
83
 
84
  == Changelog ==
85
+ = 4.0.1 =
86
+
87
+ **This is a hotfix release.**
88
+
89
+ - Fixes a warning message triggered on old PHP versions.
90
+ - Fixes undefined default_thumbnail_sizes warning message.
91
+ - Removes a hardcoded table prefix causing issues on sites that uses a different prefix than the stock one.
92
+
93
  = 4.0.0 =
94
 
95
  **If you're using a caching plugin, flushing its cache after installing / upgrading to this version is highly recommended.**
wordpress-popular-posts.php CHANGED
@@ -16,7 +16,7 @@
16
  * Plugin Name: WordPress Popular Posts
17
  * Plugin URI: https://wordpress.org/plugins/wordpress-popular-posts/
18
  * Description: A highly customizable widget that displays the most popular posts on your blog.
19
- * Version: 4.0.0
20
  * Author: Hector Cabrera
21
  * Author URI: http://cabrerahector.com/
22
  * License: GPL-2.0+
16
  * Plugin Name: WordPress Popular Posts
17
  * Plugin URI: https://wordpress.org/plugins/wordpress-popular-posts/
18
  * Description: A highly customizable widget that displays the most popular posts on your blog.
19
+ * Version: 4.0.1
20
  * Author: Hector Cabrera
21
  * Author URI: http://cabrerahector.com/
22
  * License: GPL-2.0+