Exemple #1
0
    function woo_ce_html_page()
    {
        global $wpdb, $export;
        $title = apply_filters('woo_ce_template_header', __('Store Exporter', 'woocommerce-exporter'));
        woo_ce_template_header($title);
        woo_ce_support_donate();
        $action = woo_get_action();
        switch ($action) {
            case 'export':
                if (WOO_CE_DEBUG) {
                    if (false === ($export_log = get_transient(WOO_CE_PREFIX . '_debug_log'))) {
                        $export_log = __('No export entries were found, please try again with different export filters.', 'woocommerce-exporter');
                    } else {
                        $export_log = base64_decode($export_log);
                    }
                    delete_transient(WOO_CE_PREFIX . '_debug_log');
                    $output = '
<h3>' . sprintf(__('Export Details: %s', 'woocommerce-exporter'), 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.', 'woocommerce-exporter') . '</p>
<textarea id="export_log">' . esc_textarea(print_r($export, true)) . '</textarea>
<hr />';
                    if (in_array($export->export_format, array('csv'))) {
                        $output .= '
<script>
	$j(function() {
		$j(\'#export_sheet\').CSVToTable(\'\', { startLine: 0 });
	});
</script>
<h3>' . __('Export', 'woocommerce-exporter') . '</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.', 'woocommerce-exporter') . '</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.', 'woocommerce-exporter') . '</p>
<hr />';
                    }
                    $output .= '
<h3>' . __('Export Log', 'woocommerce-exporter') . '</h3>
<p>' . __('This prints the raw export contents and is helpful when the jQuery plugin above fails due to major formatting errors.', 'woocommerce-exporter') . '</p>
<textarea id="export_log" wrap="off">' . esc_textarea($export_log) . '</textarea>
<hr />
';
                    echo $output;
                }
                woo_ce_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 ($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);
                    }
                }
                $message = __('Custom Fields saved.', 'woocommerce-exporter');
                woo_ce_admin_notice_html($message);
                woo_ce_manage_form();
                break;
            default:
                woo_ce_manage_form();
                break;
        }
        woo_ce_template_footer();
    }
Exemple #2
0
 function woo_ce_html_page()
 {
     global $wpdb, $woo_ce, $export;
     $title = apply_filters('woo_ce_template_header', '');
     woo_ce_template_header($title);
     woo_ce_support_donate();
     $action = woo_get_action();
     switch ($action) {
         case 'export':
             $message = __('Chosen WooCommerce details have been exported from your store.', 'woo_ce');
             $output = '<div class="updated settings-error"><p><strong>' . $message . '</strong></p></div>';
             if (isset($woo_ce['debug']) && $woo_ce['debug']) {
                 if (!isset($woo_ce['debug_log'])) {
                     $woo_ce['debug_log'] = __('No export entries were found, please try again with different export filters.', 'woo_ce');
                 }
                 $output .= '<h3>' . sprintf(__('Export Log: %s', 'woo_ce'), $export->filename) . '</h3>';
                 $output .= '<textarea id="export_log">' . $woo_ce['debug_log'] . '</textarea>';
             }
             echo $output;
             woo_ce_manage_form();
             break;
         case 'update':
             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] = trim($custom_orders[$i]);
                     }
                     woo_ce_update_option('custom_orders', $custom_orders);
                 }
             }
             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] = trim($custom_order_items[$i]);
                         }
                         woo_ce_update_option('custom_order_items', $custom_order_items);
                     }
                 } else {
                     woo_ce_update_option('custom_order_items', '');
                 }
             }
             $message = __('Custom Fields saved.', 'woo_ce');
             $output = '<div class="updated settings-error"><p><strong>' . $message . '</strong></p></div>';
             echo $output;
             woo_ce_manage_form();
             break;
         default:
             woo_ce_manage_form();
             break;
     }
     woo_ce_template_footer();
 }
Exemple #3
0
    function woo_ce_html_page()
    {
        global $wpdb, $export;
        $title = apply_filters('woo_ce_template_header', '');
        woo_ce_template_header($title);
        woo_ce_support_donate();
        $action = woo_get_action();
        switch ($action) {
            case 'export':
                $message = __('Chosen WooCommerce details have been exported from your store.', 'woo_ce');
                woo_ce_admin_notice($message);
                $output = '';
                if (WOO_CE_DEBUG) {
                    if (false === ($export_log = get_transient(WOO_CE_PREFIX . '_debug_log'))) {
                        $export_log = __('No export entries were found, please try again with different export filters.', 'woo_ce');
                    } else {
                        delete_transient(WOO_CE_PREFIX . '_debug_log');
                        $export_log = base64_decode($export_log);
                    }
                    $output = '
<h3>' . __('Export Details') . '</h3>
<textarea id="export_log">' . print_r($export, true) . '</textarea><hr />
<h3>' . sprintf(__('Export Log: %s', 'woo_ce'), $export->filename) . '</h3>
<textarea id="export_log">' . $export_log . '</textarea>
';
                }
                echo $output;
                woo_ce_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 ($size) {
                        for ($i = 0; $i < $size; $i++) {
                            $custom_products[$i] = trim($custom_products[$i]);
                        }
                        woo_ce_update_option('custom_products', $custom_products);
                    }
                }
                // 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] = 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] = trim($custom_order_items[$i]);
                            }
                            woo_ce_update_option('custom_order_items', $custom_order_items);
                        }
                    } else {
                        woo_ce_update_option('custom_order_items', '');
                    }
                }
                $message = __('Custom Fields saved.', 'woo_ce');
                woo_ce_admin_notice($message);
                woo_ce_manage_form();
                break;
            default:
                woo_ce_manage_form();
                break;
        }
        woo_ce_template_footer();
    }