Constants
This commit is contained in:
parent
af6996866e
commit
e143d344e5
|
@ -162,8 +162,8 @@ class WC_Admin_Assets {
|
|||
'currency_format_decimal_sep' => esc_attr( stripslashes( get_option( 'woocommerce_price_decimal_sep' ) ) ),
|
||||
'currency_format_thousand_sep' => esc_attr( stripslashes( get_option( 'woocommerce_price_thousand_sep' ) ) ),
|
||||
'currency_format' => esc_attr( str_replace( array( '%1$s', '%2$s' ), array( '%s', '%v' ), get_woocommerce_price_format() ) ), // For accounting JS
|
||||
'rounding_precision' => WOOCOMMERCE_ROUNDING_PRECISION,
|
||||
'tax_rounding_mode' => WOOCOMMERCE_TAX_ROUNDING_MODE,
|
||||
'rounding_precision' => WC_ROUNDING_PRECISION,
|
||||
'tax_rounding_mode' => WC_TAX_ROUNDING_MODE,
|
||||
'product_types' => array_map( 'sanitize_title', get_terms( 'product_type', array( 'hide_empty' => false, 'fields' => 'names' ) ) ),
|
||||
'default_attribute_visibility' => apply_filters( 'default_attribute_visibility', false ),
|
||||
'default_attribute_variation' => apply_filters( 'default_attribute_variation', false ),
|
||||
|
|
|
@ -29,7 +29,7 @@ class WC_Admin_Notices {
|
|||
*/
|
||||
public function add_notices() {
|
||||
if ( get_option( '_wc_needs_update' ) == 1 || get_option( '_wc_needs_pages' ) == 1 ) {
|
||||
wp_enqueue_style( 'woocommerce-activation', plugins_url( '/assets/css/activation.css', WOOCOMMERCE_PLUGIN_FILE ) );
|
||||
wp_enqueue_style( 'woocommerce-activation', plugins_url( '/assets/css/activation.css', WC_PLUGIN_FILE ) );
|
||||
add_action( 'admin_notices', array( $this, 'install_notice' ) );
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ class WC_Admin_Notices {
|
|||
}
|
||||
|
||||
if ( get_option( 'woocommerce_theme_support_check' ) !== $template ) {
|
||||
wp_enqueue_style( 'woocommerce-activation', plugins_url( '/assets/css/activation.css', WOOCOMMERCE_PLUGIN_FILE ) );
|
||||
wp_enqueue_style( 'woocommerce-activation', plugins_url( '/assets/css/activation.css', WC_PLUGIN_FILE ) );
|
||||
add_action( 'admin_notices', array( $this, 'theme_check_notice' ) );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ class WC_Admin_Welcome {
|
|||
* @return void
|
||||
*/
|
||||
public function admin_css() {
|
||||
wp_enqueue_style( 'woocommerce-activation', plugins_url( '/assets/css/activation.css', WOOCOMMERCE_PLUGIN_FILE ) );
|
||||
wp_enqueue_style( 'woocommerce-activation', plugins_url( '/assets/css/activation.css', WC_PLUGIN_FILE ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -469,7 +469,7 @@ class WC_Meta_Box_Product_Data {
|
|||
$values = array();
|
||||
foreach ( $post_terms as $term )
|
||||
$values[] = $term->name;
|
||||
echo esc_attr( implode( ' ' . WOOCOMMERCE_DELIMITER . ' ', $values ) );
|
||||
echo esc_attr( implode( ' ' . WC_DELIMITER . ' ', $values ) );
|
||||
}
|
||||
|
||||
?>" placeholder="<?php _e( 'Pipe (|) separate terms', 'woocommerce' ); ?>" />
|
||||
|
@ -898,7 +898,7 @@ class WC_Meta_Box_Product_Data {
|
|||
|
||||
} else {
|
||||
|
||||
$options = array_map( 'trim', explode( WOOCOMMERCE_DELIMITER, $attribute['value'] ) );
|
||||
$options = array_map( 'trim', explode( WC_DELIMITER, $attribute['value'] ) );
|
||||
|
||||
foreach ( $options as $option )
|
||||
echo '<option ' . selected( sanitize_title( $variation_selected_value ), sanitize_title( $option ), false ) . ' value="' . esc_attr( sanitize_title( $option ) ) . '">' . esc_html( apply_filters( 'woocommerce_variation_option_name', $option ) ) . '</option>';
|
||||
|
@ -1036,7 +1036,7 @@ class WC_Meta_Box_Product_Data {
|
|||
|
||||
// Text based attributes - Posted values are term names - don't change to slugs
|
||||
} else {
|
||||
$values = array_map( 'stripslashes', array_map( 'strip_tags', explode( WOOCOMMERCE_DELIMITER, $attribute_values[ $i ] ) ) );
|
||||
$values = array_map( 'stripslashes', array_map( 'strip_tags', explode( WC_DELIMITER, $attribute_values[ $i ] ) ) );
|
||||
}
|
||||
|
||||
// Remove empty items in the array
|
||||
|
@ -1065,7 +1065,7 @@ class WC_Meta_Box_Product_Data {
|
|||
} elseif ( isset( $attribute_values[ $i ] ) ) {
|
||||
|
||||
// Text based, separate by pipe
|
||||
$values = implode( ' ' . WOOCOMMERCE_DELIMITER . ' ', array_map( 'woocommerce_clean', explode( WOOCOMMERCE_DELIMITER, $attribute_values[ $i ] ) ) );
|
||||
$values = implode( ' ' . WC_DELIMITER . ' ', array_map( 'woocommerce_clean', explode( WC_DELIMITER, $attribute_values[ $i ] ) ) );
|
||||
|
||||
// Custom attribute - Add attribute to array and set the values
|
||||
$attributes[ sanitize_title( $attribute_names[ $i ] ) ] = array(
|
||||
|
|
|
@ -30,7 +30,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
|||
|
||||
} else {
|
||||
|
||||
$options = array_map( 'trim', explode( WOOCOMMERCE_DELIMITER, $attribute['value'] ) );
|
||||
$options = array_map( 'trim', explode( WC_DELIMITER, $attribute['value'] ) );
|
||||
|
||||
foreach ( $options as $option ) {
|
||||
echo '<option ' . selected( sanitize_title( $variation_selected_value ), sanitize_title( $option ), false ) . ' value="' . esc_attr( sanitize_title( $option ) ) . '">' . esc_html( apply_filters( 'woocommerce_variation_option_name', $option ) ) . '</option>';
|
||||
|
|
|
@ -506,7 +506,7 @@ class WC_Form_Handler {
|
|||
$variations[ $taxonomy ] = $value;
|
||||
else {
|
||||
// For custom attributes, get the name from the slug
|
||||
$options = array_map( 'trim', explode( WOOCOMMERCE_DELIMITER, $attribute['value'] ) );
|
||||
$options = array_map( 'trim', explode( WC_DELIMITER, $attribute['value'] ) );
|
||||
foreach ( $options as $option ) {
|
||||
if ( sanitize_title( $option ) == $value ) {
|
||||
$value = $option;
|
||||
|
|
|
@ -22,19 +22,19 @@ class WC_Frontend_Scripts {
|
|||
'woocommerce-layout' => array(
|
||||
'src' => str_replace( array( 'http:', 'https:' ), '', WC()->plugin_url() ) . '/assets/css/woocommerce-layout.css',
|
||||
'deps' => '',
|
||||
'version' => WOOCOMMERCE_VERSION,
|
||||
'version' => WC_VERSION,
|
||||
'media' => ''
|
||||
),
|
||||
'woocommerce-smallscreen' => array(
|
||||
'src' => str_replace( array( 'http:', 'https:' ), '', WC()->plugin_url() ) . '/assets/css/woocommerce-smallscreen.css',
|
||||
'deps' => 'woocommerce-layout',
|
||||
'version' => WOOCOMMERCE_VERSION,
|
||||
'version' => WC_VERSION,
|
||||
'media' => 'only screen and (max-width: ' . apply_filters( 'woocommerce_style_smallscreen_breakpoint', $breakpoint = '768px' ) . ')'
|
||||
),
|
||||
'woocommerce-general' => array(
|
||||
'src' => str_replace( array( 'http:', 'https:' ), '', WC()->plugin_url() ) . '/assets/css/woocommerce.css',
|
||||
'deps' => '',
|
||||
'version' => WOOCOMMERCE_VERSION,
|
||||
'version' => WC_VERSION,
|
||||
'media' => ''
|
||||
),
|
||||
) );
|
||||
|
@ -58,35 +58,35 @@ class WC_Frontend_Scripts {
|
|||
// Register any scripts for later use, or used as dependencies
|
||||
wp_register_script( 'chosen', $assets_path . 'js/chosen/chosen.jquery' . $suffix . '.js', array( 'jquery' ), '0.9.14', true );
|
||||
wp_register_script( 'jquery-blockui', $assets_path . 'js/jquery-blockui/jquery.blockUI' . $suffix . '.js', array( 'jquery' ), '2.60', true );
|
||||
wp_register_script( 'jquery-placeholder', $assets_path . 'js/jquery-placeholder/jquery.placeholder' . $suffix . '.js', array( 'jquery' ), WOOCOMMERCE_VERSION, true );
|
||||
wp_register_script( 'jquery-placeholder', $assets_path . 'js/jquery-placeholder/jquery.placeholder' . $suffix . '.js', array( 'jquery' ), WC_VERSION, true );
|
||||
wp_register_script( 'jquery-payment', $assets_path . 'js/jquery-payment/jquery.payment' . $suffix . '.js', array( 'jquery' ), '1.0.2', true );
|
||||
wp_register_script( 'wc-credit-card-form', $assets_path . 'js/frontend/credit-card-form' . $suffix . '.js', array( 'jquery', 'jquery-payment' ), WOOCOMMERCE_VERSION, true );
|
||||
wp_register_script( 'wc-credit-card-form', $assets_path . 'js/frontend/credit-card-form' . $suffix . '.js', array( 'jquery', 'jquery-payment' ), WC_VERSION, true );
|
||||
|
||||
wp_register_script( 'wc-add-to-cart-variation', $frontend_script_path . 'add-to-cart-variation' . $suffix . '.js', array( 'jquery' ), WOOCOMMERCE_VERSION, true );
|
||||
wp_register_script( 'wc-single-product', $frontend_script_path . 'single-product' . $suffix . '.js', array( 'jquery' ), WOOCOMMERCE_VERSION, true );
|
||||
wp_register_script( 'wc-country-select', $frontend_script_path . 'country-select' . $suffix . '.js', array( 'jquery' ), WOOCOMMERCE_VERSION, true );
|
||||
wp_register_script( 'wc-add-to-cart-variation', $frontend_script_path . 'add-to-cart-variation' . $suffix . '.js', array( 'jquery' ), WC_VERSION, true );
|
||||
wp_register_script( 'wc-single-product', $frontend_script_path . 'single-product' . $suffix . '.js', array( 'jquery' ), WC_VERSION, true );
|
||||
wp_register_script( 'wc-country-select', $frontend_script_path . 'country-select' . $suffix . '.js', array( 'jquery' ), WC_VERSION, true );
|
||||
wp_register_script( 'jquery-cookie', $assets_path . 'js/jquery-cookie/jquery.cookie' . $suffix . '.js', array( 'jquery' ), '1.3.1', true );
|
||||
|
||||
// Queue frontend scripts conditionally
|
||||
if ( $ajax_cart_en )
|
||||
wp_enqueue_script( 'wc-add-to-cart', $frontend_script_path . 'add-to-cart' . $suffix . '.js', array( 'jquery' ), WOOCOMMERCE_VERSION, true );
|
||||
wp_enqueue_script( 'wc-add-to-cart', $frontend_script_path . 'add-to-cart' . $suffix . '.js', array( 'jquery' ), WC_VERSION, true );
|
||||
|
||||
if ( is_cart() )
|
||||
wp_enqueue_script( 'wc-cart', $frontend_script_path . 'cart' . $suffix . '.js', array( 'jquery', 'wc-country-select' ), WOOCOMMERCE_VERSION, true );
|
||||
wp_enqueue_script( 'wc-cart', $frontend_script_path . 'cart' . $suffix . '.js', array( 'jquery', 'wc-country-select' ), WC_VERSION, true );
|
||||
|
||||
if ( is_checkout() ) {
|
||||
|
||||
if ( get_option( 'woocommerce_enable_chosen' ) == 'yes' ) {
|
||||
wp_enqueue_script( 'wc-chosen', $frontend_script_path . 'chosen-frontend' . $suffix . '.js', array( 'chosen' ), WOOCOMMERCE_VERSION, true );
|
||||
wp_enqueue_script( 'wc-chosen', $frontend_script_path . 'chosen-frontend' . $suffix . '.js', array( 'chosen' ), WC_VERSION, true );
|
||||
wp_enqueue_style( 'woocommerce_chosen_styles', $assets_path . 'css/chosen.css' );
|
||||
}
|
||||
|
||||
wp_enqueue_script( 'wc-checkout', $frontend_script_path . 'checkout' . $suffix . '.js', array( 'jquery', 'woocommerce', 'wc-country-select' ), WOOCOMMERCE_VERSION, true );
|
||||
wp_enqueue_script( 'wc-checkout', $frontend_script_path . 'checkout' . $suffix . '.js', array( 'jquery', 'woocommerce', 'wc-country-select' ), WC_VERSION, true );
|
||||
}
|
||||
|
||||
if ( $lightbox_en && ( is_product() || ( ! empty( $post->post_content ) && strstr( $post->post_content, '[product_page' ) ) ) ) {
|
||||
wp_enqueue_script( 'prettyPhoto', $assets_path . 'js/prettyPhoto/jquery.prettyPhoto' . $suffix . '.js', array( 'jquery' ), '3.1.5', true );
|
||||
wp_enqueue_script( 'prettyPhoto-init', $assets_path . 'js/prettyPhoto/jquery.prettyPhoto.init' . $suffix . '.js', array( 'jquery' ), WOOCOMMERCE_VERSION, true );
|
||||
wp_enqueue_script( 'prettyPhoto-init', $assets_path . 'js/prettyPhoto/jquery.prettyPhoto.init' . $suffix . '.js', array( 'jquery' ), WC_VERSION, true );
|
||||
wp_enqueue_style( 'woocommerce_prettyPhoto_css', $assets_path . 'css/prettyPhoto.css' );
|
||||
}
|
||||
|
||||
|
@ -94,8 +94,8 @@ class WC_Frontend_Scripts {
|
|||
wp_enqueue_script( 'wc-single-product' );
|
||||
|
||||
// Global frontend scripts
|
||||
wp_enqueue_script( 'woocommerce', $frontend_script_path . 'woocommerce' . $suffix . '.js', array( 'jquery', 'jquery-blockui', 'jquery-placeholder' ), WOOCOMMERCE_VERSION, true );
|
||||
wp_enqueue_script( 'wc-cart-fragments', $frontend_script_path . 'cart-fragments' . $suffix . '.js', array( 'jquery', 'jquery-cookie' ), WOOCOMMERCE_VERSION, true );
|
||||
wp_enqueue_script( 'woocommerce', $frontend_script_path . 'woocommerce' . $suffix . '.js', array( 'jquery', 'jquery-blockui', 'jquery-placeholder' ), WC_VERSION, true );
|
||||
wp_enqueue_script( 'wc-cart-fragments', $frontend_script_path . 'cart-fragments' . $suffix . '.js', array( 'jquery', 'jquery-cookie' ), WC_VERSION, true );
|
||||
|
||||
// Variables for JS scripts
|
||||
wp_localize_script( 'woocommerce', 'woocommerce_params', apply_filters( 'woocommerce_params', array(
|
||||
|
|
|
@ -21,7 +21,7 @@ class WC_Install {
|
|||
* Hook in tabs.
|
||||
*/
|
||||
public function __construct() {
|
||||
register_activation_hook( WOOCOMMERCE_PLUGIN_FILE, array( $this, 'install' ) );
|
||||
register_activation_hook( WC_PLUGIN_FILE, array( $this, 'install' ) );
|
||||
|
||||
add_action( 'admin_init', array( $this, 'install_actions' ) );
|
||||
add_action( 'admin_init', array( $this, 'check_version' ), 5 );
|
||||
|
@ -165,7 +165,7 @@ class WC_Install {
|
|||
update_option( 'woocommerce_db_version', '2.0.14' );
|
||||
}
|
||||
|
||||
if ( version_compare( $current_db_version, '2.1.0', '<' ) || WOOCOMMERCE_VERSION == '2.1-bleeding' ) {
|
||||
if ( version_compare( $current_db_version, '2.1.0', '<' ) || WC_VERSION == '2.1-bleeding' ) {
|
||||
include( 'updates/woocommerce-update-2.1.php' );
|
||||
update_option( 'woocommerce_db_version', '2.1.0' );
|
||||
}
|
||||
|
@ -639,7 +639,7 @@ class WC_Install {
|
|||
|
||||
// Output Upgrade Notice
|
||||
$matches = null;
|
||||
$regexp = '~==\s*Upgrade Notice\s*==\s*=\s*[0-9.]+\s*=(.*)(=\s*' . preg_quote( WOOCOMMERCE_VERSION ) . '\s*=|$)~Uis';
|
||||
$regexp = '~==\s*Upgrade Notice\s*==\s*=\s*[0-9.]+\s*=(.*)(=\s*' . preg_quote( WC_VERSION ) . '\s*=|$)~Uis';
|
||||
|
||||
if ( preg_match( $regexp, $response['body'], $matches ) ) {
|
||||
$notices = (array) preg_split('~[\r\n]+~', trim( $matches[1] ) );
|
||||
|
@ -655,7 +655,7 @@ class WC_Install {
|
|||
|
||||
// Output Changelog
|
||||
$matches = null;
|
||||
$regexp = '~==\s*Changelog\s*==\s*=\s*[0-9.]+\s*-(.*)=(.*)(=\s*' . preg_quote( WOOCOMMERCE_VERSION ) . '\s*-(.*)=|$)~Uis';
|
||||
$regexp = '~==\s*Changelog\s*==\s*=\s*[0-9.]+\s*-(.*)=(.*)(=\s*' . preg_quote( WC_VERSION ) . '\s*-(.*)=|$)~Uis';
|
||||
|
||||
if ( preg_match( $regexp, $response['body'], $matches ) ) {
|
||||
$changelog = (array) preg_split('~[\r\n]+~', trim( $matches[2] ) );
|
||||
|
|
|
@ -312,7 +312,7 @@ class WC_Product_Variable extends WC_Product {
|
|||
foreach ( $post_terms as $term )
|
||||
$values[] = $term->slug;
|
||||
} else {
|
||||
$values = array_map( 'trim', explode( WOOCOMMERCE_DELIMITER, $attribute['value'] ) );
|
||||
$values = array_map( 'trim', explode( WC_DELIMITER, $attribute['value'] ) );
|
||||
}
|
||||
|
||||
$values = array_unique( $values );
|
||||
|
@ -320,7 +320,7 @@ class WC_Product_Variable extends WC_Product {
|
|||
// Order custom attributes (non taxonomy) as defined
|
||||
} elseif ( ! $attribute['is_taxonomy'] ) {
|
||||
|
||||
$option_names = array_map( 'trim', explode( WOOCOMMERCE_DELIMITER, $attribute['value'] ) );
|
||||
$option_names = array_map( 'trim', explode( WC_DELIMITER, $attribute['value'] ) );
|
||||
$option_slugs = $values;
|
||||
$values = array();
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ class WC_Tax {
|
|||
* @return void
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->precision = WOOCOMMERCE_ROUNDING_PRECISION;
|
||||
$this->precision = WC_ROUNDING_PRECISION;
|
||||
$this->dp = (int) get_option( 'woocommerce_price_num_decimals' );
|
||||
$this->round_at_subtotal = get_option('woocommerce_tax_round_at_subtotal') == 'yes';
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ class WC_Template_Loader {
|
|||
|
||||
$file = 'single-product.php';
|
||||
$find[] = $file;
|
||||
$find[] = WOOCOMMERCE_TEMPLATE_PATH . $file;
|
||||
$find[] = WC_TEMPLATE_PATH . $file;
|
||||
|
||||
} elseif ( is_tax( 'product_cat' ) || is_tax( 'product_tag' ) ) {
|
||||
|
||||
|
@ -49,15 +49,15 @@ class WC_Template_Loader {
|
|||
|
||||
$file = 'taxonomy-' . $term->taxonomy . '.php';
|
||||
$find[] = 'taxonomy-' . $term->taxonomy . '-' . $term->slug . '.php';
|
||||
$find[] = WOOCOMMERCE_TEMPLATE_PATH . 'taxonomy-' . $term->taxonomy . '-' . $term->slug . '.php';
|
||||
$find[] = WC_TEMPLATE_PATH . 'taxonomy-' . $term->taxonomy . '-' . $term->slug . '.php';
|
||||
$find[] = $file;
|
||||
$find[] = WOOCOMMERCE_TEMPLATE_PATH . $file;
|
||||
$find[] = WC_TEMPLATE_PATH . $file;
|
||||
|
||||
} elseif ( is_post_type_archive( 'product' ) || is_page( woocommerce_get_page_id( 'shop' ) ) ) {
|
||||
|
||||
$file = 'archive-product.php';
|
||||
$find[] = $file;
|
||||
$find[] = WOOCOMMERCE_TEMPLATE_PATH . $file;
|
||||
$find[] = WC_TEMPLATE_PATH . $file;
|
||||
|
||||
}
|
||||
|
||||
|
@ -81,10 +81,10 @@ class WC_Template_Loader {
|
|||
if ( get_post_type() !== 'product' )
|
||||
return $template;
|
||||
|
||||
if ( file_exists( STYLESHEETPATH . '/' . WOOCOMMERCE_TEMPLATE_PATH . 'single-product-reviews.php' ))
|
||||
return STYLESHEETPATH . '/' . WOOCOMMERCE_TEMPLATE_PATH . 'single-product-reviews.php';
|
||||
elseif ( file_exists( TEMPLATEPATH . '/' . WOOCOMMERCE_TEMPLATE_PATH . 'single-product-reviews.php' ))
|
||||
return TEMPLATEPATH . '/' . WOOCOMMERCE_TEMPLATE_PATH . 'single-product-reviews.php';
|
||||
if ( file_exists( STYLESHEETPATH . '/' . WC_TEMPLATE_PATH . 'single-product-reviews.php' ))
|
||||
return STYLESHEETPATH . '/' . WC_TEMPLATE_PATH . 'single-product-reviews.php';
|
||||
elseif ( file_exists( TEMPLATEPATH . '/' . WC_TEMPLATE_PATH . 'single-product-reviews.php' ))
|
||||
return TEMPLATEPATH . '/' . WC_TEMPLATE_PATH . 'single-product-reviews.php';
|
||||
elseif ( file_exists( STYLESHEETPATH . '/' . 'single-product-reviews.php' ))
|
||||
return STYLESHEETPATH . '/' . 'single-product-reviews.php';
|
||||
elseif ( file_exists( TEMPLATEPATH . '/' . 'single-product-reviews.php' ))
|
||||
|
|
|
@ -803,7 +803,7 @@ class WC_Gateway_Paypal extends WC_Payment_Gateway {
|
|||
'sslverify' => false,
|
||||
'timeout' => 60,
|
||||
'httpversion' => '1.1',
|
||||
'user-agent' => 'WooCommerce/' . WOOCOMMERCE_VERSION
|
||||
'user-agent' => 'WooCommerce/' . WC_VERSION
|
||||
);
|
||||
|
||||
// Post back to get a response
|
||||
|
|
|
@ -243,7 +243,7 @@ class WC_Shipping_Flat_Rate extends WC_Shipping_Method {
|
|||
// Loop options
|
||||
foreach ( $this->options as $option ) {
|
||||
|
||||
$this_option = array_map( 'trim', explode( WOOCOMMERCE_DELIMITER, $option ) );
|
||||
$this_option = array_map( 'trim', explode( WC_DELIMITER, $option ) );
|
||||
|
||||
if ( sizeof( $this_option ) !== 3 ) continue;
|
||||
|
||||
|
|
|
@ -168,7 +168,7 @@ function woocommerce_round_tax_total( $tax ) {
|
|||
if ( version_compare( phpversion(), '5.3', '<' ) ) {
|
||||
$tax = round( $tax, $dp );
|
||||
} else {
|
||||
$tax = round( $tax, $dp, WOOCOMMERCE_TAX_ROUNDING_MODE );
|
||||
$tax = round( $tax, $dp, WC_TAX_ROUNDING_MODE );
|
||||
}
|
||||
return $tax;
|
||||
}
|
||||
|
|
|
@ -87,7 +87,7 @@ function wc_setup_product_data( $post ) {
|
|||
* @return void
|
||||
*/
|
||||
function wc_generator_tag() {
|
||||
echo "\n\n" . '<!-- WooCommerce Version -->' . "\n" . '<meta name="generator" content="WooCommerce ' . esc_attr( WOOCOMMERCE_VERSION ) . '" />' . "\n\n";
|
||||
echo "\n\n" . '<!-- WooCommerce Version -->' . "\n" . '<meta name="generator" content="WooCommerce ' . esc_attr( WC_VERSION ) . '" />' . "\n\n";
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -183,7 +183,7 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc
|
|||
* Feature - Handling for password protected products.
|
||||
* Feature - Schema markup selector for downloadables.
|
||||
* Feature - woocommerce_get_featured_product_ids function.
|
||||
* Feature - WOOCOMMERCE_DELIMITER to customise the pipes for attributes
|
||||
* Feature - WC_DELIMITER to customise the pipes for attributes
|
||||
* Feature - Standardized, default credit card form for gateways to use if they support 'default_credit_card_form'.
|
||||
* Feature - Coupon usage limits per user (using email + ID).
|
||||
* Tweak - Added pagination to tax rate screens.
|
||||
|
|
|
@ -59,7 +59,7 @@ if ( empty( $attributes ) && ( ! $product->enable_dimensions_display() || ( ! $p
|
|||
} else {
|
||||
|
||||
// Convert pipes to commas and display values
|
||||
$values = array_map( 'trim', explode( WOOCOMMERCE_DELIMITER, $attribute['value'] ) );
|
||||
$values = array_map( 'trim', explode( WC_DELIMITER, $attribute['value'] ) );
|
||||
echo apply_filters( 'woocommerce_attribute', wpautop( wptexturize( implode( ', ', $values ) ) ), $attribute, $values );
|
||||
|
||||
}
|
||||
|
|
|
@ -454,7 +454,7 @@ function woocommerce_save_attributes() {
|
|||
|
||||
// Text based attributes - Posted values are term names - don't change to slugs
|
||||
} else {
|
||||
$values = array_map( 'stripslashes', array_map( 'strip_tags', explode( WOOCOMMERCE_DELIMITER, $attribute_values[ $i ] ) ) );
|
||||
$values = array_map( 'stripslashes', array_map( 'strip_tags', explode( WC_DELIMITER, $attribute_values[ $i ] ) ) );
|
||||
}
|
||||
|
||||
// Remove empty items in the array
|
||||
|
@ -483,7 +483,7 @@ function woocommerce_save_attributes() {
|
|||
} elseif ( isset( $attribute_values[ $i ] ) ) {
|
||||
|
||||
// Text based, separate by pipe
|
||||
$values = implode( ' ' . WOOCOMMERCE_DELIMITER . ' ', array_map( 'woocommerce_clean', array_map( 'stripslashes', explode( WOOCOMMERCE_DELIMITER, $attribute_values[ $i ] ) ) ) );
|
||||
$values = implode( ' ' . WC_DELIMITER . ' ', array_map( 'woocommerce_clean', array_map( 'stripslashes', explode( WC_DELIMITER, $attribute_values[ $i ] ) ) ) );
|
||||
|
||||
// Custom attribute - Add attribute to array and set the values
|
||||
$attributes[ sanitize_title( $attribute_names[ $i ] ) ] = array(
|
||||
|
@ -635,7 +635,7 @@ function woocommerce_link_all_variations() {
|
|||
$options[] = $term->slug;
|
||||
}
|
||||
} else {
|
||||
$options = explode( WOOCOMMERCE_DELIMITER, $attribute['value'] );
|
||||
$options = explode( WC_DELIMITER, $attribute['value'] );
|
||||
}
|
||||
|
||||
$options = array_map( 'sanitize_title', array_map( 'trim', $options ) );
|
||||
|
|
|
@ -122,13 +122,7 @@ final class WooCommerce {
|
|||
spl_autoload_register( array( $this, 'autoload' ) );
|
||||
|
||||
// Define constants
|
||||
define( 'WOOCOMMERCE_PLUGIN_FILE', __FILE__ );
|
||||
define( 'WOOCOMMERCE_VERSION', $this->version );
|
||||
define( 'WOOCOMMERCE_TEMPLATE_PATH', $this->template_path() );
|
||||
define( 'WOOCOMMERCE_ROUNDING_PRECISION', 4 );
|
||||
define( 'WOOCOMMERCE_TAX_ROUNDING_MODE', 2 ); // 2 = PHP_ROUND_HALF_DOWN
|
||||
if ( ! defined( 'WOOCOMMERCE_DELIMITER' ) )
|
||||
define( 'WOOCOMMERCE_DELIMITER', '|' );
|
||||
$this->define_constants();
|
||||
|
||||
// Include required files
|
||||
$this->includes();
|
||||
|
@ -159,8 +153,8 @@ final class WooCommerce {
|
|||
return $this->$key();
|
||||
else switch( $key ) {
|
||||
case 'template_url':
|
||||
_deprecated_argument( 'Woocommerce->template_url', '2.1', 'WOOCOMMERCE_TEMPLATE_PATH constant' );
|
||||
return WOOCOMMERCE_TEMPLATE_PATH;
|
||||
_deprecated_argument( 'Woocommerce->template_url', '2.1', 'WC_TEMPLATE_PATH constant' );
|
||||
return WC_TEMPLATE_PATH;
|
||||
case 'messages':
|
||||
_deprecated_argument( 'Woocommerce->messages', '2.1', 'The "messages" field is moved to the messages helper class.' );
|
||||
return $this->session->get( 'wc_messages', array() );
|
||||
|
@ -249,10 +243,32 @@ final class WooCommerce {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Define WC Constants
|
||||
*/
|
||||
private function define_constants() {
|
||||
define( 'WC_PLUGIN_FILE', __FILE__ );
|
||||
define( 'WC_VERSION', $this->version );
|
||||
define( 'WOOCOMMERCE_VERSION', WC_VERSION ); // Backwards compat
|
||||
|
||||
if ( ! defined( 'WC_TEMPLATE_PATH' ) )
|
||||
define( 'WC_TEMPLATE_PATH', $this->template_path() );
|
||||
|
||||
if ( ! defined( 'WC_ROUNDING_PRECISION' ) )
|
||||
define( 'WC_ROUNDING_PRECISION', 4 );
|
||||
|
||||
// 1 = PHP_ROUND_HALF_UP, 2 = PHP_ROUND_HALF_DOWN
|
||||
if ( ! defined( 'WC_TAX_ROUNDING_MODE' ) )
|
||||
define( 'WC_TAX_ROUNDING_MODE', get_option( 'woocommerce_prices_include_tax' ) == 'yes' ? 2 : 1 );
|
||||
|
||||
if ( ! defined( 'WC_DELIMITER' ) )
|
||||
define( 'WC_DELIMITER', '|' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Include required core files used in admin and on the frontend.
|
||||
*/
|
||||
public function includes() {
|
||||
private function includes() {
|
||||
include( 'includes/wc-core-functions.php' );
|
||||
include( 'includes/class-wc-install.php' );
|
||||
include( 'includes/class-wc-download-handler.php' );
|
||||
|
@ -485,7 +501,7 @@ final class WooCommerce {
|
|||
* @return string
|
||||
*/
|
||||
public function template_path() {
|
||||
return apply_filters( 'woocommerce_template_path', 'woocommerce/' );
|
||||
return apply_filters( 'WC_TEMPLATE_PATH', 'woocommerce/' );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue