$_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'] ) && isset( $conditions[ $_options['type'] ]['taxonomy'] ) ? $conditions[ $_options['type'] ]['taxonomy'] : false; // phpcs:ignore
$last_tax = isset( $set_conditions[ $last_index ]['type'] ) && isset( $conditions[ $set_conditions[ $last_index ]['type'] ]['taxonomy'] ) ? $conditions[ $set_conditions[ $last_index ]['type'] ]['taxonomy'] : false;
if (
$taxonomy && $last_tax && $last_tax === $taxonomy
&& ( ! isset( $_options['connector'] ) || 'or' !== $_options['connector'] )
&& 'is' === $operator && 'is' === $set_conditions[ $last_index ]['operator']
&& $_options['type'] !== $set_conditions[ $last_index ]['type']
) {
$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' ) . '';
}
?>