@@ 222-232 (lines=11) @@ | ||
219 | ||
220 | foreach ( $show_for as $key => $rule ) { |
|
221 | // Check if we have a relation key |
|
222 | if ( $key === 'relation' ) { |
|
223 | $relation = strtoupper( $rule ); |
|
224 | ||
225 | if ( ! in_array( $relation, $allowed_relations ) ) { |
|
226 | Incorrect_Syntax_Exception::raise( 'Invalid relation type ' . $rule . '. ' . |
|
227 | 'The rule should be one of the following: "' . implode( '", "', $allowed_relations ) . '"' ); |
|
228 | } |
|
229 | ||
230 | $parsed_show_for['relation'] = $relation; |
|
231 | continue; |
|
232 | } |
|
233 | ||
234 | // Check if the rule is valid |
|
235 | if ( ! is_string( $rule ) || empty( $rule ) ) { |
@@ 921-931 (lines=11) @@ | ||
918 | ||
919 | foreach ( $rules as $key => $rule ) { |
|
920 | // Check if we have a relation key |
|
921 | if ( $key === 'relation' ) { |
|
922 | $relation = strtoupper( $rule ); |
|
923 | ||
924 | if ( ! in_array( $relation, $allowed_relations ) ) { |
|
925 | Incorrect_Syntax_Exception::raise( 'Invalid relation type ' . $rule . '. ' . |
|
926 | 'The rule should be one of the following: "' . implode( '", "', $allowed_relations ) . '"' ); |
|
927 | } |
|
928 | ||
929 | $parsed_rules['relation'] = $relation; |
|
930 | continue; |
|
931 | } |
|
932 | ||
933 | // Check if the rule is valid |
|
934 | if ( ! is_array( $rule ) || empty( $rule['field'] ) ) { |