@@ 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 ) ) { |
@@ 864-874 (lines=11) @@ | ||
861 | ||
862 | foreach ( $rules as $key => $rule ) { |
|
863 | // Check if we have a relation key |
|
864 | if ( $key === 'relation' ) { |
|
865 | $relation = strtoupper( $rule ); |
|
866 | ||
867 | if ( ! in_array( $relation, $allowed_relations ) ) { |
|
868 | Incorrect_Syntax_Exception::raise( 'Invalid relation type ' . $rule . '. ' . |
|
869 | 'The rule should be one of the following: "' . implode( '", "', $allowed_relations ) . '"' ); |
|
870 | } |
|
871 | ||
872 | $parsed_rules['relation'] = $relation; |
|
873 | continue; |
|
874 | } |
|
875 | ||
876 | // Check if the rule is valid |
|
877 | if ( ! is_array( $rule ) || empty( $rule['field'] ) ) { |