$_options ) :
$show_or_force_warning = false;
$show_is_not_or_warning = false;
// get type attribute from previous option format.
$_options['type'] = isset( $_options['type'] ) ? $_options['type'] : $_index;
$connector = ( ! isset( $_options['connector'] ) || 'or' !== $_options['connector'] ) ? 'and' : 'or';
$operator = ! isset( $_options['operator'] ) || 'is_not' !== $_options['operator'] ? 'is' : 'is_not';
if ( isset( $_options['type'] ) && isset( $conditions[ $_options['type'] ]['metabox'] ) ) {
$metabox = $conditions[ $_options['type'] ]['metabox'];
} else {
continue;
}
if ( method_exists( $metabox[0], $metabox[1] ) ) {
/**
* Show warning for connector when
* not set to OR already
* this condition and the previous are on page level and not from the identical type
* they are both set to SHOW
*/
$taxonomy = isset( $_options['type'], $conditions[ $_options['type'] ]['taxonomy'] ) ? $conditions[ $_options['type'] ]['taxonomy'] : false; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
$last_tax = isset( $set_conditions[ $last_index ]['type'], $conditions[ $set_conditions[ $last_index ]['type'] ]['taxonomy'] ) ? $conditions[ $set_conditions[ $last_index ]['type'] ]['taxonomy'] : false; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
$same_taxonomy = $taxonomy && $last_tax && $taxonomy === $last_tax;
$and_connector = ! isset( $_options['connector'] ) || 'or' !== $_options['connector'];
$both_is_operator = 'is' === $operator && 'is' === ( $set_conditions[ $last_index ]['operator'] ?? '' );
$different_types = ( $set_conditions[ $last_index ]['type'] ?? null ) !== $_options['type'];
if ( $same_taxonomy && $and_connector && $both_is_operator && $different_types ) {
$show_or_force_warning = true;
}
if (
'is_not' === $operator
&& 'or' === $connector
&& isset( $set_conditions[ $last_index ]['operator'] )
&& 'is_not' === $set_conditions[ $last_index ]['operator']
) {
$show_is_not_or_warning = true;
}
if ( $i > 0 ) :
?>
' . esc_attr__( 'manual', 'advanced-ads' ) . '';
} else {
esc_attr_e( 'The ad might always show due to OR and "is not". Better use AND.', 'advanced-ads' );
echo ' ' . esc_attr__( 'manual', 'advanced-ads' ) . '';
}
?>