init class

This commit is contained in:
Mike Jolley 2012-05-01 10:19:56 +01:00
parent 0103e14f9b
commit 3bfb91ca0c
1 changed files with 23 additions and 5 deletions

View File

@ -39,11 +39,7 @@ class WC_ShareYourCart extends WC_Integration {
if ( $this->enabled == 'yes' ) {
add_action( 'wp_enqueue_scripts', array(&$this, 'styles') );
// Share your cart api class
include_once('class-shareyourcart-woocommerce.php');
// Init the class
$this->shareYourCartWooCommerce = new ShareYourCartWooCommerce( $this->settings );
$this->init_share_your_cart();
}
}
@ -57,6 +53,24 @@ class WC_ShareYourCart extends WC_Integration {
wp_enqueue_style( 'shareyourcart', plugins_url( 'css/style.css', __FILE__ ) );
}
/**
* init_share_your_cart function.
*
* @access public
* @return void
*/
function init_share_your_cart() {
if ( ! $this->shareYourCartWooCommerce ) {
// Share your cart api class
include_once('class-shareyourcart-woocommerce.php');
// Init the class
$this->shareYourCartWooCommerce = new ShareYourCartWooCommerce( $this->settings );
}
}
/**
* process_forms function.
*
@ -66,6 +80,8 @@ class WC_ShareYourCart extends WC_Integration {
if ( ! empty( $_REQUEST['syc-account'] ) && $_REQUEST['syc-account'] == 'create' ) {
$this->init_share_your_cart();
$error = $message = '';
$redirect = remove_query_arg( 'saved' );
@ -106,6 +122,8 @@ class WC_ShareYourCart extends WC_Integration {
} elseif ( ! empty( $_REQUEST['syc-account'] ) && $_REQUEST['syc-account'] == 'recover' ) {
$this->init_share_your_cart();
$error = $message = '';
$redirect = remove_query_arg( 'saved' );