PluginProbe
SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster / 2.3.0
SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster v2.3.0
2.6.0 trunk 1.1.0 1.1.4 1.2.1 1.2.2 1.2.3 1.2.5 1.2.9 1.3.1 1.3.2 1.5.0 1.5.1 1.5.4 1.5.7 1.5.8 1.5.9 1.6.2 1.6.5 1.6.8 1.7.2 1.7.4 1.7.5 1.7.9 1.8.1 All 42 releases
← All changes | includes/functions.php +24 -2 1.2.12.3.0 View file →
@@ -117,11 +117,17 @@
117 117 * @SuppressWarnings(PHPMD.NPathComplexity)
118 118 * @param array $conditions Conditions data.
119 119 */
120 120 function sellkit_conditions_validation( $conditions ) {
121 - $is_valid = true;
122 - $condition_type = ! empty( $conditions[1]['type'] ) ? $conditions[1]['type'] : 'and';
121 + $is_valid = true;
123 122
123 + if ( empty( $conditions ) ) {
124 + return true;
125 + }
126 +
127 + $first_condition = reset( $conditions );
128 + $condition_type = ! empty( $first_condition['type'] ) ? $first_condition['type'] : 'and';
129 +
124 130 if ( 'or' === $condition_type ) {
125 131 $is_valid = false;
126 132 }
127 133
@@ -150,5 +156,21 @@
150 156 return true;
151 157 }
152 158
153 159 return false;
160 +}
161 +
162 +if ( ! function_exists( 'array_key_last' ) ) {
163 + /**
164 + * Adds support for array_key_last function for lower php than 7.3.0 & WP lower than 5.9.0.
165 + *
166 + * @param array $array array.
167 + */
168 + function array_key_last( $array ) {
169 + if ( empty( $array ) ) {
170 + return null;
171 + }
172 +
173 + end( $array );
174 + return key( $array );
175 + }
154 176 }