WordPress Popular Posts - Version 4.0.8

Version Description

  • Multisite: plugin can now be installed individually on each site.
  • Multisite: improved upgrade process.
  • Dashboard: adds multisite check to Debug screen.
  • Dashboard: have the Debug screen display active plugins only.
  • Improves compatibility with Beaver Builder.
  • Adds onload event to ajax widget (props @cawa-93).
  • Other minor bug fixes.
Download this release

Release Info

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

Code changes from version 4.0.6 to 4.0.8

admin/class-wordpress-popular-posts-admin.php CHANGED
@@ -1138,6 +1138,35 @@ class WPP_Admin {
1138
  */
1139
  public function upgrade_check(){
1140
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1141
  // Get WPP version
1142
  $wpp_ver = get_option( 'wpp_ver' );
1143
 
@@ -1146,8 +1175,7 @@ class WPP_Admin {
1146
  } elseif ( version_compare( $wpp_ver, $this->version, '<' ) ) {
1147
  $this->upgrade();
1148
  }
1149
-
1150
- } // end upgrade_check
1151
 
1152
  /**
1153
  * On plugin upgrade, performs a number of actions: update WPP database tables structures (if needed),
1138
  */
1139
  public function upgrade_check(){
1140
 
1141
+ // Multisite setup, upgrade all sites
1142
+ if ( function_exists( 'is_multisite' ) && is_multisite() ) {
1143
+ global $wpdb;
1144
+
1145
+ $original_blog_id = get_current_blog_id();
1146
+ $blogs_ids = $wpdb->get_col( "SELECT blog_id FROM {$wpdb->blogs}" );
1147
+
1148
+ include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
1149
+
1150
+ foreach( $blogs_ids as $blog_id ) {
1151
+ switch_to_blog( $blog_id );
1152
+ $this->upgrade_site();
1153
+ }
1154
+
1155
+ // Switch back to current blog
1156
+ switch_to_blog( $original_blog_id );
1157
+ }
1158
+ else {
1159
+ $this->upgrade_site();
1160
+ }
1161
+
1162
+ } // end upgrade_check
1163
+
1164
+ /**
1165
+ * Upgrades single site.
1166
+ *
1167
+ * @since 4.0.7
1168
+ */
1169
+ private function upgrade_site() {
1170
  // Get WPP version
1171
  $wpp_ver = get_option( 'wpp_ver' );
1172
 
1175
  } elseif ( version_compare( $wpp_ver, $this->version, '<' ) ) {
1176
  $this->upgrade();
1177
  }
1178
+ }
 
1179
 
1180
  /**
1181
  * On plugin upgrade, performs a number of actions: update WPP database tables structures (if needed),
admin/partials/admin.php CHANGED
@@ -976,6 +976,8 @@ if ( !$wpp_rand = get_option("wpp_rand") ) {
976
  $plugin_names = array();
977
 
978
  foreach( $site_plugins as $main_file => $plugin_meta ) :
 
 
979
  $plugin_names[] = sanitize_text_field( $plugin_meta['Name'] . ' ' . $plugin_meta['Version'] );
980
  endforeach;
981
  ?>
@@ -985,7 +987,8 @@ if ( !$wpp_rand = get_option("wpp_rand") ) {
985
  <p><strong>Database version:</strong> <?php echo $wpdb->get_var( "SELECT VERSION();" ); ?></p>
986
  <p><strong>InnoDB availability:</strong> <?php echo $wpdb->get_var( "SELECT SUPPORT FROM INFORMATION_SCHEMA.ENGINES WHERE ENGINE = 'InnoDB';" ); ?></p>
987
  <p><strong>WordPress version:</strong> <?php echo $wp_version; ?></p>
988
- <p><strong>Installed plugins:</strong> <?php echo implode( ', ', $plugin_names ); ?></p>
 
989
  <p><strong>Theme:</strong> <?php echo $my_theme->get( 'Name' ) . ' (' . $my_theme->get( 'Version' ) . ') by ' . $my_theme->get( 'Author' ); ?></p>
990
  </div>
991
  <!-- End debug -->
976
  $plugin_names = array();
977
 
978
  foreach( $site_plugins as $main_file => $plugin_meta ) :
979
+ if ( !is_plugin_active( $main_file ) )
980
+ continue;
981
  $plugin_names[] = sanitize_text_field( $plugin_meta['Name'] . ' ' . $plugin_meta['Version'] );
982
  endforeach;
983
  ?>
987
  <p><strong>Database version:</strong> <?php echo $wpdb->get_var( "SELECT VERSION();" ); ?></p>
988
  <p><strong>InnoDB availability:</strong> <?php echo $wpdb->get_var( "SELECT SUPPORT FROM INFORMATION_SCHEMA.ENGINES WHERE ENGINE = 'InnoDB';" ); ?></p>
989
  <p><strong>WordPress version:</strong> <?php echo $wp_version; ?></p>
990
+ <p><strong>Multisite:</strong> <?php echo ( function_exists( 'is_multisite' ) && is_multisite() ) ? 'Yes' : 'No'; ?></p>
991
+ <p><strong>Active plugins:</strong> <?php echo implode( ', ', $plugin_names ); ?></p>
992
  <p><strong>Theme:</strong> <?php echo $my_theme->get( 'Name' ) . ' (' . $my_theme->get( 'Version' ) . ') by ' . $my_theme->get( 'Author' ); ?></p>
993
  </div>
994
  <!-- End debug -->
includes/class-wordpress-popular-posts-widget.php CHANGED
@@ -112,6 +112,7 @@ class WPP_Widget extends WP_Widget {
112
  }, function( response ){
113
  widget_container.children("p.wpp-loader").remove();
114
  widget_container.append(response);
 
115
  }
116
  );
117
 
@@ -398,8 +399,13 @@ class WPP_Widget extends WP_Widget {
398
 
399
  }
400
 
401
- if ( defined('DOING_AJAX') && DOING_AJAX && !is_preview() )
 
 
 
 
402
  wp_die();
 
403
 
404
  }
405
 
112
  }, function( response ){
113
  widget_container.children("p.wpp-loader").remove();
114
  widget_container.append(response);
115
+ widget_container.trigger('wpp-onload');
116
  }
117
  );
118
 
399
 
400
  }
401
 
402
+ if (
403
+ defined('DOING_AJAX')
404
+ && DOING_AJAX && !is_preview()
405
+ && !( is_singular() && isset( $_GET['fl_builder'] ) )
406
+ ) {
407
  wp_die();
408
+ }
409
 
410
  }
411
 
includes/class-wordpress-popular-posts.php CHANGED
@@ -28,7 +28,7 @@ class WordPressPopularPosts {
28
  public function __construct(){
29
 
30
  $this->plugin_name = 'wordpress-popular-posts';
31
- $this->version = '4.0.6';
32
 
33
  $this->load_dependencies();
34
  $this->set_locale();
28
  public function __construct(){
29
 
30
  $this->plugin_name = 'wordpress-popular-posts';
31
+ $this->version = '4.0.8';
32
 
33
  $this->load_dependencies();
34
  $this->set_locale();
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.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -82,6 +82,15 @@ 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.6 =
86
 
87
  - Improves compatibility with Multisite.
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.8
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.8 =
86
+ - Multisite: plugin can now be installed individually on each site.
87
+ - Multisite: improved upgrade process.
88
+ - Dashboard: adds multisite check to Debug screen.
89
+ - Dashboard: have the Debug screen display active plugins only.
90
+ - Improves compatibility with Beaver Builder.
91
+ - Adds onload event to ajax widget (props @cawa-93).
92
+ - Other minor bug fixes.
93
+
94
  = 4.0.6 =
95
 
96
  - Improves compatibility with Multisite.
uninstall.php CHANGED
@@ -28,6 +28,7 @@ if ( function_exists( 'is_multisite' ) && is_multisite() ) {
28
 
29
  // Delete plugin's options
30
  delete_option( 'wpp_ver' );
 
31
  delete_option( 'wpp_settings_config' );
32
  delete_option( 'wpp_rand' );
33
  delete_option( 'wpp_transients' );
@@ -47,6 +48,7 @@ if ( function_exists( 'is_multisite' ) && is_multisite() ) {
47
 
48
  // Delete plugin's options
49
  delete_option( 'wpp_ver' );
 
50
  delete_option( 'wpp_settings_config' );
51
  delete_option( 'wpp_rand' );
52
  delete_option( 'wpp_transients' );
28
 
29
  // Delete plugin's options
30
  delete_option( 'wpp_ver' );
31
+ delete_option( 'wpp_update' );
32
  delete_option( 'wpp_settings_config' );
33
  delete_option( 'wpp_rand' );
34
  delete_option( 'wpp_transients' );
48
 
49
  // Delete plugin's options
50
  delete_option( 'wpp_ver' );
51
+ delete_option( 'wpp_update' );
52
  delete_option( 'wpp_settings_config' );
53
  delete_option( 'wpp_rand' );
54
  delete_option( 'wpp_transients' );
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.6
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.8
20
  * Author: Hector Cabrera
21
  * Author URI: http://cabrerahector.com/
22
  * License: GPL-2.0+