diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b6b48a3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +#ignore alls sublime created files +*.sublime-workspace diff --git a/includes/woo-out-of-office-functions.php b/includes/woo-out-of-office-functions.php new file mode 100644 index 0000000..a22785e --- /dev/null +++ b/includes/woo-out-of-office-functions.php @@ -0,0 +1,143 @@ += $sdate) && ($tdate <= $edate)){ + return true; + } else { + return false; + } +} + +function woo_out_of_office_include_dates_in_message($start_date, $end_date, $message){ + $message_compiled = str_replace("[StartDate]", wp_date(get_option('date_format'), strtotime($start_date)), $message); + $message_compiled = str_replace("[EndDate]", wp_date(get_option('date_format'), strtotime($end_date)), $message_compiled); + return $message_compiled; +} + +// function to add the out of office message to the order confirmation email +add_action( 'woocommerce_email_before_order_table', 'woo_out_of_office_show_in_order_confirmation_email', 20 ); + +function woo_out_of_office_show_in_order_confirmation_email( $order ) { + $woo_ooo_show_in_order_confirmation_email = esc_attr(get_option( 'woo_ooo_show_in_order_confirmation_email', '' )); + + if ((woo_out_of_office_is_active()) && ($woo_ooo_show_in_order_confirmation_email == "Yes")) { + $woo_ooo_message = esc_attr(get_option( 'woo_ooo_message', '' )); + $woo_ooo_title = esc_attr(get_option( 'woo_ooo_title', '' )); + $woo_ooo_start_date = esc_attr(get_option( 'woo_ooo_start_date', '' )); + $woo_ooo_end_date = esc_attr(get_option( 'woo_ooo_end_date', '' )); + $woo_ooo_message_compiled = woo_out_of_office_include_dates_in_message($woo_ooo_start_date, $woo_ooo_end_date, $woo_ooo_message); + + ?> +
|
+ + + +++ + + ++ |
+
+ +
++ +
+|
+ + + +++ + + ++ |
+