diff --git a/includes/Admin/Actions.php b/includes/Admin/Actions.php index 0e6f516..e36a200 100644 --- a/includes/Admin/Actions.php +++ b/includes/Admin/Actions.php @@ -140,6 +140,5 @@ public static function save_donation_meta( $product_id ) { update_post_meta( $product_id, '_wcdm_min_amount', ( ! empty( $_POST['_wcdm_min_amount'] ) && is_numeric( $_POST['_wcdm_min_amount'] ) ? floatval( wp_unslash( $_POST['_wcdm_min_amount'] ) ) : get_option( 'wcdm_minimum_amount' ) ) ); update_post_meta( $product_id, '_wcdm_max_amount', ( ! empty( $_POST['_wcdm_max_amount'] ) && is_numeric( $_POST['_wcdm_max_amount'] ) ? floatval( wp_unslash( $_POST['_wcdm_max_amount'] ) ) : get_option( 'wcdm_maximum_amount' ) ) ); update_post_meta( $product_id, '_wcdm_campaign_id', ( ! empty( $_POST['_wcdm_campaign_id'] ) ? sanitize_text_field( wp_unslash( $_POST['_wcdm_campaign_id'] ) ) : '' ) ); - update_post_meta( $product_id, '_wcdm_campaign_cause', ( ! empty( $_POST['_wcdm_campaign_cause'] ) ? sanitize_text_field( wp_unslash( $_POST['_wcdm_campaign_cause'] ) ) : '' ) ); } } diff --git a/includes/Admin/ListTables/CampaignsListTable.php b/includes/Admin/ListTables/CampaignsListTable.php index 42da390..d2afb49 100644 --- a/includes/Admin/ListTables/CampaignsListTable.php +++ b/includes/Admin/ListTables/CampaignsListTable.php @@ -45,7 +45,7 @@ public function prepare_items() { $sortable = $this->get_sortable_columns(); $hidden = $this->get_hidden_columns(); $this->_column_headers = array( $columns, $hidden, $sortable ); - $per_page = get_option( 'posts_per_page' ); + $per_page = $this->get_items_per_page( 'wcdm_campaigns_per_page', 20 ); $order_by = isset( $_GET['orderby'] ) ? sanitize_key( wp_unslash( $_GET['orderby'] ) ) : ''; $order = isset( $_GET['order'] ) ? sanitize_key( wp_unslash( $_GET['order'] ) ) : ''; $search = isset( $_GET['s'] ) ? sanitize_text_field( wp_unslash( $_GET['s'] ) ) : ''; diff --git a/includes/Admin/ListTables/DonorsListTable.php b/includes/Admin/ListTables/DonorsListTable.php deleted file mode 100644 index e3f70d0..0000000 --- a/includes/Admin/ListTables/DonorsListTable.php +++ /dev/null @@ -1,195 +0,0 @@ - 'donor', - 'plural' => 'donors', - ) - ); - $this->screen = get_current_screen(); - parent::__construct( $args ); - } - - /** - * Retrieve all the data for the table. - * - * @since 1.0.0 - * @return void - */ - public function prepare_items() { - wp_verify_nonce( '_nonce' ); - $columns = $this->get_columns(); - $sortable = $this->get_sortable_columns(); - $hidden = $this->get_hidden_columns(); - $this->_column_headers = array( $columns, $hidden, $sortable ); - $per_page = get_option( 'posts_per_page' ); - $order_by = isset( $_GET['orderby'] ) ? sanitize_key( wp_unslash( $_GET['orderby'] ) ) : ''; - $order = isset( $_GET['order'] ) ? sanitize_key( wp_unslash( $_GET['order'] ) ) : ''; - $current_page = isset( $_GET['paged'] ) ? sanitize_key( wp_unslash( $_GET['paged'] ) ) : 1; - $search = isset( $_GET['s'] ) ? sanitize_text_field( wp_unslash( $_GET['s'] ) ) : ''; - - $args = array( - 'status' => array( 'wc-completed' ), - 'limit' => $per_page, - 'paged' => $current_page, - 'paginate' => true, - 'orderby' => $order_by, - 'order' => $order, - 's' => $search, - ); - - $this->items = wcdm_get_donors( $args ); - $this->total_count = wcdm_get_donors( $args, true ); - - $this->set_pagination_args( - array( - 'total_items' => $this->total_count, - 'per_page' => $per_page, - 'total_pages' => $this->total_pages, - ) - ); - } - - /** - * No items found text. - * - * @since 1.0.0 - * @return void - */ - public function no_items() { - esc_html_e( 'No items found.', 'wc-donation-manager' ); - } - - /** - * Get the table columns - * - * @since 1.0.0 - * @return array - */ - public function get_columns() { - return array( - 'name' => __( 'Name', 'wc-donation-manager' ), - 'email' => __( 'Email', 'wc-donation-manager' ), - 'donation_amount' => __( 'Donation Amount', 'wc-donation-manager' ), - 'order' => __( 'Order', 'wc-donation-manager' ), - 'type' => __( 'Type', 'wc-donation-manager' ), - ); - } - - /** - * Get the table sortable columns - * - * @since 1.0.0 - * @return array - */ - public function get_sortable_columns() { - return array( - 'name' => array( 'name', true ), - 'type' => array( 'type', true ), - ); - } - - /** - * Get the table hidden columns - * - * @since 1.0.0 - * @return array - */ - public function get_hidden_columns() { - return array(); - } - - /** - * Define primary column. - * - * @since 1.0.0 - * @return string - */ - public function get_primary_column_name() { - return 'name'; - } - - /** - * Renders the name column in the items list table. - * - * @param \WC_Order $item The order object. - * - * @since 1.0.0 - * @return string Displays the donor name. - */ - public function column_name( $item ) { - return sprintf( '%s %s', esc_url( add_query_arg( 'post', $item->get_id(), admin_url( 'post.php?action=edit' ) ) ), esc_html( $item->get_billing_first_name() ), esc_html( $item->get_billing_last_name() ) ); - } - - /** - * This function renders most of the columns in the list table. - * - * @param \WC_Order $item The order object. - * @param string $column_name The name of the column. - * - * @since 1.0.0 - * @return string Displays the donor table columns. - */ - public function column_default( $item, $column_name ) { - - $value = '—'; - - switch ( $column_name ) { - case 'email': - $value = sprintf( '%1$s', esc_html( $item->get_billing_email() ) ); - break; - case 'donation_amount': - $donation_amount = 0.00; - $order = wc_get_order( $item->get_id() ); - - foreach ( $order->get_items() as $item ) { - $product = $item->get_product(); - if ( $product->is_type( 'donation' ) ) { - $donation_amount += floatval( $item->get_total() ); - } - } - - $value = sprintf( '%1$s%2$.2f', esc_html( get_woocommerce_currency_symbol() ), esc_html( $donation_amount ) ); - break; - case 'order': - $value = sprintf( /* translators: 1: Order ID 2: HTML tag 3: Woocommerce currency 4: HTML tag 5: Admin order url */ - __( 'Order ID: #%1$s %2$s Total Amount: %3$s%4$.2f %5$s View Order', 'wc-donation-manager' ), - esc_html( $item->get_id() ), - '
', - esc_html( get_woocommerce_currency_symbol() ), - esc_html( $item->get_total() ), - '
', - esc_url( add_query_arg( 'post', $item->get_id(), admin_url( 'post.php?action=edit' ) ) ), - ); - break; - case 'type': - $value = __( 'Onetime', 'wc-donation-manager' ); - break; - default: - $value = parent::column_default( $item, $column_name ); - } - - return $value; - } -} diff --git a/includes/Admin/Menus.php b/includes/Admin/Menus.php index 7cc8905..98d4e01 100644 --- a/includes/Admin/Menus.php +++ b/includes/Admin/Menus.php @@ -36,14 +36,10 @@ public function __construct() { add_action( 'admin_menu', array( $this, 'admin_menu' ) ); add_filter( 'set-screen-option', array( $this, 'screen_option' ), 10, 3 ); add_action( 'current_screen', array( $this, 'setup_list_table' ) ); - add_action( 'wc_donation_manager_campaigns_content', array( $this, 'render_campaigns_content' ) ); - // Settings tabs. - add_action( 'wc_donation_manager_settings_tutorial_content', array( $this, 'render_tutorial_content' ) ); - // Pro tabs. - if ( ! WCDM()->is_plugin_active( 'wc-donation-manager-pro.php' ) ) { + if ( ! WCDM()->is_plugin_active( 'wc-donation-manager-pro' ) ) { add_action( 'wc_donation_manager_donors_content', array( $this, 'render_donors_content' ) ); add_action( 'wc_donation_manager_settings_emails_content', array( $this, 'render_emails_settings' ) ); } @@ -131,9 +127,9 @@ public function screen_option( $status, $option, $value ) { 'wc_donation_manager_screen_options', array( 'wcdm_campaigns_per_page', - 'wcdm_donors_per_page', ) ); + if ( in_array( $option, $options, true ) ) { return $value; } @@ -167,12 +163,6 @@ public function setup_list_table() { $args['option'] = 'wcdm_campaigns_per_page'; add_screen_option( 'per_page', $args ); break; - case 'wcdm-donors': - $this->list_table = new ListTables\DonorsListTable(); - $this->list_table->prepare_items(); - $args['option'] = 'wcdm_donors_per_page'; - add_screen_option( 'per_page', $args ); - break; } } @@ -207,7 +197,7 @@ public function render_campaigns_content() { * @return void */ public function render_donors_content() { - include __DIR__ . '/views/donors/donors.php'; + echo esc_html__( 'The donors list table is a PRO module!', 'wc-donation-manager' ); } /** @@ -217,115 +207,6 @@ public function render_donors_content() { * @return void */ public function render_emails_settings() { - $mailer = WC()->mailer(); - $email_templates = $mailer->get_emails(); - - $donation_emails = array_filter( - $email_templates, - function ( $email ) { - // Check if class name contains 'WC_Donation_Order_Email'. - return str_contains( get_class( $email ), 'WC_Donation_Order_Email' ); - } - ); - - if ( ! empty( $donation_emails ) ) { - ?> - - - - - - '', - 'name' => __( 'Email', 'wc-donation-manager' ), - 'email_type' => __( 'Content type', 'wc-donation-manager' ), - 'recipient' => __( 'Recipient(s)', 'wc-donation-manager' ), - 'actions' => '', - ) - ); - foreach ( $columns as $key => $column ) { - echo ''; - } - ?> - - - $email ) { - echo ''; - - $manage_url = add_query_arg( - array( - 'section' => strtolower( $email_key ), - ), - admin_url( 'admin.php?page=wc-settings&tab=email' ) - ); - - foreach ( $columns as $key => $column ) { - - switch ( $key ) { - case 'name': - echo ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped - break; - case 'recipient': - echo ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped - break; - case 'status': - echo ''; - break; - case 'email_type': - echo ''; - break; - case 'actions': - echo ''; - break; - default: - do_action( 'woocommerce_email_setting_column_' . $key, $email ); - break; - } - } - - echo ''; - } - ?> - -
- - - '_wcdm_campaign_cause', - 'label' => __( 'Campaign cause', 'wc-donation-manager' ), - 'description' => __( 'Enter the cause of the campaign. This will be override the assigned campaign cause text. Leave it empty to use the campaign default cause text.', 'wc-donation-manager' ), - 'desc_tip' => true, - 'placeholder' => 'Enter the cause of the campaign...', - 'value' => ! empty( get_post_meta( get_the_ID(), '_wcdm_campaign_cause', true ) ) ? get_post_meta( get_the_ID(), '_wcdm_campaign_cause', true ) : '', - ) - ); + /** + * Hook for adding more campaign data. + * + * @since 1.0.1 + */ + do_action( 'wc_donation_manager_after_product_campaign_data', $wcdm_campaign ); + echo ''; } diff --git a/includes/Admin/Settings.php b/includes/Admin/Settings.php index a761379..0d79e78 100644 --- a/includes/Admin/Settings.php +++ b/includes/Admin/Settings.php @@ -25,7 +25,6 @@ public function get_tabs() { 'general' => __( 'General', 'wc-donation-manager' ), 'advanced' => __( 'Advanced', 'wc-donation-manager' ), 'emails' => __( 'Emails', 'wc-donation-manager' ), - 'tutorial' => __( 'Tutorial', 'wc-donation-manager' ), ) ); } @@ -49,14 +48,6 @@ public function get_settings( $tab ) { 'desc' => __( 'The following options are the plugin general settings. Theses options affect how the plugin will work.', 'wc-donation-manager' ), 'id' => 'general_options', ), - array( - 'title' => __( 'Add to cart button text', 'wc-donation-manager' ), - 'id' => 'wcdm_add_to_cart_btn_text', - 'desc' => __( 'Enter the add to cart button text. This will be applicable only for campaigns or donation product types.', 'wc-donation-manager' ), - 'desc_tip' => __( 'Enter the add to cart button text. This will be applicable only for campaigns or donation product types.', 'wc-donation-manager' ), - 'type' => 'text', - 'default' => 'Donate Now', - ), array( 'title' => __( 'Skip cart', 'wc-donation-manager' ), 'desc' => __( 'Skip cart.', 'wc-donation-manager' ), @@ -104,14 +95,6 @@ public function get_settings( $tab ) { 'default' => 'yes', 'type' => 'checkbox', ), - array( - 'title' => __( 'Campaign expired text', 'wc-donation-manager' ), - 'desc' => __( 'Enter the campaign expired text. This will be visible to the donation products if the campaign end date is exceeded.', 'wc-donation-manager' ), - 'desc_tip' => __( 'Enter the campaign expired text. This will be visible to the donation products if the campaign end date is exceeded.', 'wc-donation-manager' ), - 'id' => 'wcdm_expired_text', - 'default' => 'The campaign expired!', - 'type' => 'text', - ), array( 'type' => 'sectionend', 'id' => 'general_options', diff --git a/includes/Admin/views/donors/donors.php b/includes/Admin/views/donors/donors.php deleted file mode 100644 index 0a13b16..0000000 --- a/includes/Admin/views/donors/donors.php +++ /dev/null @@ -1,27 +0,0 @@ - -

- - list_table->get_request_search() ) : ?> - - list_table->get_request_search() ) ) ); ?> - -

-
- -
- list_table->views(); ?> - list_table->search_box( __( 'Search', 'wc-donation-manager' ), 'search' ); ?> - list_table->display(); ?> - -
-id = 'customer_completed_donation'; - $this->customer_email = true; - $this->title = __( 'Completed donation', 'wc-donation-manager' ); - $this->description = __( 'Donation order completed notification emails are sent when a customer places an donation order.', 'wc-donation-manager' ); - $this->template_html = 'emails/customer-completed-donation.php'; - $this->template_plain = 'emails/plain/customer-completed-donation.php'; - $this->template_base = WCDM_PATH . 'templates/'; - $this->placeholders = array( - '{order_date}' => '', - '{order_number}' => '', - ); - - // Trigger on order status completed. - add_action( 'woocommerce_order_status_completed_notification', array( $this, 'trigger' ), 10, 2 ); - - // Call parent constructor. - parent::__construct(); - } - - /** - * Trigger the sending of this email. - * - * @param int $order_id The order ID. - * @param WC_Order|false $order Order object. - * - * @since 0.1 - * @return void - */ - public function trigger( $order_id, $order = false ) { - $this->setup_locale(); - - if ( $order_id && ! is_a( $order, 'WC_Order' ) ) { - $order = wc_get_order( $order_id ); - } - - if ( is_a( $order, 'WC_Order' ) ) { - $this->object = $order; - $this->recipient = $this->object->get_billing_email(); - $this->placeholders['{order_date}'] = wc_format_datetime( $this->object->get_date_created() ); - $this->placeholders['{order_number}'] = $this->object->get_order_number(); - - foreach ( $order->get_items() as $item ) { - $product = $item->get_product(); - if ( $product->is_type( 'donation' ) ) { - $this->donation_amount += (float) $item['subtotal']; - } - } - } - - if ( $this->is_enabled() && $this->get_recipient() ) { - $this->send( $this->get_recipient(), $this->get_subject(), $this->get_content(), $this->get_headers(), $this->get_attachments() ); - } - - $this->restore_locale(); - } - - /** - * Get content html. - * - * @return string - */ - public function get_content_html() { - return wc_get_template_html( - $this->template_html, - array( - 'order' => $this->object, - 'email_heading' => $this->get_heading(), - 'additional_content' => $this->get_additional_content(), - 'sent_to_admin' => false, - 'plain_text' => false, - 'email' => $this, - 'donation_amount' => $this->donation_amount, - ), - '', - $this->template_base, - ); - } - - /** - * Get content plain. - * - * @return string - */ - public function get_content_plain() { - return wc_get_template_html( - $this->template_plain, - array( - 'order' => $this->object, - 'email_heading' => $this->get_heading(), - 'additional_content' => $this->get_additional_content(), - 'sent_to_admin' => false, - 'plain_text' => true, - 'email' => $this, - 'donation_amount' => $this->donation_amount, - ), - '', - $this->template_base, - ); - } - - /** - * Return content from the additional_content field. - * - * Displayed above the footer. - * - * @since 3.7.0 - * @return string - */ - public function get_additional_content() { - /** - * Provides an opportunity to inspect and modify additional content for the email. - * - * @since 3.7.0 - * - * @param string $additional_content Additional content to be added to the email. - * @param object|bool $object The object (ie, product or order) this email relates to, if any. - * @param WC_Email $email WC_Email instance managing the email. - */ - return apply_filters( 'wcdm_email_additional_content_' . $this->id, $this->format_string( $this->get_option( 'additional_content', $this->get_default_additional_content() ) ), $this->object, $this ); - } - - /** - * Initialize Settings Form Fields. - * - * @since 0.1 - * @return void - */ - public function init_form_fields() { - - $this->form_fields = array( - 'enabled' => array( - 'title' => 'Enable/Disable', - 'type' => 'checkbox', - 'label' => 'Enable this email notification', - 'default' => 'yes', - ), - 'subject' => array( - 'title' => 'Subject', - 'type' => 'text', - 'description' => sprintf( /* translators: 1: Email subject */ __( 'This controls the email subject line. Leave blank to use the default subject: %s.', 'wc-donation-manager' ), $this->get_default_subject() ), - 'desc_tip' => true, - 'placeholder' => $this->get_default_subject(), - 'default' => '', - ), - 'heading' => array( - 'title' => 'Email Heading', - 'type' => 'text', - 'description' => sprintf( /* translators: 1: Email heading */ __( 'This controls the main heading contained within the email notification. Leave blank to use the default heading: %s.', 'wc-donation-manager' ), $this->get_default_heading() ), - 'desc_tip' => true, - 'placeholder' => $this->get_default_heading(), - 'default' => '', - ), - 'additional_content' => array( - 'title' => __( 'Additional content', 'wc-donation-manager' ), - 'description' => __( 'Text to appear below the main email content. Available placeholders: {site_title}, {site_address}, {site_url}, {order_date}, {order_number}', 'wc-donation-manager' ), - 'desc_tip' => true, - 'type' => 'textarea', - 'css' => 'width:400px;', - 'placeholder' => __( 'N/A', 'wc-donation-manager' ), - 'default' => $this->get_default_additional_content(), - ), - 'email_type' => array( - 'title' => __( 'Email type', 'wc-donation-manager' ), - 'type' => 'select', - 'description' => __( 'Choose which format of email to send.', 'wc-donation-manager' ), - 'desc_tip' => true, - 'default' => 'html', - 'class' => 'email_type wc-enhanced-select', - 'options' => $this->get_email_type_options(), - ), - ); - } - - /** - * Get email subject. - * - * @since 1.0.0 - * @return string - */ - public function get_default_subject() { - return __( 'Your {site_title} donation has been received!', 'wc-donation-manager' ); - } - - /** - * Get email heading. - * - * @since 1.0.0 - * @return string - */ - public function get_default_heading() { - return __( 'Thank you for your donation', 'wc-donation-manager' ); - } - - /** - * Default email additional content - * - * @return string - */ - public function get_default_additional_content() { - return __( 'Just to let you know — we\'ve received your donation order #{order_number}, and it is now being processed:', 'wc-donation-manager' ); - } -} diff --git a/includes/Frontend/Frontend.php b/includes/Frontend/Frontend.php index 330e758..ced204f 100644 --- a/includes/Frontend/Frontend.php +++ b/includes/Frontend/Frontend.php @@ -20,7 +20,8 @@ class Frontend { * @since 1.0.0 */ public function __construct() { - add_action( 'wp', array( __CLASS__, 'remove_coupon' ) ); + add_action( 'woocommerce_before_cart', array( __CLASS__, 'remove_coupon' ) ); + add_action( 'woocommerce_before_checkout_form', array( __CLASS__, 'remove_coupon' ) ); add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); } diff --git a/includes/Plugin.php b/includes/Plugin.php index e6b96a9..55d51fa 100644 --- a/includes/Plugin.php +++ b/includes/Plugin.php @@ -94,7 +94,6 @@ public function on_init() { $this->set( array( Donation\Donation::class, - Emails\Emails::class, Frontend\Frontend::class, Frontend\Product::class, Frontend\Cart::class, diff --git a/includes/functions.php b/includes/functions.php index a1cad52..b551d53 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -109,43 +109,3 @@ function wcdm_get_the_title( $post_id ) { return sprintf( '(#%1$s) %2$s', $post_id, get_the_title( $post_id ) ); } - -/** - * Get donors from the woocommerce order list. - * - * @param array $args The args. - * @param bool $count Whether to return a count. - * - * @since 1.0.0 - * @return array|int - */ -function wcdm_get_donors( $args = array(), $count = false ) { - $defaults = array( - 'limit' => - 1, - 'paged' => 1, - 'paginate' => true, - 'order' => 'DESC', - 'key' => '_has_product_type', - 'value' => 'donation', - ); - - $args = wp_parse_args( $args, $defaults ); - $orders = wc_get_orders( $args ); - - $filtered_orders = array(); - foreach ( $orders->orders as $order ) { - foreach ( $order->get_items() as $item ) { - $product = $item->get_product(); - if ( $product->is_type( 'donation' ) ) { - $filtered_orders[] = $order; - break; - } - } - } - - if ( $count ) { - return count( $filtered_orders ); - } - - return $filtered_orders; -} diff --git a/src/Models/Campaign.php b/src/Models/Campaign.php deleted file mode 100644 index 8ef028a..0000000 --- a/src/Models/Campaign.php +++ /dev/null @@ -1,196 +0,0 @@ - '', - 'cause' => '', - 'goal_amount' => 0.00, - 'end_date' => '', - 'status' => 'publish', - ); - - /** - * Post data to property map. - * - * Post data key => property key. - * - * @since 1.0.0 - * @var array - */ - protected $postdata_map = array( - 'name' => 'post_title', - 'cause' => 'post_content', - 'status' => 'post_status', - ); - - /** - * Save data. - * - * @since 1.0.0 - * @return $this|\WP_Error Post object (or WP_Error on failure). - */ - public function save() { - if ( empty( $this->get_prop( 'name' ) ) ) { - return new \WP_Error( 'missing_required', __( 'Missing required campaign name.', 'wc-donation-manager' ) ); - } - - if ( empty( $this->get_prop( 'goal_amount' ) ) ) { - return new \WP_Error( 'missing_required', __( 'Missing required amount.', 'wc-donation-manager' ) ); - } - - if ( empty( $this->get_prop( 'status' ) ) ) { - return new \WP_Error( 'missing_required', __( 'Missing required status.', 'wc-donation-manager' ) ); - } - - return parent::save(); - } - - /* - |-------------------------------------------------------------------------- - | Getters and Setters. - |-------------------------------------------------------------------------- - | Getters and setters for the data properties. - */ - - /** - * Get campaign name. - * - * @since 1.0.0 - * @return string - */ - public function get_name() { - return $this->get_prop( 'name' ); - } - - /** - * Set campaign name. - * - * @param string $campaign Campaign name. - * - * @since 1.0.0 - * @return void - */ - public function set_name( $campaign ) { - $this->set_prop( 'name', sanitize_text_field( $campaign ) ); - } - - /** - * Get cause. - * - * @since 1.0.0 - * @return string - */ - public function get_cause() { - return $this->get_prop( 'cause' ); - } - - /** - * Set cause. - * - * @param string $cause Campaign cause. - * - * @since 1.0.0 - * @return void - */ - public function set_cause( $cause ) { - $this->set_prop( 'cause', sanitize_textarea_field( $cause ) ); - } - - /** - * Get goal amount. - * - * @since 1.0.0 - * @return numeric - */ - public function get_goal_amount() { - return $this->get_prop( 'goal_amount' ); - } - - /** - * Set goal amount. - * - * @param numeric $goal_amount Campaign goal amount. - * - * @since 1.0.0 - * @return void - */ - public function set_goal_amount( $goal_amount ) { - $this->set_prop( 'goal_amount', floatval( $goal_amount ) ); - } - - /** - * Get campaign end date. - * - * @since 1.0.0 - * @return string - */ - public function get_end_date() { - return $this->get_prop( 'end_date' ); - } - - /** - * Set campaign end date. - * - * @param string $end_date Campaign end date. - * - * @since 1.0.0 - * @return void - */ - public function set_end_date( $end_date ) { - $this->set_prop( 'end_date', sanitize_text_field( $end_date ) ); - } - - /** - * Get status. - * - * @since 1.0.0 - * @return string - */ - public function get_status() { - return $this->get_prop( 'status' ); - } - - /** - * Set status. - * - * @param string $status Campaign status. - * - * @since 1.0.0 - * @return void - */ - public function set_status( $status ) { - $all_status = array( 'Publish', 'Pending', 'Draft' ); - $status = ucfirst( $status ); - if ( in_array( $status, $all_status, true ) ) { - $this->set_prop( 'status', ucfirst( sanitize_key( $status ) ) ); - } else { - $this->set_prop( 'status', ucfirst( sanitize_key( 'Draft' ) ) ); - } - } -} diff --git a/src/images/donors.png b/src/images/donors.png new file mode 100644 index 0000000..a3e5086 Binary files /dev/null and b/src/images/donors.png differ diff --git a/templates/emails/customer-completed-donation.php b/templates/emails/customer-completed-donation.php deleted file mode 100644 index 2016259..0000000 --- a/templates/emails/customer-completed-donation.php +++ /dev/null @@ -1,36 +0,0 @@ - - - -

get_billing_first_name() ) ); ?>

-

- -

- get_billing_first_name() ) ) . "\n\n"; -/* translators: %s: Site title */ -echo esc_html__( 'We have finished processing your donation.', 'wc-donation-manager' ) . "\n\n"; - -echo "\n----------------------------------------\n\n"; - -printf( /* translators: 1: Woocommerce currency symbol 2: Donated amount */ esc_html__( 'Your donated amount: %1$s%2$.2f', 'wc-donation-manager' ), esc_html( get_woocommerce_currency_symbol() ), floatval( $donation_amount ) ); - -echo "\n\n----------------------------------------\n\n"; - -/** - * Show user-defined additional content - this is set in each email's settings. - */ -if ( $additional_content ) { - echo esc_html( wp_strip_all_tags( wptexturize( $additional_content ) ) ); - echo "\n\n----------------------------------------\n\n"; -} - -echo wp_kses_post( apply_filters( 'woocommerce_email_footer_text', get_option( 'woocommerce_email_footer_text' ) ) );