Download URL fix with HTTPS

This commit is contained in:
Mike Jolley 2011-12-15 11:21:06 +00:00
parent 1cc32d1740
commit 7163d1dd38
3 changed files with 29 additions and 17 deletions

View File

@ -50,6 +50,7 @@ class woocommerce_localisation {
) )
) )
); );
} }
} }

View File

@ -46,21 +46,24 @@ class WooCommerce_Widget_Cart extends WP_Widget {
if ( $title ) echo $before_title . $title . $after_title; if ( $title ) echo $before_title . $title . $after_title;
echo '<ul class="cart_list product_list_widget">'; echo '<ul class="cart_list product_list_widget">';
if (sizeof($woocommerce->cart->get_cart())>0) : foreach ($woocommerce->cart->get_cart() as $cart_item_key => $cart_item) : if (sizeof($woocommerce->cart->get_cart())>0) :
$_product = $cart_item['data']; foreach ($woocommerce->cart->get_cart() as $cart_item_key => $cart_item) :
if ($_product->exists() && $cart_item['quantity']>0) : $_product = $cart_item['data'];
echo '<li><a href="'.get_permalink($cart_item['product_id']).'">'; if ($_product->exists() && $cart_item['quantity']>0) :
echo '<li><a href="'.get_permalink($cart_item['product_id']).'">';
echo $_product->get_image();
echo $_product->get_image();
echo apply_filters('woocommerce_cart_widget_product_title', $_product->get_title(), $_product).'</a>';
echo apply_filters('woocommerce_cart_widget_product_title', $_product->get_title(), $_product).'</a>';
echo $woocommerce->cart->get_item_data( $cart_item );
echo $woocommerce->cart->get_item_data( $cart_item );
echo '<span class="quantity">' .$cart_item['quantity'].' &times; '.woocommerce_price($_product->get_price()).'</span></li>';
endif; echo '<span class="quantity">' .$cart_item['quantity'].' &times; '.woocommerce_price($_product->get_price()).'</span></li>';
endforeach; endif;
else: echo '<li class="empty">'.__('No products in the cart.', 'woothemes').'</li>'; endif; endforeach;
else:
echo '<li class="empty">'.__('No products in the cart.', 'woothemes').'</li>';
endif;
echo '</ul>'; echo '</ul>';
if (sizeof($woocommerce->cart->get_cart())>0) : if (sizeof($woocommerce->cart->get_cart())>0) :

View File

@ -620,13 +620,21 @@ function woocommerce_download_product() {
endif; endif;
// Get URLS with https
$site_url = site_url();
$network_url = network_admin_url();
if (is_ssl()) :
$site_url = str_replace('https:', 'http:', $site_url);
$network_url = str_replace('https:', 'http:', $network_url);
endif;
if (!is_multisite()) : if (!is_multisite()) :
$file_path = str_replace(trailingslashit(site_url()), ABSPATH, $file_path); $file_path = str_replace(trailingslashit($site_url), ABSPATH, $file_path);
else : else :
$upload_dir = wp_upload_dir(); $upload_dir = wp_upload_dir();
// Try to replace network url // Try to replace network url
$file_path = str_replace(trailingslashit(network_admin_url()), ABSPATH, $file_path); $file_path = str_replace(trailingslashit($network_url), ABSPATH, $file_path);
// Now try to replace upload URL // Now try to replace upload URL
$file_path = str_replace($upload_dir['baseurl'], $upload_dir['basedir'], $file_path); $file_path = str_replace($upload_dir['baseurl'], $upload_dir['basedir'], $file_path);