@@ 240-250 (lines=11) @@ | ||
237 | ||
238 | foreach ( $show_for as $key => $rule ) { |
|
239 | // Check if we have a relation key |
|
240 | if ( $key === 'relation' ) { |
|
241 | $relation = strtoupper( $rule ); |
|
242 | ||
243 | if ( ! in_array( $relation, $allowed_relations ) ) { |
|
244 | Incorrect_Syntax_Exception::raise( 'Invalid relation type ' . $rule . '. ' . |
|
245 | 'The rule should be one of the following: "' . implode( '", "', $allowed_relations ) . '"' ); |
|
246 | } |
|
247 | ||
248 | $parsed_show_for['relation'] = $relation; |
|
249 | continue; |
|
250 | } |
|
251 | ||
252 | // Check if the rule is valid |
|
253 | if ( ! is_string( $rule ) || empty( $rule ) ) { |
@@ 787-797 (lines=11) @@ | ||
784 | ||
785 | foreach ( $rules as $key => $rule ) { |
|
786 | // Check if we have a relation key |
|
787 | if ( $key === 'relation' ) { |
|
788 | $relation = strtoupper( $rule ); |
|
789 | ||
790 | if ( ! in_array( $relation, $allowed_relations ) ) { |
|
791 | Incorrect_Syntax_Exception::raise( 'Invalid relation type ' . $rule . '. ' . |
|
792 | 'The rule should be one of the following: "' . implode( '", "', $allowed_relations ) . '"' ); |
|
793 | } |
|
794 | ||
795 | $parsed_rules['relation'] = $relation; |
|
796 | continue; |
|
797 | } |
|
798 | ||
799 | // Check if the rule is valid |
|
800 | if ( ! is_array( $rule ) || empty( $rule['field'] ) ) { |