__( 'System Status', 'woocommerce' ),
'tools' => __( 'Tools', 'woocommerce' ),
);
foreach ( $tabs as $name => $label ) {
echo '' . $label . '';
}
?>
|
: |
|
: |
|
: |
version ); ?> |
: |
|
: |
|
: |
|
: |
|
: |
|
: |
' . sprintf( __( '%s - We recommend setting memory to at least 64MB. See: Increasing memory allocated to PHP', 'woocommerce' ), wp_convert_bytes_to_hr( $memory ), 'http://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP' ) . '';
} else {
echo '' . wp_convert_bytes_to_hr( $memory ) . '';
}
?> |
: |
' . __( 'Yes', 'woocommerce' ) . ''; else echo '' . __( 'No', 'woocommerce' ) . ''; ?> |
: |
|
: |
|
: |
|
: |
plugin_path() . '/logs/paypal.txt', 'a' ) )
echo '' . __( 'Log directory is writable.', 'woocommerce' ) . '';
else
echo '' . __( 'Log directory (woocommerce/logs/ ) is not writable. Logging will not be possible.', 'woocommerce' ) . '';
?> |
';
$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 SOAP Client class enabled - some gateway plugins which use SOAP may not work as expected.', 'woocommerce' ), 'http://php.net/manual/en/class.soapclient.php' ) . '';
$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( 'wc_debug_posting', $posting );
foreach( $posting as $post ) { $mark = ( isset( $post['success'] ) && $post['success'] == true ) ? 'yes' : 'error';
?>
: |
|
|
: |
', $wc_plugins );
?> |
|
: |
'.__( 'Yes', 'woocommerce' ).'' : ''.__( 'No', '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 ''; else echo '
';
echo '' . esc_html( $page_name ) . ': | ';
$error = false;
$page_id = get_option( $values['option'] );
// Page ID check
if ( ! $page_id ) {
echo '' . __( 'Page not set', 'woocommerce' ) . '';
$error = true;
} else {
// Shortcode check
if ( $values['shortcode'] ) {
$page = get_post( $page_id );
if ( empty( $page ) ) {
echo '' . sprintf( __( 'Page does not exist', 'woocommerce' ) ) . '';
$error = true;
} else if ( ! strstr( $page->post_content, $values['shortcode'] ) ) {
echo '' . sprintf( __( 'Page does not contain the shortcode: %s', 'woocommerce' ), $values['shortcode'] ) . '';
$error = true;
}
}
}
if ( ! $error ) echo '#' . absint( $page_id ) . ' - ' . str_replace( home_url(), '', get_permalink( $page_id ) ) . '';
echo ' |
';
$alt = $alt * -1;
}
?>
|
: |
0 ) );
foreach ( $terms as $term )
$display_terms[] = $term->name . ' (' . $term->slug . ')';
echo implode( ', ', array_map( 'esc_html', $display_terms ) );
?> |
: |
0 ) );
foreach ( $terms as $term )
$display_terms[] = $term->name . ' (' . $term->slug . ')';
echo implode( ', ', array_map( 'esc_html', $display_terms ) );
?> |
|
: |
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( ', ', $found_files );
} else {
_e( 'No core overrides present in theme.', 'woocommerce' );
}
?> |
$value ) {
if ( ! in_array( $value, array( ".",".." ) ) ) {
if ( is_dir( $template_path . DIRECTORY_SEPARATOR . $value ) ) {
$sub_files = woocommerce_scan_template_files( $template_path . DIRECTORY_SEPARATOR . $value );
foreach ( $sub_files as $sub_file ) {
$result[] = $value . DIRECTORY_SEPARATOR . $sub_file;
}
} else {
$result[] = $value;
}
}
}
}
return $result;
}
/**
* woocommerce_status_tools function.
*
* @access public
* @return void
*/
function woocommerce_status_tools() {
global $woocommerce, $wpdb;
$tools = apply_filters( 'wc_debug_tools', array(
'clear_transients' => array(
'name' => __( 'WC Transients','woocommerce'),
'button' => __('Clear transients','woocommerce'),
'desc' => __( 'This tool will clear the product/shop transients cache.', 'woocommerce' ),
),
'clear_expired_transients' => array(
'name' => __( 'Expired Transients','woocommerce'),
'button' => __('Clear expired transients','woocommerce'),
'desc' => __( 'This tool will clear ALL expired transients from Wordpress.', 'woocommerce' ),
),
'recount_terms' => array(
'name' => __('Term counts','woocommerce'),
'button' => __('Recount terms','woocommerce'),
'desc' => __( 'This tool will recount product terms - useful when changing your settings in a way which hides products from the catalog.', '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' ),
),
) );
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 '' . __( 'Product Transients Cleared', 'woocommerce' ) . '
';
break;
case "clear_expired_transients" :
// http://w-shadow.com/blog/2012/04/17/delete-stale-transients/
$rows = $wpdb->query( "
DELETE
a, b
FROM
{$wpdb->options} a, {$wpdb->options} b
WHERE
a.option_name LIKE '_transient_%' AND
a.option_name NOT LIKE '_transient_timeout_%' AND
b.option_name = CONCAT(
'_transient_timeout_',
SUBSTRING(
a.option_name,
CHAR_LENGTH('_transient_') + 1
)
)
AND b.option_value < UNIX_TIMESTAMP()
" );
$rows2 = $wpdb->query( "
DELETE
a, b
FROM
{$wpdb->options} a, {$wpdb->options} b
WHERE
a.option_name LIKE '_site_transient_%' AND
a.option_name NOT LIKE '_site_transient_timeout_%' AND
b.option_name = CONCAT(
'_site_transient_timeout_',
SUBSTRING(
a.option_name,
CHAR_LENGTH('_site_transient_') + 1
)
)
AND b.option_value < UNIX_TIMESTAMP()
" );
echo '' . sprintf( __( '%d Transients Rows Cleared', 'woocommerce' ), $rows + $rows2 ) . '
';
break;
case "reset_roles" :
// Remove then re-add caps and roles
woocommerce_remove_roles();
woocommerce_init_roles();
echo '' . __( 'Roles successfully reset', 'woocommerce' ) . '
';
break;
case "recount_terms" :
$product_cats = get_terms( 'product_cat', array( 'hide_empty' => false, 'fields' => 'id=>parent' ) );
_woocommerce_term_recount( $product_cats, get_taxonomy( 'product_cat' ), false, false );
$product_tags = get_terms( 'product_tag', array( 'hide_empty' => false, 'fields' => 'id=>parent' ) );
_woocommerce_term_recount( $product_cats, get_taxonomy( 'product_tag' ), false, false );
echo '' . __( 'Terms successfully recounted', 'woocommerce' ) . '
';
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 '' . sprintf( __( 'There was an error calling %s::%s', 'woocommerce' ), get_class( $callback[0] ), $callback[1] ) . '
';
} else {
echo '' . sprintf( __( 'There was an error calling %s', 'woocommerce' ), $callback ) . '
';
}
}
}
}
}
?>