0) : if ( in_array( $product['product_id'], $coupon['products'] )) : $valid = true; endif; if ( $product['variation_id'] <> '' ) : if ( in_array( $product['variation_id'], $coupon['products'] )) : $valid = true; endif; endif; endif; return $valid; } /** * determines whether a coupon code is valid by being within allowed dates if dates are entered * * @param array $coupon - the coupon record to check valid dates for * @return boolean - whether coupon is valid based on dates * @since 0.9.9.1 */ function in_date_range( $coupon ) { $in_range = false; $date_from = (int)$coupon['date_from']; $date_to = (int)$coupon['date_to']; $current_time = strtotime( 'NOW' ); if ( $date_to == 0 && $date_from == 0 ) $in_range = true; else if ( $date_from == 0 || ( $date_from > 0 && $date_from < $current_time )) : if ( $date_to == 0 || $date_to > $current_time ) $in_range = true; endif; return $in_range; } }