PluginProbe
Ultimate Store Kit – Store Builder Addons for Elementor, WooCommerce Store Builder, EDD Store Builder / 3.1.4
Ultimate Store Kit – Store Builder Addons for Elementor, WooCommerce Store Builder, EDD Store Builder v3.1.4
3.1.4 3.0.8 3.0.9 3.1.0 3.1.2 3.1.3 3.0.7 3.0.5 3.0.4 3.0.3 3.0.2 trunk 1.5.0 1.5.1 1.5.2 1.6.1 1.6.2 1.6.3 1.6.4 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 All 93 releases
← All changes | base/support/helpers.php +12 -69 1.6.33.1.4 View file →
@@ -1,34 +1,28 @@
1 1 <?php
2 2
3 -use UltimateStoreKit\Base\Support\Optional;
3 +if (! defined('ABSPATH')) {
4 + exit; // Exit if accessed directly
5 +}
4 6
5 -if(!function_exists('dd')){
7 +// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals -- usk_ / BDTUSK_ / ultimate-store-kit- are this plugin's established public prefixes. Ultimate Store Kit Pro calls into these names, as does third-party integration code, so renaming them is a breaking change. Plugin Check only recognises prefixes derived verbatim from the slug and so reports them as unprefixed.
6 8
7 - /**
8 - * dump & die.
9 - */
10 - function dd( $x ) {
11 - echo '<pre>';
12 - if ( is_array( $x ) || is_object( $x ) ) {
13 - print_r( $x );
14 - } else {
15 - echo wp_kses_post($x);
16 - }
17 - echo '</pre>';exit;
18 - }
19 -}
9 +use UltimateStoreKit\Base\Support\Optional;
20 10
21 -if (! function_exists('optional')) {
11 +if (! function_exists('ultimate_store_kit_optional')) {
22 12 /**
23 13 * Provide access to optional objects.
24 14 *
15 + * Named ultimate_store_kit_optional() rather than optional(): the unprefixed name is the
16 + * Laravel helper, which any plugin bundling illuminate/support also declares.
17 + * Behind a function_exists() guard the first declaration wins, so an
18 + * unprefixed version would silently hand this plugin a foreign Optional class.
19 + *
25 20 * @param mixed $value
26 21 * @param callable|null $callback
27 22 * @return mixed
28 23 */
29 - function optional($value = null, callable $callback = null)
30 - {
24 + function ultimate_store_kit_optional($value = null, ?callable $callback = null) {
31 25 if (is_null($callback)) {
32 26 return new Optional($value);
33 27 } elseif (! is_null($value)) {
34 28 return $callback($value);
@@ -34,55 +28,4 @@
34 28 return $callback($value);
35 29 }
36 30 }
37 31 }
38 -
39 -
40 -if (! function_exists('array_except')) {
41 - /**
42 - * Provide access to optional objects.
43 - *
44 - * @param mixed $value
45 - * @param callable|null $callback
46 - * @return mixed
47 - */
48 - function array_except($array, $keys)
49 - {
50 -
51 - $original = &$array;
52 -
53 - $keys = (array) $keys;
54 -
55 - if (count($keys) === 0) {
56 - return;
57 - }
58 -
59 - foreach ($keys as $key) {
60 - // if the exact key exists in the top-level, remove it
61 - if (array_key_exists($key, $array)) {
62 - unset($array[$key]);
63 -
64 - continue;
65 - }
66 -
67 - $parts = explode('.', $key);
68 -
69 - // clean up before each pass
70 - $array = &$original;
71 -
72 - while (count($parts) > 1) {
73 - $part = array_shift($parts);
74 -
75 - if (isset($array[$part]) && is_array($array[$part])) {
76 - $array = &$array[$part];
77 - } else {
78 - continue 2;
79 - }
80 - }
81 -
82 - unset($array[array_shift($parts)]);
83 - }
84 -
85 - return $array;
86 - }
87 -}
88 -