Changeset 1948140
- Timestamp:
- 09/27/2018 04:08:56 PM (8 years ago)
- Location:
- woo-cart-expiration
- Files:
-
- 26 added
- 3 edited
-
tags/0.2.0 (added)
-
tags/0.2.0/CHANGELOG.md (added)
-
tags/0.2.0/LICENSE (added)
-
tags/0.2.0/assets (added)
-
tags/0.2.0/assets/css (added)
-
tags/0.2.0/assets/css/woo-cart-expiration-front.css (added)
-
tags/0.2.0/assets/css/woo-cart-expiration-front.min.css (added)
-
tags/0.2.0/assets/js (added)
-
tags/0.2.0/assets/js/woo-cart-expiration-front.js (added)
-
tags/0.2.0/assets/js/woo-cart-expiration-front.min.js (added)
-
tags/0.2.0/includes (added)
-
tags/0.2.0/includes/activate.php (added)
-
tags/0.2.0/includes/ajax-actions.php (added)
-
tags/0.2.0/includes/cart-actions.php (added)
-
tags/0.2.0/includes/cookies.php (added)
-
tags/0.2.0/includes/deactivate.php (added)
-
tags/0.2.0/includes/display.php (added)
-
tags/0.2.0/includes/markup.php (added)
-
tags/0.2.0/includes/settings-tab.php (added)
-
tags/0.2.0/includes/uninstall.php (added)
-
tags/0.2.0/includes/utilities.php (added)
-
tags/0.2.0/index.php (added)
-
tags/0.2.0/languages (added)
-
tags/0.2.0/languages/woo-cart-expiration.pot (added)
-
tags/0.2.0/readme.txt (added)
-
tags/0.2.0/woo-cart-expiration.php (added)
-
trunk/includes/cookies.php (modified) (4 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/woo-cart-expiration.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
woo-cart-expiration/trunk/includes/cookies.php
r1939994 r1948140 23 23 function build_cookie_args( $timer_expire = 0, $cart_key = '' ) { 24 24 25 // Now create a JSON encoded array so we can check stuff later.26 $setup = a rray( 'expire' => absint( $timer_expire ), 'cart' =>$cart_key );25 // Smash together the two pieces with a delimiter. 26 $setup = absint( $timer_expire ) . '|' . sanitize_key( $cart_key ); 27 27 28 28 // Return the base64 string. 29 return base64_encode( maybe_serialize( $setup ));29 return base64_encode( $setup ); 30 30 } 31 31 … … 105 105 } 106 106 107 // Decode and unserialize the cookie.108 $ cookie = maybe_unserialize( base64_decode( $_COOKIE[ Core\COOKIE_NAME ] ));107 // First decode our cookie value. 108 $decode = base64_decode( $_COOKIE[ Core\COOKIE_NAME ] ); 109 109 110 // Bail without a set of data or an expire time. 111 if ( ! $cookie || empty( $cookie['expire'] ) ) { 110 // Bail if we have no resulting value or it isn't serialized. 111 if ( empty( $decode ) ) { 112 return; 113 } 114 115 // Convert back to an array. 116 $pieces = explode( '|', $decode ); 117 118 // Make sure it worked and that each one exists before moving. 119 if ( empty( $pieces ) || ! is_array( $pieces ) || empty( $pieces[0] ) || empty( $pieces[1] ) ) { 112 120 return false; 113 121 } … … 115 123 // If we requested the data, send it. 116 124 if ( $data ) { 117 return $cookie;125 return array( 'expire' => absint( $pieces[0] ), 'cart' => sanitize_key( $pieces[1] ) ); 118 126 } 119 127 … … 122 130 123 131 // Return true / false for expired. 124 return absint( $ cookie['expire'] ) >= absint( $current_time ) ? true : false;132 return absint( $pieces[0] ) >= absint( $current_time ) ? true : false; 125 133 } -
woo-cart-expiration/trunk/readme.txt
r1939994 r1948140 4 4 Requires at least: 4.8 5 5 Tested up to: 4.9.8 6 Stable tag: 0. 1.06 Stable tag: 0.2.0 7 7 License: MIT 8 8 License URI: https://opensource.org/licenses/MIT … … 42 42 == Changelog == 43 43 44 = 0.1.0 = 44 = 0.2.0 09/27/2018 = 45 * Updating storage and retrieval methods for cookies. 46 47 = 0.1.0 09/25/2018 = 45 48 * Initial release 46 49 -
woo-cart-expiration/trunk/woo-cart-expiration.php
r1939994 r1948140 4 4 * Plugin URI: https://github.com/liquidweb/woo-cart-expiration 5 5 * Description: Set a time limit on a customer checking out. 6 * Version: 0. 1.06 * Version: 0.2.0 7 7 * Author: Liquid Web 8 8 * Author URI: https://www.liquidweb.com … … 23 23 24 24 // Define our plugin version. 25 define( __NAMESPACE__ . '\VERS', '0. 1.0' );25 define( __NAMESPACE__ . '\VERS', '0.2.0' ); 26 26 27 27 // Plugin root file.
Note: See TracChangeset
for help on using the changeset viewer.