function woo_cd_admin_notice($message = '', $priority = 'updated', $screen = '') { if (empty($priority)) { $priority = 'updated'; } if (!empty($message)) { add_action('admin_notices', woo_cd_admin_notice_html($message, $priority, $screen)); } }
function woo_ce_fail_notices() { $troubleshooting_url = 'http://www.visser.com.au/documentation/store-exporter-deluxe/usage/'; // If the failed flag is set then prepare for an error notice if( isset( $_GET['failed'] ) ) { $message = ''; if( isset( $_GET['message'] ) ) $message = urldecode( $_GET['message'] ); if( $message ) $message = sprintf( __( 'A WordPress or server error caused the exporter to fail, the exporter was provided with a reason: <em>%s</em>', 'woo_ce' ), $message ) . ' (<a href="' . $troubleshooting_url . '" target="_blank">' . __( 'Need help?', 'woo_ce' ) . '</a>)'; else $message = __( 'A WordPress or server error caused the exporter to fail, no reason was provided, please get in touch so we can reproduce and resolve this with you.', 'woo_ce' ) . ' (<a href="' . $troubleshooting_url . '" target="_blank">' . __( 'Need help?', 'woo_ce' ) . '</a>)'; woo_cd_admin_notice_html( $message, 'error' ); } // Displays a HTML notice where the memory allocated to WordPress falls below 64MB if( !woo_ce_get_option( 'dismiss_execution_time_prompt', 0 ) ) { $max_execution_time = absint( ini_get( 'max_execution_time' ) ); $response = ini_set( 'max_execution_time', 120 ); if( $response == false || ( $response != $max_execution_time ) ) { $dismiss_url = esc_url( add_query_arg( 'action', 'dismiss_execution_time_prompt' ) ); $message = sprintf( __( 'We could not override the PHP configuration option <code>max_execution_time</code>, this will limit the size of possible exports. See: <a href="%s" target="_blank">Increasing PHP max_execution_time configuration option</a>', 'woo_ce' ), $troubleshooting_url ) . '<span style="float:right;"><a href="' . $dismiss_url . '">' . __( 'Dismiss', 'woo_ce' ) . '</a></span>'; woo_cd_admin_notice_html( $message, 'error' ); } ini_set( 'max_execution_time', $max_execution_time ); } // Displays a HTML notice where the memory allocated to WordPress falls below 64MB if( !woo_ce_get_option( 'dismiss_memory_prompt', 0 ) ) { $memory_limit = absint( ini_get( 'memory_limit' ) ); $minimum_memory_limit = 64; if( $memory_limit < $minimum_memory_limit ) { $dismiss_url = esc_url( add_query_arg( 'action', 'dismiss_memory_prompt' ) ); $message = sprintf( __( 'We recommend setting memory to at least %dMB, your site has only %dMB allocated to it. See: <a href="%s" target="_blank">Increasing memory allocated to PHP</a>', 'woo_ce' ), $minimum_memory_limit, $memory_limit, $troubleshooting_url ) . '<span style="float:right;"><a href="' . $dismiss_url . '">' . __( 'Dismiss', 'woo_ce' ) . '</a></span>'; woo_cd_admin_notice_html( $message, 'error' ); } } // Displays a HTML notice if PHP 5.2 is installed if( version_compare( phpversion(), '5.3', '<' ) && !woo_ce_get_option( 'dismiss_php_legacy', 0 ) ) { $dismiss_url = esc_url( add_query_arg( 'action', 'dismiss_php_legacy' ) ); $message = sprintf( __( 'Your PHP version (%s) is not supported and is very much out of date, since 2010 all users are strongly encouraged to upgrade to PHP 5.3+ and above. Contact your hosting provider to make this happen. See: <a href="%s" target="_blank">Migrating from PHP 5.2 to 5.3</a>', 'woo_ce' ), phpversion(), $troubleshooting_url ) . '<span style="float:right;"><a href="' . $dismiss_url . '">' . __( 'Dismiss', 'woo_ce' ) . '</a></span>'; woo_cd_admin_notice_html( $message, 'error' ); } // Displays HTML notice if there are more than 2500 Subscriptions if( !woo_ce_get_option( 'dismiss_subscription_prompt', 0 ) ) { if( class_exists( 'WC_Subscriptions' ) ) { if( method_exists( 'WC_Subscriptions', 'is_large_site' ) ) { // Does this store have roughly more than 3000 Subscriptions if( WC_Subscriptions::is_large_site() ) { $dismiss_url = esc_url( add_query_arg( 'action', 'dismiss_subscription_prompt' ) ); $message = __( 'We\'ve detected the <em>is_large_site</em> flag has been set within WooCommerce Subscriptions. Please get in touch if exports are incomplete as we need to spin up an alternative export process to export Subscriptions from large stores.', 'woo_ce' ) . ' (<a href="' . $troubleshooting_url . '" target="_blank">' . __( 'Need help?', 'woo_ce' ) . '</a>)' . '<span style="float:right;"><a href="' . $dismiss_url . '">' . __( 'Dismiss', 'woo_ce' ) . '</a></span>'; woo_cd_admin_notice_html( $message, 'error' ); } } } } // If the export failed the WordPress Transient will still exist if( get_transient( WOO_CD_PREFIX . '_running' ) ) { $message = __( 'A WordPress or server error caused the exporter to fail with a blank screen, this is usually isolated to a memory or timeout issue, please get in touch so we can reproduce and resolve this.', 'woo_ce' ) . ' (<a href="' . $troubleshooting_url . '" target="_blank">' . __( 'Need help?', 'woo_ce' ) . '</a>)'; woo_cd_admin_notice_html( $message, 'error' ); delete_transient( WOO_CD_PREFIX . '_running' ); } // If the woo_cd_exported WordPress Option exists then an Order export failed and we should roll back changes if( woo_ce_get_option( 'exported', false ) ) { $orders = woo_ce_get_option( 'exported', false ); if( !empty( $orders ) ) { foreach( $orders as $order_id ) { // Remove the export flag delete_post_meta( $order_id, '_woo_cd_exported' ); // Add an additional Order Note $order = woo_ce_get_order_wc_data( $order_id ); $note = __( 'Order export flag was cleared due to a failed export.', 'woo_ce' ); $order->add_order_note( $note ); unset( $order ); } } unset( $orders, $order_id ); $message = __( 'It looks like a previous Orders export failed before it could complete, we have removed the exported flag assigned to those Orders so they are not excluded from your next export using <em>Filter Orders by Order Date</em> > <em>Since last export</em>.', 'woo_ce' ) . ' (<a href="' . $troubleshooting_url . '" target="_blank">' . __( 'Need help?', 'woo_ce' ) . '</a>)'; woo_cd_admin_notice_html( $message ); delete_option( WOO_CD_PREFIX . '_exported' ); } /* // If the sed-exports folder within Uploads does not exist // @mod - Will work on the next minor release $upload_dir = wp_upload_dir(); if( !file_exists( $upload_dir['basedir'] . '/sed-exports/.htaccess' ) && woo_ce_get_option( 'dismiss_secure_archives_prompt', false ) == false ) { $dismiss_url = esc_url( add_query_arg( 'action', 'dismiss_secure_archives_prompt' ) ); $action_url = esc_url( add_query_arg( 'action', 'relocate_archived_exports' ) ); $message = __( 'It looks like your exports are out in the open, let\'s move them to a secure location within the WordPres Uploads directory.', 'woo_ce' ) . ' (<a href="' . $troubleshooting_url . '" target="_blank">' . __( 'Need help?', 'woo_ce' ) . '</a>)' . '<span style="float:right;"><a href="' . $dismiss_url . '">' . __( 'Dismiss', 'woo_ce' ) . '</a></span>' . '<br /><br /><a href="' . $action_url . '" class="button-primary">' . __( 'Re-locate archived exports', 'woo_ce' ) . '</a>'; woo_cd_admin_notice_html( $message, 'error' ); } */ }
function woo_cd_html_page() { global $wpdb, $export; $title = apply_filters( 'woo_ce_template_header', __( 'Store Exporter Deluxe', 'woo_ce' ) ); woo_cd_template_header( $title ); $action = woo_get_action(); switch( $action ) { case 'export': if( WOO_CD_DEBUG ) { if( false === ( $export_log = get_transient( WOO_CD_PREFIX . '_debug_log' ) ) ) { $export_log = __( 'No export entries were found within the debug Transient, please try again with different export filters.', 'woo_ce' ); } else { $export_log = base64_decode( $export_log ); } delete_transient( WOO_CD_PREFIX . '_debug_log' ); $output = ' <h3>' . sprintf( __( 'Export Details: %s', 'woo_ce' ), esc_attr( $export->filename ) ) . '</h3> <p>' . __( 'This prints the $export global that contains the different export options and filters to help reproduce this on another instance of WordPress. Very useful for debugging blank or unexpected exports.', 'woo_ce' ) . '</p> <textarea id="export_log">' . esc_textarea( print_r( $export, true ) ) . '</textarea> <hr />'; if( in_array( $export->export_format, array( 'csv', 'xls' ) ) ) { $output .= ' <script> $j(function() { $j(\'#export_sheet\').CSVToTable(\'\', { startLine: 0'; if( in_array( $export->export_format, array( 'xls', 'xlsx' ) ) ) { $output .= ', separator: "\t"'; } $output .= ' }); }); </script> <h3>' . __( 'Export', 'woo_ce' ) . '</h3> <p>' . __( 'We use the <a href="http://code.google.com/p/jquerycsvtotable/" target="_blank"><em>CSV to Table plugin</em></a> to see first hand formatting errors or unexpected values within the export file.', 'woo_ce' ) . '</p> <div id="export_sheet">' . esc_textarea( $export_log ) . '</div> <p class="description">' . __( 'This jQuery plugin can fail with <code>\'Item count (#) does not match header count\'</code> notices which simply mean the number of headers detected does not match the number of cell contents.', 'woo_ce' ) . '</p> <hr />'; } $output .= ' <h3>' . __( 'Export Log', 'woo_ce' ) . '</h3> <p>' . __( 'This prints the raw export contents and is helpful when the jQuery plugin above fails due to major formatting errors.', 'woo_ce' ) . '</p> <textarea id="export_log" wrap="off">' . esc_textarea( $export_log ) . '</textarea> <hr /> '; echo $output; } woo_cd_manage_form(); break; case 'update': // Save Custom Product Meta if( isset( $_POST['custom_products'] ) ) { $custom_products = $_POST['custom_products']; $custom_products = explode( "\n", trim( $custom_products ) ); $size = count( $custom_products ); if( !empty( $size ) ) { for( $i = 0; $i < $size; $i++ ) $custom_products[$i] = sanitize_text_field( trim( $custom_products[$i] ) ); woo_ce_update_option( 'custom_products', $custom_products ); } } // Save Custom Attributes if( isset( $_POST['custom_attributes'] ) ) { $custom_attributes = $_POST['custom_attributes']; $custom_attributes = explode( "\n", trim( $custom_attributes ) ); $size = count( $custom_attributes ); if( !empty( $size ) ) { for( $i = 0; $i < $size; $i++ ) $custom_attributes[$i] = sanitize_text_field( trim( $custom_attributes[$i] ) ); woo_ce_update_option( 'custom_attributes', $custom_attributes ); } } // Save Custom Product Add-ons if( isset( $_POST['custom_product_addons'] ) ) { $custom_product_addons = $_POST['custom_product_addons']; $custom_product_addons = explode( "\n", trim( $custom_product_addons ) ); $size = count( $custom_product_addons ); if( !empty( $size ) ) { for( $i = 0; $i < $size; $i++ ) $custom_product_addons[$i] = sanitize_text_field( trim( $custom_product_addons[$i] ) ); woo_ce_update_option( 'custom_product_addons', $custom_product_addons ); } } // Save Custom Order Meta if( isset( $_POST['custom_orders'] ) ) { $custom_orders = $_POST['custom_orders']; $custom_orders = explode( "\n", trim( $custom_orders ) ); $size = count( $custom_orders ); if( $size ) { for( $i = 0; $i < $size; $i++ ) $custom_orders[$i] = sanitize_text_field( trim( $custom_orders[$i] ) ); woo_ce_update_option( 'custom_orders', $custom_orders ); } } // Save Custom Order Item Meta if( isset( $_POST['custom_order_items'] ) ) { $custom_order_items = $_POST['custom_order_items']; if( !empty( $custom_order_items ) ) { $custom_order_items = explode( "\n", trim( $custom_order_items ) ); $size = count( $custom_order_items ); if( $size ) { for( $i = 0; $i < $size; $i++ ) $custom_order_items[$i] = sanitize_text_field( trim( $custom_order_items[$i] ) ); woo_ce_update_option( 'custom_order_items', $custom_order_items ); } } else { woo_ce_update_option( 'custom_order_items', '' ); } } // Save Custom User Meta if( isset( $_POST['custom_users'] ) ) { $custom_users = $_POST['custom_users']; $custom_users = explode( "\n", trim( $custom_users ) ); $size = count( $custom_users ); if( $size ) { for( $i = 0; $i < $size; $i++ ) $custom_users[$i] = sanitize_text_field( trim( $custom_users[$i] ) ); woo_ce_update_option( 'custom_users', $custom_users ); } } // Save Custom Customer Meta if( isset( $_POST['custom_customers'] ) ) { $custom_customers = $_POST['custom_customers']; $custom_customers = explode( "\n", trim( $custom_customers ) ); $size = count( $custom_customers ); if( $size ) { for( $i = 0; $i < $size; $i++ ) $custom_customers[$i] = sanitize_text_field( trim( $custom_customers[$i] ) ); woo_ce_update_option( 'custom_customers', $custom_customers ); } } $message = __( 'Custom Fields saved. You can now select those additional fields from the Export Fields list.', 'woo_ce' ); woo_cd_admin_notice_html( $message ); woo_cd_manage_form(); break; default: woo_cd_manage_form(); break; } woo_cd_template_footer(); }
function woo_cd_tab_template( $tab = '' ) { if( !$tab ) $tab = 'overview'; $troubleshooting_url = 'http://www.visser.com.au/documentation/store-exporter-deluxe/'; switch( $tab ) { case 'overview': $skip_overview = woo_ce_get_option( 'skip_overview', false ); break; case 'export': $export_type = sanitize_text_field( ( isset( $_POST['dataset'] ) ? $_POST['dataset'] : woo_ce_get_option( 'last_export', 'product' ) ) ); $types = array_keys( woo_ce_return_export_types() ); // Check if the default export type exists if( !in_array( $export_type, $types ) ) $export_type = 'product'; $products = woo_ce_return_count( 'product' ); $categories = woo_ce_return_count( 'category' ); $tags = woo_ce_return_count( 'tag' ); $brands = woo_ce_return_count( 'brand' ); $orders = woo_ce_return_count( 'order' ); $customers = woo_ce_return_count( 'customer' ); $users = woo_ce_return_count( 'user' ); $coupons = woo_ce_return_count( 'coupon' ); $attributes = woo_ce_return_count( 'attribute' ); $subscriptions = woo_ce_return_count( 'subscription' ); $product_vendors = woo_ce_return_count( 'product_vendor' ); $commissions = woo_ce_return_count( 'commission' ); $shipping_classes = woo_ce_return_count( 'shipping_class' ); add_action( 'woo_ce_export_options', 'woo_ce_export_options_export_format' ); if( $product_fields = woo_ce_get_product_fields() ) { foreach( $product_fields as $key => $product_field ) $product_fields[$key]['disabled'] = ( isset( $product_field['disabled'] ) ? $product_field['disabled'] : 0 ); add_action( 'woo_ce_export_product_options_before_table', 'woo_ce_products_filter_by_product_category' ); add_action( 'woo_ce_export_product_options_before_table', 'woo_ce_products_filter_by_product_tag' ); add_action( 'woo_ce_export_product_options_before_table', 'woo_ce_products_filter_by_product_brand' ); add_action( 'woo_ce_export_product_options_before_table', 'woo_ce_products_filter_by_product_vendor' ); add_action( 'woo_ce_export_product_options_before_table', 'woo_ce_products_filter_by_product_status' ); add_action( 'woo_ce_export_product_options_before_table', 'woo_ce_products_filter_by_product_type' ); add_action( 'woo_ce_export_product_options_before_table', 'woo_ce_products_filter_by_stock_status' ); add_action( 'woo_ce_export_product_options_before_table', 'woo_ce_products_filter_by_language' ); add_action( 'woo_ce_export_product_options_after_table', 'woo_ce_product_sorting' ); add_action( 'woo_ce_export_options', 'woo_ce_products_upsells_formatting' ); add_action( 'woo_ce_export_options', 'woo_ce_products_crosssells_formatting' ); add_action( 'woo_ce_export_options', 'woo_ce_products_variation_formatting' ); add_action( 'woo_ce_export_options', 'woo_ce_products_description_excerpt_formatting' ); add_action( 'woo_ce_export_options', 'woo_ce_export_options_gallery_format' ); add_action( 'woo_ce_export_after_form', 'woo_ce_products_custom_fields' ); } if( $category_fields = woo_ce_get_category_fields() ) { foreach( $category_fields as $key => $category_field ) $category_fields[$key]['disabled'] = ( isset( $category_field['disabled'] ) ? $category_field['disabled'] : 0 ); add_action( 'woo_ce_export_category_options_before_table', 'woo_ce_categories_filter_by_language' ); add_action( 'woo_ce_export_category_options_after_table', 'woo_ce_category_sorting' ); } if( $tag_fields = woo_ce_get_tag_fields() ) { foreach( $tag_fields as $key => $tag_field ) $tag_fields[$key]['disabled'] = ( isset( $tag_field['disabled'] ) ? $tag_field['disabled'] : 0 ); add_action( 'woo_ce_export_tag_options_before_table', 'woo_ce_tags_filter_by_language' ); add_action( 'woo_ce_export_tag_options_after_table', 'woo_ce_tag_sorting' ); } if( $brand_fields = woo_ce_get_brand_fields() ) { foreach( $brand_fields as $key => $brand_field ) $brand_fields[$key]['disabled'] = ( isset( $brand_field['disabled'] ) ? $brand_field['disabled'] : 0 ); add_action( 'woo_ce_export_brand_options_before_table', 'woo_ce_brand_sorting' ); } if( $order_fields = woo_ce_get_order_fields() ) { foreach( $order_fields as $key => $order_field ) { $order_fields[$key]['disabled'] = ( isset( $order_field['disabled'] ) ? $order_field['disabled'] : 0 ); if( $order_field['hidden'] ) unset( $order_fields[$key] ); } add_action( 'woo_ce_export_quicklinks', 'woo_ce_quicklink_custom_fields' ); add_action( 'woo_ce_export_order_options_before_table', 'woo_ce_orders_filter_by_date' ); add_action( 'woo_ce_export_order_options_before_table', 'woo_ce_orders_filter_by_status' ); add_action( 'woo_ce_export_order_options_before_table', 'woo_ce_orders_filter_by_customer' ); add_action( 'woo_ce_export_order_options_before_table', 'woo_ce_orders_filter_by_billing_country' ); add_action( 'woo_ce_export_order_options_before_table', 'woo_ce_orders_filter_by_shipping_country' ); add_action( 'woo_ce_export_order_options_before_table', 'woo_ce_orders_filter_by_user_role' ); add_action( 'woo_ce_export_order_options_before_table', 'woo_ce_orders_filter_by_coupon' ); add_action( 'woo_ce_export_order_options_before_table', 'woo_ce_orders_filter_by_product' ); add_action( 'woo_ce_export_order_options_before_table', 'woo_ce_orders_filter_by_product_category' ); add_action( 'woo_ce_export_order_options_before_table', 'woo_ce_orders_filter_by_product_tag' ); add_action( 'woo_ce_export_order_options_before_table', 'woo_ce_orders_filter_by_product_brand' ); add_action( 'woo_ce_export_order_options_before_table', 'woo_ce_orders_filter_by_order_id' ); add_action( 'woo_ce_export_order_options_before_table', 'woo_ce_orders_filter_by_payment_gateway' ); add_action( 'woo_ce_export_order_options_before_table', 'woo_ce_orders_filter_by_shipping_method' ); add_action( 'woo_ce_export_order_options_before_table', 'woo_ce_orders_custom_fields_link' ); add_action( 'woo_ce_export_order_options_after_table', 'woo_ce_order_sorting' ); add_action( 'woo_ce_export_options', 'woo_ce_orders_items_formatting' ); add_action( 'woo_ce_export_options', 'woo_ce_orders_max_order_items' ); add_action( 'woo_ce_export_options', 'woo_ce_orders_items_types' ); add_action( 'woo_ce_export_after_form', 'woo_ce_orders_custom_fields' ); } if( $customer_fields = woo_ce_get_customer_fields() ) { foreach( $customer_fields as $key => $customer_field ) $customer_fields[$key]['disabled'] = ( isset( $customer_field['disabled'] ) ? $customer_field['disabled'] : 0 ); add_action( 'woo_ce_export_customer_options_before_table', 'woo_ce_customers_filter_by_status' ); add_action( 'woo_ce_export_customer_options_before_table', 'woo_ce_customers_filter_by_user_role' ); add_action( 'woo_ce_export_after_form', 'woo_ce_customers_custom_fields' ); } if( $user_fields = woo_ce_get_user_fields() ) { foreach( $user_fields as $key => $user_field ) $user_fields[$key]['disabled'] = ( isset( $user_field['disabled'] ) ? $user_field['disabled'] : 0 ); add_action( 'woo_ce_export_user_options_after_table', 'woo_ce_user_sorting' ); add_action( 'woo_ce_export_after_form', 'woo_ce_users_custom_fields' ); } if( $coupon_fields = woo_ce_get_coupon_fields() ) { foreach( $coupon_fields as $key => $coupon_field ) $coupon_fields[$key]['disabled'] = ( isset( $coupon_field['disabled'] ) ? $coupon_field['disabled'] : 0 ); add_action( 'woo_ce_export_coupon_options_before_table', 'woo_ce_coupons_filter_by_discount_type' ); add_action( 'woo_ce_export_coupon_options_before_table', 'woo_ce_coupon_sorting' ); } if( $subscription_fields = woo_ce_get_subscription_fields() ) { foreach( $subscription_fields as $key => $subscription_field ) $subscription_fields[$key]['disabled'] = ( isset( $subscription_field['disabled'] ) ? $subscription_field['disabled'] : 0 ); add_action( 'woo_ce_export_subscription_options_before_table', 'woo_ce_subscriptions_filter_by_subscription_status' ); add_action( 'woo_ce_export_subscription_options_before_table', 'woo_ce_subscriptions_filter_by_subscription_product' ); } if( $product_vendor_fields = woo_ce_get_product_vendor_fields() ) { foreach( $product_vendor_fields as $key => $product_vendor_field ) $product_vendor_fields[$key]['disabled'] = ( isset( $product_vendor_field['disabled'] ) ? $product_vendor_field['disabled'] : 0 ); } if( $commission_fields = woo_ce_get_commission_fields() ) { foreach( $commission_fields as $key => $commission_field ) $commission_fields[$key]['disabled'] = ( isset( $commission_field['disabled'] ) ? $commission_field['disabled'] : 0 ); add_action( 'woo_ce_export_commission_options_before_table', 'woo_ce_commissions_filter_by_date' ); add_action( 'woo_ce_export_commission_options_before_table', 'woo_ce_commissions_filter_by_product_vendor' ); add_action( 'woo_ce_export_commission_options_before_table', 'woo_ce_commissions_filter_by_commission_status' ); add_action( 'woo_ce_export_commission_options_before_table', 'woo_ce_commission_sorting' ); } if( $shipping_class_fields = woo_ce_get_shipping_class_fields() ) { foreach( $shipping_class_fields as $key => $shipping_class_field ) $shipping_class_fields[$key]['disabled'] = ( isset( $shipping_class_field['disabled'] ) ? $shipping_class_field['disabled'] : 0 ); add_action( 'woo_ce_export_shipping_class_options_after_table', 'woo_ce_shipping_class_sorting' ); } // $attribute_fields = woo_ce_get_attribute_fields(); if( $attribute_fields = false ) { foreach( $attribute_fields as $key => $attribute_field ) $attribute_fields[$key]['disabled'] = ( isset( $attribute_field['disabled'] ) ? $attribute_field['disabled'] : 0 ); } // Export modules $modules = woo_ce_modules_list(); // Export options $limit_volume = woo_ce_get_option( 'limit_volume' ); $offset = woo_ce_get_option( 'offset' ); break; case 'fields': $export_type = ( isset( $_GET['type'] ) ? sanitize_text_field( $_GET['type'] ) : '' ); $types = array_keys( woo_ce_return_export_types() ); $fields = array(); if( in_array( $export_type, $types ) ) { if( has_filter( 'woo_ce_' . $export_type . '_fields', 'woo_ce_override_' . $export_type . '_field_labels' ) ) remove_filter( 'woo_ce_' . $export_type . '_fields', 'woo_ce_override_' . $export_type . '_field_labels', 11 ); if( function_exists( sprintf( 'woo_ce_get_%s_fields', $export_type ) ) ) $fields = call_user_func( 'woo_ce_get_' . $export_type . '_fields' ); $labels = woo_ce_get_option( $export_type . '_labels', array() ); } break; case 'archive': if( isset( $_POST['archive'] ) || isset( $_GET['trashed'] ) ) { if( isset( $_POST['archive'] ) ) { $post_id = count( $_POST['archive'] ); } else if( isset( $_GET['trashed'] ) ) { $post_id = count( $_GET['ids'] ); } $message = _n( 'Archived export has been deleted.', 'Archived exports has been deleted.', $post_id, 'woo_ce' ); woo_cd_admin_notice_html( $message ); } global $archives_table; $archives_table->prepare_items(); break; case 'settings': $export_filename = woo_ce_get_option( 'export_filename', '' ); // Strip file extension from export filename if( ( strpos( $export_filename, '.csv' ) !== false ) || ( strpos( $export_filename, '.xml' ) !== false ) || ( strpos( $export_filename, '.xls' ) !== false ) ) $export_filename = str_replace( array( '.csv', '.xml', '.xls' ), '', $export_filename ); // Default export filename if( $export_filename == false ) $export_filename = '%store_name%-export_%dataset%-%date%-%time%'; $delete_file = woo_ce_get_option( 'delete_file', 1 ); $timeout = woo_ce_get_option( 'timeout', 0 ); $encoding = woo_ce_get_option( 'encoding', 'UTF-8' ); $bom = woo_ce_get_option( 'bom', 1 ); $delimiter = woo_ce_get_option( 'delimiter', ',' ); $category_separator = woo_ce_get_option( 'category_separator', '|' ); $line_ending_formatting = woo_ce_get_option( 'line_ending_formatting', 'windows' ); $escape_formatting = woo_ce_get_option( 'escape_formatting', 'all' ); $date_format = woo_ce_get_option( 'date_format', 'd/m/Y' ); if( $date_format == 1 || $date_format == '' ) $date_format = 'd/m/Y'; $file_encodings = ( function_exists( 'mb_list_encodings' ) ? mb_list_encodings() : false ); add_action( 'woo_ce_export_settings_top', 'woo_ce_export_settings_quicklinks' ); add_action( 'woo_ce_export_settings_after', 'woo_ce_export_settings_csv' ); add_action( 'woo_ce_export_settings_after', 'woo_ce_export_settings_extend' ); break; case 'tools': // Product Importer Deluxe $woo_pd_url = 'http://www.visser.com.au/woocommerce/plugins/product-importer-deluxe/'; $woo_pd_target = ' target="_blank"'; if( function_exists( 'woo_pd_init' ) ) { $woo_pd_url = esc_url( add_query_arg( array( 'page' => 'woo_pd', 'tab' => null ) ) ); $woo_pd_target = false; } // Store Toolkit $woo_st_url = 'http://www.visser.com.au/woocommerce/plugins/store-toolkit/'; $woo_st_target = ' target="_blank"'; if( function_exists( 'woo_st_admin_init' ) ) { $woo_st_url = esc_url( add_query_arg( array( 'page' => 'woo_st', 'tab' => null ) ) ); $woo_st_target = false; } break; } if( $tab ) { if( file_exists( WOO_CD_PATH . 'templates/admin/tabs-' . $tab . '.php' ) ) { include_once( WOO_CD_PATH . 'templates/admin/tabs-' . $tab . '.php' ); } else { $message = sprintf( __( 'We couldn\'t load the export template file <code>%s</code> within <code>%s</code>, this file should be present.', 'woo_ce' ), 'tabs-' . $tab . '.php', WOO_CD_PATH . 'templates/admin/...' ); woo_cd_admin_notice_html( $message, 'error' ); ob_start(); ?> <p><?php _e( 'You can see this error for one of a few common reasons', 'woo_ce' ); ?>:</p> <ul class="ul-disc"> <li><?php _e( 'WordPress was unable to create this file when the Plugin was installed or updated', 'woo_ce' ); ?></li> <li><?php _e( 'The Plugin files have been recently changed and there has been a file conflict', 'woo_ce' ); ?></li> <li><?php _e( 'The Plugin file has been locked and cannot be opened by WordPress', 'woo_ce' ); ?></li> </ul> <p><?php _e( 'Jump onto our website and download a fresh copy of this Plugin as it might be enough to fix this issue. If this persists get in touch with us.', 'woo_ce' ); ?></p> <?php ob_end_flush(); } } }