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