From eb8c37844b8a834eee4027a5d2463e967cdd8b0d Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Wed, 6 Mar 2013 11:59:24 +0000 Subject: [PATCH] Update tweaks for coen --- classes/class-wc-session-handler.php | 2 +- woocommerce.php | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/classes/class-wc-session-handler.php b/classes/class-wc-session-handler.php index bb5d51e781c..303acde310a 100644 --- a/classes/class-wc-session-handler.php +++ b/classes/class-wc-session-handler.php @@ -98,7 +98,7 @@ class WC_Session_Handler extends WC_Session { * @return mixed */ private function get_session_cookie() { - if ( ! isset( $_COOKIE[ $this->_cookie ] ) ) + if ( empty( $_COOKIE[ $this->_cookie ] ) ) return false; list( $customer_id, $session_expiration, $session_expiring, $cookie_hash ) = explode( '||', $_COOKIE[ $this->_cookie ] ); diff --git a/woocommerce.php b/woocommerce.php index 18c509b43ea..b022fb9c818 100644 --- a/woocommerce.php +++ b/woocommerce.php @@ -132,9 +132,8 @@ class Woocommerce { // Installation register_activation_hook( __FILE__, array( $this, 'activate' ) ); - // Upgrades - if ( is_admin() && ( get_option( 'woocommerce_version' ) != $this->version || get_option( 'woocommerce_db_version' ) != $this->version ) ) - add_action( 'admin_init', array( $this, 'install' ), 1 ); + // Updates + add_action( 'admin_init', array( $this, 'update' ), 5 ); // Include required files $this->includes(); @@ -241,6 +240,16 @@ class Woocommerce { $this->install(); } + /** + * update function. + * + * @access public + * @return void + */ + public function update() { + if ( ! defined( 'IFRAME_REQUEST' ) && ( get_option( 'woocommerce_version' ) != $this->version || get_option( 'woocommerce_db_version' ) != $this->version ) ) + $this->install(); + } /** * upgrade function.