PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.6.5
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.6.5
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 1.3.19 trunk All 48 releases
← All changes | app/Services/Report/ReportHelper.php +19 -4 1.6.1 → 1.6.5 View file →
@@ -10,9 +10,8 @@
10 10 use FluentCart\App\Services\DateTime\DateTime;
11 11
12 12 class ReportHelper
13 13 {
14 -
15 14 /**
16 15 * Define the group key based on the data density between the start and end dates.
17 16 *
18 17 * @param \DateTime $startDate The start date as a DateTime object.
@@ -161,9 +160,9 @@
161 160 * @return string
162 161 */
163 162 public static function sanitizeGroupKey($value)
164 163 {
165 - $acceptedValues = ['billing_country', 'shipping_country', 'payment_method', 'payment_status', 'default', 'monthly', 'yearly'];
164 + $acceptedValues = ['billing_country', 'shipping_country', 'payment_method', 'payment_status', 'default', 'daily', 'monthly', 'yearly'];
166 165 return in_array($value, $acceptedValues) ? $value : 'payment_method';
167 166 }
168 167
169 168 protected static function sanitizeParams($params)
@@ -183,11 +182,27 @@
183 182 'customDays' => 'intval',
184 183 'subscriptionType' => 'sanitize_text_field',
185 184 'orderStatus.*' => 'sanitize_text_field',
186 185 'orderTypes.*' => 'sanitize_text_field',
186 + 'filter_type' => 'sanitize_text_field',
187 187 ];
188 -
189 - return Sanitizer::sanitize($params, $rules);
188 +
189 + /**
190 + * Report params whose shape this plugin does not own.
191 + *
192 + * `advanced_filters` deliberately has no rule above. Its payload describes
193 + * filter conditions, and only whoever consumes it knows what shape is
194 + * valid — so only they can sanitize it without mangling it (running
195 + * sanitize_text_field() over a JSON blob eats everything after the first
196 + * '<'). A consumer pushes its own rule in here, and Sanitizer::sanitize()
197 + * leaves any key with no rule untouched.
198 + *
199 + * @param array $rules Sanitization rules, keyed like $params.
200 + * @param array $params The raw, unsanitized params.
201 + */
202 + $rules = apply_filters('fluent_cart/report/sanitize_params_rules', $rules, $params);
203 +
204 + return Sanitizer::sanitize($params, is_array($rules) ? $rules : []);
190 205 }
191 206
192 207 /**
193 208 * @param string $type