Version Description
- Improves PHP 8.1 support.
- Adds new filter to modify the post date.
- Adds check to prevent the misuse of the Data Sampling feature (props to the JPCERT/CC team for reporting this issue).
- Updates dependencies.
Release notes
Download this release
Release Info
Developer | hcabrera |
Plugin | WordPress Popular Posts |
Version | 6.1.0 |
Comparing to | |
See all releases |
Code changes from version 6.0.5 to 6.1.0
- i18n/wordpress-popular-posts.pot +13 -13
- readme.txt +11 -2
- src/Container/Container.php +4 -3
- src/Front/Front.php +5 -1
- src/Output.php +3 -1
- src/Rest/ViewLoggerEndpoint.php +9 -0
- wordpress-popular-posts.php +2 -2
i18n/wordpress-popular-posts.pot
CHANGED
@@ -5,7 +5,7 @@ msgid ""
|
|
5 |
msgstr ""
|
6 |
"Project-Id-Version: WordPress Popular Posts\n"
|
7 |
"Report-Msgid-Bugs-To: http://wordpress.org/tag/wordpress-popular-posts\n"
|
8 |
-
"POT-Creation-Date: 2022-
|
9 |
"PO-Revision-Date: 2015-04-24 13:30-0430\n"
|
10 |
"Last-Translator: Héctor Cabrera <hcabrerab@gmail.com>\n"
|
11 |
"Language-Team: Héctor Cabrera <me@cabrerahector.com>\n"
|
@@ -445,7 +445,7 @@ msgid "Support"
|
|
445 |
msgstr ""
|
446 |
|
447 |
#: src/Admin/Admin.php:744 src/Admin/Admin.php:1130 src/Admin/Admin.php:1134
|
448 |
-
#: src/Output.php:
|
449 |
#, php-format
|
450 |
msgid "%s view"
|
451 |
msgid_plural "%s views"
|
@@ -453,7 +453,7 @@ msgstr[0] ""
|
|
453 |
msgstr[1] ""
|
454 |
|
455 |
#: src/Admin/Admin.php:744 src/Admin/Admin.php:1132 src/Admin/Admin.php:1134
|
456 |
-
#: src/Output.php:
|
457 |
#, php-format
|
458 |
msgid "%s comment"
|
459 |
msgid_plural "%s comments"
|
@@ -844,34 +844,34 @@ msgstr ""
|
|
844 |
msgid "Sorry. No data so far."
|
845 |
msgstr ""
|
846 |
|
847 |
-
#: src/Output.php:
|
848 |
#, php-format
|
849 |
msgid "%s ago"
|
850 |
msgstr ""
|
851 |
|
852 |
-
#: src/Output.php:
|
853 |
#, php-format
|
854 |
msgid "%s view per day"
|
855 |
msgid_plural "%s views per day"
|
856 |
msgstr[0] ""
|
857 |
msgstr[1] ""
|
858 |
|
859 |
-
#: src/Output.php:
|
860 |
#, php-format
|
861 |
msgid "by %s"
|
862 |
msgstr ""
|
863 |
|
864 |
-
#: src/Output.php:
|
865 |
#, php-format
|
866 |
msgid "posted %s"
|
867 |
msgstr ""
|
868 |
|
869 |
-
#: src/Output.php:
|
870 |
#, php-format
|
871 |
msgid "posted on %s"
|
872 |
msgstr ""
|
873 |
|
874 |
-
#: src/Output.php:
|
875 |
#, php-format
|
876 |
msgid "under %s"
|
877 |
msgstr ""
|
@@ -924,19 +924,19 @@ msgstr ""
|
|
924 |
msgid "Include popular posts from author ID(s)."
|
925 |
msgstr ""
|
926 |
|
927 |
-
#: src/Rest/ViewLoggerEndpoint.php:
|
928 |
msgid "Security nonce."
|
929 |
msgstr ""
|
930 |
|
931 |
-
#: src/Rest/ViewLoggerEndpoint.php:
|
932 |
msgid "The post / page ID."
|
933 |
msgstr ""
|
934 |
|
935 |
-
#: src/Rest/ViewLoggerEndpoint.php:
|
936 |
msgid "Enables Data Sampling."
|
937 |
msgstr ""
|
938 |
|
939 |
-
#: src/Rest/ViewLoggerEndpoint.php:
|
940 |
msgid "Sets the Sampling Rate."
|
941 |
msgstr ""
|
942 |
|
5 |
msgstr ""
|
6 |
"Project-Id-Version: WordPress Popular Posts\n"
|
7 |
"Report-Msgid-Bugs-To: http://wordpress.org/tag/wordpress-popular-posts\n"
|
8 |
+
"POT-Creation-Date: 2022-11-12 15:20-0400\n"
|
9 |
"PO-Revision-Date: 2015-04-24 13:30-0430\n"
|
10 |
"Last-Translator: Héctor Cabrera <hcabrerab@gmail.com>\n"
|
11 |
"Language-Team: Héctor Cabrera <me@cabrerahector.com>\n"
|
445 |
msgstr ""
|
446 |
|
447 |
#: src/Admin/Admin.php:744 src/Admin/Admin.php:1130 src/Admin/Admin.php:1134
|
448 |
+
#: src/Output.php:812
|
449 |
#, php-format
|
450 |
msgid "%s view"
|
451 |
msgid_plural "%s views"
|
453 |
msgstr[1] ""
|
454 |
|
455 |
#: src/Admin/Admin.php:744 src/Admin/Admin.php:1132 src/Admin/Admin.php:1134
|
456 |
+
#: src/Output.php:795
|
457 |
#, php-format
|
458 |
msgid "%s comment"
|
459 |
msgid_plural "%s comments"
|
844 |
msgid "Sorry. No data so far."
|
845 |
msgstr ""
|
846 |
|
847 |
+
#: src/Output.php:630
|
848 |
#, php-format
|
849 |
msgid "%s ago"
|
850 |
msgstr ""
|
851 |
|
852 |
+
#: src/Output.php:806
|
853 |
#, php-format
|
854 |
msgid "%s view per day"
|
855 |
msgid_plural "%s views per day"
|
856 |
msgstr[0] ""
|
857 |
msgstr[1] ""
|
858 |
|
859 |
+
#: src/Output.php:824
|
860 |
#, php-format
|
861 |
msgid "by %s"
|
862 |
msgstr ""
|
863 |
|
864 |
+
#: src/Output.php:829
|
865 |
#, php-format
|
866 |
msgid "posted %s"
|
867 |
msgstr ""
|
868 |
|
869 |
+
#: src/Output.php:829
|
870 |
#, php-format
|
871 |
msgid "posted on %s"
|
872 |
msgstr ""
|
873 |
|
874 |
+
#: src/Output.php:834
|
875 |
#, php-format
|
876 |
msgid "under %s"
|
877 |
msgstr ""
|
924 |
msgid "Include popular posts from author ID(s)."
|
925 |
msgstr ""
|
926 |
|
927 |
+
#: src/Rest/ViewLoggerEndpoint.php:229
|
928 |
msgid "Security nonce."
|
929 |
msgstr ""
|
930 |
|
931 |
+
#: src/Rest/ViewLoggerEndpoint.php:235
|
932 |
msgid "The post / page ID."
|
933 |
msgstr ""
|
934 |
|
935 |
+
#: src/Rest/ViewLoggerEndpoint.php:242
|
936 |
msgid "Enables Data Sampling."
|
937 |
msgstr ""
|
938 |
|
939 |
+
#: src/Rest/ViewLoggerEndpoint.php:249
|
940 |
msgid "Sets the Sampling Rate."
|
941 |
msgstr ""
|
942 |
|
readme.txt
CHANGED
@@ -3,9 +3,9 @@ Contributors: hcabrera
|
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=hcabrerab%40gmail%2ecom&lc=GB&item_name=WordPress%20Popular%20Posts%20Plugin¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG_global%2egif%3aNonHosted
|
4 |
Tags: popular, posts, widget, popularity, top
|
5 |
Requires at least: 5.3
|
6 |
-
Tested up to: 6.0
|
7 |
Requires PHP: 7.2
|
8 |
-
Stable tag: 6.0
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -109,6 +109,15 @@ The FAQ section has been moved [here](https://github.com/cabrerahector/wordpress
|
|
109 |
|
110 |
== Changelog ==
|
111 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
= 6.0.5 =
|
113 |
|
114 |
- Fixes yet another issue where excerpts may output broken HTML under certain conditions (thanks dxylott54!)
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=hcabrerab%40gmail%2ecom&lc=GB&item_name=WordPress%20Popular%20Posts%20Plugin¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG_global%2egif%3aNonHosted
|
4 |
Tags: popular, posts, widget, popularity, top
|
5 |
Requires at least: 5.3
|
6 |
+
Tested up to: 6.1.0
|
7 |
Requires PHP: 7.2
|
8 |
+
Stable tag: 6.1.0
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
109 |
|
110 |
== Changelog ==
|
111 |
|
112 |
+
= 6.1.0 =
|
113 |
+
|
114 |
+
- Improves PHP 8.1 support.
|
115 |
+
- Adds new [filter to modify the post date](https://github.com/cabrerahector/wordpress-popular-posts/wiki/3.-Filters#wpp_the_date).
|
116 |
+
- Adds check to prevent the misuse of the Data Sampling feature (props to the JPCERT/CC team for reporting this issue).
|
117 |
+
- Updates dependencies.
|
118 |
+
|
119 |
+
[Release notes](https://cabrerahector.com/wordpress/wordpress-popular-posts-6-1-0-improved-php-8-1-support-plus-minor-enhancements/)
|
120 |
+
|
121 |
= 6.0.5 =
|
122 |
|
123 |
- Fixes yet another issue where excerpts may output broken HTML under certain conditions (thanks dxylott54!)
|
src/Container/Container.php
CHANGED
@@ -47,7 +47,7 @@ class Container implements \ArrayAccess
|
|
47 |
*
|
48 |
* @return bool
|
49 |
*/
|
50 |
-
public function offsetExists($key) /** @TODO: starting PHP 8.0 $key can be declared as mixed $key, see https://www.php.net/manual/en/language.types.declarations.php */
|
51 |
{
|
52 |
return array_key_exists($key, $this->values);
|
53 |
}
|
@@ -58,7 +58,7 @@ class Container implements \ArrayAccess
|
|
58 |
* @param mixed $key
|
59 |
* @param mixed $value
|
60 |
*/
|
61 |
-
public function offsetSet($key, $value) /** @TODO: starting PHP 8.0 $key and $value can be declared as mixed $key, mixed $value */
|
62 |
{
|
63 |
$this->values[$key] = $value;
|
64 |
}
|
@@ -68,7 +68,7 @@ class Container implements \ArrayAccess
|
|
68 |
*
|
69 |
* @param mixed $key
|
70 |
*/
|
71 |
-
public function offsetUnset($key) /** @TODO: starting PHP 8.0 $key can be declared as mixed $key */
|
72 |
{
|
73 |
unset($this->values[$key]);
|
74 |
}
|
@@ -80,6 +80,7 @@ class Container implements \ArrayAccess
|
|
80 |
*
|
81 |
* @return mixed
|
82 |
*/
|
|
|
83 |
public function offsetGet($key) /** @TODO: starting PHP 8.0 $key can be declared as mixed $key */
|
84 |
{
|
85 |
if ( ! $this->offsetExists($key) ) {
|
47 |
*
|
48 |
* @return bool
|
49 |
*/
|
50 |
+
public function offsetExists($key) : bool /** @TODO: starting PHP 8.0 $key can be declared as mixed $key, see https://www.php.net/manual/en/language.types.declarations.php */
|
51 |
{
|
52 |
return array_key_exists($key, $this->values);
|
53 |
}
|
58 |
* @param mixed $key
|
59 |
* @param mixed $value
|
60 |
*/
|
61 |
+
public function offsetSet($key, $value) : void /** @TODO: starting PHP 8.0 $key and $value can be declared as mixed $key, mixed $value */
|
62 |
{
|
63 |
$this->values[$key] = $value;
|
64 |
}
|
68 |
*
|
69 |
* @param mixed $key
|
70 |
*/
|
71 |
+
public function offsetUnset($key) : void /** @TODO: starting PHP 8.0 $key can be declared as mixed $key */
|
72 |
{
|
73 |
unset($this->values[$key]);
|
74 |
}
|
80 |
*
|
81 |
* @return mixed
|
82 |
*/
|
83 |
+
#[\ReturnTypeWillChange]
|
84 |
public function offsetGet($key) /** @TODO: starting PHP 8.0 $key can be declared as mixed $key */
|
85 |
{
|
86 |
if ( ! $this->offsetExists($key) ) {
|
src/Front/Front.php
CHANGED
@@ -118,7 +118,11 @@ class Front {
|
|
118 |
$is_single = Helper::is_single();
|
119 |
}
|
120 |
|
121 |
-
|
|
|
|
|
|
|
|
|
122 |
$params = [
|
123 |
'sampling_active' => (int) $this->config['tools']['sampling']['active'],
|
124 |
'sampling_rate' => (int) $this->config['tools']['sampling']['rate'],
|
118 |
$is_single = Helper::is_single();
|
119 |
}
|
120 |
|
121 |
+
$wpp_js = ( defined('WP_DEBUG') && WP_DEBUG )
|
122 |
+
? plugin_dir_url(dirname(dirname(__FILE__))) . 'assets/js/wpp.js'
|
123 |
+
: plugin_dir_url(dirname(dirname(__FILE__))) . 'assets/js/wpp.min.js';
|
124 |
+
|
125 |
+
wp_register_script('wpp-js', $wpp_js, [], WPP_VERSION, false);
|
126 |
$params = [
|
127 |
'sampling_active' => (int) $this->config['tools']['sampling']['active'],
|
128 |
'sampling_rate' => (int) $this->config['tools']['sampling']['rate'],
|
src/Output.php
CHANGED
@@ -443,6 +443,8 @@ class Output {
|
|
443 |
*/
|
444 |
private function get_title(\stdClass $post_object, int $post_id)
|
445 |
{
|
|
|
|
|
446 |
if ( $post_object->id != $post_id ) {
|
447 |
$title = get_the_title($post_id);
|
448 |
} else {
|
@@ -639,7 +641,7 @@ class Output {
|
|
639 |
}
|
640 |
}
|
641 |
|
642 |
-
return $date;
|
643 |
}
|
644 |
|
645 |
/**
|
443 |
*/
|
444 |
private function get_title(\stdClass $post_object, int $post_id)
|
445 |
{
|
446 |
+
$title = '';
|
447 |
+
|
448 |
if ( $post_object->id != $post_id ) {
|
449 |
$title = get_the_title($post_id);
|
450 |
} else {
|
641 |
}
|
642 |
}
|
643 |
|
644 |
+
return apply_filters('wpp_the_date', $date, $post_object->id);
|
645 |
}
|
646 |
|
647 |
/**
|
src/Rest/ViewLoggerEndpoint.php
CHANGED
@@ -40,6 +40,15 @@ class ViewLoggerEndpoint extends Endpoint {
|
|
40 |
$sampling = $request->get_param('sampling');
|
41 |
$sampling_rate = $request->get_param('sampling_rate');
|
42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
$table = $wpdb->prefix . "popularposts";
|
44 |
$wpdb->show_errors();
|
45 |
|
40 |
$sampling = $request->get_param('sampling');
|
41 |
$sampling_rate = $request->get_param('sampling_rate');
|
42 |
|
43 |
+
// Sampling settings from database
|
44 |
+
$_sampling = $this->config['tools']['sampling']['active'];
|
45 |
+
$_sampling_rate = $this->config['tools']['sampling']['rate'];
|
46 |
+
|
47 |
+
// Let's make sure that sampling settings we got
|
48 |
+
// on this request are what we expect
|
49 |
+
$sampling = $sampling != $_sampling ? $_sampling : $sampling;
|
50 |
+
$sampling_rate = $sampling_rate != $_sampling_rate ? $_sampling_rate : $sampling_rate;
|
51 |
+
|
52 |
$table = $wpdb->prefix . "popularposts";
|
53 |
$wpdb->show_errors();
|
54 |
|
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: 6.0
|
20 |
* Requires at least: 5.3
|
21 |
* Requires PHP: 7.2
|
22 |
* Author: Hector Cabrera
|
@@ -31,7 +31,7 @@ if ( ! defined( 'WPINC' ) ) {
|
|
31 |
die();
|
32 |
}
|
33 |
|
34 |
-
define('WPP_VERSION', '6.0
|
35 |
|
36 |
$wpp_main_plugin_file = __FILE__;
|
37 |
// Load plugin bootstrap
|
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: 6.1.0
|
20 |
* Requires at least: 5.3
|
21 |
* Requires PHP: 7.2
|
22 |
* Author: Hector Cabrera
|
31 |
die();
|
32 |
}
|
33 |
|
34 |
+
define('WPP_VERSION', '6.1.0');
|
35 |
|
36 |
$wpp_main_plugin_file = __FILE__;
|
37 |
// Load plugin bootstrap
|