More reliable un-force https code

This commit is contained in:
Mike Jolley 2012-02-27 11:18:55 +00:00
parent 4fab179206
commit 226f8aa4db
2 changed files with 10 additions and 1 deletions

View File

@ -186,6 +186,7 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc
* Enhanced variation price display (thanks pixeltrix) and tweaked get_price_html - new filters for variation prices
* email_order_items_table image thumbnail support
* Hiding the cart widget option now shows the widget if adding to cart via ajax
* More reliable un-force https code
= 1.4.4 - 18/02/2012 =
* Fix for remove coupon links after ajax update of shipping

View File

@ -365,7 +365,15 @@ class Woocommerce {
exit;
// Break out of SSL if we leave the checkout (anywhere but thanks page)
elseif (is_ssl() && get_option('woocommerce_force_ssl_checkout')=='yes' && get_option('woocommerce_unforce_ssl_checkout')=='yes' && $_SERVER['REQUEST_URI'] && !is_checkout() && !is_page(woocommerce_get_page_id('thanks')) && !is_ajax()) :
wp_safe_redirect( str_replace('https:', 'http:', home_url($_SERVER['REQUEST_URI']) ) );
if ( 0 === strpos($_SERVER['REQUEST_URI'], 'http') ) {
wp_redirect(preg_replace('|^https://|', 'http://', $_SERVER['REQUEST_URI']));
exit();
} else {
wp_redirect('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
exit();
}
exit;
endif;
}