@@ 221-231 (lines=11) @@ | ||
218 | ||
219 | foreach ( $show_for as $key => $rule ) { |
|
220 | // Check if we have a relation key |
|
221 | if ( $key === 'relation' ) { |
|
222 | $relation = strtoupper( $rule ); |
|
223 | ||
224 | if ( ! in_array( $relation, $allowed_relations ) ) { |
|
225 | Incorrect_Syntax_Exception::raise( 'Invalid relation type ' . $rule . '. ' . |
|
226 | 'The rule should be one of the following: "' . implode( '", "', $allowed_relations ) . '"' ); |
|
227 | } |
|
228 | ||
229 | $parsed_show_for['relation'] = $relation; |
|
230 | continue; |
|
231 | } |
|
232 | ||
233 | // Check if the rule is valid |
|
234 | if ( ! is_string( $rule ) || empty( $rule ) ) { |
@@ 908-918 (lines=11) @@ | ||
905 | ||
906 | foreach ( $rules as $key => $rule ) { |
|
907 | // Check if we have a relation key |
|
908 | if ( $key === 'relation' ) { |
|
909 | $relation = strtoupper( $rule ); |
|
910 | ||
911 | if ( ! in_array( $relation, $allowed_relations ) ) { |
|
912 | Incorrect_Syntax_Exception::raise( 'Invalid relation type ' . $rule . '. ' . |
|
913 | 'The rule should be one of the following: "' . implode( '", "', $allowed_relations ) . '"' ); |
|
914 | } |
|
915 | ||
916 | $parsed_rules['relation'] = $relation; |
|
917 | continue; |
|
918 | } |
|
919 | ||
920 | // Check if the rule is valid |
|
921 | if ( ! is_array( $rule ) || empty( $rule['field'] ) ) { |