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/Hooks/actions.php +70 -0 1.6.4 → 1.7.0 View file →
@@ -25,8 +25,9 @@
25 25 (new \FluentCart\App\Hooks\Handlers\RetentionSnapshotHandler)->register();
26 26 (new \FluentCart\App\Hooks\Handlers\ReminderHandler)->register();
27 27
28 28 (new \FluentCart\App\Hooks\Handlers\ShortCodes\ShopAppHandler)->register();
29 +(new \FluentCart\App\Hooks\Handlers\ShortCodes\OrderReviewShortCode)->register();
29 30
30 31 (new FluentCart\App\Hooks\Handlers\CustomCheckout\CustomCheckout())->register();
31 32
32 33 // Tax Module Init
@@ -36,8 +37,11 @@
36 37
37 38 // Turnstile Module Init
38 39 (new \FluentCart\App\Modules\Turnstile\TurnstileInit())->register(\FluentCart\App\App::getInstance());
39 40
41 +// Reviews Module Init
42 +(new \FluentCart\App\Modules\Reviews\ReviewModule())->register();
43 +
40 44 (new \FluentCart\App\Modules\FluentPlayer\FluentPlayerAdminAssets())->register();
41 45
42 46 // Register Pro Gateways Promo
43 47 (new \FluentCart\App\Hooks\Handlers\PromoGatewaysHandler())->register();
@@ -103,8 +107,19 @@
103 107 \FluentCart\App\Hooks\Handlers\BlockEditors\StockBlock::register();
104 108 \FluentCart\App\Hooks\Handlers\BlockEditors\SoldOutBadgeBlockEditor::register();
105 109 }
106 110
111 +if (\FluentCart\Api\ModuleSettings::isActive('reviews') && class_exists(\FluentCart\App\Hooks\Handlers\BlockEditors\ProductReviewsBlockEditor::class)) {
112 + \FluentCart\App\Hooks\Handlers\BlockEditors\ProductReviewsBlockEditor::register();
113 + \FluentCart\App\Hooks\Handlers\BlockEditors\ProductRatingBlockEditor::register();
114 + \FluentCart\App\Hooks\Handlers\BlockEditors\WriteAReviewButtonBlockEditor::register();
115 + \FluentCart\App\Hooks\Handlers\BlockEditors\ProductReviewFormBlockEditor::register();
116 + \FluentCart\App\Hooks\Handlers\BlockEditors\ProductReviewSummaryBlockEditor::register();
117 + \FluentCart\App\Hooks\Handlers\BlockEditors\ProductReviewList\ProductReviewListBlockEditor::register();
118 + \FluentCart\App\Hooks\Handlers\BlockEditors\ProductReviewSummaryGroupBlockEditor::register();
119 + \FluentCart\App\Hooks\Handlers\ShortCodes\ProductReviewsShortCode::register();
120 +}
121 +
107 122 (new \FluentCart\App\Hooks\Cart\CartLoader)->register();
108 123 (new \FluentCart\App\Hooks\Handlers\GlobalPaymentHandler)->register();
109 124
110 125 \FluentCart\App\Http\Routes\WebRoutes::register();
@@ -172,8 +187,63 @@
172 187 do_action('fluent_cart/order_paid_done', $eventData);
173 188
174 189 };
175 190 add_action('fluent_cart/order_paid_async_private_handle', $orderPaidAsyncHandler, 1, 1);
191 +
192 +// The settled half of a review approval — see ReviewApproved::afterDispatch().
193 +// Runs off the request, so it trusts nothing it was told: the review is
194 +// re-read, and only one that is still an approved top-level review is
195 +// announced. Deleted or held back since, nothing fires.
196 +$reviewApprovedAsyncHandler = function ($data) {
197 + $reviewId = (int) \FluentCart\Framework\Support\Arr::get($data, 'review_id');
198 +
199 + if (!$reviewId) {
200 + return;
201 + }
202 +
203 + $review = \FluentCart\App\Models\ProductReview::query()->with('product')->find($reviewId);
204 +
205 + if (!$review || $review->parent_id || $review->status !== \FluentCart\App\Helpers\Status::REVIEW_APPROVED) {
206 + return;
207 + }
208 +
209 + do_action('fluent_cart/review_approved_done', [
210 + 'review' => $review,
211 + 'product' => $review->product,
212 + ]);
213 +};
214 +add_action('fluent_cart/review_approved_async_private_handle', $reviewApprovedAsyncHandler, 1, 1);
215 +
216 +// The settled half of a store reply — see ReviewReplied::afterDispatch().
217 +// Announced only while both halves are published: the reply itself, and the
218 +// review it answers. A reply to a review nobody can see is not a
219 +// conversation the reviewer can be pointed at.
220 +$reviewRepliedAsyncHandler = function ($data) {
221 + $replyId = (int) \FluentCart\Framework\Support\Arr::get($data, 'reply_id');
222 +
223 + if (!$replyId) {
224 + return;
225 + }
226 +
227 + $reply = \FluentCart\App\Models\ProductReview::query()->with('product')->find($replyId);
228 +
229 + if (!$reply || !$reply->parent_id || !$reply->is_admin_reply || $reply->status !== \FluentCart\App\Helpers\Status::REVIEW_APPROVED) {
230 + return;
231 + }
232 +
233 + $review = \FluentCart\App\Models\ProductReview::query()->find((int) $reply->parent_id);
234 +
235 + if (!$review || $review->parent_id || $review->status !== \FluentCart\App\Helpers\Status::REVIEW_APPROVED) {
236 + return;
237 + }
238 +
239 + do_action('fluent_cart/review_replied_done', [
240 + 'reply' => $reply,
241 + 'review' => $review,
242 + 'product' => $reply->product,
243 + ]);
244 +};
245 +add_action('fluent_cart/review_replied_async_private_handle', $reviewRepliedAsyncHandler, 1, 1);
176 246
177 247
178 248 //
179 249 //$app->addAction('fluent_cart/orders_filter_customer', function ($query, $filters) {