PluginProbe
Discount Rules for WooCommerce – Disco | Dynamic Pricing, Conditions, Bulk, Bundle, BOGO / 1.4.22
Discount Rules for WooCommerce – Disco | Dynamic Pricing, Conditions, Bulk, Bundle, BOGO v1.4.22
1.4.22 1.4.21 1.4.20 1.4.19 1.4.18 1.4.17 1.4.16 1.4.15 1.4.14 1.4.13 1.4.12 1.4.11 1.4.10 1.4.9 1.4.8 1.4.7 1.4.6 1.4.5 1.4.4 1.4.3 1.4.2 1.4.1 1.4.0 1.3.54 1.3.53 All 185 releases
← All changes | app/Utility/Conditions.php +8 -8 1.4.20 → 1.4.22 View file →
@@ -141,11 +141,11 @@
141 141 // Apply the operator
142 142 if ( $first ) {
143 143 $result = $condition;
144 144 $first = false;
145 - } elseif ( $operator === 'and' ) {
145 + } elseif ( 'and' === $operator ) {
146 146 $result = $result && $condition;// phpcs:ignore
147 - } elseif ( $operator === 'or' ) {
147 + } elseif ( 'or' === $operator ) {
148 148 $result = $result || $condition;// phpcs:ignore
149 149 }
150 150 }//end foreach
151 151
@@ -224,14 +224,14 @@
224 224 $type = 'array';
225 225 }
226 226
227 227 // If $compare is an array, check if it is a number range. Only for between condition.
228 - if ( $condition === 'between' && is_array( $compare ) && count( $compare ) === 2 ) {
228 + if ( 'between' === $condition && is_array( $compare ) && 2 === count( $compare ) ) {
229 229 $type = 'integer';
230 230 }
231 231
232 232 // If $compare is an array, check if it is a date range. Only for date between condition.
233 - if ( $condition === 'date_between'
233 + if ( 'date_between' === $condition
234 234 && is_array( $compare )
235 235 && count( $compare ) === 2
236 236 && strtotime( $compare[0] )
237 237 && strtotime( $compare[1] )
@@ -498,11 +498,11 @@
498 498
499 499 if ( $first_group ) {
500 500 $final_result = $group_result;
501 501 $first_group = false;
502 - } elseif ( $group->base_operator === 'and' ) {
502 + } elseif ( 'and' === $group->base_operator ) {
503 503 $final_result = $final_result && $group_result; // phpcs:ignore
504 - } elseif ( $group->base_operator === 'or' ) {
504 + } elseif ( 'or' === $group->base_operator ) {
505 505 $final_result = $final_result || $group_result; // phpcs:ignore
506 506 }
507 507 }
508 508
@@ -564,9 +564,9 @@
564 564 ) {
565 565 return false;
566 566 }
567 567
568 - if ( $filter->compare_with === 'item_quantity' ) {
568 + if ( 'item_quantity' === $filter->compare_with ) {
569 569 $total_quantity = array_sum(
570 570 array_map(
571 571 function( $item ) {
572 572 if ( isset( $item['quantity'] ) ) {
@@ -579,9 +579,9 @@
579 579 )
580 580 );
581 581
582 582 $compare_value = $total_quantity;
583 - } elseif ( $filter->compare_with === 'item_count' ) {
583 + } elseif ( 'item_count' === $filter->compare_with ) {
584 584 $compare_value = count( $matched_products );
585 585 } else {
586 586 return false;
587 587 }