| @@ 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 ) ) { |
|
| @@ 897-907 (lines=11) @@ | ||
| 894 | ||
| 895 | foreach ( $rules as $key => $rule ) { |
|
| 896 | // Check if we have a relation key |
|
| 897 | if ( $key === 'relation' ) { |
|
| 898 | $relation = strtoupper( $rule ); |
|
| 899 | ||
| 900 | if ( ! in_array( $relation, $allowed_relations ) ) { |
|
| 901 | Incorrect_Syntax_Exception::raise( 'Invalid relation type ' . $rule . '. ' . |
|
| 902 | 'The rule should be one of the following: "' . implode( '", "', $allowed_relations ) . '"' ); |
|
| 903 | } |
|
| 904 | ||
| 905 | $parsed_rules['relation'] = $relation; |
|
| 906 | continue; |
|
| 907 | } |
|
| 908 | ||
| 909 | // Check if the rule is valid |
|
| 910 | if ( ! is_array( $rule ) || empty( $rule['field'] ) ) { |
|