WordPress Popular Posts - Version 4.0.10

Version Description

If you're using a caching plugin, flushing its cache after upgrading to this version is highly recommended.

Download this release

Release Info

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

Code changes from version 4.0.9 to 4.0.10

includes/class-wordpress-popular-posts-settings.php CHANGED
@@ -30,6 +30,7 @@ class WPP_Settings {
30
  'widget_options' => array(
31
  'title' => '',
32
  'limit' => 10,
 
33
  'range' => 'daily',
34
  'time_unit' => 'hour',
35
  'time_quantity' => 24,
30
  'widget_options' => array(
31
  'title' => '',
32
  'limit' => 10,
33
+ 'offset' => 0,
34
  'range' => 'daily',
35
  'time_unit' => 'hour',
36
  'time_quantity' => 24,
includes/class-wordpress-popular-posts-widget.php CHANGED
@@ -365,24 +365,28 @@ class WPP_Widget extends WP_Widget {
365
  $time = 60 * 60 * 24 * 365;
366
  break;
367
 
368
- $expiration = $time * $this->admin_options['tools']['cache']['interval']['value'];
 
 
369
 
370
- // Store transient
371
- set_transient( $transient_name, $popular_posts, $expiration );
372
 
373
- // Store transient in WPP transients array for garbage collection
374
- $wpp_transients = get_option('wpp_transients');
375
 
376
- if ( !$wpp_transients ) {
377
- $wpp_transients = array( $transient_name );
378
- add_option( 'wpp_transients', $wpp_transients );
379
- } else {
380
- if ( !in_array($transient_name, $wpp_transients) ) {
381
- $wpp_transients[] = $transient_name;
382
- update_option( 'wpp_transients', $wpp_transients );
383
- }
384
- }
385
 
 
 
 
 
 
 
 
 
386
  }
387
 
388
  }
365
  $time = 60 * 60 * 24 * 365;
366
  break;
367
 
368
+ default:
369
+ $time = 60 * 60;
370
+ break;
371
 
372
+ }
 
373
 
374
+ $expiration = $time * $this->admin_options['tools']['cache']['interval']['value'];
 
375
 
376
+ // Store transient
377
+ set_transient( $transient_name, $popular_posts, $expiration );
378
+
379
+ // Store transient in WPP transients array for garbage collection
380
+ $wpp_transients = get_option('wpp_transients');
 
 
 
 
381
 
382
+ if ( !$wpp_transients ) {
383
+ $wpp_transients = array( $transient_name );
384
+ add_option( 'wpp_transients', $wpp_transients );
385
+ } else {
386
+ if ( !in_array($transient_name, $wpp_transients) ) {
387
+ $wpp_transients[] = $transient_name;
388
+ update_option( 'wpp_transients', $wpp_transients );
389
+ }
390
  }
391
 
392
  }
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.9';
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.10';
32
 
33
  $this->load_dependencies();
34
  $this->set_locale();
public/class-wordpress-popular-posts-public.php CHANGED
@@ -102,7 +102,7 @@ class WPP_Public {
102
  || ( 2 == $this->admin_options['tools']['log']['level'] && is_user_logged_in() )
103
  ) {
104
 
105
- wp_register_script( 'wpp-tracking', plugin_dir_url( __FILE__ ) . 'js/tracking.js', array(), $this->version, false );
106
 
107
  $params = array(
108
  'sampling_active' => $this->admin_options['tools']['sampling']['active'],
@@ -242,6 +242,7 @@ class WPP_Public {
242
  /**
243
  * @var string $header
244
  * @var int $limit
 
245
  * @var string $range
246
  * @var bool $freshness
247
  * @var string $order_by
@@ -273,6 +274,7 @@ class WPP_Public {
273
  extract( shortcode_atts( array(
274
  'header' => '',
275
  'limit' => 10,
 
276
  'range' => 'daily',
277
  'time_unit' => 'hour',
278
  'time_quantity' => 24,
@@ -315,6 +317,7 @@ class WPP_Public {
315
  $shortcode_ops = array(
316
  'title' => strip_tags( $header ),
317
  'limit' => ( !empty( $limit ) && WPP_Helper::is_number( $limit ) && $limit > 0 ) ? $limit : 10,
 
318
  'range' => ( in_array($range, $range_values) ) ? $range : 'daily',
319
  'time_quantity' => ( !empty( $time_quantity ) && WPP_Helper::is_number( $time_quantity ) && $time_quantity > 0 ) ? $time_quantity : 24,
320
  'time_unit' => ( in_array($time_unit, $time_units) ) ? $time_unit : 'hour',
102
  || ( 2 == $this->admin_options['tools']['log']['level'] && is_user_logged_in() )
103
  ) {
104
 
105
+ wp_register_script( 'wpp-js', plugin_dir_url( __FILE__ ) . 'js/wpp.js', array(), $this->version, false );
106
 
107
  $params = array(
108
  'sampling_active' => $this->admin_options['tools']['sampling']['active'],
242
  /**
243
  * @var string $header
244
  * @var int $limit
245
+ * @var int $offset
246
  * @var string $range
247
  * @var bool $freshness
248
  * @var string $order_by
274
  extract( shortcode_atts( array(
275
  'header' => '',
276
  'limit' => 10,
277
+ 'offset' => 0,
278
  'range' => 'daily',
279
  'time_unit' => 'hour',
280
  'time_quantity' => 24,
317
  $shortcode_ops = array(
318
  'title' => strip_tags( $header ),
319
  'limit' => ( !empty( $limit ) && WPP_Helper::is_number( $limit ) && $limit > 0 ) ? $limit : 10,
320
+ 'offset' => ( !empty( $offset ) && WPP_Helper::is_number( $offset ) && $offset >= 0 ) ? $offset : 0,
321
  'range' => ( in_array($range, $range_values) ) ? $range : 'daily',
322
  'time_quantity' => ( !empty( $time_quantity ) && WPP_Helper::is_number( $time_quantity ) && $time_quantity > 0 ) ? $time_quantity : 24,
323
  'time_unit' => ( in_array($time_unit, $time_units) ) ? $time_unit : 'hour',
public/js/{tracking.js → wpp.js} RENAMED
File without changes
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.9
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.9 =
86
  - Widget: fixes Author ID field not saving/updating.
87
  - Fixes WPP data caching (props @zu2).
@@ -161,33 +169,6 @@ Also, see [Release notes](https://cabrerahector.com/development/wordpress-popula
161
  - Minor improvements and bug fixes.
162
  - Documentation updated.
163
 
164
- = 3.3.3 =
165
- - Fixes potential XSS exploit in WPP's admin dashboard.
166
- - Adds filter to set which post types should be tracked by WPP ([details](https://github.com/cabrerahector/wordpress-popular-posts/wiki/3.-Filters#wpp_trackable_post_types)).
167
- - Adds ability to select first attached image as thumbnail source (thanks, [@serglopatin](https://github.com/serglopatin)!)
168
-
169
- = 3.3.2 =
170
- - Fixes warning message: 'stream does not support seeking in...'
171
- - Removes excerpt HTML encoding.
172
- - Passes widget ID to the instance variable for customization.
173
- - Adds CSS class current.
174
- - Documentation cleanup.
175
- - Other minor bug fixes / improvements.
176
-
177
- = 3.3.1 =
178
- - Fixes undefined index notice.
179
- - Makes sure legacy tables are deleted on plugin upgrade.
180
-
181
- = 3.3.0 =
182
- - Adds the ability to limit the amount of data logged by WPP (see Settings > WordPress Popular Posts > Tools for more).
183
- - Adds Polylang support (thanks, [@Chouby](https://github.com/Chouby)!)
184
- - Removes post data from DB on deletion.
185
- - Fixes whitespaces from post_type argument (thanks, [@getdave](https://github.com/getdave)!)
186
- - WPP now handles SSL detection for images.
187
- - Removes legacy datacache and datacache_backup tables.
188
- - Adds Settings page advertisement support.
189
- - FAQ section has been moved over to Github.
190
-
191
  See [full changelog](https://github.com/cabrerahector/wordpress-popular-posts/blob/master/changelog.md).
192
 
193
  == Credits ==
@@ -195,5 +176,5 @@ See [full changelog](https://github.com/cabrerahector/wordpress-popular-posts/bl
195
  * Flame graphic by freevector/Vecteezy.com.
196
 
197
  == Upgrade Notice ==
198
- = 4.0.9 =
199
- If you're using a caching plugin, flush its cache before upgrading to this version.
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.10
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.1.0 =
86
+
87
+ **If you're using a caching plugin, flushing its cache after installing / upgrading to this version is highly recommended.**
88
+
89
+ - Renames tracking script to prevent issues with ad blockers (props @Damienov).
90
+ - Widget: fixes caching (props @zu2).
91
+ - Exposes offset parameter to wpp shortcode / `wpp_get_mostpopular` template tag.
92
+
93
  = 4.0.9 =
94
  - Widget: fixes Author ID field not saving/updating.
95
  - Fixes WPP data caching (props @zu2).
169
  - Minor improvements and bug fixes.
170
  - Documentation updated.
171
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
172
  See [full changelog](https://github.com/cabrerahector/wordpress-popular-posts/blob/master/changelog.md).
173
 
174
  == Credits ==
176
  * Flame graphic by freevector/Vecteezy.com.
177
 
178
  == Upgrade Notice ==
179
+ = 4.0.10 =
180
+ If you're using a caching plugin, flushing its cache after 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.9
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.10
20
  * Author: Hector Cabrera
21
  * Author URI: http://cabrerahector.com/
22
  * License: GPL-2.0+