Site Reviews - Version 5.23.1

Version Description

(2022-04-09) =

  • Fixed admin notices
Download this release

Release Info

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

Code changes from version 5.23.0 to 5.23.1

languages/site-reviews-en_US.mo CHANGED
Binary file
languages/site-reviews-en_US.po CHANGED
@@ -1783,7 +1783,7 @@ msgctxt "admin-text"
1783
  msgid "Help"
1784
  msgstr "Help"
1785
 
1786
- #: plugin/Addons/Updater.php:222
1787
  msgctxt "admin-text"
1788
  msgid "A valid license key is required to download this update."
1789
  msgstr "A valid license key is required to download this update."
@@ -2123,17 +2123,17 @@ msgctxt "admin-text"
2123
  msgid "Yes"
2124
  msgstr "Yes"
2125
 
2126
- #: plugin/Controllers/NoticeController.php:123
2127
  msgctxt "admin-text"
2128
  msgid "Common Problems and Solutions"
2129
  msgstr "Common Problems and Solutions"
2130
 
2131
- #: plugin/Controllers/NoticeController.php:138
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:139
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!"
@@ -3768,16 +3768,34 @@ msgctxt "admin-text"
3768
  msgid "Run Migration"
3769
  msgstr "Run Migration"
3770
 
3771
- #: views/partials/notices/premium.php:3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3772
  msgctxt "admin-text"
3773
  msgid ""
3774
  "You are using the free version of Site Reviews. %sPurchase premium%s to "
3775
  "support future development and get images, filters, themes, custom forms, "
3776
- "and more."
3777
  msgstr ""
3778
  "You are using the free version of Site Reviews. %sPurchase premium%s to "
3779
  "support future development and get images, filters, themes, custom forms, "
3780
- "and more."
3781
 
3782
  #: views/partials/notices/welcome.php:4
3783
  msgctxt "admin-text"
1783
  msgid "Help"
1784
  msgstr "Help"
1785
 
1786
+ #: plugin/Addons/Updater.php:237
1787
  msgctxt "admin-text"
1788
  msgid "A valid license key is required to download this update."
1789
  msgstr "A valid license key is required to download this update."
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!"
3768
  msgid "Run Migration"
3769
  msgstr "Run Migration"
3770
 
3771
+ #: views/partials/notices/premium.php:16
3772
+ msgctxt "admin-text"
3773
+ msgid ""
3774
+ "One or more add-ons are not receiving updates. %sSave your license%s in the "
3775
+ "settings to get the latest updates and priority support."
3776
+ msgstr ""
3777
+ "One or more add-ons are not receiving updates. %sSave your license%s in the "
3778
+ "settings to get the latest updates and priority support."
3779
+
3780
+ #: views/partials/notices/premium.php:10
3781
+ msgctxt "admin-text"
3782
+ msgid ""
3783
+ "One or more of your licenses have expired. %sRenew your license%s to get "
3784
+ "the latest updates and priority support."
3785
+ msgstr ""
3786
+ "One or more of your licenses have expired. %sRenew your license%s to get "
3787
+ "the latest updates and priority support."
3788
+
3789
+ #: views/partials/notices/premium.php:4
3790
  msgctxt "admin-text"
3791
  msgid ""
3792
  "You are using the free version of Site Reviews. %sPurchase premium%s to "
3793
  "support future development and get images, filters, themes, custom forms, "
3794
+ "and more!"
3795
  msgstr ""
3796
  "You are using the free version of Site Reviews. %sPurchase premium%s to "
3797
  "support future development and get images, filters, themes, custom forms, "
3798
+ "and more!"
3799
 
3800
  #: views/partials/notices/welcome.php:4
3801
  msgctxt "admin-text"
languages/site-reviews.pot CHANGED
@@ -1340,7 +1340,7 @@ msgctxt "admin-text"
1340
  msgid "Help"
1341
  msgstr ""
1342
 
1343
- #: plugin/Addons/Updater.php:222
1344
  msgctxt "admin-text"
1345
  msgid "A valid license key is required to download this update."
1346
  msgstr ""
@@ -1702,17 +1702,17 @@ msgctxt "admin-text"
1702
  msgid "Yes"
1703
  msgstr ""
1704
 
1705
- #: plugin/Controllers/NoticeController.php:123
1706
  msgctxt "admin-text"
1707
  msgid "Common Problems and Solutions"
1708
  msgstr ""
1709
 
1710
- #: plugin/Controllers/NoticeController.php:138
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:139
1716
  msgctxt "admin-text"
1717
  msgid "Thanks for updating to Site Reviews v%s, we hope you love the changes!"
1718
  msgstr ""
@@ -3678,9 +3678,19 @@ msgctxt "admin-text"
3678
  msgid "Run Migration"
3679
  msgstr ""
3680
 
3681
- #: views/partials/notices/premium.php:3
3682
  msgctxt "admin-text"
3683
- msgid "You are using the free version of Site Reviews. %sPurchase premium%s to support future development and get images, filters, themes, custom forms, and more."
 
 
 
 
 
 
 
 
 
 
3684
  msgstr ""
3685
 
3686
  #: views/partials/notices/welcome.php:4
1340
  msgid "Help"
1341
  msgstr ""
1342
 
1343
+ #: plugin/Addons/Updater.php:237
1344
  msgctxt "admin-text"
1345
  msgid "A valid license key is required to download this update."
1346
  msgstr ""
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 ""
3678
  msgid "Run Migration"
3679
  msgstr ""
3680
 
3681
+ #: views/partials/notices/premium.php:16
3682
  msgctxt "admin-text"
3683
+ msgid "One or more add-ons are not receiving updates. %sSave your license%s in the settings to get the latest updates and priority support."
3684
+ msgstr ""
3685
+
3686
+ #: views/partials/notices/premium.php:10
3687
+ msgctxt "admin-text"
3688
+ msgid "One or more of your licenses have expired. %sRenew your license%s to get the latest updates and priority support."
3689
+ msgstr ""
3690
+
3691
+ #: views/partials/notices/premium.php:4
3692
+ msgctxt "admin-text"
3693
+ msgid "You are using the free version of Site Reviews. %sPurchase premium%s to support future development and get images, filters, themes, custom forms, and more!"
3694
  msgstr ""
3695
 
3696
  #: views/partials/notices/welcome.php:4
plugin/Addons/Updater.php CHANGED
@@ -8,6 +8,11 @@ use GeminiLabs\SiteReviews\Helpers\Url;
8
 
9
  class Updater
10
  {
 
 
 
 
 
11
  /**
12
  * @var string
13
  */
@@ -24,6 +29,10 @@ class Updater
24
  * @var bool
25
  */
26
  protected $isReady = false;
 
 
 
 
27
  /**
28
  * @var string
29
  */
@@ -32,8 +41,9 @@ class Updater
32
  /**
33
  * @param string $apiUrl
34
  * @param string $file
 
35
  */
36
- public function __construct($apiUrl, $file, array $data = [])
37
  {
38
  if (!file_exists($file)) {
39
  return;
@@ -41,6 +51,7 @@ class Updater
41
  if (!function_exists('get_plugin_data')) {
42
  require_once ABSPATH.WPINC.'/plugin.php';
43
  }
 
44
  $this->apiUrl = trailingslashit(glsr()->filterString('addon/api-url', $apiUrl));
45
  if ($this->apiUrl === Url::home()) {
46
  return;
@@ -136,8 +147,12 @@ class Updater
136
  */
137
  public function isLicenseValid()
138
  {
139
- $result = $this->checkLicense();
140
- return 'valid' === Arr::get($result, 'license');
 
 
 
 
141
  }
142
 
143
  /**
8
 
9
  class Updater
10
  {
11
+ /**
12
+ * @var string
13
+ */
14
+ protected $addonId;
15
+
16
  /**
17
  * @var string
18
  */
29
  * @var bool
30
  */
31
  protected $isReady = false;
32
+ /**
33
+ * @var string
34
+ */
35
+ protected $status;
36
  /**
37
  * @var string
38
  */
41
  /**
42
  * @param string $apiUrl
43
  * @param string $file
44
+ * @param string $addonId
45
  */
46
+ public function __construct($apiUrl, $file, $addonId, array $data = [])
47
  {
48
  if (!file_exists($file)) {
49
  return;
51
  if (!function_exists('get_plugin_data')) {
52
  require_once ABSPATH.WPINC.'/plugin.php';
53
  }
54
+ $this->addonId = $addonId;
55
  $this->apiUrl = trailingslashit(glsr()->filterString('addon/api-url', $apiUrl));
56
  if ($this->apiUrl === Url::home()) {
57
  return;
147
  */
148
  public function isLicenseValid()
149
  {
150
+ if (empty($this->status)) {
151
+ $result = $this->checkLicense();
152
+ $this->status = Arr::get($result, 'license');
153
+ update_option(glsr()->prefix.$this->addonId, $this->status); // store the license status
154
+ }
155
+ return 'valid' === $this->status;
156
  }
157
 
158
  /**
plugin/Application.php CHANGED
@@ -255,13 +255,14 @@ final class Application extends Container
255
  try {
256
  $reflection = new \ReflectionClass($addon);
257
  $addonId = $reflection->getConstant('ID');
 
258
  $updateUrl = $reflection->getConstant('UPDATE_URL');
259
  if ($addonId && $updateUrl && !array_key_exists($addonId, $this->updated)) {
260
  $this->license($addon);
261
  $license = glsr_get_option('licenses.'.$addonId);
262
- $updater = new Updater($updateUrl, $file, compact('license'));
263
  $updater->init();
264
- $this->updated[$addonId] = compact('file', 'updateUrl'); // store details for license verification in settings
265
  }
266
  } catch (\ReflectionException $e) {
267
  // We don't need to log an error here.
255
  try {
256
  $reflection = new \ReflectionClass($addon);
257
  $addonId = $reflection->getConstant('ID');
258
+ $licensed = $reflection->getConstant('LICENSED');
259
  $updateUrl = $reflection->getConstant('UPDATE_URL');
260
  if ($addonId && $updateUrl && !array_key_exists($addonId, $this->updated)) {
261
  $this->license($addon);
262
  $license = glsr_get_option('licenses.'.$addonId);
263
+ $updater = new Updater($updateUrl, $file, $addonId, compact('license'));
264
  $updater->init();
265
+ $this->updated[$addonId] = compact('file', 'licensed', 'updateUrl'); // store details for license verification in settings
266
  }
267
  } catch (\ReflectionException $e) {
268
  // We don't need to log an error here.
plugin/Commands/EnqueueAdminAssets.php CHANGED
@@ -76,7 +76,7 @@ class EnqueueAdminAssets implements Contract
76
  */
77
  public function inlineScript()
78
  {
79
- $licenses = array_filter(Arr::consolidate(glsr_get_option('licenses')));
80
  $variables = [
81
  'action' => glsr()->prefix.'action',
82
  'addons' => [],
76
  */
77
  public function inlineScript()
78
  {
79
+ $licenses = array_filter(glsr_get_option('licenses', [], 'array'));
80
  $variables = [
81
  'action' => glsr()->prefix.'action',
82
  'addons' => [],
plugin/Controllers/NoticeController.php CHANGED
@@ -2,6 +2,7 @@
2
 
3
  namespace GeminiLabs\SiteReviews\Controllers;
4
 
 
5
  use GeminiLabs\SiteReviews\Database;
6
  use GeminiLabs\SiteReviews\Database\OptionManager;
7
  use GeminiLabs\SiteReviews\Helper;
@@ -64,6 +65,34 @@ class NoticeController extends Controller
64
  wp_send_json_success();
65
  }
66
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  /**
68
  * @param string $key
69
  * @param mixed $fallback
@@ -89,10 +118,16 @@ class NoticeController extends Controller
89
  */
90
  protected function renderPremiumNotice()
91
  {
92
- if (Str::startsWith(glsr()->post_type, glsr_current_screen()->post_type)
93
- && Helper::isGreaterThan($this->getVersionFor('premium'), $this->getUserMeta('premium', 0))
94
- && glsr()->can('edit_others_posts')) {
95
- glsr()->render('partials/notices/premium');
 
 
 
 
 
 
96
  }
97
  }
98
 
2
 
3
  namespace GeminiLabs\SiteReviews\Controllers;
4
 
5
+ use GeminiLabs\SiteReviews\Addons\Updater;
6
  use GeminiLabs\SiteReviews\Database;
7
  use GeminiLabs\SiteReviews\Database\OptionManager;
8
  use GeminiLabs\SiteReviews\Helper;
65
  wp_send_json_success();
66
  }
67
 
68
+ protected function licensing()
69
+ {
70
+ $isFree = true; // priority 1
71
+ $isValid = true; // priority 2
72
+ $isSaved = true; // priority 3
73
+ foreach (glsr()->updated as $addonId => $addon) {
74
+ if (!$addon['licensed']) {
75
+ continue; // this is a free add-on
76
+ }
77
+ $isFree = false; // there are premium add-ons installed
78
+ if (empty(glsr_get_option('licenses.'.$addonId))) {
79
+ $isSaved = false;
80
+ continue; // the license has not been saved in the settings
81
+ }
82
+ $licenseStatus = get_option(glsr()->prefix.$addonId);
83
+ if (empty($licenseStatus)) { // the license status has not been stored
84
+ $license = glsr_get_option('licenses.'.$addonId);
85
+ $updater = new Updater($addon['updateUrl'], $addon['file'], $addonId, compact('license'));
86
+ $licenseStatus = $updater->isLicenseValid() ? 'valid' : 'invalid';
87
+ }
88
+ if ('valid' !== $licenseStatus) {
89
+ $isValid = false;
90
+ break;
91
+ }
92
+ }
93
+ return compact('isFree', 'isSaved', 'isValid');
94
+ }
95
+
96
  /**
97
  * @param string $key
98
  * @param mixed $fallback
118
  */
119
  protected function renderPremiumNotice()
120
  {
121
+ if (!Str::startsWith(glsr()->post_type, glsr_current_screen()->post_type)) {
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
 
plugin/Controllers/SettingsController.php CHANGED
@@ -164,7 +164,7 @@ class SettingsController extends Controller
164
  }
165
  try {
166
  $addon = glsr()->updated[$addonId];
167
- $updater = new Updater($addon['updateUrl'], $addon['file'], compact('license'));
168
  if (!$updater->isLicenseValid()) {
169
  throw new LicenseException('Invalid license: '.$license.' ('.$addonId.')');
170
  }
164
  }
165
  try {
166
  $addon = glsr()->updated[$addonId];
167
+ $updater = new Updater($addon['updateUrl'], $addon['file'], $addonId, compact('license'));
168
  if (!$updater->isLicenseValid()) {
169
  throw new LicenseException('Invalid license: '.$license.' ('.$addonId.')');
170
  }
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.0
9
  License: GPLv3
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -142,6 +142,10 @@ All documentation can be found in the "Help" page of the plugin. If your questio
142
 
143
  ## Changelog
144
 
 
 
 
 
145
  = 5.23.0 (2022-04-09) =
146
 
147
  - Added an "Export Reviews" tool
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
 
143
  ## Changelog
144
 
145
+ = 5.23.1 (2022-04-09) =
146
+
147
+ - Fixed admin notices
148
+
149
  = 5.23.0 (2022-04-09) =
150
 
151
  - Added an "Export Reviews" tool
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.0
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.1
11
  * Author: Paul Ryley
12
  * Author URI: https://geminilabs.io
13
  * License: GPL2
views/partials/notices/premium.php CHANGED
@@ -1,8 +1,23 @@
1
  <div class="glsr-notice glsr-notice-top-of-page" data-dismiss="premium">
2
- <?= sprintf(
3
- _x('You are using the free version of Site Reviews. %sPurchase premium%s to support future development and get images, filters, themes, custom forms, and more.', 'admin-text', 'site-reviews'),
4
- '<a href="https://niftyplugins.com/plugins/site-reviews-premium/" target="_blank">',
5
- '</a>'
6
- ); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  <button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button>
8
  </div>
1
  <div class="glsr-notice glsr-notice-top-of-page" data-dismiss="premium">
2
+ <?php
3
+ if ($isFree) {
4
+ printf(_x('You are using the free version of Site Reviews. %sPurchase premium%s to support future development and get images, filters, themes, custom forms, and more!', 'admin-text', 'site-reviews'),
5
+ '<a href="https://niftyplugins.com/plugins/site-reviews-premium/" target="_blank">',
6
+ '</a>'
7
+ );
8
+ } elseif (!$isValid) {
9
+ printf(
10
+ _x('One or more of your licenses have expired. %sRenew your license%s to get the latest updates and priority support.', 'admin-text', 'site-reviews'),
11
+ '<a href="https://niftyplugins.com/account/license-keys/" target="_blank">',
12
+ '</a>'
13
+ );
14
+ } else {
15
+ printf(
16
+ _x('One or more add-ons are not receiving updates. %sSave your license%s in the settings to get the latest updates and priority support.', 'admin-text', 'site-reviews'),
17
+ '<a href="'.glsr_admin_url('settings', 'licenses').'">',
18
+ '</a>'
19
+ );
20
+ }
21
+ ?>
22
  <button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button>
23
  </div>