Converted Indentations to tabs

This commit is contained in:
Shiva Poudel 2014-09-15 01:29:56 +05:45
parent f829e53a96
commit a4f6b0f9f9
1 changed files with 70 additions and 70 deletions

View File

@ -128,7 +128,7 @@ class WC_Cart {
*/
public function init() {
$this->get_cart_from_session();
add_action( 'woocommerce_check_cart_items', array( $this, 'check_cart_items' ), 1 );
add_action( 'woocommerce_check_cart_items', array( $this, 'check_cart_coupons' ), 1 );
add_action( 'woocommerce_after_checkout_validation', array( $this, 'check_customer_coupons' ), 1 );
@ -136,7 +136,7 @@ class WC_Cart {
/**
* Will set cart cookies if needed, once, during WP hook
*
*
* @access public
* @return void
*/
@ -168,7 +168,7 @@ class WC_Cart {
do_action( 'woocommerce_set_cart_cookies', $set );
}
/*-----------------------------------------------------------------------------------*/
/*-----------------------------------------------------------------------------------*/
/* Cart Session Handling */
/*-----------------------------------------------------------------------------------*/
@ -279,7 +279,7 @@ class WC_Cart {
do_action( 'woocommerce_cart_emptied' );
}
/*-----------------------------------------------------------------------------------*/
/*-----------------------------------------------------------------------------------*/
/* Persistent cart handling */
/*-----------------------------------------------------------------------------------*/
@ -305,7 +305,7 @@ class WC_Cart {
delete_user_meta( get_current_user_id(), '_woocommerce_persistent_cart' );
}
/*-----------------------------------------------------------------------------------*/
/*-----------------------------------------------------------------------------------*/
/* Cart Data Functions */
/*-----------------------------------------------------------------------------------*/
@ -398,7 +398,7 @@ class WC_Cart {
/**
* Looks through cart items and checks the posts are not trashed or deleted.
*
*
* @return bool|WP_Error
*/
public function check_cart_item_validity() {
@ -522,15 +522,15 @@ class WC_Cart {
$taxonomy = wc_attribute_taxonomy_name( str_replace( 'attribute_pa_', '', urldecode( $name ) ) );
// If this is a term slug, get the term's nice name
if ( taxonomy_exists( $taxonomy ) ) {
$term = get_term_by( 'slug', $value, $taxonomy );
if ( ! is_wp_error( $term ) && $term && $term->name ) {
$value = $term->name;
}
$label = wc_attribute_label( $taxonomy );
if ( taxonomy_exists( $taxonomy ) ) {
$term = get_term_by( 'slug', $value, $taxonomy );
if ( ! is_wp_error( $term ) && $term && $term->name ) {
$value = $term->name;
}
$label = wc_attribute_label( $taxonomy );
// If this is a custom option slug, get the options name
} else {
// If this is a custom option slug, get the options name
} else {
$value = apply_filters( 'woocommerce_variation_option_name', $value );
$product_attributes = $cart_item['data']->get_attributes();
if ( isset( $product_attributes[ str_replace( 'attribute_', '', $name ) ] ) ) {
@ -707,7 +707,7 @@ class WC_Cart {
$tax_totals[ $code ]->amount = 0;
}
$tax_totals[ $code ]->tax_rate_id = $key;
$tax_totals[ $code ]->tax_rate_id = $key;
$tax_totals[ $code ]->is_compound = $this->tax->is_compound( $key );
$tax_totals[ $code ]->label = $this->tax->get_rate_label( $key );
$tax_totals[ $code ]->amount += wc_round_tax_total( $tax );
@ -723,60 +723,60 @@ class WC_Cart {
/*-----------------------------------------------------------------------------------*/
/**
* Check if product is in the cart and return cart item key.
*
* Cart item key will be unique based on the item and its properties, such as variations.
*
* @param mixed id of product to find in the cart
* @return string cart item key
*/
public function find_product_in_cart( $cart_id = false ) {
if ( $cart_id !== false ) {
if ( is_array( $this->cart_contents ) ) {
foreach ( $this->cart_contents as $cart_item_key => $cart_item ) {
if ( $cart_item_key == $cart_id ) {
return $cart_item_key;
}
}
}
}
* Check if product is in the cart and return cart item key.
*
* Cart item key will be unique based on the item and its properties, such as variations.
*
* @param mixed id of product to find in the cart
* @return string cart item key
*/
public function find_product_in_cart( $cart_id = false ) {
if ( $cart_id !== false ) {
if ( is_array( $this->cart_contents ) ) {
foreach ( $this->cart_contents as $cart_item_key => $cart_item ) {
if ( $cart_item_key == $cart_id ) {
return $cart_item_key;
}
}
}
}
return '';
}
/**
* Generate a unique ID for the cart item being added.
*
* @param int $product_id - id of the product the key is being generated for
* @param int $variation_id of the product the key is being generated for
* @param array $variation data for the cart item
* @param array $cart_item_data other cart item data passed which affects this items uniqueness in the cart
* @return string cart item key
*/
public function generate_cart_id( $product_id, $variation_id = 0, $variation = array(), $cart_item_data = array() ) {
$id_parts = array( $product_id );
* Generate a unique ID for the cart item being added.
*
* @param int $product_id - id of the product the key is being generated for
* @param int $variation_id of the product the key is being generated for
* @param array $variation data for the cart item
* @param array $cart_item_data other cart item data passed which affects this items uniqueness in the cart
* @return string cart item key
*/
public function generate_cart_id( $product_id, $variation_id = 0, $variation = array(), $cart_item_data = array() ) {
$id_parts = array( $product_id );
if ( $variation_id && 0 != $variation_id )
$id_parts[] = $variation_id;
if ( $variation_id && 0 != $variation_id )
$id_parts[] = $variation_id;
if ( is_array( $variation ) && ! empty( $variation ) ) {
$variation_key = '';
foreach ( $variation as $key => $value ) {
$variation_key .= trim( $key ) . trim( $value );
}
$id_parts[] = $variation_key;
}
if ( is_array( $variation ) && ! empty( $variation ) ) {
$variation_key = '';
foreach ( $variation as $key => $value ) {
$variation_key .= trim( $key ) . trim( $value );
}
$id_parts[] = $variation_key;
}
if ( is_array( $cart_item_data ) && ! empty( $cart_item_data ) ) {
$cart_item_data_key = '';
foreach ( $cart_item_data as $key => $value ) {
if ( is_array( $value ) ) $value = http_build_query( $value );
$cart_item_data_key .= trim($key) . trim($value);
}
$id_parts[] = $cart_item_data_key;
}
if ( is_array( $cart_item_data ) && ! empty( $cart_item_data ) ) {
$cart_item_data_key = '';
foreach ( $cart_item_data as $key => $value ) {
if ( is_array( $value ) ) $value = http_build_query( $value );
$cart_item_data_key .= trim($key) . trim($value);
}
$id_parts[] = $cart_item_data_key;
}
return md5( implode( '_', $id_parts ) );
}
return md5( implode( '_', $id_parts ) );
}
/**
* Add a product to the cart.
@ -901,8 +901,8 @@ class WC_Cart {
}
if ( did_action( 'wp' ) ) {
$this->set_cart_cookies( sizeof( $this->cart_contents ) > 0 );
}
$this->set_cart_cookies( sizeof( $this->cart_contents ) > 0 );
}
do_action( 'woocommerce_add_to_cart', $cart_item_key, $product_id, $quantity, $variation_id, $variation, $cart_item_data );
@ -932,7 +932,7 @@ class WC_Cart {
}
}
/*-----------------------------------------------------------------------------------*/
/*-----------------------------------------------------------------------------------*/
/* Cart Calculation Functions */
/*-----------------------------------------------------------------------------------*/
@ -1152,7 +1152,7 @@ class WC_Cart {
// Tax rows - merge the totals we just got
foreach ( array_keys( $this->taxes + $discounted_taxes ) as $key ) {
$this->taxes[ $key ] = ( isset( $discounted_taxes[ $key ] ) ? $discounted_taxes[ $key ] : 0 ) + ( isset( $this->taxes[ $key ] ) ? $this->taxes[ $key ] : 0 );
$this->taxes[ $key ] = ( isset( $discounted_taxes[ $key ] ) ? $discounted_taxes[ $key ] : 0 ) + ( isset( $this->taxes[ $key ] ) ? $this->taxes[ $key ] : 0 );
}
/**
@ -1178,7 +1178,7 @@ class WC_Cart {
// Tax rows - merge the totals we just got
foreach ( array_keys( $this->taxes + $discounted_taxes ) as $key ) {
$this->taxes[ $key ] = ( isset( $discounted_taxes[ $key ] ) ? $discounted_taxes[ $key ] : 0 ) + ( isset( $this->taxes[ $key ] ) ? $this->taxes[ $key ] : 0 );
$this->taxes[ $key ] = ( isset( $discounted_taxes[ $key ] ) ? $discounted_taxes[ $key ] : 0 ) + ( isset( $this->taxes[ $key ] ) ? $this->taxes[ $key ] : 0 );
}
}
@ -1280,7 +1280,7 @@ class WC_Cart {
return apply_filters( 'woocommerce_cart_needs_payment', $this->total > 0, $this );
}
/*-----------------------------------------------------------------------------------*/
/*-----------------------------------------------------------------------------------*/
/* Shipping related functions */
/*-----------------------------------------------------------------------------------*/
@ -1449,7 +1449,7 @@ class WC_Cart {
return '';
}
/*-----------------------------------------------------------------------------------*/
/*-----------------------------------------------------------------------------------*/
/* Coupons/Discount related functions */
/*-----------------------------------------------------------------------------------*/
@ -1837,7 +1837,7 @@ class WC_Cart {
$this->coupon_applied_count[ $code ] += $count;
}
/*-----------------------------------------------------------------------------------*/
/*-----------------------------------------------------------------------------------*/
/* Fees API to add additional costs to orders */
/*-----------------------------------------------------------------------------------*/
@ -1919,7 +1919,7 @@ class WC_Cart {
}
}
/*-----------------------------------------------------------------------------------*/
/*-----------------------------------------------------------------------------------*/
/* Get Formatted Totals */
/*-----------------------------------------------------------------------------------*/