Merge branch 'master' into tests/api-system-status

This commit is contained in:
Steve Grunwell 2018-01-17 21:21:41 +00:00
commit 473262cb13
8 changed files with 25 additions and 12 deletions

File diff suppressed because one or more lines are too long

View File

@ -2135,7 +2135,6 @@ ul.wc_coupon_list_block {
.order-status {
display: inline-flex;
padding: 0px 1em;
line-height: 2.5em;
color: #777;
background: #E5E5E5;
@ -2144,6 +2143,7 @@ ul.wc_coupon_list_block {
margin: -.25em 0;
cursor: inherit !important;
white-space: nowrap;
max-width: 100%;
&.status-completed {
background: #C8D7E1;
@ -2169,6 +2169,12 @@ ul.wc_coupon_list_block {
background: #eba3a3;
color: #761919;
}
> span {
margin: 0 1em;
overflow: hidden;
text-overflow: ellipsis;
}
}
.wc-order-preview {
@ -2270,7 +2276,7 @@ ul.wc_coupon_list_block {
white-space: nowrap;
}
.wc-action-button {
margin: -1px !important;
margin: 0 0 0 -1px !important;
border: 1px solid #ccc;
padding: 1px 10px !important;
border-radius: 0 !important;
@ -2286,6 +2292,7 @@ ul.wc_coupon_list_block {
z-index: 2;
}
.wc-action-button:first-child {
margin-left: 0 !important;
border-top-left-radius: 3px !important;
border-bottom-left-radius: 3px !important;
}

View File

@ -7,8 +7,8 @@ jQuery( function( $ ) {
}
/* Storage Handling */
var $supports_html5_storage;
var cart_hash_key = wc_cart_fragments_params.ajax_url.toString() + '-wc_cart_hash';
var $supports_html5_storage = true,
cart_hash_key = wc_cart_fragments_params.cart_hash_key;
try {
$supports_html5_storage = ( 'sessionStorage' in window && window.sessionStorage !== null );

View File

@ -1 +1 @@
jQuery(function(e){function t(){o&&sessionStorage.setItem("wc_cart_created",(new Date).getTime())}function n(e){o&&(localStorage.setItem(a,e),sessionStorage.setItem(a,e))}function r(){e.ajax(s)}if("undefined"==typeof wc_cart_fragments_params)return!1;var o,a=wc_cart_fragments_params.ajax_url.toString()+"-wc_cart_hash";try{o="sessionStorage"in window&&null!==window.sessionStorage,window.sessionStorage.setItem("wc","test"),window.sessionStorage.removeItem("wc"),window.localStorage.setItem("wc","test"),window.localStorage.removeItem("wc")}catch(w){o=!1}var s={url:wc_cart_fragments_params.wc_ajax_url.toString().replace("%%endpoint%%","get_refreshed_fragments"),type:"POST",success:function(r){r&&r.fragments&&(e.each(r.fragments,function(t,n){e(t).replaceWith(n)}),o&&(sessionStorage.setItem(wc_cart_fragments_params.fragment_name,JSON.stringify(r.fragments)),n(r.cart_hash),r.cart_hash&&t()),e(document.body).trigger("wc_fragments_refreshed"))}};if(o){var i=null;e(document.body).on("wc_fragment_refresh updated_wc_div",function(){r()}),e(document.body).on("added_to_cart",function(e,r,o){var s=sessionStorage.getItem(a);null!==s&&s!==undefined&&""!==s||t(),sessionStorage.setItem(wc_cart_fragments_params.fragment_name,JSON.stringify(r)),n(o)}),e(document.body).on("wc_fragments_refreshed",function(){clearTimeout(i),i=setTimeout(r,864e5)}),e(window).on("storage onstorage",function(e){a===e.originalEvent.key&&localStorage.getItem(a)!==sessionStorage.getItem(a)&&r()}),e(window).on("pageshow",function(t){t.originalEvent.persisted&&(e(".widget_shopping_cart_content").empty(),e(document.body).trigger("wc_fragment_refresh"))});try{var c=e.parseJSON(sessionStorage.getItem(wc_cart_fragments_params.fragment_name)),_=sessionStorage.getItem(a),g=Cookies.get("woocommerce_cart_hash"),m=sessionStorage.getItem("wc_cart_created");if(null!==_&&_!==undefined&&""!==_||(_=""),null!==g&&g!==undefined&&""!==g||(g=""),_&&(null===m||m===undefined||""===m))throw"No cart_created";if(m){var d=1*m+864e5,f=(new Date).getTime();if(d<f)throw"Fragment expired";i=setTimeout(r,d-f)}if(!c||!c["div.widget_shopping_cart_content"]||_!==g)throw"No fragment";e.each(c,function(t,n){e(t).replaceWith(n)}),e(document.body).trigger("wc_fragments_loaded")}catch(w){r()}}else r();Cookies.get("woocommerce_items_in_cart")>0?e(".hide_cart_widget_if_empty").closest(".widget_shopping_cart").show():e(".hide_cart_widget_if_empty").closest(".widget_shopping_cart").hide(),e(document.body).on("adding_to_cart",function(){e(".hide_cart_widget_if_empty").closest(".widget_shopping_cart").show()})});
jQuery(function(e){function t(){o&&sessionStorage.setItem("wc_cart_created",(new Date).getTime())}function n(e){o&&(localStorage.setItem(a,e),sessionStorage.setItem(a,e))}function r(){e.ajax(s)}if("undefined"==typeof wc_cart_fragments_params)return!1;var o=!0,a=wc_cart_fragments_params.cart_hash_key;try{o="sessionStorage"in window&&null!==window.sessionStorage,window.sessionStorage.setItem("wc","test"),window.sessionStorage.removeItem("wc"),window.localStorage.setItem("wc","test"),window.localStorage.removeItem("wc")}catch(w){o=!1}var s={url:wc_cart_fragments_params.wc_ajax_url.toString().replace("%%endpoint%%","get_refreshed_fragments"),type:"POST",success:function(r){r&&r.fragments&&(e.each(r.fragments,function(t,n){e(t).replaceWith(n)}),o&&(sessionStorage.setItem(wc_cart_fragments_params.fragment_name,JSON.stringify(r.fragments)),n(r.cart_hash),r.cart_hash&&t()),e(document.body).trigger("wc_fragments_refreshed"))}};if(o){var i=null;e(document.body).on("wc_fragment_refresh updated_wc_div",function(){r()}),e(document.body).on("added_to_cart",function(e,r,o){var s=sessionStorage.getItem(a);null!==s&&s!==undefined&&""!==s||t(),sessionStorage.setItem(wc_cart_fragments_params.fragment_name,JSON.stringify(r)),n(o)}),e(document.body).on("wc_fragments_refreshed",function(){clearTimeout(i),i=setTimeout(r,864e5)}),e(window).on("storage onstorage",function(e){a===e.originalEvent.key&&localStorage.getItem(a)!==sessionStorage.getItem(a)&&r()}),e(window).on("pageshow",function(t){t.originalEvent.persisted&&(e(".widget_shopping_cart_content").empty(),e(document.body).trigger("wc_fragment_refresh"))});try{var c=e.parseJSON(sessionStorage.getItem(wc_cart_fragments_params.fragment_name)),_=sessionStorage.getItem(a),g=Cookies.get("woocommerce_cart_hash"),m=sessionStorage.getItem("wc_cart_created");if(null!==_&&_!==undefined&&""!==_||(_=""),null!==g&&g!==undefined&&""!==g||(g=""),_&&(null===m||m===undefined||""===m))throw"No cart_created";if(m){var d=1*m+864e5,f=(new Date).getTime();if(d<f)throw"Fragment expired";i=setTimeout(r,d-f)}if(!c||!c["div.widget_shopping_cart_content"]||_!==g)throw"No fragment";e.each(c,function(t,n){e(t).replaceWith(n)}),e(document.body).trigger("wc_fragments_loaded")}catch(w){r()}}else r();Cookies.get("woocommerce_items_in_cart")>0?e(".hide_cart_widget_if_empty").closest(".widget_shopping_cart").show():e(".hide_cart_widget_if_empty").closest(".widget_shopping_cart").hide(),e(document.body).on("adding_to_cart",function(){e(".hide_cart_widget_if_empty").closest(".widget_shopping_cart").show()})});

View File

@ -1503,9 +1503,7 @@ class WC_Admin_Setup_Wizard {
$this->install_plugin( $gateway_id, $gateway );
}
$settings_key = 'woocommerce_' . $gateway_id . '_settings';
$settings = array_filter( (array) get_option( $settings_key, array() ) );
$settings['enabled'] = ! empty( $_POST[ 'wc-wizard-service-' . $gateway_id . '-enabled' ] ) ? 'yes' : 'no'; // WPCS: CSRF ok, input var ok.
$settings = array( 'enabled' => ! empty( $_POST[ 'wc-wizard-service-' . $gateway_id . '-enabled' ] ) ? 'yes' : 'no' ); // WPCS: CSRF ok, input var ok.
// @codingStandardsIgnoreStart
if ( ! empty( $gateway['settings'] ) ) {
@ -1517,7 +1515,13 @@ class WC_Admin_Setup_Wizard {
}
// @codingStandardsIgnoreSEnd
update_option( $settings_key, $settings );
if ( 'ppec_paypal' === $gateway_id && empty( $settings['reroute_requests'] ) ) {
unset( $settings['enabled'] );
}
$settings_key = 'woocommerce_' . $gateway_id . '_settings';
$previously_saved_settings = array_filter( (array) get_option( $settings_key, array() ) );
update_option( $settings_key, array_merge( $previously_saved_settings, $settings ) );
}
wp_redirect( esc_url_raw( $this->get_next_step_link() ) );

View File

@ -516,6 +516,7 @@ class WC_Frontend_Scripts {
$params = array(
'ajax_url' => WC()->ajax_url(),
'wc_ajax_url' => WC_AJAX::get_endpoint( "%%endpoint%%" ),
'cart_hash_key' => apply_filters( 'woocommerce_cart_hash_key', 'wc_cart_hash_' . md5( get_current_blog_id() . '_' . get_site_url( get_current_blog_id(), '/' ) ) ),
'fragment_name' => apply_filters( 'woocommerce_cart_fragment_name', 'wc_fragments_' . md5( get_current_blog_id() . '_' . get_site_url( get_current_blog_id(), '/' ) ) ),
);
break;

View File

@ -279,6 +279,7 @@ class WC_Post_types {
'new_item' => __( 'New product', 'woocommerce' ),
'view' => __( 'View product', 'woocommerce' ),
'view_item' => __( 'View product', 'woocommerce' ),
'view_items' => __( 'View products', 'woocommerce' ),
'search_items' => __( 'Search products', 'woocommerce' ),
'not_found' => __( 'No products found', 'woocommerce' ),
'not_found_in_trash' => __( 'No products found in trash', 'woocommerce' ),

View File

@ -47,7 +47,7 @@ class WC_Product_Download implements ArrayAccess {
*/
public function get_type_of_file_path( $file_path = '' ) {
$file_path = $file_path ? $file_path : $this->get_file();
if ( 0 === strpos( $file_path, 'http' ) ) {
if ( 0 === strpos( $file_path, 'http' ) || 0 === strpos( $file_path, '//' ) ) {
return 'absolute';
} elseif ( '[' === substr( $file_path, 0, 1 ) && ']' === substr( $file_path, -1 ) ) {
return 'shortcode';