| @@ 151-161 (lines=11) @@ | ||
| 148 | ||
| 149 | foreach ( $show_for as $key => $rule ) { |
|
| 150 | // Check if we have a relation key |
|
| 151 | if ( $key === 'relation' ) { |
|
| 152 | $relation = strtoupper( $rule ); |
|
| 153 | ||
| 154 | if ( ! in_array( $relation, $allowed_relations ) ) { |
|
| 155 | Incorrect_Syntax_Exception::raise( 'Invalid relation type ' . $rule . '. ' . |
|
| 156 | 'The rule should be one of the following: "' . implode( '", "', $allowed_relations ) . '"' ); |
|
| 157 | } |
|
| 158 | ||
| 159 | $parsed_show_for['relation'] = $relation; |
|
| 160 | continue; |
|
| 161 | } |
|
| 162 | ||
| 163 | // Check if the rule is valid |
|
| 164 | if ( ! is_string( $rule ) || empty( $rule ) ) { |
|
| @@ 787-797 (lines=11) @@ | ||
| 784 | ||
| 785 | foreach ( $rules as $key => $rule ) { |
|
| 786 | // Check if we have a relation key |
|
| 787 | if ( $key === 'relation' ) { |
|
| 788 | $relation = strtoupper( $rule ); |
|
| 789 | ||
| 790 | if ( ! in_array( $relation, $allowed_relations ) ) { |
|
| 791 | Incorrect_Syntax_Exception::raise( 'Invalid relation type ' . $rule . '. ' . |
|
| 792 | 'The rule should be one of the following: "' . implode( '", "', $allowed_relations ) . '"' ); |
|
| 793 | } |
|
| 794 | ||
| 795 | $parsed_rules['relation'] = $relation; |
|
| 796 | continue; |
|
| 797 | } |
|
| 798 | ||
| 799 | // Check if the rule is valid |
|
| 800 | if ( ! is_array( $rule ) || empty( $rule['field'] ) ) { |
|