1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Deprecated functions |
4
|
|
|
* |
5
|
|
|
* Where functions come to die. |
6
|
|
|
* |
7
|
|
|
* @author WooThemes |
8
|
|
|
* @category Core |
9
|
|
|
* @package WooCommerce/Functions |
10
|
|
|
* @version 2.1.0 |
11
|
|
|
*/ |
12
|
|
|
|
13
|
|
|
if ( ! defined( 'ABSPATH' ) ) { |
14
|
|
|
exit; // Exit if accessed directly |
15
|
|
|
} |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* @deprecated |
19
|
|
|
*/ |
20
|
|
|
function woocommerce_show_messages() { |
21
|
|
|
_deprecated_function( 'woocommerce_show_messages', '2.1', 'wc_print_notices' ); |
22
|
|
|
wc_print_notices(); |
23
|
|
|
} |
24
|
|
|
/** |
25
|
|
|
* @deprecated |
26
|
|
|
*/ |
27
|
|
|
function woocommerce_weekend_area_js() { |
28
|
|
|
_deprecated_function( 'woocommerce_weekend_area_js', '2.1', '' ); |
29
|
|
|
} |
30
|
|
|
/** |
31
|
|
|
* @deprecated |
32
|
|
|
*/ |
33
|
|
|
function woocommerce_tooltip_js() { |
34
|
|
|
_deprecated_function( 'woocommerce_tooltip_js', '2.1', '' ); |
35
|
|
|
} |
36
|
|
|
/** |
37
|
|
|
* @deprecated |
38
|
|
|
*/ |
39
|
|
|
function woocommerce_datepicker_js() { |
40
|
|
|
_deprecated_function( 'woocommerce_datepicker_js', '2.1', '' ); |
41
|
|
|
} |
42
|
|
|
/** |
43
|
|
|
* @deprecated |
44
|
|
|
*/ |
45
|
|
|
function woocommerce_admin_scripts() { |
46
|
|
|
_deprecated_function( 'woocommerce_admin_scripts', '2.1', '' ); |
47
|
|
|
} |
48
|
|
|
/** |
49
|
|
|
* @deprecated |
50
|
|
|
*/ |
51
|
|
|
function woocommerce_create_page( $slug, $option = '', $page_title = '', $page_content = '', $post_parent = 0 ) { |
52
|
|
|
_deprecated_function( 'woocommerce_create_page', '2.1', 'wc_create_page' ); |
53
|
|
|
return wc_create_page( $slug, $option, $page_title, $page_content, $post_parent ); |
54
|
|
|
} |
55
|
|
|
/** |
56
|
|
|
* @deprecated |
57
|
|
|
*/ |
58
|
|
|
function woocommerce_readfile_chunked( $file, $retbytes = true ) { |
|
|
|
|
59
|
|
|
_deprecated_function( 'woocommerce_readfile_chunked', '2.1', 'WC_Download_Handler::readfile_chunked()' ); |
60
|
|
|
return WC_Download_Handler::readfile_chunked( $file ); |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* Formal total costs - format to the number of decimal places for the base currency. |
65
|
|
|
* |
66
|
|
|
* @access public |
67
|
|
|
* @param mixed $number |
68
|
|
|
* @deprecated 2.1 |
69
|
|
|
* @return string |
70
|
|
|
*/ |
71
|
|
|
function woocommerce_format_total( $number ) { |
72
|
|
|
_deprecated_function( __FUNCTION__, '2.1', 'wc_format_decimal()' ); |
73
|
|
|
return wc_format_decimal( $number, wc_get_price_decimals(), false ); |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* Get product name with extra details such as SKU price and attributes. Used within admin. |
78
|
|
|
* |
79
|
|
|
* @access public |
80
|
|
|
* @param WC_Product $product |
81
|
|
|
* @deprecated 2.1 |
82
|
|
|
* @return string |
83
|
|
|
*/ |
84
|
|
|
function woocommerce_get_formatted_product_name( $product ) { |
85
|
|
|
_deprecated_function( __FUNCTION__, '2.1', 'WC_Product::get_formatted_name()' ); |
86
|
|
|
return $product->get_formatted_name(); |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
/** |
90
|
|
|
* Handle IPN requests for the legacy paypal gateway by calling gateways manually if needed. |
91
|
|
|
* |
92
|
|
|
* @access public |
93
|
|
|
*/ |
94
|
|
|
function woocommerce_legacy_paypal_ipn() { |
95
|
|
|
if ( ! empty( $_GET['paypalListener'] ) && $_GET['paypalListener'] == 'paypal_standard_IPN' ) { |
96
|
|
|
|
97
|
|
|
WC()->payment_gateways(); |
98
|
|
|
|
99
|
|
|
do_action( 'woocommerce_api_wc_gateway_paypal' ); |
100
|
|
|
} |
101
|
|
|
} |
102
|
|
|
add_action( 'init', 'woocommerce_legacy_paypal_ipn' ); |
103
|
|
|
|
104
|
|
|
/** |
105
|
|
|
* get_product soft deprecated for wc_get_product. |
106
|
|
|
* |
107
|
|
|
* @deprecated |
108
|
|
|
*/ |
109
|
|
|
function get_product( $the_product = false, $args = array() ) { |
110
|
|
|
return wc_get_product( $the_product, $args ); |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
/** |
114
|
|
|
* Cart functions (soft deprecated). |
115
|
|
|
*/ |
116
|
|
|
/** |
117
|
|
|
* @deprecated |
118
|
|
|
*/ |
119
|
|
|
function woocommerce_protected_product_add_to_cart( $passed, $product_id ) { |
120
|
|
|
return wc_protected_product_add_to_cart( $passed, $product_id ); |
121
|
|
|
} |
122
|
|
|
/** |
123
|
|
|
* @deprecated |
124
|
|
|
*/ |
125
|
|
|
function woocommerce_empty_cart() { |
126
|
|
|
wc_empty_cart(); |
127
|
|
|
} |
128
|
|
|
/** |
129
|
|
|
* @deprecated |
130
|
|
|
*/ |
131
|
|
|
function woocommerce_load_persistent_cart( $user_login, $user = 0 ) { |
132
|
|
|
return wc_load_persistent_cart( $user_login, $user ); |
|
|
|
|
133
|
|
|
} |
134
|
|
|
/** |
135
|
|
|
* @deprecated |
136
|
|
|
*/ |
137
|
|
|
function woocommerce_add_to_cart_message( $product_id ) { |
138
|
|
|
wc_add_to_cart_message( $product_id ); |
139
|
|
|
} |
140
|
|
|
/** |
141
|
|
|
* @deprecated |
142
|
|
|
*/ |
143
|
|
|
function woocommerce_clear_cart_after_payment() { |
144
|
|
|
wc_clear_cart_after_payment(); |
145
|
|
|
} |
146
|
|
|
/** |
147
|
|
|
* @deprecated |
148
|
|
|
*/ |
149
|
|
|
function woocommerce_cart_totals_subtotal_html() { |
150
|
|
|
wc_cart_totals_subtotal_html(); |
151
|
|
|
} |
152
|
|
|
/** |
153
|
|
|
* @deprecated |
154
|
|
|
*/ |
155
|
|
|
function woocommerce_cart_totals_shipping_html() { |
156
|
|
|
wc_cart_totals_shipping_html(); |
157
|
|
|
} |
158
|
|
|
/** |
159
|
|
|
* @deprecated |
160
|
|
|
*/ |
161
|
|
|
function woocommerce_cart_totals_coupon_html( $coupon ) { |
162
|
|
|
wc_cart_totals_coupon_html( $coupon ); |
163
|
|
|
} |
164
|
|
|
/** |
165
|
|
|
* @deprecated |
166
|
|
|
*/ |
167
|
|
|
function woocommerce_cart_totals_order_total_html() { |
168
|
|
|
wc_cart_totals_order_total_html(); |
169
|
|
|
} |
170
|
|
|
/** |
171
|
|
|
* @deprecated |
172
|
|
|
*/ |
173
|
|
|
function woocommerce_cart_totals_fee_html( $fee ) { |
174
|
|
|
wc_cart_totals_fee_html( $fee ); |
175
|
|
|
} |
176
|
|
|
/** |
177
|
|
|
* @deprecated |
178
|
|
|
*/ |
179
|
|
|
function woocommerce_cart_totals_shipping_method_label( $method ) { |
180
|
|
|
return wc_cart_totals_shipping_method_label( $method ); |
181
|
|
|
} |
182
|
|
|
|
183
|
|
|
/** |
184
|
|
|
* Core functions (soft deprecated). |
185
|
|
|
*/ |
186
|
|
|
/** |
187
|
|
|
* @deprecated |
188
|
|
|
*/ |
189
|
|
|
function woocommerce_get_template_part( $slug, $name = '' ) { |
190
|
|
|
wc_get_template_part( $slug, $name ); |
191
|
|
|
} |
192
|
|
|
/** |
193
|
|
|
* @deprecated |
194
|
|
|
*/ |
195
|
|
|
function woocommerce_get_template( $template_name, $args = array(), $template_path = '', $default_path = '' ) { |
196
|
|
|
wc_get_template( $template_name, $args, $template_path, $default_path ); |
197
|
|
|
} |
198
|
|
|
/** |
199
|
|
|
* @deprecated |
200
|
|
|
*/ |
201
|
|
|
function woocommerce_locate_template( $template_name, $template_path = '', $default_path = '' ) { |
202
|
|
|
return wc_locate_template( $template_name, $template_path, $default_path ); |
203
|
|
|
} |
204
|
|
|
/** |
205
|
|
|
* @deprecated |
206
|
|
|
*/ |
207
|
|
|
function woocommerce_mail( $to, $subject, $message, $headers = "Content-Type: text/html\r\n", $attachments = "" ) { |
208
|
|
|
wc_mail( $to, $subject, $message, $headers, $attachments ); |
209
|
|
|
} |
210
|
|
|
|
211
|
|
|
/** |
212
|
|
|
* Customer functions (soft deprecated). |
213
|
|
|
*/ |
214
|
|
|
/** |
215
|
|
|
* @deprecated |
216
|
|
|
*/ |
217
|
|
|
function woocommerce_disable_admin_bar( $show_admin_bar ) { |
218
|
|
|
return wc_disable_admin_bar( $show_admin_bar ); |
219
|
|
|
} |
220
|
|
|
/** |
221
|
|
|
* @deprecated |
222
|
|
|
*/ |
223
|
|
|
function woocommerce_create_new_customer( $email, $username = '', $password = '' ) { |
224
|
|
|
return wc_create_new_customer( $email, $username, $password ); |
225
|
|
|
} |
226
|
|
|
/** |
227
|
|
|
* @deprecated |
228
|
|
|
*/ |
229
|
|
|
function woocommerce_set_customer_auth_cookie( $customer_id ) { |
230
|
|
|
wc_set_customer_auth_cookie( $customer_id ); |
231
|
|
|
} |
232
|
|
|
/** |
233
|
|
|
* @deprecated |
234
|
|
|
*/ |
235
|
|
|
function woocommerce_update_new_customer_past_orders( $customer_id ) { |
236
|
|
|
return wc_update_new_customer_past_orders( $customer_id ); |
237
|
|
|
} |
238
|
|
|
/** |
239
|
|
|
* @deprecated |
240
|
|
|
*/ |
241
|
|
|
function woocommerce_paying_customer( $order_id ) { |
242
|
|
|
wc_paying_customer( $order_id ); |
243
|
|
|
} |
244
|
|
|
/** |
245
|
|
|
* @deprecated |
246
|
|
|
*/ |
247
|
|
|
function woocommerce_customer_bought_product( $customer_email, $user_id, $product_id ) { |
248
|
|
|
return wc_customer_bought_product( $customer_email, $user_id, $product_id ); |
249
|
|
|
} |
250
|
|
|
/** |
251
|
|
|
* @deprecated |
252
|
|
|
*/ |
253
|
|
|
function woocommerce_customer_has_capability( $allcaps, $caps, $args ) { |
254
|
|
|
return wc_customer_has_capability( $allcaps, $caps, $args ); |
255
|
|
|
} |
256
|
|
|
|
257
|
|
|
/** |
258
|
|
|
* Formatting functions (soft deprecated). |
259
|
|
|
*/ |
260
|
|
|
/** |
261
|
|
|
* @deprecated |
262
|
|
|
*/ |
263
|
|
|
function woocommerce_sanitize_taxonomy_name( $taxonomy ) { |
264
|
|
|
return wc_sanitize_taxonomy_name( $taxonomy ); |
265
|
|
|
} |
266
|
|
|
/** |
267
|
|
|
* @deprecated |
268
|
|
|
*/ |
269
|
|
|
function woocommerce_get_filename_from_url( $file_url ) { |
270
|
|
|
return wc_get_filename_from_url( $file_url ); |
271
|
|
|
} |
272
|
|
|
/** |
273
|
|
|
* @deprecated |
274
|
|
|
*/ |
275
|
|
|
function woocommerce_get_dimension( $dim, $to_unit ) { |
276
|
|
|
return wc_get_dimension( $dim, $to_unit ); |
277
|
|
|
} |
278
|
|
|
/** |
279
|
|
|
* @deprecated |
280
|
|
|
*/ |
281
|
|
|
function woocommerce_get_weight( $weight, $to_unit ) { |
282
|
|
|
return wc_get_weight( $weight, $to_unit ); |
283
|
|
|
} |
284
|
|
|
/** |
285
|
|
|
* @deprecated |
286
|
|
|
*/ |
287
|
|
|
function woocommerce_trim_zeros( $price ) { |
288
|
|
|
return wc_trim_zeros( $price ); |
289
|
|
|
} |
290
|
|
|
/** |
291
|
|
|
* @deprecated |
292
|
|
|
*/ |
293
|
|
|
function woocommerce_round_tax_total( $tax ) { |
294
|
|
|
return wc_round_tax_total( $tax ); |
295
|
|
|
} |
296
|
|
|
/** |
297
|
|
|
* @deprecated |
298
|
|
|
*/ |
299
|
|
|
function woocommerce_format_decimal( $number, $dp = false, $trim_zeros = false ) { |
300
|
|
|
return wc_format_decimal( $number, $dp, $trim_zeros ); |
301
|
|
|
} |
302
|
|
|
/** |
303
|
|
|
* @deprecated |
304
|
|
|
*/ |
305
|
|
|
function woocommerce_clean( $var ) { |
306
|
|
|
return wc_clean( $var ); |
307
|
|
|
} |
308
|
|
|
/** |
309
|
|
|
* @deprecated |
310
|
|
|
*/ |
311
|
|
|
function woocommerce_array_overlay( $a1, $a2 ) { |
312
|
|
|
return wc_array_overlay( $a1, $a2 ); |
313
|
|
|
} |
314
|
|
|
/** |
315
|
|
|
* @deprecated |
316
|
|
|
*/ |
317
|
|
|
function woocommerce_price( $price, $args = array() ) { |
318
|
|
|
return wc_price( $price, $args ); |
319
|
|
|
} |
320
|
|
|
/** |
321
|
|
|
* @deprecated |
322
|
|
|
*/ |
323
|
|
|
function woocommerce_let_to_num( $size ) { |
324
|
|
|
return wc_let_to_num( $size ); |
325
|
|
|
} |
326
|
|
|
|
327
|
|
|
/** |
328
|
|
|
* @return string |
329
|
|
|
*/ |
330
|
|
|
/** |
331
|
|
|
* @deprecated |
332
|
|
|
*/ |
333
|
|
|
function woocommerce_date_format() { |
334
|
|
|
return wc_date_format(); |
335
|
|
|
} |
336
|
|
|
/** |
337
|
|
|
* @deprecated |
338
|
|
|
*/ |
339
|
|
|
function woocommerce_time_format() { |
340
|
|
|
return wc_time_format(); |
341
|
|
|
} |
342
|
|
|
/** |
343
|
|
|
* @deprecated |
344
|
|
|
*/ |
345
|
|
|
function woocommerce_timezone_string() { |
346
|
|
|
return wc_timezone_string(); |
347
|
|
|
} |
348
|
|
|
if ( ! function_exists( 'woocommerce_rgb_from_hex' ) ) { |
349
|
|
|
/** |
350
|
|
|
* @deprecated |
351
|
|
|
*/ |
352
|
|
|
function woocommerce_rgb_from_hex( $color ) { |
353
|
|
|
return wc_rgb_from_hex( $color ); |
354
|
|
|
} |
355
|
|
|
} |
356
|
|
|
if ( ! function_exists( 'woocommerce_hex_darker' ) ) { |
357
|
|
|
/** |
358
|
|
|
* @deprecated |
359
|
|
|
*/ |
360
|
|
|
function woocommerce_hex_darker( $color, $factor = 30 ) { |
361
|
|
|
return wc_hex_darker( $color, $factor ); |
362
|
|
|
} |
363
|
|
|
} |
364
|
|
|
if ( ! function_exists( 'woocommerce_hex_lighter' ) ) { |
365
|
|
|
/** |
366
|
|
|
* @deprecated |
367
|
|
|
*/ |
368
|
|
|
function woocommerce_hex_lighter( $color, $factor = 30 ) { |
369
|
|
|
return wc_hex_lighter( $color, $factor ); |
370
|
|
|
} |
371
|
|
|
} |
372
|
|
|
if ( ! function_exists( 'woocommerce_light_or_dark' ) ) { |
373
|
|
|
/** |
374
|
|
|
* @deprecated |
375
|
|
|
*/ |
376
|
|
|
function woocommerce_light_or_dark( $color, $dark = '#000000', $light = '#FFFFFF' ) { |
377
|
|
|
return wc_light_or_dark( $color, $dark, $light ); |
378
|
|
|
} |
379
|
|
|
} |
380
|
|
|
if ( ! function_exists( 'woocommerce_format_hex' ) ) { |
381
|
|
|
/** |
382
|
|
|
* @deprecated |
383
|
|
|
*/ |
384
|
|
|
function woocommerce_format_hex( $hex ) { |
385
|
|
|
return wc_format_hex( $hex ); |
386
|
|
|
} |
387
|
|
|
} |
388
|
|
|
|
389
|
|
|
/** |
390
|
|
|
* Order functions (soft deprecated). |
391
|
|
|
*/ |
392
|
|
|
/** |
393
|
|
|
* @deprecated |
394
|
|
|
*/ |
395
|
|
|
function woocommerce_get_order_id_by_order_key( $order_key ) { |
396
|
|
|
return wc_get_order_id_by_order_key( $order_key ); |
397
|
|
|
} |
398
|
|
|
/** |
399
|
|
|
* @deprecated |
400
|
|
|
*/ |
401
|
|
|
function woocommerce_downloadable_file_permission( $download_id, $product_id, $order ) { |
402
|
|
|
return wc_downloadable_file_permission( $download_id, $product_id, $order ); |
403
|
|
|
} |
404
|
|
|
/** |
405
|
|
|
* @deprecated |
406
|
|
|
*/ |
407
|
|
|
function woocommerce_downloadable_product_permissions( $order_id ) { |
408
|
|
|
wc_downloadable_product_permissions( $order_id ); |
409
|
|
|
} |
410
|
|
|
/** |
411
|
|
|
* @deprecated |
412
|
|
|
*/ |
413
|
|
|
function woocommerce_add_order_item( $order_id, $item ) { |
414
|
|
|
return wc_add_order_item( $order_id, $item ); |
415
|
|
|
} |
416
|
|
|
/** |
417
|
|
|
* @deprecated |
418
|
|
|
*/ |
419
|
|
|
function woocommerce_delete_order_item( $item_id ) { |
420
|
|
|
return wc_delete_order_item( $item_id ); |
421
|
|
|
} |
422
|
|
|
/** |
423
|
|
|
* @deprecated |
424
|
|
|
*/ |
425
|
|
|
function woocommerce_update_order_item_meta( $item_id, $meta_key, $meta_value, $prev_value = '' ) { |
426
|
|
|
return wc_update_order_item_meta( $item_id, $meta_key, $meta_value, $prev_value ); |
427
|
|
|
} |
428
|
|
|
/** |
429
|
|
|
* @deprecated |
430
|
|
|
*/ |
431
|
|
|
function woocommerce_add_order_item_meta( $item_id, $meta_key, $meta_value, $unique = false ) { |
432
|
|
|
return wc_add_order_item_meta( $item_id, $meta_key, $meta_value, $unique ); |
433
|
|
|
} |
434
|
|
|
/** |
435
|
|
|
* @deprecated |
436
|
|
|
*/ |
437
|
|
|
function woocommerce_delete_order_item_meta( $item_id, $meta_key, $meta_value = '', $delete_all = false ) { |
438
|
|
|
return wc_delete_order_item_meta( $item_id, $meta_key, $meta_value, $delete_all ); |
439
|
|
|
} |
440
|
|
|
/** |
441
|
|
|
* @deprecated |
442
|
|
|
*/ |
443
|
|
|
function woocommerce_get_order_item_meta( $item_id, $key, $single = true ) { |
444
|
|
|
return wc_get_order_item_meta( $item_id, $key, $single ); |
445
|
|
|
} |
446
|
|
|
/** |
447
|
|
|
* @deprecated |
448
|
|
|
*/ |
449
|
|
|
function woocommerce_cancel_unpaid_orders() { |
450
|
|
|
wc_cancel_unpaid_orders(); |
451
|
|
|
} |
452
|
|
|
/** |
453
|
|
|
* @deprecated |
454
|
|
|
*/ |
455
|
|
|
function woocommerce_processing_order_count() { |
456
|
|
|
return wc_processing_order_count(); |
457
|
|
|
} |
458
|
|
|
|
459
|
|
|
/** |
460
|
|
|
* Page functions (soft deprecated). |
461
|
|
|
*/ |
462
|
|
|
/** |
463
|
|
|
* @deprecated |
464
|
|
|
*/ |
465
|
|
|
function woocommerce_get_page_id( $page ) { |
466
|
|
|
return wc_get_page_id( $page ); |
467
|
|
|
} |
468
|
|
|
/** |
469
|
|
|
* @deprecated |
470
|
|
|
*/ |
471
|
|
|
function woocommerce_get_endpoint_url( $endpoint, $value = '', $permalink = '' ) { |
472
|
|
|
return wc_get_endpoint_url( $endpoint, $value, $permalink ); |
473
|
|
|
} |
474
|
|
|
/** |
475
|
|
|
* @deprecated |
476
|
|
|
*/ |
477
|
|
|
function woocommerce_lostpassword_url( $url ) { |
478
|
|
|
return wc_lostpassword_url( $url ); |
479
|
|
|
} |
480
|
|
|
/** |
481
|
|
|
* @deprecated |
482
|
|
|
*/ |
483
|
|
|
function woocommerce_customer_edit_account_url() { |
484
|
|
|
return wc_customer_edit_account_url(); |
485
|
|
|
} |
486
|
|
|
/** |
487
|
|
|
* @deprecated |
488
|
|
|
*/ |
489
|
|
|
function woocommerce_nav_menu_items( $items, $args ) { |
|
|
|
|
490
|
|
|
return wc_nav_menu_items( $items ); |
491
|
|
|
} |
492
|
|
|
/** |
493
|
|
|
* @deprecated |
494
|
|
|
*/ |
495
|
|
|
function woocommerce_nav_menu_item_classes( $menu_items, $args ) { |
|
|
|
|
496
|
|
|
return wc_nav_menu_item_classes( $menu_items ); |
497
|
|
|
} |
498
|
|
|
/** |
499
|
|
|
* @deprecated |
500
|
|
|
*/ |
501
|
|
|
function woocommerce_list_pages( $pages ) { |
502
|
|
|
return wc_list_pages( $pages ); |
503
|
|
|
} |
504
|
|
|
|
505
|
|
|
/** |
506
|
|
|
* Handle renamed filters. |
507
|
|
|
*/ |
508
|
|
|
global $wc_map_deprecated_filters; |
509
|
|
|
|
510
|
|
|
$wc_map_deprecated_filters = array( |
511
|
|
|
'woocommerce_add_to_cart_fragments' => 'add_to_cart_fragments', |
512
|
|
|
'woocommerce_add_to_cart_redirect' => 'add_to_cart_redirect' |
513
|
|
|
); |
514
|
|
|
|
515
|
|
|
foreach ( $wc_map_deprecated_filters as $new => $old ) { |
516
|
|
|
add_filter( $new, 'woocommerce_deprecated_filter_mapping' ); |
517
|
|
|
} |
518
|
|
|
|
519
|
|
|
function woocommerce_deprecated_filter_mapping( $data, $arg_1 = '', $arg_2 = '', $arg_3 = '' ) { |
520
|
|
|
global $wc_map_deprecated_filters; |
521
|
|
|
|
522
|
|
|
$filter = current_filter(); |
523
|
|
|
|
524
|
|
|
if ( isset( $wc_map_deprecated_filters[ $filter ] ) ) { |
525
|
|
|
if ( has_filter( $wc_map_deprecated_filters[ $filter ] ) ) { |
526
|
|
|
$data = apply_filters( $wc_map_deprecated_filters[ $filter ], $data, $arg_1, $arg_2, $arg_3 ); |
527
|
|
|
if ( ! is_ajax() ) { |
528
|
|
|
_deprecated_function( 'The ' . $wc_map_deprecated_filters[ $filter ] . ' filter', '', $filter ); |
529
|
|
|
} |
530
|
|
|
} |
531
|
|
|
} |
532
|
|
|
|
533
|
|
|
return $data; |
534
|
|
|
} |
535
|
|
|
|
536
|
|
|
/** |
537
|
|
|
* Alias functions/soft-deprecated function names (moving from woocommerce_ to wc_). These will be deprecated with notices in future updates. |
538
|
|
|
*/ |
539
|
|
|
|
540
|
|
|
/** |
541
|
|
|
* Attribute functions - soft deprecated. |
542
|
|
|
*/ |
543
|
|
|
/** |
544
|
|
|
* @deprecated |
545
|
|
|
*/ |
546
|
|
|
function woocommerce_product_dropdown_categories( $args = array(), $deprecated_hierarchical = 1, $deprecated_show_uncategorized = 1, $deprecated_orderby = '' ) { |
547
|
|
|
return wc_product_dropdown_categories( $args, $deprecated_hierarchical, $deprecated_show_uncategorized, $deprecated_orderby ); |
548
|
|
|
} |
549
|
|
|
/** |
550
|
|
|
* @deprecated |
551
|
|
|
*/ |
552
|
|
|
function woocommerce_walk_category_dropdown_tree( $a1 = '', $a2 = '', $a3 = '' ) { |
553
|
|
|
return wc_walk_category_dropdown_tree( $a1, $a2, $a3 ); |
554
|
|
|
} |
555
|
|
|
/** |
556
|
|
|
* @deprecated |
557
|
|
|
*/ |
558
|
|
|
function woocommerce_taxonomy_metadata_wpdbfix() { |
559
|
|
|
return wc_taxonomy_metadata_wpdbfix(); |
560
|
|
|
} |
561
|
|
|
/** |
562
|
|
|
* @deprecated |
563
|
|
|
*/ |
564
|
|
|
function woocommerce_order_terms( $the_term, $next_id, $taxonomy, $index = 0, $terms = null ) { |
565
|
|
|
return wc_reorder_terms( $the_term, $next_id, $taxonomy, $index, $terms ); |
566
|
|
|
} |
567
|
|
|
/** |
568
|
|
|
* @deprecated |
569
|
|
|
*/ |
570
|
|
|
function woocommerce_set_term_order( $term_id, $index, $taxonomy, $recursive = false ) { |
571
|
|
|
return wc_set_term_order( $term_id, $index, $taxonomy, $recursive ); |
572
|
|
|
} |
573
|
|
|
/** |
574
|
|
|
* @deprecated |
575
|
|
|
*/ |
576
|
|
|
function woocommerce_terms_clauses( $clauses, $taxonomies, $args ) { |
577
|
|
|
return wc_terms_clauses( $clauses, $taxonomies, $args ); |
578
|
|
|
} |
579
|
|
|
/** |
580
|
|
|
* @deprecated |
581
|
|
|
*/ |
582
|
|
|
function _woocommerce_term_recount( $terms, $taxonomy, $callback, $terms_are_term_taxonomy_ids ) { |
583
|
|
|
return _wc_term_recount( $terms, $taxonomy, $callback, $terms_are_term_taxonomy_ids ); |
584
|
|
|
} |
585
|
|
|
/** |
586
|
|
|
* @deprecated |
587
|
|
|
*/ |
588
|
|
|
function woocommerce_recount_after_stock_change( $product_id ) { |
589
|
|
|
return wc_recount_after_stock_change( $product_id ); |
590
|
|
|
} |
591
|
|
|
/** |
592
|
|
|
* @deprecated |
593
|
|
|
*/ |
594
|
|
|
function woocommerce_change_term_counts( $terms, $taxonomies, $args ) { |
|
|
|
|
595
|
|
|
return wc_change_term_counts( $terms, $taxonomies ); |
596
|
|
|
} |
597
|
|
|
|
598
|
|
|
/** |
599
|
|
|
* Product functions - soft deprecated. |
600
|
|
|
*/ |
601
|
|
|
/** |
602
|
|
|
* @deprecated |
603
|
|
|
*/ |
604
|
|
|
function woocommerce_get_product_ids_on_sale() { |
605
|
|
|
return wc_get_product_ids_on_sale(); |
606
|
|
|
} |
607
|
|
|
/** |
608
|
|
|
* @deprecated |
609
|
|
|
*/ |
610
|
|
|
function woocommerce_get_featured_product_ids() { |
611
|
|
|
return wc_get_featured_product_ids(); |
612
|
|
|
} |
613
|
|
|
/** |
614
|
|
|
* @deprecated |
615
|
|
|
*/ |
616
|
|
|
function woocommerce_get_product_terms( $object_id, $taxonomy, $fields = 'all' ) { |
617
|
|
|
return wc_get_product_terms( $object_id, $taxonomy, array( 'fields' => $fields ) ); |
618
|
|
|
} |
619
|
|
|
/** |
620
|
|
|
* @deprecated |
621
|
|
|
*/ |
622
|
|
|
function woocommerce_product_post_type_link( $permalink, $post ) { |
623
|
|
|
return wc_product_post_type_link( $permalink, $post ); |
624
|
|
|
} |
625
|
|
|
/** |
626
|
|
|
* @deprecated |
627
|
|
|
*/ |
628
|
|
|
function woocommerce_placeholder_img_src() { |
629
|
|
|
return wc_placeholder_img_src(); |
630
|
|
|
} |
631
|
|
|
/** |
632
|
|
|
* @deprecated |
633
|
|
|
*/ |
634
|
|
|
function woocommerce_placeholder_img( $size = 'shop_thumbnail' ) { |
635
|
|
|
return wc_placeholder_img( $size ); |
636
|
|
|
} |
637
|
|
|
/** |
638
|
|
|
* @deprecated |
639
|
|
|
*/ |
640
|
|
|
function woocommerce_get_formatted_variation( $variation = '', $flat = false ) { |
641
|
|
|
return wc_get_formatted_variation( $variation, $flat ); |
642
|
|
|
} |
643
|
|
|
/** |
644
|
|
|
* @deprecated |
645
|
|
|
*/ |
646
|
|
|
function woocommerce_scheduled_sales() { |
647
|
|
|
return wc_scheduled_sales(); |
648
|
|
|
} |
649
|
|
|
/** |
650
|
|
|
* @deprecated |
651
|
|
|
*/ |
652
|
|
|
function woocommerce_get_attachment_image_attributes( $attr ) { |
653
|
|
|
return wc_get_attachment_image_attributes( $attr ); |
654
|
|
|
} |
655
|
|
|
/** |
656
|
|
|
* @deprecated |
657
|
|
|
*/ |
658
|
|
|
function woocommerce_prepare_attachment_for_js( $response ) { |
659
|
|
|
return wc_prepare_attachment_for_js( $response ); |
660
|
|
|
} |
661
|
|
|
/** |
662
|
|
|
* @deprecated |
663
|
|
|
*/ |
664
|
|
|
function woocommerce_track_product_view() { |
665
|
|
|
return wc_track_product_view(); |
666
|
|
|
} |
667
|
|
|
|
668
|
|
|
/** |
669
|
|
|
* Shop order status. |
670
|
|
|
* |
671
|
|
|
* @since 2.2 |
672
|
|
|
* @param WP_Query $q |
673
|
|
|
*/ |
674
|
|
|
function wc_shop_order_status_backwards_compatibility( $q ) { |
675
|
|
|
if ( $q->is_main_query() ) { |
676
|
|
|
return; |
677
|
|
|
} |
678
|
|
|
|
679
|
|
|
if ( |
680
|
|
|
isset( $q->query_vars['post_type'] ) && 'shop_order' == $q->query_vars['post_type'] |
681
|
|
|
&& isset( $q->query_vars['post_status'] ) && 'publish' == $q->query_vars['post_status'] |
682
|
|
|
) { |
683
|
|
|
$tax_query = isset( $q->query_vars['tax_query'] ) ? $q->query_vars['tax_query'] : array(); |
684
|
|
|
$order_status = array(); |
685
|
|
|
$tax_key = ''; |
686
|
|
|
|
687
|
|
|
// Look for shop_order_status taxonomy and get the terms |
688
|
|
|
foreach ( $tax_query as $key => $tax ) { |
689
|
|
|
if ( 'shop_order_status' == $tax['taxonomy'] ) { |
690
|
|
|
$tax_key = $key; |
691
|
|
|
$order_status = $tax['terms']; |
692
|
|
|
break; |
693
|
|
|
} |
694
|
|
|
} |
695
|
|
|
|
696
|
|
|
if ( $order_status ) { |
697
|
|
|
// Remove old tax_query |
698
|
|
|
unset( $tax_query[ $tax_key ] ); |
699
|
|
|
|
700
|
|
|
// Set the new order status |
701
|
|
|
$order_status = is_array( $order_status ) ? 'wc-' . implode( ',wc-', $order_status ) : 'wc-' . $order_status; |
702
|
|
|
|
703
|
|
|
$q->set( 'post_status', $order_status ); |
704
|
|
|
$q->set( 'tax_query', $tax_query ); |
705
|
|
|
|
706
|
|
|
_doing_it_wrong( 'WP_Query', sprintf( __( 'The shop_order_status taxonomy is no more in WooCommerce 2.2! You should use the new WooCommerce post_status instead, <a href="%s">read more...</a>', 'woocommerce' ), 'https://woocommerce.wordpress.com/2014/08/wc-2-2-order-statuses-plugin-compatibility/' ), 'WooCommerce 2.2' ); |
707
|
|
|
} else { |
708
|
|
|
$q->set( 'post_status', array_keys( wc_get_order_statuses() ) ); |
709
|
|
|
|
710
|
|
|
_doing_it_wrong( 'WP_Query', sprintf( __( 'The "publish" order status is no more in WooCommerce 2.2! You should use the new WooCommerce post_status instead, <a href="%s">read more...</a>', 'woocommerce' ), 'https://woocommerce.wordpress.com/2014/08/wc-2-2-order-statuses-plugin-compatibility/' ), 'WooCommerce 2.2' ); |
711
|
|
|
} |
712
|
|
|
} |
713
|
|
|
} |
714
|
|
|
|
715
|
|
|
add_action( 'pre_get_posts', 'wc_shop_order_status_backwards_compatibility' ); |
716
|
|
|
|
717
|
|
|
/** |
718
|
|
|
* @since 2.3 |
719
|
|
|
* @deprecated has no replacement |
720
|
|
|
*/ |
721
|
|
|
function woocommerce_compile_less_styles() { |
722
|
|
|
_deprecated_function( 'woocommerce_compile_less_styles', '2.3' ); |
723
|
|
|
} |
724
|
|
|
|
725
|
|
|
/** |
726
|
|
|
* woocommerce_calc_shipping was an option used to determine if shipping was enabled prior to version 2.6.0. This has since been replaced with wc_shipping_enabled() function and |
727
|
|
|
* the woocommerce_ship_to_countries setting. |
728
|
|
|
* @since 2.6.0 |
729
|
|
|
* @return string |
730
|
|
|
*/ |
731
|
|
|
function woocommerce_calc_shipping_backwards_compatibility( $value ) { |
732
|
|
|
if ( defined( 'WC_UPDATING' ) ) { |
733
|
|
|
return $value; |
734
|
|
|
} |
735
|
|
|
return 'disabled' === get_option( 'woocommerce_ship_to_countries' ) ? 'no' : 'yes'; |
736
|
|
|
} |
737
|
|
|
|
738
|
|
|
add_filter( 'pre_option_woocommerce_calc_shipping', 'woocommerce_calc_shipping_backwards_compatibility' ); |
739
|
|
|
|
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.