2012-03-25 01:49:21 +00:00
< ? php
/**
* Debug / Status page
*
* @ author WooThemes
* @ category Admin
2012-08-14 12:21:34 +00:00
* @ package WooCommerce / Admin / System Status
* @ version 1.6 . 4
2012-03-25 01:49:21 +00:00
*/
2012-08-14 12:21:34 +00:00
/**
* Output the content of the debugging page .
*
* @ access public
* @ return void
*/
2012-05-21 08:25:34 +00:00
function woocommerce_status () {
2012-12-30 15:02:24 +00:00
global $woocommerce , $wpdb ;
2012-08-02 22:19:31 +00:00
2012-05-10 11:37:10 +00:00
$tools = apply_filters ( 'wc_debug_tools' , array (
'clear_transients' => array (
2012-12-30 15:02:24 +00:00
'name' => __ ( 'WC Transients' , 'woocommerce' ),
'button' => __ ( 'Clear transients' , 'woocommerce' ),
2012-05-10 11:37:10 +00:00
'desc' => __ ( 'This tool will clear the product/shop transients cache.' , 'woocommerce' ),
),
2012-12-30 15:02:24 +00:00
'clear_expired_transients' => array (
'name' => __ ( 'Expired Transients' , 'woocommerce' ),
'button' => __ ( 'Clear expired transients' , 'woocommerce' ),
'desc' => __ ( 'This tool will clear ALL expired transients from Wordpress.' , 'woocommerce' ),
),
2012-11-28 15:23:13 +00:00
'recount_terms' => array (
'name' => __ ( 'Term counts' , 'woocommerce' ),
2012-12-30 15:02:24 +00:00
'button' => __ ( 'Recount terms' , 'woocommerce' ),
2012-11-28 15:23:13 +00:00
'desc' => __ ( 'This tool will recount product terms - useful when changing your settings in a way which hides products from the catalog.' , 'woocommerce' ),
),
2012-05-10 11:37:10 +00:00
'reset_roles' => array (
'name' => __ ( 'Capabilities' , 'woocommerce' ),
2012-12-30 15:02:24 +00:00
'button' => __ ( 'Reset capabilities' , 'woocommerce' ),
2012-05-10 11:37:10 +00:00
'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' ),
),
) );
2012-08-02 22:19:31 +00:00
2012-03-25 01:49:21 +00:00
?>
< div class = " wrap woocommerce " >
2012-04-10 17:13:31 +00:00
< div class = " icon32 icon32-woocommerce-status " id = " icon-woocommerce " >< br /></ div >
2012-10-16 09:45:33 +00:00
< h2 >< ? php _e ( 'System Status' , 'woocommerce' ); ?> <a href="#" class="add-new-h2 debug-report"><?php _e('Generate report', 'woocommerce' ); ?></a></h2>
2012-08-02 22:19:31 +00:00
2012-03-25 01:49:21 +00:00
< ? php
if ( ! empty ( $_GET [ 'action' ] ) && ! empty ( $_REQUEST [ '_wpnonce' ] ) && wp_verify_nonce ( $_REQUEST [ '_wpnonce' ], 'debug_action' ) ) {
2012-08-02 22:19:31 +00:00
2012-03-25 01:49:21 +00:00
switch ( $_GET [ 'action' ] ) {
case " clear_transients " :
$woocommerce -> clear_product_transients ();
2012-08-02 22:19:31 +00:00
2012-10-16 09:45:33 +00:00
echo '<div class="updated"><p>' . __ ( 'Product Transients Cleared' , 'woocommerce' ) . '</p></div>' ;
2012-03-25 01:49:21 +00:00
break ;
2012-12-30 15:02:24 +00:00
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 '<div class="updated"><p>' . sprintf ( __ ( '%d Transients Rows Cleared' , 'woocommerce' ), $rows + $rows2 ) . '</p></div>' ;
break ;
2012-03-25 01:49:21 +00:00
case " reset_roles " :
2012-09-20 15:35:15 +00:00
// Remove then re-add caps and roles
2012-11-27 16:22:47 +00:00
woocommerce_remove_roles ();
2012-09-20 15:35:15 +00:00
woocommerce_init_roles ();
2012-08-02 22:19:31 +00:00
2012-10-16 09:45:33 +00:00
echo '<div class="updated"><p>' . __ ( 'Roles successfully reset' , 'woocommerce' ) . '</p></div>' ;
2012-03-25 01:49:21 +00:00
break ;
2012-11-28 15:23:13 +00:00
case " recount_terms " :
$product_cats = get_terms ( 'product_cat' , array ( 'hide_empty' => false , 'fields' => 'id=>parent' ) );
2012-11-28 15:40:08 +00:00
_woocommerce_term_recount ( $product_cats , get_taxonomy ( 'product_cat' ), false , false );
2012-11-28 15:23:13 +00:00
$product_tags = get_terms ( 'product_tag' , array ( 'hide_empty' => false , 'fields' => 'id=>parent' ) );
2012-11-28 15:40:08 +00:00
_woocommerce_term_recount ( $product_cats , get_taxonomy ( 'product_tag' ), false , false );
2012-11-28 15:23:13 +00:00
echo '<div class="updated"><p>' . __ ( 'Terms successfully recounted' , 'woocommerce' ) . '</p></div>' ;
break ;
2012-05-10 11:37:10 +00:00
default :
2012-05-16 17:09:34 +00:00
$action = esc_attr ( $_GET [ 'action' ] );
if ( isset ( $tools [ $action ][ 'callback' ] ) ) {
$callback = $tools [ $action ][ 'callback' ];
2012-05-10 11:37:10 +00:00
$return = call_user_func ( $callback );
if ( $return === false ) {
if ( is_array ( $callback ) ) {
2012-10-16 09:45:33 +00:00
echo '<div class="error"><p>' . sprintf ( __ ( 'There was an error calling %s::%s' , 'woocommerce' ), get_class ( $callback [ 0 ] ), $callback [ 1 ] ) . '</p></div>' ;
2012-08-02 22:19:31 +00:00
2012-05-10 11:37:10 +00:00
} else {
2012-10-16 09:45:33 +00:00
echo '<div class="error"><p>' . sprintf ( __ ( 'There was an error calling %s' , 'woocommerce' ), $callback ) . '</p></div>' ;
2012-05-10 11:37:10 +00:00
}
}
}
2012-03-25 01:49:21 +00:00
}
}
?>
< br />
< textarea id = " debug-report " readonly = " readonly " ></ textarea >
< table class = " wc_status_table widefat " cellspacing = " 0 " >
2012-08-02 22:19:31 +00:00
2012-03-25 01:49:21 +00:00
< thead >
< tr >
< th colspan = " 2 " >< ? php _e ( 'Versions' , 'woocommerce' ); ?> </th>
</ tr >
</ thead >
2012-08-02 22:19:31 +00:00
2012-03-25 01:49:21 +00:00
< tbody >
2012-05-16 17:09:34 +00:00
< tr >
2012-03-25 01:49:21 +00:00
< td >< ? php _e ( 'WooCommerce version' , 'woocommerce' ) ?> </td>
2012-10-18 09:33:02 +00:00
< td >< ? php echo esc_html ( $woocommerce -> version ); ?> </td>
</ tr >
< tr >
< td >< ? php _e ( 'WooCommerce DB version' , 'woocommerce' ) ?> </td>
< td >< ? php echo esc_html ( get_option ( 'woocommerce_db_version' ) ); ?> </td>
2012-03-25 01:49:21 +00:00
</ 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 >
2012-05-16 17:09:34 +00:00
< tr >
2012-03-25 01:49:21 +00:00
< td >< ? php _e ( 'Installed plugins' , 'woocommerce' ) ?> </td>
< td >< ? php
$active_plugins = ( array ) get_option ( 'active_plugins' , array () );
2012-08-02 22:19:31 +00:00
2012-03-25 01:49:21 +00:00
if ( is_multisite () )
$active_plugins = array_merge ( $active_plugins , get_site_option ( 'active_sitewide_plugins' , array () ) );
2012-08-02 22:19:31 +00:00
2012-03-25 01:49:21 +00:00
$wc_plugins = array ();
2012-08-02 22:19:31 +00:00
2012-03-25 01:49:21 +00:00
foreach ( $active_plugins as $plugin ) {
2012-08-02 22:19:31 +00:00
2012-09-05 17:45:14 +00:00
$plugin_data = @ get_plugin_data ( WP_PLUGIN_DIR . '/' . $plugin );
2012-08-02 22:19:31 +00:00
2012-09-05 17:45:14 +00:00
if ( ! empty ( $plugin_data [ 'Name' ] ) ) {
2012-08-02 22:19:31 +00:00
2012-10-16 09:45:33 +00:00
$wc_plugins [] = $plugin_data [ 'Name' ] . ' ' . __ ( 'by' , 'woocommerce' ) . ' ' . $plugin_data [ 'Author' ] . ' ' . __ ( 'version' , 'woocommerce' ) . ' ' . $plugin_data [ 'Version' ];
2012-08-02 22:19:31 +00:00
2012-09-05 17:45:14 +00:00
}
2012-03-25 01:49:21 +00:00
}
2012-08-02 22:19:31 +00:00
2012-03-25 01:49:21 +00:00
if ( sizeof ( $wc_plugins ) == 0 ) echo '-' ; else echo '<ul><li>' . implode ( ', </li><li>' , $wc_plugins ) . '</li></ul>' ;
2012-08-02 22:19:31 +00:00
2012-03-25 01:49:21 +00:00
?> </td>
</ tr >
</ tbody >
< thead >
< tr >
< th colspan = " 2 " >< ? php _e ( 'Settings' , 'woocommerce' ); ?> </th>
</ tr >
</ thead >
2012-08-02 22:19:31 +00:00
2012-03-25 01:49:21 +00:00
< tbody >
2012-05-16 17:09:34 +00:00
< tr >
2012-03-25 01:49:21 +00:00
< 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 >
2012-05-16 17:09:34 +00:00
< tr >
2012-03-25 01:49:21 +00:00
< td >< ? php _e ( 'Force SSL' , 'woocommerce' ) ?> </td>
2012-06-12 07:21:25 +00:00
< td >< ? php echo ( get_option ( 'woocommerce_force_ssl_checkout' ) === 'yes' ) ? '<mark class="yes">' . __ ( 'Yes' , 'woocommerce' ) . '</mark>' : '<mark class="no">' . __ ( 'No' , 'woocommerce' ) . '</mark>' ; ?> </td>
2012-03-25 01:49:21 +00:00
</ tr >
</ tbody >
< thead >
< tr >
< th colspan = " 2 " >< ? php _e ( 'Shop Pages' , 'woocommerce' ); ?> </th>
</ tr >
</ thead >
2012-08-02 22:19:31 +00:00
2012-03-25 01:49:21 +00:00
< tbody >
< ? php
$check_pages = array (
2012-10-16 09:45:33 +00:00
__ ( 'Shop base page' , 'woocommerce' ) => array (
2012-03-25 01:49:21 +00:00
'option' => 'woocommerce_shop_page_id' ,
'shortcode' => ''
),
2012-10-16 09:45:33 +00:00
__ ( 'Cart Page' , 'woocommerce' ) => array (
2012-03-25 01:49:21 +00:00
'option' => 'woocommerce_cart_page_id' ,
'shortcode' => '[woocommerce_cart]'
),
2012-10-16 09:45:33 +00:00
__ ( 'Checkout Page' , 'woocommerce' ) => array (
2012-03-25 01:49:21 +00:00
'option' => 'woocommerce_checkout_page_id' ,
'shortcode' => '[woocommerce_checkout]'
),
2012-10-16 09:45:33 +00:00
__ ( 'Pay Page' , 'woocommerce' ) => array (
2012-03-25 01:49:21 +00:00
'option' => 'woocommerce_pay_page_id' ,
'shortcode' => '[woocommerce_pay]'
),
2012-10-16 09:45:33 +00:00
__ ( 'Thanks Page' , 'woocommerce' ) => array (
2012-03-25 01:49:21 +00:00
'option' => 'woocommerce_thanks_page_id' ,
'shortcode' => '[woocommerce_thankyou]'
),
2012-10-16 09:45:33 +00:00
__ ( 'My Account Page' , 'woocommerce' ) => array (
2012-03-25 01:49:21 +00:00
'option' => 'woocommerce_myaccount_page_id' ,
'shortcode' => '[woocommerce_my_account]'
),
2012-10-16 09:45:33 +00:00
__ ( 'Edit Address Page' , 'woocommerce' ) => array (
2012-03-25 01:49:21 +00:00
'option' => 'woocommerce_edit_address_page_id' ,
'shortcode' => '[woocommerce_edit_address]'
),
2012-10-16 09:45:33 +00:00
__ ( 'View Order Page' , 'woocommerce' ) => array (
2012-03-25 01:49:21 +00:00
'option' => 'woocommerce_view_order_page_id' ,
'shortcode' => '[woocommerce_view_order]'
),
2012-10-16 09:45:33 +00:00
__ ( 'Change Password Page' , 'woocommerce' ) => array (
2012-03-25 01:49:21 +00:00
'option' => 'woocommerce_change_password_page_id' ,
'shortcode' => '[woocommerce_change_password]'
)
);
2012-08-02 22:19:31 +00:00
2012-03-25 01:49:21 +00:00
$alt = 1 ;
2012-08-02 22:19:31 +00:00
2012-03-25 01:49:21 +00:00
foreach ( $check_pages as $page_name => $values ) {
2012-08-02 22:19:31 +00:00
2012-05-16 17:09:34 +00:00
if ( $alt == 1 ) echo '<tr>' ; else echo '<tr>' ;
2012-08-02 22:19:31 +00:00
2012-10-16 14:46:21 +00:00
echo '<td>' . esc_html ( $page_name ) . '</td><td>' ;
2012-08-02 22:19:31 +00:00
2012-03-25 01:49:21 +00:00
$error = false ;
2012-08-02 22:19:31 +00:00
2012-03-25 01:49:21 +00:00
$page_id = get_option ( $values [ 'option' ]);
2012-08-02 22:19:31 +00:00
2012-03-25 01:49:21 +00:00
// Page ID check
if ( ! $page_id ) {
2012-10-16 09:45:33 +00:00
echo '<mark class="error">' . __ ( 'Page not set' , 'woocommerce' ) . '</mark>' ;
2012-03-25 01:49:21 +00:00
$error = true ;
} else {
2012-08-02 22:19:31 +00:00
2012-03-25 01:49:21 +00:00
// Shortcode check
if ( $values [ 'shortcode' ] ) {
$page = get_post ( $page_id );
2012-08-02 22:19:31 +00:00
2012-03-25 01:49:21 +00:00
if ( ! strstr ( $page -> post_content , $values [ 'shortcode' ] ) ) {
2012-08-02 22:19:31 +00:00
2012-10-16 09:45:33 +00:00
echo '<mark class="error">' . sprintf ( __ ( 'Page does not contain the shortcode: %s' , 'woocommerce' ), $values [ 'shortcode' ] ) . '</mark>' ;
2012-03-25 01:49:21 +00:00
$error = true ;
2012-08-02 22:19:31 +00:00
2012-03-25 01:49:21 +00:00
}
}
2012-08-02 22:19:31 +00:00
2012-03-25 01:49:21 +00:00
}
2012-08-02 22:19:31 +00:00
2012-10-16 14:46:21 +00:00
if ( ! $error ) echo '<mark class="yes">#' . absint ( $page_id ) . ' - ' . get_permalink ( $page_id ) . '</mark>' ;
2012-08-02 22:19:31 +00:00
2012-03-25 01:49:21 +00:00
echo '</td></tr>' ;
2012-08-02 22:19:31 +00:00
2012-03-25 01:49:21 +00:00
$alt = $alt * - 1 ;
}
?>
</ tbody >
2012-08-02 22:19:31 +00:00
< thead >
< tr >
< th colspan = " 2 " >< ? php _e ( 'Core Taxonomies' , 'woocommerce' ); ?> </th>
</ tr >
</ thead >
< tbody >
< tr >
< td >< ? php _e ( 'Order Statuses' , 'woocommerce' ) ?> </td>
< td >< ? php
2012-08-24 17:14:34 +00:00
$order_statuses = get_terms ( 'shop_order_status' , array ( 'fields' => 'names' , 'hide_empty' => 0 ) );
2012-10-16 14:46:21 +00:00
echo implode ( ', ' , array_map ( 'esc_html' , $order_statuses ) );
2012-08-02 22:19:31 +00:00
?> </td>
</ tr >
</ tbody >
2012-03-25 01:49:21 +00:00
< thead >
< tr >
< th colspan = " 2 " >< ? php _e ( 'Server Environment' , 'woocommerce' ); ?> </th>
</ tr >
</ thead >
2012-08-02 22:19:31 +00:00
2012-03-25 01:49:21 +00:00
< tbody >
2012-05-16 17:09:34 +00:00
< tr >
2012-03-25 01:49:21 +00:00
< td >< ? php _e ( 'PHP Version' , 'woocommerce' ) ?> </td>
2012-08-02 22:19:31 +00:00
< td >< ? php
2012-11-27 16:22:47 +00:00
if ( function_exists ( 'phpversion' ) )
2012-10-16 14:46:21 +00:00
echo esc_html ( phpversion () );
2012-03-25 01:49:21 +00:00
?> </td>
</ tr >
< tr >
< td >< ? php _e ( 'Server Software' , 'woocommerce' ) ?> </td>
2012-08-02 22:19:31 +00:00
< td >< ? php
2012-10-16 14:46:21 +00:00
echo esc_html ( $_SERVER [ 'SERVER_SOFTWARE' ] );
2012-03-25 01:49:21 +00:00
?> </td>
</ tr >
2012-05-16 17:09:34 +00:00
< tr >
2012-03-25 01:49:21 +00:00
< td >< ? php _e ( 'WP Max Upload Size' , 'woocommerce' ); ?> </td>
2012-08-02 22:19:31 +00:00
< td >< ? php
2012-03-25 01:49:21 +00:00
echo wp_convert_bytes_to_hr ( wp_max_upload_size () );
?> </td>
</ tr >
< tr >
< td >< ? php _e ( 'Server upload_max_filesize' , 'woocommerce' ) ?> </td>
2012-08-02 22:19:31 +00:00
< td >< ? php
2012-03-25 01:49:21 +00:00
if ( function_exists ( 'phpversion' ))
echo wp_convert_bytes_to_hr ( woocommerce_let_to_num ( ini_get ( 'upload_max_filesize' ) ) );
?> </td>
</ tr >
2012-05-16 17:09:34 +00:00
< tr >
2012-03-25 01:49:21 +00:00
< td >< ? php _e ( 'Server post_max_size' , 'woocommerce' ) ?> </td>
2012-08-02 22:19:31 +00:00
< td >< ? php
if ( function_exists ( 'phpversion' ))
2012-03-25 01:49:21 +00:00
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>
2012-08-02 22:19:31 +00:00
< td >< ? php
2012-05-21 08:25:34 +00:00
$memory = woocommerce_let_to_num ( WP_MEMORY_LIMIT );
2012-08-02 22:19:31 +00:00
2012-05-21 08:25:34 +00:00
if ( $memory < 67108864 ) {
2012-10-16 09:45:33 +00:00
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' ), wp_convert_bytes_to_hr ( $memory ), 'http://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP' ) . '</mark>' ;
2012-05-21 08:25:34 +00:00
} else {
echo '<mark class="yes">' . wp_convert_bytes_to_hr ( $memory ) . '</mark>' ;
}
2012-03-25 01:49:21 +00:00
?> </td>
</ tr >
2012-05-16 17:09:34 +00:00
< tr >
2012-03-25 01:49:21 +00:00
< td >< ? php _e ( 'WP Debug Mode' , 'woocommerce' ) ?> </td>
2012-10-16 09:45:33 +00:00
< td >< ? php if ( defined ( 'WP_DEBUG' ) && WP_DEBUG ) echo '<mark class="yes">' . __ ( 'Yes' , 'woocommerce' ) . '</mark>' ; else echo '<mark class="no">' . __ ( 'No' , 'woocommerce' ) . '</mark>' ; ?> </td>
2012-03-25 01:49:21 +00:00
</ tr >
< tr >
< td >< ? php _e ( 'WC Logging' , 'woocommerce' ) ?> </td>
2012-08-02 22:19:31 +00:00
< td >< ? php
2012-03-25 01:49:21 +00:00
if ( @ fopen ( $woocommerce -> plugin_path () . '/logs/paypal.txt' , 'a' ) )
2012-10-16 09:45:33 +00:00
echo '<mark class="yes">' . __ ( 'Log directory is writable.' , 'woocommerce' ) . '</mark>' ;
2012-03-25 01:49:21 +00:00
else
2012-10-16 09:45:33 +00:00
echo '<mark class="error">' . __ ( 'Log directory (<code>woocommerce/logs/</code>) is not writable. Logging will not be possible.' , 'woocommerce' ) . '</mark>' ;
2012-03-25 01:49:21 +00:00
?> </td>
</ tr >
</ tbody >
2012-08-02 22:19:31 +00:00
2012-03-25 01:49:21 +00:00
< thead >
< tr >
< th colspan = " 2 " >< ? php _e ( 'Remote Posting/IPN' , 'woocommerce' ); ?> </th>
</ tr >
</ thead >
2012-08-02 22:19:31 +00:00
2012-05-10 11:37:10 +00:00
< ? php
$posting = array ();
2012-08-02 22:19:31 +00:00
2012-06-12 07:34:06 +00:00
// fsockopen/cURL
2012-10-16 09:45:33 +00:00
$posting [ 'fsockopen_curl' ][ 'name' ] = __ ( 'fsockopen/cURL' , 'woocommerce' );
2012-06-12 07:34:06 +00:00
if ( function_exists ( 'fsockopen' ) || function_exists ( 'curl_init' ) ) {
if ( function_exists ( 'fsockopen' ) && function_exists ( 'curl_init' )) {
2012-10-16 09:45:33 +00:00
$posting [ 'fsockopen_curl' ][ 'note' ] = __ ( 'Your server has fsockopen and cURL enabled.' , 'woocommerce' );
2012-06-12 07:34:06 +00:00
} elseif ( function_exists ( 'fsockopen' )) {
2012-10-16 09:45:33 +00:00
$posting [ 'fsockopen_curl' ][ 'note' ] = __ ( 'Your server has fsockopen enabled, cURL is disabled.' , 'woocommerce' );
2012-06-12 07:34:06 +00:00
} else {
2012-10-16 09:45:33 +00:00
$posting [ 'fsockopen_curl' ][ 'note' ] = __ ( 'Your server has cURL enabled, fsockopen is disabled.' , 'woocommerce' );
2012-06-12 07:34:06 +00:00
}
$posting [ 'fsockopen_curl' ][ 'success' ] = true ;
2012-05-10 11:37:10 +00:00
} else {
2012-10-16 09:45:33 +00:00
$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>' ;
2012-05-10 11:37:10 +00:00
$posting [ 'fsockopen_curl' ][ 'success' ] = false ;
}
2012-11-27 16:22:47 +00:00
2012-11-04 15:03:48 +00:00
// 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 ;
}
2012-08-02 22:19:31 +00:00
2012-05-10 11:37:10 +00:00
// WP Remote Post Check
2012-10-16 09:45:33 +00:00
$posting [ 'wp_remote_post' ][ 'name' ] = __ ( 'WP Remote Post Check' , 'woocommerce' );
2012-07-09 17:12:24 +00:00
$request [ 'cmd' ] = '_notify-validate' ;
2012-08-02 22:19:31 +00:00
$params = array (
2012-05-10 11:37:10 +00:00
'sslverify' => false ,
2012-06-18 11:36:27 +00:00
'timeout' => 60 ,
2012-07-09 17:12:24 +00:00
'user-agent' => 'WooCommerce/' . $woocommerce -> version ,
'body' => $request
2012-08-02 22:19:31 +00:00
);
2012-05-10 11:37:10 +00:00
$response = wp_remote_post ( 'https://www.paypal.com/cgi-bin/webscr' , $params );
2012-08-02 22:19:31 +00:00
2012-06-18 11:36:27 +00:00
if ( ! is_wp_error ( $response ) && $response [ 'response' ][ 'code' ] >= 200 && $response [ 'response' ][ 'code' ] < 300 ) {
2012-10-16 09:45:33 +00:00
$posting [ 'wp_remote_post' ][ 'note' ] = __ ( 'wp_remote_post() was successful - PayPal IPN is working.' , 'woocommerce' );
2012-05-10 11:37:10 +00:00
$posting [ 'wp_remote_post' ][ 'success' ] = true ;
2012-06-18 11:36:27 +00:00
} elseif ( is_wp_error ( $response ) ) {
2012-10-16 09:45:33 +00:00
$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 ();
2012-05-10 11:37:10 +00:00
$posting [ 'wp_remote_post' ][ 'success' ] = false ;
2012-06-18 11:36:27 +00:00
} else {
2012-10-16 09:45:33 +00:00
$posting [ 'wp_remote_post' ][ 'note' ] = __ ( 'wp_remote_post() failed. PayPal IPN may not work with your server.' , 'woocommerce' );
2012-06-18 11:36:27 +00:00
$posting [ 'wp_remote_post' ][ 'success' ] = false ;
2012-05-10 11:37:10 +00:00
}
2012-08-02 22:19:31 +00:00
2012-05-10 11:37:10 +00:00
$posting = apply_filters ( 'wc_debug_posting' , $posting );
?>
2012-08-02 22:19:31 +00:00
2012-03-25 01:49:21 +00:00
< tbody >
2012-05-10 11:37:10 +00:00
< ? php foreach ( $posting as $post ) { $mark = ( isset ( $post [ 'success' ] ) && $post [ 'success' ] == true ) ? 'yes' : 'error' ; ?>
2012-05-16 17:09:34 +00:00
< tr >
2012-10-16 14:46:21 +00:00
< td >< ? php echo esc_html ( $post [ 'name' ] ); ?> </td>
2012-05-10 11:37:10 +00:00
< td >
< mark class = " <?php echo $mark ; ?> " >
2012-11-04 15:03:48 +00:00
< ? php echo wp_kses_data ( $post [ 'note' ] ); ?>
2012-05-10 11:37:10 +00:00
</ mark >
</ td >
2012-03-25 01:49:21 +00:00
</ tr >
2012-05-10 11:37:10 +00:00
< ? php } ?>
2012-03-25 01:49:21 +00:00
</ tbody >
2012-08-02 22:19:31 +00:00
2012-03-25 01:49:21 +00:00
< thead class = " tools " >
< tr >
< th colspan = " 2 " >< ? php _e ( 'Tools' , 'woocommerce' ); ?> </th>
</ tr >
</ thead >
2012-05-10 11:37:10 +00:00
2012-03-25 01:49:21 +00:00
< tbody class = " tools " >
2012-05-10 11:37:10 +00:00
< ? php foreach ( $tools as $action => $tool ) { ?>
2012-05-16 17:09:34 +00:00
< tr >
2012-10-16 14:46:21 +00:00
< td >< ? php echo esc_html ( $tool [ 'name' ] ); ?> </td>
2012-03-25 01:49:21 +00:00
< td >
< p >
2012-10-16 14:46:21 +00:00
< a href = " <?php echo wp_nonce_url( admin_url('admin.php?page=woocommerce_status&action=' . $action ), 'debug_action' ); ?> " class = " button " >< ? php echo esc_html ( $tool [ 'button' ] ); ?> </a>
< span class = " description " >< ? php echo wp_kses_post ( $tool [ 'desc' ] ); ?> </span>
2012-03-25 01:49:21 +00:00
</ p >
</ td >
</ tr >
2012-05-10 11:37:10 +00:00
< ? php } ?>
2012-03-25 01:49:21 +00:00
</ tbody >
</ table >
</ div >
< script type = " text/javascript " >
2012-08-02 22:19:31 +00:00
2012-03-25 01:49:21 +00:00
jQuery ( 'a.debug-report' ) . click ( function (){
2012-08-02 22:19:31 +00:00
2012-03-25 01:49:21 +00:00
if ( ! jQuery ( '#debug-report' ) . val () ) {
2012-08-02 22:19:31 +00:00
2012-03-25 01:49:21 +00:00
// Generate report - user can paste into forum
var report = '`' ;
2012-08-02 22:19:31 +00:00
2012-03-25 01:49:21 +00:00
jQuery ( 'thead:not(".tools"), tbody:not(".tools")' , '.wc_status_table' ) . each ( function (){
2012-08-02 22:19:31 +00:00
2012-03-25 01:49:21 +00:00
$this = jQuery ( this );
2012-08-02 22:19:31 +00:00
2012-03-25 01:49:21 +00:00
if ( $this . is ( 'thead' ) ) {
2012-08-02 22:19:31 +00:00
2012-03-25 01:49:21 +00:00
report = report + " \n ============================================================================================= \n " ;
report = report + " " + jQuery . trim ( $this . text () ) + " \n " ;
report = report + " ============================================================================================= \n " ;
2012-08-02 22:19:31 +00:00
2012-03-25 01:49:21 +00:00
} else {
2012-08-02 22:19:31 +00:00
2012-03-25 01:49:21 +00:00
jQuery ( 'tr' , $this ) . each ( function (){
2012-08-02 22:19:31 +00:00
2012-03-25 01:49:21 +00:00
$this = jQuery ( this );
2012-08-02 22:19:31 +00:00
2012-03-25 01:49:21 +00:00
report = report + $this . find ( 'td:eq(0)' ) . text () + " : \t " ;
report = report + $this . find ( 'td:eq(1)' ) . text () + " \n " ;
2012-08-02 22:19:31 +00:00
2012-03-25 01:49:21 +00:00
});
2012-08-02 22:19:31 +00:00
2012-03-25 01:49:21 +00:00
}
2012-08-02 22:19:31 +00:00
2012-03-25 01:49:21 +00:00
});
2012-08-02 22:19:31 +00:00
2012-03-25 01:49:21 +00:00
report = report + '`' ;
2012-08-02 22:19:31 +00:00
2012-03-25 01:49:21 +00:00
jQuery ( '#debug-report' ) . val ( report );
}
2012-08-02 22:19:31 +00:00
2012-03-25 01:49:21 +00:00
jQuery ( '#debug-report' ) . slideToggle ( '500' , function () {
jQuery ( this ) . select ();
});
return false ;
2012-08-02 22:19:31 +00:00
2012-03-25 01:49:21 +00:00
});
2012-08-02 22:19:31 +00:00
2012-03-25 01:49:21 +00:00
</ script >
< ? php
}