Merge pull request #1990 from warrendholmes/master

Scope on functions and remove var
This commit is contained in:
Coen Jacobs 2012-12-15 03:42:11 -08:00
commit cc08f08b2f
17 changed files with 590 additions and 590 deletions

View File

@ -13,67 +13,67 @@
class WC_Cart {
/** @var array Contains an array of cart items. */
var $cart_contents;
public $cart_contents;
/** @var array Contains an array of coupon codes applied to the cart. */
var $applied_coupons;
public $applied_coupons;
/** @var array Contains an array of coupon code discounts after they have been applied. */
var $coupon_discount_amounts;
public $coupon_discount_amounts;
/** @var float The total cost of the cart items. */
var $cart_contents_total;
public $cart_contents_total;
/** @var float The total weight of the cart items. */
var $cart_contents_weight;
public $cart_contents_weight;
/** @var float The total count of the cart items. */
var $cart_contents_count;
public $cart_contents_count;
/** @var float The total tax for the cart items. */
var $cart_contents_tax;
public $cart_contents_tax;
/** @var float Cart grand total. */
var $total;
public $total;
/** @var float Cart subtotal. */
var $subtotal;
public $subtotal;
/** @var float Cart subtotal without tax. */
var $subtotal_ex_tax;
public $subtotal_ex_tax;
/** @var float Total cart tax. */
var $tax_total;
public $tax_total;
/** @var array An array of taxes/tax rates for the cart. */
var $taxes;
public $taxes;
/** @var array An array of taxes/tax rates for the shipping. */
var $shipping_taxes;
public $shipping_taxes;
/** @var float Discounts before tax. */
var $discount_cart;
public $discount_cart;
/** @var float Discounts after tax. */
var $discount_total;
public $discount_total;
/** @var float Total for additonal fees. */
var $fee_total;
public $fee_total;
/** @var float Shipping cost. */
var $shipping_total;
public $shipping_total;
/** @var float Shipping tax. */
var $shipping_tax_total;
public $shipping_tax_total;
/** @var float Shipping title/label. */
var $shipping_label;
public $shipping_label;
/** @var WC_Tax */
var $tax;
public $tax;
/** @var array An array of fees. */
var $fees;
public $fees;
/**
* Constructor for the cart class. Loads options and hooks in the init method.
@ -81,7 +81,7 @@ class WC_Cart {
* @access public
* @return void
*/
function __construct() {
public function __construct() {
$this->tax = new WC_Tax();
$this->prices_include_tax = ( get_option( 'woocommerce_prices_include_tax' ) == 'yes' ) ? true : false;
$this->tax_display_cart = get_option( 'woocommerce_tax_display_cart' );
@ -100,7 +100,7 @@ class WC_Cart {
* @access public
* @return void
*/
function init() {
public function init() {
$this->get_cart_from_session();
add_action('woocommerce_check_cart_items', array( &$this, 'check_cart_items' ), 1 );
@ -118,7 +118,7 @@ class WC_Cart {
* @access public
* @return void
*/
function get_cart_from_session() {
public function get_cart_from_session() {
global $woocommerce;
// Load the coupons
@ -191,7 +191,7 @@ class WC_Cart {
* @access public
* @return void
*/
function set_session() {
public function set_session() {
global $woocommerce;
// Re-calc totals
@ -244,7 +244,7 @@ class WC_Cart {
* @param bool $clear_persistent_cart (default: true)
* @return void
*/
function empty_cart( $clear_persistent_cart = true ) {
public function empty_cart( $clear_persistent_cart = true ) {
global $woocommerce;
$this->cart_contents = array();
@ -268,7 +268,7 @@ class WC_Cart {
* @access public
* @return void
*/
function persistent_cart_update() {
public function persistent_cart_update() {
global $woocommerce;
update_user_meta( get_current_user_id(), '_woocommerce_persistent_cart', array(
@ -283,7 +283,7 @@ class WC_Cart {
* @access public
* @return void
*/
function persistent_cart_destroy() {
public function persistent_cart_destroy() {
delete_user_meta( get_current_user_id(), '_woocommerce_persistent_cart' );
}
@ -297,7 +297,7 @@ class WC_Cart {
* @access public
* @return int
*/
function get_cart_contents_count() {
public function get_cart_contents_count() {
return apply_filters( 'woocommerce_cart_contents_count', $this->cart_contents_count );
}
@ -308,7 +308,7 @@ class WC_Cart {
* @access public
* @return void
*/
function check_cart_items() {
public function check_cart_items() {
global $woocommerce;
// Check item stock
@ -325,7 +325,7 @@ class WC_Cart {
* @access public
* @return void
*/
function check_cart_coupons() {
public function check_cart_coupons() {
global $woocommerce;
if ( ! empty( $this->applied_coupons ) ) {
@ -352,7 +352,7 @@ class WC_Cart {
* @access public
* @return array
*/
function get_cart_item_quantities() {
public function get_cart_item_quantities() {
$quantities = array();
foreach ( $this->get_cart() as $cart_item_key => $values ) {
@ -391,7 +391,7 @@ class WC_Cart {
* @access public
* @param array $posted
*/
function check_customer_coupons( $posted ) {
public function check_customer_coupons( $posted ) {
global $woocommerce;
if ( ! empty( $this->applied_coupons ) ) {
@ -429,7 +429,7 @@ class WC_Cart {
* @access public
* @return bool
*/
function check_cart_item_stock() {
public function check_cart_item_stock() {
global $woocommerce, $wpdb;
$error = new WP_Error();
@ -540,7 +540,7 @@ class WC_Cart {
* @param bool $flat (default: false)
* @return string
*/
function get_item_data( $cart_item, $flat = false ) {
public function get_item_data( $cart_item, $flat = false ) {
global $woocommerce;
$return = '';
@ -622,7 +622,7 @@ class WC_Cart {
*
* @return array cross_sells (item ids)
*/
function get_cross_sells() {
public function get_cross_sells() {
$cross_sells = array();
$in_cart = array();
if ( sizeof( $this->cart_contents) > 0 ) {
@ -642,7 +642,7 @@ class WC_Cart {
*
* @return string url to page
*/
function get_cart_url() {
public function get_cart_url() {
$cart_page_id = woocommerce_get_page_id('cart');
if ( $cart_page_id ) return apply_filters( 'woocommerce_get_cart_url', get_permalink( $cart_page_id ) );
}
@ -652,7 +652,7 @@ class WC_Cart {
*
* @return string url to page
*/
function get_checkout_url() {
public function get_checkout_url() {
$checkout_page_id = woocommerce_get_page_id('checkout');
if ( $checkout_page_id ) {
if ( is_ssl() )
@ -667,7 +667,7 @@ class WC_Cart {
*
* @return string url to page
*/
function get_remove_url( $cart_item_key ) {
public function get_remove_url( $cart_item_key ) {
global $woocommerce;
$cart_page_id = woocommerce_get_page_id('cart');
if ($cart_page_id)
@ -679,7 +679,7 @@ class WC_Cart {
*
* @return array contents of the cart
*/
function get_cart() {
public function get_cart() {
return array_filter( (array) $this->cart_contents );
}
@ -688,7 +688,7 @@ class WC_Cart {
*
* @return array merged taxes
*/
function get_taxes() {
public function get_taxes() {
$merged_taxes = array();
// Merge
@ -704,7 +704,7 @@ class WC_Cart {
*
* @return array merged taxes
*/
function get_formatted_taxes() {
public function get_formatted_taxes() {
$taxes = $this->get_taxes();
@ -727,7 +727,7 @@ class WC_Cart {
* @param mixed id of product to find in the cart
* @return string cart item key
*/
function find_product_in_cart( $cart_id = false ) {
public function find_product_in_cart( $cart_id = false ) {
if ( $cart_id !== false )
foreach ( $this->cart_contents as $cart_item_key => $cart_item )
if ( $cart_item_key == $cart_id )
@ -743,7 +743,7 @@ class WC_Cart {
* @param array $cart_item_data other cart item data passed which affects this items uniqueness in the cart
* @return string cart item key
*/
function generate_cart_id( $product_id, $variation_id = '', $variation = '', $cart_item_data = array() ) {
public function generate_cart_id( $product_id, $variation_id = '', $variation = '', $cart_item_data = array() ) {
$id_parts = array( $product_id );
@ -779,7 +779,7 @@ class WC_Cart {
* @param array $cart_item_data extra cart item data we want to pass into the item
* @return bool
*/
function add_to_cart( $product_id, $quantity = 1, $variation_id = '', $variation = '', $cart_item_data = array() ) {
public function add_to_cart( $product_id, $quantity = 1, $variation_id = '', $variation = '', $cart_item_data = array() ) {
global $woocommerce;
if ( $quantity <= 0 ) return false;
@ -892,7 +892,7 @@ class WC_Cart {
* @param string cart_item_key contains the id of the cart item
* @param string quantity contains the quantity of the item
*/
function set_quantity( $cart_item_key, $quantity = 1 ) {
public function set_quantity( $cart_item_key, $quantity = 1 ) {
if ( $quantity == 0 || $quantity < 0 ) {
do_action( 'woocommerce_before_cart_item_quantity_zero', $cart_item_key );
@ -933,7 +933,7 @@ class WC_Cart {
* @param bool $add_totals (default: false)
* @return float price
*/
function get_discounted_price( $values, $price, $add_totals = false ) {
public function get_discounted_price( $values, $price, $add_totals = false ) {
if ( ! $price ) return $price;
@ -1096,7 +1096,7 @@ class WC_Cart {
* @param mixed $values
* @param mixed $price
*/
function apply_product_discounts_after_tax( $values, $price ) {
public function apply_product_discounts_after_tax( $values, $price ) {
if ( ! empty( $this->applied_coupons) ) {
foreach ( $this->applied_coupons as $code ) {
@ -1173,7 +1173,7 @@ class WC_Cart {
*
* @access public
*/
function apply_cart_discounts_after_tax() {
public function apply_cart_discounts_after_tax() {
if ( $this->applied_coupons ) {
foreach ( $this->applied_coupons as $code ) {
@ -1215,7 +1215,7 @@ class WC_Cart {
*
* @access public
*/
function calculate_totals() {
public function calculate_totals() {
global $woocommerce;
$this->reset();
@ -1524,7 +1524,7 @@ class WC_Cart {
*
* @return bool
*/
function needs_payment() {
public function needs_payment() {
$needs_payment = ( $this->total > 0 ) ? true : false;
return apply_filters( 'woocommerce_cart_needs_payment', $needs_payment, $this );
}
@ -1539,7 +1539,7 @@ class WC_Cart {
* @access public
* @return void
*/
function calculate_shipping() {
public function calculate_shipping() {
global $woocommerce;
if ( $this->needs_shipping() && $this->show_shipping() ) {
@ -1569,7 +1569,7 @@ class WC_Cart {
* @access public
* @return array of cart items
*/
function get_shipping_packages() {
public function get_shipping_packages() {
global $woocommerce;
// Packages array for storing 'carts'
@ -1595,7 +1595,7 @@ class WC_Cart {
*
* @return bool whether or not the cart needs shipping
*/
function needs_shipping() {
public function needs_shipping() {
if ( get_option('woocommerce_calc_shipping')=='no' ) return false;
if ( ! is_array( $this->cart_contents ) ) return false;
@ -1616,7 +1616,7 @@ class WC_Cart {
*
* @return bool
*/
function show_shipping() {
public function show_shipping() {
global $woocommerce;
if ( get_option('woocommerce_calc_shipping')=='no' ) return false;
@ -1639,7 +1639,7 @@ class WC_Cart {
*
* @return bool
*/
function ship_to_billing_address_only() {
public function ship_to_billing_address_only() {
if ( get_option('woocommerce_ship_to_billing_address_only') == 'yes' ) return true; else return false;
}
@ -1648,7 +1648,7 @@ class WC_Cart {
*
* @return mixed price or string for the shipping total
*/
function get_cart_shipping_total() {
public function get_cart_shipping_total() {
global $woocommerce;
if ( isset( $this->shipping_label ) ) {
@ -1688,7 +1688,7 @@ class WC_Cart {
*
* @return string shipping method title
*/
function get_cart_shipping_title() {
public function get_cart_shipping_title() {
if ( isset( $this->shipping_label ) ) {
return __( 'via', 'woocommerce' ) . ' ' . $this->shipping_label;
}
@ -1704,7 +1704,7 @@ class WC_Cart {
*
* @return bool
*/
function has_discount( $code ) {
public function has_discount( $code ) {
if ( in_array( $code, $this->applied_coupons ) ) return true;
return false;
}
@ -1715,7 +1715,7 @@ class WC_Cart {
* @param string $coupon_code - The code to apply
* @return bool True if the coupon is applied, false if it does not exist or cannot be applied
*/
function add_discount( $coupon_code ) {
public function add_discount( $coupon_code ) {
global $woocommerce;
// Coupons are globally disabled
@ -1777,7 +1777,7 @@ class WC_Cart {
*
* @return array of applied coupons
*/
function get_applied_coupons() {
public function get_applied_coupons() {
return (array) $this->applied_coupons;
}
@ -1786,7 +1786,7 @@ class WC_Cart {
*
* @params int type - 0 for all, 1 for before tax, 2 for after tax
*/
function remove_coupons( $type = 0 ) {
public function remove_coupons( $type = 0 ) {
global $woocommerce;
if ( 1 == $type ) {
@ -1827,7 +1827,7 @@ class WC_Cart {
* @param string $tax_class (default: '')
* @return void
*/
function add_fee( $name, $amount, $taxable = false, $tax_class = '' ) {
public function add_fee( $name, $amount, $taxable = false, $tax_class = '' ) {
if ( empty( $this->fees ) )
$this->fees = array();
@ -1849,7 +1849,7 @@ class WC_Cart {
* @access public
* @return void
*/
function get_fees() {
public function get_fees() {
return (array) $this->fees;
}
@ -1862,7 +1862,7 @@ class WC_Cart {
*
* @return float
*/
function get_order_discount_total() {
public function get_order_discount_total() {
return $this->discount_total;
}
@ -1871,7 +1871,7 @@ class WC_Cart {
*
* @return float
*/
function get_cart_discount_total() {
public function get_cart_discount_total() {
return $this->discount_cart;
}
@ -1880,7 +1880,7 @@ class WC_Cart {
*
* @return string formatted price
*/
function get_total() {
public function get_total() {
return apply_filters( 'woocommerce_cart_total', woocommerce_price( $this->total ) );
}
@ -1889,7 +1889,7 @@ class WC_Cart {
*
* @return string formatted price
*/
function get_total_ex_tax() {
public function get_total_ex_tax() {
$total = $this->total - $this->tax_total - $this->shipping_tax_total;
if ( $total < 0 ) $total = 0;
return apply_filters( 'woocommerce_cart_total_ex_tax', woocommerce_price( $total ) );
@ -1900,7 +1900,7 @@ class WC_Cart {
*
* @return string formatted price
*/
function get_cart_total() {
public function get_cart_total() {
if ( ! $this->prices_include_tax ) {
$cart_contents_total = woocommerce_price( $this->cart_contents_total );
} else {
@ -1916,7 +1916,7 @@ class WC_Cart {
* @params bool whether to include compound taxes
* @return string formatted price
*/
function get_cart_subtotal( $compound = false ) {
public function get_cart_subtotal( $compound = false ) {
global $woocommerce;
// If the cart has compound tax, we want to show the subtotal as
@ -1962,7 +1962,7 @@ class WC_Cart {
* @params int quantity
* @return string formatted price
*/
function get_product_subtotal( $_product, $quantity ) {
public function get_product_subtotal( $_product, $quantity ) {
global $woocommerce;
$price = $_product->get_price();
@ -2007,7 +2007,7 @@ class WC_Cart {
*
* @return string formatted price
*/
function get_cart_tax() {
public function get_cart_tax() {
$return = false;
$cart_total_tax = $this->tax_total + $this->shipping_tax_total;
if ( $cart_total_tax > 0 ) $return = woocommerce_price( $cart_total_tax );
@ -2019,7 +2019,7 @@ class WC_Cart {
*
* @return float price
*/
function get_taxes_total( $compound = true ) {
public function get_taxes_total( $compound = true ) {
$total = 0;
foreach ( $this->taxes as $key => $tax ) {
if ( ! $compound && $this->tax->is_compound( $key ) ) continue;
@ -2037,7 +2037,7 @@ class WC_Cart {
*
* @return mixed formatted price or false if there are none
*/
function get_discounts_before_tax() {
public function get_discounts_before_tax() {
if ( $this->discount_cart ) {
$discounts_before_tax = woocommerce_price( $this->discount_cart );
} else {
@ -2051,7 +2051,7 @@ class WC_Cart {
*
* @return mixed formatted price or false if there are none
*/
function get_discounts_after_tax() {
public function get_discounts_after_tax() {
if ( $this->discount_total ) {
$discounts_after_tax = woocommerce_price( $this->discount_total );
} else {
@ -2065,7 +2065,7 @@ class WC_Cart {
*
* @return mixed formatted price or false if there are none
*/
function get_total_discount() {
public function get_total_discount() {
if ( $this->discount_total || $this->discount_cart ) {
$total_discount = woocommerce_price( $this->discount_total + $this->discount_cart );
} else {

View File

@ -12,19 +12,19 @@
class WC_Checkout {
/** @var array Array of posted form data. */
var $posted;
public $posted;
/** @var array Array of fields to display on the checkout. */
var $checkout_fields;
public $checkout_fields;
/** @var bool Whether or not the user must create an account to checkout. */
var $must_create_account;
public $must_create_account;
/** @var bool Whether or not signups are allowed. */
var $enable_signup;
public $enable_signup;
/** @var bool True when the user is creating an account. */
var $creating_account;
public $creating_account;
/**
* Constructor for the checkout class. Hooks in methods and defines eheckout fields.
@ -32,7 +32,7 @@ class WC_Checkout {
* @access public
* @return void
*/
function __construct () {
public function __construct () {
global $woocommerce;
add_action( 'woocommerce_checkout_process', array( &$this,'checkout_process' ) );
@ -93,7 +93,7 @@ class WC_Checkout {
* @access public
* @return void
*/
function checkout_process() {
public function checkout_process() {
// When we process the checkout, lets ensure cart items are rechecked to prevent checkout
do_action('woocommerce_check_cart_items');
}
@ -105,7 +105,7 @@ class WC_Checkout {
* @access public
* @return void
*/
function checkout_form_billing() {
public function checkout_form_billing() {
woocommerce_get_template( 'checkout/form-billing.php', array( 'checkout' => $this ) );
}
@ -116,7 +116,7 @@ class WC_Checkout {
* @access public
* @return void
*/
function checkout_form_shipping() {
public function checkout_form_shipping() {
woocommerce_get_template( 'checkout/form-shipping.php', array( 'checkout' => $this ) );
}
@ -127,7 +127,7 @@ class WC_Checkout {
* @access public
* @return void
*/
function create_order() {
public function create_order() {
global $woocommerce, $wpdb;
// Create Order (send cart variable so we can record items and reduce inventory). Only create if this is a new order, not if the payment was rejected last time.
@ -352,7 +352,7 @@ class WC_Checkout {
* @access public
* @return void
*/
function process_checkout() {
public function process_checkout() {
global $wpdb, $woocommerce;
$woocommerce->verify_nonce( 'process_checkout' );
@ -733,7 +733,7 @@ class WC_Checkout {
* @param string $input
* @return string
*/
function get_value( $input ) {
public function get_value( $input ) {
global $woocommerce;
if ( ! empty( $_POST[ $input ] ) ) {

View File

@ -12,16 +12,16 @@
class WC_Countries {
/** @var array Array of countries */
var $countries;
public $countries;
/** @var array Array of states */
var $states;
public $states;
/** @var array Array of locales */
var $locale;
public $locale;
/** @var array Array of address formats for locales */
var $address_formats;
public $address_formats;
/**
* Constructor for the counties class - defines all countries and states.
@ -29,7 +29,7 @@ class WC_Countries {
* @access public
* @return void
*/
function __construct() {
public function __construct() {
$this->countries = apply_filters('woocommerce_countries', array(
'AF' => __( 'Afghanistan', 'woocommerce' ),
@ -448,7 +448,7 @@ class WC_Countries {
* @access public
* @return string
*/
function get_base_country() {
public function get_base_country() {
$default = esc_attr( get_option('woocommerce_default_country') );
if ( ( $pos = strpos( $default, ':' ) ) === false )
return $default;
@ -462,7 +462,7 @@ class WC_Countries {
* @access public
* @return string
*/
function get_base_state() {
public function get_base_state() {
$default = esc_attr( get_option( 'woocommerce_default_country' ) );
if ( ( $pos = strrpos( $default, ':' ) ) === false )
return '';
@ -476,7 +476,7 @@ class WC_Countries {
* @access public
* @return array
*/
function get_allowed_countries() {
public function get_allowed_countries() {
asort( $this->countries );
@ -500,7 +500,7 @@ class WC_Countries {
* @access public
* @return array
*/
function get_allowed_country_states() {
public function get_allowed_country_states() {
if ( get_option('woocommerce_allowed_countries') !== 'specific' )
return $this->states;
@ -523,7 +523,7 @@ class WC_Countries {
* @access public
* @return array
*/
function get_european_union_countries() {
public function get_european_union_countries() {
return array('AT', 'BE', 'BG', 'CY', 'CZ', 'DE', 'DK', 'EE', 'ES', 'FI', 'FR', 'GB', 'GR', 'HU', 'IE', 'IT', 'LT', 'LU', 'LV', 'MT', 'NL', 'PL', 'PT', 'RO', 'SE', 'SI', 'SK');
}
@ -534,7 +534,7 @@ class WC_Countries {
* @access public
* @return string
*/
function shipping_to_prefix() {
public function shipping_to_prefix() {
global $woocommerce;
$return = '';
if (in_array($woocommerce->customer->get_shipping_country(), array( 'GB', 'US', 'AE', 'CZ', 'DO', 'NL', 'PH', 'USAF' ))) $return = __( 'to the', 'woocommerce' );
@ -549,7 +549,7 @@ class WC_Countries {
* @access public
* @return string
*/
function estimated_for_prefix() {
public function estimated_for_prefix() {
$return = '';
if (in_array($this->get_base_country(), array( 'GB', 'US', 'AE', 'CZ', 'DO', 'NL', 'PH', 'USAF' ))) $return = __( 'the', 'woocommerce' ) . ' ';
return apply_filters('woocommerce_countries_estimated_for_prefix', $return, $this->get_base_country());
@ -562,7 +562,7 @@ class WC_Countries {
* @access public
* @return string
*/
function tax_or_vat() {
public function tax_or_vat() {
$return = ( in_array($this->get_base_country(), $this->get_european_union_countries()) ) ? __( 'VAT', 'woocommerce' ) : __( 'Tax', 'woocommerce' );
return apply_filters( 'woocommerce_countries_tax_or_vat', $return );
@ -575,7 +575,7 @@ class WC_Countries {
* @access public
* @return string
*/
function inc_tax_or_vat() {
public function inc_tax_or_vat() {
$return = ( in_array($this->get_base_country(), $this->get_european_union_countries()) ) ? __( '(incl. VAT)', 'woocommerce' ) : __( '(incl. tax)', 'woocommerce' );
return apply_filters( 'woocommerce_countries_inc_tax_or_vat', $return );
@ -588,7 +588,7 @@ class WC_Countries {
* @access public
* @return string
*/
function ex_tax_or_vat() {
public function ex_tax_or_vat() {
$return = ( in_array($this->get_base_country(), $this->get_european_union_countries()) ) ? __( '(ex. VAT)', 'woocommerce' ) : __( '(ex. tax)', 'woocommerce' );
return apply_filters( 'woocommerce_countries_ex_tax_or_vat', $return );
@ -602,7 +602,7 @@ class WC_Countries {
* @param mixed $cc country code
* @return array of states
*/
function get_states( $cc ) {
public function get_states( $cc ) {
if (isset( $this->states[$cc] )) return $this->states[$cc];
}
@ -616,7 +616,7 @@ class WC_Countries {
* @param bool $escape (default: false)
* @return void
*/
function country_dropdown_options( $selected_country = '', $selected_state = '', $escape = false ) {
public function country_dropdown_options( $selected_country = '', $selected_state = '', $escape = false ) {
asort($this->countries);
@ -648,7 +648,7 @@ class WC_Countries {
* @param bool $escape (default: false)
* @return void
*/
function country_multiselect_options( $selected_countries = '', $escape = false ) {
public function country_multiselect_options( $selected_countries = '', $escape = false ) {
$countries = $this->get_allowed_countries();
@ -674,7 +674,7 @@ class WC_Countries {
* @access public
* @return array
*/
function get_address_formats() {
public function get_address_formats() {
if (!$this->address_formats) :
@ -724,7 +724,7 @@ class WC_Countries {
* @param array $args (default: array())
* @return string address
*/
function get_formatted_address( $args = array() ) {
public function get_formatted_address( $args = array() ) {
$args = array_map( 'trim', $args );
@ -792,7 +792,7 @@ class WC_Countries {
* @access public
* @return array
*/
function get_country_locale() {
public function get_country_locale() {
if ( ! $this->locale ) {
// Locale information used by the checkout
@ -1062,7 +1062,7 @@ class WC_Countries {
}
/** Apply locale and get address fields */
function get_address_fields( $country, $type = 'billing_' ) {
public function get_address_fields( $country, $type = 'billing_' ) {
$locale = $this->get_country_locale();
$fields = array(

View File

@ -11,59 +11,59 @@
*/
class WC_Coupon {
/** @var string Coupon code. */
var $code;
/** @public string Coupon code. */
public $code;
/** @var int Coupon ID. */
var $id;
/** @public int Coupon ID. */
public $id;
/** @var string Type of discount. */
var $type;
/** @public string Type of discount. */
public $type;
/** @var string Type of discount (alias). */
var $discount_type;
/** @public string Type of discount (alias). */
public $discount_type;
/** @var string Coupon amount. */
var $amount;
/** @public string Coupon amount. */
public $amount;
/** @var string "Yes" if for individual use. */
var $individual_use;
/** @public string "Yes" if for individual use. */
public $individual_use;
/** @var array Array of product IDs. */
var $product_ids;
/** @public array Array of product IDs. */
public $product_ids;
/** @var int Coupon usage limit. */
var $usage_limit;
/** @public int Coupon usage limit. */
public $usage_limit;
/** @var int Coupon usage count. */
var $usage_count;
/** @public int Coupon usage count. */
public $usage_count;
/** @var string Expirey date. */
var $expiry_date;
/** @public string Expirey date. */
public $expiry_date;
/** @var string "yes" if applied before tax. */
var $apply_before_tax;
/** @public string "yes" if applied before tax. */
public $apply_before_tax;
/** @var string "yes" if coupon grants free shipping. */
var $free_shipping;
/** @public string "yes" if coupon grants free shipping. */
public $free_shipping;
/** @var array Array of category ids. */
var $product_categories;
/** @public array Array of category ids. */
public $product_categories;
/** @var array Array of category ids. */
var $exclude_product_categories;
/** @public array Array of category ids. */
public $exclude_product_categories;
/** @var string Minimum cart amount. */
var $minimum_amount;
/** @public string Minimum cart amount. */
public $minimum_amount;
/** @var string Coupon owner's email. */
var $customer_email;
/** @public string Coupon owner's email. */
public $customer_email;
/** @var array Post meta. */
var $coupon_custom_fields;
/** @public array Post meta. */
public $coupon_custom_fields;
/** @var string How much the coupon is worth. */
var $coupon_amount;
/** @public string How much the coupon is worth. */
public $coupon_amount;
/**
* Coupon constructor. Loads coupon data.
@ -72,7 +72,7 @@ class WC_Coupon {
* @param mixed $code code of the coupon to load
* @return bool whether or not the coupon was found
*/
function __construct( $code ) {
public function __construct( $code ) {
global $wpdb;
$this->code = apply_filters( 'woocommerce_coupon_code', $code );
@ -162,7 +162,7 @@ class WC_Coupon {
* @access public
* @return bool
*/
function apply_before_tax() {
public function apply_before_tax() {
return $this->apply_before_tax == 'yes' ? true : false;
}
@ -173,7 +173,7 @@ class WC_Coupon {
* @access public
* @return void
*/
function enable_free_shipping() {
public function enable_free_shipping() {
return $this->free_shipping == 'yes' ? true : false;
}
@ -184,7 +184,7 @@ class WC_Coupon {
* @access public
* @return void
*/
function inc_usage_count() {
public function inc_usage_count() {
$this->usage_count++;
update_post_meta( $this->id, 'usage_count', $this->usage_count );
}
@ -196,7 +196,7 @@ class WC_Coupon {
* @access public
* @return void
*/
function dcr_usage_count() {
public function dcr_usage_count() {
$this->usage_count--;
update_post_meta( $this->id, 'usage_count', $this->usage_count );
}
@ -209,7 +209,7 @@ class WC_Coupon {
* @access public
* @return bool|WP_Error validity or a WP_Error if not valid
*/
function is_valid() {
public function is_valid() {
global $woocommerce;
if ( $this->id ) {

View File

@ -20,7 +20,7 @@ class WC_Customer {
* @access public
* @return void
*/
function __construct() {
public function __construct() {
global $woocommerce;
if ( empty( $woocommerce->session->customer ) ) {
@ -88,7 +88,7 @@ class WC_Customer {
* @access public
* @return void
*/
function save_data() {
public function save_data() {
global $woocommerce;
$woocommerce->session->customer = $this->_data;
}
@ -99,7 +99,7 @@ class WC_Customer {
* @access public
* @return bool
*/
function has_calculated_shipping() {
public function has_calculated_shipping() {
return ( ! empty( $this->_data['calculated_shipping'] ) && $this->_data['calculated_shipping'] ) ? true : false;
}
@ -110,7 +110,7 @@ class WC_Customer {
* @access public
* @return void
*/
function set_to_base() {
public function set_to_base() {
global $woocommerce;
$default = apply_filters( 'woocommerce_customer_default_location', get_option('woocommerce_default_country') );
if ( strstr( $default, ':' ) ) {
@ -132,7 +132,7 @@ class WC_Customer {
* @access public
* @return void
*/
function set_shipping_to_base() {
public function set_shipping_to_base() {
global $woocommerce;
$default = get_option('woocommerce_default_country');
if ( strstr( $default, ':' ) ) {
@ -154,7 +154,7 @@ class WC_Customer {
* @access public
* @return bool
*/
function is_customer_outside_base() {
public function is_customer_outside_base() {
list( $country, $state, $postcode, $city ) = $this->get_taxable_address();
if ( $country ) {
@ -182,7 +182,7 @@ class WC_Customer {
* @access public
* @return bool
*/
function is_vat_exempt() {
public function is_vat_exempt() {
return ( isset( $this->_data['is_vat_exempt'] ) && $this->_data['is_vat_exempt'] ) ? true : false;
}
@ -193,7 +193,7 @@ class WC_Customer {
* @access public
* @return string
*/
function get_state() {
public function get_state() {
if ( isset( $this->_data['state'] ) ) return $this->_data['state'];
}
@ -204,7 +204,7 @@ class WC_Customer {
* @access public
* @return string
*/
function get_country() {
public function get_country() {
if ( isset( $this->_data['country'] ) ) return $this->_data['country'];
}
@ -215,7 +215,7 @@ class WC_Customer {
* @access public
* @return string
*/
function get_postcode() {
public function get_postcode() {
global $woocommerce;
$validation = $woocommerce->validation();
if (isset($this->_data['postcode']) && $this->_data['postcode'] !== false) return $validation->format_postcode( $this->_data['postcode'], $this->get_country());
@ -228,7 +228,7 @@ class WC_Customer {
* @access public
* @return void
*/
function get_city() {
public function get_city() {
if ( isset( $this->_data['city'] ) ) return $this->_data['city'];
}
@ -238,7 +238,7 @@ class WC_Customer {
* @access public
* @return void
*/
function get_address() {
public function get_address() {
if ( isset( $this->_data['address'] ) ) return $this->_data['address'];
}
@ -248,7 +248,7 @@ class WC_Customer {
* @access public
* @return void
*/
function get_address_2() {
public function get_address_2() {
if ( isset( $this->_data['address_2'] ) ) return $this->_data['address_2'];
}
@ -258,7 +258,7 @@ class WC_Customer {
* @access public
* @return string
*/
function get_shipping_state() {
public function get_shipping_state() {
if ( isset( $this->_data['shipping_state'] ) ) return $this->_data['shipping_state'];
}
@ -269,7 +269,7 @@ class WC_Customer {
* @access public
* @return string
*/
function get_shipping_country() {
public function get_shipping_country() {
if ( isset( $this->_data['shipping_country'] ) ) return $this->_data['shipping_country'];
}
@ -280,7 +280,7 @@ class WC_Customer {
* @access public
* @return string
*/
function get_shipping_postcode() {
public function get_shipping_postcode() {
global $woocommerce;
$validation = $woocommerce->validation();
if (isset($this->_data['shipping_postcode'])) return $validation->format_postcode( $this->_data['shipping_postcode'], $this->get_shipping_country());
@ -293,7 +293,7 @@ class WC_Customer {
* @access public
* @return void
*/
function get_shipping_city() {
public function get_shipping_city() {
if ( isset( $this->_data['shipping_city'] ) ) return $this->_data['shipping_city'];
}
@ -303,7 +303,7 @@ class WC_Customer {
* @access public
* @return void
*/
function get_shipping_address() {
public function get_shipping_address() {
if ( isset( $this->_data['shipping_address'] ) ) return $this->_data['shipping_address'];
}
@ -313,7 +313,7 @@ class WC_Customer {
* @access public
* @return void
*/
function get_shipping_address_2() {
public function get_shipping_address_2() {
if ( isset( $this->_data['shipping_address_2'] ) ) return $this->_data['shipping_address_2'];
}
@ -323,7 +323,7 @@ class WC_Customer {
* @access public
* @return void
*/
function get_taxable_address() {
public function get_taxable_address() {
$tax_based_on = get_option( 'woocommerce_tax_based_on' );
if ( $tax_based_on == 'base' ) {
@ -369,7 +369,7 @@ class WC_Customer {
* @param string $city (default: '')
* @return void
*/
function set_location( $country, $state, $postcode = '', $city = '' ) {
public function set_location( $country, $state, $postcode = '', $city = '' ) {
$this->_data['country'] = $country;
$this->_data['state'] = $state;
$this->_data['postcode'] = $postcode;
@ -384,7 +384,7 @@ class WC_Customer {
* @param mixed $country
* @return void
*/
function set_country( $country ) {
public function set_country( $country ) {
$this->_data['country'] = $country;
}
@ -396,7 +396,7 @@ class WC_Customer {
* @param mixed $state
* @return void
*/
function set_state( $state ) {
public function set_state( $state ) {
$this->_data['state'] = $state;
}
@ -408,7 +408,7 @@ class WC_Customer {
* @param mixed $postcode
* @return void
*/
function set_postcode( $postcode ) {
public function set_postcode( $postcode ) {
$this->_data['postcode'] = $postcode;
}
@ -420,7 +420,7 @@ class WC_Customer {
* @param mixed $postcode
* @return void
*/
function set_city( $city ) {
public function set_city( $city ) {
$this->_data['city'] = $city;
}
@ -431,7 +431,7 @@ class WC_Customer {
* @param mixed $address
* @return void
*/
function set_address( $address ) {
public function set_address( $address ) {
$this->_data['address'] = $address;
}
@ -442,7 +442,7 @@ class WC_Customer {
* @param mixed $address_2
* @return void
*/
function set_address_2( $address_2 ) {
public function set_address_2( $address_2 ) {
$this->_data['address_2'] = $address_2;
}
@ -456,7 +456,7 @@ class WC_Customer {
* @param string $city (default: '')
* @return void
*/
function set_shipping_location( $country, $state = '', $postcode = '', $city = '' ) {
public function set_shipping_location( $country, $state = '', $postcode = '', $city = '' ) {
$this->_data['shipping_country'] = $country;
$this->_data['shipping_state'] = $state;
$this->_data['shipping_postcode'] = $postcode;
@ -471,7 +471,7 @@ class WC_Customer {
* @param mixed $country
* @return void
*/
function set_shipping_country( $country ) {
public function set_shipping_country( $country ) {
$this->_data['shipping_country'] = $country;
}
@ -483,7 +483,7 @@ class WC_Customer {
* @param mixed $state
* @return void
*/
function set_shipping_state( $state ) {
public function set_shipping_state( $state ) {
$this->_data['shipping_state'] = $state;
}
@ -495,7 +495,7 @@ class WC_Customer {
* @param mixed $postcode
* @return void
*/
function set_shipping_postcode( $postcode ) {
public function set_shipping_postcode( $postcode ) {
$this->_data['shipping_postcode'] = $postcode;
}
@ -507,7 +507,7 @@ class WC_Customer {
* @param mixed $postcode
* @return void
*/
function set_shipping_city( $city ) {
public function set_shipping_city( $city ) {
$this->_data['shipping_city'] = $city;
}
@ -518,7 +518,7 @@ class WC_Customer {
* @param mixed $address
* @return void
*/
function set_shipping_address( $address ) {
public function set_shipping_address( $address ) {
$this->_data['shipping_address'] = $address;
}
@ -529,7 +529,7 @@ class WC_Customer {
* @param mixed $address_2
* @return void
*/
function set_shipping_address_2( $address_2 ) {
public function set_shipping_address_2( $address_2 ) {
$this->_data['shipping_address_2'] = $address_2;
}
@ -541,7 +541,7 @@ class WC_Customer {
* @param mixed $is_vat_exempt
* @return void
*/
function set_is_vat_exempt( $is_vat_exempt ) {
public function set_is_vat_exempt( $is_vat_exempt ) {
$this->_data['is_vat_exempt'] = $is_vat_exempt;
}
@ -553,7 +553,7 @@ class WC_Customer {
* @param mixed $calculated
* @return void
*/
function calculated_shipping( $calculated = true ) {
public function calculated_shipping( $calculated = true ) {
$this->_data['calculated_shipping'] = $calculated;
}
@ -564,7 +564,7 @@ class WC_Customer {
* @access public
* @return array Array of downloadable products
*/
function get_downloadable_products() {
public function get_downloadable_products() {
global $wpdb, $woocommerce;
$downloads = array();

View File

@ -10,10 +10,10 @@
class WC_Logger {
/**
* @var array Stores open file handles.
* @var array Stores open file _handles.
* @access private
*/
private $handles;
private $_handles;
/**
* Constructor for the logger.
@ -21,8 +21,8 @@ class WC_Logger {
* @access public
* @return void
*/
function __construct() {
$this->handles = array();
public function __construct() {
$this->_handles = array();
}
@ -32,8 +32,8 @@ class WC_Logger {
* @access public
* @return void
*/
function __destruct() {
foreach ( $this->handles as $handle )
public function __destruct() {
foreach ( $this->_handles as $handle )
@fclose( escapeshellarg( $handle ) );
}
@ -48,10 +48,10 @@ class WC_Logger {
private function open( $handle ) {
global $woocommerce;
if ( isset( $this->handles[ $handle ] ) )
if ( isset( $this->_handles[ $handle ] ) )
return true;
if ( $this->handles[ $handle ] = @fopen( $woocommerce->plugin_path() . '/logs/' . $this->file_name( $handle ) . '.txt', 'a' ) )
if ( $this->_handles[ $handle ] = @fopen( $woocommerce->plugin_path() . '/logs/' . $this->file_name( $handle ) . '.txt', 'a' ) )
return true;
return false;
@ -69,7 +69,7 @@ class WC_Logger {
public function add( $handle, $message ) {
if ( $this->open( $handle ) ) {
$time = date_i18n( 'm-d-Y @ H:i:s -' ); //Grab Time
fwrite( $this->handles[ $handle ], $time . " " . $message . "\n" );
fwrite( $this->_handles[ $handle ], $time . " " . $message . "\n" );
}
}
@ -84,7 +84,7 @@ class WC_Logger {
public function clear( $handle ) {
if ( $this->open( $handle ) )
ftruncate( $this->handles[ $handle ], 0 );
ftruncate( $this->_handles[ $handle ], 0 );
}

View File

@ -11,143 +11,143 @@
*/
class WC_Order {
/** @var int Order (post) ID */
var $id;
/** @public int Order (post) ID */
public $id;
/** @var string Order status. */
var $status;
/** @public string Order status. */
public $status;
/** @var string Order date (placed). */
var $order_date;
/** @public string Order date (placed). */
public $order_date;
/** @var string Order date (paid). */
var $modified_date;
/** @public string Order date (paid). */
public $modified_date;
/** @var string Note added by the customer. */
var $customer_note;
/** @public string Note added by the customer. */
public $customer_note;
/** @var array Order (post) meta/custom fields. */
var $order_custom_fields;
/** @public array Order (post) meta/custom fields. */
public $order_custom_fields;
/** @var string Order unique key. */
var $order_key;
/** @public string Order unique key. */
public $order_key;
/** @var string */
var $billing_first_name;
/** @public string */
public $billing_first_name;
/** @var string */
var $billing_last_name;
/** @public string */
public $billing_last_name;
/** @var string */
var $billing_company;
/** @public string */
public $billing_company;
/** @var string */
var $billing_address_1;
/** @public string */
public $billing_address_1;
/** @var string */
var $billing_address_2;
/** @public string */
public $billing_address_2;
/** @var string */
var $billing_city;
/** @public string */
public $billing_city;
/** @var string */
var $billing_postcode;
/** @public string */
public $billing_postcode;
/** @var string */
var $billing_country;
/** @public string */
public $billing_country;
/** @var string */
var $billing_state;
/** @public string */
public $billing_state;
/** @var string */
var $billing_email;
/** @public string */
public $billing_email;
/** @var string */
var $billing_phone;
/** @public string */
public $billing_phone;
/** @var string */
var $shipping_first_name;
/** @public string */
public $shipping_first_name;
/** @var string */
var $shipping_last_name;
/** @public string */
public $shipping_last_name;
/** @var string */
var $shipping_company;
/** @public string */
public $shipping_company;
/** @var string */
var $shipping_address_1;
/** @public string */
public $shipping_address_1;
/** @var string */
var $shipping_address_2;
/** @public string */
public $shipping_address_2;
/** @var string */
var $shipping_city;
/** @public string */
public $shipping_city;
/** @var string */
var $shipping_postcode;
/** @public string */
public $shipping_postcode;
/** @var string */
var $shipping_country;
/** @public string */
public $shipping_country;
/** @var string */
var $shipping_state;
/** @public string */
public $shipping_state;
/** @var string Method id of the shipping used */
var $shipping_method;
/** @public string Method id of the shipping used */
public $shipping_method;
/** @var string Shipping method title */
var $shipping_method_title;
/** @public string Shipping method title */
public $shipping_method_title;
/** @var string Method id of the payment used */
var $payment_method;
/** @public string Method id of the payment used */
public $payment_method;
/** @var string Payment method title */
var $payment_method_title;
/** @public string Payment method title */
public $payment_method_title;
/** @var string After tax discount total */
var $order_discount;
/** @public string After tax discount total */
public $order_discount;
/** @var string Before tax discount total */
var $cart_discount;
/** @public string Before tax discount total */
public $cart_discount;
/** @var string Tax for the items total */
var $order_tax;
/** @public string Tax for the items total */
public $order_tax;
/** @var string Shipping cost */
var $order_shipping;
/** @public string Shipping cost */
public $order_shipping;
/** @var string Shipping tax */
var $order_shipping_tax;
/** @public string Shipping tax */
public $order_shipping_tax;
/** @var string Grand total */
var $order_total;
/** @public string Grand total */
public $order_total;
/** @var array Taxes array (tax rows) */
var $taxes;
/** @public array Taxes array (tax rows) */
public $taxes;
/** @var int User ID */
var $customer_user;
/** @public int User ID */
public $customer_user;
/** @var int User ID */
var $user_id;
/** @public int User ID */
public $user_id;
/** @var string */
var $completed_date;
/** @public string */
public $completed_date;
/** @var string */
var $billing_address;
/** @public string */
public $billing_address;
/** @var string */
var $formatted_billing_address;
/** @public string */
public $formatted_billing_address;
/** @var string */
var $shipping_address;
/** @public string */
public $shipping_address;
/** @var string */
var $formatted_shipping_address;
/** @public string */
public $formatted_shipping_address;
/** @var string */
var $post_status;
/** @public string */
public $post_status;
/**
* Get the order if ID is passed, otherwise the order is new and empty.
@ -156,7 +156,7 @@ class WC_Order {
* @param string $id (default: '')
* @return void
*/
function __construct( $id = '' ) {
public function __construct( $id = '' ) {
$this->prices_include_tax = get_option('woocommerce_prices_include_tax') == 'yes' ? true : false;
$this->tax_display_cart = get_option( 'woocommerce_tax_display_cart' );
@ -175,7 +175,7 @@ class WC_Order {
* @param int $id (default: 0)
* @return bool
*/
function get_order( $id = 0 ) {
public function get_order( $id = 0 ) {
if ( ! $id )
return false;
if ( $result = get_post( $id ) ) {
@ -193,7 +193,7 @@ class WC_Order {
* @param mixed $result
* @return void
*/
function populate( $result ) {
public function populate( $result ) {
// Standard post data
$this->id = $result->ID;
$this->order_date = $result->post_date;
@ -264,7 +264,7 @@ class WC_Order {
* @param mixed $key
* @return bool
*/
function key_is_valid( $key ) {
public function key_is_valid( $key ) {
if ( $key == $this->order_key ) return true;
return false;
}
@ -278,7 +278,7 @@ class WC_Order {
* @access public
* @return string
*/
function get_order_number() {
public function get_order_number() {
return apply_filters( 'woocommerce_order_number', _x( '#', 'hash before order number', 'woocommerce' ) . $this->id, $this );
}
@ -288,7 +288,7 @@ class WC_Order {
* @access public
* @return string
*/
function get_formatted_billing_address() {
public function get_formatted_billing_address() {
if ( ! $this->formatted_billing_address ) {
global $woocommerce;
@ -316,7 +316,7 @@ class WC_Order {
* @access public
* @return array
*/
function get_billing_address() {
public function get_billing_address() {
if ( ! $this->billing_address ) {
// Formatted Addresses
$address = array(
@ -340,7 +340,7 @@ class WC_Order {
* @access public
* @return void
*/
function get_formatted_shipping_address() {
public function get_formatted_shipping_address() {
if ( ! $this->formatted_shipping_address ) {
if ( $this->shipping_address_1 ) {
global $woocommerce;
@ -371,7 +371,7 @@ class WC_Order {
* @access public
* @return array
*/
function get_shipping_address() {
public function get_shipping_address() {
if ( ! $this->shipping_address ) {
if ( $this->shipping_address_1 ) {
// Formatted Addresses
@ -398,7 +398,7 @@ class WC_Order {
* @param string $type Types of line items to get (array or string)
* @return void
*/
function get_items( $type = '' ) {
public function get_items( $type = '' ) {
global $wpdb, $woocommerce;
if ( empty( $type ) )
@ -442,7 +442,7 @@ class WC_Order {
* @access public
* @return array
*/
function get_fees() {
public function get_fees() {
return $this->get_items( 'fee' );
}
@ -452,7 +452,7 @@ class WC_Order {
* @access public
* @return void
*/
function get_taxes() {
public function get_taxes() {
return $this->get_items( 'tax' );
}
@ -462,7 +462,7 @@ class WC_Order {
* @access public
* @return array of meta data
*/
function has_meta( $order_item_id ) {
public function has_meta( $order_item_id ) {
global $wpdb;
return $wpdb->get_results( $wpdb->prepare("SELECT meta_key, meta_value, meta_id, order_item_id
@ -479,7 +479,7 @@ class WC_Order {
* @param bool $single (default: false)
* @return void
*/
function get_item_meta( $order_item_id, $key = '', $single = false ) {
public function get_item_meta( $order_item_id, $key = '', $single = false ) {
return get_metadata( 'order_item', $order_item_id, $key, $single );
}
@ -492,7 +492,7 @@ class WC_Order {
* @access public
* @return float
*/
function get_total_tax() {
public function get_total_tax() {
return apply_filters( 'woocommerce_order_amount_total_tax', number_format( (double) $this->order_tax + (double) $this->order_shipping_tax, 2, '.', '' ) );
}
@ -503,7 +503,7 @@ class WC_Order {
* @access public
* @return float
*/
function get_cart_discount() {
public function get_cart_discount() {
return apply_filters( 'woocommerce_order_amount_cart_discount', number_format( (double) $this->cart_discount, 2, '.', '' ) );
}
@ -514,7 +514,7 @@ class WC_Order {
* @access public
* @return float
*/
function get_order_discount() {
public function get_order_discount() {
return apply_filters( 'woocommerce_order_amount_order_discount', number_format( (double) $this->order_discount, 2, '.', '' ) );
}
@ -525,7 +525,7 @@ class WC_Order {
* @access public
* @return float
*/
function get_total_discount() {
public function get_total_discount() {
if ( $this->order_discount || $this->cart_discount )
return apply_filters( 'woocommerce_order_amount_total_discount', number_format( (double) $this->order_discount + (double) $this->cart_discount, 2, '.', '' ) );
}
@ -537,7 +537,7 @@ class WC_Order {
* @access public
* @return float
*/
function get_shipping() {
public function get_shipping() {
return apply_filters( 'woocommerce_order_amount_shipping', number_format( (double) $this->order_shipping, 2, '.', '' ) );
}
@ -548,7 +548,7 @@ class WC_Order {
* @access public
* @return float
*/
function get_shipping_tax() {
public function get_shipping_tax() {
return apply_filters( 'woocommerce_order_amount_shipping_tax', number_format( (double) $this->order_shipping_tax, 2, '.', '' ) );
}
@ -559,7 +559,7 @@ class WC_Order {
* @access public
* @return float
*/
function get_total() {
public function get_total() {
return apply_filters( 'woocommerce_order_amount_total', number_format( (double) $this->order_total, 2, '.', '' ) );
}
@ -570,7 +570,7 @@ class WC_Order {
* @access public
* @return void
*/
function get_order_total() {
public function get_order_total() {
return $this->get_total();
}
@ -580,7 +580,7 @@ class WC_Order {
* @access public
* @return string
*/
function get_shipping_method() {
public function get_shipping_method() {
return apply_filters( 'woocommerce_order_shipping_method', ucwords( $this->shipping_method_title ) );
}
@ -594,7 +594,7 @@ class WC_Order {
* @param bool $round (default: true)
* @return float
*/
function get_item_subtotal( $item, $inc_tax = false, $round = true ) {
public function get_item_subtotal( $item, $inc_tax = false, $round = true ) {
if ( $inc_tax )
$price = ( $item['line_subtotal'] + $item['line_subtotal_tax'] / $item['qty'] );
else
@ -612,7 +612,7 @@ class WC_Order {
* @param bool $round (default: true)
* @return float
*/
function get_line_subtotal( $item, $inc_tax = false, $round = true ) {
public function get_line_subtotal( $item, $inc_tax = false, $round = true ) {
if ( $inc_tax )
$price = $item['line_subtotal'] + $item['line_subtotal_tax'];
else
@ -630,7 +630,7 @@ class WC_Order {
* @param bool $round (default: true)
* @return float
*/
function get_item_total( $item, $inc_tax = false, $round = true ) {
public function get_item_total( $item, $inc_tax = false, $round = true ) {
if ( $inc_tax )
$price = ( ( $item['line_total'] + $item['line_tax'] ) / $item['qty'] );
else
@ -647,7 +647,7 @@ class WC_Order {
* @param bool $round (default: true)
* @return float
*/
function get_item_tax( $item, $round = true ) {
public function get_item_tax( $item, $round = true ) {
$price = $item['line_tax'] / $item['qty'];
return apply_filters( 'woocommerce_order_amount_item_tax', ($round) ? number_format( $price, 2, '.', '') : $price );
}
@ -661,7 +661,7 @@ class WC_Order {
* @param bool $inc_tax (default: false)
* @return float
*/
function get_line_total( $item, $inc_tax = false ) {
public function get_line_total( $item, $inc_tax = false ) {
if ( $inc_tax )
return apply_filters( 'woocommerce_order_amount_line_total', number_format( $item['line_total'] + $item['line_tax'] , 2, '.', '') );
else
@ -676,7 +676,7 @@ class WC_Order {
* @param mixed $item
* @return float
*/
function get_line_tax( $item ) {
public function get_line_tax( $item ) {
return apply_filters( 'woocommerce_order_amount_line_tax', number_format( $item['line_tax'], 2, '.', '') );
}
@ -689,7 +689,7 @@ class WC_Order {
* @param mixed $item
* @return string
*/
function get_formatted_line_subtotal( $item ) {
public function get_formatted_line_subtotal( $item ) {
$subtotal = 0;
if (!isset($item['line_subtotal']) || !isset($item['line_subtotal_tax'])) return;
@ -711,7 +711,7 @@ class WC_Order {
* @access public
* @return string
*/
function get_formatted_order_total() {
public function get_formatted_order_total() {
$formatted_total = woocommerce_price( $this->order_total );
@ -726,7 +726,7 @@ class WC_Order {
* @param bool $compound (default: false)
* @return string
*/
function get_subtotal_to_display( $compound = false ) {
public function get_subtotal_to_display( $compound = false ) {
global $woocommerce;
$subtotal = 0;
@ -790,7 +790,7 @@ class WC_Order {
* @access public
* @return string
*/
function get_shipping_to_display() {
public function get_shipping_to_display() {
global $woocommerce;
if ( $this->order_shipping > 0 ) {
@ -833,7 +833,7 @@ class WC_Order {
* @access public
* @return string.
*/
function get_cart_discount_to_display() {
public function get_cart_discount_to_display() {
return apply_filters( 'woocommerce_order_cart_discount_to_display', woocommerce_price( $this->get_cart_discount() ), $this );
}
@ -844,7 +844,7 @@ class WC_Order {
* @access public
* @return string
*/
function get_order_discount_to_display() {
public function get_order_discount_to_display() {
return apply_filters( 'woocommerce_order_discount_to_display', woocommerce_price( $this->get_order_discount() ), $this );
}
@ -856,7 +856,7 @@ class WC_Order {
* @param mixed $item
* @return WC_Product
*/
function get_product_from_item( $item ) {
public function get_product_from_item( $item ) {
$_product = get_product( $item['variation_id'] ? $item['variation_id'] : $item['product_id'] );
return $_product;
@ -870,7 +870,7 @@ class WC_Order {
* @access public
* @return array
*/
function get_order_item_totals() {
public function get_order_item_totals() {
global $woocommerce;
$total_rows = array();
@ -1006,7 +1006,7 @@ class WC_Order {
* @param bool plain text
* @return string
*/
function email_order_items_table( $show_download_links = false, $show_sku = false, $show_purchase_note = false, $show_image = false, $image_size = array( 32, 32 ), $plain_text = false ) {
public function email_order_items_table( $show_download_links = false, $show_sku = false, $show_purchase_note = false, $show_image = false, $image_size = array( 32, 32 ), $plain_text = false ) {
ob_start();
@ -1033,7 +1033,7 @@ class WC_Order {
* @access public
* @return bool
*/
function is_download_permitted() {
public function is_download_permitted() {
return apply_filters( 'woocommerce_order_is_download_permitted', $this->status == 'completed' || ( get_option( 'woocommerce_downloads_grant_access_after_payment' ) == 'yes' && $this->status == 'processing' ), $this );
}
@ -1043,7 +1043,7 @@ class WC_Order {
* @access public
* @return bool
*/
function has_downloadable_item() {
public function has_downloadable_item() {
$has_downloadable_item = false;
foreach($this->get_items() as $item) :
@ -1066,7 +1066,7 @@ class WC_Order {
* @access public
* @return string
*/
function get_checkout_payment_url() {
public function get_checkout_payment_url() {
$payment_page = get_permalink(woocommerce_get_page_id('pay'));
@ -1082,7 +1082,7 @@ class WC_Order {
* @access public
* @return string
*/
function get_cancel_order_url() {
public function get_cancel_order_url() {
global $woocommerce;
return apply_filters('woocommerce_get_cancel_order_url', $woocommerce->nonce_url( 'cancel_order', add_query_arg('cancel_order', 'true', add_query_arg('order', $this->order_key, add_query_arg('order_id', $this->id, trailingslashit( home_url() ))))));
}
@ -1097,7 +1097,7 @@ class WC_Order {
* @param array $item the item
* @return array available downloadable file urls
*/
function get_downloadable_file_urls( $product_id, $variation_id, $item ) {
public function get_downloadable_file_urls( $product_id, $variation_id, $item ) {
global $wpdb;
$download_file = $variation_id > 0 ? $variation_id : $product_id;
@ -1131,7 +1131,7 @@ class WC_Order {
* @param int $is_customer_note (default: 0) Is this a note for the customer?
* @return id Comment ID
*/
function add_order_note( $note, $is_customer_note = 0 ) {
public function add_order_note( $note, $is_customer_note = 0 ) {
$is_customer_note = intval( $is_customer_note );
@ -1168,7 +1168,7 @@ class WC_Order {
* @param string $note (default: '') Optional note to add
* @return void
*/
function update_status( $new_status_slug, $note = '' ) {
public function update_status( $new_status_slug, $note = '' ) {
if ( $note )
$note .= ' ';
@ -1222,7 +1222,7 @@ class WC_Order {
* @param string $note (default: '') Optional note to add
* @return void
*/
function cancel_order( $note = '' ) {
public function cancel_order( $note = '' ) {
global $woocommerce;
unset( $woocommerce->session->order_awaiting_payment );
@ -1243,7 +1243,7 @@ class WC_Order {
* @access public
* @return void
*/
function payment_complete() {
public function payment_complete() {
global $woocommerce;
unset( $woocommerce->session->order_awaiting_payment );
@ -1299,7 +1299,7 @@ class WC_Order {
* @access public
* @return void
*/
function record_product_sales() {
public function record_product_sales() {
if ( get_post_meta( $this->id, '_recorded_sales', true ) == 'yes' )
return;
@ -1325,7 +1325,7 @@ class WC_Order {
* @access public
* @return array
*/
function get_used_coupons() {
public function get_used_coupons() {
$codes = array();
$coupons = $this->get_items( 'coupon' );
@ -1344,7 +1344,7 @@ class WC_Order {
* @access public
* @return void
*/
function increase_coupon_usage_counts() {
public function increase_coupon_usage_counts() {
global $woocommerce;
if ( get_post_meta( $this->id, '_recorded_coupon_usage_counts', true ) == 'yes' )
@ -1370,7 +1370,7 @@ class WC_Order {
* @access public
* @return void
*/
function decrease_coupon_usage_counts() {
public function decrease_coupon_usage_counts() {
global $woocommerce;
if ( get_post_meta( $this->id, '_recorded_coupon_usage_counts', true ) != 'yes' )
@ -1396,7 +1396,7 @@ class WC_Order {
* @access public
* @return void
*/
function reduce_order_stock() {
public function reduce_order_stock() {
if ( get_option('woocommerce_manage_stock') == 'yes' && sizeof( $this->get_items() ) > 0 ) {
@ -1439,7 +1439,7 @@ class WC_Order {
* @param int $qty_ordered
* @return void
*/
function send_stock_notifications( $product, $new_stock, $qty_ordered ) {
public function send_stock_notifications( $product, $new_stock, $qty_ordered ) {
// Backorders
if ( $new_stock < 0 )
@ -1466,7 +1466,7 @@ class WC_Order {
* @access public
* @return array
*/
function get_customer_order_notes() {
public function get_customer_order_notes() {
$notes = array();
@ -1508,7 +1508,7 @@ class WC_Order {
*/
class WC_Order_Item_Meta {
var $meta;
public $meta;
/**
* Constructor
@ -1517,7 +1517,7 @@ class WC_Order_Item_Meta {
* @param string $item_meta (default: '')
* @return void
*/
function __construct( $item_meta = array() ) {
public function __construct( $item_meta = array() ) {
$this->meta = $item_meta;
}
@ -1530,7 +1530,7 @@ class WC_Order_Item_Meta {
* @param string $hideprefix (default: _)
* @return void
*/
function display( $flat = false, $return = false, $hideprefix = '_' ) {
public function display( $flat = false, $return = false, $hideprefix = '_' ) {
global $woocommerce;
if ( ! empty( $this->meta ) ) {

View File

@ -14,10 +14,10 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
class WC_Product_External extends WC_Product_Simple {
/** @var string URL to external product. */
var $product_url;
public $product_url;
/** @var string Text for the buy/link button. */
var $button_text;
public $button_text;
/**
* __construct function.
@ -26,7 +26,7 @@ class WC_Product_External extends WC_Product_Simple {
* @param mixed $product
* @param array $args Contains arguments to set up this product
*/
function __construct( $product, $args ) {
public function __construct( $product, $args ) {
parent::__construct( $product, $args );
@ -53,7 +53,7 @@ class WC_Product_External extends WC_Product_Simple {
* @access public
* @return cool
*/
function is_purchasable() {
public function is_purchasable() {
return apply_filters( 'woocommerce_is_purchasable', false, $this );
}
@ -63,7 +63,7 @@ class WC_Product_External extends WC_Product_Simple {
* @access public
* @return void
*/
function get_product_url() {
public function get_product_url() {
return $this->product_url;
}
@ -73,7 +73,7 @@ class WC_Product_External extends WC_Product_Simple {
* @access public
* @return void
*/
function get_button_text() {
public function get_button_text() {
return $this->button_text ? $this->button_text : __( 'Buy product', 'woocommerce' );
}
}

View File

@ -14,10 +14,10 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
class WC_Product_Grouped extends WC_Product {
/** @var array Array of child products/posts/variations. */
var $children;
public $children;
/** @var string The product's total stock, including that of its children. */
var $total_stock;
public $total_stock;
/**
* __construct function.
@ -26,7 +26,7 @@ class WC_Product_Grouped extends WC_Product {
* @param mixed $product
* @param array $args Contains arguments to set up this product
*/
function __construct( $product, $args ) {
public function __construct( $product, $args ) {
parent::__construct( $product );
@ -63,7 +63,7 @@ class WC_Product_Grouped extends WC_Product {
* @access public
* @return int
*/
function get_total_stock() {
public function get_total_stock() {
if ( is_null( $this->total_stock ) ) {
@ -95,7 +95,7 @@ class WC_Product_Grouped extends WC_Product {
* @access public
* @return array
*/
function get_children() {
public function get_children() {
if ( ! is_array( $this->children ) ) {
@ -123,7 +123,7 @@ class WC_Product_Grouped extends WC_Product {
* @param mixed $child_id
* @return object WC_Product or WC_Product_variation
*/
function get_child( $child_id ) {
public function get_child( $child_id ) {
return get_product( $child_id );
}
@ -134,7 +134,7 @@ class WC_Product_Grouped extends WC_Product {
* @access public
* @return bool
*/
function has_child() {
public function has_child() {
return sizeof( $this->get_children() ) ? true : false;
}
@ -145,7 +145,7 @@ class WC_Product_Grouped extends WC_Product {
* @access public
* @return bool
*/
function is_on_sale() {
public function is_on_sale() {
if ( $this->has_child() ) {
foreach ( $this->get_children() as $child_id ) {
@ -170,7 +170,7 @@ class WC_Product_Grouped extends WC_Product {
* @access public
* @return cool
*/
function is_purchasable() {
public function is_purchasable() {
return apply_filters( 'woocommerce_is_purchasable', false, $this );
}
@ -182,7 +182,7 @@ class WC_Product_Grouped extends WC_Product {
* @param string $price (default: '')
* @return string
*/
function get_price_html( $price = '' ) {
public function get_price_html( $price = '' ) {
$child_prices = array();

View File

@ -20,7 +20,7 @@ class WC_Product_Simple extends WC_Product {
* @param mixed $product
* @param array $args Contains arguments to set up this product
*/
function __construct( $product, $args ) {
public function __construct( $product, $args ) {
parent::__construct( $product );
@ -60,7 +60,7 @@ class WC_Product_Simple extends WC_Product {
* @access public
* @return string
*/
function get_title() {
public function get_title() {
$title = $this->post->post_title;
@ -78,7 +78,7 @@ class WC_Product_Simple extends WC_Product {
* @access public
* @return void
*/
function grouped_product_sync() {
public function grouped_product_sync() {
global $wpdb, $woocommerce;
if ( ! $this->get_parent() ) return;

View File

@ -13,29 +13,29 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
class WC_Product_Variable extends WC_Product {
/** @var array Array of child products/posts/variations. */
var $children;
/** @public array Array of child products/posts/variations. */
public $children;
/** @var string The product's total stock, including that of its children. */
var $total_stock;
/** @public string The product's total stock, including that of its children. */
public $total_stock;
/** @var string Used for variation prices. */
var $min_variation_price;
/** @public string Used for variation prices. */
public $min_variation_price;
/** @var string Used for variation prices. */
var $max_variation_price;
/** @public string Used for variation prices. */
public $max_variation_price;
/** @var string Used for variation prices. */
var $min_variation_regular_price;
/** @public string Used for variation prices. */
public $min_variation_regular_price;
/** @var string Used for variation prices. */
var $max_variation_regular_price;
/** @public string Used for variation prices. */
public $max_variation_regular_price;
/** @var string Used for variation prices. */
var $min_variation_sale_price;
/** @public string Used for variation prices. */
public $min_variation_sale_price;
/** @var string Used for variation prices. */
var $max_variation_sale_price;
/** @public string Used for variation prices. */
public $max_variation_sale_price;
/**
* __construct function.
@ -44,7 +44,7 @@ class WC_Product_Variable extends WC_Product {
* @param mixed $product
* @param array $args Contains arguments to set up this product
*/
function __construct( $product, $args ) {
public function __construct( $product, $args ) {
parent::__construct( $product );
@ -89,7 +89,7 @@ class WC_Product_Variable extends WC_Product {
* @access public
* @return int
*/
function get_total_stock() {
public function get_total_stock() {
if ( is_null( $this->total_stock ) ) {
@ -121,7 +121,7 @@ class WC_Product_Variable extends WC_Product {
* @param int $by (default: 1) Amount to reduce by.
* @return int Stock
*/
function reduce_stock( $by = 1 ) {
public function reduce_stock( $by = 1 ) {
global $woocommerce;
if ( $this->managing_stock() ) {
@ -147,7 +147,7 @@ class WC_Product_Variable extends WC_Product {
* @param int $by (default: 1) Amount to increase by
* @return int Stock
*/
function increase_stock( $by = 1 ) {
public function increase_stock( $by = 1 ) {
global $woocommerce;
if ($this->managing_stock()) :
@ -172,7 +172,7 @@ class WC_Product_Variable extends WC_Product {
* @access public
* @return array
*/
function get_children() {
public function get_children() {
if ( ! is_array( $this->children ) ) {
@ -201,7 +201,7 @@ class WC_Product_Variable extends WC_Product {
* @param mixed $child_id
* @return object WC_Product or WC_Product_variation
*/
function get_child( $child_id ) {
public function get_child( $child_id ) {
return get_product( $child_id, array(
'parent_id' => $this->id,
'parent' => $this,
@ -216,7 +216,7 @@ class WC_Product_Variable extends WC_Product {
* @access public
* @return bool
*/
function has_child() {
public function has_child() {
return sizeof( $this->get_children() ) ? true : false;
}
@ -227,7 +227,7 @@ class WC_Product_Variable extends WC_Product {
* @access public
* @return bool
*/
function is_on_sale() {
public function is_on_sale() {
if ( $this->has_child() ) {
foreach ( $this->get_children() as $child_id ) {
@ -252,7 +252,7 @@ class WC_Product_Variable extends WC_Product {
* @param string $price (default: '')
* @return string
*/
function get_price_html( $price = '' ) {
public function get_price_html( $price = '' ) {
// Ensure variation prices are synced with variations
if ( $this->min_variation_price === '' || $this->min_variation_regular_price === '' ) {
@ -319,7 +319,7 @@ class WC_Product_Variable extends WC_Product {
* @access public
* @return array of attributes and their available values
*/
function get_variation_attributes() {
public function get_variation_attributes() {
$variation_attributes = array();
@ -387,7 +387,7 @@ class WC_Product_Variable extends WC_Product {
* @access public
* @return array
*/
function get_variation_default_attributes() {
public function get_variation_default_attributes() {
$default = isset( $this->product_custom_fields['_default_attributes'][0] ) ? $this->product_custom_fields['_default_attributes'][0] : '';
@ -400,7 +400,7 @@ class WC_Product_Variable extends WC_Product {
* @access public
* @return array
*/
function get_available_variations() {
public function get_available_variations() {
$available_variations = array();
@ -463,7 +463,7 @@ class WC_Product_Variable extends WC_Product {
* @access public
* @return void
*/
function variable_product_sync() {
public function variable_product_sync() {
global $woocommerce;
$children = get_posts( array(

View File

@ -14,53 +14,53 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
class WC_Product_Variation extends WC_Product {
/** @var array Stores variation data (attributes) for the current variation. */
var $variation_data;
/** @public array Stores variation data (attributes) for the current variation. */
public $variation_data;
/** @var int ID of the variable product. */
var $variation_id;
/** @public int ID of the variable product. */
public $variation_id;
/** @var bool True if the variation has a length. */
var $variation_has_length;
/** @public bool True if the variation has a length. */
public $variation_has_length;
/** @var bool True if the variation has a width. */
var $variation_has_width;
/** @public bool True if the variation has a width. */
public $variation_has_width;
/** @var bool True if the variation has a height. */
var $variation_has_height;
/** @public bool True if the variation has a height. */
public $variation_has_height;
/** @var bool True if the variation has a weight. */
var $variation_has_weight;
/** @public bool True if the variation has a weight. */
public $variation_has_weight;
/** @var bool True if the variation has a price. */
var $variation_has_price;
/** @public bool True if the variation has a price. */
public $variation_has_price;
/** @var bool True if the variation has a regular price. */
var $variation_has_regular_price;
/** @public bool True if the variation has a regular price. */
public $variation_has_regular_price;
/** @var bool True if the variation has a sale price. */
var $variation_has_sale_price;
/** @public bool True if the variation has a sale price. */
public $variation_has_sale_price;
/** @var bool True if the variation has stock and is managing stock. */
var $variation_has_stock;
/** @public bool True if the variation has stock and is managing stock. */
public $variation_has_stock;
/** @var bool True if the variation has a sku. */
var $variation_has_sku;
/** @public bool True if the variation has a sku. */
public $variation_has_sku;
/** @var string Stores the shipping class of the variation. */
var $variation_shipping_class;
/** @public string Stores the shipping class of the variation. */
public $variation_shipping_class;
/** @var int Stores the shipping class ID of the variation. */
var $variation_shipping_class_id;
/** @public int Stores the shipping class ID of the variation. */
public $variation_shipping_class_id;
/** @var bool True if the variation has a tax class. */
var $variation_has_tax_class;
/** @public bool True if the variation has a tax class. */
public $variation_has_tax_class;
/** @var array Array of custom fields (meta) containing product data. */
var $parent_custom_fields;
/** @public array Array of custom fields (meta) containing product data. */
public $parent_custom_fields;
/** @var object Parent Variable product object. */
var $parent;
/** @public object Parent Variable product object. */
public $parent;
/**
* Loads all product data from custom fields
@ -70,7 +70,7 @@ class WC_Product_Variation extends WC_Product {
* @param array $args Array of the arguments containing parent product data
* @return void
*/
function __construct( $variation, $args = array() ) {
public function __construct( $variation, $args = array() ) {
$this->product_type = 'variable';
@ -219,7 +219,7 @@ class WC_Product_Variation extends WC_Product {
* @access public
* @return bool
*/
function is_visible() {
public function is_visible() {
$visible = true;
@ -237,7 +237,7 @@ class WC_Product_Variation extends WC_Product {
* @access public
* @return bool
*/
function parent_is_visible() {
public function parent_is_visible() {
return parent::is_visible();
}
@ -246,7 +246,7 @@ class WC_Product_Variation extends WC_Product {
*
* @return int
*/
function get_variation_id() {
public function get_variation_id() {
return absint( $this->variation_id );
}
@ -255,7 +255,7 @@ class WC_Product_Variation extends WC_Product {
*
* @return array of attributes and their values for this variation
*/
function get_variation_attributes() {
public function get_variation_attributes() {
return $this->variation_data;
}
@ -264,7 +264,7 @@ class WC_Product_Variation extends WC_Product {
*
* @return string containing the formatted price
*/
function get_price_html() {
public function get_price_html() {
if ( $this->variation_has_price ) {
$price = '';
@ -292,7 +292,7 @@ class WC_Product_Variation extends WC_Product {
* @param string $size (default: 'shop_thumbnail')
* @return string
*/
function get_image( $size = 'shop_thumbnail', $attr = array() ) {
public function get_image( $size = 'shop_thumbnail', $attr = array() ) {
global $woocommerce;
$image = '';
@ -318,7 +318,7 @@ class WC_Product_Variation extends WC_Product {
* @param int $by (default: 1) Amount to reduce by
* @return int stock level
*/
function reduce_stock( $by = 1 ) {
public function reduce_stock( $by = 1 ) {
global $woocommerce;
if ( $this->variation_has_stock ) {
@ -356,7 +356,7 @@ class WC_Product_Variation extends WC_Product {
* @param int $by (default: 1) Amount to increase by
* @return int stock level
*/
function increase_stock( $by = 1 ) {
public function increase_stock( $by = 1 ) {
global $woocommerce;
if ($this->variation_has_stock) :
@ -385,7 +385,7 @@ class WC_Product_Variation extends WC_Product {
* @access public
* @return string
*/
function get_shipping_class() {
public function get_shipping_class() {
if ( ! $this->variation_shipping_class ) {
$classes = get_the_terms( $this->variation_id, 'product_shipping_class' );
@ -406,7 +406,7 @@ class WC_Product_Variation extends WC_Product {
* @access public
* @return int
*/
function get_shipping_class_id() {
public function get_shipping_class_id() {
if ( ! $this->variation_shipping_class_id ) {
$classes = get_the_terms( $this->variation_id, 'product_shipping_class' );
@ -427,7 +427,7 @@ class WC_Product_Variation extends WC_Product {
* @param string $download_id file identifier
* @return array
*/
function get_file_download_path( $download_id ) {
public function get_file_download_path( $download_id ) {
$file_path = '';
$file_paths = apply_filters( 'woocommerce_file_download_paths', get_post_meta( $this->variation_id, '_file_paths', true ), $this->variation_id, null, null );

View File

@ -9,23 +9,23 @@
*/
class WC_Query {
/** @var array Unfiltered product ids (before layered nav etc) */
var $unfiltered_product_ids = array();
/** @public array Unfiltered product ids (before layered nav etc) */
public $unfiltered_product_ids = array();
/** @var array Filtered product ids (after layered nav) */
var $filtered_product_ids = array();
/** @public array Filtered product ids (after layered nav) */
public $filtered_product_ids = array();
/** @var array Product IDs that match the layered nav + price filter */
var $post__in = array();
/** @public array Product IDs that match the layered nav + price filter */
public $post__in = array();
/** @var array The meta query for the page */
var $meta_query = '';
/** @public array The meta query for the page */
public $meta_query = '';
/** @var array Post IDs matching layered nav only */
var $layered_nav_post__in = array();
/** @public array Post IDs matching layered nav only */
public $layered_nav_post__in = array();
/** @var array Stores post IDs matching layered nav, so price filter can find max price in view */
var $layered_nav_product_ids = array();
/** @public array Stores post IDs matching layered nav, so price filter can find max price in view */
public $layered_nav_product_ids = array();
/**
* Constructor for the query class. Hooks in methods.
@ -33,7 +33,7 @@ class WC_Query {
* @access public
* @return void
*/
function __construct() {
public function __construct() {
add_filter( 'pre_get_posts', array( &$this, 'pre_get_posts') );
add_filter( 'the_posts', array( &$this, 'the_posts'), 11, 2 );
add_filter( 'wp', array( &$this, 'remove_product_query') );
@ -47,7 +47,7 @@ class WC_Query {
* @param mixed $q query object
* @return void
*/
function pre_get_posts( $q ) {
public function pre_get_posts( $q ) {
global $woocommerce;
// We only want to affect the main query
@ -113,7 +113,7 @@ class WC_Query {
* @param mixed $meta
* @return void
*/
function wpseo_metadesc() {
public function wpseo_metadesc() {
return wpseo_get_value( 'metadesc', woocommerce_get_page_id('shop') );
}
@ -124,7 +124,7 @@ class WC_Query {
* @access public
* @return void
*/
function wpseo_metakey() {
public function wpseo_metakey() {
return wpseo_get_value( 'metakey', woocommerce_get_page_id('shop') );
}
@ -137,7 +137,7 @@ class WC_Query {
* @param bool $query (default: false)
* @return void
*/
function the_posts( $posts, $query = false ) {
public function the_posts( $posts, $query = false ) {
global $woocommerce;
// Abort if theres no query
@ -194,7 +194,7 @@ class WC_Query {
* @param mixed $q
* @return void
*/
function product_query( $q ) {
public function product_query( $q ) {
// Meta query
$meta_query = (array) $q->get( 'meta_query' );
@ -237,7 +237,7 @@ class WC_Query {
* @access public
* @return void
*/
function remove_product_query() {
public function remove_product_query() {
remove_filter( 'pre_get_posts', array( &$this, 'pre_get_posts') );
}
@ -248,7 +248,7 @@ class WC_Query {
* @access public
* @return void
*/
function get_products_in_view() {
public function get_products_in_view() {
global $wp_the_query;
$unfiltered_product_ids = array();
@ -308,7 +308,7 @@ class WC_Query {
* @access public
* @return array
*/
function get_catalog_ordering_args() {
public function get_catalog_ordering_args() {
global $woocommerce;
$current_order = ( isset( $woocommerce->session->orderby ) ) ? $woocommerce->session->orderby : apply_filters( 'woocommerce_default_catalog_orderby', get_option( 'woocommerce_default_catalog_orderby' ) );
@ -359,7 +359,7 @@ class WC_Query {
* @param string $compare (default: 'IN')
* @return array
*/
function visibility_meta_query( $compare = 'IN' ) {
public function visibility_meta_query( $compare = 'IN' ) {
if ( is_search() ) $in = array( 'visible', 'search' ); else $in = array( 'visible', 'catalog' );
$meta_query = array(
@ -379,7 +379,7 @@ class WC_Query {
* @param string $status (default: 'instock')
* @return array
*/
function stock_status_meta_query( $status = 'instock' ) {
public function stock_status_meta_query( $status = 'instock' ) {
$meta_query = array();
if ( get_option( 'woocommerce_hide_out_of_stock_items' ) == 'yes' ) {
$meta_query = array(

View File

@ -10,19 +10,19 @@
class WC_Settings_API {
/** @var string The plugin ID. Used for option names. */
var $plugin_id = 'woocommerce_';
public $plugin_id = 'woocommerce_';
/** @var array Array of setting values. */
var $settings = array();
public $settings = array();
/** @var array Array of form option fields. */
var $form_fields = array();
public $form_fields = array();
/** @var array Array of validation errors. */
var $errors = array();
public $errors = array();
/** @var array Sanitized fields after validation. */
var $sanitized_fields = array();
public $sanitized_fields = array();
/**
@ -35,7 +35,7 @@ class WC_Settings_API {
* @access public
* @return void
*/
function admin_options() { ?>
public function admin_options() { ?>
<h3><?php echo ( ! empty( $this->method_title ) ) ? $this->method_title : __( 'Settings','woocommerce' ) ; ?></h3>
<?php echo ( ! empty( $this->method_description ) ) ? wpautop( $this->method_description ) : ''; ?>
@ -55,8 +55,8 @@ class WC_Settings_API {
* @access public
* @return string
*/
function init_form_fields() {
return __( 'This function needs to be overridden by your payment gateway class.', 'woocommerce' );
public function init_form_fields() {
return __( 'This public function needs to be overridden by your payment gateway class.', 'woocommerce' );
}
/**
@ -86,7 +86,7 @@ class WC_Settings_API {
* @access public
* @return void
*/
function display_errors() {}
public function display_errors() {}
/**
* Initialise Gateway Settings
@ -100,7 +100,7 @@ class WC_Settings_API {
* @access public
* @return void
*/
function init_settings() {
public function init_settings() {
// Load form_field settings
if ( $this->form_fields ) {
@ -138,7 +138,7 @@ class WC_Settings_API {
* @param mixed $value
* @return array
*/
function format_settings( $value ) {
public function format_settings( $value ) {
return ( is_array( $value ) ) ? $value : html_entity_decode( $value );
}
@ -155,7 +155,7 @@ class WC_Settings_API {
* @access public
* @return string the html for the settings
*/
function generate_settings_html ( $form_fields = false ) {
public function generate_settings_html ( $form_fields = false ) {
if ( ! $form_fields )
$form_fields = $this->form_fields;
@ -184,7 +184,7 @@ class WC_Settings_API {
* @since 1.0.0
* @return string
*/
function generate_text_html( $key, $data ) {
public function generate_text_html( $key, $data ) {
$html = '';
$data['title'] = isset( $data['title'] ) ? $data['title'] : '';
@ -226,7 +226,7 @@ class WC_Settings_API {
* @since 1.0.0
* @return string
*/
function generate_password_html( $key, $data ) {
public function generate_password_html( $key, $data ) {
$html = '';
$data['title'] = isset( $data['title'] ) ? $data['title'] : '';
@ -266,7 +266,7 @@ class WC_Settings_API {
* @since 1.0.0
* @return string
*/
function generate_textarea_html( $key, $data ) {
public function generate_textarea_html( $key, $data ) {
$html = '';
$data['title'] = isset( $data['title'] ) ? $data['title'] : '';
@ -307,7 +307,7 @@ class WC_Settings_API {
* @since 1.0.0
* @return string
*/
function generate_checkbox_html( $key, $data ) {
public function generate_checkbox_html( $key, $data ) {
$html = '';
$data['title'] = isset( $data['title'] ) ? $data['title'] : '';
@ -346,7 +346,7 @@ class WC_Settings_API {
* @since 1.0.0
* @return string
*/
function generate_select_html( $key, $data ) {
public function generate_select_html( $key, $data ) {
$html = '';
$data['title'] = isset( $data['title'] ) ? $data['title'] : '';
@ -392,7 +392,7 @@ class WC_Settings_API {
* @since 1.0.0
* @return string
*/
function generate_multiselect_html( $key, $data ) {
public function generate_multiselect_html( $key, $data ) {
$html = '';
$data['title'] = isset( $data['title'] ) ? $data['title'] : '';
@ -440,7 +440,7 @@ class WC_Settings_API {
* @since 1.6.2
* @return string
*/
function generate_title_html( $key, $data ) {
public function generate_title_html( $key, $data ) {
$html = '';
$data['title'] = isset( $data['title'] ) ? $data['title'] : '';
@ -466,7 +466,7 @@ class WC_Settings_API {
* @param bool $form_fields (default: false)
* @return void
*/
function validate_settings_fields( $form_fields = false ) {
public function validate_settings_fields( $form_fields = false ) {
if ( ! $form_fields )
$form_fields = $this->form_fields;
@ -498,7 +498,7 @@ class WC_Settings_API {
* @since 1.0.0
* @return string
*/
function validate_checkbox_field( $key ) {
public function validate_checkbox_field( $key ) {
$status = 'no';
if ( isset( $_POST[ $this->plugin_id . $this->id . '_' . $key ] ) && ( 1 == $_POST[ $this->plugin_id . $this->id . '_' . $key ] ) ) {
$status = 'yes';
@ -517,7 +517,7 @@ class WC_Settings_API {
* @since 1.0.0
* @return string
*/
function validate_text_field( $key ) {
public function validate_text_field( $key ) {
$text = ( isset( $this->settings[ $key ] ) ) ? $this->settings[ $key ] : '';
if ( isset( $_POST[ $this->plugin_id . $this->id . '_' . $key ] ) ) {
@ -538,7 +538,7 @@ class WC_Settings_API {
* @since 1.0.0
* @return string
*/
function validate_password_field( $key ) {
public function validate_password_field( $key ) {
$text = (isset($this->settings[$key])) ? $this->settings[$key] : '';
if ( isset( $_POST[ $this->plugin_id . $this->id . '_' . $key ] ) ) {
@ -559,7 +559,7 @@ class WC_Settings_API {
* @since 1.0.0
* @return string
*/
function validate_textarea_field( $key ) {
public function validate_textarea_field( $key ) {
$text = ( isset( $this->settings[ $key ] ) ) ? $this->settings[ $key ] : '';
if ( isset( $_POST[ $this->plugin_id . $this->id . '_' . $key ] ) ) {
@ -580,7 +580,7 @@ class WC_Settings_API {
* @since 1.0.0
* @return string
*/
function validate_select_field( $key ) {
public function validate_select_field( $key ) {
$value = ( isset( $this->settings[ $key ] ) ) ? $this->settings[ $key ] : '';
if ( isset( $_POST[ $this->plugin_id . $this->id . '_' . $key ] ) ) {
@ -600,7 +600,7 @@ class WC_Settings_API {
* @since 1.0.0
* @return string
*/
function validate_multiselect_field( $key ) {
public function validate_multiselect_field( $key ) {
$value = ( isset( $this->settings[ $key ] ) ) ? $this->settings[ $key ] : '';
if ( isset( $_POST[ $this->plugin_id . $this->id . '_' . $key ] ) ) {

View File

@ -10,7 +10,7 @@
class WC_Tax {
/** @var array */
var $matched_rates;
public $matched_rates;
/**
* __construct function.
@ -18,7 +18,7 @@ class WC_Tax {
* @access public
* @return void
*/
function __construct() {
public function __construct() {
$this->dp = (int) get_option( 'woocommerce_price_num_decimals' );
}
@ -29,7 +29,7 @@ class WC_Tax {
* @param string $args (default: '')
* @return array
*/
function find_rates( $args = '' ) {
public function find_rates( $args = '' ) {
global $wpdb;
$defaults = array(
@ -117,7 +117,7 @@ class WC_Tax {
* @param object Tax Class
* @return array
*/
function get_rates( $tax_class = '' ) {
public function get_rates( $tax_class = '' ) {
global $woocommerce;
$tax_class = sanitize_title( $tax_class );
@ -156,7 +156,7 @@ class WC_Tax {
* @param string Tax Class
* @return array
*/
function get_shop_base_rate( $tax_class = '' ) {
public function get_shop_base_rate( $tax_class = '' ) {
global $woocommerce;
$country = $woocommerce->countries->get_base_country();
@ -175,7 +175,7 @@ class WC_Tax {
* @param string Tax Class
* @return mixed
*/
function get_shipping_tax_rates( $tax_class = null ) {
public function get_shipping_tax_rates( $tax_class = null ) {
global $woocommerce;
// See if we have an explicitly set shipping tax class
@ -320,7 +320,7 @@ class WC_Tax {
* @param bool passed price includes tax
* @return array array of rates/amounts
*/
function calc_tax( $price, $rates, $price_includes_tax = true, $supress_rounding = false ) {
public function calc_tax( $price, $rates, $price_includes_tax = true, $supress_rounding = false ) {
$price = $price * 100; // To avoid float rounding errors, work with integers (pence)
@ -445,7 +445,7 @@ class WC_Tax {
* @param int Taxation Rate
* @return int
*/
function calc_shipping_tax( $price, $rates ) {
public function calc_shipping_tax( $price, $rates ) {
// Taxes array
$taxes = array();
@ -485,7 +485,7 @@ class WC_Tax {
* @param int key
* @return bool
*/
function is_compound( $key ) {
public function is_compound( $key ) {
global $wpdb;
return $wpdb->get_var( $wpdb->prepare( "SELECT tax_rate_compound FROM {$wpdb->prefix}woocommerce_tax_rates WHERE tax_rate_id = %s", $key ) ) ? true : false;
}
@ -496,7 +496,7 @@ class WC_Tax {
* @param int key
* @return string
*/
function get_rate_label( $key ) {
public function get_rate_label( $key ) {
global $wpdb;
return apply_filters( 'woocommerce_rate_label', $wpdb->get_var( $wpdb->prepare( "SELECT tax_rate_name FROM {$wpdb->prefix}woocommerce_tax_rates WHERE tax_rate_id = %s", $key ) ), $key, $this );
}
@ -508,7 +508,7 @@ class WC_Tax {
* @param mixed $key
* @return void
*/
function get_rate_code( $key ) {
public function get_rate_code( $key ) {
global $wpdb;
$rate = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}woocommerce_tax_rates WHERE tax_rate_id = %s", $key ) );
@ -529,7 +529,7 @@ class WC_Tax {
* @param array
* @return float
*/
function get_tax_total( $taxes ) {
public function get_tax_total( $taxes ) {
return array_sum( array_map( array(&$this, 'round'), $taxes ) );
}
@ -538,13 +538,13 @@ class WC_Tax {
*
* Filter example: to return rounding to .5 cents you'd use:
*
* function euro_5cent_rounding( $in ) {
* public function euro_5cent_rounding( $in ) {
* return round( $in / 5, 2 ) * 5;
* }
* add_filter( 'woocommerce_tax_round', 'euro_5cent_rounding' );
*
*/
function round( $in ) {
public function round( $in ) {
return apply_filters( 'woocommerce_tax_round', round( $in, $this->dp ), $in );
}

View File

@ -15,7 +15,7 @@ class WC_Validation {
* @param string email address
* @return bool
*/
function is_email( $email ) {
public function is_email( $email ) {
return is_email( $email );
}
@ -26,7 +26,7 @@ class WC_Validation {
* @param string phone number
* @return bool
*/
function is_phone( $phone ) {
public function is_phone( $phone ) {
if ( strlen( trim( preg_replace( '/[\s\#0-9_\-\+\(\)]/', '', $phone ) ) ) > 0 )
return false;
@ -41,7 +41,7 @@ class WC_Validation {
* @param string country
* @return bool
*/
function is_postcode( $postcode, $country ) {
public function is_postcode( $postcode, $country ) {
if ( strlen( trim( preg_replace( '/[\s\-A-Za-z0-9]/', '', $postcode ) ) ) > 0 )
return false;
@ -67,7 +67,7 @@ class WC_Validation {
* @param mixed $toCheck A postcode
* @return bool
*/
function is_GB_postcode( $toCheck ) {
public function is_GB_postcode( $toCheck ) {
// Permitted letters depend upon their position in the postcode.
$alpha1 = "[abcdefghijklmnoprstuwyz]"; // Character 1
@ -128,7 +128,7 @@ class WC_Validation {
* @param string country
* @return string formatted postcode
*/
function format_postcode( $postcode, $country ) {
public function format_postcode( $postcode, $country ) {
$postcode = strtoupper(trim($postcode));
$postcode = trim(preg_replace('/[\s]/', '', $postcode));
@ -146,7 +146,7 @@ class WC_Validation {
* @param mixed $tel
* @return string
*/
function format_phone( $tel ) {
public function format_phone( $tel ) {
$tel = str_replace( '.', '-', $tel );
return $tel;
}

View File

@ -37,87 +37,87 @@ class Woocommerce {
/**
* @var string
*/
var $version = '2.0.0';
public $version = '2.0.0';
/**
* @var string
*/
var $plugin_url;
public $plugin_url;
/**
* @var string
*/
var $plugin_path;
public $plugin_path;
/**
* @var string
*/
var $template_url;
public $template_url;
/**
* @var array
*/
var $errors = array();
public $errors = array();
/**
* @var array
*/
var $messages = array();
public $messages = array();
/**
* @var WC_Query
*/
var $query;
public $query;
/**
* @var WC_Customer
*/
var $customer;
public $customer;
/**
* @var WC_Shipping
*/
var $shipping;
public $shipping;
/**
* @var WC_Product_Factory
*/
var $product_factory;
public $product_factory;
/**
* @var WC_Cart
*/
var $cart;
public $cart;
/**
* @var WC_Payment_Gateways
*/
var $payment_gateways;
public $payment_gateways;
/**
* @var WC_Countries
*/
var $countries;
public $countries;
/**
* @var WC_Email
*/
var $woocommerce_email;
public $woocommerce_email;
/**
* @var WC_Checkout
*/
var $checkout;
public $checkout;
/**
* @var WC_Integrations
*/
var $integrations;
public $integrations;
/**
* @var array
*/
var $attribute_taxonomies;
public $attribute_taxonomies;
/**
* @var array
@ -136,7 +136,7 @@ class Woocommerce {
* @access public
* @return void
*/
function __construct() {
public function __construct() {
// Start a PHP session, if not yet started
if ( ! session_id() )
@ -173,7 +173,7 @@ class Woocommerce {
* @access public
* @return void
*/
function activate() {
public function activate() {
update_option( 'skip_install_woocommerce_pages', 0 );
update_option( 'woocommerce_installed', 1 );
$this->install();
@ -253,7 +253,7 @@ class Woocommerce {
* @access public
* @return void
*/
function admin_includes() {
public function admin_includes() {
include( 'admin/woocommerce-admin-init.php' ); // Admin section
}
@ -264,7 +264,7 @@ class Woocommerce {
* @access public
* @return void
*/
function ajax_includes() {
public function ajax_includes() {
include( 'woocommerce-ajax.php' ); // Ajax functions for admin and the front-end
}
@ -275,7 +275,7 @@ class Woocommerce {
* @access public
* @return void
*/
function frontend_includes() {
public function frontend_includes() {
include( 'woocommerce-hooks.php' ); // Template hooks used on the front-end
include( 'woocommerce-functions.php' ); // Contains functions for various front-end events
include( 'shortcodes/shortcode-init.php' ); // Init the shortcodes
@ -294,7 +294,7 @@ class Woocommerce {
* @access public
* @return void
*/
function include_template_functions() {
public function include_template_functions() {
include( 'woocommerce-template.php' );
}
@ -305,7 +305,7 @@ class Woocommerce {
* @access public
* @return void
*/
function init() {
public function init() {
//Before init action
do_action( 'before_woocommerce_init' );
@ -401,7 +401,7 @@ class Woocommerce {
* @access public
* @return void
*/
function api_requests() {
public function api_requests() {
if ( isset( $_GET['wc-api'] ) ) {
$api = strtolower( esc_attr( $_GET['wc-api'] ) );
do_action( 'woocommerce_api_' . $api );
@ -415,7 +415,7 @@ class Woocommerce {
* @access public
* @return void
*/
function load_plugin_textdomain() {
public function load_plugin_textdomain() {
// Note: the first-loaded translation file overrides any following ones if the same translation is present
$locale = apply_filters( 'plugin_locale', get_locale(), 'woocommerce' );
$variable_lang = ( get_option( 'woocommerce_informal_localisation_type' ) == 'yes' ) ? 'informal' : 'formal';
@ -441,7 +441,7 @@ class Woocommerce {
* @param mixed $template
* @return string
*/
function template_loader( $template ) {
public function template_loader( $template ) {
$find = array( 'woocommerce.php' );
$file = '';
@ -486,7 +486,7 @@ class Woocommerce {
* @param mixed $template
* @return string
*/
function comments_template_loader( $template ) {
public function comments_template_loader( $template ) {
if( get_post_type() !== 'product' ) return $template;
if (file_exists( STYLESHEETPATH . '/' . $this->template_url . 'single-product-reviews.php' ))
@ -502,7 +502,7 @@ class Woocommerce {
* @access public
* @return void
*/
function buffer_checkout() {
public function buffer_checkout() {
if ( is_checkout() ) ob_start();
}
@ -513,7 +513,7 @@ class Woocommerce {
* @access public
* @return void
*/
function register_globals() {
public function register_globals() {
$GLOBALS['product'] = null;
}
@ -525,7 +525,7 @@ class Woocommerce {
* @param mixed $post
* @return WC_Product
*/
function setup_product_data( $post ) {
public function setup_product_data( $post ) {
if ( is_int( $post ) ) $post = get_post( $post );
if ( $post->post_type !== 'product' ) return;
unset( $GLOBALS['product'] );
@ -540,7 +540,7 @@ class Woocommerce {
* @access public
* @return void
*/
function compatibility() {
public function compatibility() {
// Post thumbnail support
if ( ! current_theme_supports( 'post-thumbnails', 'product' ) ) {
add_theme_support( 'post-thumbnails' );
@ -576,7 +576,7 @@ class Woocommerce {
* @access public
* @return void
*/
function ssl_redirect() {
public function ssl_redirect() {
if ( get_option('woocommerce_force_ssl_checkout') == 'no' ) return;
if ( ! is_ssl() ) {
@ -614,7 +614,7 @@ class Woocommerce {
* @access public
* @return void
*/
function generator() {
public function generator() {
echo "\n\n" . '<!-- WooCommerce Version -->' . "\n" . '<meta name="generator" content="WooCommerce ' . esc_attr( $this->version ) . '" />' . "\n\n";
}
@ -625,7 +625,7 @@ class Woocommerce {
* @access public
* @return void
*/
function wp_head() {
public function wp_head() {
$theme_name = ( function_exists( 'wp_get_theme' ) ) ? wp_get_theme() : get_current_theme();
$this->add_body_class( "theme-{$theme_name}" );
@ -647,7 +647,7 @@ class Woocommerce {
* @access public
* @return void
*/
function init_taxonomy() {
public function init_taxonomy() {
if ( post_type_exists('product') )
return;
@ -1018,7 +1018,7 @@ class Woocommerce {
* @access public
* @return void
*/
function init_image_sizes() {
public function init_image_sizes() {
$shop_thumbnail = $this->get_image_size( 'shop_thumbnail' );
$shop_catalog = $this->get_image_size( 'shop_catalog' );
$shop_single = $this->get_image_size( 'shop_single' );
@ -1035,7 +1035,7 @@ class Woocommerce {
* @access public
* @return void
*/
function init_styles() {
public function init_styles() {
// Optional front end css
if ( ( defined('WOOCOMMERCE_USE_CSS') && WOOCOMMERCE_USE_CSS ) || ( ! defined('WOOCOMMERCE_USE_CSS') && get_option('woocommerce_frontend_css') == 'yes') ) {
@ -1052,7 +1052,7 @@ class Woocommerce {
* @access public
* @return void
*/
function frontend_scripts() {
public function frontend_scripts() {
global $post;
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
@ -1132,7 +1132,7 @@ class Woocommerce {
* @access public
* @return void
*/
function check_jquery() {
public function check_jquery() {
global $wp_scripts;
// Enforce minimum version of jQuery
@ -1151,7 +1151,7 @@ class Woocommerce {
* @access public
* @return WC_Checkout
*/
function checkout() {
public function checkout() {
if ( ! class_exists( 'WC_Checkout' ) ) {
include_once( 'classes/class-wc-checkout.php' );
$this->checkout = new WC_Checkout();
@ -1166,7 +1166,7 @@ class Woocommerce {
* @access public
* @return WC_Logger
*/
function logger() {
public function logger() {
if ( ! class_exists('WC_Logger') ) include( 'classes/class-wc-logger.php' );
return new WC_Logger();
}
@ -1178,7 +1178,7 @@ class Woocommerce {
* @access public
* @return WC_Validation
*/
function validation() {
public function validation() {
if ( ! class_exists('WC_Validation') ) include( 'classes/class-wc-validation.php' );
return new WC_Validation();
}
@ -1191,7 +1191,7 @@ class Woocommerce {
* @param mixed $code
* @return WC_Coupon
*/
function coupon( $code ) {
public function coupon( $code ) {
if ( ! class_exists('WC_Coupon') ) include( 'classes/class-wc-coupon.php' );
return new WC_Coupon( $code );
}
@ -1204,7 +1204,7 @@ class Woocommerce {
* @param array $args (default: array())
* @return void
*/
function send_transactional_email( $args = array() ) {
public function send_transactional_email( $args = array() ) {
$this->mailer();
do_action( current_filter() . '_notification', $args );
}
@ -1216,7 +1216,7 @@ class Woocommerce {
* @access public
* @return WC_Email
*/
function mailer() {
public function mailer() {
if ( empty( $this->woocommerce_email ) ) {
// Init mail class
if ( ! class_exists('WC_Emails') ) {
@ -1235,7 +1235,7 @@ class Woocommerce {
* @access public
* @return string
*/
function plugin_url() {
public function plugin_url() {
if ( $this->plugin_url ) return $this->plugin_url;
return $this->plugin_url = plugins_url( basename( plugin_dir_path(__FILE__) ), basename( __FILE__ ) );
}
@ -1247,7 +1247,7 @@ class Woocommerce {
* @access public
* @return string
*/
function plugin_path() {
public function plugin_path() {
if ( $this->plugin_path ) return $this->plugin_path;
return $this->plugin_path = untrailingslashit( plugin_dir_path( __FILE__ ) );
@ -1260,7 +1260,7 @@ class Woocommerce {
* @access public
* @return string
*/
function ajax_url() {
public function ajax_url() {
return admin_url( 'admin-ajax.php', 'relative' );
}
@ -1272,7 +1272,7 @@ class Woocommerce {
* @param string/array $content
* @return string/array
*/
function force_ssl( $content ) {
public function force_ssl( $content ) {
if ( is_ssl() ) {
if ( is_array($content) )
$content = array_map( array( &$this, 'force_ssl' ) , $content );
@ -1292,7 +1292,7 @@ class Woocommerce {
* @param mixed $image_size
* @return string
*/
function get_image_size( $image_size ) {
public function get_image_size( $image_size ) {
// Only return sizes we define in settings
if ( ! in_array( $image_size, array( 'shop_thumbnail', 'shop_catalog', 'shop_single' ) ) )
@ -1315,7 +1315,7 @@ class Woocommerce {
* @access public
* @return void
*/
function load_messages() {
public function load_messages() {
$this->errors = $this->session->errors;
$this->messages = $this->session->messages;
unset( $this->session->errors, $this->session->messages );
@ -1333,7 +1333,7 @@ class Woocommerce {
* @param string $error
* @return void
*/
function add_error( $error ) {
public function add_error( $error ) {
$this->errors[] = apply_filters( 'woocommerce_add_error', $error );
}
@ -1345,7 +1345,7 @@ class Woocommerce {
* @param string $message
* @return void
*/
function add_message( $message ) {
public function add_message( $message ) {
$this->messages[] = apply_filters( 'woocommerce_add_message', $message );
}
@ -1356,7 +1356,7 @@ class Woocommerce {
* @access public
* @return void
*/
function clear_messages() {
public function clear_messages() {
$this->errors = $this->messages = array();
unset( $this->session->errors, $this->session->messages );
}
@ -1368,7 +1368,7 @@ class Woocommerce {
* @access public
* @return int
*/
function error_count() {
public function error_count() {
return sizeof( $this->errors );
}
@ -1379,7 +1379,7 @@ class Woocommerce {
* @access public
* @return int
*/
function message_count() {
public function message_count() {
return sizeof( $this->messages );
}
@ -1390,7 +1390,7 @@ class Woocommerce {
* @access public
* @return array
*/
function get_errors() {
public function get_errors() {
return (array) $this->errors;
}
@ -1401,7 +1401,7 @@ class Woocommerce {
* @access public
* @return array
*/
function get_messages() {
public function get_messages() {
return (array) $this->messages;
}
@ -1412,7 +1412,7 @@ class Woocommerce {
* @access public
* @return void
*/
function show_messages() {
public function show_messages() {
woocommerce_show_messages();
}
@ -1423,7 +1423,7 @@ class Woocommerce {
* @access public
* @return void
*/
function set_messages() {
public function set_messages() {
$this->session->errors = $this->errors;
$this->session->messages = $this->messages;
}
@ -1437,7 +1437,7 @@ class Woocommerce {
* @param mixed $status
* @return string
*/
function redirect( $location, $status ) {
public function redirect( $location, $status ) {
$this->set_messages();
return apply_filters( 'woocommerce_redirect', $location );
@ -1451,7 +1451,7 @@ class Woocommerce {
* @access public
* @return object
*/
function get_attribute_taxonomies() {
public function get_attribute_taxonomies() {
global $wpdb;
if ( ! $this->attribute_taxonomies )
$this->attribute_taxonomies = $wpdb->get_results( "SELECT * FROM " . $wpdb->prefix . "woocommerce_attribute_taxonomies" );
@ -1466,7 +1466,7 @@ class Woocommerce {
* @param mixed $name
* @return string
*/
function attribute_taxonomy_name( $name ) {
public function attribute_taxonomy_name( $name ) {
return 'pa_' . woocommerce_sanitize_taxonomy_name( $name );
}
@ -1478,7 +1478,7 @@ class Woocommerce {
* @param mixed $name
* @return string
*/
function attribute_label( $name ) {
public function attribute_label( $name ) {
global $wpdb;
if ( strstr( $name, 'pa_' ) ) {
@ -1503,7 +1503,7 @@ class Woocommerce {
* @param mixed $name
* @return string
*/
function attribute_orderby( $name ) {
public function attribute_orderby( $name ) {
global $wpdb;
$name = str_replace( 'pa_', '', sanitize_title( $name ) );
@ -1521,7 +1521,7 @@ class Woocommerce {
* @access public
* @return array
*/
function get_attribute_taxonomy_names() {
public function get_attribute_taxonomy_names() {
$taxonomy_names = array();
$attribute_taxonomies = $this->get_attribute_taxonomies();
if ( $attribute_taxonomies ) {
@ -1540,7 +1540,7 @@ class Woocommerce {
* @access public
* @return array
*/
function get_coupon_discount_types() {
public function get_coupon_discount_types() {
if ( ! isset($this->coupon_discount_types ) ) {
$this->coupon_discount_types = apply_filters( 'woocommerce_coupon_discount_types', array(
'fixed_cart' => __( 'Cart Discount', 'woocommerce' ),
@ -1560,7 +1560,7 @@ class Woocommerce {
* @param string $type (default: '')
* @return string
*/
function get_coupon_discount_type( $type = '' ) {
public function get_coupon_discount_type( $type = '' ) {
$types = (array) $this->get_coupon_discount_types();
if ( isset( $types[$type] ) ) return $types[$type];
}
@ -1576,7 +1576,7 @@ class Woocommerce {
* @param bool $echo (default: true)
* @return void
*/
function nonce_field( $action, $referer = true , $echo = true ) {
public function nonce_field( $action, $referer = true , $echo = true ) {
return wp_nonce_field('woocommerce-' . $action, '_n', $referer, $echo );
}
@ -1589,7 +1589,7 @@ class Woocommerce {
* @param string $url (default: '')
* @return string
*/
function nonce_url( $action, $url = '' ) {
public function nonce_url( $action, $url = '' ) {
return add_query_arg( '_n', wp_create_nonce( 'woocommerce-' . $action ), $url );
}
@ -1606,7 +1606,7 @@ class Woocommerce {
* @param string $error_message custom error message, or false for default message, or an empty string to fail silently
* @return bool
*/
function verify_nonce( $action, $method='_POST', $error_message = false ) {
public function verify_nonce( $action, $method='_POST', $error_message = false ) {
$name = '_n';
$action = 'woocommerce-' . $action;
@ -1632,7 +1632,7 @@ class Woocommerce {
* @param array $atts (default: array())
* @return string
*/
function shortcode_wrapper(
public function shortcode_wrapper(
$function,
$atts = array(),
$wrapper = array(
@ -1661,7 +1661,7 @@ class Woocommerce {
* @access public
* @return void
*/
function nocache() {
public function nocache() {
if ( ! defined('DONOTCACHEPAGE') ) define("DONOTCACHEPAGE", "true"); // WP Super Cache constant
}
@ -1673,7 +1673,7 @@ class Woocommerce {
* @param mixed $set
* @return void
*/
function cart_has_contents_cookie( $set ) {
public function cart_has_contents_cookie( $set ) {
if ( ! headers_sent() ) {
if ($set)
setcookie( "woocommerce_items_in_cart", "1", 0, COOKIEPATH, COOKIE_DOMAIN, false );
@ -1693,7 +1693,7 @@ class Woocommerce {
* @param mixed $function
* @return void
*/
function mfunc_wrapper( $mfunction, $function, $args ) {
public function mfunc_wrapper( $mfunction, $function, $args ) {
global $wp_super_cache_late_init;
if ( is_null( $wp_super_cache_late_init ) || $wp_super_cache_late_init == 1 ) {
@ -1714,7 +1714,7 @@ class Woocommerce {
* @param int $post_id (default: 0)
* @return void
*/
function clear_product_transients( $post_id = 0 ) {
public function clear_product_transients( $post_id = 0 ) {
global $wpdb;
$post_id = absint( $post_id );
@ -1773,7 +1773,7 @@ class Woocommerce {
* @param string $class
* @return void
*/
function add_body_class( $class ) {
public function add_body_class( $class ) {
$this->_body_classes[] = sanitize_html_class( strtolower($class) );
}
@ -1784,7 +1784,7 @@ class Woocommerce {
* @param mixed $classes
* @return array
*/
function output_body_class( $classes ) {
public function output_body_class( $classes ) {
if ( sizeof( $this->_body_classes ) > 0 ) $classes = array_merge( $classes, $this->_body_classes );
if ( is_singular('product') ) {
@ -1804,7 +1804,7 @@ class Woocommerce {
* @param string $code
* @return void
*/
function add_inline_js( $code ) {
public function add_inline_js( $code ) {
$this->_inline_js .= "\n" . $code . "\n";
}
@ -1814,7 +1814,7 @@ class Woocommerce {
* @access public
* @return void
*/
function output_inline_js() {
public function output_inline_js() {
if ( $this->_inline_js ) {
echo "<!-- WooCommerce JavaScript-->\n<script type=\"text/javascript\">\njQuery(document).ready(function($) {";