@@ 217-227 (lines=11) @@ | ||
214 | ||
215 | foreach ( $show_for as $key => $rule ) { |
|
216 | // Check if we have a relation key |
|
217 | if ( $key === 'relation' ) { |
|
218 | $relation = strtoupper( $rule ); |
|
219 | ||
220 | if ( ! in_array( $relation, $allowed_relations ) ) { |
|
221 | Incorrect_Syntax_Exception::raise( 'Invalid relation type ' . $rule . '. ' . |
|
222 | 'The rule should be one of the following: "' . implode( '", "', $allowed_relations ) . '"' ); |
|
223 | } |
|
224 | ||
225 | $parsed_show_for['relation'] = $relation; |
|
226 | continue; |
|
227 | } |
|
228 | ||
229 | // Check if the rule is valid |
|
230 | if ( ! is_string( $rule ) || empty( $rule ) ) { |
@@ 899-909 (lines=11) @@ | ||
896 | ||
897 | foreach ( $rules as $key => $rule ) { |
|
898 | // Check if we have a relation key |
|
899 | if ( $key === 'relation' ) { |
|
900 | $relation = strtoupper( $rule ); |
|
901 | ||
902 | if ( ! in_array( $relation, $allowed_relations ) ) { |
|
903 | Incorrect_Syntax_Exception::raise( 'Invalid relation type ' . $rule . '. ' . |
|
904 | 'The rule should be one of the following: "' . implode( '", "', $allowed_relations ) . '"' ); |
|
905 | } |
|
906 | ||
907 | $parsed_rules['relation'] = $relation; |
|
908 | continue; |
|
909 | } |
|
910 | ||
911 | // Check if the rule is valid |
|
912 | if ( ! is_array( $rule ) || empty( $rule['field'] ) ) { |