Site Reviews - Version 5.12.4

Version Description

(2021-07-01) =

  • Fixed the filters on the "All Reviews" admin page
Download this release

Release Info

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

Code changes from version 5.12.3 to 5.12.4

languages/site-reviews-en_US.mo CHANGED
Binary file
languages/site-reviews-en_US.po CHANGED
@@ -310,7 +310,7 @@ msgstr "Rated <strong>%s</strong> out of %s"
310
  msgid "Submit your review"
311
  msgstr "Submit your review"
312
 
313
- #: plugin/Modules/Html/Tags/ReviewAssignedLinksTag.php:43
314
  msgid "Review of %s"
315
  msgstr "Review of %s"
316
 
@@ -2670,6 +2670,11 @@ msgctxt "admin-text"
2670
  msgid "All assigned posts"
2671
  msgstr "All assigned posts"
2672
 
 
 
 
 
 
2673
  #: plugin/Controllers/ListTableColumns/ColumnFilterAssignedUser.php:20
2674
  msgctxt "admin-text"
2675
  msgid "Filter by assigned user"
310
  msgid "Submit your review"
311
  msgstr "Submit your review"
312
 
313
+ #: plugin/Modules/Html/Tags/ReviewAssignedLinksTag.php:47
314
  msgid "Review of %s"
315
  msgstr "Review of %s"
316
 
2670
  msgid "All assigned posts"
2671
  msgstr "All assigned posts"
2672
 
2673
+ #: plugin/Controllers/ListTableColumns/ColumnFilterAssignedPost.php:48, plugin/Modules/Html/Tags/ReviewAssignedLinksTag.php:26
2674
+ msgctxt "admin-text"
2675
+ msgid "No title"
2676
+ msgstr "No title"
2677
+
2678
  #: plugin/Controllers/ListTableColumns/ColumnFilterAssignedUser.php:20
2679
  msgctxt "admin-text"
2680
  msgid "Filter by assigned user"
languages/site-reviews.pot CHANGED
@@ -2502,6 +2502,11 @@ msgctxt "admin-text"
2502
  msgid "All assigned posts"
2503
  msgstr ""
2504
 
 
 
 
 
 
2505
  #: plugin/Controllers/ListTableColumns/ColumnFilterAssignedUser.php:20
2506
  msgctxt "admin-text"
2507
  msgid "Filter by assigned user"
@@ -3305,7 +3310,7 @@ msgstr ""
3305
  msgid "Submit your review"
3306
  msgstr ""
3307
 
3308
- #: plugin/Modules/Html/Tags/ReviewAssignedLinksTag.php:43
3309
  msgid "Review of %s"
3310
  msgstr ""
3311
 
2502
  msgid "All assigned posts"
2503
  msgstr ""
2504
 
2505
+ #: plugin/Controllers/ListTableColumns/ColumnFilterAssignedPost.php:48, plugin/Modules/Html/Tags/ReviewAssignedLinksTag.php:26
2506
+ msgctxt "admin-text"
2507
+ msgid "No title"
2508
+ msgstr ""
2509
+
2510
  #: plugin/Controllers/ListTableColumns/ColumnFilterAssignedUser.php:20
2511
  msgctxt "admin-text"
2512
  msgid "Filter by assigned user"
3310
  msgid "Submit your review"
3311
  msgstr ""
3312
 
3313
+ #: plugin/Modules/Html/Tags/ReviewAssignedLinksTag.php:47
3314
  msgid "Review of %s"
3315
  msgstr ""
3316
 
plugin/Controllers/ListTableColumns/ColumnFilter.php CHANGED
@@ -7,7 +7,7 @@ use GeminiLabs\SiteReviews\Modules\Html\Builder;
7
  abstract class ColumnFilter
8
  {
9
  protected $enabled = false;
10
- protected $maxWidth = 150;
11
 
12
  /**
13
  * @return string|void
7
  abstract class ColumnFilter
8
  {
9
  protected $enabled = false;
10
+ protected $maxWidth = 160;
11
 
12
  /**
13
  * @return string|void
plugin/Controllers/ListTableColumns/ColumnFilterAssignedPost.php CHANGED
@@ -37,13 +37,20 @@ class ColumnFilterAssignedPost extends ColumnFilter
37
  return [];
38
  }
39
  $posts = get_posts([
40
- 'order' => 'ASC',
41
- 'orderby' => 'post_title',
42
  'post_type' => 'any',
43
- 'posts_per_page' => -1,
44
  'post__in' => $postIds,
 
45
  ]);
46
- return wp_list_pluck($posts, 'post_title', 'ID');
 
 
 
 
 
 
 
 
47
  }
48
 
49
  /**
37
  return [];
38
  }
39
  $posts = get_posts([
40
+ 'no_found_rows' => true, // skip counting the total rows found
 
41
  'post_type' => 'any',
 
42
  'post__in' => $postIds,
43
+ 'posts_per_page' => -1,
44
  ]);
45
+ $options = wp_list_pluck($posts, 'post_title', 'ID');
46
+ foreach ($options as $id => &$title) {
47
+ if (empty($title)) {
48
+ $title = sprintf('%s', _x('No title', 'admin-text', 'site-reviews'));
49
+ }
50
+ $title = sprintf('%s (ID: %s)', $title, $id);
51
+ }
52
+ natcasesort($options);
53
+ return $options;
54
  }
55
 
56
  /**
plugin/Controllers/ListTableController.php CHANGED
@@ -310,7 +310,7 @@ class ListTableController extends Controller
310
  $query->set('meta_key', Str::prefix($orderby, '_'));
311
  $query->set('orderby', 'meta_value');
312
  }
313
- if ($termId = filter_input(INPUT_GET, 'assigned_term_id', FILTER_SANITIZE_NUMBER_INT)) {
314
  $query->set('tax_query', [[
315
  'taxonomy' => glsr()->taxonomy,
316
  'terms' => $termId,
310
  $query->set('meta_key', Str::prefix($orderby, '_'));
311
  $query->set('orderby', 'meta_value');
312
  }
313
+ if ($termId = filter_input(INPUT_GET, 'assigned_term', FILTER_SANITIZE_NUMBER_INT)) {
314
  $query->set('tax_query', [[
315
  'taxonomy' => glsr()->taxonomy,
316
  'terms' => $termId,
plugin/Defaults/ColumnFilterbyDefaults.php CHANGED
@@ -12,8 +12,8 @@ class ColumnFilterbyDefaults extends Defaults
12
  protected function defaults()
13
  {
14
  return [
15
- 'assigned_post_id' => FILTER_SANITIZE_NUMBER_INT,
16
- 'assigned_user_id' => FILTER_SANITIZE_NUMBER_INT,
17
  'rating' => FILTER_SANITIZE_NUMBER_INT,
18
  'type' => FILTER_SANITIZE_STRING,
19
  ];
12
  protected function defaults()
13
  {
14
  return [
15
+ 'assigned_post' => FILTER_SANITIZE_NUMBER_INT,
16
+ 'assigned_user' => FILTER_SANITIZE_NUMBER_INT,
17
  'rating' => FILTER_SANITIZE_NUMBER_INT,
18
  'type' => FILTER_SANITIZE_STRING,
19
  ];
plugin/Modules/Html/Tags/ReviewAssignedLinksTag.php CHANGED
@@ -21,9 +21,13 @@ class ReviewAssignedLinksTag extends ReviewTag
21
  foreach (Arr::consolidate($value) as $postId) {
22
  $postId = Helper::getPostId(glsr(Multilingual::class)->getPostId($postId));
23
  if (!empty($postId) && !in_array($postId, $usedIds)) {
 
 
 
 
24
  $links[] = glsr(Builder::class)->a([
25
  'href' => get_the_permalink($postId),
26
- 'text' => get_the_title($postId),
27
  ]);
28
  $usedIds[] = $postId;
29
  $usedIds = Arr::unique($usedIds);
21
  foreach (Arr::consolidate($value) as $postId) {
22
  $postId = Helper::getPostId(glsr(Multilingual::class)->getPostId($postId));
23
  if (!empty($postId) && !in_array($postId, $usedIds)) {
24
+ $title = get_the_title($postId);
25
+ if (empty(trim($title))) {
26
+ $title = _x('No title', 'admin-text', 'site-reviews');
27
+ }
28
  $links[] = glsr(Builder::class)->a([
29
  'href' => get_the_permalink($postId),
30
+ 'text' => $title,
31
  ]);
32
  $usedIds[] = $postId;
33
  $usedIds = Arr::unique($usedIds);
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: reviews, ratings, testimonials, woocommerce, product reviews
5
  Tested up to: 5.7
6
  Requires at least: 5.5
7
  Requires PHP: 5.6
8
- Stable tag: 5.12.3
9
  License: GPLv3
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -137,6 +137,10 @@ All documentation can be found in the "Help" page of the plugin. If your questio
137
 
138
  ## Changelog
139
 
 
 
 
 
140
  = 5.12.3 (2021-07-01) =
141
 
142
  - Added a `data-rating` attribute to the review ratings
5
  Tested up to: 5.7
6
  Requires at least: 5.5
7
  Requires PHP: 5.6
8
+ Stable tag: 5.12.4
9
  License: GPLv3
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
11
 
137
 
138
  ## Changelog
139
 
140
+ = 5.12.4 (2021-07-01) =
141
+
142
+ - Fixed the filters on the "All Reviews" admin page
143
+
144
  = 5.12.3 (2021-07-01) =
145
 
146
  - Added a `data-rating` attribute to the review ratings
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.12.3
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.12.4
11
  * Author: Paul Ryley
12
  * Author URI: https://geminilabs.io
13
  * License: GPL2