PluginProbe
FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment / 3.1.14
FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment v3.1.14
3.1.14 3.1.13 3.1.12 3.1.11 3.1.10 3.1.9 3.1.8 3.1.7 trunk 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 All 123 releases
← All changes | Inc/Framework/Inc/Helpers/ArrayHelper.php +30 -3 1.0.3 → 3.1.14 View file →
@@ -1,12 +1,12 @@
1 1 <?php
2 2 /**
3 3 * @package FirePlugins Framework
4 - * @version 1.0.4
4 + * @version 1.2.6
5 5 *
6 6 * @author FirePlugins <[email protected]>
7 7 * @link https://www.fireplugins.com
8 - * @copyright Copyright © 2021 FirePlugins All Rights Reserved
8 + * @copyright Copyright © 2026 FirePlugins All Rights Reserved
9 9 * @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
10 10 */
11 11
12 12 namespace FPFramework\Helpers;
@@ -15,9 +15,36 @@
15 15 {
16 16 exit; // Exit if accessed directly.
17 17 }
18 18
19 -class ArrayHelper {
19 +class ArrayHelper
20 +{
21 + /**
22 + * Fix arrays, remove duplicate items, null items and whitespace around item values.
23 + *
24 + * @param array $subject
25 + *
26 + * @return array The new cleaned array
27 + */
28 + public static function cleanArray($subject)
29 + {
30 + if (!is_array($subject))
31 + {
32 + return [];
33 + }
34 +
35 + $subject = array_unique($subject);
36 + $subject = array_map('trim', $subject);
37 +
38 + // Remove empty items. We use a custom callback here because the default behavior of array_filter removes 0 values as well.
39 + $subject = array_filter($subject, function($value)
40 + {
41 + return ($value !== null && $value !== false && $value !== '');
42 + });
43 +
44 + return $subject;
45 + }
46 +
20 47 /**
21 48 * Merges 2 arrays
22 49 *
23 50 * @param array $arr1