Version Description
- Improves compatibility with Multisite.
- Fixes a bug that prevented upgrade process from running on MU (props Greg Sullivan!)
- Improves compatibility with Beaver Builder.
Download this release
Release Info
Developer | hcabrera |
Plugin | WordPress Popular Posts |
Version | 4.0.6 |
Comparing to | |
See all releases |
Code changes from version 4.0.5 to 4.0.6
- admin/class-wordpress-popular-posts-admin.php +11 -11
- admin/partials/admin.php +10 -10
- includes/class-wordpress-popular-posts-helper.php +1 -1
- includes/class-wordpress-popular-posts-settings.php +2 -2
- includes/class-wordpress-popular-posts-widget.php +9 -4
- includes/class-wordpress-popular-posts.php +1 -1
- public/class-wordpress-popular-posts-public.php +3 -3
- readme.txt +9 -3
- uninstall.php +4 -4
- wordpress-popular-posts.php +1 -1
admin/class-wordpress-popular-posts-admin.php
CHANGED
@@ -703,7 +703,7 @@ class WPP_Admin {
|
|
703 |
$admin_options['stats']['time_unit'] = $time_unit;
|
704 |
$this->options = $admin_options;
|
705 |
|
706 |
-
|
707 |
|
708 |
$response = array(
|
709 |
'status' => 'ok',
|
@@ -960,7 +960,7 @@ class WPP_Admin {
|
|
960 |
if ( is_array($wpp_uploads_dir) && !empty($wpp_uploads_dir) ) {
|
961 |
|
962 |
$token = isset( $_POST['token'] ) ? $_POST['token'] : null;
|
963 |
-
$key =
|
964 |
|
965 |
if (
|
966 |
current_user_can( 'manage_options' )
|
@@ -1013,7 +1013,7 @@ class WPP_Admin {
|
|
1013 |
|
1014 |
$token = $_POST['token'];
|
1015 |
$clear = isset( $_POST['clear'] ) ? $_POST['clear'] : null;
|
1016 |
-
$key =
|
1017 |
|
1018 |
if (
|
1019 |
current_user_can( 'manage_options' )
|
@@ -1072,14 +1072,14 @@ class WPP_Admin {
|
|
1072 |
*/
|
1073 |
private function flush_transients() {
|
1074 |
|
1075 |
-
$wpp_transients =
|
1076 |
|
1077 |
if ( $wpp_transients && is_array( $wpp_transients ) && !empty( $wpp_transients ) ) {
|
1078 |
|
1079 |
for ( $t=0; $t < count( $wpp_transients ); $t++ )
|
1080 |
delete_transient( $wpp_transients[$t] );
|
1081 |
|
1082 |
-
|
1083 |
|
1084 |
}
|
1085 |
|
@@ -1139,10 +1139,10 @@ class WPP_Admin {
|
|
1139 |
public function upgrade_check(){
|
1140 |
|
1141 |
// Get WPP version
|
1142 |
-
$wpp_ver =
|
1143 |
|
1144 |
if ( !$wpp_ver ) {
|
1145 |
-
|
1146 |
} elseif ( version_compare( $wpp_ver, $this->version, '<' ) ) {
|
1147 |
$this->upgrade();
|
1148 |
}
|
@@ -1160,10 +1160,10 @@ class WPP_Admin {
|
|
1160 |
private function upgrade() {
|
1161 |
|
1162 |
// Keep the upgrade process from running too many times
|
1163 |
-
if (
|
1164 |
return;
|
1165 |
|
1166 |
-
|
1167 |
|
1168 |
global $wpdb;
|
1169 |
|
@@ -1203,10 +1203,10 @@ class WPP_Admin {
|
|
1203 |
}
|
1204 |
|
1205 |
// Update WPP version
|
1206 |
-
|
1207 |
|
1208 |
// Remove upgrade flag
|
1209 |
-
|
1210 |
|
1211 |
} // end __upgrade
|
1212 |
|
703 |
$admin_options['stats']['time_unit'] = $time_unit;
|
704 |
$this->options = $admin_options;
|
705 |
|
706 |
+
update_option( 'wpp_settings_config', $this->options );
|
707 |
|
708 |
$response = array(
|
709 |
'status' => 'ok',
|
960 |
if ( is_array($wpp_uploads_dir) && !empty($wpp_uploads_dir) ) {
|
961 |
|
962 |
$token = isset( $_POST['token'] ) ? $_POST['token'] : null;
|
963 |
+
$key = get_option( "wpp_rand" );
|
964 |
|
965 |
if (
|
966 |
current_user_can( 'manage_options' )
|
1013 |
|
1014 |
$token = $_POST['token'];
|
1015 |
$clear = isset( $_POST['clear'] ) ? $_POST['clear'] : null;
|
1016 |
+
$key = get_option( "wpp_rand" );
|
1017 |
|
1018 |
if (
|
1019 |
current_user_can( 'manage_options' )
|
1072 |
*/
|
1073 |
private function flush_transients() {
|
1074 |
|
1075 |
+
$wpp_transients = get_option( 'wpp_transients' );
|
1076 |
|
1077 |
if ( $wpp_transients && is_array( $wpp_transients ) && !empty( $wpp_transients ) ) {
|
1078 |
|
1079 |
for ( $t=0; $t < count( $wpp_transients ); $t++ )
|
1080 |
delete_transient( $wpp_transients[$t] );
|
1081 |
|
1082 |
+
update_option( 'wpp_transients', array() );
|
1083 |
|
1084 |
}
|
1085 |
|
1139 |
public function upgrade_check(){
|
1140 |
|
1141 |
// Get WPP version
|
1142 |
+
$wpp_ver = get_option( 'wpp_ver' );
|
1143 |
|
1144 |
if ( !$wpp_ver ) {
|
1145 |
+
add_option( 'wpp_ver', $this->version );
|
1146 |
} elseif ( version_compare( $wpp_ver, $this->version, '<' ) ) {
|
1147 |
$this->upgrade();
|
1148 |
}
|
1160 |
private function upgrade() {
|
1161 |
|
1162 |
// Keep the upgrade process from running too many times
|
1163 |
+
if ( get_option('wpp_update') )
|
1164 |
return;
|
1165 |
|
1166 |
+
add_option( 'wpp_update', '1' );
|
1167 |
|
1168 |
global $wpdb;
|
1169 |
|
1203 |
}
|
1204 |
|
1205 |
// Update WPP version
|
1206 |
+
update_option( 'wpp_ver', $this->version );
|
1207 |
|
1208 |
// Remove upgrade flag
|
1209 |
+
delete_option( 'wpp_update' );
|
1210 |
|
1211 |
} // end __upgrade
|
1212 |
|
admin/partials/admin.php
CHANGED
@@ -29,7 +29,7 @@ if ( isset($_POST['section']) ) {
|
|
29 |
$this->options['stats']['post_type'] = empty( $_POST['stats_type'] ) ? "post,page" : $_POST['stats_type'];
|
30 |
$this->options['stats']['freshness'] = empty( $_POST['stats_freshness'] ) ? false : $_POST['stats_freshness'];
|
31 |
|
32 |
-
|
33 |
echo "<div class=\"notice notice-success is-dismissible\"><p><strong>" . __( 'Settings saved.', 'wordpress-popular-posts' ) . "</strong></p></div>";
|
34 |
|
35 |
}
|
@@ -44,7 +44,7 @@ if ( isset($_POST['section']) ) {
|
|
44 |
$this->options['tools']['link']['target'] = $_POST['link_target'];
|
45 |
$this->options['tools']['css'] = $_POST['css'];
|
46 |
|
47 |
-
|
48 |
echo "<div class=\"notice notice-success is-dismissible\"><p><strong>" . __( 'Settings saved.', 'wordpress-popular-posts' ) . "</strong></p></div>";
|
49 |
|
50 |
}
|
@@ -68,7 +68,7 @@ if ( isset($_POST['section']) ) {
|
|
68 |
$this->options['tools']['thumbnail']['resize'] = $_POST['thumb_field_resize'];
|
69 |
$this->options['tools']['thumbnail']['responsive'] = $_POST['thumb_responsive'];
|
70 |
|
71 |
-
|
72 |
echo "<div class=\"notice notice-success is-dismissible\"><p><strong>" . __( 'Settings saved.', 'wordpress-popular-posts' ) . "</strong></p></div>";
|
73 |
|
74 |
}
|
@@ -109,7 +109,7 @@ if ( isset($_POST['section']) ) {
|
|
109 |
? $_POST['sample_rate']
|
110 |
: 100;
|
111 |
|
112 |
-
|
113 |
echo "<div class=\"notice notice-success is-dismissible\"><p><strong>" . __( 'Settings saved.', 'wordpress-popular-posts' ) . "</strong></p></div>";
|
114 |
|
115 |
}
|
@@ -123,10 +123,10 @@ if ( $this->options['tools']['css'] && !file_exists( get_stylesheet_directory()
|
|
123 |
|
124 |
$rand = md5( uniqid(rand(), true) );
|
125 |
|
126 |
-
if ( !$wpp_rand =
|
127 |
-
|
128 |
} else {
|
129 |
-
|
130 |
}
|
131 |
|
132 |
?>
|
@@ -138,7 +138,7 @@ if ( !$wpp_rand = get_site_option("wpp_rand") ) {
|
|
138 |
ajaxurl,
|
139 |
{
|
140 |
action: 'wpp_clear_data',
|
141 |
-
token: '<?php echo
|
142 |
clear: 'cache'
|
143 |
}, function(data){
|
144 |
var response = "";
|
@@ -177,7 +177,7 @@ if ( !$wpp_rand = get_site_option("wpp_rand") ) {
|
|
177 |
ajaxurl,
|
178 |
{
|
179 |
action: 'wpp_clear_data',
|
180 |
-
token: '<?php echo
|
181 |
clear: 'all'
|
182 |
}, function(data){
|
183 |
var response = "";
|
@@ -216,7 +216,7 @@ if ( !$wpp_rand = get_site_option("wpp_rand") ) {
|
|
216 |
ajaxurl,
|
217 |
{
|
218 |
action: 'wpp_clear_thumbnail',
|
219 |
-
token: '<?php echo
|
220 |
}, function(data){
|
221 |
var response = "";
|
222 |
|
29 |
$this->options['stats']['post_type'] = empty( $_POST['stats_type'] ) ? "post,page" : $_POST['stats_type'];
|
30 |
$this->options['stats']['freshness'] = empty( $_POST['stats_freshness'] ) ? false : $_POST['stats_freshness'];
|
31 |
|
32 |
+
update_option( 'wpp_settings_config', $this->options );
|
33 |
echo "<div class=\"notice notice-success is-dismissible\"><p><strong>" . __( 'Settings saved.', 'wordpress-popular-posts' ) . "</strong></p></div>";
|
34 |
|
35 |
}
|
44 |
$this->options['tools']['link']['target'] = $_POST['link_target'];
|
45 |
$this->options['tools']['css'] = $_POST['css'];
|
46 |
|
47 |
+
update_option( 'wpp_settings_config', $this->options );
|
48 |
echo "<div class=\"notice notice-success is-dismissible\"><p><strong>" . __( 'Settings saved.', 'wordpress-popular-posts' ) . "</strong></p></div>";
|
49 |
|
50 |
}
|
68 |
$this->options['tools']['thumbnail']['resize'] = $_POST['thumb_field_resize'];
|
69 |
$this->options['tools']['thumbnail']['responsive'] = $_POST['thumb_responsive'];
|
70 |
|
71 |
+
update_option( 'wpp_settings_config', $this->options );
|
72 |
echo "<div class=\"notice notice-success is-dismissible\"><p><strong>" . __( 'Settings saved.', 'wordpress-popular-posts' ) . "</strong></p></div>";
|
73 |
|
74 |
}
|
109 |
? $_POST['sample_rate']
|
110 |
: 100;
|
111 |
|
112 |
+
update_option( 'wpp_settings_config', $this->options );
|
113 |
echo "<div class=\"notice notice-success is-dismissible\"><p><strong>" . __( 'Settings saved.', 'wordpress-popular-posts' ) . "</strong></p></div>";
|
114 |
|
115 |
}
|
123 |
|
124 |
$rand = md5( uniqid(rand(), true) );
|
125 |
|
126 |
+
if ( !$wpp_rand = get_option("wpp_rand") ) {
|
127 |
+
add_option( "wpp_rand", $rand );
|
128 |
} else {
|
129 |
+
update_option( "wpp_rand", $rand );
|
130 |
}
|
131 |
|
132 |
?>
|
138 |
ajaxurl,
|
139 |
{
|
140 |
action: 'wpp_clear_data',
|
141 |
+
token: '<?php echo get_option("wpp_rand"); ?>',
|
142 |
clear: 'cache'
|
143 |
}, function(data){
|
144 |
var response = "";
|
177 |
ajaxurl,
|
178 |
{
|
179 |
action: 'wpp_clear_data',
|
180 |
+
token: '<?php echo get_option("wpp_rand"); ?>',
|
181 |
clear: 'all'
|
182 |
}, function(data){
|
183 |
var response = "";
|
216 |
ajaxurl,
|
217 |
{
|
218 |
action: 'wpp_clear_thumbnail',
|
219 |
+
token: '<?php echo get_option("wpp_rand"); ?>'
|
220 |
}, function(data){
|
221 |
var response = "";
|
222 |
|
includes/class-wordpress-popular-posts-helper.php
CHANGED
@@ -76,7 +76,7 @@ class WPP_Helper {
|
|
76 |
* @return string
|
77 |
*/
|
78 |
public static function curdate() {
|
79 |
-
return gmdate( 'Y-m-d', ( time() + (
|
80 |
}
|
81 |
|
82 |
/**
|
76 |
* @return string
|
77 |
*/
|
78 |
public static function curdate() {
|
79 |
+
return gmdate( 'Y-m-d', ( time() + ( get_option( 'gmt_offset' ) * 3600 ) ) );
|
80 |
}
|
81 |
|
82 |
/**
|
includes/class-wordpress-popular-posts-settings.php
CHANGED
@@ -143,9 +143,9 @@ class WPP_Settings {
|
|
143 |
return $options[ 'widget_options' ];
|
144 |
}
|
145 |
|
146 |
-
if ( !$admin_options =
|
147 |
$admin_options = $options[ 'admin_options' ];
|
148 |
-
|
149 |
}
|
150 |
else {
|
151 |
$options[ 'admin_options' ] = WPP_Helper::merge_array_r(
|
143 |
return $options[ 'widget_options' ];
|
144 |
}
|
145 |
|
146 |
+
if ( !$admin_options = get_option( 'wpp_settings_config' ) ) {
|
147 |
$admin_options = $options[ 'admin_options' ];
|
148 |
+
add_option( 'wpp_settings_config', $admin_options );
|
149 |
}
|
150 |
else {
|
151 |
$options[ 'admin_options' ] = WPP_Helper::merge_array_r(
|
includes/class-wordpress-popular-posts-widget.php
CHANGED
@@ -54,6 +54,11 @@ class WPP_Widget extends WP_Widget {
|
|
54 |
*/
|
55 |
extract( $args, EXTR_SKIP );
|
56 |
|
|
|
|
|
|
|
|
|
|
|
57 |
$markup = ( $instance['markup']['custom_html'] || has_filter('wpp_custom_html') || has_filter('wpp_post') )
|
58 |
? 'custom'
|
59 |
: 'regular';
|
@@ -365,15 +370,15 @@ class WPP_Widget extends WP_Widget {
|
|
365 |
set_transient( $transient_name, $popular_posts, $expiration );
|
366 |
|
367 |
// Store transient in WPP transients array for garbage collection
|
368 |
-
$wpp_transients =
|
369 |
|
370 |
if ( !$wpp_transients ) {
|
371 |
$wpp_transients = array( $transient_name );
|
372 |
-
|
373 |
} else {
|
374 |
if ( !in_array($transient_name, $wpp_transients) ) {
|
375 |
$wpp_transients[] = $transient_name;
|
376 |
-
|
377 |
}
|
378 |
}
|
379 |
|
@@ -393,7 +398,7 @@ class WPP_Widget extends WP_Widget {
|
|
393 |
|
394 |
}
|
395 |
|
396 |
-
if ( defined('DOING_AJAX') && DOING_AJAX )
|
397 |
wp_die();
|
398 |
|
399 |
}
|
54 |
*/
|
55 |
extract( $args, EXTR_SKIP );
|
56 |
|
57 |
+
$instance = WPP_Helper::merge_array_r(
|
58 |
+
WPP_Settings::$defaults[ 'widget_options' ],
|
59 |
+
(array) $instance
|
60 |
+
);
|
61 |
+
|
62 |
$markup = ( $instance['markup']['custom_html'] || has_filter('wpp_custom_html') || has_filter('wpp_post') )
|
63 |
? 'custom'
|
64 |
: 'regular';
|
370 |
set_transient( $transient_name, $popular_posts, $expiration );
|
371 |
|
372 |
// Store transient in WPP transients array for garbage collection
|
373 |
+
$wpp_transients = get_option('wpp_transients');
|
374 |
|
375 |
if ( !$wpp_transients ) {
|
376 |
$wpp_transients = array( $transient_name );
|
377 |
+
add_option( 'wpp_transients', $wpp_transients );
|
378 |
} else {
|
379 |
if ( !in_array($transient_name, $wpp_transients) ) {
|
380 |
$wpp_transients[] = $transient_name;
|
381 |
+
update_option( 'wpp_transients', $wpp_transients );
|
382 |
}
|
383 |
}
|
384 |
|
398 |
|
399 |
}
|
400 |
|
401 |
+
if ( defined('DOING_AJAX') && DOING_AJAX && !is_preview() )
|
402 |
wp_die();
|
403 |
|
404 |
}
|
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.
|
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.6';
|
32 |
|
33 |
$this->load_dependencies();
|
34 |
$this->set_locale();
|
public/class-wordpress-popular-posts-public.php
CHANGED
@@ -452,15 +452,15 @@ class WPP_Public {
|
|
452 |
set_transient( $transient_name, $popular_posts, $expiration );
|
453 |
|
454 |
// Store transient in WPP transients array for garbage collection
|
455 |
-
$wpp_transients =
|
456 |
|
457 |
if ( !$wpp_transients ) {
|
458 |
$wpp_transients = array( $transient_name );
|
459 |
-
|
460 |
} else {
|
461 |
if ( !in_array($transient_name, $wpp_transients) ) {
|
462 |
$wpp_transients[] = $transient_name;
|
463 |
-
|
464 |
}
|
465 |
}
|
466 |
|
452 |
set_transient( $transient_name, $popular_posts, $expiration );
|
453 |
|
454 |
// Store transient in WPP transients array for garbage collection
|
455 |
+
$wpp_transients = get_option('wpp_transients');
|
456 |
|
457 |
if ( !$wpp_transients ) {
|
458 |
$wpp_transients = array( $transient_name );
|
459 |
+
add_option( 'wpp_transients', $wpp_transients );
|
460 |
} else {
|
461 |
if ( !in_array($transient_name, $wpp_transients) ) {
|
462 |
$wpp_transients[] = $transient_name;
|
463 |
+
update_option( 'wpp_transients', $wpp_transients );
|
464 |
}
|
465 |
}
|
466 |
|
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.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -82,6 +82,12 @@ 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.5 =
|
86 |
|
87 |
- Fixes the taxonomy filter for Custom Post Types.
|
@@ -173,5 +179,5 @@ See [full changelog](https://github.com/cabrerahector/wordpress-popular-posts/bl
|
|
173 |
* Flame graphic by freevector/Vecteezy.com.
|
174 |
|
175 |
== Upgrade Notice ==
|
176 |
-
= 4.0 =
|
177 |
-
If you're using a caching plugin, flush its cache before upgrading to
|
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 |
4. WordPress Popular Posts Stats panel.
|
83 |
|
84 |
== Changelog ==
|
85 |
+
= 4.0.6 =
|
86 |
+
|
87 |
+
- Improves compatibility with Multisite.
|
88 |
+
- Fixes a bug that prevented upgrade process from running on MU (props Greg Sullivan!)
|
89 |
+
- Improves compatibility with Beaver Builder.
|
90 |
+
|
91 |
= 4.0.5 =
|
92 |
|
93 |
- Fixes the taxonomy filter for Custom Post Types.
|
179 |
* Flame graphic by freevector/Vecteezy.com.
|
180 |
|
181 |
== Upgrade Notice ==
|
182 |
+
= 4.0.6 =
|
183 |
+
If you're using a caching plugin, flush its cache before upgrading to this version.
|
uninstall.php
CHANGED
@@ -27,10 +27,10 @@ if ( function_exists( 'is_multisite' ) && is_multisite() ) {
|
|
27 |
switch_to_blog( $blog_id );
|
28 |
|
29 |
// Delete plugin's options
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
|
35 |
// delete tables
|
36 |
uninstall();
|
27 |
switch_to_blog( $blog_id );
|
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' );
|
34 |
|
35 |
// delete tables
|
36 |
uninstall();
|
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.
|
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.6
|
20 |
* Author: Hector Cabrera
|
21 |
* Author URI: http://cabrerahector.com/
|
22 |
* License: GPL-2.0+
|