/includes/wc-deprecated-functions.php

  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; 
  15.  
  16. /** 
  17. * Runs a deprecated action with notice only if used. 
  18. * 
  19. * @since 3.0.0 
  20. * @param string $action 
  21. * @param array $args 
  22. * @param string $deprecated_in 
  23. * @param string $replacement 
  24. */ 
  25. function wc_do_deprecated_action( $action, $args, $deprecated_in, $replacement ) { 
  26. if ( has_action( $action ) ) { 
  27. wc_deprecated_function( 'Action: ' . $action, $deprecated_in, $replacement ); 
  28. do_action_ref_array( $action, $args ); 
  29.  
  30. /** 
  31. * Wrapper for deprecated functions so we can apply some extra logic. 
  32. * 
  33. * @since 3.0.0 
  34. * @param string $function 
  35. * @param string $version 
  36. * @param string $replacement 
  37. */ 
  38. function wc_deprecated_function( $function, $version, $replacement = null ) { 
  39. if ( is_ajax() ) { 
  40. do_action( 'deprecated_function_run', $function, $replacement, $version ); 
  41. $log_string = "The {$function} function is deprecated since version {$version}."; 
  42. $log_string .= $replacement ? " Replace with {$replacement}." : ''; 
  43. error_log( $log_string ); 
  44. } else { 
  45. _deprecated_function( $function, $version, $replacement ); 
  46.  
  47.  
  48. /** 
  49. * Wrapper for wc_doing_it_wrong. 
  50. * 
  51. * @since 3.0.0 
  52. * @param string $function 
  53. * @param string $version 
  54. * @param string $replacement 
  55. */ 
  56. function wc_doing_it_wrong( $function, $message, $version ) { 
  57. $message .= ' Backtrace: ' . wp_debug_backtrace_summary(); 
  58.  
  59. if ( is_ajax() ) { 
  60. do_action( 'doing_it_wrong_run', $function, $message, $version ); 
  61. error_log( "{$function} was called incorrectly. {$message}. This message was added in version {$version}." ); 
  62. } else { 
  63. _doing_it_wrong( $function, $message, $version ); 
  64.  
  65. /** 
  66. * Wrapper for deprecated arguments so we can apply some extra logic. 
  67. * 
  68. * @since 3.0.0 
  69. * @param string $argument 
  70. * @param string $version 
  71. * @param string $replacement 
  72. */ 
  73. function wc_deprecated_argument( $argument, $version, $message = null ) { 
  74. if ( is_ajax() ) { 
  75. do_action( 'deprecated_argument_run', $argument, $message, $version ); 
  76. error_log( "The {$argument} argument is deprecated since version {$version}. {$message}" ); 
  77. } else { 
  78. _deprecated_argument( $argument, $version, $message ); 
  79.  
  80. /** 
  81. * @deprecated 2.1 
  82. */ 
  83. function woocommerce_show_messages() { 
  84. wc_deprecated_function( 'woocommerce_show_messages', '2.1', 'wc_print_notices' ); 
  85. wc_print_notices(); 
  86.  
  87. /** 
  88. * @deprecated 2.1 
  89. */ 
  90. function woocommerce_weekend_area_js() { 
  91. wc_deprecated_function( 'woocommerce_weekend_area_js', '2.1' ); 
  92.  
  93. /** 
  94. * @deprecated 2.1 
  95. */ 
  96. function woocommerce_tooltip_js() { 
  97. wc_deprecated_function( 'woocommerce_tooltip_js', '2.1' ); 
  98.  
  99. /** 
  100. * @deprecated 2.1 
  101. */ 
  102. function woocommerce_datepicker_js() { 
  103. wc_deprecated_function( 'woocommerce_datepicker_js', '2.1' ); 
  104.  
  105. /** 
  106. * @deprecated 2.1 
  107. */ 
  108. function woocommerce_admin_scripts() { 
  109. wc_deprecated_function( 'woocommerce_admin_scripts', '2.1' ); 
  110.  
  111. /** 
  112. * @deprecated 2.1 
  113. */ 
  114. function woocommerce_create_page( $slug, $option = '', $page_title = '', $page_content = '', $post_parent = 0 ) { 
  115. wc_deprecated_function( 'woocommerce_create_page', '2.1', 'wc_create_page' ); 
  116. return wc_create_page( $slug, $option, $page_title, $page_content, $post_parent ); 
  117.  
  118. /** 
  119. * @deprecated 2.1 
  120. */ 
  121. function woocommerce_readfile_chunked( $file, $retbytes = true ) { 
  122. wc_deprecated_function( 'woocommerce_readfile_chunked', '2.1', 'WC_Download_Handler::readfile_chunked()' ); 
  123. return WC_Download_Handler::readfile_chunked( $file ); 
  124.  
  125. /** 
  126. * Formal total costs - format to the number of decimal places for the base currency. 
  127. * 
  128. * @access public 
  129. * @param mixed $number 
  130. * @deprecated 2.1 
  131. * @return string 
  132. */ 
  133. function woocommerce_format_total( $number ) { 
  134. wc_deprecated_function( __FUNCTION__, '2.1', 'wc_format_decimal()' ); 
  135. return wc_format_decimal( $number, wc_get_price_decimals(), false ); 
  136.  
  137. /** 
  138. * Get product name with extra details such as SKU price and attributes. Used within admin. 
  139. * 
  140. * @access public 
  141. * @param WC_Product $product 
  142. * @deprecated 2.1 
  143. * @return string 
  144. */ 
  145. function woocommerce_get_formatted_product_name( $product ) { 
  146. wc_deprecated_function( __FUNCTION__, '2.1', 'WC_Product::get_formatted_name()' ); 
  147. return $product->get_formatted_name(); 
  148.  
  149. /** 
  150. * Handle IPN requests for the legacy paypal gateway by calling gateways manually if needed. 
  151. * 
  152. * @access public 
  153. */ 
  154. function woocommerce_legacy_paypal_ipn() { 
  155. if ( ! empty( $_GET['paypalListener'] ) && 'paypal_standard_IPN' === $_GET['paypalListener'] ) { 
  156. WC()->payment_gateways(); 
  157. do_action( 'woocommerce_api_wc_gateway_paypal' ); 
  158. add_action( 'init', 'woocommerce_legacy_paypal_ipn' ); 
  159.  
  160. /** 
  161. * @deprecated 3.0 
  162. */ 
  163. function get_product( $the_product = false, $args = array() ) { 
  164. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_get_product' ); 
  165. return wc_get_product( $the_product, $args ); 
  166.  
  167. /** 
  168. * @deprecated 3.0 
  169. */ 
  170. function woocommerce_protected_product_add_to_cart( $passed, $product_id ) { 
  171. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_protected_product_add_to_cart' ); 
  172. return wc_protected_product_add_to_cart( $passed, $product_id ); 
  173.  
  174. /** 
  175. * @deprecated 3.0 
  176. */ 
  177. function woocommerce_empty_cart() { 
  178. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_empty_cart' ); 
  179. wc_empty_cart(); 
  180.  
  181. /** 
  182. * @deprecated 3.0 
  183. */ 
  184. function woocommerce_load_persistent_cart( $user_login, $user = 0 ) { 
  185. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_load_persistent_cart' ); 
  186. return wc_load_persistent_cart( $user_login, $user ); 
  187.  
  188. /** 
  189. * @deprecated 3.0 
  190. */ 
  191. function woocommerce_add_to_cart_message( $product_id ) { 
  192. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_add_to_cart_message' ); 
  193. wc_add_to_cart_message( $product_id ); 
  194.  
  195. /** 
  196. * @deprecated 3.0 
  197. */ 
  198. function woocommerce_clear_cart_after_payment() { 
  199. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_clear_cart_after_payment' ); 
  200. wc_clear_cart_after_payment(); 
  201.  
  202. /** 
  203. * @deprecated 3.0 
  204. */ 
  205. function woocommerce_cart_totals_subtotal_html() { 
  206. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_cart_totals_subtotal_html' ); 
  207. wc_cart_totals_subtotal_html(); 
  208.  
  209. /** 
  210. * @deprecated 3.0 
  211. */ 
  212. function woocommerce_cart_totals_shipping_html() { 
  213. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_cart_totals_shipping_html' ); 
  214. wc_cart_totals_shipping_html(); 
  215.  
  216. /** 
  217. * @deprecated 3.0 
  218. */ 
  219. function woocommerce_cart_totals_coupon_html( $coupon ) { 
  220. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_cart_totals_coupon_html' ); 
  221. wc_cart_totals_coupon_html( $coupon ); 
  222.  
  223. /** 
  224. * @deprecated 3.0 
  225. */ 
  226. function woocommerce_cart_totals_order_total_html() { 
  227. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_cart_totals_order_total_html' ); 
  228. wc_cart_totals_order_total_html(); 
  229.  
  230. /** 
  231. * @deprecated 3.0 
  232. */ 
  233. function woocommerce_cart_totals_fee_html( $fee ) { 
  234. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_cart_totals_fee_html' ); 
  235. wc_cart_totals_fee_html( $fee ); 
  236.  
  237. /** 
  238. * @deprecated 3.0 
  239. */ 
  240. function woocommerce_cart_totals_shipping_method_label( $method ) { 
  241. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_cart_totals_shipping_method_label' ); 
  242. return wc_cart_totals_shipping_method_label( $method ); 
  243.  
  244. /** 
  245. * @deprecated 3.0 
  246. */ 
  247. function woocommerce_get_template_part( $slug, $name = '' ) { 
  248. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_get_template_part' ); 
  249. wc_get_template_part( $slug, $name ); 
  250.  
  251. /** 
  252. * @deprecated 3.0 
  253. */ 
  254. function woocommerce_get_template( $template_name, $args = array(), $template_path = '', $default_path = '' ) { 
  255. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_get_template' ); 
  256. wc_get_template( $template_name, $args, $template_path, $default_path ); 
  257.  
  258. /** 
  259. * @deprecated 3.0 
  260. */ 
  261. function woocommerce_locate_template( $template_name, $template_path = '', $default_path = '' ) { 
  262. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_locate_template' ); 
  263. return wc_locate_template( $template_name, $template_path, $default_path ); 
  264.  
  265. /** 
  266. * @deprecated 3.0 
  267. */ 
  268. function woocommerce_mail( $to, $subject, $message, $headers = "Content-Type: text/html\r\n", $attachments = "" ) { 
  269. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_mail' ); 
  270. wc_mail( $to, $subject, $message, $headers, $attachments ); 
  271.  
  272. /** 
  273. * @deprecated 3.0 
  274. */ 
  275. function woocommerce_disable_admin_bar( $show_admin_bar ) { 
  276. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_disable_admin_bar' ); 
  277. return wc_disable_admin_bar( $show_admin_bar ); 
  278.  
  279. /** 
  280. * @deprecated 3.0 
  281. */ 
  282. function woocommerce_create_new_customer( $email, $username = '', $password = '' ) { 
  283. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_create_new_customer' ); 
  284. return wc_create_new_customer( $email, $username, $password ); 
  285.  
  286. /** 
  287. * @deprecated 3.0 
  288. */ 
  289. function woocommerce_set_customer_auth_cookie( $customer_id ) { 
  290. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_set_customer_auth_cookie' ); 
  291. wc_set_customer_auth_cookie( $customer_id ); 
  292.  
  293. /** 
  294. * @deprecated 3.0 
  295. */ 
  296. function woocommerce_update_new_customer_past_orders( $customer_id ) { 
  297. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_update_new_customer_past_orders' ); 
  298. return wc_update_new_customer_past_orders( $customer_id ); 
  299.  
  300. /** 
  301. * @deprecated 3.0 
  302. */ 
  303. function woocommerce_paying_customer( $order_id ) { 
  304. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_paying_customer' ); 
  305. wc_paying_customer( $order_id ); 
  306.  
  307. /** 
  308. * @deprecated 3.0 
  309. */ 
  310. function woocommerce_customer_bought_product( $customer_email, $user_id, $product_id ) { 
  311. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_customer_bought_product' ); 
  312. return wc_customer_bought_product( $customer_email, $user_id, $product_id ); 
  313.  
  314. /** 
  315. * @deprecated 3.0 
  316. */ 
  317. function woocommerce_customer_has_capability( $allcaps, $caps, $args ) { 
  318. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_customer_has_capability' ); 
  319. return wc_customer_has_capability( $allcaps, $caps, $args ); 
  320.  
  321. /** 
  322. * @deprecated 3.0 
  323. */ 
  324. function woocommerce_sanitize_taxonomy_name( $taxonomy ) { 
  325. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_sanitize_taxonomy_name' ); 
  326. return wc_sanitize_taxonomy_name( $taxonomy ); 
  327.  
  328. /** 
  329. * @deprecated 3.0 
  330. */ 
  331. function woocommerce_get_filename_from_url( $file_url ) { 
  332. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_get_filename_from_url' ); 
  333. return wc_get_filename_from_url( $file_url ); 
  334.  
  335. /** 
  336. * @deprecated 3.0 
  337. */ 
  338. function woocommerce_get_dimension( $dim, $to_unit ) { 
  339. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_get_dimension' ); 
  340. return wc_get_dimension( $dim, $to_unit ); 
  341.  
  342. /** 
  343. * @deprecated 3.0 
  344. */ 
  345. function woocommerce_get_weight( $weight, $to_unit ) { 
  346. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_get_weight' ); 
  347. return wc_get_weight( $weight, $to_unit ); 
  348.  
  349. /** 
  350. * @deprecated 3.0 
  351. */ 
  352. function woocommerce_trim_zeros( $price ) { 
  353. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_trim_zeros' ); 
  354. return wc_trim_zeros( $price ); 
  355.  
  356. /** 
  357. * @deprecated 3.0 
  358. */ 
  359. function woocommerce_round_tax_total( $tax ) { 
  360. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_round_tax_total' ); 
  361. return wc_round_tax_total( $tax ); 
  362.  
  363. /** 
  364. * @deprecated 3.0 
  365. */ 
  366. function woocommerce_format_decimal( $number, $dp = false, $trim_zeros = false ) { 
  367. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_format_decimal' ); 
  368. return wc_format_decimal( $number, $dp, $trim_zeros ); 
  369.  
  370. /** 
  371. * @deprecated 3.0 
  372. */ 
  373. function woocommerce_clean( $var ) { 
  374. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_clean' ); 
  375. return wc_clean( $var ); 
  376.  
  377. /** 
  378. * @deprecated 3.0 
  379. */ 
  380. function woocommerce_array_overlay( $a1, $a2 ) { 
  381. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_array_overlay' ); 
  382. return wc_array_overlay( $a1, $a2 ); 
  383.  
  384. /** 
  385. * @deprecated 3.0 
  386. */ 
  387. function woocommerce_price( $price, $args = array() ) { 
  388. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_price' ); 
  389. return wc_price( $price, $args ); 
  390.  
  391. /** 
  392. * @deprecated 3.0 
  393. */ 
  394. function woocommerce_let_to_num( $size ) { 
  395. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_let_to_num' ); 
  396. return wc_let_to_num( $size ); 
  397.  
  398. /** 
  399. * @deprecated 3.0 
  400. */ 
  401. function woocommerce_date_format() { 
  402. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_date_format' ); 
  403. return wc_date_format(); 
  404.  
  405. /** 
  406. * @deprecated 3.0 
  407. */ 
  408. function woocommerce_time_format() { 
  409. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_time_format' ); 
  410. return wc_time_format(); 
  411.  
  412. /** 
  413. * @deprecated 3.0 
  414. */ 
  415. function woocommerce_timezone_string() { 
  416. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_timezone_string' ); 
  417. return wc_timezone_string(); 
  418.  
  419. if ( ! function_exists( 'woocommerce_rgb_from_hex' ) ) { 
  420. /** 
  421. * @deprecated 3.0 
  422. */ 
  423. function woocommerce_rgb_from_hex( $color ) { 
  424. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_rgb_from_hex' ); 
  425. return wc_rgb_from_hex( $color ); 
  426.  
  427. if ( ! function_exists( 'woocommerce_hex_darker' ) ) { 
  428. /** 
  429. * @deprecated 3.0 
  430. */ 
  431. function woocommerce_hex_darker( $color, $factor = 30 ) { 
  432. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_hex_darker' ); 
  433. return wc_hex_darker( $color, $factor ); 
  434.  
  435. if ( ! function_exists( 'woocommerce_hex_lighter' ) ) { 
  436. /** 
  437. * @deprecated 3.0 
  438. */ 
  439. function woocommerce_hex_lighter( $color, $factor = 30 ) { 
  440. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_hex_lighter' ); 
  441. return wc_hex_lighter( $color, $factor ); 
  442.  
  443. if ( ! function_exists( 'woocommerce_light_or_dark' ) ) { 
  444. /** 
  445. * @deprecated 3.0 
  446. */ 
  447. function woocommerce_light_or_dark( $color, $dark = '#000000', $light = '#FFFFFF' ) { 
  448. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_light_or_dark' ); 
  449. return wc_light_or_dark( $color, $dark, $light ); 
  450.  
  451. if ( ! function_exists( 'woocommerce_format_hex' ) ) { 
  452. /** 
  453. * @deprecated 3.0 
  454. */ 
  455. function woocommerce_format_hex( $hex ) { 
  456. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_format_hex' ); 
  457. return wc_format_hex( $hex ); 
  458.  
  459. /** 
  460. * @deprecated 3.0 
  461. */ 
  462. function woocommerce_get_order_id_by_order_key( $order_key ) { 
  463. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_get_order_id_by_order_key' ); 
  464. return wc_get_order_id_by_order_key( $order_key ); 
  465.  
  466. /** 
  467. * @deprecated 3.0 
  468. */ 
  469. function woocommerce_downloadable_file_permission( $download_id, $product_id, $order ) { 
  470. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_downloadable_file_permission' ); 
  471. return wc_downloadable_file_permission( $download_id, $product_id, $order ); 
  472.  
  473. /** 
  474. * @deprecated 3.0 
  475. */ 
  476. function woocommerce_downloadable_product_permissions( $order_id ) { 
  477. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_downloadable_product_permissions' ); 
  478. wc_downloadable_product_permissions( $order_id ); 
  479.  
  480. /** 
  481. * @deprecated 3.0 
  482. */ 
  483. function woocommerce_add_order_item( $order_id, $item ) { 
  484. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_add_order_item' ); 
  485. return wc_add_order_item( $order_id, $item ); 
  486.  
  487. /** 
  488. * @deprecated 3.0 
  489. */ 
  490. function woocommerce_delete_order_item( $item_id ) { 
  491. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_delete_order_item' ); 
  492. return wc_delete_order_item( $item_id ); 
  493.  
  494. /** 
  495. * @deprecated 3.0 
  496. */ 
  497. function woocommerce_update_order_item_meta( $item_id, $meta_key, $meta_value, $prev_value = '' ) { 
  498. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_update_order_item_meta' ); 
  499. return wc_update_order_item_meta( $item_id, $meta_key, $meta_value, $prev_value ); 
  500.  
  501. /** 
  502. * @deprecated 3.0 
  503. */ 
  504. function woocommerce_add_order_item_meta( $item_id, $meta_key, $meta_value, $unique = false ) { 
  505. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_add_order_item_meta' ); 
  506. return wc_add_order_item_meta( $item_id, $meta_key, $meta_value, $unique ); 
  507.  
  508. /** 
  509. * @deprecated 3.0 
  510. */ 
  511. function woocommerce_delete_order_item_meta( $item_id, $meta_key, $meta_value = '', $delete_all = false ) { 
  512. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_delete_order_item_meta' ); 
  513. return wc_delete_order_item_meta( $item_id, $meta_key, $meta_value, $delete_all ); 
  514.  
  515. /** 
  516. * @deprecated 3.0 
  517. */ 
  518. function woocommerce_get_order_item_meta( $item_id, $key, $single = true ) { 
  519. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_get_order_item_meta' ); 
  520. return wc_get_order_item_meta( $item_id, $key, $single ); 
  521.  
  522. /** 
  523. * @deprecated 3.0 
  524. */ 
  525. function woocommerce_cancel_unpaid_orders() { 
  526. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_cancel_unpaid_orders' ); 
  527. wc_cancel_unpaid_orders(); 
  528.  
  529. /** 
  530. * @deprecated 3.0 
  531. */ 
  532. function woocommerce_processing_order_count() { 
  533. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_processing_order_count' ); 
  534. return wc_processing_order_count(); 
  535.  
  536. /** 
  537. * @deprecated 3.0 
  538. */ 
  539. function woocommerce_get_page_id( $page ) { 
  540. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_get_page_id' ); 
  541. return wc_get_page_id( $page ); 
  542.  
  543. /** 
  544. * @deprecated 3.0 
  545. */ 
  546. function woocommerce_get_endpoint_url( $endpoint, $value = '', $permalink = '' ) { 
  547. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_get_endpoint_url' ); 
  548. return wc_get_endpoint_url( $endpoint, $value, $permalink ); 
  549.  
  550. /** 
  551. * @deprecated 3.0 
  552. */ 
  553. function woocommerce_lostpassword_url( $url ) { 
  554. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_lostpassword_url' ); 
  555. return wc_lostpassword_url( $url ); 
  556.  
  557. /** 
  558. * @deprecated 3.0 
  559. */ 
  560. function woocommerce_customer_edit_account_url() { 
  561. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_customer_edit_account_url' ); 
  562. return wc_customer_edit_account_url(); 
  563.  
  564. /** 
  565. * @deprecated 3.0 
  566. */ 
  567. function woocommerce_nav_menu_items( $items, $args ) { 
  568. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_nav_menu_items' ); 
  569. return wc_nav_menu_items( $items ); 
  570.  
  571. /** 
  572. * @deprecated 3.0 
  573. */ 
  574. function woocommerce_nav_menu_item_classes( $menu_items, $args ) { 
  575. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_nav_menu_item_classes' ); 
  576. return wc_nav_menu_item_classes( $menu_items ); 
  577.  
  578. /** 
  579. * @deprecated 3.0 
  580. */ 
  581. function woocommerce_list_pages( $pages ) { 
  582. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_list_pages' ); 
  583. return wc_list_pages( $pages ); 
  584.  
  585. /** 
  586. * @deprecated 3.0 
  587. */ 
  588. function woocommerce_product_dropdown_categories( $args = array(), $deprecated_hierarchical = 1, $deprecated_show_uncategorized = 1, $deprecated_orderby = '' ) { 
  589. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_product_dropdown_categories' ); 
  590. return wc_product_dropdown_categories( $args, $deprecated_hierarchical, $deprecated_show_uncategorized, $deprecated_orderby ); 
  591.  
  592. /** 
  593. * @deprecated 3.0 
  594. */ 
  595. function woocommerce_walk_category_dropdown_tree( $a1 = '', $a2 = '', $a3 = '' ) { 
  596. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_walk_category_dropdown_tree' ); 
  597. return wc_walk_category_dropdown_tree( $a1, $a2, $a3 ); 
  598.  
  599. /** 
  600. * @deprecated 3.0 
  601. */ 
  602. function woocommerce_taxonomy_metadata_wpdbfix() { 
  603. wc_deprecated_function( __FUNCTION__, '3.0' ); 
  604.  
  605. /** 
  606. * @deprecated 3.0 
  607. */ 
  608. function wc_taxonomy_metadata_wpdbfix() { 
  609. wc_deprecated_function( __FUNCTION__, '3.0' ); 
  610.  
  611. /** 
  612. * @deprecated 3.0 
  613. */ 
  614. function woocommerce_order_terms( $the_term, $next_id, $taxonomy, $index = 0, $terms = null ) { 
  615. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_reorder_terms' ); 
  616. return wc_reorder_terms( $the_term, $next_id, $taxonomy, $index, $terms ); 
  617.  
  618. /** 
  619. * @deprecated 3.0 
  620. */ 
  621. function woocommerce_set_term_order( $term_id, $index, $taxonomy, $recursive = false ) { 
  622. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_set_term_order' ); 
  623. return wc_set_term_order( $term_id, $index, $taxonomy, $recursive ); 
  624.  
  625. /** 
  626. * @deprecated 3.0 
  627. */ 
  628. function woocommerce_terms_clauses( $clauses, $taxonomies, $args ) { 
  629. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_terms_clauses' ); 
  630. return wc_terms_clauses( $clauses, $taxonomies, $args ); 
  631.  
  632. /** 
  633. * @deprecated 3.0 
  634. */ 
  635. function _woocommerce_term_recount( $terms, $taxonomy, $callback, $terms_are_term_taxonomy_ids ) { 
  636. wc_deprecated_function( __FUNCTION__, '3.0', '_wc_term_recount' ); 
  637. return _wc_term_recount( $terms, $taxonomy, $callback, $terms_are_term_taxonomy_ids ); 
  638.  
  639. /** 
  640. * @deprecated 3.0 
  641. */ 
  642. function woocommerce_recount_after_stock_change( $product_id ) { 
  643. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_recount_after_stock_change' ); 
  644. return wc_recount_after_stock_change( $product_id ); 
  645.  
  646. /** 
  647. * @deprecated 3.0 
  648. */ 
  649. function woocommerce_change_term_counts( $terms, $taxonomies, $args ) { 
  650. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_change_term_counts' ); 
  651. return wc_change_term_counts( $terms, $taxonomies ); 
  652.  
  653. /** 
  654. * @deprecated 3.0 
  655. */ 
  656. function woocommerce_get_product_ids_on_sale() { 
  657. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_get_product_ids_on_sale' ); 
  658. return wc_get_product_ids_on_sale(); 
  659.  
  660. /** 
  661. * @deprecated 3.0 
  662. */ 
  663. function woocommerce_get_featured_product_ids() { 
  664. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_get_featured_product_ids' ); 
  665. return wc_get_featured_product_ids(); 
  666.  
  667. /** 
  668. * @deprecated 3.0 
  669. */ 
  670. function woocommerce_get_product_terms( $object_id, $taxonomy, $fields = 'all' ) { 
  671. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_get_product_terms' ); 
  672. return wc_get_product_terms( $object_id, $taxonomy, array( 'fields' => $fields ) ); 
  673.  
  674. /** 
  675. * @deprecated 3.0 
  676. */ 
  677. function woocommerce_product_post_type_link( $permalink, $post ) { 
  678. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_product_post_type_link' ); 
  679. return wc_product_post_type_link( $permalink, $post ); 
  680.  
  681. /** 
  682. * @deprecated 3.0 
  683. */ 
  684. function woocommerce_placeholder_img_src() { 
  685. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_placeholder_img_src' ); 
  686. return wc_placeholder_img_src(); 
  687.  
  688. /** 
  689. * @deprecated 3.0 
  690. */ 
  691. function woocommerce_placeholder_img( $size = 'shop_thumbnail' ) { 
  692. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_placeholder_img' ); 
  693. return wc_placeholder_img( $size ); 
  694.  
  695. /** 
  696. * @deprecated 3.0 
  697. */ 
  698. function woocommerce_get_formatted_variation( $variation = '', $flat = false ) { 
  699. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_get_formatted_variation' ); 
  700. return wc_get_formatted_variation( $variation, $flat ); 
  701.  
  702. /** 
  703. * @deprecated 3.0 
  704. */ 
  705. function woocommerce_scheduled_sales() { 
  706. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_scheduled_sales' ); 
  707. return wc_scheduled_sales(); 
  708.  
  709. /** 
  710. * @deprecated 3.0 
  711. */ 
  712. function woocommerce_get_attachment_image_attributes( $attr ) { 
  713. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_get_attachment_image_attributes' ); 
  714. return wc_get_attachment_image_attributes( $attr ); 
  715.  
  716. /** 
  717. * @deprecated 3.0 
  718. */ 
  719. function woocommerce_prepare_attachment_for_js( $response ) { 
  720. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_prepare_attachment_for_js' ); 
  721. return wc_prepare_attachment_for_js( $response ); 
  722.  
  723. /** 
  724. * @deprecated 3.0 
  725. */ 
  726. function woocommerce_track_product_view() { 
  727. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_track_product_view' ); 
  728. return wc_track_product_view(); 
  729.  
  730. /** 
  731. * @since 2.3 
  732. * @deprecated has no replacement 
  733. */ 
  734. function woocommerce_compile_less_styles() { 
  735. wc_deprecated_function( 'woocommerce_compile_less_styles', '2.3' ); 
  736.  
  737. /** 
  738. * 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 
  739. * the woocommerce_ship_to_countries setting. 
  740. * @since 2.6.0 
  741. * @return string 
  742. */ 
  743. function woocommerce_calc_shipping_backwards_compatibility( $value ) { 
  744. if ( defined( 'WC_UPDATING' ) ) { 
  745. return $value; 
  746. return 'disabled' === get_option( 'woocommerce_ship_to_countries' ) ? 'no' : 'yes'; 
  747. add_filter( 'pre_option_woocommerce_calc_shipping', 'woocommerce_calc_shipping_backwards_compatibility' ); 
  748.  
  749. /** 
  750. * @deprecated 3.0.0 
  751. * @see WC_Structured_Data class 
  752. * 
  753. * @return string 
  754. */ 
  755. function woocommerce_get_product_schema() { 
  756. wc_deprecated_function( 'woocommerce_get_product_schema', '3.0' ); 
  757.  
  758. global $product; 
  759.  
  760. $schema = "Product"; 
  761.  
  762. // Downloadable product schema handling 
  763. if ( $product->is_downloadable() ) { 
  764. switch ( $product->download_type ) { 
  765. case 'application' : 
  766. $schema = "SoftwareApplication"; 
  767. break; 
  768. case 'music' : 
  769. $schema = "MusicAlbum"; 
  770. break; 
  771. default : 
  772. $schema = "Product"; 
  773. break; 
  774.  
  775. return 'http://schema.org/' . $schema; 
  776.  
  777. /** 
  778. * Save product price. 
  779. * 
  780. * This is a private function (internal use ONLY) used until a data manipulation api is built. 
  781. * 
  782. * @deprecated 3.0.0 
  783. * @param int $product_id 
  784. * @param float $regular_price 
  785. * @param float $sale_price 
  786. * @param string $date_from 
  787. * @param string $date_to 
  788. */ 
  789. function _wc_save_product_price( $product_id, $regular_price, $sale_price = '', $date_from = '', $date_to = '' ) { 
  790. wc_doing_it_wrong( '_wc_save_product_price()', 'This function is not for developer use and is deprecated.', '3.0' ); 
  791.  
  792. $product_id = absint( $product_id ); 
  793. $regular_price = wc_format_decimal( $regular_price ); 
  794. $sale_price = '' === $sale_price ? '' : wc_format_decimal( $sale_price ); 
  795. $date_from = wc_clean( $date_from ); 
  796. $date_to = wc_clean( $date_to ); 
  797.  
  798. update_post_meta( $product_id, '_regular_price', $regular_price ); 
  799. update_post_meta( $product_id, '_sale_price', $sale_price ); 
  800.  
  801. // Save Dates 
  802. update_post_meta( $product_id, '_sale_price_dates_from', $date_from ? strtotime( $date_from ) : '' ); 
  803. update_post_meta( $product_id, '_sale_price_dates_to', $date_to ? strtotime( $date_to ) : '' ); 
  804.  
  805. if ( $date_to && ! $date_from ) { 
  806. $date_from = strtotime( 'NOW', current_time( 'timestamp' ) ); 
  807. update_post_meta( $product_id, '_sale_price_dates_from', $date_from ); 
  808.  
  809. // Update price if on sale 
  810. if ( '' !== $sale_price && '' === $date_to && '' === $date_from ) { 
  811. update_post_meta( $product_id, '_price', $sale_price ); 
  812. } else { 
  813. update_post_meta( $product_id, '_price', $regular_price ); 
  814.  
  815. if ( '' !== $sale_price && $date_from && strtotime( $date_from ) < strtotime( 'NOW', current_time( 'timestamp' ) ) ) { 
  816. update_post_meta( $product_id, '_price', $sale_price ); 
  817.  
  818. if ( $date_to && strtotime( $date_to ) < strtotime( 'NOW', current_time( 'timestamp' ) ) ) { 
  819. update_post_meta( $product_id, '_price', $regular_price ); 
  820. update_post_meta( $product_id, '_sale_price_dates_from', '' ); 
  821. update_post_meta( $product_id, '_sale_price_dates_to', '' ); 
.