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); + + ?> + + + + +
+
+

+ +

+
+

+ +

+
+
+ + +
+

+ +

+
+

+ +

+
+ + + +
+

+ +

+
+

+ +

+
+ + +
+ : + + +
+ ' . __('Settings', 'woo-out-of-office-page') . ''; + $links[] = $settings_link; + // $settings_link = '' . __( 'Settings','woo-out-of-office-page' ) . ''; + // array_push( $links, $settings_link ); + return $links; +} +$filter_name = "plugin_action_links_" . WOOO_BASENAME; +add_filter( $filter_name, 'woo_out_of_office_add_settings_link' ); diff --git a/includes/woo-out-of-office-options.php b/includes/woo-out-of-office-options.php new file mode 100644 index 0000000..62b3818 --- /dev/null +++ b/includes/woo-out-of-office-options.php @@ -0,0 +1,249 @@ + +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ Use [StartDate] and [EndDate] as shortcodes within the text in order to incorporate the actual dates. +
+ For example: "We are between [StartDate] and [EndDate] on vacation :)" +
+ The result is displayed below :) +
+ +
+ > +
+ > +
+ > +
+ +
+ +
+ > +
+ > +
+
+ +
+ > +
+ > +
+
+ +
+ > +
+ > +
+
+ +
+ > +
+ > +
+
+ Not yet implemented +
+ Woo Out of Office`. You will see a form where you can input start and end dates. + +== Changelog == += 1.0 = +* Initial release. diff --git a/templates/admin/settings-page.php b/templates/admin/settings-page.php new file mode 100644 index 0000000..ffb3578 --- /dev/null +++ b/templates/admin/settings-page.php @@ -0,0 +1,49 @@ +
+ +
+ + + +
+
+'; +if (woo_out_of_office_is_active()) { + echo "Out of office is ACTIVE!"; +} else { + echo "Out of office is NOT active!"; +} +echo '
'; + +echo "The message will be displayed like this:"; +echo '
'; + +?> + + + + + +
+
+

+ +

+
+

+ +

+
+
+ +