Remove pass by reference for objects

Done all files except for external libaries: shareyourcart, cssmin,
lessc

@mikejolley Should we update those libraries as well?
This commit is contained in:
Coen Jacobs 2012-12-15 12:53:32 +01:00
parent b5daf825a9
commit 7b5e74626a
37 changed files with 132 additions and 132 deletions

View File

@ -59,7 +59,7 @@ if ( class_exists( 'WP_Importer' ) ) {
else else
$file = ABSPATH . $this->file_url; $file = ABSPATH . $this->file_url;
add_filter( 'http_request_timeout', array( &$this, 'bump_request_timeout' ) ); add_filter( 'http_request_timeout', array( $this, 'bump_request_timeout' ) );
if ( function_exists( 'gc_enable' ) ) if ( function_exists( 'gc_enable' ) )
gc_enable(); gc_enable();

View File

@ -27,7 +27,7 @@ abstract class WC_Session {
*/ */
public function __construct() { public function __construct() {
// When leaving or ending page load, store data // When leaving or ending page load, store data
add_action( 'shutdown', array( &$this, 'save_data' ), 20 ); add_action( 'shutdown', array( $this, 'save_data' ), 20 );
} }
/** /**

View File

@ -90,7 +90,7 @@ class WC_Cart {
$this->display_totals_ex_tax = $this->tax_display_cart == 'excl' ? true : false; $this->display_totals_ex_tax = $this->tax_display_cart == 'excl' ? true : false;
$this->display_cart_ex_tax = $this->tax_display_cart == 'excl' ? true : false; $this->display_cart_ex_tax = $this->tax_display_cart == 'excl' ? true : false;
add_action( 'init', array( &$this, 'init' ), 5 ); // Get cart on init add_action( 'init', array( $this, 'init' ), 5 ); // Get cart on init
} }
@ -103,9 +103,9 @@ class WC_Cart {
function init() { function init() {
$this->get_cart_from_session(); $this->get_cart_from_session();
add_action('woocommerce_check_cart_items', array( &$this, 'check_cart_items' ), 1 ); add_action('woocommerce_check_cart_items', array( $this, 'check_cart_items' ), 1 );
add_action('woocommerce_check_cart_items', array( &$this, 'check_cart_coupons' ), 1 ); add_action('woocommerce_check_cart_items', array( $this, 'check_cart_coupons' ), 1 );
add_action('woocommerce_after_checkout_validation', array( &$this, 'check_customer_coupons' ), 1 ); add_action('woocommerce_after_checkout_validation', array( $this, 'check_customer_coupons' ), 1 );
} }
/*-----------------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------------*/
@ -1502,8 +1502,8 @@ class WC_Cart {
} }
// Round cart/shipping tax rows // Round cart/shipping tax rows
$this->taxes = array_map( array( &$this->tax, 'round' ), $this->taxes ); $this->taxes = array_map( array( $this->tax, 'round' ), $this->taxes );
$this->shipping_taxes = array_map( array( &$this->tax, 'round' ), $this->shipping_taxes ); $this->shipping_taxes = array_map( array( $this->tax, 'round' ), $this->shipping_taxes );
// Allow plugins to hook and alter totals before final total is calculated // Allow plugins to hook and alter totals before final total is calculated
do_action( 'woocommerce_calculate_totals', $this ); do_action( 'woocommerce_calculate_totals', $this );

View File

@ -35,9 +35,9 @@ class WC_Checkout {
function __construct () { function __construct () {
global $woocommerce; global $woocommerce;
add_action( 'woocommerce_checkout_process', array( &$this,'checkout_process' ) ); add_action( 'woocommerce_checkout_process', array( $this,'checkout_process' ) );
add_action( 'woocommerce_checkout_billing', array( &$this,'checkout_form_billing' ) ); add_action( 'woocommerce_checkout_billing', array( $this,'checkout_form_billing' ) );
add_action( 'woocommerce_checkout_shipping', array( &$this,'checkout_form_shipping' ) ); add_action( 'woocommerce_checkout_shipping', array( $this,'checkout_form_shipping' ) );
$this->enable_signup = get_option( 'woocommerce_enable_signup_and_login_from_checkout' ) == 'yes' ? true : false; $this->enable_signup = get_option( 'woocommerce_enable_signup_and_login_from_checkout' ) == 'yes' ? true : false;
$this->enable_guest_checkout = get_option( 'woocommerce_enable_guest_checkout' ) == 'yes' ? true : false; $this->enable_guest_checkout = get_option( 'woocommerce_enable_guest_checkout' ) == 'yes' ? true : false;

View File

@ -56,7 +56,7 @@ class WC_Customer {
} }
// When leaving or ending page load, store data // When leaving or ending page load, store data
add_action( 'shutdown', array( &$this, 'save_data' ), 10 ); add_action( 'shutdown', array( $this, 'save_data' ), 10 );
} }
/** /**

View File

@ -34,9 +34,9 @@ class WC_Query {
* @return void * @return void
*/ */
function __construct() { function __construct() {
add_filter( 'pre_get_posts', array( &$this, 'pre_get_posts') ); add_filter( 'pre_get_posts', array( $this, 'pre_get_posts') );
add_filter( 'the_posts', array( &$this, 'the_posts'), 11, 2 ); add_filter( 'the_posts', array( $this, 'the_posts'), 11, 2 );
add_filter( 'wp', array( &$this, 'remove_product_query') ); add_filter( 'wp', array( $this, 'remove_product_query') );
} }
@ -84,8 +84,8 @@ class WC_Query {
// Fix WP SEO // Fix WP SEO
if ( function_exists( 'wpseo_get_value' ) ) { if ( function_exists( 'wpseo_get_value' ) ) {
add_filter( 'wpseo_metadesc', array( &$this, 'wpseo_metadesc' ) ); add_filter( 'wpseo_metadesc', array( $this, 'wpseo_metadesc' ) );
add_filter( 'wpseo_metakey', array( &$this, 'wpseo_metakey' ) ); add_filter( 'wpseo_metakey', array( $this, 'wpseo_metakey' ) );
} }
} else { } else {
@ -99,7 +99,7 @@ class WC_Query {
$this->product_query( $q ); $this->product_query( $q );
// We're on a shop page so queue the woocommerce_get_products_in_view function // We're on a shop page so queue the woocommerce_get_products_in_view function
add_action( 'wp', array( &$this, 'get_products_in_view' ), 2); add_action( 'wp', array( $this, 'get_products_in_view' ), 2);
// And remove the pre_get_posts hook // And remove the pre_get_posts hook
$this->remove_product_query(); $this->remove_product_query();
@ -238,7 +238,7 @@ class WC_Query {
* @return void * @return void
*/ */
function remove_product_query() { function remove_product_query() {
remove_filter( 'pre_get_posts', array( &$this, 'pre_get_posts') ); remove_filter( 'pre_get_posts', array( $this, 'pre_get_posts') );
} }

View File

@ -122,7 +122,7 @@ class WC_Settings_API {
} }
// Set and decode escaped values // Set and decode escaped values
$this->settings = array_map( array( &$this, 'format_settings' ), $form_field_settings ); $this->settings = array_map( array( $this, 'format_settings' ), $form_field_settings );
} }
if ( isset( $this->settings['enabled'] ) && ( $this->settings['enabled'] == 'yes' ) ) if ( isset( $this->settings['enabled'] ) && ( $this->settings['enabled'] == 'yes' ) )

View File

@ -530,7 +530,7 @@ class WC_Tax {
* @return float * @return float
*/ */
function get_tax_total( $taxes ) { function get_tax_total( $taxes ) {
return array_sum( array_map( array(&$this, 'round'), $taxes ) ); return array_sum( array_map( array( $this, 'round' ), $taxes ) );
} }
/** /**

View File

@ -34,7 +34,7 @@ class WC_Email_Customer_Completed_Order extends WC_Email {
$this->template_plain = 'emails/plain/customer-completed-order.php'; $this->template_plain = 'emails/plain/customer-completed-order.php';
// Triggers for this email // Triggers for this email
add_action( 'woocommerce_order_status_completed_notification', array( &$this, 'trigger' ) ); add_action( 'woocommerce_order_status_completed_notification', array( $this, 'trigger' ) );
// Call parent constuctor // Call parent constuctor
parent::__construct(); parent::__construct();

View File

@ -36,7 +36,7 @@ class WC_Email_Customer_Note extends WC_Email {
$this->heading = __( 'A note has been added to your order', 'woocommerce'); $this->heading = __( 'A note has been added to your order', 'woocommerce');
// Triggers // Triggers
add_action( 'woocommerce_new_customer_note_notification', array( &$this, 'trigger' ) ); add_action( 'woocommerce_new_customer_note_notification', array( $this, 'trigger' ) );
// Call parent constuctor // Call parent constuctor
parent::__construct(); parent::__construct();

View File

@ -31,8 +31,8 @@ class WC_Email_Customer_Processing_Order extends WC_Email {
$this->template_plain = 'emails/plain/customer-processing-order.php'; $this->template_plain = 'emails/plain/customer-processing-order.php';
// Triggers for this email // Triggers for this email
add_action( 'woocommerce_order_status_pending_to_processing_notification', array( &$this, 'trigger' ) ); add_action( 'woocommerce_order_status_pending_to_processing_notification', array( $this, 'trigger' ) );
add_action( 'woocommerce_order_status_pending_to_on-hold_notification', array( &$this, 'trigger' ) ); add_action( 'woocommerce_order_status_pending_to_on-hold_notification', array( $this, 'trigger' ) );
// Call parent constuctor // Call parent constuctor
parent::__construct(); parent::__construct();

View File

@ -31,12 +31,12 @@ class WC_Email_New_Order extends WC_Email {
$this->template_plain = 'emails/plain/admin-new-order.php'; $this->template_plain = 'emails/plain/admin-new-order.php';
// Triggers for this email // Triggers for this email
add_action( 'woocommerce_order_status_pending_to_processing_notification', array( &$this, 'trigger' ) ); add_action( 'woocommerce_order_status_pending_to_processing_notification', array( $this, 'trigger' ) );
add_action( 'woocommerce_order_status_pending_to_completed_notification', array( &$this, 'trigger' ) ); add_action( 'woocommerce_order_status_pending_to_completed_notification', array( $this, 'trigger' ) );
add_action( 'woocommerce_order_status_pending_to_on-hold_notification', array( &$this, 'trigger' ) ); add_action( 'woocommerce_order_status_pending_to_on-hold_notification', array( $this, 'trigger' ) );
add_action( 'woocommerce_order_status_failed_to_processing_notification', array( &$this, 'trigger' ) ); add_action( 'woocommerce_order_status_failed_to_processing_notification', array( $this, 'trigger' ) );
add_action( 'woocommerce_order_status_failed_to_completed_notification', array( &$this, 'trigger' ) ); add_action( 'woocommerce_order_status_failed_to_completed_notification', array( $this, 'trigger' ) );
add_action( 'woocommerce_order_status_failed_to_on-hold_notification', array( &$this, 'trigger' ) ); add_action( 'woocommerce_order_status_failed_to_on-hold_notification', array( $this, 'trigger' ) );
// Call parent constuctor // Call parent constuctor
parent::__construct(); parent::__construct();

View File

@ -134,7 +134,7 @@ class WC_Email extends WC_Settings_API {
$this->init_settings(); $this->init_settings();
// Save settings hook // Save settings hook
add_action( 'woocommerce_update_options_email_' . $this->id, array( &$this, 'process_admin_options' ) ); add_action( 'woocommerce_update_options_email_' . $this->id, array( $this, 'process_admin_options' ) );
// Settings // Settings
$this->template_base = $woocommerce->plugin_path() . '/templates/'; $this->template_base = $woocommerce->plugin_path() . '/templates/';
@ -148,7 +148,7 @@ class WC_Email extends WC_Settings_API {
$this->replace = array( $this->get_blogname() ); $this->replace = array( $this->get_blogname() );
// For multipart messages // For multipart messages
add_filter( 'phpmailer_init', array( &$this, 'handle_multipart' ) ); add_filter( 'phpmailer_init', array( $this, 'handle_multipart' ) );
} }
/** /**
@ -393,15 +393,15 @@ class WC_Email extends WC_Settings_API {
* @return void * @return void
*/ */
function send( $to, $subject, $message, $headers, $attachments ) { function send( $to, $subject, $message, $headers, $attachments ) {
add_filter( 'wp_mail_from', array( &$this, 'get_from_address' ) ); add_filter( 'wp_mail_from', array( $this, 'get_from_address' ) );
add_filter( 'wp_mail_from_name', array( &$this, 'get_from_name' ) ); add_filter( 'wp_mail_from_name', array( $this, 'get_from_name' ) );
add_filter( 'wp_mail_content_type', array( &$this, 'get_content_type' ) ); add_filter( 'wp_mail_content_type', array( $this, 'get_content_type' ) );
wp_mail( $to, $subject, $message, $headers, $attachments ); wp_mail( $to, $subject, $message, $headers, $attachments );
remove_filter( 'wp_mail_from', array( &$this, 'get_from_address' ) ); remove_filter( 'wp_mail_from', array( $this, 'get_from_address' ) );
remove_filter( 'wp_mail_from_name', array( &$this, 'get_from_name' ) ); remove_filter( 'wp_mail_from_name', array( $this, 'get_from_name' ) );
remove_filter( 'wp_mail_content_type', array( &$this, 'get_content_type' ) ); remove_filter( 'wp_mail_content_type', array( $this, 'get_content_type' ) );
} }
/** /**

View File

@ -64,14 +64,14 @@ class WC_Emails {
$this->emails = apply_filters( 'woocommerce_email_classes', $this->emails ); $this->emails = apply_filters( 'woocommerce_email_classes', $this->emails );
// Email Header, Footer and content hooks // Email Header, Footer and content hooks
add_action( 'woocommerce_email_header', array( &$this, 'email_header' ) ); add_action( 'woocommerce_email_header', array( $this, 'email_header' ) );
add_action( 'woocommerce_email_footer', array( &$this, 'email_footer' ) ); add_action( 'woocommerce_email_footer', array( $this, 'email_footer' ) );
add_action( 'woocommerce_email_order_meta', array( &$this, 'order_meta' ), 10, 3 ); add_action( 'woocommerce_email_order_meta', array( $this, 'order_meta' ), 10, 3 );
// Hooks for sending emails during store events // Hooks for sending emails during store events
add_action( 'woocommerce_low_stock_notification', array( &$this, 'low_stock' ) ); add_action( 'woocommerce_low_stock_notification', array( $this, 'low_stock' ) );
add_action( 'woocommerce_no_stock_notification', array( &$this, 'no_stock' ) ); add_action( 'woocommerce_no_stock_notification', array( $this, 'no_stock' ) );
add_action( 'woocommerce_product_on_backorder_notification', array( &$this, 'backorder' )); add_action( 'woocommerce_product_on_backorder_notification', array( $this, 'backorder' ));
// Let 3rd parties unhook the above via this hook // Let 3rd parties unhook the above via this hook
do_action( 'woocommerce_email', $this ); do_action( 'woocommerce_email', $this );
@ -186,17 +186,17 @@ class WC_Emails {
$this->_content_type = $content_type; $this->_content_type = $content_type;
// Filters for the email // Filters for the email
add_filter( 'wp_mail_from', array( &$this, 'get_from_address' ) ); add_filter( 'wp_mail_from', array( $this, 'get_from_address' ) );
add_filter( 'wp_mail_from_name', array( &$this, 'get_from_name' ) ); add_filter( 'wp_mail_from_name', array( $this, 'get_from_name' ) );
add_filter( 'wp_mail_content_type', array( &$this, 'get_content_type' ) ); add_filter( 'wp_mail_content_type', array( $this, 'get_content_type' ) );
// Send // Send
wp_mail( $to, $subject, $message, $headers, $attachments ); wp_mail( $to, $subject, $message, $headers, $attachments );
// Unhook filters // Unhook filters
remove_filter( 'wp_mail_from', array( &$this, 'get_from_address' ) ); remove_filter( 'wp_mail_from', array( $this, 'get_from_address' ) );
remove_filter( 'wp_mail_from_name', array( &$this, 'get_from_name' ) ); remove_filter( 'wp_mail_from_name', array( $this, 'get_from_name' ) );
remove_filter( 'wp_mail_content_type', array( &$this, 'get_content_type' ) ); remove_filter( 'wp_mail_content_type', array( $this, 'get_content_type' ) );
} }
/** /**

View File

@ -43,11 +43,11 @@ class WC_BACS extends WC_Payment_Gateway {
$this->bic = $this->settings['bic']; $this->bic = $this->settings['bic'];
// Actions // Actions
add_action('woocommerce_update_options_payment_gateways', array(&$this, 'process_admin_options')); add_action( 'woocommerce_update_options_payment_gateways', array( $this, 'process_admin_options' ) );
add_action('woocommerce_thankyou_bacs', array(&$this, 'thankyou_page')); add_action( 'woocommerce_thankyou_bacs', array( $this, 'thankyou_page' ) );
// Customer Emails // Customer Emails
add_action('woocommerce_email_before_order_table', array(&$this, 'email_instructions'), 10, 2); add_action( 'woocommerce_email_before_order_table', array( $this, 'email_instructions' ), 10, 2 );
} }

View File

@ -38,11 +38,11 @@ class WC_Cheque extends WC_Payment_Gateway {
$this->description = $this->settings['description']; $this->description = $this->settings['description'];
// Actions // Actions
add_action('woocommerce_update_options_payment_gateways', array(&$this, 'process_admin_options')); add_action( 'woocommerce_update_options_payment_gateways', array( $this, 'process_admin_options' ) );
add_action('woocommerce_thankyou_cheque', array(&$this, 'thankyou_page')); add_action( 'woocommerce_thankyou_cheque', array( $this, 'thankyou_page' ) );
// Customer Emails // Customer Emails
add_action('woocommerce_email_before_order_table', array(&$this, 'email_instructions'), 10, 2); add_action( 'woocommerce_email_before_order_table', array( $this, 'email_instructions' ), 10, 2 );
} }

View File

@ -46,7 +46,7 @@ class WC_Payment_Gateways {
ksort($this->payment_gateways); ksort($this->payment_gateways);
add_action('woocommerce_update_options_payment_gateways', array(&$this, 'process_admin_options')); add_action( 'woocommerce_update_options_payment_gateways', array( $this, 'process_admin_options' ) );
} }

View File

@ -39,8 +39,8 @@ class WC_COD extends WC_Payment_Gateway {
$this->instructions = $this->settings['instructions']; $this->instructions = $this->settings['instructions'];
$this->enable_for_methods = empty( $this->settings['enable_for_methods'] ) ? array() : $this->settings['enable_for_methods']; $this->enable_for_methods = empty( $this->settings['enable_for_methods'] ) ? array() : $this->settings['enable_for_methods'];
add_action('woocommerce_update_options_payment_gateways', array(&$this, 'process_admin_options')); add_action( 'woocommerce_update_options_payment_gateways', array( $this, 'process_admin_options' ) );
add_action('woocommerce_thankyou_cod', array(&$this, 'thankyou')); add_action( 'woocommerce_thankyou_cod', array( $this, 'thankyou' ) );
} }

View File

@ -47,15 +47,15 @@ class WC_Mijireh_Checkout extends WC_Payment_Gateway {
$this->install_slurp_page(); $this->install_slurp_page();
// Hooks // Hooks
add_action( 'add_meta_boxes', array( &$this, 'add_page_slurp_meta' ) ); add_action( 'add_meta_boxes', array( $this, 'add_page_slurp_meta' ) );
add_action( 'wp_ajax_page_slurp', array( &$this, 'page_slurp' ) ); add_action( 'wp_ajax_page_slurp', array( $this, 'page_slurp' ) );
} }
// Save options // Save options
add_action( 'woocommerce_update_options_payment_gateways', array( &$this, 'process_admin_options' ) ); add_action( 'woocommerce_update_options_payment_gateways', array( $this, 'process_admin_options' ) );
// Payment listener/API hook // Payment listener/API hook
add_action( 'woocommerce_api_wc_mijireh_checkout', array( &$this, 'mijireh_notification' ) ); add_action( 'woocommerce_api_wc_mijireh_checkout', array( $this, 'mijireh_notification' ) );
} }
/** /**
@ -340,7 +340,7 @@ class WC_Mijireh_Checkout extends WC_Payment_Gateway {
add_meta_box( add_meta_box(
'slurp_meta_box', // $id 'slurp_meta_box', // $id
'Mijireh Page Slurp', // $title 'Mijireh Page Slurp', // $title
array( &$this, 'draw_page_slurp_meta_box' ), // $callback array( $this, 'draw_page_slurp_meta_box' ), // $callback
'page', // $page 'page', // $page
'normal', // $context 'normal', // $context
'high' // $priority 'high' // $priority

View File

@ -56,12 +56,12 @@ class WC_Paypal extends WC_Payment_Gateway {
if ($this->debug=='yes') $this->log = $woocommerce->logger(); if ($this->debug=='yes') $this->log = $woocommerce->logger();
// Actions // Actions
add_action( 'valid-paypal-standard-ipn-request', array( &$this, 'successful_request' ) ); add_action( 'valid-paypal-standard-ipn-request', array( $this, 'successful_request' ) );
add_action( 'woocommerce_receipt_paypal', array( &$this, 'receipt_page' ) ); add_action( 'woocommerce_receipt_paypal', array( $this, 'receipt_page' ) );
add_action( 'woocommerce_update_options_payment_gateways', array( &$this, 'process_admin_options' ) ); add_action( 'woocommerce_update_options_payment_gateways', array( $this, 'process_admin_options' ) );
// Payment listener/API hook // Payment listener/API hook
add_action( 'woocommerce_api_wc_paypal', array( &$this, 'check_ipn_response' ) ); add_action( 'woocommerce_api_wc_paypal', array( $this, 'check_ipn_response' ) );
if ( !$this->is_valid_for_use() ) $this->enabled = false; if ( !$this->is_valid_for_use() ) $this->enabled = false;
} }

View File

@ -39,15 +39,15 @@ class WC_Google_Analytics extends WC_Integration {
$this->ga_event_tracking_enabled = $this->settings['ga_event_tracking_enabled']; $this->ga_event_tracking_enabled = $this->settings['ga_event_tracking_enabled'];
// Actions // Actions
add_action( 'woocommerce_update_options_integration_google_analytics', array( &$this, 'process_admin_options') ); add_action( 'woocommerce_update_options_integration_google_analytics', array( $this, 'process_admin_options') );
// Tracking code // Tracking code
add_action( 'wp_footer', array( &$this, 'google_tracking_code' ) ); add_action( 'wp_footer', array( $this, 'google_tracking_code' ) );
add_action( 'woocommerce_thankyou', array( &$this, 'ecommerce_tracking_code' ) ); add_action( 'woocommerce_thankyou', array( $this, 'ecommerce_tracking_code' ) );
// Event tracking code // Event tracking code
add_action( 'woocommerce_after_add_to_cart_button', array( &$this, 'add_to_cart' ) ); add_action( 'woocommerce_after_add_to_cart_button', array( $this, 'add_to_cart' ) );
add_action( 'woocommerce_after_shop_loop', array( &$this, 'loop_add_to_cart' ) ); add_action( 'woocommerce_after_shop_loop', array( $this, 'loop_add_to_cart' ) );
} }
@ -154,7 +154,7 @@ class WC_Google_Analytics extends WC_Integration {
if ( ! $tracking_id ) return; if ( ! $tracking_id ) return;
// Doing eCommerce tracking so unhook standard tracking from the footer // Doing eCommerce tracking so unhook standard tracking from the footer
remove_action( 'wp_footer', array( &$this, 'google_tracking_code' ) ); remove_action( 'wp_footer', array( $this, 'google_tracking_code' ) );
// Get the order and output tracking code // Get the order and output tracking code
$order = new WC_Order( $order_id ); $order = new WC_Order( $order_id );

View File

@ -36,10 +36,10 @@ class WC_ShareDaddy extends WC_Integration {
$this->enabled = $this->settings['enabled']; $this->enabled = $this->settings['enabled'];
// Actions // Actions
add_action( 'woocommerce_update_options_integration_sharedaddy', array( &$this, 'process_admin_options') ); add_action( 'woocommerce_update_options_integration_sharedaddy', array( $this, 'process_admin_options' ) );
// Share widget // Share widget
add_action( 'woocommerce_share', array( &$this, 'sharedaddy_code') ); add_action( 'woocommerce_share', array( $this, 'sharedaddy_code' ) );
} }

View File

@ -47,10 +47,10 @@ class WC_ShareThis extends WC_Integration {
if ( ! $this->sharethis_code ) $this->settings['sharethis_code'] = $this->sharethis_code = $this->default_code; if ( ! $this->sharethis_code ) $this->settings['sharethis_code'] = $this->sharethis_code = $this->default_code;
// Actions // Actions
add_action( 'woocommerce_update_options_integration_sharethis', array( &$this, 'process_admin_options') ); add_action( 'woocommerce_update_options_integration_sharethis', array( $this, 'process_admin_options' ) );
// Share widget // Share widget
add_action( 'woocommerce_share', array( &$this, 'sharethis_code') ); add_action( 'woocommerce_share', array( $this, 'sharethis_code' ) );
} }

View File

@ -28,8 +28,8 @@ class WC_Flat_Rate extends WC_Shipping_Method {
$this->admin_page_heading = __( 'Flat Rates', 'woocommerce' ); $this->admin_page_heading = __( 'Flat Rates', 'woocommerce' );
$this->admin_page_description = __( 'Flat rates let you define a standard rate per item, or per order.', 'woocommerce' ); $this->admin_page_description = __( 'Flat rates let you define a standard rate per item, or per order.', 'woocommerce' );
add_action( 'woocommerce_update_options_shipping_' . $this->id, array( &$this, 'process_admin_options' ) ); add_action( 'woocommerce_update_options_shipping_' . $this->id, array( $this, 'process_admin_options' ) );
add_action( 'woocommerce_update_options_shipping_' . $this->id, array( &$this, 'process_flat_rates' ) ); add_action( 'woocommerce_update_options_shipping_' . $this->id, array( $this, 'process_flat_rates' ) );
$this->init(); $this->init();
} }

View File

@ -58,7 +58,7 @@ class WC_Free_Shipping extends WC_Shipping_Method {
} }
// Actions // Actions
add_action('woocommerce_update_options_shipping_'.$this->id, array(&$this, 'process_admin_options')); add_action( 'woocommerce_update_options_shipping_' . $this->id, array( $this, 'process_admin_options' ) );
} }

View File

@ -31,8 +31,8 @@ class WC_International_Delivery extends WC_Flat_Rate {
$this->admin_page_heading = __( 'International Delivery', 'woocommerce' ); $this->admin_page_heading = __( 'International Delivery', 'woocommerce' );
$this->admin_page_description = __( 'International delivery based on flat rate shipping.', 'woocommerce' ); $this->admin_page_description = __( 'International delivery based on flat rate shipping.', 'woocommerce' );
add_action('woocommerce_update_options_shipping_'.$this->id, array(&$this, 'process_admin_options')); add_action( 'woocommerce_update_options_shipping_' . $this->id, array( $this, 'process_admin_options' ) );
add_action('woocommerce_update_options_shipping_'.$this->id, array(&$this, 'process_flat_rates')); add_action( 'woocommerce_update_options_shipping_' . $this->id, array( $this, 'process_flat_rates' ) );
$this->init(); $this->init();
} }

View File

@ -49,7 +49,7 @@ class WC_Local_Delivery extends WC_Shipping_Method {
$this->availability = empty( $this->settings['availability'] ) ? '' : $this->settings['availability']; $this->availability = empty( $this->settings['availability'] ) ? '' : $this->settings['availability'];
$this->countries = empty( $this->settings['countries'] ) ? '' : $this->settings['countries']; $this->countries = empty( $this->settings['countries'] ) ? '' : $this->settings['countries'];
add_action('woocommerce_update_options_shipping_'.$this->id, array(&$this, 'process_admin_options')); add_action( 'woocommerce_update_options_shipping_' . $this->id, array( $this, 'process_admin_options' ) );
} }
/** /**

View File

@ -47,9 +47,9 @@ class WC_Local_Pickup extends WC_Shipping_Method {
$this->countries = $this->settings['countries']; $this->countries = $this->settings['countries'];
// Actions // Actions
add_action( 'woocommerce_update_options_shipping_' . $this->id, array( &$this, 'process_admin_options' ) ); add_action( 'woocommerce_update_options_shipping_' . $this->id, array( $this, 'process_admin_options' ) );
add_filter( 'woocommerce_customer_taxable_address', array( &$this, 'taxable_address' ) ); add_filter( 'woocommerce_customer_taxable_address', array( $this, 'taxable_address' ) );
add_action( 'woocommerce_shipping_method_chosen', array( &$this, 'method_chosen' ) ); add_action( 'woocommerce_shipping_method_chosen', array( $this, 'method_chosen' ) );
} }
/** /**

View File

@ -45,7 +45,7 @@ class WC_Shipping {
$this->enabled = ( get_option('woocommerce_calc_shipping') == 'no' ) ? false : true; $this->enabled = ( get_option('woocommerce_calc_shipping') == 'no' ) ? false : true;
add_action( 'woocommerce_update_options_shipping', array( &$this, 'process_admin_options' ) ); add_action( 'woocommerce_update_options_shipping', array( $this, 'process_admin_options' ) );
} }
/** /**

View File

@ -38,9 +38,9 @@ class WooCommerce_Widget_Best_Sellers extends WP_Widget {
/* Create the widget. */ /* Create the widget. */
$this->WP_Widget('best_sellers', $this->woo_widget_name, $widget_ops); $this->WP_Widget('best_sellers', $this->woo_widget_name, $widget_ops);
add_action( 'save_post', array(&$this, 'flush_widget_cache') ); add_action( 'save_post', array( $this, 'flush_widget_cache' ) );
add_action( 'deleted_post', array(&$this, 'flush_widget_cache') ); add_action( 'deleted_post', array( $this, 'flush_widget_cache' ) );
add_action( 'switch_theme', array(&$this, 'flush_widget_cache') ); add_action( 'switch_theme', array( $this, 'flush_widget_cache' ) );
} }

View File

@ -42,9 +42,9 @@ class WooCommerce_Widget_Featured_Products extends WP_Widget {
/* Create the widget. */ /* Create the widget. */
$this->WP_Widget('featured-products', $this->woo_widget_name, $widget_ops); $this->WP_Widget('featured-products', $this->woo_widget_name, $widget_ops);
add_action( 'save_post', array(&$this, 'flush_widget_cache') ); add_action( 'save_post', array( $this, 'flush_widget_cache' ) );
add_action( 'deleted_post', array(&$this, 'flush_widget_cache') ); add_action( 'deleted_post', array( $this, 'flush_widget_cache' ) );
add_action( 'switch_theme', array(&$this, 'flush_widget_cache') ); add_action( 'switch_theme', array( $this, 'flush_widget_cache' ) );
} }

View File

@ -38,9 +38,9 @@ class WooCommerce_Widget_On_Sale extends WP_Widget {
/* Create the widget. */ /* Create the widget. */
$this->WP_Widget('onsale', $this->woo_widget_name, $widget_ops); $this->WP_Widget('onsale', $this->woo_widget_name, $widget_ops);
add_action( 'save_post', array(&$this, 'flush_widget_cache') ); add_action( 'save_post', array( $this, 'flush_widget_cache' ) );
add_action( 'deleted_post', array(&$this, 'flush_widget_cache') ); add_action( 'deleted_post', array( $this, 'flush_widget_cache' ) );
add_action( 'switch_theme', array(&$this, 'flush_widget_cache') ); add_action( 'switch_theme', array( $this, 'flush_widget_cache' ) );
} }
/** /**

View File

@ -38,9 +38,9 @@ class WooCommerce_Widget_Recent_Products extends WP_Widget {
/* Create the widget. */ /* Create the widget. */
$this->WP_Widget('recent_products', $this->woo_widget_name, $widget_ops); $this->WP_Widget('recent_products', $this->woo_widget_name, $widget_ops);
add_action( 'save_post', array(&$this, 'flush_widget_cache') ); add_action( 'save_post', array( $this, 'flush_widget_cache' ) );
add_action( 'deleted_post', array(&$this, 'flush_widget_cache') ); add_action( 'deleted_post', array( $this, 'flush_widget_cache' ) );
add_action( 'switch_theme', array(&$this, 'flush_widget_cache') ); add_action( 'switch_theme', array( $this, 'flush_widget_cache' ) );
} }
/** /**

View File

@ -38,9 +38,9 @@ class WooCommerce_Widget_Recent_Reviews extends WP_Widget {
/* Create the widget. */ /* Create the widget. */
$this->WP_Widget('recent_reviews', $this->woo_widget_name, $widget_ops); $this->WP_Widget('recent_reviews', $this->woo_widget_name, $widget_ops);
add_action( 'save_post', array(&$this, 'flush_widget_cache') ); add_action( 'save_post', array( $this, 'flush_widget_cache' ) );
add_action( 'deleted_post', array(&$this, 'flush_widget_cache') ); add_action( 'deleted_post', array( $this, 'flush_widget_cache' ) );
add_action( 'switch_theme', array(&$this, 'flush_widget_cache') ); add_action( 'switch_theme', array( $this, 'flush_widget_cache' ) );
} }
/** /**

View File

@ -38,9 +38,9 @@ class WooCommerce_Widget_Recently_Viewed extends WP_Widget {
/* Create the widget. */ /* Create the widget. */
$this->WP_Widget('recently_viewed_products', $this->woo_widget_name, $widget_ops); $this->WP_Widget('recently_viewed_products', $this->woo_widget_name, $widget_ops);
add_action( 'save_post', array(&$this, 'flush_widget_cache') ); add_action( 'save_post', array( $this, 'flush_widget_cache' ) );
add_action( 'deleted_post', array(&$this, 'flush_widget_cache') ); add_action( 'deleted_post', array( $this, 'flush_widget_cache' ) );
add_action( 'switch_theme', array(&$this, 'flush_widget_cache') ); add_action( 'switch_theme', array( $this, 'flush_widget_cache' ) );
} }
/** /**

View File

@ -40,9 +40,9 @@ class WooCommerce_Widget_Top_Rated_Products extends WP_Widget {
/* Create the widget. */ /* Create the widget. */
$this->WP_Widget('top-rated-products', $this->woo_widget_name, $widget_ops); $this->WP_Widget('top-rated-products', $this->woo_widget_name, $widget_ops);
add_action( 'save_post', array(&$this, 'flush_widget_cache') ); add_action( 'save_post', array( $this, 'flush_widget_cache' ) );
add_action( 'deleted_post', array(&$this, 'flush_widget_cache') ); add_action( 'deleted_post', array( $this, 'flush_widget_cache' ) );
add_action( 'switch_theme', array(&$this, 'flush_widget_cache') ); add_action( 'switch_theme', array( $this, 'flush_widget_cache' ) );
} }
/** /**
@ -75,7 +75,7 @@ class WooCommerce_Widget_Top_Rated_Products extends WP_Widget {
else if ( $number < 1 ) $number = 1; else if ( $number < 1 ) $number = 1;
else if ( $number > 15 ) $number = 15; else if ( $number > 15 ) $number = 15;
add_filter( 'posts_clauses', array(&$this, 'order_by_rating_post_clauses') ); add_filter( 'posts_clauses', array( $this, 'order_by_rating_post_clauses' ) );
$query_args = array('posts_per_page' => $number, 'no_found_rows' => 1, 'post_status' => 'publish', 'post_type' => 'product' ); $query_args = array('posts_per_page' => $number, 'no_found_rows' => 1, 'post_status' => 'publish', 'post_type' => 'product' );
@ -107,7 +107,7 @@ class WooCommerce_Widget_Top_Rated_Products extends WP_Widget {
endif; endif;
wp_reset_query(); wp_reset_query();
remove_filter( 'posts_clauses', array(&$this, 'order_by_rating_post_clauses') ); remove_filter( 'posts_clauses', array( $this, 'order_by_rating_post_clauses' ) );
$content = ob_get_clean(); $content = ob_get_clean();

View File

@ -151,16 +151,16 @@ class Woocommerce {
register_activation_hook( __FILE__, 'flush_rewrite_rules' ); register_activation_hook( __FILE__, 'flush_rewrite_rules' );
if ( get_option( 'woocommerce_version' ) != $this->version ) if ( get_option( 'woocommerce_version' ) != $this->version )
add_action( 'init', array( &$this, 'install' ), 1 ); add_action( 'init', array( $this, 'install' ), 1 );
} }
// Include required files // Include required files
$this->includes(); $this->includes();
// Actions // Actions
add_action( 'init', array( &$this, 'init' ), 0 ); add_action( 'init', array( $this, 'init' ), 0 );
add_action( 'init', array( &$this, 'include_template_functions' ), 25 ); add_action( 'init', array( $this, 'include_template_functions' ), 25 );
add_action( 'after_setup_theme', array( &$this, 'compatibility' ) ); add_action( 'after_setup_theme', array( $this, 'compatibility' ) );
// Loaded action // Loaded action
do_action( 'woocommerce_loaded' ); do_action( 'woocommerce_loaded' );
@ -343,36 +343,36 @@ class Woocommerce {
$this->load_messages(); $this->load_messages();
// Hooks // Hooks
add_filter( 'template_include', array(&$this, 'template_loader') ); add_filter( 'template_include', array( $this, 'template_loader' ) );
add_filter( 'comments_template', array(&$this, 'comments_template_loader') ); add_filter( 'comments_template', array( $this, 'comments_template_loader' ) );
add_filter( 'wp_redirect', array(&$this, 'redirect'), 1, 2 ); add_filter( 'wp_redirect', array( $this, 'redirect' ), 1, 2 );
add_action( 'template_redirect', array(&$this, 'buffer_checkout') ); add_action( 'template_redirect', array( $this, 'buffer_checkout' ) );
add_action( 'wp_enqueue_scripts', array(&$this, 'frontend_scripts') ); add_action( 'wp_enqueue_scripts', array( $this, 'frontend_scripts' ) );
add_action( 'wp_print_scripts', array(&$this, 'check_jquery'), 25 ); add_action( 'wp_print_scripts', array( $this, 'check_jquery' ), 25 );
add_action( 'wp_head', array(&$this, 'generator') ); add_action( 'wp_head', array( $this, 'generator' ) );
add_action( 'wp_head', array(&$this, 'wp_head') ); add_action( 'wp_head', array( $this, 'wp_head' ) );
add_filter( 'body_class', array(&$this, 'output_body_class') ); add_filter( 'body_class', array( $this, 'output_body_class' ) );
add_action( 'wp_footer', array(&$this, 'output_inline_js'), 25 ); add_action( 'wp_footer', array( $this, 'output_inline_js' ), 25 );
} }
// Actions // Actions
add_action( 'the_post', array( &$this, 'setup_product_data' ) ); add_action( 'the_post', array( $this, 'setup_product_data' ) );
add_action( 'admin_footer', array( &$this, 'output_inline_js' ), 25 ); add_action( 'admin_footer', array( $this, 'output_inline_js' ), 25 );
// Email Actions // Email Actions
$email_actions = array( 'woocommerce_low_stock', 'woocommerce_no_stock', 'woocommerce_product_on_backorder', 'woocommerce_order_status_pending_to_processing', 'woocommerce_order_status_pending_to_completed', 'woocommerce_order_status_pending_to_on-hold', 'woocommerce_order_status_failed_to_processing', 'woocommerce_order_status_failed_to_completed', 'woocommerce_order_status_pending_to_processing', 'woocommerce_order_status_pending_to_on-hold', 'woocommerce_order_status_completed', 'woocommerce_new_customer_note' ); $email_actions = array( 'woocommerce_low_stock', 'woocommerce_no_stock', 'woocommerce_product_on_backorder', 'woocommerce_order_status_pending_to_processing', 'woocommerce_order_status_pending_to_completed', 'woocommerce_order_status_pending_to_on-hold', 'woocommerce_order_status_failed_to_processing', 'woocommerce_order_status_failed_to_completed', 'woocommerce_order_status_pending_to_processing', 'woocommerce_order_status_pending_to_on-hold', 'woocommerce_order_status_completed', 'woocommerce_new_customer_note' );
foreach ( $email_actions as $action ) foreach ( $email_actions as $action )
add_action( $action, array( &$this, 'send_transactional_email') ); add_action( $action, array( $this, 'send_transactional_email') );
// Actions for SSL // Actions for SSL
if ( ! is_admin() || defined('DOING_AJAX') ) { if ( ! is_admin() || defined('DOING_AJAX') ) {
add_action( 'template_redirect', array( &$this, 'ssl_redirect' ) ); add_action( 'template_redirect', array( $this, 'ssl_redirect' ) );
$filters = array( 'post_thumbnail_html', 'widget_text', 'wp_get_attachment_url', 'wp_get_attachment_image_attributes', 'wp_get_attachment_url', 'option_siteurl', 'option_homeurl', 'option_home', 'option_url', 'option_wpurl', 'option_stylesheet_url', 'option_template_url', 'script_loader_src', 'style_loader_src', 'template_directory_uri', 'stylesheet_directory_uri', 'site_url' ); $filters = array( 'post_thumbnail_html', 'widget_text', 'wp_get_attachment_url', 'wp_get_attachment_image_attributes', 'wp_get_attachment_url', 'option_siteurl', 'option_homeurl', 'option_home', 'option_url', 'option_wpurl', 'option_stylesheet_url', 'option_template_url', 'script_loader_src', 'style_loader_src', 'template_directory_uri', 'stylesheet_directory_uri', 'site_url' );
foreach ( $filters as $filter ) foreach ( $filters as $filter )
add_filter( $filter, array( &$this, 'force_ssl') ); add_filter( $filter, array( $this, 'force_ssl') );
} }
// Register globals for WC environment // Register globals for WC environment
@ -1275,7 +1275,7 @@ class Woocommerce {
function force_ssl( $content ) { function force_ssl( $content ) {
if ( is_ssl() ) { if ( is_ssl() ) {
if ( is_array($content) ) if ( is_array($content) )
$content = array_map( array( &$this, 'force_ssl' ) , $content ); $content = array_map( array( $this, 'force_ssl' ) , $content );
else else
$content = str_replace( 'http:', 'https:', $content ); $content = str_replace( 'http:', 'https:', $content );
} }