Merge pull request #12454 from woocommerce/deprecation-wrappers-12328
Deprecation wrappers
This commit is contained in:
commit
b2b42600cd
|
@ -25,7 +25,7 @@ abstract class WC_Abstract_Legacy_Order extends WC_Data {
|
|||
* @throws WC_Data_Exception
|
||||
*/
|
||||
public function add_coupon( $code = array(), $discount = 0, $discount_tax = 0 ) {
|
||||
_deprecated_function( 'WC_Order::add_coupon', '2.7', 'Create new WC_Order_Item_Coupon object and add to order with WC_Order::add_item()' );
|
||||
wc_deprecated_function( 'WC_Order::add_coupon', '2.7', 'Create new WC_Order_Item_Coupon object and add to order with WC_Order::add_item()' );
|
||||
|
||||
$item = new WC_Order_Item_Coupon();
|
||||
$item->set_props( array(
|
||||
|
@ -49,7 +49,7 @@ abstract class WC_Abstract_Legacy_Order extends WC_Data {
|
|||
* @throws WC_Data_Exception
|
||||
*/
|
||||
public function add_tax( $tax_rate_id, $tax_amount = 0, $shipping_tax_amount = 0 ) {
|
||||
_deprecated_function( 'WC_Order::add_tax', '2.7', 'Create new WC_Order_Item_Tax object and add to order with WC_Order::add_item()' );
|
||||
wc_deprecated_function( 'WC_Order::add_tax', '2.7', 'Create new WC_Order_Item_Tax object and add to order with WC_Order::add_item()' );
|
||||
|
||||
$item = new WC_Order_Item_Tax();
|
||||
$item->set_props( array(
|
||||
|
@ -72,7 +72,7 @@ abstract class WC_Abstract_Legacy_Order extends WC_Data {
|
|||
* @throws WC_Data_Exception
|
||||
*/
|
||||
public function add_shipping( $shipping_rate ) {
|
||||
_deprecated_function( 'WC_Order::add_shipping', '2.7', 'Create new WC_Order_Item_Shipping object and add to order with WC_Order::add_item()' );
|
||||
wc_deprecated_function( 'WC_Order::add_shipping', '2.7', 'Create new WC_Order_Item_Shipping object and add to order with WC_Order::add_item()' );
|
||||
|
||||
$item = new WC_Order_Item_Shipping();
|
||||
$item->set_props( array(
|
||||
|
@ -97,7 +97,7 @@ abstract class WC_Abstract_Legacy_Order extends WC_Data {
|
|||
* @throws WC_Data_Exception
|
||||
*/
|
||||
public function add_fee( $fee ) {
|
||||
_deprecated_function( 'WC_Order::add_fee', '2.7', 'Create new WC_Order_Item_Fee object and add to order with WC_Order::add_item()' );
|
||||
wc_deprecated_function( 'WC_Order::add_fee', '2.7', 'Create new WC_Order_Item_Fee object and add to order with WC_Order::add_item()' );
|
||||
|
||||
$item = new WC_Order_Item_Fee();
|
||||
$item->set_props( array(
|
||||
|
@ -128,7 +128,7 @@ abstract class WC_Abstract_Legacy_Order extends WC_Data {
|
|||
* @throws WC_Data_Exception
|
||||
*/
|
||||
public function update_product( $item, $product, $args ) {
|
||||
_deprecated_function( 'WC_Order::update_product', '2.7', 'Interact with WC_Order_Item_Product class' );
|
||||
wc_deprecated_function( 'WC_Order::update_product', '2.7', 'Interact with WC_Order_Item_Product class' );
|
||||
if ( is_numeric( $item ) ) {
|
||||
$item = $this->get_item( $item );
|
||||
}
|
||||
|
@ -177,7 +177,7 @@ abstract class WC_Abstract_Legacy_Order extends WC_Data {
|
|||
* @throws WC_Data_Exception
|
||||
*/
|
||||
public function update_coupon( $item, $args ) {
|
||||
_deprecated_function( 'WC_Order::update_coupon', '2.7', 'Interact with WC_Order_Item_Coupon class' );
|
||||
wc_deprecated_function( 'WC_Order::update_coupon', '2.7', 'Interact with WC_Order_Item_Coupon class' );
|
||||
if ( is_numeric( $item ) ) {
|
||||
$item = $this->get_item( $item );
|
||||
}
|
||||
|
@ -216,7 +216,7 @@ abstract class WC_Abstract_Legacy_Order extends WC_Data {
|
|||
* @throws WC_Data_Exception
|
||||
*/
|
||||
public function update_shipping( $item, $args ) {
|
||||
_deprecated_function( 'WC_Order::update_shipping', '2.7', 'Interact with WC_Order_Item_Shipping class' );
|
||||
wc_deprecated_function( 'WC_Order::update_shipping', '2.7', 'Interact with WC_Order_Item_Shipping class' );
|
||||
if ( is_numeric( $item ) ) {
|
||||
$item = $this->get_item( $item );
|
||||
}
|
||||
|
@ -253,7 +253,7 @@ abstract class WC_Abstract_Legacy_Order extends WC_Data {
|
|||
* @throws WC_Data_Exception
|
||||
*/
|
||||
public function update_fee( $item, $args ) {
|
||||
_deprecated_function( 'WC_Order::update_fee', '2.7', 'Interact with WC_Order_Item_Fee class' );
|
||||
wc_deprecated_function( 'WC_Order::update_fee', '2.7', 'Interact with WC_Order_Item_Fee class' );
|
||||
if ( is_numeric( $item ) ) {
|
||||
$item = $this->get_item( $item );
|
||||
}
|
||||
|
@ -284,7 +284,7 @@ abstract class WC_Abstract_Legacy_Order extends WC_Data {
|
|||
* @throws WC_Data_Exception
|
||||
*/
|
||||
public function update_tax( $item, $args ) {
|
||||
_deprecated_function( 'WC_Order::update_tax', '2.7', 'Interact with WC_Order_Item_Tax class' );
|
||||
wc_deprecated_function( 'WC_Order::update_tax', '2.7', 'Interact with WC_Order_Item_Tax class' );
|
||||
if ( is_numeric( $item ) ) {
|
||||
$item = $this->get_item( $item );
|
||||
}
|
||||
|
@ -397,7 +397,7 @@ abstract class WC_Abstract_Legacy_Order extends WC_Data {
|
|||
* @return mixed
|
||||
*/
|
||||
public function __get( $key ) {
|
||||
_doing_it_wrong( $key, 'Order properties should not be accessed directly.', '2.7' );
|
||||
wc_doing_it_wrong( $key, 'Order properties should not be accessed directly.', '2.7' );
|
||||
|
||||
if ( 'completed_date' === $key ) {
|
||||
return $this->get_date_completed();
|
||||
|
@ -457,7 +457,7 @@ abstract class WC_Abstract_Legacy_Order extends WC_Data {
|
|||
public function has_meta( $order_item_id ) {
|
||||
global $wpdb;
|
||||
|
||||
_deprecated_function( 'has_meta', '2.7', 'WC_Order_item::get_meta_data' );
|
||||
wc_deprecated_function( 'has_meta', '2.7', 'WC_Order_item::get_meta_data' );
|
||||
|
||||
return $wpdb->get_results( $wpdb->prepare( "SELECT meta_key, meta_value, meta_id, order_item_id
|
||||
FROM {$wpdb->prefix}woocommerce_order_itemmeta WHERE order_item_id = %d
|
||||
|
@ -469,7 +469,7 @@ abstract class WC_Abstract_Legacy_Order extends WC_Data {
|
|||
* @param array $item
|
||||
*/
|
||||
public function display_item_meta( $item ) {
|
||||
_deprecated_function( 'display_item_meta', '2.7', 'wc_display_item_meta' );
|
||||
wc_deprecated_function( 'display_item_meta', '2.7', 'wc_display_item_meta' );
|
||||
$product = $item->get_product();
|
||||
$item_meta = new WC_Order_Item_Meta( $item, $product );
|
||||
$item_meta->display();
|
||||
|
@ -480,7 +480,7 @@ abstract class WC_Abstract_Legacy_Order extends WC_Data {
|
|||
* @param array $item
|
||||
*/
|
||||
public function display_item_downloads( $item ) {
|
||||
_deprecated_function( 'display_item_downloads', '2.7', 'wc_display_item_downloads' );
|
||||
wc_deprecated_function( 'display_item_downloads', '2.7', 'wc_display_item_downloads' );
|
||||
$product = $item->get_product();
|
||||
|
||||
if ( $product && $product->exists() && $product->is_downloadable() && $this->is_download_permitted() ) {
|
||||
|
@ -506,7 +506,7 @@ abstract class WC_Abstract_Legacy_Order extends WC_Data {
|
|||
* @return string
|
||||
*/
|
||||
public function get_download_url( $product_id, $download_id ) {
|
||||
_deprecated_function( 'get_download_url', '2.7', 'WC_Order_Item_Product::get_item_download_url' );
|
||||
wc_deprecated_function( 'get_download_url', '2.7', 'WC_Order_Item_Product::get_item_download_url' );
|
||||
return add_query_arg( array(
|
||||
'download_file' => $product_id,
|
||||
'order' => $this->get_order_key(),
|
||||
|
@ -522,7 +522,7 @@ abstract class WC_Abstract_Legacy_Order extends WC_Data {
|
|||
* @return array
|
||||
*/
|
||||
public function get_item_downloads( $item ) {
|
||||
_deprecated_function( 'get_item_downloads', '2.7', 'WC_Order_Item_Product::get_item_downloads' );
|
||||
wc_deprecated_function( 'get_item_downloads', '2.7', 'WC_Order_Item_Product::get_item_downloads' );
|
||||
return $item->get_item_downloads();
|
||||
}
|
||||
|
||||
|
@ -544,7 +544,7 @@ abstract class WC_Abstract_Legacy_Order extends WC_Data {
|
|||
* @return array|string
|
||||
*/
|
||||
public function get_item_meta( $order_item_id, $key = '', $single = false ) {
|
||||
_deprecated_function( 'get_item_meta', '2.7', 'wc_get_order_item_meta' );
|
||||
wc_deprecated_function( 'get_item_meta', '2.7', 'wc_get_order_item_meta' );
|
||||
return get_metadata( 'order_item', $order_item_id, $key, $single );
|
||||
}
|
||||
|
||||
|
@ -555,7 +555,7 @@ abstract class WC_Abstract_Legacy_Order extends WC_Data {
|
|||
* @return array of objects
|
||||
*/
|
||||
public function get_item_meta_array( $order_item_id ) {
|
||||
_deprecated_function( 'get_item_meta_array', '2.7', 'WC_Order_Item::get_meta_data() (note the format has changed)' );
|
||||
wc_deprecated_function( 'get_item_meta_array', '2.7', 'WC_Order_Item::get_meta_data() (note the format has changed)' );
|
||||
$item = $this->get_item( $order_item_id );
|
||||
$meta_data = $item->get_meta_data();
|
||||
$item_meta_array = array();
|
||||
|
@ -575,7 +575,7 @@ abstract class WC_Abstract_Legacy_Order extends WC_Data {
|
|||
* @return array
|
||||
*/
|
||||
public function expand_item_meta( $item ) {
|
||||
_deprecated_function( 'expand_item_meta', '2.7' );
|
||||
wc_deprecated_function( 'expand_item_meta', '2.7' );
|
||||
return $item;
|
||||
}
|
||||
|
||||
|
@ -585,7 +585,7 @@ abstract class WC_Abstract_Legacy_Order extends WC_Data {
|
|||
* @param int|object|WC_Order $order Order to init.
|
||||
*/
|
||||
protected function init( $order ) {
|
||||
_deprecated_function( 'init', '2.7', 'Logic moved to constructor' );
|
||||
wc_deprecated_function( 'init', '2.7', 'Logic moved to constructor' );
|
||||
if ( is_numeric( $order ) ) {
|
||||
$this->read( $order );
|
||||
} elseif ( $order instanceof WC_Order ) {
|
||||
|
@ -602,7 +602,7 @@ abstract class WC_Abstract_Legacy_Order extends WC_Data {
|
|||
* @return bool
|
||||
*/
|
||||
public function get_order( $id = 0 ) {
|
||||
_deprecated_function( 'get_order', '2.7', 'read' );
|
||||
wc_deprecated_function( 'get_order', '2.7', 'read' );
|
||||
if ( ! $id ) {
|
||||
return false;
|
||||
}
|
||||
|
@ -619,7 +619,7 @@ abstract class WC_Abstract_Legacy_Order extends WC_Data {
|
|||
* @param mixed $result
|
||||
*/
|
||||
public function populate( $result ) {
|
||||
_deprecated_function( 'populate', '2.7', 'read' );
|
||||
wc_deprecated_function( 'populate', '2.7', 'read' );
|
||||
$this->read( $result->ID );
|
||||
}
|
||||
|
||||
|
@ -629,7 +629,7 @@ abstract class WC_Abstract_Legacy_Order extends WC_Data {
|
|||
* @param string $note (default: '') Optional note to add.
|
||||
*/
|
||||
public function cancel_order( $note = '' ) {
|
||||
_deprecated_function( 'cancel_order', '2.7', 'update_status' );
|
||||
wc_deprecated_function( 'cancel_order', '2.7', 'update_status' );
|
||||
WC()->session->set( 'order_awaiting_payment', false );
|
||||
$this->update_status( 'cancelled', $note );
|
||||
}
|
||||
|
@ -639,7 +639,7 @@ abstract class WC_Abstract_Legacy_Order extends WC_Data {
|
|||
* @deprecated 2.7.0
|
||||
*/
|
||||
public function record_product_sales() {
|
||||
_deprecated_function( 'record_product_sales', '2.7', 'wc_update_total_sales_counts' );
|
||||
wc_deprecated_function( 'record_product_sales', '2.7', 'wc_update_total_sales_counts' );
|
||||
wc_update_total_sales_counts( $this->get_id() );
|
||||
}
|
||||
|
||||
|
@ -648,7 +648,7 @@ abstract class WC_Abstract_Legacy_Order extends WC_Data {
|
|||
* @deprecated 2.7.0
|
||||
*/
|
||||
public function increase_coupon_usage_counts() {
|
||||
_deprecated_function( 'increase_coupon_usage_counts', '2.7', 'wc_update_coupon_usage_counts' );
|
||||
wc_deprecated_function( 'increase_coupon_usage_counts', '2.7', 'wc_update_coupon_usage_counts' );
|
||||
wc_update_coupon_usage_counts( $this->get_id() );
|
||||
}
|
||||
|
||||
|
@ -657,7 +657,7 @@ abstract class WC_Abstract_Legacy_Order extends WC_Data {
|
|||
* @deprecated 2.7.0
|
||||
*/
|
||||
public function decrease_coupon_usage_counts() {
|
||||
_deprecated_function( 'decrease_coupon_usage_counts', '2.7', 'wc_update_coupon_usage_counts' );
|
||||
wc_deprecated_function( 'decrease_coupon_usage_counts', '2.7', 'wc_update_coupon_usage_counts' );
|
||||
wc_update_coupon_usage_counts( $this->get_id() );
|
||||
}
|
||||
|
||||
|
@ -666,7 +666,7 @@ abstract class WC_Abstract_Legacy_Order extends WC_Data {
|
|||
* @deprecated 2.7.0
|
||||
*/
|
||||
public function reduce_order_stock() {
|
||||
_deprecated_function( 'reduce_order_stock', '2.7', 'wc_reduce_stock_levels' );
|
||||
wc_deprecated_function( 'reduce_order_stock', '2.7', 'wc_reduce_stock_levels' );
|
||||
wc_reduce_stock_levels( $this->get_id() );
|
||||
}
|
||||
|
||||
|
@ -675,7 +675,7 @@ abstract class WC_Abstract_Legacy_Order extends WC_Data {
|
|||
* @deprecated 2.7.0 No longer needs to be called directly.
|
||||
*/
|
||||
public function send_stock_notifications( $product, $new_stock, $qty_ordered ) {
|
||||
_deprecated_function( 'send_stock_notifications', '2.7' );
|
||||
wc_deprecated_function( 'send_stock_notifications', '2.7' );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -685,7 +685,7 @@ abstract class WC_Abstract_Legacy_Order extends WC_Data {
|
|||
* @return string
|
||||
*/
|
||||
public function email_order_items_table( $args = array() ) {
|
||||
_deprecated_function( 'email_order_items_table', '2.7', 'wc_get_email_order_items' );
|
||||
wc_deprecated_function( 'email_order_items_table', '2.7', 'wc_get_email_order_items' );
|
||||
return wc_get_email_order_items( $this, $args );
|
||||
}
|
||||
|
||||
|
@ -694,7 +694,7 @@ abstract class WC_Abstract_Legacy_Order extends WC_Data {
|
|||
* @deprecated 2.7.0
|
||||
*/
|
||||
public function get_order_currency() {
|
||||
_deprecated_function( 'get_order_currency', '2.7', 'get_currency' );
|
||||
wc_deprecated_function( 'get_order_currency', '2.7', 'get_currency' );
|
||||
return apply_filters( 'woocommerce_get_order_currency', $this->get_currency(), $this );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ abstract class WC_Legacy_Payment_Token extends WC_Data {
|
|||
* @deprecated 2.7.0 - Init a token class with an ID.
|
||||
*/
|
||||
public function read( $token_id ) {
|
||||
// wc_soft_deprecated_function( 'WC_Payment_Token::read', '2.7', '2.8', 'Init a token class with an ID.' );
|
||||
wc_deprecated_function( 'WC_Payment_Token::read', '2.7', 'Init a token class with an ID.' );
|
||||
$this->set_id( $token_id );
|
||||
$data_store = WC_Data_Store::load( 'payment-token' );
|
||||
$data_store->read( $this );
|
||||
|
@ -33,7 +33,7 @@ abstract class WC_Legacy_Payment_Token extends WC_Data {
|
|||
* @deprecated 2.7.0 - Use ::save instead.
|
||||
*/
|
||||
public function update() {
|
||||
// wc_soft_deprecated_function( 'WC_Payment_Token::update', '2.7', '2.8', 'Use ::save instead.' );
|
||||
wc_deprecated_function( 'WC_Payment_Token::update', '2.7', 'Use ::save instead.' );
|
||||
$data_store = WC_Data_Store::load( 'payment-token' );
|
||||
try {
|
||||
$data_store->update( $this );
|
||||
|
@ -47,7 +47,7 @@ abstract class WC_Legacy_Payment_Token extends WC_Data {
|
|||
* @deprecated 2.7.0 - Use ::save instead.
|
||||
*/
|
||||
public function create() {
|
||||
// wc_soft_deprecated_function( 'WC_Payment_Token::create', '2.7', '2.8', 'Use ::save instead.' );
|
||||
wc_deprecated_function( 'WC_Payment_Token::create', '2.7', 'Use ::save instead.' );
|
||||
$data_store = WC_Data_Store::load( 'payment-token' );
|
||||
try {
|
||||
$data_store->create( $this );
|
||||
|
|
|
@ -64,7 +64,7 @@ abstract class WC_Abstract_Legacy_Product extends WC_Data {
|
|||
return $this->post_type;
|
||||
}
|
||||
|
||||
_doing_it_wrong( $key, __( 'Product properties should not be accessed directly.', 'woocommerce' ), '2.7' );
|
||||
wc_doing_it_wrong( $key, __( 'Product properties should not be accessed directly.', 'woocommerce' ), '2.7' );
|
||||
|
||||
switch ( $key ) {
|
||||
case 'id' :
|
||||
|
@ -144,7 +144,7 @@ abstract class WC_Abstract_Legacy_Product extends WC_Data {
|
|||
* @return array
|
||||
*/
|
||||
public function get_variation_default_attributes() {
|
||||
_deprecated_function( 'WC_Product_Variable::get_variation_default_attributes', '2.7', 'WC_Product::get_default_attributes' );
|
||||
wc_deprecated_function( 'WC_Product_Variable::get_variation_default_attributes', '2.7', 'WC_Product::get_default_attributes' );
|
||||
return apply_filters( 'woocommerce_product_default_attributes', array_filter( (array) maybe_unserialize( $this->get_default_attributes() ) ), $this );
|
||||
}
|
||||
|
||||
|
@ -155,7 +155,7 @@ abstract class WC_Abstract_Legacy_Product extends WC_Data {
|
|||
* @return array
|
||||
*/
|
||||
public function get_gallery_attachment_ids() {
|
||||
_deprecated_function( 'WC_Product::get_gallery_attachment_ids', '2.7', 'WC_Product::get_gallery_image_ids' );
|
||||
wc_deprecated_function( 'WC_Product::get_gallery_attachment_ids', '2.7', 'WC_Product::get_gallery_image_ids' );
|
||||
return $this->get_gallery_image_ids();
|
||||
}
|
||||
|
||||
|
@ -165,7 +165,7 @@ abstract class WC_Abstract_Legacy_Product extends WC_Data {
|
|||
* @deprecated 2.7.0
|
||||
*/
|
||||
public function set_stock( $amount = null, $mode = 'set' ) {
|
||||
_deprecated_function( 'WC_Product::set_stock', '2.7', 'wc_update_product_stock' );
|
||||
wc_deprecated_function( 'WC_Product::set_stock', '2.7', 'wc_update_product_stock' );
|
||||
return wc_update_product_stock( $this, $amount, $mode );
|
||||
}
|
||||
|
||||
|
@ -177,7 +177,7 @@ abstract class WC_Abstract_Legacy_Product extends WC_Data {
|
|||
* @return int new stock level
|
||||
*/
|
||||
public function reduce_stock( $amount = 1 ) {
|
||||
_deprecated_function( 'WC_Product::reduce_stock', '2.7', 'wc_update_product_stock' );
|
||||
wc_deprecated_function( 'WC_Product::reduce_stock', '2.7', 'wc_update_product_stock' );
|
||||
wc_update_product_stock( $this, $amount, 'decrease' );
|
||||
}
|
||||
|
||||
|
@ -189,7 +189,7 @@ abstract class WC_Abstract_Legacy_Product extends WC_Data {
|
|||
* @return int new stock level
|
||||
*/
|
||||
public function increase_stock( $amount = 1 ) {
|
||||
_deprecated_function( 'WC_Product::increase_stock', '2.7', 'wc_update_product_stock' );
|
||||
wc_deprecated_function( 'WC_Product::increase_stock', '2.7', 'wc_update_product_stock' );
|
||||
wc_update_product_stock( $this, $amount, 'increase' );
|
||||
}
|
||||
|
||||
|
@ -199,7 +199,7 @@ abstract class WC_Abstract_Legacy_Product extends WC_Data {
|
|||
* @deprecated 2.7.0 Sync is done automatically on read/save, so calling this should not be needed any more.
|
||||
*/
|
||||
public function check_stock_status() {
|
||||
_deprecated_function( 'WC_Product::check_stock_status', '2.7' );
|
||||
wc_deprecated_function( 'WC_Product::check_stock_status', '2.7' );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -209,7 +209,7 @@ abstract class WC_Abstract_Legacy_Product extends WC_Data {
|
|||
* @return string
|
||||
*/
|
||||
public function get_availability() {
|
||||
_deprecated_function( 'WC_Product::get_availability', '2.7', 'Handled in stock.php template file and wc_format_stock_for_display function.' );
|
||||
wc_deprecated_function( 'WC_Product::get_availability', '2.7', 'Handled in stock.php template file and wc_format_stock_for_display function.' );
|
||||
return apply_filters( 'woocommerce_get_availability', array(
|
||||
'availability' => $this->get_availability_text(),
|
||||
'class' => $this->get_availability_class(),
|
||||
|
@ -223,7 +223,7 @@ abstract class WC_Abstract_Legacy_Product extends WC_Data {
|
|||
* @return string
|
||||
*/
|
||||
protected function get_availability_text() {
|
||||
_deprecated_function( 'WC_Product::get_availability_text', '2.7' );
|
||||
wc_deprecated_function( 'WC_Product::get_availability_text', '2.7' );
|
||||
if ( ! $this->is_in_stock() ) {
|
||||
$availability = __( 'Out of stock', 'woocommerce' );
|
||||
} elseif ( $this->managing_stock() && $this->is_on_backorder( 1 ) ) {
|
||||
|
@ -265,7 +265,7 @@ abstract class WC_Abstract_Legacy_Product extends WC_Data {
|
|||
* @return string
|
||||
*/
|
||||
protected function get_availability_class() {
|
||||
_deprecated_function( 'WC_Product::get_availability_class', '2.7' );
|
||||
wc_deprecated_function( 'WC_Product::get_availability_class', '2.7' );
|
||||
if ( ! $this->is_in_stock() ) {
|
||||
$class = 'out-of-stock';
|
||||
} elseif ( $this->managing_stock() && $this->is_on_backorder( 1 ) && $this->backorders_require_notification() ) {
|
||||
|
@ -281,7 +281,7 @@ abstract class WC_Abstract_Legacy_Product extends WC_Data {
|
|||
* @deprecated 2.7.0 Use wc_get_related_products instead.
|
||||
*/
|
||||
public function get_related( $limit = 5 ) {
|
||||
_deprecated_function( 'WC_Product::get_related', '2.7', 'wc_get_related_products' );
|
||||
wc_deprecated_function( 'WC_Product::get_related', '2.7', 'wc_get_related_products' );
|
||||
return wc_get_related_products( $this->get_id(), $limit );
|
||||
}
|
||||
|
||||
|
@ -290,7 +290,7 @@ abstract class WC_Abstract_Legacy_Product extends WC_Data {
|
|||
* @deprecated 2.7.0 Use wc_get_product_term_ids instead.
|
||||
*/
|
||||
protected function get_related_terms( $term ) {
|
||||
_deprecated_function( 'WC_Product::get_related_terms', '2.7', 'wc_get_product_term_ids' );
|
||||
wc_deprecated_function( 'WC_Product::get_related_terms', '2.7', 'wc_get_product_term_ids' );
|
||||
return array_merge( array( 0 ), wc_get_product_term_ids( $this->get_id(), $term ) );
|
||||
}
|
||||
|
||||
|
@ -299,7 +299,7 @@ abstract class WC_Abstract_Legacy_Product extends WC_Data {
|
|||
* @deprecated 2.7.0 Use Product Data Store get_related_products_query instead.
|
||||
*/
|
||||
protected function build_related_query( $cats_array, $tags_array, $exclude_ids, $limit ) {
|
||||
_deprecated_function( 'WC_Product::build_related_query', '2.7', 'Product Data Store get_related_products_query' );
|
||||
wc_deprecated_function( 'WC_Product::build_related_query', '2.7', 'Product Data Store get_related_products_query' );
|
||||
$data_store = WC_Data_Store::load( 'product' );
|
||||
return $data_store->get_related_products_query( $cats_array, $tags_array, $exclude_ids, $limit );
|
||||
}
|
||||
|
@ -311,7 +311,7 @@ abstract class WC_Abstract_Legacy_Product extends WC_Data {
|
|||
* @return WC_Product|WC_Product|WC_Product_variation
|
||||
*/
|
||||
public function get_child( $child_id ) {
|
||||
_deprecated_function( 'WC_Product::get_child', '2.7', 'wc_get_product' );
|
||||
wc_deprecated_function( 'WC_Product::get_child', '2.7', 'wc_get_product' );
|
||||
return wc_get_product( $child_id );
|
||||
}
|
||||
|
||||
|
@ -322,7 +322,7 @@ abstract class WC_Abstract_Legacy_Product extends WC_Data {
|
|||
* @return string
|
||||
*/
|
||||
public function get_price_html_from_text() {
|
||||
_deprecated_function( 'WC_Product::get_price_html_from_text', '2.7' );
|
||||
wc_deprecated_function( 'WC_Product::get_price_html_from_text', '2.7' );
|
||||
$from = '<span class="from">' . _x( 'From:', 'min_price', 'woocommerce' ) . ' </span>';
|
||||
return apply_filters( 'woocommerce_get_price_html_from_text', $from, $this );
|
||||
}
|
||||
|
@ -336,7 +336,7 @@ abstract class WC_Abstract_Legacy_Product extends WC_Data {
|
|||
* @return string
|
||||
*/
|
||||
public function get_price_html_from_to( $from, $to ) {
|
||||
_deprecated_function( 'WC_Product::get_price_html_from_to', '2.7', 'wc_format_sale_price' );
|
||||
wc_deprecated_function( 'WC_Product::get_price_html_from_to', '2.7', 'wc_format_sale_price' );
|
||||
return apply_filters( 'woocommerce_get_price_html_from_to', wc_format_sale_price( $from, $to ), $from, $to, $this );
|
||||
}
|
||||
|
||||
|
@ -349,7 +349,7 @@ abstract class WC_Abstract_Legacy_Product extends WC_Data {
|
|||
* @return string
|
||||
*/
|
||||
public function get_price_suffix( $price = '', $qty = 1 ) {
|
||||
_deprecated_function( 'WC_Product::get_price_suffix', '2.7', 'wc_get_price_suffix' );
|
||||
wc_deprecated_function( 'WC_Product::get_price_suffix', '2.7', 'wc_get_price_suffix' );
|
||||
return wc_get_price_suffix( $this, $price, $qty );
|
||||
}
|
||||
|
||||
|
@ -358,7 +358,7 @@ abstract class WC_Abstract_Legacy_Product extends WC_Data {
|
|||
* @deprecated 2.7.0 Use wc_display_product_attributes instead.
|
||||
*/
|
||||
public function list_attributes() {
|
||||
_deprecated_function( 'WC_Product::list_attributes', '2.7', 'wc_display_product_attributes' );
|
||||
wc_deprecated_function( 'WC_Product::list_attributes', '2.7', 'wc_display_product_attributes' );
|
||||
wc_display_product_attributes( $this );
|
||||
}
|
||||
|
||||
|
@ -371,7 +371,7 @@ abstract class WC_Abstract_Legacy_Product extends WC_Data {
|
|||
* @return string
|
||||
*/
|
||||
public function get_price_including_tax( $qty = 1, $price = '' ) {
|
||||
_deprecated_function( 'WC_Product::get_price_including_tax', '2.7', 'wc_get_price_including_tax' );
|
||||
wc_deprecated_function( 'WC_Product::get_price_including_tax', '2.7', 'wc_get_price_including_tax' );
|
||||
return wc_get_price_including_tax( $this, array( 'qty' => $qty, 'price' => $price ) );
|
||||
}
|
||||
|
||||
|
@ -384,7 +384,7 @@ abstract class WC_Abstract_Legacy_Product extends WC_Data {
|
|||
* @return string
|
||||
*/
|
||||
public function get_display_price( $price = '', $qty = 1 ) {
|
||||
_deprecated_function( 'WC_Product::get_display_price', '2.7', 'wc_get_price_to_display' );
|
||||
wc_deprecated_function( 'WC_Product::get_display_price', '2.7', 'wc_get_price_to_display' );
|
||||
return wc_get_price_to_display( $this, array( 'qty' => $qty, 'price' => $price ) );
|
||||
}
|
||||
|
||||
|
@ -398,7 +398,7 @@ abstract class WC_Abstract_Legacy_Product extends WC_Data {
|
|||
* @return string
|
||||
*/
|
||||
public function get_price_excluding_tax( $qty = 1, $price = '' ) {
|
||||
_deprecated_function( 'WC_Product::get_price_excluding_tax', '2.7', 'wc_get_price_excluding_tax' );
|
||||
wc_deprecated_function( 'WC_Product::get_price_excluding_tax', '2.7', 'wc_get_price_excluding_tax' );
|
||||
return wc_get_price_excluding_tax( $this, array( 'qty' => $qty, 'price' => $price ) );
|
||||
}
|
||||
|
||||
|
@ -409,7 +409,7 @@ abstract class WC_Abstract_Legacy_Product extends WC_Data {
|
|||
* @param mixed $price
|
||||
*/
|
||||
public function adjust_price( $price ) {
|
||||
_deprecated_function( 'WC_Product::adjust_price', '2.7', 'WC_Product::set_price / WC_Product::get_price' );
|
||||
wc_deprecated_function( 'WC_Product::adjust_price', '2.7', 'WC_Product::set_price / WC_Product::get_price' );
|
||||
$this->data['price'] = $this->data['price'] + $price;
|
||||
}
|
||||
|
||||
|
@ -423,7 +423,7 @@ abstract class WC_Abstract_Legacy_Product extends WC_Data {
|
|||
* @return string
|
||||
*/
|
||||
public function get_categories( $sep = ', ', $before = '', $after = '' ) {
|
||||
_deprecated_function( 'WC_Product::get_categories', '2.7', 'wc_get_product_category_list' );
|
||||
wc_deprecated_function( 'WC_Product::get_categories', '2.7', 'wc_get_product_category_list' );
|
||||
return wc_get_product_category_list( $this->get_id(), $sep, $before, $after );
|
||||
}
|
||||
|
||||
|
@ -437,7 +437,7 @@ abstract class WC_Abstract_Legacy_Product extends WC_Data {
|
|||
* @return array
|
||||
*/
|
||||
public function get_tags( $sep = ', ', $before = '', $after = '' ) {
|
||||
_deprecated_function( 'WC_Product::get_tags', '2.7', 'wc_get_product_tag_list' );
|
||||
wc_deprecated_function( 'WC_Product::get_tags', '2.7', 'wc_get_product_tag_list' );
|
||||
return wc_get_product_tag_list( $this->get_id(), $sep, $before, $after );
|
||||
}
|
||||
|
||||
|
@ -448,7 +448,7 @@ abstract class WC_Abstract_Legacy_Product extends WC_Data {
|
|||
* @return WP_Post
|
||||
*/
|
||||
public function get_post_data() {
|
||||
_deprecated_function( 'WC_Product::get_post_data', '2.7', 'get_post' );
|
||||
wc_deprecated_function( 'WC_Product::get_post_data', '2.7', 'get_post' );
|
||||
|
||||
// In order to keep backwards compatibility it's required to use the parent data for variations.
|
||||
if ( $this->is_type( 'variation' ) ) {
|
||||
|
@ -467,7 +467,7 @@ abstract class WC_Abstract_Legacy_Product extends WC_Data {
|
|||
* @return string
|
||||
*/
|
||||
public function get_title() {
|
||||
_deprecated_function( 'WC_Product::get_title', '2.7', 'WC_Product::get_name' );
|
||||
wc_deprecated_function( 'WC_Product::get_title', '2.7', 'WC_Product::get_name' );
|
||||
|
||||
return apply_filters( 'woocommerce_product_title', $this->get_post_data() ? $this->get_post_data()->post_title : '', $this );
|
||||
}
|
||||
|
@ -479,7 +479,7 @@ abstract class WC_Abstract_Legacy_Product extends WC_Data {
|
|||
* @return int
|
||||
*/
|
||||
public function get_parent() {
|
||||
_deprecated_function( 'WC_Product::get_parent', '2.7', 'WC_Product::get_parent_id' );
|
||||
wc_deprecated_function( 'WC_Product::get_parent', '2.7', 'WC_Product::get_parent_id' );
|
||||
return apply_filters( 'woocommerce_product_parent', absint( $this->get_post_data()->post_parent ), $this );
|
||||
}
|
||||
|
||||
|
@ -490,7 +490,7 @@ abstract class WC_Abstract_Legacy_Product extends WC_Data {
|
|||
* @return array
|
||||
*/
|
||||
public function get_upsells() {
|
||||
_deprecated_function( 'WC_Product::get_upsells', '2.7', 'WC_Product::get_upsell_ids' );
|
||||
wc_deprecated_function( 'WC_Product::get_upsells', '2.7', 'WC_Product::get_upsell_ids' );
|
||||
return apply_filters( 'woocommerce_product_upsell_ids', $this->get_upsell_ids(), $this );
|
||||
}
|
||||
|
||||
|
@ -501,7 +501,7 @@ abstract class WC_Abstract_Legacy_Product extends WC_Data {
|
|||
* @return array
|
||||
*/
|
||||
public function get_cross_sells() {
|
||||
_deprecated_function( 'WC_Product::get_cross_sells', '2.7', 'WC_Product::get_cross_sell_ids' );
|
||||
wc_deprecated_function( 'WC_Product::get_cross_sells', '2.7', 'WC_Product::get_cross_sell_ids' );
|
||||
return apply_filters( 'woocommerce_product_crosssell_ids', $this->get_cross_sell_ids(), $this );
|
||||
}
|
||||
|
||||
|
@ -512,7 +512,7 @@ abstract class WC_Abstract_Legacy_Product extends WC_Data {
|
|||
* @return bool
|
||||
*/
|
||||
public function has_default_attributes() {
|
||||
_deprecated_function( 'WC_Product_Variable::has_default_attributes', '2.7', 'Check WC_Product::get_default_attributes directly' );
|
||||
wc_deprecated_function( 'WC_Product_Variable::has_default_attributes', '2.7', 'Check WC_Product::get_default_attributes directly' );
|
||||
if ( ! $this->get_default_attributes() ) {
|
||||
return true;
|
||||
}
|
||||
|
@ -526,7 +526,7 @@ abstract class WC_Abstract_Legacy_Product extends WC_Data {
|
|||
* @return int
|
||||
*/
|
||||
public function get_variation_id() {
|
||||
_deprecated_function( 'WC_Product::get_variation_id', '2.7', 'WC_Product::get_id() will always be the variation ID if this is a variation.' );
|
||||
wc_deprecated_function( 'WC_Product::get_variation_id', '2.7', 'WC_Product::get_id() will always be the variation ID if this is a variation.' );
|
||||
return $this->get_id();
|
||||
}
|
||||
|
||||
|
@ -537,7 +537,7 @@ abstract class WC_Abstract_Legacy_Product extends WC_Data {
|
|||
* @return string
|
||||
*/
|
||||
public function get_variation_description() {
|
||||
_deprecated_function( 'WC_Product::get_variation_description', '2.7', 'WC_Product::get_description()' );
|
||||
wc_deprecated_function( 'WC_Product::get_variation_description', '2.7', 'WC_Product::get_description()' );
|
||||
return $this->get_description();
|
||||
}
|
||||
|
||||
|
@ -548,7 +548,7 @@ abstract class WC_Abstract_Legacy_Product extends WC_Data {
|
|||
* @return boolean
|
||||
*/
|
||||
public function has_all_attributes_set() {
|
||||
_deprecated_function( 'WC_Product::has_all_attributes_set', '2.7' );
|
||||
wc_deprecated_function( 'WC_Product::has_all_attributes_set', '2.7' );
|
||||
$set = true;
|
||||
|
||||
// undefined attributes have null strings as array values
|
||||
|
@ -568,7 +568,7 @@ abstract class WC_Abstract_Legacy_Product extends WC_Data {
|
|||
* @return bool
|
||||
*/
|
||||
public function parent_is_visible() {
|
||||
_deprecated_function( 'WC_Product::parent_is_visible', '2.7' );
|
||||
wc_deprecated_function( 'WC_Product::parent_is_visible', '2.7' );
|
||||
return $this->is_visible();
|
||||
}
|
||||
|
||||
|
@ -579,7 +579,7 @@ abstract class WC_Abstract_Legacy_Product extends WC_Data {
|
|||
* @return int
|
||||
*/
|
||||
public function get_total_stock() {
|
||||
_deprecated_function( 'WC_Product::get_total_stock', '2.7', 'Use get_stock_quantity on each child. Beware of performance issues in doing so.' );
|
||||
wc_deprecated_function( 'WC_Product::get_total_stock', '2.7', 'Use get_stock_quantity on each child. Beware of performance issues in doing so.' );
|
||||
if ( sizeof( $this->get_children() ) > 0 ) {
|
||||
$total_stock = max( 0, $this->get_stock_quantity() );
|
||||
|
||||
|
@ -602,7 +602,7 @@ abstract class WC_Abstract_Legacy_Product extends WC_Data {
|
|||
* @return string
|
||||
*/
|
||||
public function get_formatted_variation_attributes( $flat = false ) {
|
||||
_deprecated_function( 'WC_Product::get_formatted_variation_attributes', '2.7', 'wc_get_formatted_variation' );
|
||||
wc_deprecated_function( 'WC_Product::get_formatted_variation_attributes', '2.7', 'wc_get_formatted_variation' );
|
||||
return wc_get_formatted_variation( $this->get_variation_attributes(), $flat );
|
||||
}
|
||||
|
||||
|
@ -612,7 +612,7 @@ abstract class WC_Abstract_Legacy_Product extends WC_Data {
|
|||
* @deprecated 2.7.0 not used in core.
|
||||
*/
|
||||
public function variable_product_sync( $product_id = '' ) {
|
||||
_deprecated_function( 'WC_Product::variable_product_sync', '2.7' );
|
||||
wc_deprecated_function( 'WC_Product::variable_product_sync', '2.7' );
|
||||
if ( empty( $product_id ) ) {
|
||||
$product_id = $this->get_id();
|
||||
}
|
||||
|
@ -674,7 +674,7 @@ abstract class WC_Abstract_Legacy_Product extends WC_Data {
|
|||
* @deprecated 2.7.0 in favour of Product data store's find_matching_product_variation.
|
||||
*/
|
||||
public function get_matching_variation( $match_attributes = array() ) {
|
||||
_deprecated_function( 'WC_Product::get_matching_variation', '2.7', 'Product data store find_matching_product_variation' );
|
||||
wc_deprecated_function( 'WC_Product::get_matching_variation', '2.7', 'Product data store find_matching_product_variation' );
|
||||
$data_store = WC_Data_Store::load( 'product' );
|
||||
return $data_store->find_matching_product_variation( $this, $match_attributes );
|
||||
}
|
||||
|
@ -685,7 +685,7 @@ abstract class WC_Abstract_Legacy_Product extends WC_Data {
|
|||
* @return bool
|
||||
*/
|
||||
public function enable_dimensions_display() {
|
||||
_deprecated_function( 'WC_Product::enable_dimensions_display', '2.7' );
|
||||
wc_deprecated_function( 'WC_Product::enable_dimensions_display', '2.7' );
|
||||
return apply_filters( 'wc_product_enable_dimensions_display', true ) && ( $this->has_dimensions() || $this->has_weight() || $this->child_has_weight() || $this->child_has_dimensions() );
|
||||
}
|
||||
|
||||
|
@ -697,7 +697,7 @@ abstract class WC_Abstract_Legacy_Product extends WC_Data {
|
|||
* @return string
|
||||
*/
|
||||
public function get_rating_html( $rating = null ) {
|
||||
_deprecated_function( 'WC_Product::get_rating_html', '2.7', 'wc_get_rating_html' );
|
||||
wc_deprecated_function( 'WC_Product::get_rating_html', '2.7', 'wc_get_rating_html' );
|
||||
return wc_get_rating_html( $rating );
|
||||
}
|
||||
|
||||
|
@ -708,7 +708,7 @@ abstract class WC_Abstract_Legacy_Product extends WC_Data {
|
|||
* @param int $post_id
|
||||
*/
|
||||
public static function sync_average_rating( $post_id ) {
|
||||
_deprecated_function( 'WC_Product::sync_average_rating', '2.7', 'WC_Comments::get_average_rating_for_product or leave to CRUD.' );
|
||||
wc_deprecated_function( 'WC_Product::sync_average_rating', '2.7', 'WC_Comments::get_average_rating_for_product or leave to CRUD.' );
|
||||
$average = WC_Comments::get_average_rating_for_product( wc_get_product( $post_id ) );
|
||||
update_post_meta( $post_id, '_wc_average_rating', $average );
|
||||
}
|
||||
|
@ -720,7 +720,7 @@ abstract class WC_Abstract_Legacy_Product extends WC_Data {
|
|||
* @param int $post_id
|
||||
*/
|
||||
public static function sync_rating_count( $post_id ) {
|
||||
_deprecated_function( 'WC_Product::sync_rating_count', '2.7', 'WC_Comments::get_rating_counts_for_product or leave to CRUD.' );
|
||||
wc_deprecated_function( 'WC_Product::sync_rating_count', '2.7', 'WC_Comments::get_rating_counts_for_product or leave to CRUD.' );
|
||||
$counts = WC_Comments::get_rating_counts_for_product( wc_get_product( $post_id ) );
|
||||
update_post_meta( $post_id, '_wc_rating_count', $counts );
|
||||
}
|
||||
|
@ -732,7 +732,7 @@ abstract class WC_Abstract_Legacy_Product extends WC_Data {
|
|||
* @return array
|
||||
*/
|
||||
public function get_files() {
|
||||
wc_soft_deprecated_function( 'WC_Product::get_files', '2.7', '2.8', 'WC_Product::get_downloads' );
|
||||
wc_deprecated_function( 'WC_Product::get_files', '2.7', 'WC_Product::get_downloads' );
|
||||
return $this->get_downloads();
|
||||
}
|
||||
|
||||
|
@ -740,6 +740,6 @@ abstract class WC_Abstract_Legacy_Product extends WC_Data {
|
|||
* @deprected 2.7.0 Sync is taken care of during save - no need to call this directly.
|
||||
*/
|
||||
public function grouped_product_sync() {
|
||||
_deprecated_function( 'WC_Product::grouped_product_sync', '2.7' );
|
||||
wc_deprecated_function( 'WC_Product::grouped_product_sync', '2.7' );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -623,7 +623,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
|||
*/
|
||||
public function set_total( $value, $deprecated = '' ) {
|
||||
if ( $deprecated ) {
|
||||
_deprecated_argument( 'total_type', '2.7', 'Use dedicated total setter methods instead.' );
|
||||
wc_deprecated_argument( 'total_type', '2.7', 'Use dedicated total setter methods instead.' );
|
||||
return $this->legacy_set_total( $value, $deprecated );
|
||||
}
|
||||
$this->set_prop( 'total', wc_format_decimal( $value, wc_get_price_decimals() ) );
|
||||
|
|
|
@ -365,7 +365,7 @@ abstract class WC_Payment_Gateway extends WC_Settings_API {
|
|||
* @param array $fields
|
||||
*/
|
||||
public function credit_card_form( $args = array(), $fields = array() ) {
|
||||
_deprecated_function( 'credit_card_form', '2.6', 'WC_Payment_Gateway_CC->form' );
|
||||
wc_deprecated_function( 'credit_card_form', '2.6', 'WC_Payment_Gateway_CC->form' );
|
||||
$cc_form = new WC_Payment_Gateway_CC;
|
||||
$cc_form->id = $this->id;
|
||||
$cc_form->supports = $this->supports;
|
||||
|
|
|
@ -460,7 +460,7 @@ class WC_Product extends WC_Abstract_Legacy_Product {
|
|||
*/
|
||||
public function get_dimensions( $formatted = true ) {
|
||||
if ( $formatted ) {
|
||||
wc_soft_deprecated_argument( 'WC_Product::get_dimensions', '2.7', '2.8', 'By default, get_dimensions has an argument set to true so that HTML is returned. This is to support the legacy version of the method. To get HTML dimensions, instead use wc_format_dimensions() function. Pass false to this method to return an array of dimensions. This will be the new default behavior in future versions.' );
|
||||
wc_deprecated_argument( 'WC_Product::get_dimensions', '2.7', 'By default, get_dimensions has an argument set to true so that HTML is returned. This is to support the legacy version of the method. To get HTML dimensions, instead use wc_format_dimensions() function. Pass false to this method to return an array of dimensions. This will be the new default behavior in future versions.' );
|
||||
return apply_filters( 'woocommerce_product_dimensions', wc_format_dimensions( $this->get_dimensions( false ) ), $this );
|
||||
}
|
||||
return array(
|
||||
|
|
|
@ -886,7 +886,7 @@ abstract class WC_Settings_API {
|
|||
* @deprecated 2.6.0 No longer used
|
||||
*/
|
||||
public function validate_settings_fields( $form_fields = array() ) {
|
||||
_deprecated_function( 'validate_settings_fields', '2.6' );
|
||||
wc_deprecated_function( 'validate_settings_fields', '2.6' );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -896,7 +896,7 @@ abstract class WC_Settings_API {
|
|||
* @return array
|
||||
*/
|
||||
public function format_settings( $value ) {
|
||||
_deprecated_function( 'format_settings', '2.6' );
|
||||
wc_deprecated_function( 'format_settings', '2.6' );
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ class WC_Admin_Assets {
|
|||
|
||||
if ( has_action( 'woocommerce_admin_css' ) ) {
|
||||
do_action( 'woocommerce_admin_css' );
|
||||
_deprecated_function( 'The woocommerce_admin_css action', '2.3', 'admin_enqueue_scripts' );
|
||||
wc_deprecated_function( 'The woocommerce_admin_css action', '2.3', 'admin_enqueue_scripts' );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -737,7 +737,7 @@ class WC_Admin_Settings {
|
|||
* @deprecated 2.4.0 - doesn't allow manipulation of values!
|
||||
*/
|
||||
if ( has_action( 'woocommerce_update_option_' . sanitize_title( $option['type'] ) ) ) {
|
||||
_deprecated_function( 'The woocommerce_update_option_X action', '2.4.0', 'woocommerce_admin_settings_sanitize_option filter' );
|
||||
wc_deprecated_function( 'The woocommerce_update_option_X action', '2.4.0', 'woocommerce_admin_settings_sanitize_option filter' );
|
||||
do_action( 'woocommerce_update_option_' . sanitize_title( $option['type'] ), $option );
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -928,7 +928,7 @@ class WC_REST_Products_Controller extends WC_REST_Posts_Controller {
|
|||
*/
|
||||
private function save_downloadable_files( $product, $downloads, $deprecated = 0 ) {
|
||||
if ( $deprecated ) {
|
||||
_deprecated_argument( 'variation_id', '2.7', 'save_downloadable_files() not requires a variation_id anymore.' );
|
||||
wc_deprecated_argument( 'variation_id', '2.7', 'save_downloadable_files() not requires a variation_id anymore.' );
|
||||
}
|
||||
|
||||
$files = array();
|
||||
|
|
|
@ -127,7 +127,7 @@ class WC_REST_Shipping_Zones_Controller extends WC_REST_Shipping_Zones_Controlle
|
|||
$zone->set_zone_order( $request->get_param( 'order' ) );
|
||||
}
|
||||
|
||||
$zone->create();
|
||||
$zone->save();
|
||||
|
||||
if ( $zone->get_id() !== 0 ) {
|
||||
$request->set_param( 'id', $zone->get_id() );
|
||||
|
|
|
@ -1498,7 +1498,7 @@ class WC_API_Products extends WC_API_Resource {
|
|||
*/
|
||||
private function save_downloadable_files( $product, $downloads, $deprecated = 0 ) {
|
||||
if ( $deprecated ) {
|
||||
_deprecated_argument( 'variation_id', '2.7', 'save_downloadable_files() not requires a variation_id anymore.' );
|
||||
wc_deprecated_argument( 'variation_id', '2.7', 'save_downloadable_files() not requires a variation_id anymore.' );
|
||||
}
|
||||
|
||||
$files = array();
|
||||
|
|
|
@ -1997,7 +1997,7 @@ class WC_API_Products extends WC_API_Resource {
|
|||
*/
|
||||
private function save_downloadable_files( $product, $downloads, $deprecated = 0 ) {
|
||||
if ( $deprecated ) {
|
||||
_deprecated_argument( 'variation_id', '2.7', 'save_downloadable_files() not requires a variation_id anymore.' );
|
||||
wc_deprecated_argument( 'variation_id', '2.7', 'save_downloadable_files() not requires a variation_id anymore.' );
|
||||
}
|
||||
|
||||
$files = array();
|
||||
|
|
|
@ -143,11 +143,11 @@ class WC_Cart {
|
|||
return $this->get_cart_contents_count();
|
||||
break;
|
||||
case 'tax' :
|
||||
_deprecated_argument( 'WC_Cart->tax', '2.3', 'Use WC_Tax:: directly' );
|
||||
wc_deprecated_argument( 'WC_Cart->tax', '2.3', 'Use WC_Tax:: directly' );
|
||||
$this->tax = new WC_Tax();
|
||||
return $this->tax;
|
||||
case 'discount_total':
|
||||
_deprecated_argument( 'WC_Cart->discount_total', '2.3', 'After tax coupons are no longer supported. For more information see: https://woocommerce.wordpress.com/2014/12/upcoming-coupon-changes-in-woocommerce-2-3/' );
|
||||
wc_deprecated_argument( 'WC_Cart->discount_total', '2.3', 'After tax coupons are no longer supported. For more information see: https://woocommerce.wordpress.com/2014/12/upcoming-coupon-changes-in-woocommerce-2-3/' );
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -682,7 +682,7 @@ class WC_Cart {
|
|||
*/
|
||||
public function get_cart() {
|
||||
if ( ! did_action( 'wp_loaded' ) ) {
|
||||
_doing_it_wrong( __FUNCTION__, __( 'Get cart should not be called before the wp_loaded action.', 'woocommerce' ), '2.3' );
|
||||
wc_doing_it_wrong( __FUNCTION__, __( 'Get cart should not be called before the wp_loaded action.', 'woocommerce' ), '2.3' );
|
||||
}
|
||||
if ( ! did_action( 'woocommerce_cart_loaded_from_session' ) ) {
|
||||
$this->get_cart_from_session();
|
||||
|
@ -2247,7 +2247,7 @@ class WC_Cart {
|
|||
* @return mixed formatted price or false if there are none
|
||||
*/
|
||||
public function get_discounts_before_tax() {
|
||||
_deprecated_function( 'get_discounts_before_tax', '2.3', 'get_total_discount' );
|
||||
wc_deprecated_function( 'get_discounts_before_tax', '2.3', 'get_total_discount' );
|
||||
if ( $this->get_cart_discount_total() ) {
|
||||
$discounts_before_tax = wc_price( $this->get_cart_discount_total() );
|
||||
} else {
|
||||
|
@ -2263,7 +2263,7 @@ class WC_Cart {
|
|||
* @return int
|
||||
*/
|
||||
public function get_order_discount_total() {
|
||||
_deprecated_function( 'get_order_discount_total', '2.3' );
|
||||
wc_deprecated_function( 'get_order_discount_total', '2.3' );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -2272,7 +2272,7 @@ class WC_Cart {
|
|||
* @deprecated Coupons can not be applied after tax
|
||||
*/
|
||||
public function apply_cart_discounts_after_tax( $values, $price ) {
|
||||
_deprecated_function( 'apply_cart_discounts_after_tax', '2.3' );
|
||||
wc_deprecated_function( 'apply_cart_discounts_after_tax', '2.3' );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2280,7 +2280,7 @@ class WC_Cart {
|
|||
* @deprecated Coupons can not be applied after tax
|
||||
*/
|
||||
public function apply_product_discounts_after_tax( $values, $price ) {
|
||||
_deprecated_function( 'apply_product_discounts_after_tax', '2.3' );
|
||||
wc_deprecated_function( 'apply_product_discounts_after_tax', '2.3' );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2288,6 +2288,6 @@ class WC_Cart {
|
|||
* @deprecated Coupons can not be applied after tax
|
||||
*/
|
||||
public function get_discounts_after_tax() {
|
||||
_deprecated_function( 'get_discounts_after_tax', '2.3' );
|
||||
wc_deprecated_function( 'get_discounts_after_tax', '2.3' );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ class WC_Checkout {
|
|||
* @since 2.1
|
||||
*/
|
||||
public function __clone() {
|
||||
_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'woocommerce' ), '2.1' );
|
||||
wc_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'woocommerce' ), '2.1' );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -80,7 +80,7 @@ class WC_Checkout {
|
|||
* @since 2.1
|
||||
*/
|
||||
public function __wakeup() {
|
||||
_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'woocommerce' ), '2.1' );
|
||||
wc_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'woocommerce' ), '2.1' );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -404,7 +404,7 @@ class WC_Checkout {
|
|||
$this->posted['ship_to_different_address'] = ! empty( $_POST['ship_to_different_address'] );
|
||||
|
||||
if ( isset( $_POST['shiptobilling'] ) ) {
|
||||
_deprecated_argument( 'WC_Checkout::process_checkout()', '2.1', 'The "shiptobilling" field is deprecated. The template files are out of date' );
|
||||
wc_deprecated_argument( 'WC_Checkout::process_checkout()', '2.1', 'The "shiptobilling" field is deprecated. The template files are out of date' );
|
||||
|
||||
$this->posted['ship_to_different_address'] = $_POST['shiptobilling'] ? false : true;
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ class WC_Coupon extends WC_Legacy_Coupon {
|
|||
if ( $data instanceof WC_Coupon ) {
|
||||
$this->set_id( absint( $data->get_id() ) );
|
||||
} elseif ( $coupon = apply_filters( 'woocommerce_get_shop_coupon_data', false, $data ) ) {
|
||||
_doing_it_wrong( 'woocommerce_get_shop_coupon_data', 'Reading a manual coupon via woocommerce_get_shop_coupon_data has been deprecated. Please sent an instance of WC_Coupon instead.', '2.7' );
|
||||
wc_doing_it_wrong( 'woocommerce_get_shop_coupon_data', 'Reading a manual coupon via woocommerce_get_shop_coupon_data has been deprecated. Please sent an instance of WC_Coupon instead.', '2.7' );
|
||||
$this->read_manual_coupon( $data, $coupon );
|
||||
} elseif ( is_numeric( $data ) && 'shop_coupon' === get_post_type( $data ) ) {
|
||||
$this->set_id( $data );
|
||||
|
@ -665,20 +665,20 @@ class WC_Coupon extends WC_Legacy_Coupon {
|
|||
case 'excluded_product_ids' :
|
||||
case 'exclude_product_ids' :
|
||||
if ( ! is_array( $coupon[ $key ] ) ) {
|
||||
_doing_it_wrong( $key, $key . ' should be an array instead of a string.', '2.7' );
|
||||
wc_doing_it_wrong( $key, $key . ' should be an array instead of a string.', '2.7' );
|
||||
$coupon['excluded_product_ids'] = wc_string_to_array( $value );
|
||||
}
|
||||
break;
|
||||
case 'exclude_product_categories' :
|
||||
case 'excluded_product_categories' :
|
||||
if ( ! is_array( $coupon[ $key ] ) ) {
|
||||
_doing_it_wrong( $key, $key . ' should be an array instead of a string.', '2.7' );
|
||||
wc_doing_it_wrong( $key, $key . ' should be an array instead of a string.', '2.7' );
|
||||
$coupon['excluded_product_categories'] = wc_string_to_array( $value );
|
||||
}
|
||||
break;
|
||||
case 'product_ids' :
|
||||
if ( ! is_array( $coupon[ $key ] ) ) {
|
||||
_doing_it_wrong( $key, $key . ' should be an array instead of a string.', '2.7' );
|
||||
wc_doing_it_wrong( $key, $key . ' should be an array instead of a string.', '2.7' );
|
||||
$coupon[ $key ] = wc_string_to_array( $value );
|
||||
}
|
||||
break;
|
||||
|
@ -686,7 +686,7 @@ class WC_Coupon extends WC_Legacy_Coupon {
|
|||
case 'free_shipping' :
|
||||
case 'exclude_sale_items' :
|
||||
if ( ! is_bool( $coupon[ $key ] ) ) {
|
||||
_doing_it_wrong( $key, $key . ' should be true or false instead of yes or no.', '2.7' );
|
||||
wc_doing_it_wrong( $key, $key . ' should be true or false instead of yes or no.', '2.7' );
|
||||
$coupon[ $key ] = wc_string_to_bool( $value );
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -45,7 +45,7 @@ class WC_Emails {
|
|||
* @since 2.1
|
||||
*/
|
||||
public function __clone() {
|
||||
_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'woocommerce' ), '2.1' );
|
||||
wc_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'woocommerce' ), '2.1' );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -54,7 +54,7 @@ class WC_Emails {
|
|||
* @since 2.1
|
||||
*/
|
||||
public function __wakeup() {
|
||||
_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'woocommerce' ), '2.1' );
|
||||
wc_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'woocommerce' ), '2.1' );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -472,7 +472,7 @@ class WC_Emails {
|
|||
* @param bool $plain_text (default: false)
|
||||
*/
|
||||
public function order_schema_markup( $order, $sent_to_admin = false, $plain_text = false ) {
|
||||
_deprecated_function( 'WC_Emails::order_schema_markup', '2.7', 'WC_Structured_Data::generate_order_data' );
|
||||
wc_deprecated_function( 'WC_Emails::order_schema_markup', '2.7', 'WC_Structured_Data::generate_order_data' );
|
||||
|
||||
WC()->structured_data->generate_order_data( $order, $sent_to_admin, $plain_text );
|
||||
WC()->structured_data->output_structured_data();
|
||||
|
|
|
@ -148,7 +148,7 @@ class WC_Order_Item_Meta {
|
|||
*/
|
||||
public function get_formatted_legacy( $hideprefix = '_' ) {
|
||||
if ( ! is_ajax() ) {
|
||||
_deprecated_function( 'get_formatted_legacy', '2.4', 'Item Meta Data is being called with legacy arguments' );
|
||||
wc_deprecated_function( 'get_formatted_legacy', '2.4', 'Item Meta Data is being called with legacy arguments' );
|
||||
}
|
||||
|
||||
$formatted_meta = array();
|
||||
|
|
|
@ -159,7 +159,7 @@ class WC_Order_Refund extends WC_Abstract_Order {
|
|||
* @return mixed
|
||||
*/
|
||||
public function __get( $key ) {
|
||||
_doing_it_wrong( $key, 'Refund properties should not be accessed directly.', '2.7' );
|
||||
wc_doing_it_wrong( $key, 'Refund properties should not be accessed directly.', '2.7' );
|
||||
/**
|
||||
* Maps legacy vars to new getters.
|
||||
*/
|
||||
|
@ -178,7 +178,7 @@ class WC_Order_Refund extends WC_Abstract_Order {
|
|||
* @return bool
|
||||
*/
|
||||
public function get_refund( $id = 0 ) {
|
||||
_deprecated_function( 'get_refund', '2.7', 'read' );
|
||||
wc_deprecated_function( 'get_refund', '2.7', 'read' );
|
||||
if ( ! $id ) {
|
||||
return false;
|
||||
}
|
||||
|
@ -195,7 +195,7 @@ class WC_Order_Refund extends WC_Abstract_Order {
|
|||
* @return int|float
|
||||
*/
|
||||
public function get_refund_amount() {
|
||||
_deprecated_function( 'get_refund_amount', '2.7', 'get_amount' );
|
||||
wc_deprecated_function( 'get_refund_amount', '2.7', 'get_amount' );
|
||||
return $this->get_amount();
|
||||
}
|
||||
|
||||
|
@ -205,7 +205,7 @@ class WC_Order_Refund extends WC_Abstract_Order {
|
|||
* @return int|float
|
||||
*/
|
||||
public function get_refund_reason() {
|
||||
_deprecated_function( 'get_refund_reason', '2.7', 'get_reason' );
|
||||
wc_deprecated_function( 'get_refund_reason', '2.7', 'get_reason' );
|
||||
return $this->get_reason();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ class WC_Payment_Gateways {
|
|||
* @since 2.1
|
||||
*/
|
||||
public function __clone() {
|
||||
_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'woocommerce' ), '2.1' );
|
||||
wc_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'woocommerce' ), '2.1' );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -57,7 +57,7 @@ class WC_Payment_Gateways {
|
|||
* @since 2.1
|
||||
*/
|
||||
public function __wakeup() {
|
||||
_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'woocommerce' ), '2.1' );
|
||||
wc_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'woocommerce' ), '2.1' );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -61,11 +61,11 @@ class WC_Product_Variable extends WC_Product {
|
|||
*/
|
||||
public function get_children( $context = 'view' ) {
|
||||
if ( is_bool( $context ) ) {
|
||||
_deprecated_argument( 'visible_only', '2.7', 'WC_Product_Variable::get_visible_children' );
|
||||
wc_deprecated_argument( 'visible_only', '2.7', 'WC_Product_Variable::get_visible_children' );
|
||||
return $context ? $this->get_visible_children() : $this->get_children();
|
||||
}
|
||||
if ( has_filter( 'woocommerce_get_children' ) ) {
|
||||
_deprecated_function( 'The woocommerce_get_children filter', '', 'woocommerce_product_get_children or woocommerce_product_get_visible_children' );
|
||||
wc_deprecated_function( 'The woocommerce_get_children filter', '', 'woocommerce_product_get_children or woocommerce_product_get_visible_children' );
|
||||
}
|
||||
return apply_filters( 'woocommerce_get_children', $this->get_prop( 'children', $context ), $this, false );
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ class WC_Product_Variable extends WC_Product {
|
|||
*/
|
||||
public function get_visible_children( $context = 'view' ) {
|
||||
if ( has_filter( 'woocommerce_get_children' ) ) {
|
||||
_deprecated_function( 'The woocommerce_get_children filter', '', 'woocommerce_product_get_children or woocommerce_product_get_visible_children' );
|
||||
wc_deprecated_function( 'The woocommerce_get_children filter', '', 'woocommerce_product_get_children or woocommerce_product_get_visible_children' );
|
||||
}
|
||||
return apply_filters( 'woocommerce_get_children', $this->get_prop( 'visible_children', $context ), $this, true );
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ class WC_Product_Variable extends WC_Product {
|
|||
*/
|
||||
public function get_variation_prices( $context = 'view' ) {
|
||||
if ( is_bool( $context ) ) {
|
||||
_deprecated_argument( 'display', '2.7', 'Use WC_Product_Variable::get_variation_prices_including_taxes' );
|
||||
wc_deprecated_argument( 'display', '2.7', 'Use WC_Product_Variable::get_variation_prices_including_taxes' );
|
||||
return $context ? $this->get_variation_prices_including_taxes() : $this->get_variation_prices();
|
||||
}
|
||||
return $this->get_prop( 'variation_prices', $context );
|
||||
|
|
|
@ -508,7 +508,7 @@ class WC_Query {
|
|||
public function order_by_rating_post_clauses( $args ) {
|
||||
global $wpdb;
|
||||
|
||||
_deprecated_function( 'order_by_rating_post_clauses', '2.7' );
|
||||
wc_deprecated_function( 'order_by_rating_post_clauses', '2.7' );
|
||||
|
||||
$args['fields'] .= ", AVG( $wpdb->commentmeta.meta_value ) as average_rating ";
|
||||
$args['where'] .= " AND ( $wpdb->commentmeta.meta_key = 'rating' OR $wpdb->commentmeta.meta_key IS null ) ";
|
||||
|
@ -713,7 +713,7 @@ class WC_Query {
|
|||
* @deprecated 2.6.0
|
||||
*/
|
||||
public function layered_nav_init() {
|
||||
_deprecated_function( 'layered_nav_init', '2.6' );
|
||||
wc_deprecated_function( 'layered_nav_init', '2.6' );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -721,7 +721,7 @@ class WC_Query {
|
|||
* @deprecated 2.6.0 due to performance concerns
|
||||
*/
|
||||
public function get_products_in_view() {
|
||||
_deprecated_function( 'get_products_in_view', '2.6' );
|
||||
wc_deprecated_function( 'get_products_in_view', '2.6' );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -729,6 +729,6 @@ class WC_Query {
|
|||
* @deprecated 2.6.0 due to performance concerns
|
||||
*/
|
||||
public function layered_nav_query( $filtered_posts ) {
|
||||
_deprecated_function( 'layered_nav_query', '2.6' );
|
||||
wc_deprecated_function( 'layered_nav_query', '2.6' );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ class WC_Shipping {
|
|||
* @since 2.1
|
||||
*/
|
||||
public function __clone() {
|
||||
_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'woocommerce' ), '2.1' );
|
||||
wc_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'woocommerce' ), '2.1' );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -75,7 +75,7 @@ class WC_Shipping {
|
|||
* @since 2.1
|
||||
*/
|
||||
public function __wakeup() {
|
||||
_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'woocommerce' ), '2.1' );
|
||||
wc_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'woocommerce' ), '2.1' );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -402,7 +402,7 @@ class WC_Shipping {
|
|||
* @deprecated 2.6.0 Was previously used to determine sort order of methods, but this is now controlled by zones and thus unused.
|
||||
*/
|
||||
public function sort_shipping_methods() {
|
||||
_deprecated_function( 'sort_shipping_methods', '2.6' );
|
||||
wc_deprecated_function( 'sort_shipping_methods', '2.6' );
|
||||
return $this->shipping_methods;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ abstract class WC_Legacy_Coupon extends WC_Data {
|
|||
* @return mixed
|
||||
*/
|
||||
public function __get( $key ) {
|
||||
_doing_it_wrong( $key, 'Coupon properties should not be accessed directly.', '2.7' );
|
||||
wc_doing_it_wrong( $key, 'Coupon properties should not be accessed directly.', '2.7' );
|
||||
|
||||
switch ( $key ) {
|
||||
case 'id' :
|
||||
|
@ -140,7 +140,7 @@ abstract class WC_Legacy_Coupon extends WC_Data {
|
|||
* @return array
|
||||
*/
|
||||
public function format_array( $array ) {
|
||||
_deprecated_function( 'format_array', '2.7' );
|
||||
wc_deprecated_function( 'format_array', '2.7' );
|
||||
if ( ! is_array( $array ) ) {
|
||||
if ( is_serialized( $array ) ) {
|
||||
$array = maybe_unserialize( $array );
|
||||
|
@ -158,7 +158,7 @@ abstract class WC_Legacy_Coupon extends WC_Data {
|
|||
* @return bool
|
||||
*/
|
||||
public function apply_before_tax() {
|
||||
_deprecated_function( 'apply_before_tax', '2.7' );
|
||||
wc_deprecated_function( 'apply_before_tax', '2.7' );
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -168,7 +168,7 @@ abstract class WC_Legacy_Coupon extends WC_Data {
|
|||
* @return bool
|
||||
*/
|
||||
public function enable_free_shipping() {
|
||||
_deprecated_function( 'enable_free_shipping', '2.7', 'get_free_shipping' );
|
||||
wc_deprecated_function( 'enable_free_shipping', '2.7', 'get_free_shipping' );
|
||||
return $this->get_free_shipping();
|
||||
}
|
||||
|
||||
|
@ -178,7 +178,7 @@ abstract class WC_Legacy_Coupon extends WC_Data {
|
|||
* @return bool
|
||||
*/
|
||||
public function exclude_sale_items() {
|
||||
_deprecated_function( 'exclude_sale_items', '2.7', 'get_exclude_sale_items' );
|
||||
wc_deprecated_function( 'exclude_sale_items', '2.7', 'get_exclude_sale_items' );
|
||||
return $this->get_exclude_sale_items();
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ abstract class WC_Legacy_Customer extends WC_Data {
|
|||
* @return string
|
||||
*/
|
||||
public function __get( $key ) {
|
||||
_doing_it_wrong( $key, 'Customer properties should not be accessed directly.', '2.7' );
|
||||
wc_doing_it_wrong( $key, 'Customer properties should not be accessed directly.', '2.7' );
|
||||
$key = $this->filter_legacy_key( $key );
|
||||
if ( in_array( $key, array( 'country', 'state', 'postcode', 'city', 'address_1', 'address', 'address_2' ) ) ) {
|
||||
$key = 'billing_' . $key;
|
||||
|
@ -62,7 +62,7 @@ abstract class WC_Legacy_Customer extends WC_Data {
|
|||
* @param mixed $key
|
||||
*/
|
||||
public function __set( $key, $value ) {
|
||||
_doing_it_wrong( $key, 'Customer properties should not be set directly.', '2.7' );
|
||||
wc_doing_it_wrong( $key, 'Customer properties should not be set directly.', '2.7' );
|
||||
$key = $this->filter_legacy_key( $key );
|
||||
|
||||
if ( is_callable( array( $this, "set_{$key}" ) ) ) {
|
||||
|
@ -106,7 +106,7 @@ abstract class WC_Legacy_Customer extends WC_Data {
|
|||
* @return string
|
||||
*/
|
||||
public function get_default_country() {
|
||||
_deprecated_function( 'WC_Customer::get_default_country', '2.7', 'wc_get_customer_default_location' );
|
||||
wc_deprecated_function( 'WC_Customer::get_default_country', '2.7', 'wc_get_customer_default_location' );
|
||||
$default = wc_get_customer_default_location();
|
||||
return $default['country'];
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ abstract class WC_Legacy_Customer extends WC_Data {
|
|||
* @return string
|
||||
*/
|
||||
public function get_default_state() {
|
||||
_deprecated_function( 'WC_Customer::get_default_state', '2.7', 'wc_get_customer_default_location' );
|
||||
wc_deprecated_function( 'WC_Customer::get_default_state', '2.7', 'wc_get_customer_default_location' );
|
||||
$default = wc_get_customer_default_location();
|
||||
return $default['state'];
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ abstract class WC_Legacy_Customer extends WC_Data {
|
|||
* Set customer address to match shop base address.
|
||||
*/
|
||||
public function set_to_base() {
|
||||
_deprecated_function( 'WC_Customer::set_to_base', '2.7', 'WC_Customer::set_billing_address_to_base' );
|
||||
wc_deprecated_function( 'WC_Customer::set_to_base', '2.7', 'WC_Customer::set_billing_address_to_base' );
|
||||
$this->set_billing_address_to_base();
|
||||
}
|
||||
|
||||
|
@ -133,7 +133,7 @@ abstract class WC_Legacy_Customer extends WC_Data {
|
|||
* Set customer shipping address to base address.
|
||||
*/
|
||||
public function set_shipping_to_base() {
|
||||
_deprecated_function( 'WC_Customer::set_shipping_to_base', '2.7', 'WC_Customer::set_shipping_address_to_base' );
|
||||
wc_deprecated_function( 'WC_Customer::set_shipping_to_base', '2.7', 'WC_Customer::set_shipping_address_to_base' );
|
||||
$this->set_shipping_address_to_base();
|
||||
}
|
||||
|
||||
|
@ -142,7 +142,7 @@ abstract class WC_Legacy_Customer extends WC_Data {
|
|||
* @param boolean $calculated
|
||||
*/
|
||||
public function calculated_shipping( $calculated = true ) {
|
||||
_deprecated_function( 'WC_Customer::calculated_shipping', '2.7', 'WC_Customer::set_calculated_shipping' );
|
||||
wc_deprecated_function( 'WC_Customer::calculated_shipping', '2.7', 'WC_Customer::set_calculated_shipping' );
|
||||
$this->set_calculated_shipping( $calculated );
|
||||
}
|
||||
|
||||
|
@ -150,7 +150,7 @@ abstract class WC_Legacy_Customer extends WC_Data {
|
|||
* Set default data for a customer.
|
||||
*/
|
||||
public function set_default_data() {
|
||||
_deprecated_function( 'WC_Customer::set_default_data', '2.7' );
|
||||
wc_deprecated_function( 'WC_Customer::set_default_data', '2.7' );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -165,7 +165,7 @@ abstract class WC_Legacy_Customer extends WC_Data {
|
|||
* @return bool
|
||||
*/
|
||||
function is_paying_customer( $user_id = '' ) {
|
||||
_deprecated_function( 'WC_Customer::is_paying_customer', '2.7', 'WC_Customer::get_is_paying_customer' );
|
||||
wc_deprecated_function( 'WC_Customer::is_paying_customer', '2.7', 'WC_Customer::get_is_paying_customer' );
|
||||
if ( ! empty( $user_id ) ) {
|
||||
$user_id = get_current_user_id();
|
||||
}
|
||||
|
@ -176,7 +176,7 @@ abstract class WC_Legacy_Customer extends WC_Data {
|
|||
* Legacy get country.
|
||||
*/
|
||||
function get_country() {
|
||||
_deprecated_function( 'WC_Customer::get_country', '2.7', 'WC_Customer::get_billing_country' );
|
||||
wc_deprecated_function( 'WC_Customer::get_country', '2.7', 'WC_Customer::get_billing_country' );
|
||||
return $this->get_billing_country();
|
||||
}
|
||||
|
||||
|
@ -184,7 +184,7 @@ abstract class WC_Legacy_Customer extends WC_Data {
|
|||
* Legacy get state.
|
||||
*/
|
||||
function get_state() {
|
||||
_deprecated_function( 'WC_Customer::get_state', '2.7', 'WC_Customer::get_billing_state' );
|
||||
wc_deprecated_function( 'WC_Customer::get_state', '2.7', 'WC_Customer::get_billing_state' );
|
||||
return $this->get_billing_state();
|
||||
}
|
||||
|
||||
|
@ -192,7 +192,7 @@ abstract class WC_Legacy_Customer extends WC_Data {
|
|||
* Legacy get postcode.
|
||||
*/
|
||||
function get_postcode() {
|
||||
_deprecated_function( 'WC_Customer::get_postcode', '2.7', 'WC_Customer::get_billing_postcode' );
|
||||
wc_deprecated_function( 'WC_Customer::get_postcode', '2.7', 'WC_Customer::get_billing_postcode' );
|
||||
return $this->get_billing_postcode();
|
||||
}
|
||||
|
||||
|
@ -200,7 +200,7 @@ abstract class WC_Legacy_Customer extends WC_Data {
|
|||
* Legacy get city.
|
||||
*/
|
||||
function get_city() {
|
||||
_deprecated_function( 'WC_Customer::get_city', '2.7', 'WC_Customer::get_billing_city' );
|
||||
wc_deprecated_function( 'WC_Customer::get_city', '2.7', 'WC_Customer::get_billing_city' );
|
||||
return $this->get_billing_city();
|
||||
}
|
||||
|
||||
|
@ -208,7 +208,7 @@ abstract class WC_Legacy_Customer extends WC_Data {
|
|||
* Legacy set country.
|
||||
*/
|
||||
function set_country( $country ) {
|
||||
_deprecated_function( 'WC_Customer::set_country', '2.7', 'WC_Customer::set_billing_country' );
|
||||
wc_deprecated_function( 'WC_Customer::set_country', '2.7', 'WC_Customer::set_billing_country' );
|
||||
$this->set_billing_country( $country );
|
||||
}
|
||||
|
||||
|
@ -216,7 +216,7 @@ abstract class WC_Legacy_Customer extends WC_Data {
|
|||
* Legacy set state.
|
||||
*/
|
||||
function set_state( $state ) {
|
||||
_deprecated_function( 'WC_Customer::set_state', '2.7', 'WC_Customer::set_billing_state' );
|
||||
wc_deprecated_function( 'WC_Customer::set_state', '2.7', 'WC_Customer::set_billing_state' );
|
||||
$this->set_billing_state( $state );
|
||||
}
|
||||
|
||||
|
@ -224,7 +224,7 @@ abstract class WC_Legacy_Customer extends WC_Data {
|
|||
* Legacy set postcode.
|
||||
*/
|
||||
function set_postcode( $postcode ) {
|
||||
_deprecated_function( 'WC_Customer::set_postcode', '2.7', 'WC_Customer::set_billing_postcode' );
|
||||
wc_deprecated_function( 'WC_Customer::set_postcode', '2.7', 'WC_Customer::set_billing_postcode' );
|
||||
$this->set_billing_postcode( $postcode );
|
||||
}
|
||||
|
||||
|
@ -232,7 +232,7 @@ abstract class WC_Legacy_Customer extends WC_Data {
|
|||
* Legacy set city.
|
||||
*/
|
||||
function set_city( $city ) {
|
||||
_deprecated_function( 'WC_Customer::set_city', '2.7', 'WC_Customer::set_billing_city' );
|
||||
wc_deprecated_function( 'WC_Customer::set_city', '2.7', 'WC_Customer::set_billing_city' );
|
||||
$this->set_billing_city( $city );
|
||||
}
|
||||
|
||||
|
@ -240,7 +240,7 @@ abstract class WC_Legacy_Customer extends WC_Data {
|
|||
* Legacy set address.
|
||||
*/
|
||||
function set_address( $address ) {
|
||||
_deprecated_function( 'WC_Customer::set_address', '2.7', 'WC_Customer::set_billing_address' );
|
||||
wc_deprecated_function( 'WC_Customer::set_address', '2.7', 'WC_Customer::set_billing_address' );
|
||||
$this->set_billing_address( $address );
|
||||
}
|
||||
|
||||
|
@ -248,7 +248,7 @@ abstract class WC_Legacy_Customer extends WC_Data {
|
|||
* Legacy set address.
|
||||
*/
|
||||
function set_address_2( $address ) {
|
||||
_deprecated_function( 'WC_Customer::set_address_2', '2.7', 'WC_Customer::set_billing_address_2' );
|
||||
wc_deprecated_function( 'WC_Customer::set_address_2', '2.7', 'WC_Customer::set_billing_address_2' );
|
||||
$this->set_billing_address_2( $address );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ abstract class WC_Legacy_Shipping_Zone extends WC_Data {
|
|||
* @deprecated 2.7
|
||||
*/
|
||||
public function get_zone_id() {
|
||||
// wc_soft_deprecated_function( 'WC_Shipping_Zone::get_zone_id', '2.7', '2.8', 'WC_Shipping_Zone::get_id' );
|
||||
wc_deprecated_function( 'WC_Shipping_Zone::get_zone_id', '2.7', 'WC_Shipping_Zone::get_id' );
|
||||
return $this->get_id();
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@ abstract class WC_Legacy_Shipping_Zone extends WC_Data {
|
|||
* @deprecated 2.7.0 - Init a shipping zone with an ID.
|
||||
*/
|
||||
public function read( $zone_id ) {
|
||||
// wc_soft_deprecated_function( 'WC_Shipping_Zone::read', '2.7', '2.8', 'Init a shipping zone with an ID.' );
|
||||
wc_deprecated_function( 'WC_Shipping_Zone::read', '2.7', 'Init a shipping zone with an ID.' );
|
||||
$this->set_id( $zone_id );
|
||||
$data_store = WC_Data_Store::load( 'shipping-zone' );
|
||||
$data_store->read( $this );
|
||||
|
@ -39,7 +39,7 @@ abstract class WC_Legacy_Shipping_Zone extends WC_Data {
|
|||
* @deprecated 2.7.0 - Use ::save instead.
|
||||
*/
|
||||
public function update() {
|
||||
// wc_soft_deprecated_function( 'WC_Shipping_Zone::update', '2.7', '2.8', 'Use ::save instead.' );
|
||||
wc_deprecated_function( 'WC_Shipping_Zone::update', '2.7', 'Use ::save instead.' );
|
||||
$data_store = WC_Data_Store::load( 'shipping-zone' );
|
||||
try {
|
||||
$data_store->update( $this );
|
||||
|
@ -53,7 +53,7 @@ abstract class WC_Legacy_Shipping_Zone extends WC_Data {
|
|||
* @deprecated 2.7.0 - Use ::save instead.
|
||||
*/
|
||||
public function create() {
|
||||
// wc_soft_deprecated_function( 'WC_Shipping_Zone::create', '2.7', '2.8', 'Use ::save instead.' );
|
||||
wc_deprecated_function( 'WC_Shipping_Zone::create', '2.7', 'Use ::save instead.' );
|
||||
$data_store = WC_Data_Store::load( 'shipping-zone' );
|
||||
try {
|
||||
$data_store->create( $this );
|
||||
|
|
|
@ -36,7 +36,7 @@ class WC_Shortcode_Checkout {
|
|||
|
||||
// Backwards compat with old pay and thanks link arguments
|
||||
if ( isset( $_GET['order'] ) && isset( $_GET['key'] ) ) {
|
||||
_deprecated_argument( __CLASS__ . '->' . __FUNCTION__, '2.1', '"order" is no longer used to pass an order ID. Use the order-pay or order-received endpoint instead.' );
|
||||
wc_deprecated_argument( __CLASS__ . '->' . __FUNCTION__, '2.1', '"order" is no longer used to pass an order ID. Use the order-pay or order-received endpoint instead.' );
|
||||
|
||||
// Get the order to work out what we are showing
|
||||
$order_id = absint( $_GET['order'] );
|
||||
|
|
|
@ -82,7 +82,7 @@ class WC_Shortcode_My_Account {
|
|||
}
|
||||
}
|
||||
|
||||
_deprecated_function( 'Your theme version of my-account.php template', '2.6', 'the latest version, which supports multiple account pages and navigation, from WC 2.6.0' );
|
||||
wc_deprecated_function( 'Your theme version of my-account.php template', '2.6', 'the latest version, which supports multiple account pages and navigation, from WC 2.6.0' );
|
||||
}
|
||||
|
||||
// Send output buffer
|
||||
|
|
|
@ -27,7 +27,7 @@ abstract class WP_REST_Controller {
|
|||
* Register the routes for the objects of the controller.
|
||||
*/
|
||||
public function register_routes() {
|
||||
_doing_it_wrong( 'WP_REST_Controller::register_routes', __( 'The register_routes() method must be overriden', 'woocommerce' ), 'WPAPI-2.0' );
|
||||
wc_doing_it_wrong( 'WP_REST_Controller::register_routes', __( 'The register_routes() method must be overriden', 'woocommerce' ), 'WPAPI-2.0' );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -142,7 +142,7 @@ if ( ! function_exists( 'register_api_field' ) ) {
|
|||
* Backwards compat shim
|
||||
*/
|
||||
function register_api_field( $object_type, $attributes, $args = array() ) {
|
||||
_deprecated_function( 'register_api_field', 'WPAPI-2.0', 'register_rest_field' );
|
||||
wc_deprecated_function( 'register_api_field', 'WPAPI-2.0', 'register_rest_field' );
|
||||
register_rest_field( $object_type, $attributes, $args );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -176,7 +176,7 @@ function wc_get_template( $template_name, $args = array(), $template_path = '',
|
|||
$located = wc_locate_template( $template_name, $template_path, $default_path );
|
||||
|
||||
if ( ! file_exists( $located ) ) {
|
||||
_doing_it_wrong( __FUNCTION__, sprintf( __( '%s does not exist.', 'woocommerce' ), '<code>' . $located . '</code>' ), '2.1' );
|
||||
wc_doing_it_wrong( __FUNCTION__, sprintf( __( '%s does not exist.', 'woocommerce' ), '<code>' . $located . '</code>' ), '2.1' );
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,39 +25,58 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
*/
|
||||
function wc_do_deprecated_action( $action, $args, $deprecated_in, $replacement ) {
|
||||
if ( has_action( $action ) ) {
|
||||
_deprecated_function( 'Action: ' . $action, $deprecated_in, $replacement );
|
||||
wc_deprecated_function( 'Action: ' . $action, $deprecated_in, $replacement );
|
||||
do_action_ref_array( $action, $args );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Soft deprecate a function so that it's technically deprecated, but not shown
|
||||
* until a future version to ease transition for developers.
|
||||
* Wrapper for deprecated functions so we can apply some extra logic.
|
||||
*
|
||||
* @since 2.7.0
|
||||
* @param string $function
|
||||
* @param string $version
|
||||
* @param string $deprecate_in_version
|
||||
* @param string $replacement
|
||||
*/
|
||||
function wc_soft_deprecated_function( $function, $version, $deprecate_in_version, $replacement = null ) {
|
||||
if ( version_compare( WC_VERSION, $deprecate_in_version, '>=' ) ) {
|
||||
function wc_deprecated_function( $function, $version, $replacement = null ) {
|
||||
if ( is_ajax() ) {
|
||||
$log_string = "The {$function} function is deprecated since version {$version}.";
|
||||
$log_string .= $replacement ? "Replace with {$replacement}." : '';
|
||||
error_log( $log_string );
|
||||
} else {
|
||||
_deprecated_function( $function, $version, $replacement );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Soft deprecate an argument so that it's technically deprecated, but not shown
|
||||
* until a future version to ease transition for developers.
|
||||
* Wrapper for wc_doing_it_wrong.
|
||||
*
|
||||
* @since 2.7.0
|
||||
* @param string $function
|
||||
* @param string $version
|
||||
* @param string $replacement
|
||||
*/
|
||||
function wc_doing_it_wrong( $function, $message, $version ) {
|
||||
if ( is_ajax() ) {
|
||||
error_log( "{$function} was called incorrectly. {$message}. This message was added in version {$version}." );
|
||||
} else {
|
||||
_doing_it_wrong( $function, $message, $version );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper for deprecated arguments so we can apply some extra logic.
|
||||
*
|
||||
* @since 2.7.0
|
||||
* @param string $argument
|
||||
* @param string $version
|
||||
* @param string $deprecate_in_version
|
||||
* @param string $replacement
|
||||
*/
|
||||
function wc_soft_deprecated_argument( $argument, $version, $deprecate_in_version, $message = null ) {
|
||||
if ( version_compare( WC_VERSION, $deprecate_in_version, '>=' ) ) {
|
||||
function wc_deprecated_argument( $argument, $version, $message = null ) {
|
||||
if ( is_ajax() ) {
|
||||
error_log( "The {$argument} argument is deprecated since version {$version}. {$message}" );
|
||||
} else {
|
||||
_deprecated_argument( $argument, $version, $message );
|
||||
}
|
||||
}
|
||||
|
@ -66,45 +85,45 @@ function wc_soft_deprecated_argument( $argument, $version, $deprecate_in_version
|
|||
* @deprecated
|
||||
*/
|
||||
function woocommerce_show_messages() {
|
||||
_deprecated_function( 'woocommerce_show_messages', '2.1', 'wc_print_notices' );
|
||||
wc_deprecated_function( 'woocommerce_show_messages', '2.1', 'wc_print_notices' );
|
||||
wc_print_notices();
|
||||
}
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
function woocommerce_weekend_area_js() {
|
||||
_deprecated_function( 'woocommerce_weekend_area_js', '2.1' );
|
||||
wc_deprecated_function( 'woocommerce_weekend_area_js', '2.1' );
|
||||
}
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
function woocommerce_tooltip_js() {
|
||||
_deprecated_function( 'woocommerce_tooltip_js', '2.1' );
|
||||
wc_deprecated_function( 'woocommerce_tooltip_js', '2.1' );
|
||||
}
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
function woocommerce_datepicker_js() {
|
||||
_deprecated_function( 'woocommerce_datepicker_js', '2.1' );
|
||||
wc_deprecated_function( 'woocommerce_datepicker_js', '2.1' );
|
||||
}
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
function woocommerce_admin_scripts() {
|
||||
_deprecated_function( 'woocommerce_admin_scripts', '2.1' );
|
||||
wc_deprecated_function( 'woocommerce_admin_scripts', '2.1' );
|
||||
}
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
function woocommerce_create_page( $slug, $option = '', $page_title = '', $page_content = '', $post_parent = 0 ) {
|
||||
_deprecated_function( 'woocommerce_create_page', '2.1', 'wc_create_page' );
|
||||
wc_deprecated_function( 'woocommerce_create_page', '2.1', 'wc_create_page' );
|
||||
return wc_create_page( $slug, $option, $page_title, $page_content, $post_parent );
|
||||
}
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
function woocommerce_readfile_chunked( $file, $retbytes = true ) {
|
||||
_deprecated_function( 'woocommerce_readfile_chunked', '2.1', 'WC_Download_Handler::readfile_chunked()' );
|
||||
wc_deprecated_function( 'woocommerce_readfile_chunked', '2.1', 'WC_Download_Handler::readfile_chunked()' );
|
||||
return WC_Download_Handler::readfile_chunked( $file );
|
||||
}
|
||||
|
||||
|
@ -117,7 +136,7 @@ function woocommerce_readfile_chunked( $file, $retbytes = true ) {
|
|||
* @return string
|
||||
*/
|
||||
function woocommerce_format_total( $number ) {
|
||||
_deprecated_function( __FUNCTION__, '2.1', 'wc_format_decimal()' );
|
||||
wc_deprecated_function( __FUNCTION__, '2.1', 'wc_format_decimal()' );
|
||||
return wc_format_decimal( $number, wc_get_price_decimals(), false );
|
||||
}
|
||||
|
||||
|
@ -130,7 +149,7 @@ function woocommerce_format_total( $number ) {
|
|||
* @return string
|
||||
*/
|
||||
function woocommerce_get_formatted_product_name( $product ) {
|
||||
_deprecated_function( __FUNCTION__, '2.1', 'WC_Product::get_formatted_name()' );
|
||||
wc_deprecated_function( __FUNCTION__, '2.1', 'WC_Product::get_formatted_name()' );
|
||||
return $product->get_formatted_name();
|
||||
}
|
||||
|
||||
|
@ -744,7 +763,7 @@ function woocommerce_track_product_view() {
|
|||
* @deprecated has no replacement
|
||||
*/
|
||||
function woocommerce_compile_less_styles() {
|
||||
_deprecated_function( 'woocommerce_compile_less_styles', '2.3' );
|
||||
wc_deprecated_function( 'woocommerce_compile_less_styles', '2.3' );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -769,7 +788,7 @@ add_filter( 'pre_option_woocommerce_calc_shipping', 'woocommerce_calc_shipping_b
|
|||
* @return string
|
||||
*/
|
||||
function woocommerce_get_product_schema() {
|
||||
_deprecated_function( 'woocommerce_get_product_schema', '2.7' );
|
||||
wc_deprecated_function( 'woocommerce_get_product_schema', '2.7' );
|
||||
|
||||
global $product;
|
||||
|
||||
|
@ -806,7 +825,7 @@ function woocommerce_get_product_schema() {
|
|||
* @param string $date_to
|
||||
*/
|
||||
function _wc_save_product_price( $product_id, $regular_price, $sale_price = '', $date_from = '', $date_to = '' ) {
|
||||
_doing_it_wrong( '_wc_save_product_price()', 'This function is not for developer use and is deprecated.', '2.7' );
|
||||
wc_doing_it_wrong( '_wc_save_product_price()', 'This function is not for developer use and is deprecated.', '2.7' );
|
||||
|
||||
$product_id = absint( $product_id );
|
||||
$regular_price = wc_format_decimal( $regular_price );
|
||||
|
|
|
@ -24,7 +24,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
*/
|
||||
function wc_notice_count( $notice_type = '' ) {
|
||||
if ( ! did_action( 'woocommerce_init' ) ) {
|
||||
_doing_it_wrong( __FUNCTION__, __( 'This function should not be called before woocommerce_init.', 'woocommerce' ), '2.3' );
|
||||
wc_doing_it_wrong( __FUNCTION__, __( 'This function should not be called before woocommerce_init.', 'woocommerce' ), '2.3' );
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -55,7 +55,7 @@ function wc_notice_count( $notice_type = '' ) {
|
|||
*/
|
||||
function wc_has_notice( $message, $notice_type = 'success' ) {
|
||||
if ( ! did_action( 'woocommerce_init' ) ) {
|
||||
_doing_it_wrong( __FUNCTION__, __( 'This function should not be called before woocommerce_init.', 'woocommerce' ), '2.3' );
|
||||
wc_doing_it_wrong( __FUNCTION__, __( 'This function should not be called before woocommerce_init.', 'woocommerce' ), '2.3' );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -73,7 +73,7 @@ function wc_has_notice( $message, $notice_type = 'success' ) {
|
|||
*/
|
||||
function wc_add_notice( $message, $notice_type = 'success' ) {
|
||||
if ( ! did_action( 'woocommerce_init' ) ) {
|
||||
_doing_it_wrong( __FUNCTION__, __( 'This function should not be called before woocommerce_init.', 'woocommerce' ), '2.3' );
|
||||
wc_doing_it_wrong( __FUNCTION__, __( 'This function should not be called before woocommerce_init.', 'woocommerce' ), '2.3' );
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -95,7 +95,7 @@ function wc_add_notice( $message, $notice_type = 'success' ) {
|
|||
*/
|
||||
function wc_set_notices( $notices ) {
|
||||
if ( ! did_action( 'woocommerce_init' ) ) {
|
||||
_doing_it_wrong( __FUNCTION__, __( 'This function should not be called before woocommerce_init.', 'woocommerce' ), '2.6' );
|
||||
wc_doing_it_wrong( __FUNCTION__, __( 'This function should not be called before woocommerce_init.', 'woocommerce' ), '2.6' );
|
||||
return;
|
||||
}
|
||||
WC()->session->set( 'wc_notices', $notices );
|
||||
|
@ -109,7 +109,7 @@ function wc_set_notices( $notices ) {
|
|||
*/
|
||||
function wc_clear_notices() {
|
||||
if ( ! did_action( 'woocommerce_init' ) ) {
|
||||
_doing_it_wrong( __FUNCTION__, __( 'This function should not be called before woocommerce_init.', 'woocommerce' ), '2.3' );
|
||||
wc_doing_it_wrong( __FUNCTION__, __( 'This function should not be called before woocommerce_init.', 'woocommerce' ), '2.3' );
|
||||
return;
|
||||
}
|
||||
WC()->session->set( 'wc_notices', null );
|
||||
|
@ -122,7 +122,7 @@ function wc_clear_notices() {
|
|||
*/
|
||||
function wc_print_notices() {
|
||||
if ( ! did_action( 'woocommerce_init' ) ) {
|
||||
_doing_it_wrong( __FUNCTION__, __( 'This function should not be called before woocommerce_init.', 'woocommerce' ), '2.3' );
|
||||
wc_doing_it_wrong( __FUNCTION__, __( 'This function should not be called before woocommerce_init.', 'woocommerce' ), '2.3' );
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -169,7 +169,7 @@ function wc_print_notice( $message, $notice_type = 'success' ) {
|
|||
*/
|
||||
function wc_get_notices( $notice_type = '' ) {
|
||||
if ( ! did_action( 'woocommerce_init' ) ) {
|
||||
_doing_it_wrong( __FUNCTION__, __( 'This function should not be called before woocommerce_init.', 'woocommerce' ), '2.3' );
|
||||
wc_doing_it_wrong( __FUNCTION__, __( 'This function should not be called before woocommerce_init.', 'woocommerce' ), '2.3' );
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ function wc_get_orders( $args ) {
|
|||
*/
|
||||
function wc_get_order( $the_order = false ) {
|
||||
if ( ! did_action( 'woocommerce_init' ) ) {
|
||||
_doing_it_wrong( __FUNCTION__, __( 'wc_get_order should not be called before the woocommerce_init action.', 'woocommerce' ), '2.5' );
|
||||
wc_doing_it_wrong( __FUNCTION__, __( 'wc_get_order should not be called before the woocommerce_init action.', 'woocommerce' ), '2.5' );
|
||||
return false;
|
||||
}
|
||||
return WC()->order_factory->get_order( $the_order );
|
||||
|
|
|
@ -46,12 +46,12 @@ add_filter( 'the_title', 'wc_page_endpoint_title' );
|
|||
function wc_get_page_id( $page ) {
|
||||
|
||||
if ( 'pay' == $page || 'thanks' == $page ) {
|
||||
_deprecated_argument( __FUNCTION__, '2.1', 'The "pay" and "thanks" pages are no-longer used - an endpoint is added to the checkout instead. To get a valid link use the WC_Order::get_checkout_payment_url() or WC_Order::get_checkout_order_received_url() methods instead.' );
|
||||
wc_deprecated_argument( __FUNCTION__, '2.1', 'The "pay" and "thanks" pages are no-longer used - an endpoint is added to the checkout instead. To get a valid link use the WC_Order::get_checkout_payment_url() or WC_Order::get_checkout_order_received_url() methods instead.' );
|
||||
|
||||
$page = 'checkout';
|
||||
}
|
||||
if ( 'change_password' === $page || 'edit_address' === $page || 'lost_password' === $page ) {
|
||||
_deprecated_argument( __FUNCTION__, '2.1', 'The "change_password", "edit_address" and "lost_password" pages are no-longer used - an endpoint is added to the my-account instead. To get a valid link use the wc_customer_edit_account_url() function instead.' );
|
||||
wc_deprecated_argument( __FUNCTION__, '2.1', 'The "change_password", "edit_address" and "lost_password" pages are no-longer used - an endpoint is added to the my-account instead. To get a valid link use the wc_customer_edit_account_url() function instead.' );
|
||||
|
||||
$page = 'myaccount';
|
||||
}
|
||||
|
|
|
@ -98,7 +98,7 @@ function wc_get_products( $args ) {
|
|||
*/
|
||||
function wc_get_product( $the_product = false, $deprecated = array() ) {
|
||||
if ( ! did_action( 'woocommerce_init' ) ) {
|
||||
_doing_it_wrong( __FUNCTION__, __( 'wc_get_product should not be called before the woocommerce_init action.', 'woocommerce' ), '2.5' );
|
||||
wc_doing_it_wrong( __FUNCTION__, __( 'wc_get_product should not be called before the woocommerce_init action.', 'woocommerce' ), '2.5' );
|
||||
return false;
|
||||
}
|
||||
return WC()->product_factory->get_product( $the_product );
|
||||
|
|
|
@ -1108,7 +1108,7 @@ if ( ! function_exists( 'woocommerce_product_reviews_tab' ) ) {
|
|||
* @subpackage Product/Tabs
|
||||
*/
|
||||
function woocommerce_product_reviews_tab() {
|
||||
_deprecated_function( 'woocommerce_product_reviews_tab', '2.4' );
|
||||
wc_deprecated_function( 'woocommerce_product_reviews_tab', '2.4' );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2507,7 +2507,7 @@ function wc_get_stock_html( $product ) {
|
|||
$html = ob_get_clean();
|
||||
|
||||
if ( has_filter( 'woocommerce_stock_html' ) ) {
|
||||
_deprecated_function( 'The woocommerce_stock_html filter', '', 'woocommerce_get_stock_html' );
|
||||
wc_deprecated_function( 'The woocommerce_stock_html filter', '', 'woocommerce_get_stock_html' );
|
||||
$html = apply_filters( 'woocommerce_stock_html', $html, $product->get_availability_text(), $product );
|
||||
}
|
||||
|
||||
|
|
|
@ -182,7 +182,7 @@ function wc_product_dropdown_categories( $args = array(), $deprecated_hierarchic
|
|||
global $wp_query;
|
||||
|
||||
if ( ! is_array( $args ) ) {
|
||||
_deprecated_argument( 'wc_product_dropdown_categories()', '2.1', 'show_counts, hierarchical, show_uncategorized and orderby arguments are invalid - pass a single array of values instead.' );
|
||||
wc_deprecated_argument( 'wc_product_dropdown_categories()', '2.1', 'show_counts, hierarchical, show_uncategorized and orderby arguments are invalid - pass a single array of values instead.' );
|
||||
|
||||
$args['show_count'] = $args;
|
||||
$args['hierarchical'] = $deprecated_hierarchical;
|
||||
|
|
|
@ -460,7 +460,7 @@ class WC_Tests_CRUD_Orders extends WC_Unit_Test_Case {
|
|||
$token = new WC_Payment_Token_Stub();
|
||||
$token->set_extra( __FUNCTION__ );
|
||||
$token->set_token( time() );
|
||||
$token->create();
|
||||
$token->save();
|
||||
$this->assertTrue( 0 < $object->add_payment_token( $token ) );
|
||||
}
|
||||
|
||||
|
@ -473,7 +473,7 @@ class WC_Tests_CRUD_Orders extends WC_Unit_Test_Case {
|
|||
$token = new WC_Payment_Token_Stub();
|
||||
$token->set_extra( __FUNCTION__ );
|
||||
$token->set_token( time() );
|
||||
$token->create();
|
||||
$token->save();
|
||||
$object->add_payment_token( $token );
|
||||
$this->assertCount( 1, $object->get_payment_tokens() );
|
||||
}
|
||||
|
|
|
@ -168,6 +168,10 @@ class WC_Tests_Payment_Token extends WC_Unit_Test_Case {
|
|||
* Test legacy token functions.
|
||||
*
|
||||
* @since 2.7.0
|
||||
*
|
||||
* @expectedDeprecated WC_Payment_Token::read
|
||||
* @expectedDeprecated WC_Payment_Token::create
|
||||
* @expectedDeprecated WC_Payment_Token::update
|
||||
*/
|
||||
public function test_wc_payment_token_legacy() {
|
||||
$token = WC_Helper_Payment_Token::create_stub_token( __FUNCTION__ );
|
||||
|
|
|
@ -325,6 +325,10 @@ class WC_Tests_Shipping_Zone extends WC_Unit_Test_Case {
|
|||
* Test legacy zone functions.
|
||||
*
|
||||
* @since 2.7.0
|
||||
*
|
||||
* @expectedDeprecated WC_Shipping_Zone::read
|
||||
* @expectedDeprecated WC_Shipping_Zone::create
|
||||
* @expectedDeprecated WC_Shipping_Zone::update
|
||||
*/
|
||||
public function test_wc_shipping_zone_legacy() {
|
||||
// Create a single zone.
|
||||
|
|
|
@ -130,7 +130,7 @@ final class WooCommerce {
|
|||
* @since 2.1
|
||||
*/
|
||||
public function __clone() {
|
||||
_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'woocommerce' ), '2.1' );
|
||||
wc_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'woocommerce' ), '2.1' );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -138,7 +138,7 @@ final class WooCommerce {
|
|||
* @since 2.1
|
||||
*/
|
||||
public function __wakeup() {
|
||||
_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'woocommerce' ), '2.1' );
|
||||
wc_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'woocommerce' ), '2.1' );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue