public function add_checkout_time_to_booking_end_time($date, $booking) { $product = wc_get_product($booking->product_id); if (empty($product) || 'accommodation-booking' !== $product->product_type) { return $date; } $check_out = get_option('woocommerce_accommodation_bookings_check_out', ''); $date_format = apply_filters('woocommerce_bookings_date_format', wc_date_format()); $time_format = apply_filters('woocommerce_bookings_time_format', ', ' . wc_time_format()); return date_i18n($date_format, $booking->end) . date_i18n($time_format, strtotime("Today " . $check_out)); }
/** * @deprecated */ function woocommerce_time_format() { return wc_time_format(); }
<code>…<?php echo esc_html($key_data['truncated_key']); ?> </code> </td> </tr> <tr valign="top"> <th scope="row" class="titledesc"> <?php _e('Last access', 'woocommerce'); ?> </th> <td class="forminp"> <span><?php if (!empty($key_data['last_access'])) { $date = sprintf(_x('%1$s at %2$s', 'date and time', 'woocommerce'), date_i18n(wc_date_format(), strtotime($key_data['last_access'])), date_i18n(wc_time_format(), strtotime($key_data['last_access']))); echo apply_filters('woocommerce_api_key_last_access_datetime', $date, $key_data['last_access']); } else { _e('Unknown', 'woocommerce'); } ?> </span> </td> </tr> <?php } ?> </tbody> </table> <?php
* @since 1.0 * @param string $profile_identifier See https://github.com/opauth/opauth/wiki/Opauth-configuration - Strategy */ echo esc_html(apply_filters('wc_social_login_profile_identifier', $profile->has_email() ? $profile->get_email() : $profile->get_nickname())); ?> </td> <td data-title="<?php esc_attr_e('Last login', 'woocommerce-social-login'); ?> "> <?php if ($login_timestamp) { ?> <?php /* translators: Placeholders: %1$s - date, %2$s - time */ printf(esc_html__('%1$s @ %2$s', 'woocommerce-social-login'), date_i18n(wc_date_format(), $login_timestamp), date_i18n(wc_time_format(), $login_timestamp)); ?> <?php } else { ?> <?php esc_html_e('Never', 'woocommerce-social-login'); ?> <?php } ?> </td> <td class="profile-actions"> <a href="<?php echo esc_url($provider->get_auth_url($return_url, 'unlink')); ?>
/** * Create keys. * * @since 2.4.0 * * @param string $app_name * @param string $app_user_id * @param string $scope * * @return array */ protected function create_keys($app_name, $app_user_id, $scope) { global $wpdb; $description = sprintf(__('%s - API %s (created on %s at %s).', 'woocommerce'), wc_clean($app_name), $this->get_i18n_scope($scope), date_i18n(wc_date_format()), date_i18n(wc_time_format())); $user = wp_get_current_user(); // Created API keys. $permissions = in_array($scope, array('read', 'write', 'read_write')) ? sanitize_text_field($scope) : 'read'; $consumer_key = 'ck_' . wc_rand_hash(); $consumer_secret = 'cs_' . wc_rand_hash(); $wpdb->insert($wpdb->prefix . 'woocommerce_api_keys', array('user_id' => $user->ID, 'description' => $description, 'permissions' => $permissions, 'consumer_key' => wc_api_hash($consumer_key), 'consumer_secret' => $consumer_secret, 'truncated_key' => substr($consumer_key, -7)), array('%d', '%s', '%s', '%s', '%s', '%s')); return array('key_id' => $wpdb->insert_id, 'user_id' => $app_user_id, 'consumer_key' => $consumer_key, 'consumer_secret' => $consumer_secret, 'key_permissions' => $permissions); }
/** * Test wc_time_format(). * * @since 2.2 */ public function test_wc_time_format() { $this->assertEquals(get_option('time_format'), wc_time_format()); }
/** * Return last access column. * * @param array $key * @return string */ public function column_last_access($key) { if (!empty($key['last_access'])) { /* translators: 1: last access date 2: last access time */ $date = sprintf(__('%1$s at %2$s', 'woocommerce'), date_i18n(wc_date_format(), strtotime($key['last_access'])), date_i18n(wc_time_format(), strtotime($key['last_access']))); return apply_filters('woocommerce_api_key_last_access_datetime', $date, $key['last_access']); } return __('Unknown', 'woocommerce'); }
<td style="border-top: 0;"> <?php $timestamp_gmt = strtotime($order->post->post_date_gmt); if ($timestamp_gmt > 0) { // translators: php date format $t_time = get_the_time(_x('Y/m/d g:i:s A', 'post date', 'woocommerce-subscriptions'), $post); $time_diff = $timestamp_gmt - current_time('timestamp', true); if ($time_diff > 0 && $time_diff < WEEK_IN_SECONDS) { // translators: placeholder is human time difference (e.g. "3 weeks") $date_to_display = sprintf(_x('In %s', 'used in "Related Orders" as the date when the related order happened in relation to now. Date is in the future.', 'woocommerce-subscriptions'), human_time_diff(current_time('timestamp', true), $timestamp_gmt)); } elseif ($time_diff < 0 && absint($time_diff) < WEEK_IN_SECONDS) { // translators: placeholder is human time difference (e.g. "3 weeks") $date_to_display = sprintf(_x('%s ago', 'used in "Related Orders" as the date when the related order happened in relation to now. Date is in the past.', 'woocommerce-subscriptions'), human_time_diff(current_time('timestamp', true), $timestamp_gmt)); } else { $timestamp_site = strtotime(get_date_from_gmt(date('Y-m-d H:i:s', $timestamp_gmt))); $date_to_display = date_i18n(wc_date_format(), $timestamp_site) . ' ' . date_i18n(wc_time_format(), $timestamp_site); } } else { $t_time = $date_to_display = __('Unpublished', 'woocommerce-subscriptions'); } ?> <abbr title="<?php echo esc_attr($t_time); ?> "> <?php echo esc_html(apply_filters('post_date_column_time', $date_to_display, $order->post)); ?> </abbr> </td> <td style="border-top: 0;">
public function meta_box_save($post_id) { if (!isset($_POST['wc_bookings_details_meta_box_nonce']) || !wp_verify_nonce($_POST['wc_bookings_details_meta_box_nonce'], 'wc_bookings_details_meta_box')) { return $post_id; } if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) { return $post_id; } if (!in_array($_POST['post_type'], $this->post_types)) { return $post_id; } global $wpdb, $post; // Save simple fields $booking_order_id = absint($_POST['_booking_order_id']); $booking_status = wc_clean($_POST['_booking_status']); $customer_id = absint($_POST['_booking_customer_id']); $product_id = wc_clean($_POST['product_or_resource_id']); $parent_id = absint($_POST['_booking_parent_id']); $all_day = isset($_POST['_booking_all_day']) ? '1' : '0'; // Update post_parent and status via query to prevent endless loops $wpdb->update($wpdb->posts, array('post_parent' => $booking_order_id), array('ID' => $post_id)); $wpdb->update($wpdb->posts, array('post_status' => $booking_status), array('ID' => $post_id)); // Trigger actions manually $old_status = $post->post_status; do_action('woocommerce_booking_' . $booking_status, $post_id); do_action('woocommerce_booking_' . $old_status . '_to_' . $booking_status, $post_id); clean_post_cache($post_id); // Note in the order if ($booking_order_id && function_exists('wc_get_order') && ($order = wc_get_order($booking_order_id))) { $order->add_order_note(sprintf(__('Booking #%d status changed manually from "%s" to "%s', 'woocommerce-bookings'), $post_id, $old_status, $booking_status)); } // Save product and resource if (strstr($product_id, '=>')) { list($product_id, $resource_id) = explode('=>', $product_id); } else { $resource_id = 0; } update_post_meta($post_id, '_booking_resource_id', $resource_id); update_post_meta($post_id, '_booking_product_id', $product_id); // Update meta update_post_meta($post_id, '_booking_customer_id', $customer_id); update_post_meta($post_id, '_booking_parent_id', $parent_id); update_post_meta($post_id, '_booking_all_day', $all_day); // Persons $saved_persons = get_post_meta($post_id, '_booking_persons', true); $product = wc_get_product($product_id); $person_types = $product->get_person_types(); if (!empty($person_types) && is_array($person_types)) { $booking_persons = array(); foreach ($person_types as $person_type) { if (!empty($_POST['_booking_person_' . $person_type->ID])) { $booking_persons[$person_type->ID] = absint($_POST['_booking_person_' . $person_type->ID]); } } update_post_meta($post_id, '_booking_persons', $booking_persons); } else { if (empty($person_types) && !empty($saved_persons) && is_array($saved_persons)) { $booking_persons = array(); foreach (array_keys($saved_persons) as $person_id) { $booking_persons[$person_id] = absint($_POST['_booking_person_' . $person_id]); } update_post_meta($post_id, '_booking_persons', $booking_persons); } } // Update date if (empty($_POST['booking_date'])) { $date = current_time('timestamp'); } else { $date = strtotime($_POST['booking_date'] . ' ' . (int) $_POST['booking_date_hour'] . ':' . (int) $_POST['booking_date_minute'] . ':00'); } $date = date_i18n('Y-m-d H:i:s', $date); $wpdb->query($wpdb->prepare("UPDATE {$wpdb->posts} SET post_date = %s, post_date_gmt = %s WHERE ID = %s", $date, get_gmt_from_date($date), $post_id)); // Do date and time magic and save them in one field $start_date = explode('-', wc_clean($_POST['booking_start_date'])); $end_date = explode('-', wc_clean($_POST['booking_end_date'])); $start_time = explode(':', wc_clean($_POST['booking_start_time'])); $end_time = explode(':', wc_clean($_POST['booking_end_time'])); $start = mktime($start_time[0], $start_time[1], 0, $start_date[1], $start_date[2], $start_date[0]); $end = mktime($end_time[0], $end_time[1], 0, $end_date[1], $end_date[2], $end_date[0]); update_post_meta($post_id, '_booking_start', date('YmdHis', $start)); update_post_meta($post_id, '_booking_end', date('YmdHis', $end)); if ($order && $booking_order_id) { // Update order metas foreach ($order->get_items() as $item_id => $item) { if ('line_item' != $item['type'] || !in_array($product_id, $item['item_meta']['_product_id'])) { continue; } $product = wc_get_product($product_id); $is_all_day = isset($_POST['_booking_all_day']) && $_POST['_booking_all_day'] == 'yes'; // Update date if (metadata_exists('order_item', $item_id, __('Booking Date', 'woocommerce-bookings'))) { $date = mktime(0, 0, 0, $start_date[1], $start_date[2], $start_date[0]); wc_update_order_item_meta($item_id, __('Booking Date', 'woocommerce-bookings'), date_i18n(wc_date_format(), $date)); } // Update time if (!$is_all_day) { if (metadata_exists('order_item', $item_id, __('Booking Time', 'woocommerce-bookings'))) { $time = mktime($start_time[0], $start_time[1], 0, $start_date[1], $start_date[2], $start_date[0]); wc_update_order_item_meta($item_id, __('Booking Time', 'woocommerce-bookings'), date_i18n(wc_time_format(), $time)); } } // Update resource if (metadata_exists('order_item', $item_id, __('Booking Type', 'woocommerce-bookings'))) { $resource = wc_booking_get_product_resource($product_id, $resource_id); wc_update_order_item_meta($item_id, __('Booking Type', 'woocommerce-bookings'), $resource->get_title()); } // Update persons if ($product->has_persons()) { if ($product->has_person_types()) { $person_types = $product->get_person_types(); foreach ($person_types as $type) { if (isset($_POST['_booking_person_' . $type->ID])) { $persons = $_POST['_booking_person_' . $type->ID]; wc_update_order_item_meta($item_id, $type->post_title, $persons); } } } else { // The product does not use person types, the ID will be always 0 and the title "Persons" if (metadata_exists('order_item', $item_id, __('Persons', 'woocommerce-bookings'))) { $persons = $_POST['_booking_person_0']; wc_update_order_item_meta($item_id, __('Persons', 'woocommerce-bookings'), $persons); } } } // Update duration if (metadata_exists('order_item', $item_id, __('Duration', 'woocommerce-bookings'))) { $start_diff = wc_clean($_POST['booking_start_date']); $end_diff = wc_clean($_POST['booking_end_date']); if (!$is_all_day) { $start_diff .= ' ' . wc_clean($_POST['booking_start_time']); $end_diff .= ' ' . wc_clean($_POST['booking_end_time']); } $start = new DateTime($start_diff); $end = new DateTime($end_diff); // Add one day because DateTime::diff does not include the last day if ($is_all_day) { $end->modify('+1 day'); } $diffs = $end->diff($start); $duration = array(); foreach ($diffs as $type => $diff) { if ($diff != 0) { switch ($type) { case 'y': $duration[] = _n('%y year', '%y years', $diff, 'woocommerce-bookings'); break; case 'm': $duration[] = _n('%m month', '%m months', $diff, 'woocommerce-bookings'); break; case 'd': $duration[] = _n('%d day', '%d days', $diff, 'woocommerce-bookings'); break; case 'h': $duration[] = _n('%h hour', '%h hours', $diff, 'woocommerce-bookings'); break; case 'i': $duration[] = _n('%i minute', '%i minutes', $diff, 'woocommerce-bookings'); break; } } } $duration = implode(', ', $duration); $duration = $diffs->format($duration); wc_update_order_item_meta($item_id, __('Duration', 'woocommerce-bookings'), $duration); } } } WC_Cache_Helper::get_transient_version('bookings', true); do_action('woocommerce_booking_process_meta', $post_id); }
/** * Formats order note * * @since 1.0 * @param string $to number SMS message was sent to * @param int $sent_timestamp integer timestamp for when message was sent * @param string $message SMS message sent * @param string $status order status * @param bool $error true if there was an error sending SMS, false otherwise * @return string HTML-formatted order note */ private function format_order_note($to, $sent_timestamp, $message, $status, $error) { try { // get datetime object from unix timestamp $datetime = new DateTime("@{$sent_timestamp}", new DateTimeZone('UTC')); // change timezone to site timezone $datetime->setTimezone(new DateTimeZone(wc_timezone_string())); // return datetime localized to site date/time settings $formatted_datetime = date_i18n(wc_date_format() . ' ' . wc_time_format(), $sent_timestamp + $datetime->getOffset()); } catch (Exception $e) { // log error and set datetime for SMS to 'N/A' wc_twilio_sms()->log($e->getMessage()); $formatted_datetime = __('N/A', WC_Twilio_SMS::TEXT_DOMAIN); } ob_start(); ?> <p><strong><?php _e('SMS Notification', WC_Twilio_SMS::TEXT_DOMAIN); ?> </strong></p> <p><strong><?php _e('To', WC_Twilio_SMS::TEXT_DOMAIN); ?> : </strong><?php echo esc_html($to); ?> </p> <p><strong><?php _e('Date Sent', WC_Twilio_SMS::TEXT_DOMAIN); ?> : </strong><?php echo esc_html($formatted_datetime); ?> </p> <p><strong><?php _e('Message', WC_Twilio_SMS::TEXT_DOMAIN); ?> : </strong><?php echo esc_html($message); ?> </p> <p><strong><?php _e('Status', WC_Twilio_SMS::TEXT_DOMAIN); ?> : <span style="<?php echo $error ? 'color: red;' : 'color: green;'; ?> "><?php echo esc_html($status); ?> </span></strong></p> <?php return ob_get_clean(); }
<li rel="<?php echo $note->ID; ?> " class="note"> <div class="note_content"> <p><?php echo $note->description; ?> </p> </div> <p class="meta"> <abbr class="exact-date" title="<?php echo $note->note_date; ?> "><?php printf(__('added on %1$s at %2$s', 'woocommerce'), date_i18n(wc_date_format(), strtotime($note->note_date)), date_i18n(wc_time_format(), strtotime($note->note_date))); ?> </abbr> </p> </li> <?php } ?> <?php } else { ?> <li><?php _e('There are no notes yet.', 'woocommerce'); ?> </li> <?php
echo absint($note->comment_ID); ?> " class="<?php echo implode(' ', array_map('sanitize_html_class', $note_classes)); ?> "> <div class="note-content"> <?php /* translators: Placeholders represent membership plan name and a note. Example "Gold: Membership cancelled" */ echo wpautop(sprintf(__('%s: %s', WC_Memberships::TEXT_DOMAIN), wp_kses_post($plan_name), wptexturize(wp_kses_post($note->comment_content)))); ?> </div> <p class="meta"> <abbr class="exact-date" title="<?php echo esc_attr($note->comment_date); ?> "><?php printf(esc_html__('On %1$s at %2$s', WC_Memberships::TEXT_DOMAIN), date_i18n(wc_date_format(), strtotime($note->comment_date)), date_i18n(wc_time_format(), strtotime($note->comment_date))); ?> </abbr> <?php if ($note->comment_author !== __('WooCommerce', WC_Memberships::TEXT_DOMAIN)) { printf(' ' . esc_html__('by %s', WC_Memberships::TEXT_DOMAIN), $note->comment_author); } ?> </p> </li>
/** * Compatibility for the woocommerce_time_format() function which is soft-deprecated in 2.1+ * * @since 2.0 * @return string time format */ public static function wc_time_format() { return self::is_wc_version_gte_2_1() ? wc_time_format() : woocommerce_time_format(); }
public function output_notes($post) { global $post, $wpdb; $sql = "SELECT * FROM {$wpdb->comments} as comments\n\t\t\t\tLEFT JOIN {$wpdb->commentmeta} as commentmeta ON(comments.comment_ID = commentmeta.comment_id AND commentmeta.meta_key = 'comment_post_ID')\n\t\t\t\tWHERE (comment_post_ID = 0 AND commentmeta.meta_value = {$post->ID}) OR comment_post_ID = {$post->ID}"; $notes = $wpdb->get_results($sql); echo '<ul class="order_notes">'; if ($notes) { foreach ($notes as $note) { $note_classes = get_comment_meta($note->comment_ID, 'is_customer_note', true) ? array('customer-note', 'note') : array('note'); ?> <li rel="<?php echo absint($note->comment_ID); ?> " class="<?php echo implode(' ', $note_classes); ?> "> <div class="note_content"> <?php echo wpautop(wptexturize(wp_kses_post($note->comment_content))); ?> </div> <p class="meta"> <abbr class="exact-date" title="<?php echo $note->comment_date; ?> "><?php printf(__('added on %1$s at %2$s', 'woocommerce'), date_i18n(wc_date_format(), strtotime($note->comment_date)), date_i18n(wc_time_format(), strtotime($note->comment_date))); ?> </abbr> <?php if ($note->comment_author !== __('WooCommerce', 'woocommerce')) { printf(' ' . __('by %s', 'woocommerce'), $note->comment_author); } ?> <a href="#" class="delete_note"><?php _e('Delete note', 'woocommerce'); ?> </a> </p> </li> <?php } } else { echo '<li>' . __('There are no notes yet.', 'woocommerce') . '</li>'; } echo '</ul>'; ?> <div class="add_note"> <h4><?php _e('Add note', 'woocommerce'); ?> </h4> <p> <textarea type="text" name="order_note" id="add_order_note" class="input-text" cols="20" rows="5"></textarea> </p> <p> <select name="order_note_type" id="order_note_type" style="display: none;"> <option value=""><?php _e('Private note', 'woocommerce'); ?> </option> </select> <a href="#" class="add_account_note button"><?php _e('Add', 'woocommerce'); ?> </a> </p> </div> <?php }
</td> </tr> <tr> <td data-export-label="Next Export"><?php _e('Next Export', 'woocommerce-customer-order-csv-export'); ?> :</td> <td class="help"><?php echo SV_WC_Plugin_Compatibility::wc_help_tip(__('The automatic export start interval in minutes.', 'woocommerce-customer-order-csv-export')); ?> </td> <td> <?php if ($scheduled_timestamp = wp_next_scheduled('wc_customer_order_csv_export_auto_export_orders')) { $scheduled_desc = sprintf(__('Scheduled on %s', 'woocommerce-customer-order-csv-export'), get_date_from_gmt(date('Y-m-d H:i:s', $scheduled_timestamp), wc_date_format() . ' ' . wc_time_format())); } else { $scheduled_desc = sprintf(__('%1$sNot scheduled%2$s', 'woocommerce-customer-order-csv-export'), '<mark class="error">', '</mark>'); } echo $scheduled_desc; ?> </td> </tr> <tr> <td data-export-label="Order Statuses"><?php _e('Order Statuses', 'woocommerce-customer-order-csv-export'); ?> :</td> <td class="help"><?php echo SV_WC_Plugin_Compatibility::wc_help_tip(__('The order statuses to be included in the automatic export.', 'woocommerce-customer-order-csv-export'));
/** * Output the metabox. */ public static function output($post) { global $post; $args = array('post_id' => $post->ID, 'orderby' => 'comment_ID', 'order' => 'DESC', 'approve' => 'approve', 'type' => 'order_note'); remove_filter('comments_clauses', array('WC_Comments', 'exclude_order_comments'), 10, 1); $notes = get_comments($args); add_filter('comments_clauses', array('WC_Comments', 'exclude_order_comments'), 10, 1); echo '<ul class="order_notes">'; if ($notes) { foreach ($notes as $note) { $note_classes = get_comment_meta($note->comment_ID, 'is_customer_note', true) ? array('customer-note', 'note') : array('note'); $note_classes = apply_filters('woocommerce_order_note_class', $note_classes, $note); ?> <li rel="<?php echo absint($note->comment_ID); ?> " class="<?php echo esc_attr(implode(' ', $note_classes)); ?> "> <div class="note_content"> <?php echo wpautop(wptexturize(wp_kses_post($note->comment_content))); ?> </div> <p class="meta"> <abbr class="exact-date" title="<?php echo $note->comment_date; ?> "><?php printf(__('added on %1$s at %2$s', 'woocommerce'), date_i18n(wc_date_format(), strtotime($note->comment_date)), date_i18n(wc_time_format(), strtotime($note->comment_date))); ?> </abbr> <?php if ($note->comment_author !== __('WooCommerce', 'woocommerce')) { printf(' ' . __('by %s', 'woocommerce'), $note->comment_author); } ?> <a href="#" class="delete_note"><?php _e('Delete note', 'woocommerce'); ?> </a> </p> </li> <?php } } else { echo '<li>' . __('There are no notes yet.', 'woocommerce') . '</li>'; } echo '</ul>'; ?> <div class="add_note"> <h4><?php _e('Add note', 'woocommerce'); ?> <?php echo wc_help_tip(__('Add a note for your reference, or add a customer note (the user will be notified).', 'woocommerce')); ?> </h4> <p> <textarea type="text" name="order_note" id="add_order_note" class="input-text" cols="20" rows="5"></textarea> </p> <p> <select name="order_note_type" id="order_note_type"> <option value=""><?php _e('Private note', 'woocommerce'); ?> </option> <option value="customer"><?php _e('Note to customer', 'woocommerce'); ?> </option> </select> <a href="#" class="add_note button"><?php _e('Add', 'woocommerce'); ?> </a> </p> </div> <?php }
* @param string $profile_identifier See https://github.com/opauth/opauth/wiki/Opauth-configuration - Strategy */ echo apply_filters('wc_social_login_profile_identifier', $profile->has_email() ? $profile->get_email() : $profile->get_nickname()); ?> </span> </td> <td data-title="<?php _e('Last login', WC_Social_Login::TEXT_DOMAIN); ?> "> <span> <?php if ($login_timestamp) { ?> <?php printf(__('%s @ %s', WC_Social_Login::TEXT_DOMAIN), date_i18n(wc_date_format(), $login_timestamp), date_i18n(wc_time_format(), $login_timestamp)); ?> <?php } else { ?> <?php echo __('Never', WC_Social_Login::TEXT_DOMAIN); ?> <?php } ?> </span> </td> <td class="profile-actions"> <a href="<?php echo $provider->get_auth_url($return_url, 'unlink');
/** * Returns settings array for use by output/save functions * * @since 3.0 * @param string $tab_id * @return array */ public static function get_settings($tab_id) { $order_statuses = wc_get_order_statuses(); // get the scheduled export time to display to user if ($scheduled_timestamp = wp_next_scheduled('wc_customer_order_csv_export_auto_export_orders')) { $scheduled_desc = sprintf(__('The next export is scheduled on <code>%s</code>', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), get_date_from_gmt(date('Y-m-d H:i:s', $scheduled_timestamp), wc_date_format() . ' ' . wc_time_format())); } else { $scheduled_desc = __('The export is not scheduled.', WC_Customer_Order_CSV_Export::TEXT_DOMAIN); } $settings = array('export' => array(array('name' => __('Export', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'type' => 'title'), array('id' => 'wc_customer_order_csv_export_type', 'name' => __('Export Orders or Customers', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'type' => 'radio', 'options' => array('orders' => __('Orders', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'customers' => __('Customers', WC_Customer_Order_CSV_Export::TEXT_DOMAIN)), 'default' => 'orders'), array('type' => 'sectionend'), array('name' => __('Export Options', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'type' => 'title'), array('id' => 'wc_customer_order_csv_export_statuses', 'name' => __('Order Statuses', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'desc_tip' => __('Orders with these statuses will be included in the export.', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'type' => 'multiselect', 'options' => $order_statuses, 'default' => '', 'class' => 'wc-enhanced-select chosen_select show_if_orders', 'css' => 'min-width: 250px'), array('id' => 'wc_customer_order_csv_export_start_date', 'name' => __('Start Date', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'desc' => __('Start date of customers or orders to include in the exported file, in the format <code>YYYY-MM-DD.</code>', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'type' => 'text'), array('id' => 'wc_customer_order_csv_export_end_date', 'name' => __('End Date', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'desc' => __('End date of customers or orders to include in the exported file, in the format <code>YYYY-MM-DD.</code>', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'type' => 'text'), array('id' => 'wc_customer_order_csv_export_limit', 'name' => __('Limit Records', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'desc' => __('Limit the number of rows to be exported. Use this option when exporting very large files that are unable to complete in a single attempt.', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'type' => 'number', 'custom_attributes' => array('min' => 0)), array('id' => 'wc_customer_order_csv_export_offset', 'name' => __('Offset Records', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'desc' => __('Set the number of records to be skipped in this export. Use this option when exporting very large files that are unable to complete in a single attempt.', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'type' => 'number', 'custom_attributes' => array('min' => 0)), array('type' => 'sectionend')), 'settings' => array(array('name' => __('Export Format', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'type' => 'title'), array('id' => 'wc_customer_order_csv_export_order_format', 'name' => __('Order Export Format', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'desc_tip' => __('Default is a new format for v3.0, Import matches the Customer/Order CSV Import plugin format, and legacy is prior to version 3', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'type' => 'select', 'options' => array('default' => __('Default', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'default_one_row_per_item' => __('Default - One Row per Item', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'import' => __('CSV Import', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'legacy_one_row_per_item' => __('Legacy - One Row per Item', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'legacy_single_column' => __('Legacy - Single Column for all Items', WC_Customer_Order_CSV_Export::TEXT_DOMAIN)), 'default' => 'default'), array('id' => 'wc_customer_order_csv_export_customer_format', 'name' => __('Customer Export Format', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'desc_tip' => __('Default is a new format for v3.0, Import matches the Customer/Order CSV Import plugin format, Legacy is prior to version 3', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'type' => 'select', 'options' => array('default' => __('Default', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'import' => __('CSV Import', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'legacy' => __('Legacy', WC_Customer_Order_CSV_Export::TEXT_DOMAIN)), 'default' => 'default'), array('id' => 'wc_customer_order_csv_export_order_filename', 'name' => __('Order Export Filename', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'desc_tip' => __('The filename for exported orders. Merge variables: %%timestamp%%, %%order_ids%%', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'default' => 'orders-export-%%timestamp%%.csv', 'css' => 'min-width: 300px;', 'type' => 'text'), array('id' => 'wc_customer_order_csv_export_customer_filename', 'name' => __('Customer Export Filename', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'desc_tip' => __('The filename for exported customers. Merge variables: %%timestamp%%', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'default' => 'customers-export-%%timestamp%%.csv', 'css' => 'min-width: 300px;', 'type' => 'text'), array('type' => 'sectionend'), array('name' => __('Automated Export Settings', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'type' => 'title'), array('id' => 'wc_customer_order_csv_export_auto_export_method', 'name' => __('Automatically Export Orders', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'desc_tip' => __('Enable this to automatically export orders via the method & schedule selected.', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'type' => 'select', 'options' => array('disabled' => __('Disabled', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'ftp' => __('via FTP', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'http_post' => __('via HTTP POST', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'email' => __('via Email', WC_Customer_Order_CSV_Export::TEXT_DOMAIN)), 'default' => 'disabled'), array('id' => 'wc_customer_order_csv_export_auto_export_start_time', 'name' => __('Export Start Time', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'desc_tip' => __('Any new orders will start exporting at this time.', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'desc' => sprintf(__('Local time is <code>%s</code>.', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), date_i18n(wc_time_format())) . ' ' . $scheduled_desc, 'default' => '', 'type' => 'text', 'css' => 'max-width: 100px;', 'class' => 'js-wc-customer-order-csv-export-auto-export-timepicker'), array('id' => 'wc_customer_order_csv_export_auto_export_interval', 'name' => __('Export Interval (in minutes)*', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'desc_tip' => __('Any new orders will be exported on this schedule.', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'desc' => __('Required in order to schedule the automatic export.', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'default' => '30', 'type' => 'text', 'css' => 'max-width: 50px;'), array('id' => 'wc_customer_order_csv_export_auto_export_statuses', 'name' => __('Order Statuses', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'desc_tip' => __('Orders with these statuses will be included in the export.', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'type' => 'multiselect', 'options' => $order_statuses, 'default' => '', 'class' => 'wc-enhanced-select chosen_select', 'css' => 'min-width: 250px'), array('type' => 'sectionend'), array('id' => 'wc_customer_order_csv_export_ftp_settings', 'name' => __('FTP Settings', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'type' => 'title'), array('id' => 'wc_customer_order_csv_export_ftp_server', 'name' => __('Server Address', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'desc_tip' => __('The address of the remote FTP server to upload to.', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'default' => '', 'type' => 'text'), array('id' => 'wc_customer_order_csv_export_ftp_username', 'name' => __('Username', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'desc_tip' => __('The username for the remote FTP server.', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'default' => '', 'type' => 'text'), array('id' => 'wc_customer_order_csv_export_ftp_password', 'name' => __('Password', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'desc_tip' => __('The password for the remote FTP server.', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'default' => '', 'type' => 'password'), array('id' => 'wc_customer_order_csv_export_ftp_port', 'name' => __('Port', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'desc_tip' => __('The password for the remote FTP server.', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'default' => '21', 'type' => 'text', 'style' => 'max-width: 50px;'), array('id' => 'wc_customer_order_csv_export_ftp_path', 'name' => __('Initial Path', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'desc_tip' => __('The initial path for the remote FTP server with trailing slash, but excluding leading slash.', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'default' => '', 'type' => 'text'), array('id' => 'wc_customer_order_csv_export_ftp_security', 'name' => __('Security', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'desc_tip' => __('Select the security type for the remote FTP server.', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'default' => 'none', 'options' => array('none' => __('None', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'ftp_ssl' => __('FTP with Implicit SSL', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'ftps' => __('FTP with Explicit TLS/SSL', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'sftp' => __('SFTP (FTP over SSH)', WC_Customer_Order_CSV_Export::TEXT_DOMAIN)), 'type' => 'select'), array('id' => 'wc_customer_order_csv_export_ftp_passive_mode', 'name' => __('Passive Mode', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'desc' => __('Enable passive mode if you are having issues connecting to FTP, especially if you see "PORT command successful" in the error log.', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'default' => 'no', 'type' => 'checkbox'), array('id' => 'wc_customer_order_csv_export_test_button', 'name' => __('Test FTP', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'method' => 'ftp', 'type' => 'csv_test_button'), array('type' => 'sectionend'), array('id' => 'wc_customer_order_csv_export_post_settings', 'name' => __('HTTP POST Settings', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'type' => 'title'), array('id' => 'wc_customer_order_csv_export_http_post_url', 'name' => __('HTTP POST URL', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'desc_tip' => __('Enter the URL to POST the exported CSV to.', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'default' => '', 'type' => 'text'), array('id' => 'wc_customer_order_csv_export_test_button', 'name' => __('Test HTTP POST', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'method' => 'http_post', 'type' => 'csv_test_button'), array('type' => 'sectionend'), array('id' => 'wc_customer_order_csv_export_email_settings', 'name' => __('Email Settings', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'type' => 'title'), array('id' => 'wc_customer_order_csv_export_email_recipients', 'name' => __('Recipient(s)', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'desc_tip' => sprintf(__('Enter recipients (comma separated) the exported CSV should be emailed to. Defaults to <em>%s</em>.', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), esc_attr(get_option('admin_email'))), 'default' => '', 'type' => 'text'), array('id' => 'wc_customer_order_csv_export_email_subject', 'name' => __('Email Subject', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'desc_tip' => __('Enter the email subject.', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'default' => sprintf(__('[%s] Order CSV Export', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), get_option('blogname')), 'type' => 'text'), array('id' => 'wc_customer_order_csv_export_test_button', 'name' => __('Test Email', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'method' => 'email', 'type' => 'csv_test_button'), array('type' => 'sectionend'))); if (wc_customer_order_csv_export()->is_plugin_active('woocommerce-subscriptions.php')) { $settings['export'][] = array('name' => __('Subscriptions Options', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'type' => 'title'); $settings['export'][] = array('id' => 'wc_customer_order_csv_export_subscription_orders', 'title' => __('Export Subscriptions Orders Only', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'desc' => __('Export subscription orders', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'type' => 'checkbox', 'checkboxgroup' => 'start'); $settings['export'][] = array('id' => 'wc_customer_order_csv_export_subscription_renewals', 'desc' => __('Export renewal orders', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), 'type' => 'checkbox', 'checkboxgroup' => 'end'); $settings['export'][] = array('type' => 'sectionend'); } /** * Allow actors to add or remove settings from the CSV export pages. * * @since 3.0.6 * @param array $settings an array of settings for the given tab * @param string $tab_id current tab ID */ return apply_filters('wc_customer_order_csv_export_settings', $settings[$tab_id], $tab_id); }