Storefront Sticky Add to Cart - Version 1.1.7

Version Description

  • 27.10.2017 =
  • Tweak - Use wp_kses_post() for stock availability sanitization. Ensures compatibility with WooCommerce Waitlist extension.
  • Tweak - Check for form.cart before calling Waypoint.
Download this release

Release Info

Developer jameskoster
Plugin Icon 128x128 Storefront Sticky Add to Cart
Version 1.1.7
Comparing to
See all releases

Code changes from version 1.1.6 to 1.1.7

assets/js/waypoints.init.js CHANGED
@@ -1,18 +1,18 @@
1
- jQuery(document).ready(function($){
 
 
 
 
 
 
 
 
2
 
3
- var waypoint = new Waypoint({
4
- element: jQuery( 'form.cart' ),
5
- handler: function( direction ) {
6
- if ( 'up' == direction ) {
7
- jQuery( '.ssatc-sticky-add-to-cart' ).addClass( 'slideOutUp' );
8
- jQuery( '.ssatc-sticky-add-to-cart' ).removeClass( 'slideInDown' );
9
  }
10
-
11
- if ( 'down' == direction ) {
12
- jQuery( '.ssatc-sticky-add-to-cart' ).addClass( 'slideInDown' );
13
- jQuery( '.ssatc-sticky-add-to-cart' ).removeClass( 'slideOutUp' );
14
- }
15
- }
16
- });
17
-
18
  });
1
+ jQuery(document).ready(function(){
2
+ if ( jQuery( 'form.cart' ).length > 0 ) {
3
+ waypoint = new Waypoint({
4
+ element: jQuery( 'form.cart' ),
5
+ handler: function( direction ) {
6
+ if ( 'up' === direction ) {
7
+ jQuery( '.ssatc-sticky-add-to-cart' ).addClass( 'slideOutUp' );
8
+ jQuery( '.ssatc-sticky-add-to-cart' ).removeClass( 'slideInDown' );
9
+ }
10
 
11
+ if ( 'down' === direction ) {
12
+ jQuery( '.ssatc-sticky-add-to-cart' ).addClass( 'slideInDown' );
13
+ jQuery( '.ssatc-sticky-add-to-cart' ).removeClass( 'slideOutUp' );
14
+ }
 
 
15
  }
16
+ });
17
+ }
 
 
 
 
 
 
18
  });
assets/js/waypoints.init.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(document).ready(function($){var s=new Waypoint({element:jQuery("form.cart"),handler:function(s){"up"==s&&(jQuery(".ssatc-sticky-add-to-cart").addClass("slideOutUp"),jQuery(".ssatc-sticky-add-to-cart").removeClass("slideInDown")),"down"==s&&(jQuery(".ssatc-sticky-add-to-cart").addClass("slideInDown"),jQuery(".ssatc-sticky-add-to-cart").removeClass("slideOutUp"))}})});
1
+ jQuery(document).ready(function(){jQuery("form.cart").length>0&&(waypoint=new Waypoint({element:jQuery("form.cart"),handler:function(t){"up"===t&&(jQuery(".ssatc-sticky-add-to-cart").addClass("slideOutUp"),jQuery(".ssatc-sticky-add-to-cart").removeClass("slideInDown")),"down"===t&&(jQuery(".ssatc-sticky-add-to-cart").addClass("slideInDown"),jQuery(".ssatc-sticky-add-to-cart").removeClass("slideOutUp"))}}))});
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: jameskoster, woothemes
3
  Tags: woocommerce, ecommerce, storefront, sticky
4
  Requires at least: 4.0
5
- Tested up to: 4.7.3
6
- Stable tag: 1.1.6
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -39,6 +39,10 @@ It simply takes up too much valuable screen real estate. You can display it on m
39
 
40
  == Changelog ==
41
 
 
 
 
 
42
  = 1.1.6 - 15.06.2017 =
43
  * Tweak - WooCommerce 2.6/2.7 compatibility.
44
 
2
  Contributors: jameskoster, woothemes
3
  Tags: woocommerce, ecommerce, storefront, sticky
4
  Requires at least: 4.0
5
+ Tested up to: 4.8.2
6
+ Stable tag: 1.1.7
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
39
 
40
  == Changelog ==
41
 
42
+ = 1.1.7 - 27.10.2017 =
43
+ * Tweak - Use wp_kses_post() for stock availability sanitization. Ensures compatibility with WooCommerce Waitlist extension.
44
+ * Tweak - Check for `form.cart` before calling Waypoint.
45
+
46
  = 1.1.6 - 15.06.2017 =
47
  * Tweak - WooCommerce 2.6/2.7 compatibility.
48
 
storefront-sticky-add-to-cart.php CHANGED
@@ -3,11 +3,11 @@
3
  * Plugin Name: Storefront Sticky Add to Cart
4
  * Plugin URI: https://wordpress.org/plugins/storefront-sticky-add-to-cart/
5
  * Description: Adds a sticky add-to-cart bar in single product pages that is revealed as the user scrolls down the page.
6
- * Version: 1.1.6
7
  * Author: WooThemes
8
  * Author URI: http://woothemes.com/
9
  * Requires at least: 4.0.0
10
- * Tested up to: 4.7.3
11
  *
12
  * Text Domain: storefront-sticky-add-to-cart
13
  * Domain Path: /languages/
@@ -90,7 +90,7 @@ final class Storefront_Sticky_Add_to_Cart {
90
  $this->token = 'storefront-sticky-add-to-cart';
91
  $this->plugin_url = plugin_dir_url( __FILE__ );
92
  $this->plugin_path = plugin_dir_path( __FILE__ );
93
- $this->version = '1.1.6';
94
 
95
  register_activation_hook( __FILE__, array( $this, 'install' ) );
96
 
@@ -277,7 +277,7 @@ final class Storefront_Sticky_Add_to_Cart {
277
  if ( is_product() ) {
278
  $availability = $product->get_availability();
279
  $ssatc = new Storefront_Sticky_Add_to_Cart();
280
- $availability_html = empty( $availability['availability'] ) ? '' : '<span class="stock ' . esc_attr( $availability['class'] ) . '">' . esc_html( $availability['availability'] ) . '</span>';
281
 
282
  // And if the product isn't variable or grouped.
283
  wp_enqueue_script( 'waypoints' );
3
  * Plugin Name: Storefront Sticky Add to Cart
4
  * Plugin URI: https://wordpress.org/plugins/storefront-sticky-add-to-cart/
5
  * Description: Adds a sticky add-to-cart bar in single product pages that is revealed as the user scrolls down the page.
6
+ * Version: 1.1.7
7
  * Author: WooThemes
8
  * Author URI: http://woothemes.com/
9
  * Requires at least: 4.0.0
10
+ * Tested up to: 4.8.2
11
  *
12
  * Text Domain: storefront-sticky-add-to-cart
13
  * Domain Path: /languages/
90
  $this->token = 'storefront-sticky-add-to-cart';
91
  $this->plugin_url = plugin_dir_url( __FILE__ );
92
  $this->plugin_path = plugin_dir_path( __FILE__ );
93
+ $this->version = '1.1.7';
94
 
95
  register_activation_hook( __FILE__, array( $this, 'install' ) );
96
 
277
  if ( is_product() ) {
278
  $availability = $product->get_availability();
279
  $ssatc = new Storefront_Sticky_Add_to_Cart();
280
+ $availability_html = empty( $availability['availability'] ) ? '' : '<span class="stock ' . esc_attr( $availability['class'] ) . '">' . wp_kses_post( $availability['availability'] ) . '</span>';
281
 
282
  // And if the product isn't variable or grouped.
283
  wp_enqueue_script( 'waypoints' );