Site Reviews - Version 5.23.2

Version Description

(2022-04-10) =

  • Fixed admin notices
  • Fixed AJAX pagination of filtered reviews (only applies if using the Review Filters add-on)
  • Fixed detection of broken Avatar URLs on local development websites
Download this release

Release Info

Developer geminilabs
Plugin Icon 128x128 Site Reviews
Version 5.23.2
Comparing to
See all releases

Code changes from version 5.23.1 to 5.23.2

languages/site-reviews-en_US.po CHANGED
@@ -41,7 +41,7 @@ msgstr[1] "%s stars or less"
41
  msgid "There are no reviews yet. Be the first one to write one."
42
  msgstr "There are no reviews yet. Be the first one to write one."
43
 
44
- #: plugin/Review.php:158, plugin/Modules/Notification.php:75
45
  msgid "Anonymous"
46
  msgstr "Anonymous"
47
 
@@ -197,7 +197,7 @@ msgstr "and"
197
  msgid "Show less"
198
  msgstr "Show less"
199
 
200
- #: plugin/Modules/Avatar.php:122
201
  msgid "Avatar for %s"
202
  msgstr "Avatar for %s"
203
 
@@ -2123,17 +2123,17 @@ msgctxt "admin-text"
2123
  msgid "Yes"
2124
  msgstr "Yes"
2125
 
2126
- #: plugin/Controllers/NoticeController.php:158
2127
  msgctxt "admin-text"
2128
  msgid "Common Problems and Solutions"
2129
  msgstr "Common Problems and Solutions"
2130
 
2131
- #: plugin/Controllers/NoticeController.php:173
2132
  msgctxt "admin-text"
2133
  msgid "Thanks for installing Site Reviews v%s, we hope you love it!"
2134
  msgstr "Thanks for installing Site Reviews v%s, we hope you love it!"
2135
 
2136
- #: plugin/Controllers/NoticeController.php:174
2137
  msgctxt "admin-text"
2138
  msgid "Thanks for updating to Site Reviews v%s, we hope you love the changes!"
2139
  msgstr "Thanks for updating to Site Reviews v%s, we hope you love the changes!"
41
  msgid "There are no reviews yet. Be the first one to write one."
42
  msgstr "There are no reviews yet. Be the first one to write one."
43
 
44
+ #: plugin/Review.php:158, plugin/Modules/Avatar.php:100, plugin/Modules/Notification.php:75
45
  msgid "Anonymous"
46
  msgstr "Anonymous"
47
 
197
  msgid "Show less"
198
  msgstr "Show less"
199
 
200
+ #: plugin/Modules/Avatar.php:123
201
  msgid "Avatar for %s"
202
  msgstr "Avatar for %s"
203
 
2123
  msgid "Yes"
2124
  msgstr "Yes"
2125
 
2126
+ #: plugin/Controllers/NoticeController.php:161
2127
  msgctxt "admin-text"
2128
  msgid "Common Problems and Solutions"
2129
  msgstr "Common Problems and Solutions"
2130
 
2131
+ #: plugin/Controllers/NoticeController.php:176
2132
  msgctxt "admin-text"
2133
  msgid "Thanks for installing Site Reviews v%s, we hope you love it!"
2134
  msgstr "Thanks for installing Site Reviews v%s, we hope you love it!"
2135
 
2136
+ #: plugin/Controllers/NoticeController.php:177
2137
  msgctxt "admin-text"
2138
  msgid "Thanks for updating to Site Reviews v%s, we hope you love the changes!"
2139
  msgstr "Thanks for updating to Site Reviews v%s, we hope you love the changes!"
languages/site-reviews.pot CHANGED
@@ -1197,7 +1197,7 @@ msgctxt "admin-text"
1197
  msgid "The [%s] method has been deprecated and will be soon be removed, please use the [%s] method instead."
1198
  msgstr ""
1199
 
1200
- #: plugin/Review.php:158, plugin/Modules/Notification.php:75
1201
  msgid "Anonymous"
1202
  msgstr ""
1203
 
@@ -1702,17 +1702,17 @@ msgctxt "admin-text"
1702
  msgid "Yes"
1703
  msgstr ""
1704
 
1705
- #: plugin/Controllers/NoticeController.php:158
1706
  msgctxt "admin-text"
1707
  msgid "Common Problems and Solutions"
1708
  msgstr ""
1709
 
1710
- #: plugin/Controllers/NoticeController.php:173
1711
  msgctxt "admin-text"
1712
  msgid "Thanks for installing Site Reviews v%s, we hope you love it!"
1713
  msgstr ""
1714
 
1715
- #: plugin/Controllers/NoticeController.php:174
1716
  msgctxt "admin-text"
1717
  msgid "Thanks for updating to Site Reviews v%s, we hope you love the changes!"
1718
  msgstr ""
@@ -2236,7 +2236,7 @@ msgctxt "admin-text"
2236
  msgid "Respond Publicly"
2237
  msgstr ""
2238
 
2239
- #: plugin/Modules/Avatar.php:122
2240
  msgid "Avatar for %s"
2241
  msgstr ""
2242
 
1197
  msgid "The [%s] method has been deprecated and will be soon be removed, please use the [%s] method instead."
1198
  msgstr ""
1199
 
1200
+ #: plugin/Review.php:158, plugin/Modules/Avatar.php:100, plugin/Modules/Notification.php:75
1201
  msgid "Anonymous"
1202
  msgstr ""
1203
 
1702
  msgid "Yes"
1703
  msgstr ""
1704
 
1705
+ #: plugin/Controllers/NoticeController.php:161
1706
  msgctxt "admin-text"
1707
  msgid "Common Problems and Solutions"
1708
  msgstr ""
1709
 
1710
+ #: plugin/Controllers/NoticeController.php:176
1711
  msgctxt "admin-text"
1712
  msgid "Thanks for installing Site Reviews v%s, we hope you love it!"
1713
  msgstr ""
1714
 
1715
+ #: plugin/Controllers/NoticeController.php:177
1716
  msgctxt "admin-text"
1717
  msgid "Thanks for updating to Site Reviews v%s, we hope you love the changes!"
1718
  msgstr ""
2236
  msgid "Respond Publicly"
2237
  msgstr ""
2238
 
2239
+ #: plugin/Modules/Avatar.php:123
2240
  msgid "Avatar for %s"
2241
  msgstr ""
2242
 
plugin/Controllers/NoticeController.php CHANGED
@@ -122,12 +122,15 @@ class NoticeController extends Controller
122
  return;
123
  }
124
  $licensing = $this->licensing();
 
 
125
  if ($licensing['isFree']) {
126
- if (Helper::isGreaterThan($this->getVersionFor('premium'), $this->getUserMeta('premium', 0))) {
127
  glsr()->render('partials/notices/premium', $licensing);
128
  }
129
- } elseif ((glsr()->can('edit_others_posts') && !$licensing['isSaved']) || !$licensing['isValid']) {
130
- glsr()->render('partials/notices/premium', $licensing); // always show this notice!
 
131
  }
132
  }
133
 
122
  return;
123
  }
124
  $licensing = $this->licensing();
125
+ $isNewVersion = Helper::isGreaterThan($this->getVersionFor('premium'), $this->getUserMeta('premium', 0));
126
+ $isUnsavedLicense = glsr()->can('edit_others_posts') && !$licensing['isSaved'];
127
  if ($licensing['isFree']) {
128
+ if ($isNewVersion) {
129
  glsr()->render('partials/notices/premium', $licensing);
130
  }
131
+ } elseif (($isUnsavedLicense && $isNewVersion) || !$licensing['isValid']) {
132
+ // always show this notice for invalid licenses!
133
+ glsr()->render('partials/notices/premium', $licensing);
134
  }
135
  }
136
 
plugin/Controllers/PublicController.php CHANGED
@@ -30,14 +30,14 @@ class PublicController extends Controller
30
  public function fetchPagedReviewsAjax(Request $request)
31
  {
32
  glsr()->store(glsr()->paged_handle, $request);
33
- $args = Arr::consolidate($request->atts);
34
- $args = glsr(SiteReviewsDefaults::class)->restrict($args);
35
- $html = glsr(SiteReviewsShortcode::class)->buildReviewsHtml($args);
 
36
  $response = [
37
  'pagination' => $html->getPagination($wrap = false),
38
  'reviews' => $html->getReviews(),
39
  ];
40
- glsr()->discard(glsr()->paged_handle);
41
  wp_send_json_success($response);
42
  }
43
 
30
  public function fetchPagedReviewsAjax(Request $request)
31
  {
32
  glsr()->store(glsr()->paged_handle, $request);
33
+ $shortcode = glsr(SiteReviewsShortcode::class);
34
+ $atts = glsr(SiteReviewsDefaults::class)->restrict($request->cast('atts', 'array'));
35
+ $args = $shortcode->normalizeAtts($atts)->toArray();
36
+ $html = $shortcode->buildReviewsHtml($args);
37
  $response = [
38
  'pagination' => $html->getPagination($wrap = false),
39
  'reviews' => $html->getReviews(),
40
  ];
 
41
  wp_send_json_success($response);
42
  }
43
 
plugin/Helper.php CHANGED
@@ -319,20 +319,16 @@ class Helper
319
 
320
  /**
321
  * @param string $url
322
- * @param int $maxRedirects
323
  * @return int|false
324
  */
325
- public static function remoteStatusCheck($url, $maxRedirects = 0)
326
  {
327
- $headers = @get_headers($url, 0, stream_context_create([ // PHP 5.6 does not support $context
328
- 'http' => [
329
- 'ignore_errors' => 1,
330
- 'max_redirects' => $maxRedirects,
331
- 'method' => 'HEAD',
332
- ],
333
- ]));
334
- if (false !== $headers) {
335
- return Cast::toInt(substr($headers[0], 9, 3));
336
  }
337
  return false;
338
  }
319
 
320
  /**
321
  * @param string $url
 
322
  * @return int|false
323
  */
324
+ public static function remoteStatusCheck($url)
325
  {
326
+ $response = wp_safe_remote_head($url, [
327
+ 'timeout' => 5,
328
+ 'sslverify' => false,
329
+ ]);
330
+ if (!is_wp_error($response)) {
331
+ return $response['response']['code'];
 
 
 
332
  }
333
  return false;
334
  }
plugin/Modules/Avatar.php CHANGED
@@ -43,10 +43,7 @@ class Avatar
43
  return $this->generatePixels($review);
44
  }
45
  if ('initials' === $this->type) {
46
- if (!empty($review->author)) {
47
- return $this->generateInitials($review);
48
- }
49
- $this->type = 'mystery'; // can't create initials without a name
50
  }
51
  return $this->type;
52
  }
@@ -85,7 +82,7 @@ class Avatar
85
  if (!$this->isUrl($avatarUrl)) {
86
  return $this->fallbackUrl($review, $size);
87
  }
88
- if (404 === Helper::remoteStatusCheck($avatarUrl)) {
89
  // @todo generate the images with javascript on canvas to avoid this status check
90
  return $this->fallbackUrl($review, $size);
91
  }
@@ -98,7 +95,11 @@ class Avatar
98
  */
99
  public function generateInitials($review)
100
  {
101
- return glsr(InitialsAvatar::class)->create($review->author);
 
 
 
 
102
  }
103
 
104
  /**
43
  return $this->generatePixels($review);
44
  }
45
  if ('initials' === $this->type) {
46
+ return $this->generateInitials($review);
 
 
 
47
  }
48
  return $this->type;
49
  }
82
  if (!$this->isUrl($avatarUrl)) {
83
  return $this->fallbackUrl($review, $size);
84
  }
85
+ if (200 !== Helper::remoteStatusCheck($avatarUrl)) {
86
  // @todo generate the images with javascript on canvas to avoid this status check
87
  return $this->fallbackUrl($review, $size);
88
  }
95
  */
96
  public function generateInitials($review)
97
  {
98
+ $name = $review->author;
99
+ if (empty($review->author)) {
100
+ $name = __('Anonymous', 'site-reviews');
101
+ }
102
+ return glsr(InitialsAvatar::class)->create($name);
103
  }
104
 
105
  /**
plugin/Modules/Dump.php CHANGED
@@ -116,8 +116,12 @@ class Dump
116
  $this->result[] = 'Nested '.$classname." Object\n";
117
  return;
118
  }
119
- $this->result[] = $classname." Object (\n";
120
- $subject = (array) $subject;
 
 
 
 
121
  foreach ($subject as $key => $val) {
122
  if (false === $this->isIgnoredKey($key)) {
123
  $this->result[] = $this->formatKey($key);
116
  $this->result[] = 'Nested '.$classname." Object\n";
117
  return;
118
  }
119
+ if ($subject instanceof \ArrayObject) {
120
+ $this->result[] = $classname." ArrayObject (\n";
121
+ } else {
122
+ $this->result[] = $classname." Object (\n";
123
+ $subject = (array) $subject;
124
+ }
125
  foreach ($subject as $key => $val) {
126
  if (false === $this->isIgnoredKey($key)) {
127
  $this->result[] = $this->formatKey($key);
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: reviews, ratings, testimonials, woocommerce, product reviews, business rev
5
  Tested up to: 5.9
6
  Requires at least: 5.5
7
  Requires PHP: 5.6.20
8
- Stable tag: 5.23.1
9
  License: GPLv3
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -142,9 +142,11 @@ All documentation can be found in the "Help" page of the plugin. If your questio
142
 
143
  ## Changelog
144
 
145
- = 5.23.1 (2022-04-09) =
146
 
147
  - Fixed admin notices
 
 
148
 
149
  = 5.23.0 (2022-04-09) =
150
 
5
  Tested up to: 5.9
6
  Requires at least: 5.5
7
  Requires PHP: 5.6.20
8
+ Stable tag: 5.23.2
9
  License: GPLv3
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
11
 
142
 
143
  ## Changelog
144
 
145
+ = 5.23.2 (2022-04-10) =
146
 
147
  - Fixed admin notices
148
+ - Fixed AJAX pagination of filtered reviews (only applies if using the Review Filters add-on)
149
+ - Fixed detection of broken Avatar URLs on local development websites
150
 
151
  = 5.23.0 (2022-04-09) =
152
 
site-reviews.php CHANGED
@@ -7,7 +7,7 @@
7
  * Plugin Name: Site Reviews
8
  * Plugin URI: https://wordpress.org/plugins/site-reviews
9
  * Description: Receive and display reviews on your website
10
- * Version: 5.23.1
11
  * Author: Paul Ryley
12
  * Author URI: https://geminilabs.io
13
  * License: GPL2
7
  * Plugin Name: Site Reviews
8
  * Plugin URI: https://wordpress.org/plugins/site-reviews
9
  * Description: Receive and display reviews on your website
10
+ * Version: 5.23.2
11
  * Author: Paul Ryley
12
  * Author URI: https://geminilabs.io
13
  * License: GPL2