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/Http/Requests/FluentMetaRequest.php +48 -0 1.6.4 → 1.7.0 View file →
@@ -4,8 +4,9 @@
4 4
5 5 use FluentCart\Framework\Foundation\RequestGuard;
6 6 use FluentCart\Framework\Support\Arr;
7 7 use FluentCart\App\Services\Permission\PermissionManager;
8 +use FluentCart\App\Services\Theme\ColorPalette;
8 9
9 10 class FluentMetaRequest extends RequestGuard
10 11 {
11 12
@@ -92,13 +93,20 @@
92 93 'show_cart_icon_in_body' => 'sanitize_text_field',
93 94 'additional_address_field' => 'sanitize_text_field',
94 95 'hide_coupon_field' => 'sanitize_text_field',
95 96 'user_account_creation_mode' => 'sanitize_text_field',
97 + 'require_customer_email_verification' => function ($value) {
98 + return $value === 'no' ? 'no' : 'yes';
99 + },
100 + 'auto_login_after_account_creation' => function ($value) {
101 + return $value === 'yes' ? 'yes' : 'no';
102 + },
96 103 'force_ssl' => 'sanitize_text_field',
97 104 'checkout_page_id' => 'intval',
98 105 'custom_payment_page_id' => 'intval',
99 106 'cart_page_id' => 'intval',
100 107 'receipt_page_id' => 'intval',
108 + 'order_review_page_id' => 'intval',
101 109 'shop_page_id' => 'intval',
102 110 'customer_profile_page_id' => 'intval',
103 111 'customer_profile_page_slug' => 'sanitize_text_field',
104 112 'registration_page_id' => 'intval',
@@ -114,8 +122,11 @@
114 122 'store_state' => 'sanitize_text_field',
115 123 'template_settings_checkout_page_mode' => 'sanitize_text_field',
116 124 'show_relevant_product_in_single_page' => 'sanitize_text_field',
117 125 'show_relevant_product_in_modal' => 'sanitize_text_field',
126 + 'show_reviews_in_single_page' => 'sanitize_text_field',
127 + 'show_rating_in_shop' => 'sanitize_text_field',
128 + 'show_rating_in_relevant' => 'sanitize_text_field',
118 129 'enable_early_payment_for_installment' => 'sanitize_text_field',
119 130 'subscription_management_mode' => function ($value) {
120 131 $value = sanitize_text_field($value);
121 132 $allowed = ['gateway_managed', 'store_managed'];
@@ -139,8 +150,16 @@
139 150 'modules_settings' => 'sanitize_text_field',
140 151 'product_slug' => 'sanitize_text_field',
141 152 'min_receipt_number' => 'sanitize_text_field',
142 153 'inv_prefix' => 'sanitize_text_field',
154 + 'date_time_format_source' => function ($value) {
155 + $value = sanitize_text_field($value);
156 + return in_array($value, ['fluent_cart', 'wordpress'], true) ? $value : 'fluent_cart';
157 + },
158 + 'timezone_source' => function ($value) {
159 + $value = sanitize_text_field($value);
160 + return in_array($value, ['fluent_cart', 'wordpress'], true) ? $value : 'fluent_cart';
161 + },
143 162 'weight_unit' => function ($value) {
144 163 if (!PermissionManager::hasPermission(['store/sensitive'])) {
145 164 $stored = get_option('fluent_cart_store_settings', []);
146 165 return $stored['weight_unit'] ?? 'kg';
@@ -159,8 +178,37 @@
159 178 return in_array($value, $allowed, true) ? $value : 'cm';
160 179 },
161 180 'enable_image_zoom_in_single_product' => 'sanitize_text_field',
162 181 'enable_image_zoom_in_modal' => 'sanitize_text_field',
182 + 'appearance_source' => function ($value) {
183 + $value = sanitize_text_field($value);
184 +
185 + return in_array($value, ColorPalette::sources(), true)
186 + ? $value
187 + : ColorPalette::SOURCE_DEFAULT;
188 + },
189 + 'appearance_colors' => function ($value) {
190 + if (!is_array($value)) {
191 + return [];
192 + }
193 +
194 + // Driven off the registry rather than the submitted keys, so an
195 + // unknown property can never reach the storefront stylesheet.
196 + $colors = [];
197 +
198 + foreach (ColorPalette::globals() as $key => $definition) {
199 + $hex = sanitize_hex_color((string)Arr::get($value, $key, ''));
200 +
201 + // sanitize_hex_color() returns null for anything malformed
202 + // and '' for an empty picker; both mean "not set", which is
203 + // how a colour falls back to FluentCart's own default.
204 + if ($hex) {
205 + $colors[$key] = $hex;
206 + }
207 + }
208 +
209 + return $colors;
210 + },
163 211 'theme_setup' => function ($value) {
164 212 if (!is_array($value)) {
165 213 return [];
166 214 }