Пример #1
0
function woo_st_tab_template($tab = '')
{
    if (!$tab) {
        $tab = 'overview';
    }
    switch ($tab) {
        case 'nuke':
            // Check if a previous nuke failed mid-drop
            $in_progress = woo_st_get_option('in_progress', '');
            if (!empty($in_progress)) {
                $message = sprintf(__('It looks like a previous nuke failed to clear that dataset, this is common in large catalogues and is likely due to WordPress hitting a memory limit or server timeout. Don\'t stress, <a href="%s">retry %s nuke?</a>', 'woo_st'), add_query_arg(array('action' => 'nuke', 'dataset' => $in_progress)), ucfirst($in_progress));
                woo_st_admin_notice_html($message, 'error');
                woo_st_update_option('in_progress', '');
            }
            $products = woo_st_return_count('product');
            $images = woo_st_return_count('product_image');
            $tags = woo_st_return_count('product_tag');
            $categories = woo_st_return_count('product_category');
            if ($categories) {
                $term_taxonomy = 'product_cat';
                $args = array('hide_empty' => 0);
                $categories_data = get_terms($term_taxonomy, $args);
            }
            $orders = woo_st_return_count('order');
            if ($orders) {
                // Check if this is a WooCommerce 2.2+ instance
                $woocommerce_version = woo_get_woo_version();
                $orders_data = false;
                if (version_compare($woocommerce_version, '2.2', '<')) {
                    $term_taxonomy = 'shop_order_status';
                    $args = array('hide_empty' => 0);
                    $orders_data = get_terms($term_taxonomy, $args);
                }
            }
            $tax_rates = woo_st_return_count('tax_rate');
            $download_permissions = woo_st_return_count('download_permission');
            $coupons = woo_st_return_count('coupon');
            $attributes = woo_st_return_count('attribute');
            $brands = woo_st_return_count('product_brand');
            $vendors = woo_st_return_count('product_vendor');
            $credit_cards = woo_st_return_count('credit_card');
            $posts = woo_st_return_count('post');
            $post_categories = woo_st_return_count('post_category');
            $post_tags = woo_st_return_count('post_tag');
            $links = woo_st_return_count('link');
            $comments = woo_st_return_count('comment');
            $media_images = woo_st_return_count('media_image');
            $show_table = false;
            if ($products || $images || $tags || $categories || $orders || $credit_cards || $attributes) {
                $show_table = true;
            }
            break;
    }
    if ($tab) {
        if (file_exists(WOO_ST_PATH . 'templates/admin/tabs-' . $tab . '.php')) {
            include_once WOO_ST_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_st'), 'tabs-' . $tab . '.php', WOO_CD_PATH . 'templates/admin/...');
            woo_st_admin_notice_html($message, 'error');
            ob_start();
            ?>
<p><?php 
            _e('You can see this error for one of a few common reasons', 'woo_st');
            ?>
:</p>
<ul class="ul-disc">
	<li><?php 
            _e('WordPress was unable to create this file when the Plugin was installed or updated', 'woo_st');
            ?>
</li>
	<li><?php 
            _e('The Plugin files have been recently changed and there has been a file conflict', 'woo_st');
            ?>
</li>
	<li><?php 
            _e('The Plugin file has been locked and cannot be opened by WordPress', 'woo_st');
            ?>
</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_st');
            ?>
</p>
<?php 
            ob_end_flush();
        }
    }
}
Пример #2
0
 function woo_st_html_page()
 {
     global $wpdb;
     woo_st_template_header();
     woo_st_support_donate();
     $action = woo_get_action();
     switch ($action) {
         case 'nuke':
             $message = __('The selected WooCommerce and/or WordPress details from the previous screen have been permanently erased from your store. <strong>Ta da!</strong>', 'woo_st');
             woo_st_admin_notice_html($message);
             woo_st_default_html_page();
             break;
         default:
             woo_st_default_html_page();
             break;
     }
     woo_st_template_footer();
 }