PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.7.0
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.7.0
1.7.0 1.6.6 1.6.5 1.6.4 1.6.3 1.6.2 1.6.1 1.6.0 1.5.4 1.5.5 1.5.3 1.5.2 1.5.1 1.5.0 1.4.2 1.4.1 1.4.0 1.3.28 1.3.27 1.3.26 1.3.25 1.3.23 1.3.22 1.3.21 1.3.20 All 50 releases
← All changes | app/Helpers/Status.php +88 -32 1.6.1 → 1.7.0 View file →
@@ -31,8 +31,19 @@
31 31 public const PAYMENT_AUTHORIZED = 'authorized';
32 32 public const PAYMENT_SCHEDULED = 'payment_scheduled';
33 33
34 34 // Transaction Statuses
35 + // Product review statuses — fct_product_reviews.status values
36 + public const REVIEW_APPROVED = 'approved';
37 + public const REVIEW_PENDING = 'pending';
38 + public const REVIEW_SPAM = 'spam';
39 + public const REVIEW_TRASH = 'trash';
40 +
41 + // Review permission modes — who may submit a review
42 + public const REVIEW_PERMISSION_VERIFIED_BUYERS = 'verified_buyers';
43 + public const REVIEW_PERMISSION_LOGGED_IN = 'logged_in';
44 + public const REVIEW_PERMISSION_ANYONE = 'anyone';
45 +
35 46 public const TRANSACTION_SUCCEEDED = 'succeeded';
36 47 public const TRANSACTION_AUTHORIZED = 'authorized';
37 48 public const TRANSACTION_PENDING = 'pending';
38 49 public const TRANSACTION_REFUNDED = 'refunded';
@@ -171,17 +182,15 @@
171 182 }
172 183
173 184 public static function getEditableOrderStatuses()
174 185 {
175 - $statuses = apply_filters_deprecated('fluent-cart/editable_order_statuses', [
176 - [
177 - self::ORDER_ON_HOLD => __('On Hold', 'fluent-cart'),
178 - self::ORDER_PROCESSING => __('Processing', 'fluent-cart'),
179 - self::ORDER_COMPLETED => __('Completed', 'fluent-cart'),
180 - // 'archived' => __('Archived', 'fluent-cart'),
181 - self::ORDER_CANCELED => __('Canceled', 'fluent-cart')
182 - ], []
183 - ], '1.3.16', 'fluent_cart/editable_order_statuses', 'Use fluent_cart/editable_order_statuses instead of fluent-cart/editable_order_statuses. It will be removed in v1.4.3.');
186 + $statuses = [
187 + self::ORDER_ON_HOLD => __('On Hold', 'fluent-cart'),
188 + self::ORDER_PROCESSING => __('Processing', 'fluent-cart'),
189 + self::ORDER_COMPLETED => __('Completed', 'fluent-cart'),
190 + // 'archived' => __('Archived', 'fluent-cart'),
191 + self::ORDER_CANCELED => __('Canceled', 'fluent-cart')
192 + ];
184 193
185 194 return apply_filters('fluent_cart/editable_order_statuses', $statuses, []);
186 195 }
187 196
@@ -220,17 +229,15 @@
220 229 }
221 230
222 231 public static function getEditableTransactionStatuses($withLabel = true)
223 232 {
224 - $statuses = apply_filters_deprecated('fluent-cart/editable_transaction_statuses', [
225 - [
226 - self::TRANSACTION_PENDING => __('Pending', 'fluent-cart'),
227 - self::TRANSACTION_SUCCEEDED => __('Succeeded', 'fluent-cart'),
228 - self::TRANSACTION_AUTHORIZED => __('Authorized', 'fluent-cart'),
229 - self::TRANSACTION_FAILED => __('Failed', 'fluent-cart'),
230 - self::TRANSACTION_REFUNDED => __('Refunded', 'fluent-cart'),
231 - ], []
232 - ], '1.3.16', 'fluent_cart/editable_transaction_statuses', 'Use fluent_cart/editable_transaction_statuses instead of fluent-cart/editable_transaction_statuses. It will be removed in v1.4.3.');
233 + $statuses = [
234 + self::TRANSACTION_PENDING => __('Pending', 'fluent-cart'),
235 + self::TRANSACTION_SUCCEEDED => __('Succeeded', 'fluent-cart'),
236 + self::TRANSACTION_AUTHORIZED => __('Authorized', 'fluent-cart'),
237 + self::TRANSACTION_FAILED => __('Failed', 'fluent-cart'),
238 + self::TRANSACTION_REFUNDED => __('Refunded', 'fluent-cart'),
239 + ];
233 240
234 241 $statuses = apply_filters('fluent_cart/editable_transaction_statuses', $statuses, []);
235 242
236 243 if ($withLabel) {
@@ -252,16 +259,14 @@
252 259 }
253 260
254 261 public static function getEditableShippingStatuses()
255 262 {
256 - $statuses = apply_filters_deprecated('fluent-cart/editable_order_statuses', [
257 - [
258 - self::SHIPPING_UNSHIPPED => __('Unshipped', 'fluent-cart'),
259 - self::SHIPPING_SHIPPED => __('Shipped', 'fluent-cart'),
260 - self::SHIPPING_DELIVERED => __('Delivered', 'fluent-cart'),
261 - self::SHIPPING_UNSHIPPABLE => __('Unshippable', 'fluent-cart'),
262 - ], []
263 - ], '1.3.16', 'fluent_cart/editable_shipping_statuses', 'Use fluent_cart/editable_shipping_statuses instead of fluent-cart/editable_order_statuses. It will be removed in v1.4.3.');
263 + $statuses = [
264 + self::SHIPPING_UNSHIPPED => __('Unshipped', 'fluent-cart'),
265 + self::SHIPPING_SHIPPED => __('Shipped', 'fluent-cart'),
266 + self::SHIPPING_DELIVERED => __('Delivered', 'fluent-cart'),
267 + self::SHIPPING_UNSHIPPABLE => __('Unshippable', 'fluent-cart'),
268 + ];
264 269
265 270 return apply_filters('fluent_cart/editable_shipping_statuses', $statuses, []);
266 271 }
267 272
@@ -356,8 +361,61 @@
356 361 {
357 362 return apply_filters('fluent_cart/transaction_success_statuses', [self::TRANSACTION_SUCCEEDED, self::TRANSACTION_AUTHORIZED], []);
358 363 }
359 364
365 + /**
366 + * All product review statuses (fct_product_reviews.status values).
367 + */
368 + public static function getReviewStatuses(): array
369 + {
370 + return [
371 + self::REVIEW_APPROVED,
372 + self::REVIEW_PENDING,
373 + self::REVIEW_SPAM,
374 + self::REVIEW_TRASH,
375 + ];
376 + }
377 +
378 + /**
379 + * Review statuses that count as an existing review for duplicate
380 + * detection. Spam and trash are deliberately excluded — a review the
381 + * store rejected does not block the customer from submitting a fresh
382 + * one. Every surface that projects "can this user review?" must use
383 + * this set so it never contradicts the
384 + * ProductReviewService::canSubmitReview() write-path guard.
385 + */
386 + public static function getReviewDuplicateStatuses(): array
387 + {
388 + return apply_filters('fluent_cart/review_duplicate_statuses', [
389 + self::REVIEW_APPROVED,
390 + self::REVIEW_PENDING,
391 + ]);
392 + }
393 +
394 + /**
395 + * Review statuses the author may see in their own history: everything
396 + * except spam and trash.
397 + *
398 + * Derived by exclusion, not by listing, so a status added later is
399 + * visible to its author by default — only the two that mean "this is not
400 + * really a review" are held back, and a customer who has been silently
401 + * spammed or trashed is not shown that judgement.
402 + *
403 + * Deliberately NOT getReviewDuplicateStatuses(). The two sets happen to
404 + * hold the same values today, but they answer different questions, and
405 + * that one is filterable: a site narrowing its duplicate rules would
406 + * otherwise hide customers' pending reviews from them as a side effect.
407 + *
408 + * @return array
409 + */
410 + public static function getReviewAuthorVisibleStatuses(): array
411 + {
412 + return array_values(array_diff(
413 + static::getReviewStatuses(),
414 + [self::REVIEW_SPAM, self::REVIEW_TRASH]
415 + ));
416 + }
417 +
360 418 // Get all statuses (optional utility)
361 419 public static function all()
362 420 {
363 421 return [
@@ -372,14 +430,12 @@
372 430 }
373 431
374 432 public static function getEditableCustomerStatuses()
375 433 {
376 - $statuses = apply_filters_deprecated('fluent-cart/editable_customer_statuses', [
377 - [
378 - self::CUSTOMER_ACTIVE => __('Active', 'fluent-cart'),
379 - self::CUSTOMER_INACTIVE => __('Inactive', 'fluent-cart'),
380 - ], []
381 - ], '1.3.16', 'fluent_cart/editable_customer_statuses', 'Use fluent_cart/editable_customer_statuses instead of fluent-cart/editable_customer_statuses. It will be removed in v1.4.3.');
434 + $statuses = [
435 + self::CUSTOMER_ACTIVE => __('Active', 'fluent-cart'),
436 + self::CUSTOMER_INACTIVE => __('Inactive', 'fluent-cart'),
437 + ];
382 438
383 439 return apply_filters('fluent_cart/editable_customer_statuses', $statuses, []);
384 440 }
385 441