<h3 id="system">System Configuration</h3> <?php require_once WooCommerce_PDF_Invoices::$plugin_path . "lib/dompdf/dompdf_config.inc.php"; $memory_limit = function_exists('wc_let_to_num') ? wc_let_to_num(WP_MEMORY_LIMIT) : woocommerce_let_to_num(WP_MEMORY_LIMIT); $server_configs = array("PHP Version" => array("required" => "5.0", "value" => phpversion(), "result" => version_compare(phpversion(), "5.0")), "DOMDocument extension" => array("required" => true, "value" => phpversion("DOM"), "result" => class_exists("DOMDocument")), "PCRE" => array("required" => true, "value" => phpversion("pcre"), "result" => function_exists("preg_match") && @preg_match("/./u", "a"), "failure" => "PCRE is required with Unicode support (the \"u\" modifier)"), "Zlib" => array("required" => true, "value" => phpversion("zlib"), "result" => function_exists("gzcompress"), "fallback" => "Recommended to compress PDF documents"), "MBString extension" => array("required" => true, "value" => phpversion("mbstring"), "result" => function_exists("mb_send_mail"), "fallback" => "Recommended, will use fallback functions"), "GD" => array("required" => true, "value" => phpversion("gd"), "result" => function_exists("imagecreate"), "fallback" => "Required if you have images in your documents"), "opcache" => array("required" => "For better performances", "value" => null, "result" => false, "fallback" => "Recommended for better performances"), "GMagick or IMagick" => array("required" => "Better with transparent PNG images", "value" => null, "result" => extension_loaded("gmagick") || extension_loaded("imagick"), "fallback" => "Recommended for better performances"), "glob()" => array("required" => "Required to detect custom templates and to clear the temp folder periodically", "value" => null, "result" => function_exists("glob"), "fallback" => "Check php disable_functions"), "WP Memory Limit" => array("required" => 'Recommended: 64MB (128MB for optimal performance)<br/>See: <a href="http://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP">Increasing memory allocated to PHP</a>', "value" => WP_MEMORY_LIMIT, "result" => $memory_limit > 67108864)); if (($xc = extension_loaded("xcache")) || ($apc = extension_loaded("apc")) || ($zop = extension_loaded("Zend OPcache")) || ($op = extension_loaded("opcache"))) { $server_configs["opcache"]["result"] = true; $server_configs["opcache"]["value"] = $xc ? "XCache " . phpversion("xcache") : ($apc ? "APC " . phpversion("apc") : ($zop ? "Zend OPCache " . phpversion("Zend OPcache") : "PHP OPCache " . phpversion("opcache"))); } if (($gm = extension_loaded("gmagick")) || ($im = extension_loaded("imagick"))) { $server_configs["GMagick or IMagick"]["value"] = $im ? "IMagick " . phpversion("imagick") : "GMagick " . phpversion("gmagick"); } ?> <table cellspacing="1px" cellpadding="4px" style="background-color: white; padding: 5px; border: 1px solid #ccc;"> <tr> <th align="left"> </th> <th align="left">Required</th> <th align="left">Present</th> </tr> <?php foreach ($server_configs as $label => $server_config) { if ($server_config["result"]) { $background = "#9e4"; $color = "black"; } elseif (isset($server_config["fallback"])) { $background = "#FCC612"; $color = "black"; } else {
/** * woocommerce_status_report function. * * @access public * @return void */ function woocommerce_status_report() { global $woocommerce, $wpdb; ?> <div class="woocommerce-message"> <div class="squeezer"> <h4><?php _e('Please include this information when requesting support:', 'woocommerce'); ?> </h4> <p class="submit"><a href="#" download="wc_report.txt" class="button-primary debug-report"><?php _e('Download System Report File', 'woocommerce'); ?> </a></p> </div> </div> <br/> <table class="wc_status_table widefat" cellspacing="0"> <thead> <tr> <th colspan="2"><?php _e('Environment', 'woocommerce'); ?> </th> </tr> </thead> <tbody> <tr> <td><?php _e('Home URL', 'woocommerce'); ?> :</td> <td><?php echo home_url(); ?> </td> </tr> <tr> <td><?php _e('Site URL', 'woocommerce'); ?> :</td> <td><?php echo site_url(); ?> </td> </tr> <tr> <td><?php _e('WC Version', 'woocommerce'); ?> :</td> <td><?php echo esc_html($woocommerce->version); ?> </td> </tr> <tr> <td><?php _e('WC Database Version', 'woocommerce'); ?> :</td> <td><?php echo esc_html(get_option('woocommerce_db_version')); ?> </td> </tr> <tr> <td><?php _e('WP Version', 'woocommerce'); ?> :</td> <td><?php if (is_multisite()) { echo 'WPMU'; } else { echo 'WP'; } ?> <?php bloginfo('version'); ?> </td> </tr> <tr> <td><?php _e('Web Server Info', 'woocommerce'); ?> :</td> <td><?php echo esc_html($_SERVER['SERVER_SOFTWARE']); ?> </td> </tr> <tr> <td><?php _e('PHP Version', 'woocommerce'); ?> :</td> <td><?php if (function_exists('phpversion')) { echo esc_html(phpversion()); } ?> </td> </tr> <tr> <td><?php _e('MySQL Version', 'woocommerce'); ?> :</td> <td><?php if (function_exists('mysql_get_server_info')) { echo esc_html(mysql_get_server_info()); } ?> </td> </tr> <tr> <td><?php _e('WP Memory Limit', 'woocommerce'); ?> :</td> <td><?php $memory = woocommerce_let_to_num(WP_MEMORY_LIMIT); if ($memory < 67108864) { echo '<mark class="error">' . sprintf(__('%s - We recommend setting memory to at least 64MB. See: <a href="%s">Increasing memory allocated to PHP</a>', 'woocommerce'), size_format($memory), 'http://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP') . '</mark>'; } else { echo '<mark class="yes">' . size_format($memory) . '</mark>'; } ?> </td> </tr> <tr> <td><?php _e('WP Debug Mode', 'woocommerce'); ?> :</td> <td><?php if (defined('WP_DEBUG') && WP_DEBUG) { echo '<mark class="yes">' . __('Yes', 'woocommerce') . '</mark>'; } else { echo '<mark class="no">' . __('No', 'woocommerce') . '</mark>'; } ?> </td> </tr> <tr> <td><?php _e('WP Max Upload Size', 'woocommerce'); ?> :</td> <td><?php echo size_format(wp_max_upload_size()); ?> </td> </tr> <tr> <td><?php _e('PHP Post Max Size', 'woocommerce'); ?> :</td> <td><?php if (function_exists('ini_get')) { echo size_format(woocommerce_let_to_num(ini_get('post_max_size'))); } ?> </td> </tr> <tr> <td><?php _e('PHP Time Limit', 'woocommerce'); ?> :</td> <td><?php if (function_exists('ini_get')) { echo ini_get('max_execution_time'); } ?> </td> </tr> <tr> <td><?php _e('WC Logging', 'woocommerce'); ?> :</td> <td><?php if (@fopen($woocommerce->plugin_path() . '/logs/paypal.txt', 'a')) { echo '<mark class="yes">' . __('Log directory is writable.', 'woocommerce') . '</mark>'; } else { echo '<mark class="error">' . __('Log directory (<code>woocommerce/logs/</code>) is not writable. Logging will not be possible.', 'woocommerce') . '</mark>'; } ?> </td> </tr> <tr> <td><?php _e('Default Timezone', 'woocommerce'); ?> :</td> <td><?php $default_timezone = date_default_timezone_get(); if ('UTC' !== $default_timezone) { echo '<mark class="error">' . sprintf(__('Default timezone is %s - it should be UTC', 'woocommerce'), $default_timezone) . '</mark>'; } else { echo '<mark class="yes">' . sprintf(__('Default timezone is %s', 'woocommerce'), $default_timezone) . '</mark>'; } ?> </td> </tr> <?php $posting = array(); // fsockopen/cURL $posting['fsockopen_curl']['name'] = __('fsockopen/cURL', 'woocommerce'); if (function_exists('fsockopen') || function_exists('curl_init')) { if (function_exists('fsockopen') && function_exists('curl_init')) { $posting['fsockopen_curl']['note'] = __('Your server has fsockopen and cURL enabled.', 'woocommerce'); } elseif (function_exists('fsockopen')) { $posting['fsockopen_curl']['note'] = __('Your server has fsockopen enabled, cURL is disabled.', 'woocommerce'); } else { $posting['fsockopen_curl']['note'] = __('Your server has cURL enabled, fsockopen is disabled.', 'woocommerce'); } $posting['fsockopen_curl']['success'] = true; } else { $posting['fsockopen_curl']['note'] = __('Your server does not have fsockopen or cURL enabled - PayPal IPN and other scripts which communicate with other servers will not work. Contact your hosting provider.', 'woocommerce') . '</mark>'; $posting['fsockopen_curl']['success'] = false; } // SOAP $posting['soap_client']['name'] = __('SOAP Client', 'woocommerce'); if (class_exists('SoapClient')) { $posting['soap_client']['note'] = __('Your server has the SOAP Client class enabled.', 'woocommerce'); $posting['soap_client']['success'] = true; } else { $posting['soap_client']['note'] = sprintf(__('Your server does not have the <a href="%s">SOAP Client</a> class enabled - some gateway plugins which use SOAP may not work as expected.', 'woocommerce'), 'http://php.net/manual/en/class.soapclient.php') . '</mark>'; $posting['soap_client']['success'] = false; } // WP Remote Post Check $posting['wp_remote_post']['name'] = __('WP Remote Post', 'woocommerce'); $request['cmd'] = '_notify-validate'; $params = array('sslverify' => false, 'timeout' => 60, 'user-agent' => 'WooCommerce/' . $woocommerce->version, 'body' => $request); $response = wp_remote_post('https://www.paypal.com/cgi-bin/webscr', $params); if (!is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) { $posting['wp_remote_post']['note'] = __('wp_remote_post() was successful - PayPal IPN is working.', 'woocommerce'); $posting['wp_remote_post']['success'] = true; } elseif (is_wp_error($response)) { $posting['wp_remote_post']['note'] = __('wp_remote_post() failed. PayPal IPN won\'t work with your server. Contact your hosting provider. Error:', 'woocommerce') . ' ' . $response->get_error_message(); $posting['wp_remote_post']['success'] = false; } else { $posting['wp_remote_post']['note'] = __('wp_remote_post() failed. PayPal IPN may not work with your server.', 'woocommerce'); $posting['wp_remote_post']['success'] = false; } $posting = apply_filters('woocommerce_debug_posting', $posting); foreach ($posting as $post) { $mark = isset($post['success']) && $post['success'] == true ? 'yes' : 'error'; ?> <tr> <td><?php echo esc_html($post['name']); ?> :</td> <td> <mark class="<?php echo $mark; ?> "> <?php echo wp_kses_data($post['note']); ?> </mark> </td> </tr> <?php } ?> </tbody> <thead> <tr> <th colspan="2"><?php _e('Plugins', 'woocommerce'); ?> </th> </tr> </thead> <tbody> <tr> <td><?php _e('Installed Plugins', 'woocommerce'); ?> :</td> <td><?php $active_plugins = (array) get_option('active_plugins', array()); if (is_multisite()) { $active_plugins = array_merge($active_plugins, get_site_option('active_sitewide_plugins', array())); } $wc_plugins = array(); foreach ($active_plugins as $plugin) { $plugin_data = @get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin); $dirname = dirname($plugin); $version_string = ''; if (!empty($plugin_data['Name'])) { if (strstr($dirname, 'woocommerce')) { if (false === ($version_data = get_transient($plugin . '_version_data'))) { $changelog = wp_remote_get('http://dzv365zjfbd8v.cloudfront.net/changelogs/' . $dirname . '/changelog.txt'); $cl_lines = explode("\n", wp_remote_retrieve_body($changelog)); if (!empty($cl_lines)) { foreach ($cl_lines as $line_num => $cl_line) { if (preg_match('/^[0-9]/', $cl_line)) { $date = str_replace('.', '-', trim(substr($cl_line, 0, strpos($cl_line, '-')))); $version = preg_replace('~[^0-9,.]~', '', stristr($cl_line, "version")); $update = trim(str_replace("*", "", $cl_lines[$line_num + 1])); $version_data = array('date' => $date, 'version' => $version, 'update' => $update, 'changelog' => $changelog); set_transient($plugin . '_version_data', $version_data, 60 * 60 * 12); break; } } } } if (!empty($version_data['version']) && version_compare($version_data['version'], $plugin_data['Version'], '!=')) { $version_string = ' – <strong style="color:red;">' . $version_data['version'] . ' ' . __('is available', 'woocommerce') . '</strong>'; } } $wc_plugins[] = $plugin_data['Name'] . ' ' . __('by', 'woocommerce') . ' ' . $plugin_data['Author'] . ' ' . __('version', 'woocommerce') . ' ' . $plugin_data['Version'] . $version_string; } } if (sizeof($wc_plugins) == 0) { echo '-'; } else { echo implode(', <br/>', $wc_plugins); } ?> </td> </tr> </tbody> <thead> <tr> <th colspan="2"><?php _e('Settings', 'woocommerce'); ?> </th> </tr> </thead> <tbody> <tr> <td><?php _e('Force SSL', 'woocommerce'); ?> :</td> <td><?php echo get_option('woocommerce_force_ssl_checkout') === 'yes' ? '<mark class="yes">' . __('Yes', 'woocommerce') . '</mark>' : '<mark class="no">' . __('No', 'woocommerce') . '</mark>'; ?> </td> </tr> </tbody> <thead> <tr> <th colspan="2"><?php _e('WC Pages', 'woocommerce'); ?> </th> </tr> </thead> <tbody> <?php $check_pages = array(__('Shop Base', 'woocommerce') => array('option' => 'woocommerce_shop_page_id', 'shortcode' => ''), __('Cart', 'woocommerce') => array('option' => 'woocommerce_cart_page_id', 'shortcode' => '[woocommerce_cart]'), __('Checkout', 'woocommerce') => array('option' => 'woocommerce_checkout_page_id', 'shortcode' => '[woocommerce_checkout]'), __('Pay', 'woocommerce') => array('option' => 'woocommerce_pay_page_id', 'shortcode' => '[woocommerce_pay]'), __('Thanks', 'woocommerce') => array('option' => 'woocommerce_thanks_page_id', 'shortcode' => '[woocommerce_thankyou]'), __('My Account', 'woocommerce') => array('option' => 'woocommerce_myaccount_page_id', 'shortcode' => '[woocommerce_my_account]'), __('Edit Address', 'woocommerce') => array('option' => 'woocommerce_edit_address_page_id', 'shortcode' => '[woocommerce_edit_address]'), __('View Order', 'woocommerce') => array('option' => 'woocommerce_view_order_page_id', 'shortcode' => '[woocommerce_view_order]'), __('Change Password', 'woocommerce') => array('option' => 'woocommerce_change_password_page_id', 'shortcode' => '[woocommerce_change_password]'), __('Lost Password', 'woocommerce') => array('option' => 'woocommerce_lost_password_page_id', 'shortcode' => '[woocommerce_lost_password]')); $alt = 1; foreach ($check_pages as $page_name => $values) { if ($alt == 1) { echo '<tr>'; } else { echo '<tr>'; } echo '<td>' . esc_html($page_name) . ':</td><td>'; $error = false; $page_id = get_option($values['option']); // Page ID check if (!$page_id) { echo '<mark class="error">' . __('Page not set', 'woocommerce') . '</mark>'; $error = true; } else { // Shortcode check if ($values['shortcode']) { $page = get_post($page_id); if (empty($page)) { echo '<mark class="error">' . sprintf(__('Page does not exist', 'woocommerce')) . '</mark>'; $error = true; } else { if (!strstr($page->post_content, $values['shortcode'])) { echo '<mark class="error">' . sprintf(__('Page does not contain the shortcode: %s', 'woocommerce'), $values['shortcode']) . '</mark>'; $error = true; } } } } if (!$error) { echo '<mark class="yes">#' . absint($page_id) . ' - ' . str_replace(home_url(), '', get_permalink($page_id)) . '</mark>'; } echo '</td></tr>'; $alt = $alt * -1; } ?> </tbody> <thead> <tr> <th colspan="2"><?php _e('WC Taxonomies', 'woocommerce'); ?> </th> </tr> </thead> <tbody> <tr> <td><?php _e('Order Statuses', 'woocommerce'); ?> :</td> <td><?php $display_terms = array(); $terms = get_terms('shop_order_status', array('hide_empty' => 0)); foreach ($terms as $term) { $display_terms[] = $term->name . ' (' . $term->slug . ')'; } echo implode(', ', array_map('esc_html', $display_terms)); ?> </td> </tr> <tr> <td><?php _e('Product Types', 'woocommerce'); ?> :</td> <td><?php $display_terms = array(); $terms = get_terms('product_type', array('hide_empty' => 0)); foreach ($terms as $term) { $display_terms[] = $term->name . ' (' . $term->slug . ')'; } echo implode(', ', array_map('esc_html', $display_terms)); ?> </td> </tr> </tbody> <thead> <tr> <th colspan="2"><?php _e('Theme', 'woocommerce'); ?> </th> </tr> </thead> <tbody> <tr> <td><?php _e('Theme Name', 'woocommerce'); ?> :</td> <td><?php $active_theme = wp_get_theme(); echo $active_theme->Name; ?> </td> </tr> <tr> <td><?php _e('Theme Version', 'woocommerce'); ?> :</td> <td><?php echo $active_theme->Version; ?> </td> </tr> <tr> <td><?php _e('Author URL', 'woocommerce'); ?> :</td> <td><?php echo $active_theme->{'Author URI'}; ?> </td> </tr> </tbody> <thead> <tr> <th colspan="2"><?php _e('Templates', 'woocommerce'); ?> </th> </tr> </thead> <tbody> <tr> <td><?php _e('Template Overrides', 'woocommerce'); ?> :</td> <td><?php $template_path = $woocommerce->plugin_path() . '/templates/'; $found_files = array(); $files = woocommerce_scan_template_files($template_path); foreach ($files as $file) { if (file_exists(get_stylesheet_directory() . '/' . $file)) { $found_files[] = '/' . $file; } elseif (file_exists(get_stylesheet_directory() . '/woocommerce/' . $file)) { $found_files[] = '/woocommerce/' . $file; } } if ($found_files) { echo implode(', <br/>', $found_files); } else { _e('No core overrides present in theme.', 'woocommerce'); } ?> </td> </tr> </tbody> </table> <script type="text/javascript"> jQuery.wc_strPad = function(i,l,s) { var o = i.toString(); if (!s) { s = '0'; } while (o.length < l) { o = o + s; } return o; }; jQuery('a.debug-report').click(function(){ var report = ""; jQuery('.wc_status_table thead, .wc_status_table tbody').each(function(){ $this = jQuery( this ); if ( $this.is('thead') ) { report = report + "\n### " + jQuery.trim( $this.text() ) + " ###\n\n"; } else { jQuery('tr', $this).each(function(){ $this = jQuery( this ); name = jQuery.wc_strPad( jQuery.trim( $this.find('td:eq(0)').text() ), 25, ' ' ); value = jQuery.trim( $this.find('td:eq(1)').text() ); report = report + '' + name + value + "\n\n"; }); } } ); var blob = new Blob( [report] ); jQuery(this).attr( 'href', window.URL.createObjectURL( blob ) ); return true; }); </script> <?php }
/** * Debug/Status page * * @author WooThemes * @category Admin * @package WooCommerce */ function woocommerce_debug() { global $woocommerce; $tools = apply_filters('wc_debug_tools', array('clear_transients' => array('name' => __('Transients', 'woocommerce'), 'button' => __('Clear Transients', 'woocommerce'), 'desc' => __('This tool will clear the product/shop transients cache.', 'woocommerce')), 'reset_roles' => array('name' => __('Capabilities', 'woocommerce'), 'button' => __('Reset Capabilities', 'woocommerce'), 'desc' => __('This tool will reset the admin, customer and shop_manager roles to default. Use this if your users cannot access all of the WooCommerce admin pages.', 'woocommerce')))); ?> <div class="wrap woocommerce"> <div class="icon32 icon32-woocommerce-status" id="icon-woocommerce"><br /></div> <h2><?php _e('Debugging Information', 'woocommerce'); ?> <a href="#" class="add-new-h2 debug-report"><?php _e('Generate report', 'woocommerce'); ?> </a></h2> <?php if (!empty($_GET['action']) && !empty($_REQUEST['_wpnonce']) && wp_verify_nonce($_REQUEST['_wpnonce'], 'debug_action')) { switch ($_GET['action']) { case "clear_transients": $woocommerce->clear_product_transients(); echo '<div class="updated"><p>' . __('Product Transients Cleared', 'woocommerce') . '</p></div>'; break; case "reset_roles": global $wp_roles; // Roles remove_role('customer'); remove_role('shop_manager'); // Capabilities $wp_roles->remove_cap('administrator', 'manage_woocommerce'); $woocommerce->init_user_roles(); echo '<div class="updated"><p>' . __('Roles successfully reset', 'woocommerce') . '</p></div>'; break; default: $action = esc_attr($_GET['action']); if (isset($tools[$action]['callback'])) { $callback = $tools[$action]['callback']; $return = call_user_func($callback); if ($return === false) { if (is_array($callback)) { echo '<div class="error"><p>' . sprintf(__('There was an error calling %s::%s', 'woocommerce'), get_class($callback[0]), $callback[1]) . '</p></div>'; } else { echo '<div class="error"><p>' . sprintf(__('There was an error calling %s', 'woocommerce'), $callback) . '</p></div>'; } } } } } ?> <br/> <textarea id="debug-report" readonly="readonly"></textarea> <table class="wc_status_table widefat" cellspacing="0"> <thead> <tr> <th colspan="2"><?php _e('Versions', 'woocommerce'); ?> </th> </tr> </thead> <tbody> <tr> <td><?php _e('WooCommerce version', 'woocommerce'); ?> </td> <td><?php echo $woocommerce->version; ?> </td> </tr> <tr> <td><?php _e('WordPress version', 'woocommerce'); ?> </td> <td><?php if (is_multisite()) { echo 'WPMU'; } else { echo 'WP'; } ?> <?php echo bloginfo('version'); ?> </td> </tr> <tr> <td><?php _e('Installed plugins', 'woocommerce'); ?> </td> <td><?php $active_plugins = (array) get_option('active_plugins', array()); if (is_multisite()) { $active_plugins = array_merge($active_plugins, get_site_option('active_sitewide_plugins', array())); } $active_plugins = array_map('strtolower', $active_plugins); $wc_plugins = array(); foreach ($active_plugins as $plugin) { //if ( strstr( $plugin, 'woocommerce' ) ) { $plugin_data = @get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin); if (!empty($plugin_data['Name'])) { $wc_plugins[] = $plugin_data['Name'] . ' ' . __('by', 'woocommerce') . ' ' . $plugin_data['Author'] . ' ' . __('version', 'woocommerce') . ' ' . $plugin_data['Version']; } //} } if (sizeof($wc_plugins) == 0) { echo '-'; } else { echo '<ul><li>' . implode(', </li><li>', $wc_plugins) . '</li></ul>'; } ?> </td> </tr> </tbody> <thead> <tr> <th colspan="2"><?php _e('Settings', 'woocommerce'); ?> </th> </tr> </thead> <tbody> <tr> <td><?php _e('Home URL', 'woocommerce'); ?> </td> <td><?php echo home_url(); ?> </td> </tr> <tr> <td><?php _e('Site URL', 'woocommerce'); ?> </td> <td><?php echo site_url(); ?> </td> </tr> <tr> <td><?php _e('Force SSL', 'woocommerce'); ?> </td> <td><?php echo ucwords(get_option('woocommerce_force_ssl_checkout')); ?> </td> </tr> </tbody> <thead> <tr> <th colspan="2"><?php _e('Shop Pages', 'woocommerce'); ?> </th> </tr> </thead> <tbody> <?php $check_pages = array(__('Shop base page', 'woocommerce') => array('option' => 'woocommerce_shop_page_id', 'shortcode' => ''), __('Cart Page', 'woocommerce') => array('option' => 'woocommerce_cart_page_id', 'shortcode' => '[woocommerce_cart]'), __('Checkout Page', 'woocommerce') => array('option' => 'woocommerce_checkout_page_id', 'shortcode' => '[woocommerce_checkout]'), __('Pay Page', 'woocommerce') => array('option' => 'woocommerce_pay_page_id', 'shortcode' => '[woocommerce_pay]'), __('Thanks Page', 'woocommerce') => array('option' => 'woocommerce_thanks_page_id', 'shortcode' => '[woocommerce_thankyou]'), __('My Account Page', 'woocommerce') => array('option' => 'woocommerce_myaccount_page_id', 'shortcode' => '[woocommerce_my_account]'), __('Edit Address Page', 'woocommerce') => array('option' => 'woocommerce_edit_address_page_id', 'shortcode' => '[woocommerce_edit_address]'), __('View Order Page', 'woocommerce') => array('option' => 'woocommerce_view_order_page_id', 'shortcode' => '[woocommerce_view_order]'), __('Change Password Page', 'woocommerce') => array('option' => 'woocommerce_change_password_page_id', 'shortcode' => '[woocommerce_change_password]')); $alt = 1; foreach ($check_pages as $page_name => $values) { if ($alt == 1) { echo '<tr>'; } else { echo '<tr>'; } echo '<td>' . $page_name . '</td><td>'; $error = false; $page_id = get_option($values['option']); // Page ID check if (!$page_id) { echo '<mark class="error">' . __('Page not set', 'woocommerce') . '</mark>'; $error = true; } else { // Shortcode check if ($values['shortcode']) { $page = get_post($page_id); if (!strstr($page->post_content, $values['shortcode'])) { echo '<mark class="error">' . sprintf(__('Page does not contain the shortcode: %s', 'woocommerce'), $values['shortcode']) . '</mark>'; $error = true; } } } if (!$error) { echo '<mark class="yes">#' . $page_id . ' - ' . get_permalink($page_id) . '</mark>'; } echo '</td></tr>'; $alt = $alt * -1; } ?> </tbody> <thead> <tr> <th colspan="2"><?php _e('Server Environment', 'woocommerce'); ?> </th> </tr> </thead> <tbody> <tr> <td><?php _e('PHP Version', 'woocommerce'); ?> </td> <td><?php if (function_exists('phpversion')) { echo phpversion(); } ?> </td> </tr> <tr> <td><?php _e('Server Software', 'woocommerce'); ?> </td> <td><?php echo $_SERVER['SERVER_SOFTWARE']; ?> </td> </tr> <tr> <td><?php _e('WP Max Upload Size', 'woocommerce'); ?> </td> <td><?php echo wp_convert_bytes_to_hr(wp_max_upload_size()); ?> </td> </tr> <tr> <td><?php _e('Server upload_max_filesize', 'woocommerce'); ?> </td> <td><?php if (function_exists('phpversion')) { echo wp_convert_bytes_to_hr(woocommerce_let_to_num(ini_get('upload_max_filesize'))); } ?> </td> </tr> <tr> <td><?php _e('Server post_max_size', 'woocommerce'); ?> </td> <td><?php if (function_exists('phpversion')) { echo wp_convert_bytes_to_hr(woocommerce_let_to_num(ini_get('post_max_size'))); } ?> </td> </tr> <tr> <td><?php _e('WP Memory Limit', 'woocommerce'); ?> </td> <td><?php echo wp_convert_bytes_to_hr(woocommerce_let_to_num(WP_MEMORY_LIMIT)); ?> </td> </tr> <tr> <td><?php _e('WP Debug Mode', 'woocommerce'); ?> </td> <td><?php if (defined('WP_DEBUG') && WP_DEBUG) { echo '<mark class="yes">' . __('Yes', 'woocommerce') . '</mark>'; } else { echo '<mark class="no">' . __('No', 'woocommerce') . '</mark>'; } ?> </td> </tr> <tr> <td><?php _e('WC Logging', 'woocommerce'); ?> </td> <td><?php if (@fopen($woocommerce->plugin_path() . '/logs/paypal.txt', 'a')) { echo '<mark class="yes">' . __('Log directory is writable.', 'woocommerce') . '</mark>'; } else { echo '<mark class="error">' . __('Log directory (<code>woocommerce/logs/</code>) is not writable. Logging will not be possible.', 'woocommerce') . '</mark>'; } ?> </td> </tr> </tbody> <thead> <tr> <th colspan="2"><?php _e('PHP Sessions', 'woocommerce'); ?> </th> </tr> </thead> <tbody> <tr> <td><?php _e('Session save path', 'woocommerce'); ?> </td> <td><?php $save_path = session_save_path(); if (!is_dir($save_path)) { echo '<mark class="error">' . sprintf(__('<code>%s</code> does not exist - contact your host to resolve the problem.', 'woocommerce'), $save_path) . '</mark>'; } elseif (!is_writeable($save_path)) { echo '<mark class="error">' . sprintf(__('<code>%s</code> is not writable - contact your host to resolve the problem.', 'woocommerce'), $save_path) . '</mark>'; } else { echo '<mark class="yes">' . sprintf(__('<code>%s</code> is writable.', 'woocommerce'), $save_path) . '</mark>'; } ?> </td> </tr> </tbody> <thead> <tr> <th colspan="2"><?php _e('Remote Posting/IPN', 'woocommerce'); ?> </th> </tr> </thead> <?php $posting = array(); // fsockopen/Curl $posting['fsockopen_curl']['name'] = __('fsockopen/Curl', 'woocommerce'); if (function_exists('fsockopen') || function_exists('curl_init')) { $posting['fsockopen_curl']['note'] = __('Your server has fsockopen or Curl enabled.', 'woocommerce'); $posting['fsockopen_curl']['success'] = true; } else { $posting['fsockopen_curl']['note'] = __('Your server does not have fsockopen or Curl enabled - PayPal IPN and other scripts which communicate with other servers will not work. Contact your hosting provider.', 'woocommerce') . '</mark>'; $posting['fsockopen_curl']['success'] = false; } // WP Remote Post Check $posting['wp_remote_post']['name'] = __('WP Remote Post Check', 'woocommerce'); $params = array('sslverify' => false, 'timeout' => 30, 'user-agent' => 'WooCommerce/' . $woocommerce->version); $response = wp_remote_post('https://www.paypal.com/cgi-bin/webscr', $params); if (!is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) { $posting['wp_remote_post']['note'] = __('wp_remote_post() was successful - PayPal IPN is working.', 'woocommerce'); $posting['wp_remote_post']['success'] = true; } else { $posting['wp_remote_post']['note'] = __('wp_remote_post() failed. PayPal IPN won\'t work with your server. Contact your hosting provider. Error: ', 'woocommerce') . $response->get_error_message(); $posting['wp_remote_post']['success'] = false; } $posting = apply_filters('wc_debug_posting', $posting); ?> <tbody> <?php foreach ($posting as $post) { $mark = isset($post['success']) && $post['success'] == true ? 'yes' : 'error'; ?> <tr> <td><?php echo $post['name']; ?> </td> <td> <mark class="<?php echo $mark; ?> "> <?php echo $post['note']; ?> </mark> </td> </tr> <?php } ?> </tbody> <thead class="tools"> <tr> <th colspan="2"><?php _e('Tools', 'woocommerce'); ?> </th> </tr> </thead> <tbody class="tools"> <?php foreach ($tools as $action => $tool) { ?> <tr> <td><?php echo $tool['name']; ?> </td> <td> <p> <a href="<?php echo wp_nonce_url(admin_url('tools.php?page=woocommerce_debug&action=' . $action), 'debug_action'); ?> " class="button"><?php echo $tool['button']; ?> </a> <span class="description"><?php echo $tool['desc']; ?> </span> </p> </td> </tr> <?php } ?> </tbody> </table> </div> <script type="text/javascript"> jQuery('a.debug-report').click(function(){ if ( ! jQuery('#debug-report').val() ) { // Generate report - user can paste into forum var report = '`'; jQuery('thead:not(".tools"), tbody:not(".tools")', '.wc_status_table').each(function(){ $this = jQuery( this ); if ( $this.is('thead') ) { report = report + "\n=============================================================================================\n"; report = report + " " + jQuery.trim( $this.text() ) + "\n"; report = report + "=============================================================================================\n"; } else { jQuery('tr', $this).each(function(){ $this = jQuery( this ); report = report + $this.find('td:eq(0)').text() + ": \t"; report = report + $this.find('td:eq(1)').text() + "\n"; }); } }); report = report + '`'; jQuery('#debug-report').val( report ); } jQuery('#debug-report').slideToggle('500', function() { jQuery(this).select(); }); return false; }); </script> <?php }
/** * Parses the CSV file and prepares us for the task of processing parsed data * * @param string $file Path to the CSV file for importing */ public function import_start($file, $mapping, $start_pos, $end_pos) { $memory = size_format(woocommerce_let_to_num(ini_get('memory_limit'))); $wp_memory = size_format(woocommerce_let_to_num(WP_MEMORY_LIMIT)); if (defined('WP_DEBUG') && WP_DEBUG) { $this->log->add('csv-import', '---[ New Import ] PHP Memory: ' . $memory . ', WP Memory: ' . $wp_memory); } if (defined('WP_DEBUG') && WP_DEBUG) { $this->log->add('csv-import', __('Parsing products CSV.', 'wc_csv_import')); } $this->parser = new WC_CSV_Parser('product'); list($this->parsed_data, $this->raw_headers, $position) = $this->parser->parse_data($file, $this->delimiter, $mapping, $start_pos, $end_pos); if (defined('WP_DEBUG') && WP_DEBUG) { $this->log->add('csv-import', __('Finished parsing products CSV.', 'wc_csv_import')); } unset($import_data); wp_defer_term_counting(true); wp_defer_comment_counting(true); return $position; }
private function printBaseInterface() { global $wpdb; $amz_settings = @unserialize(get_option('AmazonWooCommerce_amazon')); $plugin_data = get_plugin_data($this->the_plugin->cfg['paths']['plugin_dir_path'] . 'plugin.php'); ?> <link rel='stylesheet' href='<?php echo $this->module_folder; ?> app.css' type='text/css' media='all' /> <script type="text/javascript" src="<?php echo $this->module_folder; ?> app.class.js" ></script> <div id="AmazonWooCommerce-wrapper" class="fluid wrapper-AmazonWooCommerce"> <?php // show the top menu AmazonWooCommerceAdminMenu::getInstance()->make_active('info|server_status')->show_menu(); ?> <!-- Main loading box --> <div id="AmazonWooCommerce-main-loading"> <div id="AmazonWooCommerce-loading-overlay"></div> <div id="AmazonWooCommerce-loading-box"> <div class="AmazonWooCommerce-loading-text"><?php _e('Loading', $this->the_plugin->localizationName); ?> </div> <div class="AmazonWooCommerce-meter AmazonWooCommerce-animate" style="width:86%; margin: 34px 0px 0px 7%;"><span style="width:100%"></span></div> </div> </div> <!-- Content --> <div id="AmazonWooCommerce-content"> <h1 class="AmazonWooCommerce-section-headline"> <?php if (isset($this->module['server_status']['in_dashboard']['icon'])) { echo '<img src="' . ($this->module_folder . $this->module['server_status']['in_dashboard']['icon']) . '" class="AmazonWooCommerce-headline-icon">'; } ?> <?php echo $this->module['server_status']['menu']['title']; ?> <span class="AmazonWooCommerce-section-info"><?php echo $this->module['server_status']['description']; ?> </span> <?php $has_help = isset($this->module['server_status']['help']) ? true : false; if ($has_help === true) { $help_type = isset($this->module['server_status']['help']['type']) && $this->module['server_status']['help']['type'] ? 'remote' : 'local'; if ($help_type == 'remote') { echo '<a href="#load_docs" class="AmazonWooCommerce-show-docs" data-helptype="' . $help_type . '" data-url="' . $this->module['server_status']['help']['url'] . '">HELP</a>'; } } echo '<a href="#load_docs" class="AmazonWooCommerce-show-feedback" data-helptype="' . 'remote' . '" data-url="' . $this->the_plugin->feedback_url . '" data-operation="feedback">Feedback</a>'; ?> </h1> <!-- Container --> <div class="AmazonWooCommerce-container clearfix"> <!-- Main Content Wrapper --> <div id="AmazonWooCommerce-content-wrap" class="clearfix" style="padding-top: 5px;"> <!-- Content Area --> <div id="AmazonWooCommerce-content-area"> <div class="AmazonWooCommerce-grid_4"> <div class="AmazonWooCommerce-panel"> <div class="AmazonWooCommerce-panel-content"> <table class="AmazonWooCommerce-table" cellspacing="0"> <thead> <tr> <th colspan="2"><?php _e('Amazon Settings', $this->the_plugin->localizationName); ?> </th> </tr> </thead> <tbody> <tr> <td width="190"><?php _e('Access Key ID', $this->the_plugin->localizationName); ?> :</td> <td><?php echo $amz_settings['AccessKeyID']; ?> </td> </tr> <tr> <td width="190"><?php _e('Secret Access Key', $this->the_plugin->localizationName); ?> :</td> <td><?php echo $amz_settings['SecretAccessKey']; ?> </td> </tr> <tr> <td width="190"><?php _e('Affiliate IDs', $this->the_plugin->localizationName); ?> :</td> <td><?php if (isset($amz_settings['AffiliateID'])) { foreach ($amz_settings['AffiliateID'] as $key => $value) { if (trim($value) != "") { echo "<strong>" . $key . ":</strong> " . $value . "<br />"; } } } ?> </td> </tr> </tbody> <thead> <tr> <th colspan="2"><?php _e('AmazonWooCommerce import settings', $this->the_plugin->localizationName); ?> </th> </tr> </thead> <tbody> <tr> <td width="190"><?php _e('Amazon API location', $this->the_plugin->localizationName); ?> :</td> <td><?php echo $amz_settings['country']; ?> </td> </tr> <tr> <td width="190"><?php _e('Number of images', $this->the_plugin->localizationName); ?> :</td> <td><?php echo $amz_settings['number_of_images']; ?> </td> </tr> </tbody> <thead> <tr> <th colspan="2"><?php _e('Syncronize Capabilities Testing:', $this->the_plugin->localizationName); ?> </th> </tr> </thead> <tbody> <tr> <td style="vertical-align: middle;">Import test:</td> <td> <div class="AmazonWooCommerce-import-products-test"> <div class="AmazonWooCommerce-test-timeline"> <div class="AmazonWooCommerce-one_step" id="stepid-step1"> <div class="AmazonWooCommerce-step-status AmazonWooCommerce-loading-inprogress"></div> <span class="AmazonWooCommerce-step-name">Step 1</span> </div> <div class="AmazonWooCommerce-one_step" id="stepid-step2"> <div class="AmazonWooCommerce-step-status"></div> <span class="AmazonWooCommerce-step-name">Step 2</span> </div> <div class="AmazonWooCommerce-one_step" id="stepid-step3"> <div class="AmazonWooCommerce-step-status"></div> <span class="AmazonWooCommerce-step-name">Step 3</span> </div> <div style="clear:both;"></div> </div> <table class="AmazonWooCommerce-table AmazonWooCommerce-logs" cellspacing="0"> <tr id="logbox-step1"> <td width="50">Step 1:</td> <td> <div class="AmazonWooCommerce-log-title"> Get product from Amazon.<?php echo $amz_settings['country']; ?> <a href="#" class="AmazonWooCommerce-button gray">View details +</a> </div> <textarea class="AmazonWooCommerce-log-details"></textarea> </td> </tr> <tr id="logbox-step2"> <td width="50">Step 2:</td> <td> <div class="AmazonWooCommerce-log-title"> Import the product into woocomerce <a href="#" class="AmazonWooCommerce-button gray">View details +</a> </div> <textarea class="AmazonWooCommerce-log-details"></textarea> </td> </tr> <tr id="logbox-step3"> <td width="50">Step 3:</td> <td> <div class="AmazonWooCommerce-log-title"> Download images (<?php echo $amz_settings['number_of_images']; ?> ) for products <a href="#" class="AmazonWooCommerce-button gray">View details +</a> </div> <textarea class="AmazonWooCommerce-log-details"></textarea> </td> </tr> </table> <div class="AmazonWooCommerce-begin-test-container"> <a href="#begin-test" class="AmazonWooCommerce-button blue AmazonWooCommerceStressTest">Begin the test</a> <input id="AmazonWooCommerce-test-ASIN" value="B0074FGNJ6" type="text" /> <label>Test with ASIN code</label> </div> </div> </td> </tr> </tbody> <thead> <tr> <th colspan="2"><?php _e('Environment', $this->the_plugin->localizationName); ?> </th> </tr> </thead> <tbody> <tr> <td width="190"><?php _e('Home URL', $this->the_plugin->localizationName); ?> :</td> <td><?php echo home_url(); ?> </td> </tr> <tr> <td><?php _e('AmazonWooCommerce Version', $this->the_plugin->localizationName); ?> :</td> <td><?php echo $plugin_data['Version']; ?> </td> </tr> <tr> <td><?php _e('WP Version', $this->the_plugin->localizationName); ?> :</td> <td><?php if (is_multisite()) { echo 'WPMU'; } else { echo 'WP'; } ?> <?php bloginfo('version'); ?> </td> </tr> <tr> <td><?php _e('Web Server Info', $this->the_plugin->localizationName); ?> :</td> <td><?php echo esc_html($_SERVER['SERVER_SOFTWARE']); ?> </td> </tr> <tr> <td><?php _e('PHP Version', $this->the_plugin->localizationName); ?> :</td> <td><?php if (function_exists('phpversion')) { echo esc_html(phpversion()); } ?> </td> </tr> <tr> <td><?php _e('MySQL Version', $this->the_plugin->localizationName); ?> :</td> <td><?php if (function_exists('mysql_get_server_info')) { echo esc_html(mysql_get_server_info()); } ?> </td> </tr> <tr> <td><?php _e('WP Memory Limit', $this->the_plugin->localizationName); ?> :</td> <td><div class="AmazonWooCommerce-loading-ajax-details" data-action="check_memory_limit"></div></td> </tr> <tr> <td><?php _e('WP Debug Mode', $this->the_plugin->localizationName); ?> :</td> <td><?php if (defined('WP_DEBUG') && WP_DEBUG) { echo __('Yes', $this->the_plugin->localizationName); } else { echo __('No', $this->the_plugin->localizationName); } ?> </td> </tr> <tr> <td><?php _e('WP Max Upload Size', $this->the_plugin->localizationName); ?> :</td> <td><?php echo size_format(wp_max_upload_size()); ?> </td> </tr> <tr> <td><?php _e('PHP Post Max Size', $this->the_plugin->localizationName); ?> :</td> <td><?php if (function_exists('ini_get')) { echo size_format(woocommerce_let_to_num(ini_get('post_max_size'))); } ?> </td> </tr> <tr> <td><?php _e('PHP Time Limit', $this->the_plugin->localizationName); ?> :</td> <td><?php if (function_exists('ini_get')) { echo ini_get('max_execution_time'); } ?> </td> </tr> <tr> <td><?php _e('WP Remote GET', $this->the_plugin->localizationName); ?> :</td> <td><div class="AmazonWooCommerce-loading-ajax-details" data-action="remote_get"></div></td> </tr> <tr> <td><?php _e('SOAP Client', $this->the_plugin->localizationName); ?> :</td> <td><div class="AmazonWooCommerce-loading-ajax-details" data-action="check_soap"></div></td> </tr> <tr> <td><?php _e('SimpleXML library', $this->the_plugin->localizationName); ?> :</td> <td><div class="AmazonWooCommerce-loading-ajax-details" data-action="check_simplexml"></div></td> </tr> </tbody> <thead> <tr> <th colspan="2"><?php _e('Plugins', $this->the_plugin->localizationName); ?> </th> </tr> </thead> <tbody> <tr> <td><?php _e('Installed Plugins', $this->the_plugin->localizationName); ?> :</td> <td><div class="AmazonWooCommerce-loading-ajax-details" data-action="active_plugins"></div></td> </tr> </tbody> <thead> <tr> <th colspan="2"><?php _e('Settings', $this->the_plugin->localizationName); ?> </th> </tr> </thead> <tbody> <tr> <td><?php _e('Force SSL', $this->the_plugin->localizationName); ?> :</td> <td><?php echo get_option('woocommerce_force_ssl_checkout') === 'yes' ? __('Yes', $this->the_plugin->localizationName) : __('No', $this->the_plugin->localizationName); ?> </td> </tr> </tbody> </table> </div> </div> </div> <div class="clear"></div> </div> </div> </div> </div> </div> <?php }
/** * Parses the CSV file and prepares us for the task of processing parsed data * * @param string $file Path to the CSV file for importing */ public function import_start($file, $mapping, $start_pos, $end_pos) { $memory = size_format(woocommerce_let_to_num(ini_get('memory_limit'))); $wp_memory = size_format(woocommerce_let_to_num(WP_MEMORY_LIMIT)); WC_Product_CSV_Import_Suite::log('---[ New Import ] PHP Memory: ' . $memory . ', WP Memory: ' . $wp_memory); WC_Product_CSV_Import_Suite::log(__('Parsing products CSV.', 'woocommerce-product-csv-import-suite')); $this->parser = new WC_CSV_Parser('product'); list($this->parsed_data, $this->raw_headers, $position) = $this->parser->parse_data($file, $this->delimiter, $mapping, $start_pos, $end_pos); WC_Product_CSV_Import_Suite::log(__('Finished parsing products CSV.', 'woocommerce-product-csv-import-suite')); unset($import_data); wp_defer_term_counting(true); wp_defer_comment_counting(true); return $position; }