/wp-includes/deprecated.php

  1. <?php 
  2. /** 
  3. * Deprecated functions from past WordPress versions. You shouldn't use these 
  4. * functions and look for the alternatives instead. The functions will be 
  5. * removed in a later version. 
  6. * 
  7. * @package WordPress 
  8. * @subpackage Deprecated 
  9. */ 
  10.  
  11. /** 
  12. * Deprecated functions come here to die. 
  13. */ 
  14.  
  15. /** 
  16. * Retrieves all post data for a given post. 
  17. * 
  18. * @since 0.71 
  19. * @deprecated 1.5.1 Use get_post() 
  20. * @see get_post() 
  21. * 
  22. * @param int $postid Post ID. 
  23. * @return array Post data. 
  24. */ 
  25. function get_postdata($postid) { 
  26. _deprecated_function( __FUNCTION__, '1.5.1', 'get_post()' ); 
  27.  
  28. $post = get_post($postid); 
  29.  
  30. $postdata = array ( 
  31. 'ID' => $post->ID,  
  32. 'Author_ID' => $post->post_author,  
  33. 'Date' => $post->post_date,  
  34. 'Content' => $post->post_content,  
  35. 'Excerpt' => $post->post_excerpt,  
  36. 'Title' => $post->post_title,  
  37. 'Category' => $post->post_category,  
  38. 'post_status' => $post->post_status,  
  39. 'comment_status' => $post->comment_status,  
  40. 'ping_status' => $post->ping_status,  
  41. 'post_password' => $post->post_password,  
  42. 'to_ping' => $post->to_ping,  
  43. 'pinged' => $post->pinged,  
  44. 'post_type' => $post->post_type,  
  45. 'post_name' => $post->post_name 
  46. ); 
  47.  
  48. return $postdata; 
  49.  
  50. /** 
  51. * Sets up the WordPress Loop. 
  52. * 
  53. * Use The Loop instead. 
  54. * 
  55. * @link https://codex.wordpress.org/The_Loop 
  56. * 
  57. * @since 1.0.1 
  58. * @deprecated 1.5.0 
  59. */ 
  60. function start_wp() { 
  61. global $wp_query; 
  62.  
  63. _deprecated_function( __FUNCTION__, '1.5.0', __('new WordPress Loop') ); 
  64.  
  65. // Since the old style loop is being used, advance the query iterator here. 
  66. $wp_query->next_post(); 
  67.  
  68. setup_postdata( get_post() ); 
  69.  
  70. /** 
  71. * Returns or prints a category ID. 
  72. * 
  73. * @since 0.71 
  74. * @deprecated 0.71 Use get_the_category() 
  75. * @see get_the_category() 
  76. * 
  77. * @param bool $echo Optional. Whether to echo the output. Default true. 
  78. * @return int Category ID. 
  79. */ 
  80. function the_category_ID($echo = true) { 
  81. _deprecated_function( __FUNCTION__, '0.71', 'get_the_category()' ); 
  82.  
  83. // Grab the first cat in the list. 
  84. $categories = get_the_category(); 
  85. $cat = $categories[0]->term_id; 
  86.  
  87. if ( $echo ) 
  88. echo $cat; 
  89.  
  90. return $cat; 
  91.  
  92. /** 
  93. * Prints a category with optional text before and after. 
  94. * 
  95. * @since 0.71 
  96. * @deprecated 0.71 Use get_the_category_by_ID() 
  97. * @see get_the_category_by_ID() 
  98. * 
  99. * @param string $before Optional. Text to display before the category. Default empty. 
  100. * @param string $after Optional. Text to display after the category. Default empty. 
  101. */ 
  102. function the_category_head( $before = '', $after = '' ) { 
  103. global $currentcat, $previouscat; 
  104.  
  105. _deprecated_function( __FUNCTION__, '0.71', 'get_the_category_by_ID()' ); 
  106.  
  107. // Grab the first cat in the list. 
  108. $categories = get_the_category(); 
  109. $currentcat = $categories[0]->category_id; 
  110. if ( $currentcat != $previouscat ) { 
  111. echo $before; 
  112. echo get_the_category_by_ID($currentcat); 
  113. echo $after; 
  114. $previouscat = $currentcat; 
  115.  
  116. /** 
  117. * Prints a link to the previous post. 
  118. * 
  119. * @since 1.5.0 
  120. * @deprecated 2.0.0 Use previous_post_link() 
  121. * @see previous_post_link() 
  122. * 
  123. * @param string $format 
  124. * @param string $previous 
  125. * @param string $title 
  126. * @param string $in_same_cat 
  127. * @param int $limitprev 
  128. * @param string $excluded_categories 
  129. */ 
  130. function previous_post($format='%', $previous='previous post: ', $title='yes', $in_same_cat='no', $limitprev=1, $excluded_categories='') { 
  131.  
  132. _deprecated_function( __FUNCTION__, '2.0.0', 'previous_post_link()' ); 
  133.  
  134. if ( empty($in_same_cat) || 'no' == $in_same_cat ) 
  135. $in_same_cat = false; 
  136. else 
  137. $in_same_cat = true; 
  138.  
  139. $post = get_previous_post($in_same_cat, $excluded_categories); 
  140.  
  141. if ( !$post ) 
  142. return; 
  143.  
  144. $string = '<a href="'.get_permalink($post->ID).'">'.$previous; 
  145. if ( 'yes' == $title ) 
  146. $string .= apply_filters('the_title', $post->post_title, $post->ID); 
  147. $string .= '</a>'; 
  148. $format = str_replace('%', $string, $format); 
  149. echo $format; 
  150.  
  151. /** 
  152. * Prints link to the next post. 
  153. * 
  154. * @since 0.71 
  155. * @deprecated 2.0.0 Use next_post_link() 
  156. * @see next_post_link() 
  157. * 
  158. * @param string $format 
  159. * @param string $next 
  160. * @param string $title 
  161. * @param string $in_same_cat 
  162. * @param int $limitnext 
  163. * @param string $excluded_categories 
  164. */ 
  165. function next_post($format='%', $next='next post: ', $title='yes', $in_same_cat='no', $limitnext=1, $excluded_categories='') { 
  166. _deprecated_function( __FUNCTION__, '2.0.0', 'next_post_link()' ); 
  167.  
  168. if ( empty($in_same_cat) || 'no' == $in_same_cat ) 
  169. $in_same_cat = false; 
  170. else 
  171. $in_same_cat = true; 
  172.  
  173. $post = get_next_post($in_same_cat, $excluded_categories); 
  174.  
  175. if ( !$post ) 
  176. return; 
  177.  
  178. $string = '<a href="'.get_permalink($post->ID).'">'.$next; 
  179. if ( 'yes' == $title ) 
  180. $string .= apply_filters('the_title', $post->post_title, $post->ID); 
  181. $string .= '</a>'; 
  182. $format = str_replace('%', $string, $format); 
  183. echo $format; 
  184.  
  185. /** 
  186. * Whether user can create a post. 
  187. * 
  188. * @since 1.5.0 
  189. * @deprecated 2.0.0 Use current_user_can() 
  190. * @see current_user_can() 
  191. * 
  192. * @param int $user_id 
  193. * @param int $blog_id Not Used 
  194. * @param int $category_id Not Used 
  195. * @return bool 
  196. */ 
  197. function user_can_create_post($user_id, $blog_id = 1, $category_id = 'None') { 
  198. _deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' ); 
  199.  
  200. $author_data = get_userdata($user_id); 
  201. return ($author_data->user_level > 1); 
  202.  
  203. /** 
  204. * Whether user can create a post. 
  205. * 
  206. * @since 1.5.0 
  207. * @deprecated 2.0.0 Use current_user_can() 
  208. * @see current_user_can() 
  209. * 
  210. * @param int $user_id 
  211. * @param int $blog_id Not Used 
  212. * @param int $category_id Not Used 
  213. * @return bool 
  214. */ 
  215. function user_can_create_draft($user_id, $blog_id = 1, $category_id = 'None') { 
  216. _deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' ); 
  217.  
  218. $author_data = get_userdata($user_id); 
  219. return ($author_data->user_level >= 1); 
  220.  
  221. /** 
  222. * Whether user can edit a post. 
  223. * 
  224. * @since 1.5.0 
  225. * @deprecated 2.0.0 Use current_user_can() 
  226. * @see current_user_can() 
  227. * 
  228. * @param int $user_id 
  229. * @param int $post_id 
  230. * @param int $blog_id Not Used 
  231. * @return bool 
  232. */ 
  233. function user_can_edit_post($user_id, $post_id, $blog_id = 1) { 
  234. _deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' ); 
  235.  
  236. $author_data = get_userdata($user_id); 
  237. $post = get_post($post_id); 
  238. $post_author_data = get_userdata($post->post_author); 
  239.  
  240. if ( (($user_id == $post_author_data->ID) && !($post->post_status == 'publish' && $author_data->user_level < 2)) 
  241. || ($author_data->user_level > $post_author_data->user_level) 
  242. || ($author_data->user_level >= 10) ) { 
  243. return true; 
  244. } else { 
  245. return false; 
  246.  
  247. /** 
  248. * Whether user can delete a post. 
  249. * 
  250. * @since 1.5.0 
  251. * @deprecated 2.0.0 Use current_user_can() 
  252. * @see current_user_can() 
  253. * 
  254. * @param int $user_id 
  255. * @param int $post_id 
  256. * @param int $blog_id Not Used 
  257. * @return bool 
  258. */ 
  259. function user_can_delete_post($user_id, $post_id, $blog_id = 1) { 
  260. _deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' ); 
  261.  
  262. // right now if one can edit, one can delete 
  263. return user_can_edit_post($user_id, $post_id, $blog_id); 
  264.  
  265. /** 
  266. * Whether user can set new posts' dates. 
  267. * 
  268. * @since 1.5.0 
  269. * @deprecated 2.0.0 Use current_user_can() 
  270. * @see current_user_can() 
  271. * 
  272. * @param int $user_id 
  273. * @param int $blog_id Not Used 
  274. * @param int $category_id Not Used 
  275. * @return bool 
  276. */ 
  277. function user_can_set_post_date($user_id, $blog_id = 1, $category_id = 'None') { 
  278. _deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' ); 
  279.  
  280. $author_data = get_userdata($user_id); 
  281. return (($author_data->user_level > 4) && user_can_create_post($user_id, $blog_id, $category_id)); 
  282.  
  283. /** 
  284. * Whether user can delete a post. 
  285. * 
  286. * @since 1.5.0 
  287. * @deprecated 2.0.0 Use current_user_can() 
  288. * @see current_user_can() 
  289. * 
  290. * @param int $user_id 
  291. * @param int $post_id 
  292. * @param int $blog_id Not Used 
  293. * @return bool returns true if $user_id can edit $post_id's date 
  294. */ 
  295. function user_can_edit_post_date($user_id, $post_id, $blog_id = 1) { 
  296. _deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' ); 
  297.  
  298. $author_data = get_userdata($user_id); 
  299. return (($author_data->user_level > 4) && user_can_edit_post($user_id, $post_id, $blog_id)); 
  300.  
  301. /** 
  302. * Whether user can delete a post. 
  303. * 
  304. * @since 1.5.0 
  305. * @deprecated 2.0.0 Use current_user_can() 
  306. * @see current_user_can() 
  307. * 
  308. * @param int $user_id 
  309. * @param int $post_id 
  310. * @param int $blog_id Not Used 
  311. * @return bool returns true if $user_id can edit $post_id's comments 
  312. */ 
  313. function user_can_edit_post_comments($user_id, $post_id, $blog_id = 1) { 
  314. _deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' ); 
  315.  
  316. // right now if one can edit a post, one can edit comments made on it 
  317. return user_can_edit_post($user_id, $post_id, $blog_id); 
  318.  
  319. /** 
  320. * Whether user can delete a post. 
  321. * 
  322. * @since 1.5.0 
  323. * @deprecated 2.0.0 Use current_user_can() 
  324. * @see current_user_can() 
  325. * 
  326. * @param int $user_id 
  327. * @param int $post_id 
  328. * @param int $blog_id Not Used 
  329. * @return bool returns true if $user_id can delete $post_id's comments 
  330. */ 
  331. function user_can_delete_post_comments($user_id, $post_id, $blog_id = 1) { 
  332. _deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' ); 
  333.  
  334. // right now if one can edit comments, one can delete comments 
  335. return user_can_edit_post_comments($user_id, $post_id, $blog_id); 
  336.  
  337. /** 
  338. * Can user can edit other user. 
  339. * 
  340. * @since 1.5.0 
  341. * @deprecated 2.0.0 Use current_user_can() 
  342. * @see current_user_can() 
  343. * 
  344. * @param int $user_id 
  345. * @param int $other_user 
  346. * @return bool 
  347. */ 
  348. function user_can_edit_user($user_id, $other_user) { 
  349. _deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' ); 
  350.  
  351. $user = get_userdata($user_id); 
  352. $other = get_userdata($other_user); 
  353. if ( $user->user_level > $other->user_level || $user->user_level > 8 || $user->ID == $other->ID ) 
  354. return true; 
  355. else 
  356. return false; 
  357.  
  358. /** 
  359. * Gets the links associated with category $cat_name. 
  360. * 
  361. * @since 0.71 
  362. * @deprecated 2.1.0 Use get_bookmarks() 
  363. * @see get_bookmarks() 
  364. * 
  365. * @param string $cat_name Optional. The category name to use. If no match is found uses all. 
  366. * @param string $before Optional. The html to output before the link. 
  367. * @param string $after Optional. The html to output after the link. 
  368. * @param string $between Optional. The html to output between the link/image and its description. Not used if no image or $show_images is true. 
  369. * @param bool $show_images Optional. Whether to show images (if defined). 
  370. * @param string $orderby Optional. The order to output the links. E.g. 'id', 'name', 'url', 'description' or 'rating'. Or maybe owner. 
  371. * If you start the name with an underscore the order will be reversed. You can also specify 'rand' as the order which will return links in a 
  372. * random order. 
  373. * @param bool $show_description Optional. Whether to show the description if show_images=false/not defined. 
  374. * @param bool $show_rating Optional. Show rating stars/chars. 
  375. * @param int $limit Optional. Limit to X entries. If not specified, all entries are shown. 
  376. * @param int $show_updated Optional. Whether to show last updated timestamp 
  377. */ 
  378. function get_linksbyname($cat_name = "noname", $before = '', $after = '<br />', $between = " ", $show_images = true, $orderby = 'id',  
  379. $show_description = true, $show_rating = false,  
  380. $limit = -1, $show_updated = 0) { 
  381. _deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' ); 
  382.  
  383. $cat_id = -1; 
  384. $cat = get_term_by('name', $cat_name, 'link_category'); 
  385. if ( $cat ) 
  386. $cat_id = $cat->term_id; 
  387.  
  388. get_links($cat_id, $before, $after, $between, $show_images, $orderby, $show_description, $show_rating, $limit, $show_updated); 
  389.  
  390. /** 
  391. * Gets the links associated with the named category. 
  392. * 
  393. * @since 1.0.1 
  394. * @deprecated 2.1.0 Use wp_list_bookmarks() 
  395. * @see wp_list_bookmarks() 
  396. * 
  397. * @param string $category The category to use. 
  398. * @param string $args 
  399. * @return string|null 
  400. */ 
  401. function wp_get_linksbyname($category, $args = '') { 
  402. _deprecated_function(__FUNCTION__, '2.1.0', 'wp_list_bookmarks()'); 
  403.  
  404. $defaults = array( 
  405. 'after' => '<br />',  
  406. 'before' => '',  
  407. 'categorize' => 0,  
  408. 'category_after' => '',  
  409. 'category_before' => '',  
  410. 'category_name' => $category,  
  411. 'show_description' => 1,  
  412. 'title_li' => '',  
  413. ); 
  414.  
  415. $r = wp_parse_args( $args, $defaults ); 
  416.  
  417. return wp_list_bookmarks($r); 
  418.  
  419. /** 
  420. * Gets an array of link objects associated with category $cat_name. 
  421. * 
  422. * $links = get_linkobjectsbyname( 'fred' ); 
  423. * foreach ( $links as $link ) { 
  424. * echo '<li>' . $link->link_name . '</li>'; 
  425. * } 
  426. * 
  427. * @since 1.0.1 
  428. * @deprecated 2.1.0 Use get_bookmarks() 
  429. * @see get_bookmarks() 
  430. * 
  431. * @param string $cat_name The category name to use. If no match is found uses all. 
  432. * @param string $orderby The order to output the links. E.g. 'id', 'name', 'url', 'description', or 'rating'. 
  433. * Or maybe owner. If you start the name with an underscore the order will be reversed. You can also 
  434. * specify 'rand' as the order which will return links in a random order. 
  435. * @param int $limit Limit to X entries. If not specified, all entries are shown. 
  436. * @return array 
  437. */ 
  438. function get_linkobjectsbyname($cat_name = "noname" , $orderby = 'name', $limit = -1) { 
  439. _deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' ); 
  440.  
  441. $cat_id = -1; 
  442. $cat = get_term_by('name', $cat_name, 'link_category'); 
  443. if ( $cat ) 
  444. $cat_id = $cat->term_id; 
  445.  
  446. return get_linkobjects($cat_id, $orderby, $limit); 
  447.  
  448. /** 
  449. * Gets an array of link objects associated with category n. 
  450. * 
  451. * Usage: 
  452. * 
  453. * $links = get_linkobjects(1); 
  454. * if ($links) { 
  455. * foreach ($links as $link) { 
  456. * echo '<li>'.$link->link_name.'<br />'.$link->link_description.'</li>'; 
  457. * } 
  458. * } 
  459. * 
  460. * Fields are: 
  461. * 
  462. * - link_id 
  463. * - link_url 
  464. * - link_name 
  465. * - link_image 
  466. * - link_target 
  467. * - link_category 
  468. * - link_description 
  469. * - link_visible 
  470. * - link_owner 
  471. * - link_rating 
  472. * - link_updated 
  473. * - link_rel 
  474. * - link_notes 
  475. * 
  476. * @since 1.0.1 
  477. * @deprecated 2.1.0 Use get_bookmarks() 
  478. * @see get_bookmarks() 
  479. * 
  480. * @param int $category The category to use. If no category supplied uses all 
  481. * @param string $orderby the order to output the links. E.g. 'id', 'name', 'url',  
  482. * 'description', or 'rating'. Or maybe owner. If you start the name with an 
  483. * underscore the order will be reversed. You can also specify 'rand' as the 
  484. * order which will return links in a random order. 
  485. * @param int $limit Limit to X entries. If not specified, all entries are shown. 
  486. * @return array 
  487. */ 
  488. function get_linkobjects($category = 0, $orderby = 'name', $limit = 0) { 
  489. _deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' ); 
  490.  
  491. $links = get_bookmarks( array( 'category' => $category, 'orderby' => $orderby, 'limit' => $limit ) ) ; 
  492.  
  493. $links_array = array(); 
  494. foreach ($links as $link) 
  495. $links_array[] = $link; 
  496.  
  497. return $links_array; 
  498.  
  499. /** 
  500. * Gets the links associated with category 'cat_name' and display rating stars/chars. 
  501. * 
  502. * @since 0.71 
  503. * @deprecated 2.1.0 Use get_bookmarks() 
  504. * @see get_bookmarks() 
  505. * 
  506. * @param string $cat_name The category name to use. If no match is found uses all 
  507. * @param string $before The html to output before the link 
  508. * @param string $after The html to output after the link 
  509. * @param string $between The html to output between the link/image and its description. Not used if no image or show_images is true 
  510. * @param bool $show_images Whether to show images (if defined). 
  511. * @param string $orderby the order to output the links. E.g. 'id', 'name', 'url',  
  512. * 'description', or 'rating'. Or maybe owner. If you start the name with an 
  513. * underscore the order will be reversed. You can also specify 'rand' as the 
  514. * order which will return links in a random order. 
  515. * @param bool $show_description Whether to show the description if show_images=false/not defined 
  516. * @param int $limit Limit to X entries. If not specified, all entries are shown. 
  517. * @param int $show_updated Whether to show last updated timestamp 
  518. */ 
  519. function get_linksbyname_withrating($cat_name = "noname", $before = '', $after = '<br />', $between = " ",  
  520. $show_images = true, $orderby = 'id', $show_description = true, $limit = -1, $show_updated = 0) { 
  521. _deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' ); 
  522.  
  523. get_linksbyname($cat_name, $before, $after, $between, $show_images, $orderby, $show_description, true, $limit, $show_updated); 
  524.  
  525. /** 
  526. * Gets the links associated with category n and display rating stars/chars. 
  527. * 
  528. * @since 0.71 
  529. * @deprecated 2.1.0 Use get_bookmarks() 
  530. * @see get_bookmarks() 
  531. * 
  532. * @param int $category The category to use. If no category supplied uses all 
  533. * @param string $before The html to output before the link 
  534. * @param string $after The html to output after the link 
  535. * @param string $between The html to output between the link/image and its description. Not used if no image or show_images == true 
  536. * @param bool $show_images Whether to show images (if defined). 
  537. * @param string $orderby The order to output the links. E.g. 'id', 'name', 'url',  
  538. * 'description', or 'rating'. Or maybe owner. If you start the name with an 
  539. * underscore the order will be reversed. You can also specify 'rand' as the 
  540. * order which will return links in a random order. 
  541. * @param bool $show_description Whether to show the description if show_images=false/not defined. 
  542. * @param int $limit Limit to X entries. If not specified, all entries are shown. 
  543. * @param int $show_updated Whether to show last updated timestamp 
  544. */ 
  545. function get_links_withrating($category = -1, $before = '', $after = '<br />', $between = " ", $show_images = true,  
  546. $orderby = 'id', $show_description = true, $limit = -1, $show_updated = 0) { 
  547. _deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' ); 
  548.  
  549. get_links($category, $before, $after, $between, $show_images, $orderby, $show_description, true, $limit, $show_updated); 
  550.  
  551. /** 
  552. * Gets the auto_toggle setting. 
  553. * 
  554. * @since 0.71 
  555. * @deprecated 2.1.0 
  556. * 
  557. * @param int $id The category to get. If no category supplied uses 0 
  558. * @return int Only returns 0. 
  559. */ 
  560. function get_autotoggle($id = 0) { 
  561. _deprecated_function( __FUNCTION__, '2.1.0' ); 
  562. return 0; 
  563.  
  564. /** 
  565. * Lists categories. 
  566. * 
  567. * @since 0.71 
  568. * @deprecated 2.1.0 Use wp_list_categories() 
  569. * @see wp_list_categories() 
  570. * 
  571. * @param int $optionall 
  572. * @param string $all 
  573. * @param string $sort_column 
  574. * @param string $sort_order 
  575. * @param string $file 
  576. * @param bool $list 
  577. * @param int $optiondates 
  578. * @param int $optioncount 
  579. * @param int $hide_empty 
  580. * @param int $use_desc_for_title 
  581. * @param bool $children 
  582. * @param int $child_of 
  583. * @param int $categories 
  584. * @param int $recurse 
  585. * @param string $feed 
  586. * @param string $feed_image 
  587. * @param string $exclude 
  588. * @param bool $hierarchical 
  589. * @return false|null 
  590. */ 
  591. function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_order = 'asc', $file = '', $list = true, $optiondates = 0,  
  592. $optioncount = 0, $hide_empty = 1, $use_desc_for_title = 1, $children=false, $child_of=0, $categories=0,  
  593. $recurse=0, $feed = '', $feed_image = '', $exclude = '', $hierarchical=false) { 
  594. _deprecated_function( __FUNCTION__, '2.1.0', 'wp_list_categories()' ); 
  595.  
  596. $query = compact('optionall', 'all', 'sort_column', 'sort_order', 'file', 'list', 'optiondates', 'optioncount', 'hide_empty', 'use_desc_for_title', 'children',  
  597. 'child_of', 'categories', 'recurse', 'feed', 'feed_image', 'exclude', 'hierarchical'); 
  598. return wp_list_cats($query); 
  599.  
  600. /** 
  601. * Lists categories. 
  602. * 
  603. * @since 1.2.0 
  604. * @deprecated 2.1.0 Use wp_list_categories() 
  605. * @see wp_list_categories() 
  606. * 
  607. * @param string|array $args 
  608. * @return false|null|string 
  609. */ 
  610. function wp_list_cats($args = '') { 
  611. _deprecated_function( __FUNCTION__, '2.1.0', 'wp_list_categories()' ); 
  612.  
  613. $r = wp_parse_args( $args ); 
  614.  
  615. // Map to new names. 
  616. if ( isset($r['optionall']) && isset($r['all'])) 
  617. $r['show_option_all'] = $r['all']; 
  618. if ( isset($r['sort_column']) ) 
  619. $r['orderby'] = $r['sort_column']; 
  620. if ( isset($r['sort_order']) ) 
  621. $r['order'] = $r['sort_order']; 
  622. if ( isset($r['optiondates']) ) 
  623. $r['show_last_update'] = $r['optiondates']; 
  624. if ( isset($r['optioncount']) ) 
  625. $r['show_count'] = $r['optioncount']; 
  626. if ( isset($r['list']) ) 
  627. $r['style'] = $r['list'] ? 'list' : 'break'; 
  628. $r['title_li'] = ''; 
  629.  
  630. return wp_list_categories($r); 
  631.  
  632. /** 
  633. * Deprecated method for generating a drop-down of categories. 
  634. * 
  635. * @since 0.71 
  636. * @deprecated 2.1.0 Use wp_dropdown_categories() 
  637. * @see wp_dropdown_categories() 
  638. * 
  639. * @param int $optionall 
  640. * @param string $all 
  641. * @param string $orderby 
  642. * @param string $order 
  643. * @param int $show_last_update 
  644. * @param int $show_count 
  645. * @param int $hide_empty 
  646. * @param bool $optionnone 
  647. * @param int $selected 
  648. * @param int $exclude 
  649. * @return string 
  650. */ 
  651. function dropdown_cats($optionall = 1, $all = 'All', $orderby = 'ID', $order = 'asc',  
  652. $show_last_update = 0, $show_count = 0, $hide_empty = 1, $optionnone = false,  
  653. $selected = 0, $exclude = 0) { 
  654. _deprecated_function( __FUNCTION__, '2.1.0', 'wp_dropdown_categories()' ); 
  655.  
  656. $show_option_all = ''; 
  657. if ( $optionall ) 
  658. $show_option_all = $all; 
  659.  
  660. $show_option_none = ''; 
  661. if ( $optionnone ) 
  662. $show_option_none = __('None'); 
  663.  
  664. $vars = compact('show_option_all', 'show_option_none', 'orderby', 'order',  
  665. 'show_last_update', 'show_count', 'hide_empty', 'selected', 'exclude'); 
  666. $query = add_query_arg($vars, ''); 
  667. return wp_dropdown_categories($query); 
  668.  
  669. /** 
  670. * Lists authors. 
  671. * 
  672. * @since 1.2.0 
  673. * @deprecated 2.1.0 Use wp_list_authors() 
  674. * @see wp_list_authors() 
  675. * 
  676. * @param bool $optioncount 
  677. * @param bool $exclude_admin 
  678. * @param bool $show_fullname 
  679. * @param bool $hide_empty 
  680. * @param string $feed 
  681. * @param string $feed_image 
  682. * @return null|string 
  683. */ 
  684. function list_authors($optioncount = false, $exclude_admin = true, $show_fullname = false, $hide_empty = true, $feed = '', $feed_image = '') { 
  685. _deprecated_function( __FUNCTION__, '2.1.0', 'wp_list_authors()' ); 
  686.  
  687. $args = compact('optioncount', 'exclude_admin', 'show_fullname', 'hide_empty', 'feed', 'feed_image'); 
  688. return wp_list_authors($args); 
  689.  
  690. /** 
  691. * Retrieves a list of post categories. 
  692. * 
  693. * @since 1.0.1 
  694. * @deprecated 2.1.0 Use wp_get_post_categories() 
  695. * @see wp_get_post_categories() 
  696. * 
  697. * @param int $blogid Not Used 
  698. * @param int $post_ID 
  699. * @return array 
  700. */ 
  701. function wp_get_post_cats($blogid = '1', $post_ID = 0) { 
  702. _deprecated_function( __FUNCTION__, '2.1.0', 'wp_get_post_categories()' ); 
  703. return wp_get_post_categories($post_ID); 
  704.  
  705. /** 
  706. * Sets the categories that the post id belongs to. 
  707. * 
  708. * @since 1.0.1 
  709. * @deprecated 2.1.0 
  710. * @deprecated Use wp_set_post_categories() 
  711. * @see wp_set_post_categories() 
  712. * 
  713. * @param int $blogid Not used 
  714. * @param int $post_ID 
  715. * @param array $post_categories 
  716. * @return bool|mixed 
  717. */ 
  718. function wp_set_post_cats($blogid = '1', $post_ID = 0, $post_categories = array()) { 
  719. _deprecated_function( __FUNCTION__, '2.1.0', 'wp_set_post_categories()' ); 
  720. return wp_set_post_categories($post_ID, $post_categories); 
  721.  
  722. /** 
  723. * Retrieves a list of archives. 
  724. * 
  725. * @since 0.71 
  726. * @deprecated 2.1.0 Use wp_get_archives() 
  727. * @see wp_get_archives() 
  728. * 
  729. * @param string $type 
  730. * @param string $limit 
  731. * @param string $format 
  732. * @param string $before 
  733. * @param string $after 
  734. * @param bool $show_post_count 
  735. * @return string|null 
  736. */ 
  737. function get_archives($type='', $limit='', $format='html', $before = '', $after = '', $show_post_count = false) { 
  738. _deprecated_function( __FUNCTION__, '2.1.0', 'wp_get_archives()' ); 
  739. $args = compact('type', 'limit', 'format', 'before', 'after', 'show_post_count'); 
  740. return wp_get_archives($args); 
  741.  
  742. /** 
  743. * Returns or Prints link to the author's posts. 
  744. * 
  745. * @since 1.2.0 
  746. * @deprecated 2.1.0 Use get_author_posts_url() 
  747. * @see get_author_posts_url() 
  748. * 
  749. * @param bool $echo 
  750. * @param int $author_id 
  751. * @param string $author_nicename Optional. 
  752. * @return string|null 
  753. */ 
  754. function get_author_link($echo, $author_id, $author_nicename = '') { 
  755. _deprecated_function( __FUNCTION__, '2.1.0', 'get_author_posts_url()' ); 
  756.  
  757. $link = get_author_posts_url($author_id, $author_nicename); 
  758.  
  759. if ( $echo ) 
  760. echo $link; 
  761. return $link; 
  762.  
  763. /** 
  764. * Print list of pages based on arguments. 
  765. * 
  766. * @since 0.71 
  767. * @deprecated 2.1.0 Use wp_link_pages() 
  768. * @see wp_link_pages() 
  769. * 
  770. * @param string $before 
  771. * @param string $after 
  772. * @param string $next_or_number 
  773. * @param string $nextpagelink 
  774. * @param string $previouspagelink 
  775. * @param string $pagelink 
  776. * @param string $more_file 
  777. * @return string 
  778. */ 
  779. function link_pages($before='<br />', $after='<br />', $next_or_number='number', $nextpagelink='next page', $previouspagelink='previous page',  
  780. $pagelink='%', $more_file='') { 
  781. _deprecated_function( __FUNCTION__, '2.1.0', 'wp_link_pages()' ); 
  782.  
  783. $args = compact('before', 'after', 'next_or_number', 'nextpagelink', 'previouspagelink', 'pagelink', 'more_file'); 
  784. return wp_link_pages($args); 
  785.  
  786. /** 
  787. * Get value based on option. 
  788. * 
  789. * @since 0.71 
  790. * @deprecated 2.1.0 Use get_option() 
  791. * @see get_option() 
  792. * 
  793. * @param string $option 
  794. * @return string 
  795. */ 
  796. function get_settings($option) { 
  797. _deprecated_function( __FUNCTION__, '2.1.0', 'get_option()' ); 
  798.  
  799. return get_option($option); 
  800.  
  801. /** 
  802. * Print the permalink of the current post in the loop. 
  803. * 
  804. * @since 0.71 
  805. * @deprecated 1.2.0 Use the_permalink() 
  806. * @see the_permalink() 
  807. */ 
  808. function permalink_link() { 
  809. _deprecated_function( __FUNCTION__, '1.2.0', 'the_permalink()' ); 
  810. the_permalink(); 
  811.  
  812. /** 
  813. * Print the permalink to the RSS feed. 
  814. * 
  815. * @since 0.71 
  816. * @deprecated 2.3.0 Use the_permalink_rss() 
  817. * @see the_permalink_rss() 
  818. * 
  819. * @param string $deprecated 
  820. */ 
  821. function permalink_single_rss($deprecated = '') { 
  822. _deprecated_function( __FUNCTION__, '2.3.0', 'the_permalink_rss()' ); 
  823. the_permalink_rss(); 
  824.  
  825. /** 
  826. * Gets the links associated with category. 
  827. * 
  828. * @since 1.0.1 
  829. * @deprecated 2.1.0 Use wp_list_bookmarks() 
  830. * @see wp_list_bookmarks() 
  831. * 
  832. * @param string $args a query string 
  833. * @return null|string 
  834. */ 
  835. function wp_get_links($args = '') { 
  836. _deprecated_function( __FUNCTION__, '2.1.0', 'wp_list_bookmarks()' ); 
  837.  
  838. if ( strpos( $args, '=' ) === false ) { 
  839. $cat_id = $args; 
  840. $args = add_query_arg( 'category', $cat_id, $args ); 
  841.  
  842. $defaults = array( 
  843. 'after' => '<br />',  
  844. 'before' => '',  
  845. 'between' => ' ',  
  846. 'categorize' => 0,  
  847. 'category' => '',  
  848. 'echo' => true,  
  849. 'limit' => -1,  
  850. 'orderby' => 'name',  
  851. 'show_description' => true,  
  852. 'show_images' => true,  
  853. 'show_rating' => false,  
  854. 'show_updated' => true,  
  855. 'title_li' => '',  
  856. ); 
  857.  
  858. $r = wp_parse_args( $args, $defaults ); 
  859.  
  860. return wp_list_bookmarks($r); 
  861.  
  862. /** 
  863. * Gets the links associated with category by id. 
  864. * 
  865. * @since 0.71 
  866. * @deprecated 2.1.0 Use get_bookmarks() 
  867. * @see get_bookmarks() 
  868. * 
  869. * @param int $category The category to use. If no category supplied uses all 
  870. * @param string $before the html to output before the link 
  871. * @param string $after the html to output after the link 
  872. * @param string $between the html to output between the link/image and its description. 
  873. * Not used if no image or show_images == true 
  874. * @param bool $show_images whether to show images (if defined). 
  875. * @param string $orderby the order to output the links. E.g. 'id', 'name', 'url',  
  876. * 'description', or 'rating'. Or maybe owner. If you start the name with an 
  877. * underscore the order will be reversed. You can also specify 'rand' as the order 
  878. * which will return links in a random order. 
  879. * @param bool $show_description whether to show the description if show_images=false/not defined. 
  880. * @param bool $show_rating show rating stars/chars 
  881. * @param int $limit Limit to X entries. If not specified, all entries are shown. 
  882. * @param int $show_updated whether to show last updated timestamp 
  883. * @param bool $echo whether to echo the results, or return them instead 
  884. * @return null|string 
  885. */ 
  886. function get_links($category = -1, $before = '', $after = '<br />', $between = ' ', $show_images = true, $orderby = 'name',  
  887. $show_description = true, $show_rating = false, $limit = -1, $show_updated = 1, $echo = true) { 
  888. _deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' ); 
  889.  
  890. $order = 'ASC'; 
  891. if ( substr($orderby, 0, 1) == '_' ) { 
  892. $order = 'DESC'; 
  893. $orderby = substr($orderby, 1); 
  894.  
  895. if ( $category == -1 ) //get_bookmarks uses '' to signify all categories 
  896. $category = ''; 
  897.  
  898. $results = get_bookmarks(array('category' => $category, 'orderby' => $orderby, 'order' => $order, 'show_updated' => $show_updated, 'limit' => $limit)); 
  899.  
  900. if ( !$results ) 
  901. return; 
  902.  
  903. $output = ''; 
  904.  
  905. foreach ( (array) $results as $row ) { 
  906. if ( !isset($row->recently_updated) ) 
  907. $row->recently_updated = false; 
  908. $output .= $before; 
  909. if ( $show_updated && $row->recently_updated ) 
  910. $output .= get_option('links_recently_updated_prepend'); 
  911. $the_link = '#'; 
  912. if ( !empty($row->link_url) ) 
  913. $the_link = esc_url($row->link_url); 
  914. $rel = $row->link_rel; 
  915. if ( '' != $rel ) 
  916. $rel = ' rel="' . $rel . '"'; 
  917.  
  918. $desc = esc_attr(sanitize_bookmark_field('link_description', $row->link_description, $row->link_id, 'display')); 
  919. $name = esc_attr(sanitize_bookmark_field('link_name', $row->link_name, $row->link_id, 'display')); 
  920. $title = $desc; 
  921.  
  922. if ( $show_updated ) 
  923. if (substr($row->link_updated_f, 0, 2) != '00') 
  924. $title .= ' ('.__('Last updated') . ' ' . date(get_option('links_updated_date_format'), $row->link_updated_f + (get_option('gmt_offset') * HOUR_IN_SECONDS)) . ')'; 
  925.  
  926. if ( '' != $title ) 
  927. $title = ' title="' . $title . '"'; 
  928.  
  929. $alt = ' alt="' . $name . '"'; 
  930.  
  931. $target = $row->link_target; 
  932. if ( '' != $target ) 
  933. $target = ' target="' . $target . '"'; 
  934.  
  935. $output .= '<a href="' . $the_link . '"' . $rel . $title . $target. '>'; 
  936.  
  937. if ( $row->link_image != null && $show_images ) { 
  938. if ( strpos($row->link_image, 'http') !== false ) 
  939. $output .= "<img src=\"$row->link_image\" $alt $title />"; 
  940. else // If it's a relative path 
  941. $output .= "<img src=\"" . get_option('siteurl') . "$row->link_image\" $alt $title />"; 
  942. } else { 
  943. $output .= $name; 
  944.  
  945. $output .= '</a>'; 
  946.  
  947. if ( $show_updated && $row->recently_updated ) 
  948. $output .= get_option('links_recently_updated_append'); 
  949.  
  950. if ( $show_description && '' != $desc ) 
  951. $output .= $between . $desc; 
  952.  
  953. if ($show_rating) { 
  954. $output .= $between . get_linkrating($row); 
  955.  
  956. $output .= "$after\n"; 
  957. } // end while 
  958.  
  959. if ( !$echo ) 
  960. return $output; 
  961. echo $output; 
  962.  
  963. /** 
  964. * Output entire list of links by category. 
  965. * 
  966. * Output a list of all links, listed by category, using the settings in 
  967. * $wpdb->linkcategories and output it as a nested HTML unordered list. 
  968. * 
  969. * @since 1.0.1 
  970. * @deprecated 2.1.0 Use wp_list_bookmarks() 
  971. * @see wp_list_bookmarks() 
  972. * 
  973. * @param string $order Sort link categories by 'name' or 'id' 
  974. */ 
  975. function get_links_list($order = 'name') { 
  976. _deprecated_function( __FUNCTION__, '2.1.0', 'wp_list_bookmarks()' ); 
  977.  
  978. $order = strtolower($order); 
  979.  
  980. // Handle link category sorting 
  981. $direction = 'ASC'; 
  982. if ( '_' == substr($order, 0, 1) ) { 
  983. $direction = 'DESC'; 
  984. $order = substr($order, 1); 
  985.  
  986. if ( !isset($direction) ) 
  987. $direction = ''; 
  988.  
  989. $cats = get_categories(array('type' => 'link', 'orderby' => $order, 'order' => $direction, 'hierarchical' => 0)); 
  990.  
  991. // Display each category 
  992. if ( $cats ) { 
  993. foreach ( (array) $cats as $cat ) { 
  994. // Handle each category. 
  995.  
  996. // Display the category name 
  997. echo ' <li id="linkcat-' . $cat->term_id . '" class="linkcat"><h2>' . apply_filters('link_category', $cat->name ) . "</h2>\n\t<ul>\n"; 
  998. // Call get_links() with all the appropriate params 
  999. get_links($cat->term_id, '<li>', "</li>", "\n", true, 'name', false); 
  1000.  
  1001. // Close the last category 
  1002. echo "\n\t</ul>\n</li>\n"; 
  1003.  
  1004. /** 
  1005. * Show the link to the links popup and the number of links. 
  1006. * 
  1007. * @since 0.71 
  1008. * @deprecated 2.1.0 
  1009. * 
  1010. * @param string $text the text of the link 
  1011. * @param int $width the width of the popup window 
  1012. * @param int $height the height of the popup window 
  1013. * @param string $file the page to open in the popup window 
  1014. * @param bool $count the number of links in the db 
  1015. */ 
  1016. function links_popup_script($text = 'Links', $width=400, $height=400, $file='links.all.php', $count = true) { 
  1017. _deprecated_function( __FUNCTION__, '2.1.0' ); 
  1018.  
  1019. /** 
  1020. * Legacy function that retrieved the value of a link's link_rating field. 
  1021. * 
  1022. * @since 1.0.1 
  1023. * @deprecated 2.1.0 Use sanitize_bookmark_field() 
  1024. * @see sanitize_bookmark_field() 
  1025. * 
  1026. * @param object $link Link object. 
  1027. * @return mixed Value of the 'link_rating' field, false otherwise. 
  1028. */ 
  1029. function get_linkrating( $link ) { 
  1030. _deprecated_function( __FUNCTION__, '2.1.0', 'sanitize_bookmark_field()' ); 
  1031. return sanitize_bookmark_field('link_rating', $link->link_rating, $link->link_id, 'display'); 
  1032.  
  1033. /** 
  1034. * Gets the name of category by id. 
  1035. * 
  1036. * @since 0.71 
  1037. * @deprecated 2.1.0 Use get_category() 
  1038. * @see get_category() 
  1039. * 
  1040. * @param int $id The category to get. If no category supplied uses 0 
  1041. * @return string 
  1042. */ 
  1043. function get_linkcatname($id = 0) { 
  1044. _deprecated_function( __FUNCTION__, '2.1.0', 'get_category()' ); 
  1045.  
  1046. $id = (int) $id; 
  1047.  
  1048. if ( empty($id) ) 
  1049. return ''; 
  1050.  
  1051. $cats = wp_get_link_cats($id); 
  1052.  
  1053. if ( empty($cats) || ! is_array($cats) ) 
  1054. return ''; 
  1055.  
  1056. $cat_id = (int) $cats[0]; // Take the first cat. 
  1057.  
  1058. $cat = get_category($cat_id); 
  1059. return $cat->name; 
  1060.  
  1061. /** 
  1062. * Print RSS comment feed link. 
  1063. * 
  1064. * @since 1.0.1 
  1065. * @deprecated 2.5.0 Use post_comments_feed_link() 
  1066. * @see post_comments_feed_link() 
  1067. * 
  1068. * @param string $link_text 
  1069. */ 
  1070. function comments_rss_link($link_text = 'Comments RSS') { 
  1071. _deprecated_function( __FUNCTION__, '2.5.0', 'post_comments_feed_link()' ); 
  1072. post_comments_feed_link($link_text); 
  1073.  
  1074. /** 
  1075. * Print/Return link to category RSS2 feed. 
  1076. * 
  1077. * @since 1.2.0 
  1078. * @deprecated 2.5.0 Use get_category_feed_link() 
  1079. * @see get_category_feed_link() 
  1080. * 
  1081. * @param bool $echo 
  1082. * @param int $cat_ID 
  1083. * @return string 
  1084. */ 
  1085. function get_category_rss_link($echo = false, $cat_ID = 1) { 
  1086. _deprecated_function( __FUNCTION__, '2.5.0', 'get_category_feed_link()' ); 
  1087.  
  1088. $link = get_category_feed_link($cat_ID, 'rss2'); 
  1089.  
  1090. if ( $echo ) 
  1091. echo $link; 
  1092. return $link; 
  1093.  
  1094. /** 
  1095. * Print/Return link to author RSS feed. 
  1096. * 
  1097. * @since 1.2.0 
  1098. * @deprecated 2.5.0 Use get_author_feed_link() 
  1099. * @see get_author_feed_link() 
  1100. * 
  1101. * @param bool $echo 
  1102. * @param int $author_id 
  1103. * @return string 
  1104. */ 
  1105. function get_author_rss_link($echo = false, $author_id = 1) { 
  1106. _deprecated_function( __FUNCTION__, '2.5.0', 'get_author_feed_link()' ); 
  1107.  
  1108. $link = get_author_feed_link($author_id); 
  1109. if ( $echo ) 
  1110. echo $link; 
  1111. return $link; 
  1112.  
  1113. /** 
  1114. * Return link to the post RSS feed. 
  1115. * 
  1116. * @since 1.5.0 
  1117. * @deprecated 2.2.0 Use get_post_comments_feed_link() 
  1118. * @see get_post_comments_feed_link() 
  1119. * 
  1120. * @return string 
  1121. */ 
  1122. function comments_rss() { 
  1123. _deprecated_function( __FUNCTION__, '2.2.0', 'get_post_comments_feed_link()' ); 
  1124. return esc_url( get_post_comments_feed_link() ); 
  1125.  
  1126. /** 
  1127. * An alias of wp_create_user(). 
  1128. * 
  1129. * @since 2.0.0 
  1130. * @deprecated 2.0.0 Use wp_create_user() 
  1131. * @see wp_create_user() 
  1132. * 
  1133. * @param string $username The user's username. 
  1134. * @param string $password The user's password. 
  1135. * @param string $email The user's email. 
  1136. * @return int The new user's ID. 
  1137. */ 
  1138. function create_user($username, $password, $email) { 
  1139. _deprecated_function( __FUNCTION__, '2.0.0', 'wp_create_user()' ); 
  1140. return wp_create_user($username, $password, $email); 
  1141.  
  1142. /** 
  1143. * Unused function. 
  1144. * 
  1145. * @deprecated 2.5.0 
  1146. */ 
  1147. function gzip_compression() { 
  1148. _deprecated_function( __FUNCTION__, '2.5.0' ); 
  1149. return false; 
  1150.  
  1151. /** 
  1152. * Retrieve an array of comment data about comment $comment_ID. 
  1153. * 
  1154. * @since 0.71 
  1155. * @deprecated 2.7.0 Use get_comment() 
  1156. * @see get_comment() 
  1157. * 
  1158. * @param int $comment_ID The ID of the comment 
  1159. * @param int $no_cache Whether to use the cache (cast to bool) 
  1160. * @param bool $include_unapproved Whether to include unapproved comments 
  1161. * @return array The comment data 
  1162. */ 
  1163. function get_commentdata( $comment_ID, $no_cache = 0, $include_unapproved = false ) { 
  1164. _deprecated_function( __FUNCTION__, '2.7.0', 'get_comment()' ); 
  1165. return get_comment($comment_ID, ARRAY_A); 
  1166.  
  1167. /** 
  1168. * Retrieve the category name by the category ID. 
  1169. * 
  1170. * @since 0.71 
  1171. * @deprecated 2.8.0 Use get_cat_name() 
  1172. * @see get_cat_name() 
  1173. * 
  1174. * @param int $cat_ID Category ID 
  1175. * @return string category name 
  1176. */ 
  1177. function get_catname( $cat_ID ) { 
  1178. _deprecated_function( __FUNCTION__, '2.8.0', 'get_cat_name()' ); 
  1179. return get_cat_name( $cat_ID ); 
  1180.  
  1181. /** 
  1182. * Retrieve category children list separated before and after the term IDs. 
  1183. * 
  1184. * @since 1.2.0 
  1185. * @deprecated 2.8.0 Use get_term_children() 
  1186. * @see get_term_children() 
  1187. * 
  1188. * @param int $id Category ID to retrieve children. 
  1189. * @param string $before Optional. Prepend before category term ID. 
  1190. * @param string $after Optional, default is empty string. Append after category term ID. 
  1191. * @param array $visited Optional. Category Term IDs that have already been added. 
  1192. * @return string 
  1193. */ 
  1194. function get_category_children( $id, $before = '/', $after = '', $visited = array() ) { 
  1195. _deprecated_function( __FUNCTION__, '2.8.0', 'get_term_children()' ); 
  1196. if ( 0 == $id ) 
  1197. return ''; 
  1198.  
  1199. $chain = ''; 
  1200. /** TODO: consult hierarchy */ 
  1201. $cat_ids = get_all_category_ids(); 
  1202. foreach ( (array) $cat_ids as $cat_id ) { 
  1203. if ( $cat_id == $id ) 
  1204. continue; 
  1205.  
  1206. $category = get_category( $cat_id ); 
  1207. if ( is_wp_error( $category ) ) 
  1208. return $category; 
  1209. if ( $category->parent == $id && !in_array( $category->term_id, $visited ) ) { 
  1210. $visited[] = $category->term_id; 
  1211. $chain .= $before.$category->term_id.$after; 
  1212. $chain .= get_category_children( $category->term_id, $before, $after ); 
  1213. return $chain; 
  1214.  
  1215. /** 
  1216. * Retrieves all category IDs. 
  1217. * 
  1218. * @since 2.0.0 
  1219. * @deprecated 4.0.0 Use get_terms() 
  1220. * @see get_terms() 
  1221. * 
  1222. * @link https://codex.wordpress.org/Function_Reference/get_all_category_ids 
  1223. * 
  1224. * @return object List of all of the category IDs. 
  1225. */ 
  1226. function get_all_category_ids() { 
  1227. _deprecated_function( __FUNCTION__, '4.0.0', 'get_terms()' ); 
  1228.  
  1229. if ( ! $cat_ids = wp_cache_get( 'all_category_ids', 'category' ) ) { 
  1230. $cat_ids = get_terms( 'category', array('fields' => 'ids', 'get' => 'all') ); 
  1231. wp_cache_add( 'all_category_ids', $cat_ids, 'category' ); 
  1232.  
  1233. return $cat_ids; 
  1234.  
  1235. /** 
  1236. * Retrieve the description of the author of the current post. 
  1237. * 
  1238. * @since 1.5.0 
  1239. * @deprecated 2.8.0 Use get_the_author_meta() 
  1240. * @see get_the_author_meta() 
  1241. * 
  1242. * @return string The author's description. 
  1243. */ 
  1244. function get_the_author_description() { 
  1245. _deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'description\')' ); 
  1246. return get_the_author_meta('description'); 
  1247.  
  1248. /** 
  1249. * Display the description of the author of the current post. 
  1250. * 
  1251. * @since 1.0.0 
  1252. * @deprecated 2.8.0 Use the_author_meta() 
  1253. * @see the_author_meta() 
  1254. */ 
  1255. function the_author_description() { 
  1256. _deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'description\')' ); 
  1257. the_author_meta('description'); 
  1258.  
  1259. /** 
  1260. * Retrieve the login name of the author of the current post. 
  1261. * 
  1262. * @since 1.5.0 
  1263. * @deprecated 2.8.0 Use get_the_author_meta() 
  1264. * @see get_the_author_meta() 
  1265. * 
  1266. * @return string The author's login name (username). 
  1267. */ 
  1268. function get_the_author_login() { 
  1269. _deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'login\')' ); 
  1270. return get_the_author_meta('login'); 
  1271.  
  1272. /** 
  1273. * Display the login name of the author of the current post. 
  1274. * 
  1275. * @since 0.71 
  1276. * @deprecated 2.8.0 Use the_author_meta() 
  1277. * @see the_author_meta() 
  1278. */ 
  1279. function the_author_login() { 
  1280. _deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'login\')' ); 
  1281. the_author_meta('login'); 
  1282.  
  1283. /** 
  1284. * Retrieve the first name of the author of the current post. 
  1285. * 
  1286. * @since 1.5.0 
  1287. * @deprecated 2.8.0 Use get_the_author_meta() 
  1288. * @see get_the_author_meta() 
  1289. * 
  1290. * @return string The author's first name. 
  1291. */ 
  1292. function get_the_author_firstname() { 
  1293. _deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'first_name\')' ); 
  1294. return get_the_author_meta('first_name'); 
  1295.  
  1296. /** 
  1297. * Display the first name of the author of the current post. 
  1298. * 
  1299. * @since 0.71 
  1300. * @deprecated 2.8.0 Use the_author_meta() 
  1301. * @see the_author_meta() 
  1302. */ 
  1303. function the_author_firstname() { 
  1304. _deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'first_name\')' ); 
  1305. the_author_meta('first_name'); 
  1306.  
  1307. /** 
  1308. * Retrieve the last name of the author of the current post. 
  1309. * 
  1310. * @since 1.5.0 
  1311. * @deprecated 2.8.0 Use get_the_author_meta() 
  1312. * @see get_the_author_meta() 
  1313. * 
  1314. * @return string The author's last name. 
  1315. */ 
  1316. function get_the_author_lastname() { 
  1317. _deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'last_name\')' ); 
  1318. return get_the_author_meta('last_name'); 
  1319.  
  1320. /** 
  1321. * Display the last name of the author of the current post. 
  1322. * 
  1323. * @since 0.71 
  1324. * @deprecated 2.8.0 Use the_author_meta() 
  1325. * @see the_author_meta() 
  1326. */ 
  1327. function the_author_lastname() { 
  1328. _deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'last_name\')' ); 
  1329. the_author_meta('last_name'); 
  1330.  
  1331. /** 
  1332. * Retrieve the nickname of the author of the current post. 
  1333. * 
  1334. * @since 1.5.0 
  1335. * @deprecated 2.8.0 Use get_the_author_meta() 
  1336. * @see get_the_author_meta() 
  1337. * 
  1338. * @return string The author's nickname. 
  1339. */ 
  1340. function get_the_author_nickname() { 
  1341. _deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'nickname\')' ); 
  1342. return get_the_author_meta('nickname'); 
  1343.  
  1344. /** 
  1345. * Display the nickname of the author of the current post. 
  1346. * 
  1347. * @since 0.71 
  1348. * @deprecated 2.8.0 Use the_author_meta() 
  1349. * @see the_author_meta() 
  1350. */ 
  1351. function the_author_nickname() { 
  1352. _deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'nickname\')' ); 
  1353. the_author_meta('nickname'); 
  1354.  
  1355. /** 
  1356. * Retrieve the email of the author of the current post. 
  1357. * 
  1358. * @since 1.5.0 
  1359. * @deprecated 2.8.0 Use get_the_author_meta() 
  1360. * @see get_the_author_meta() 
  1361. * 
  1362. * @return string The author's username. 
  1363. */ 
  1364. function get_the_author_email() { 
  1365. _deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'email\')' ); 
  1366. return get_the_author_meta('email'); 
  1367.  
  1368. /** 
  1369. * Display the email of the author of the current post. 
  1370. * 
  1371. * @since 0.71 
  1372. * @deprecated 2.8.0 Use the_author_meta() 
  1373. * @see the_author_meta() 
  1374. */ 
  1375. function the_author_email() { 
  1376. _deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'email\')' ); 
  1377. the_author_meta('email'); 
  1378.  
  1379. /** 
  1380. * Retrieve the ICQ number of the author of the current post. 
  1381. * 
  1382. * @since 1.5.0 
  1383. * @deprecated 2.8.0 Use get_the_author_meta() 
  1384. * @see get_the_author_meta() 
  1385. * 
  1386. * @return string The author's ICQ number. 
  1387. */ 
  1388. function get_the_author_icq() { 
  1389. _deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'icq\')' ); 
  1390. return get_the_author_meta('icq'); 
  1391.  
  1392. /** 
  1393. * Display the ICQ number of the author of the current post. 
  1394. * 
  1395. * @since 0.71 
  1396. * @deprecated 2.8.0 Use the_author_meta() 
  1397. * @see the_author_meta() 
  1398. */ 
  1399. function the_author_icq() { 
  1400. _deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'icq\')' ); 
  1401. the_author_meta('icq'); 
  1402.  
  1403. /** 
  1404. * Retrieve the Yahoo! IM name of the author of the current post. 
  1405. * 
  1406. * @since 1.5.0 
  1407. * @deprecated 2.8.0 Use get_the_author_meta() 
  1408. * @see get_the_author_meta() 
  1409. * 
  1410. * @return string The author's Yahoo! IM name. 
  1411. */ 
  1412. function get_the_author_yim() { 
  1413. _deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'yim\')' ); 
  1414. return get_the_author_meta('yim'); 
  1415.  
  1416. /** 
  1417. * Display the Yahoo! IM name of the author of the current post. 
  1418. * 
  1419. * @since 0.71 
  1420. * @deprecated 2.8.0 Use the_author_meta() 
  1421. * @see the_author_meta() 
  1422. */ 
  1423. function the_author_yim() { 
  1424. _deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'yim\')' ); 
  1425. the_author_meta('yim'); 
  1426.  
  1427. /** 
  1428. * Retrieve the MSN address of the author of the current post. 
  1429. * 
  1430. * @since 1.5.0 
  1431. * @deprecated 2.8.0 Use get_the_author_meta() 
  1432. * @see get_the_author_meta() 
  1433. * 
  1434. * @return string The author's MSN address. 
  1435. */ 
  1436. function get_the_author_msn() { 
  1437. _deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'msn\')' ); 
  1438. return get_the_author_meta('msn'); 
  1439.  
  1440. /** 
  1441. * Display the MSN address of the author of the current post. 
  1442. * 
  1443. * @since 0.71 
  1444. * @deprecated 2.8.0 Use the_author_meta() 
  1445. * @see the_author_meta() 
  1446. */ 
  1447. function the_author_msn() { 
  1448. _deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'msn\')' ); 
  1449. the_author_meta('msn'); 
  1450.  
  1451. /** 
  1452. * Retrieve the AIM address of the author of the current post. 
  1453. * 
  1454. * @since 1.5.0 
  1455. * @deprecated 2.8.0 Use get_the_author_meta() 
  1456. * @see get_the_author_meta() 
  1457. * 
  1458. * @return string The author's AIM address. 
  1459. */ 
  1460. function get_the_author_aim() { 
  1461. _deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'aim\')' ); 
  1462. return get_the_author_meta('aim'); 
  1463.  
  1464. /** 
  1465. * Display the AIM address of the author of the current post. 
  1466. * 
  1467. * @since 0.71 
  1468. * @deprecated 2.8.0 Use the_author_meta('aim') 
  1469. * @see the_author_meta() 
  1470. */ 
  1471. function the_author_aim() { 
  1472. _deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'aim\')' ); 
  1473. the_author_meta('aim'); 
  1474.  
  1475. /** 
  1476. * Retrieve the specified author's preferred display name. 
  1477. * 
  1478. * @since 1.0.0 
  1479. * @deprecated 2.8.0 Use get_the_author_meta() 
  1480. * @see get_the_author_meta() 
  1481. * 
  1482. * @param int $auth_id The ID of the author. 
  1483. * @return string The author's display name. 
  1484. */ 
  1485. function get_author_name( $auth_id = false ) { 
  1486. _deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'display_name\')' ); 
  1487. return get_the_author_meta('display_name', $auth_id); 
  1488.  
  1489. /** 
  1490. * Retrieve the URL to the home page of the author of the current post. 
  1491. * 
  1492. * @since 1.5.0 
  1493. * @deprecated 2.8.0 Use get_the_author_meta() 
  1494. * @see get_the_author_meta() 
  1495. * 
  1496. * @return string The URL to the author's page. 
  1497. */ 
  1498. function get_the_author_url() { 
  1499. _deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'url\')' ); 
  1500. return get_the_author_meta('url'); 
  1501.  
  1502. /** 
  1503. * Display the URL to the home page of the author of the current post. 
  1504. * 
  1505. * @since 0.71 
  1506. * @deprecated 2.8.0 Use the_author_meta() 
  1507. * @see the_author_meta() 
  1508. */ 
  1509. function the_author_url() { 
  1510. _deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'url\')' ); 
  1511. the_author_meta('url'); 
  1512.  
  1513. /** 
  1514. * Retrieve the ID of the author of the current post. 
  1515. * 
  1516. * @since 1.5.0 
  1517. * @deprecated 2.8.0 Use get_the_author_meta() 
  1518. * @see get_the_author_meta() 
  1519. * 
  1520. * @return string|int The author's ID. 
  1521. */ 
  1522. function get_the_author_ID() { 
  1523. _deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'ID\')' ); 
  1524. return get_the_author_meta('ID'); 
  1525.  
  1526. /** 
  1527. * Display the ID of the author of the current post. 
  1528. * 
  1529. * @since 0.71 
  1530. * @deprecated 2.8.0 Use the_author_meta() 
  1531. * @see the_author_meta() 
  1532. */ 
  1533. function the_author_ID() { 
  1534. _deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'ID\')' ); 
  1535. the_author_meta('ID'); 
  1536.  
  1537. /** 
  1538. * Display the post content for the feed. 
  1539. * 
  1540. * For encoding the html or the $encode_html parameter, there are three possible 
  1541. * values. '0' will make urls footnotes and use make_url_footnote(). '1' will 
  1542. * encode special characters and automatically display all of the content. The 
  1543. * value of '2' will strip all HTML tags from the content. 
  1544. * 
  1545. * Also note that you cannot set the amount of words and not set the html 
  1546. * encoding. If that is the case, then the html encoding will default to 2,  
  1547. * which will strip all HTML tags. 
  1548. * 
  1549. * To restrict the amount of words of the content, you can use the cut 
  1550. * parameter. If the content is less than the amount, then there won't be any 
  1551. * dots added to the end. If there is content left over, then dots will be added 
  1552. * and the rest of the content will be removed. 
  1553. * 
  1554. * @since 0.71 
  1555. * 
  1556. * @deprecated 2.9.0 Use the_content_feed() 
  1557. * @see the_content_feed() 
  1558. * 
  1559. * @param string $more_link_text Optional. Text to display when more content is available but not displayed. 
  1560. * @param int $stripteaser Optional. Default is 0. 
  1561. * @param string $more_file Optional. 
  1562. * @param int $cut Optional. Amount of words to keep for the content. 
  1563. * @param int $encode_html Optional. How to encode the content. 
  1564. */ 
  1565. function the_content_rss($more_link_text='(more...)', $stripteaser=0, $more_file='', $cut = 0, $encode_html = 0) { 
  1566. _deprecated_function( __FUNCTION__, '2.9.0', 'the_content_feed' ); 
  1567. $content = get_the_content($more_link_text, $stripteaser); 
  1568. $content = apply_filters('the_content_rss', $content); 
  1569. if ( $cut && !$encode_html ) 
  1570. $encode_html = 2; 
  1571. if ( 1== $encode_html ) { 
  1572. $content = esc_html($content); 
  1573. $cut = 0; 
  1574. } elseif ( 0 == $encode_html ) { 
  1575. $content = make_url_footnote($content); 
  1576. } elseif ( 2 == $encode_html ) { 
  1577. $content = strip_tags($content); 
  1578. if ( $cut ) { 
  1579. $blah = explode(' ', $content); 
  1580. if ( count($blah) > $cut ) { 
  1581. $k = $cut; 
  1582. $use_dotdotdot = 1; 
  1583. } else { 
  1584. $k = count($blah); 
  1585. $use_dotdotdot = 0; 
  1586.  
  1587. /** @todo Check performance, might be faster to use array slice instead. */ 
  1588. for ( $i=0; $i<$k; $i++ ) 
  1589. $excerpt .= $blah[$i].' '; 
  1590. $excerpt .= ($use_dotdotdot) ? '...' : ''; 
  1591. $content = $excerpt; 
  1592. $content = str_replace(']]>', ']]>', $content); 
  1593. echo $content; 
  1594.  
  1595. /** 
  1596. * Strip HTML and put links at the bottom of stripped content. 
  1597. * 
  1598. * Searches for all of the links, strips them out of the content, and places 
  1599. * them at the bottom of the content with numbers. 
  1600. * 
  1601. * @since 0.71 
  1602. * @deprecated 2.9.0 
  1603. * 
  1604. * @param string $content Content to get links 
  1605. * @return string HTML stripped out of content with links at the bottom. 
  1606. */ 
  1607. function make_url_footnote( $content ) { 
  1608. _deprecated_function( __FUNCTION__, '2.9.0', '' ); 
  1609. preg_match_all( '/<a(.+?)href=\"(.+?)\"(.*?)>(.+?)<\/a>/', $content, $matches ); 
  1610. $links_summary = "\n"; 
  1611. for ( $i = 0, $c = count( $matches[0] ); $i < $c; $i++ ) { 
  1612. $link_match = $matches[0][$i]; 
  1613. $link_number = '['.($i+1).']'; 
  1614. $link_url = $matches[2][$i]; 
  1615. $link_text = $matches[4][$i]; 
  1616. $content = str_replace( $link_match, $link_text . ' ' . $link_number, $content ); 
  1617. $link_url = ( ( strtolower( substr( $link_url, 0, 7 ) ) != 'http://' ) && ( strtolower( substr( $link_url, 0, 8 ) ) != 'https://' ) ) ? get_option( 'home' ) . $link_url : $link_url; 
  1618. $links_summary .= "\n" . $link_number . ' ' . $link_url; 
  1619. $content = strip_tags( $content ); 
  1620. $content .= $links_summary; 
  1621. return $content; 
  1622.  
  1623. /** 
  1624. * Retrieve translated string with vertical bar context 
  1625. * 
  1626. * Quite a few times, there will be collisions with similar translatable text 
  1627. * found in more than two places but with different translated context. 
  1628. * 
  1629. * In order to use the separate contexts, the _c() function is used and the 
  1630. * translatable string uses a pipe ('|') which has the context the string is in. 
  1631. * 
  1632. * When the translated string is returned, it is everything before the pipe, not 
  1633. * including the pipe character. If there is no pipe in the translated text then 
  1634. * everything is returned. 
  1635. * 
  1636. * @since 2.2.0 
  1637. * @deprecated 2.9.0 Use _x() 
  1638. * @see _x() 
  1639. * 
  1640. * @param string $text Text to translate 
  1641. * @param string $domain Optional. Domain to retrieve the translated text 
  1642. * @return string Translated context string without pipe 
  1643. */ 
  1644. function _c( $text, $domain = 'default' ) { 
  1645. _deprecated_function( __FUNCTION__, '2.9.0', '_x()' ); 
  1646. return before_last_bar( translate( $text, $domain ) ); 
  1647.  
  1648. /** 
  1649. * Translates $text like translate(), but assumes that the text 
  1650. * contains a context after its last vertical bar. 
  1651. * 
  1652. * @since 2.5.0 
  1653. * @deprecated 3.0.0 Use _x() 
  1654. * @see _x() 
  1655. * 
  1656. * @param string $text Text to translate 
  1657. * @param string $domain Domain to retrieve the translated text 
  1658. * @return string Translated text 
  1659. */ 
  1660. function translate_with_context( $text, $domain = 'default' ) { 
  1661. _deprecated_function( __FUNCTION__, '2.9.0', '_x()' ); 
  1662. return before_last_bar( translate( $text, $domain ) ); 
  1663.  
  1664. /** 
  1665. * Legacy version of _n(), which supports contexts. 
  1666. * 
  1667. * Strips everything from the translation after the last bar. 
  1668. * 
  1669. * @since 2.7.0 
  1670. * @deprecated 3.0.0 Use _nx() 
  1671. * @see _nx() 
  1672. * 
  1673. * @param string $single The text to be used if the number is singular. 
  1674. * @param string $plural The text to be used if the number is plural. 
  1675. * @param int $number The number to compare against to use either the singular or plural form. 
  1676. * @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings. 
  1677. * Default 'default'. 
  1678. * @return string The translated singular or plural form. 
  1679. */ 
  1680. function _nc( $single, $plural, $number, $domain = 'default' ) { 
  1681. _deprecated_function( __FUNCTION__, '2.9.0', '_nx()' ); 
  1682. return before_last_bar( _n( $single, $plural, $number, $domain ) ); 
  1683.  
  1684. /** 
  1685. * Retrieve the plural or single form based on the amount. 
  1686. * 
  1687. * @since 1.2.0 
  1688. * @deprecated 2.8.0 Use _n() 
  1689. * @see _n() 
  1690. */ 
  1691. function __ngettext() { 
  1692. _deprecated_function( __FUNCTION__, '2.8.0', '_n()' ); 
  1693. $args = func_get_args(); 
  1694. return call_user_func_array('_n', $args); 
  1695.  
  1696. /** 
  1697. * Register plural strings in POT file, but don't translate them. 
  1698. * 
  1699. * @since 2.5.0 
  1700. * @deprecated 2.8.0 Use _n_noop() 
  1701. * @see _n_noop() 
  1702. */ 
  1703. function __ngettext_noop() { 
  1704. _deprecated_function( __FUNCTION__, '2.8.0', '_n_noop()' ); 
  1705. $args = func_get_args(); 
  1706. return call_user_func_array('_n_noop', $args); 
  1707.  
  1708.  
  1709. /** 
  1710. * Retrieve all autoload options, or all options if no autoloaded ones exist. 
  1711. * 
  1712. * @since 1.0.0 
  1713. * @deprecated 3.0.0 Use wp_load_alloptions()) 
  1714. * @see wp_load_alloptions() 
  1715. * 
  1716. * @return array List of all options. 
  1717. */ 
  1718. function get_alloptions() { 
  1719. _deprecated_function( __FUNCTION__, '3.0.0', 'wp_load_alloptions()' ); 
  1720. return wp_load_alloptions(); 
  1721.  
  1722. /** 
  1723. * Retrieve HTML content of attachment image with link. 
  1724. * 
  1725. * @since 2.0.0 
  1726. * @deprecated 2.5.0 Use wp_get_attachment_link() 
  1727. * @see wp_get_attachment_link() 
  1728. * 
  1729. * @param int $id Optional. Post ID. 
  1730. * @param bool $fullsize Optional, default is false. Whether to use full size image. 
  1731. * @param array $max_dims Optional. Max image dimensions. 
  1732. * @param bool $permalink Optional, default is false. Whether to include permalink to image. 
  1733. * @return string 
  1734. */ 
  1735. function get_the_attachment_link($id = 0, $fullsize = false, $max_dims = false, $permalink = false) { 
  1736. _deprecated_function( __FUNCTION__, '2.5.0', 'wp_get_attachment_link()' ); 
  1737. $id = (int) $id; 
  1738. $_post = get_post($id); 
  1739.  
  1740. if ( ('attachment' != $_post->post_type) || !$url = wp_get_attachment_url($_post->ID) ) 
  1741. return __('Missing Attachment'); 
  1742.  
  1743. if ( $permalink ) 
  1744. $url = get_attachment_link($_post->ID); 
  1745.  
  1746. $post_title = esc_attr($_post->post_title); 
  1747.  
  1748. $innerHTML = get_attachment_innerHTML($_post->ID, $fullsize, $max_dims); 
  1749. return "<a href='$url' title='$post_title'>$innerHTML</a>"; 
  1750.  
  1751. /** 
  1752. * Retrieve icon URL and Path. 
  1753. * 
  1754. * @since 2.1.0 
  1755. * @deprecated 2.5.0 Use wp_get_attachment_image_src() 
  1756. * @see wp_get_attachment_image_src() 
  1757. * 
  1758. * @param int $id Optional. Post ID. 
  1759. * @param bool $fullsize Optional, default to false. Whether to have full image. 
  1760. * @return array Icon URL and full path to file, respectively. 
  1761. */ 
  1762. function get_attachment_icon_src( $id = 0, $fullsize = false ) { 
  1763. _deprecated_function( __FUNCTION__, '2.5.0', 'wp_get_attachment_image_src()' ); 
  1764. $id = (int) $id; 
  1765. if ( !$post = get_post($id) ) 
  1766. return false; 
  1767.  
  1768. $file = get_attached_file( $post->ID ); 
  1769.  
  1770. if ( !$fullsize && $src = wp_get_attachment_thumb_url( $post->ID ) ) { 
  1771. // We have a thumbnail desired, specified and existing 
  1772.  
  1773. $src_file = basename($src); 
  1774. } elseif ( wp_attachment_is_image( $post->ID ) ) { 
  1775. // We have an image without a thumbnail 
  1776.  
  1777. $src = wp_get_attachment_url( $post->ID ); 
  1778. $src_file = & $file; 
  1779. } elseif ( $src = wp_mime_type_icon( $post->ID ) ) { 
  1780. // No thumb, no image. We'll look for a mime-related icon instead. 
  1781.  
  1782. $icon_dir = apply_filters( 'icon_dir', get_template_directory() . '/images' ); 
  1783. $src_file = $icon_dir . '/' . basename($src); 
  1784.  
  1785. if ( !isset($src) || !$src ) 
  1786. return false; 
  1787.  
  1788. return array($src, $src_file); 
  1789.  
  1790. /** 
  1791. * Retrieve HTML content of icon attachment image element. 
  1792. * 
  1793. * @since 2.0.0 
  1794. * @deprecated 2.5.0 Use wp_get_attachment_image() 
  1795. * @see wp_get_attachment_image() 
  1796. * 
  1797. * @param int $id Optional. Post ID. 
  1798. * @param bool $fullsize Optional, default to false. Whether to have full size image. 
  1799. * @param array $max_dims Optional. Dimensions of image. 
  1800. * @return false|string HTML content. 
  1801. */ 
  1802. function get_attachment_icon( $id = 0, $fullsize = false, $max_dims = false ) { 
  1803. _deprecated_function( __FUNCTION__, '2.5.0', 'wp_get_attachment_image()' ); 
  1804. $id = (int) $id; 
  1805. if ( !$post = get_post($id) ) 
  1806. return false; 
  1807.  
  1808. if ( !$src = get_attachment_icon_src( $post->ID, $fullsize ) ) 
  1809. return false; 
  1810.  
  1811. list($src, $src_file) = $src; 
  1812.  
  1813. // Do we need to constrain the image? 
  1814. if ( ($max_dims = apply_filters('attachment_max_dims', $max_dims)) && file_exists($src_file) ) { 
  1815.  
  1816. $imagesize = getimagesize($src_file); 
  1817.  
  1818. if (($imagesize[0] > $max_dims[0]) || $imagesize[1] > $max_dims[1] ) { 
  1819. $actual_aspect = $imagesize[0] / $imagesize[1]; 
  1820. $desired_aspect = $max_dims[0] / $max_dims[1]; 
  1821.  
  1822. if ( $actual_aspect >= $desired_aspect ) { 
  1823. $height = $actual_aspect * $max_dims[0]; 
  1824. $constraint = "width='{$max_dims[0]}' "; 
  1825. $post->iconsize = array($max_dims[0], $height); 
  1826. } else { 
  1827. $width = $max_dims[1] / $actual_aspect; 
  1828. $constraint = "height='{$max_dims[1]}' "; 
  1829. $post->iconsize = array($width, $max_dims[1]); 
  1830. } else { 
  1831. $post->iconsize = array($imagesize[0], $imagesize[1]); 
  1832. $constraint = ''; 
  1833. } else { 
  1834. $constraint = ''; 
  1835.  
  1836. $post_title = esc_attr($post->post_title); 
  1837.  
  1838. $icon = "<img src='$src' title='$post_title' alt='$post_title' $constraint/>"; 
  1839.  
  1840. return apply_filters( 'attachment_icon', $icon, $post->ID ); 
  1841.  
  1842. /** 
  1843. * Retrieve HTML content of image element. 
  1844. * 
  1845. * @since 2.0.0 
  1846. * @deprecated 2.5.0 Use wp_get_attachment_image() 
  1847. * @see wp_get_attachment_image() 
  1848. * 
  1849. * @param int $id Optional. Post ID. 
  1850. * @param bool $fullsize Optional, default to false. Whether to have full size image. 
  1851. * @param array $max_dims Optional. Dimensions of image. 
  1852. * @return false|string 
  1853. */ 
  1854. function get_attachment_innerHTML($id = 0, $fullsize = false, $max_dims = false) { 
  1855. _deprecated_function( __FUNCTION__, '2.5.0', 'wp_get_attachment_image()' ); 
  1856. $id = (int) $id; 
  1857. if ( !$post = get_post($id) ) 
  1858. return false; 
  1859.  
  1860. if ( $innerHTML = get_attachment_icon($post->ID, $fullsize, $max_dims)) 
  1861. return $innerHTML; 
  1862.  
  1863. $innerHTML = esc_attr($post->post_title); 
  1864.  
  1865. return apply_filters('attachment_innerHTML', $innerHTML, $post->ID); 
  1866.  
  1867. /** 
  1868. * Retrieves bookmark data based on ID. 
  1869. * 
  1870. * @since 2.0.0 
  1871. * @deprecated 2.1.0 Use get_bookmark() 
  1872. * @see get_bookmark() 
  1873. * 
  1874. * @param int $bookmark_id ID of link 
  1875. * @param string $output Optional. Type of output. Accepts OBJECT, ARRAY_N, or ARRAY_A. 
  1876. * Default OBJECT. 
  1877. * @param string $filter Optional. How to filter the link for output. Accepts 'raw', 'edit',  
  1878. * 'attribute', 'js', 'db', or 'display'. Default 'raw'. 
  1879. * @return object|array Bookmark object or array, depending on the type specified by `$output`. 
  1880. */ 
  1881. function get_link( $bookmark_id, $output = OBJECT, $filter = 'raw' ) { 
  1882. _deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmark()' ); 
  1883. return get_bookmark($bookmark_id, $output, $filter); 
  1884.  
  1885. /** 
  1886. * Performs esc_url() for database or redirect usage. 
  1887. * 
  1888. * @since 2.3.1 
  1889. * @deprecated 2.8.0 Use esc_url_raw() 
  1890. * @see esc_url_raw() 
  1891. * 
  1892. * @param string $url The URL to be cleaned. 
  1893. * @param array $protocols An array of acceptable protocols. 
  1894. * @return string The cleaned URL. 
  1895. */ 
  1896. function sanitize_url( $url, $protocols = null ) { 
  1897. _deprecated_function( __FUNCTION__, '2.8.0', 'esc_url_raw()' ); 
  1898. return esc_url_raw( $url, $protocols ); 
  1899.  
  1900. /** 
  1901. * Checks and cleans a URL. 
  1902. * 
  1903. * A number of characters are removed from the URL. If the URL is for displaying 
  1904. * (the default behaviour) ampersands are also replaced. The 'clean_url' filter 
  1905. * is applied to the returned cleaned URL. 
  1906. * 
  1907. * @since 1.2.0 
  1908. * @deprecated 3.0.0 Use esc_url() 
  1909. * @see Alias for esc_url() 
  1910. * 
  1911. * @param string $url The URL to be cleaned. 
  1912. * @param array $protocols Optional. An array of acceptable protocols. 
  1913. * @param string $context Optional. How the URL will be used. Default is 'display'. 
  1914. * @return string The cleaned $url after the {@see 'clean_url'} filter is applied. 
  1915. */ 
  1916. function clean_url( $url, $protocols = null, $context = 'display' ) { 
  1917. if ( $context == 'db' ) 
  1918. _deprecated_function( 'clean_url( $context = \'db\' )', '3.0.0', 'esc_url_raw()' ); 
  1919. else 
  1920. _deprecated_function( __FUNCTION__, '3.0.0', 'esc_url()' ); 
  1921. return esc_url( $url, $protocols, $context ); 
  1922.  
  1923. /** 
  1924. * Escape single quotes, specialchar double quotes, and fix line endings. 
  1925. * 
  1926. * The filter {@see 'js_escape'} is also applied by esc_js(). 
  1927. * 
  1928. * @since 2.0.4 
  1929. * @deprecated 2.8.0 Use esc_js() 
  1930. * @see esc_js() 
  1931. * 
  1932. * @param string $text The text to be escaped. 
  1933. * @return string Escaped text. 
  1934. */ 
  1935. function js_escape( $text ) { 
  1936. _deprecated_function( __FUNCTION__, '2.8.0', 'esc_js()' ); 
  1937. return esc_js( $text ); 
  1938.  
  1939. /** 
  1940. * Legacy escaping for HTML blocks. 
  1941. * 
  1942. * @deprecated 2.8.0 Use esc_html() 
  1943. * @see esc_html() 
  1944. * 
  1945. * @param string $string String to escape. 
  1946. * @param string $quote_style Unused. 
  1947. * @param false|string $charset Unused. 
  1948. * @param false $double_encode Whether to double encode. Unused. 
  1949. * @return string Escaped `$string`. 
  1950. */ 
  1951. function wp_specialchars( $string, $quote_style = ENT_NOQUOTES, $charset = false, $double_encode = false ) { 
  1952. _deprecated_function( __FUNCTION__, '2.8.0', 'esc_html()' ); 
  1953. if ( func_num_args() > 1 ) { // Maintain back-compat for people passing additional arguments. 
  1954. $args = func_get_args(); 
  1955. return call_user_func_array( '_wp_specialchars', $args ); 
  1956. } else { 
  1957. return esc_html( $string ); 
  1958.  
  1959. /** 
  1960. * Escaping for HTML attributes. 
  1961. * 
  1962. * @since 2.0.6 
  1963. * @deprecated 2.8.0 Use esc_attr() 
  1964. * @see esc_attr() 
  1965. * 
  1966. * @param string $text 
  1967. * @return string 
  1968. */ 
  1969. function attribute_escape( $text ) { 
  1970. _deprecated_function( __FUNCTION__, '2.8.0', 'esc_attr()' ); 
  1971. return esc_attr( $text ); 
  1972.  
  1973. /** 
  1974. * Register widget for sidebar with backward compatibility. 
  1975. * 
  1976. * Allows $name to be an array that accepts either three elements to grab the 
  1977. * first element and the third for the name or just uses the first element of 
  1978. * the array for the name. 
  1979. * 
  1980. * Passes to wp_register_sidebar_widget() after argument list and backward 
  1981. * compatibility is complete. 
  1982. * 
  1983. * @since 2.2.0 
  1984. * @deprecated 2.8.0 Use wp_register_sidebar_widget() 
  1985. * @see wp_register_sidebar_widget() 
  1986. * 
  1987. * @param string|int $name Widget ID. 
  1988. * @param callable $output_callback Run when widget is called. 
  1989. * @param string $classname Optional. Classname widget option. Default empty. 
  1990. * @param mixed $params , ... Widget parameters. 
  1991. */ 
  1992. function register_sidebar_widget($name, $output_callback, $classname = '') { 
  1993. _deprecated_function( __FUNCTION__, '2.8.0', 'wp_register_sidebar_widget()' ); 
  1994. // Compat 
  1995. if ( is_array($name) ) { 
  1996. if ( count($name) == 3 ) 
  1997. $name = sprintf($name[0], $name[2]); 
  1998. else 
  1999. $name = $name[0]; 
  2000.  
  2001. $id = sanitize_title($name); 
  2002. $options = array(); 
  2003. if ( !empty($classname) && is_string($classname) ) 
  2004. $options['classname'] = $classname; 
  2005. $params = array_slice(func_get_args(), 2); 
  2006. $args = array($id, $name, $output_callback, $options); 
  2007. if ( !empty($params) ) 
  2008. $args = array_merge($args, $params); 
  2009.  
  2010. call_user_func_array('wp_register_sidebar_widget', $args); 
  2011.  
  2012. /** 
  2013. * Serves as an alias of wp_unregister_sidebar_widget(). 
  2014. * 
  2015. * @since 2.2.0 
  2016. * @deprecated 2.8.0 Use wp_unregister_sidebar_widget() 
  2017. * @see wp_unregister_sidebar_widget() 
  2018. * 
  2019. * @param int|string $id Widget ID. 
  2020. */ 
  2021. function unregister_sidebar_widget($id) { 
  2022. _deprecated_function( __FUNCTION__, '2.8.0', 'wp_unregister_sidebar_widget()' ); 
  2023. return wp_unregister_sidebar_widget($id); 
  2024.  
  2025. /** 
  2026. * Registers widget control callback for customizing options. 
  2027. * 
  2028. * Allows $name to be an array that accepts either three elements to grab the 
  2029. * first element and the third for the name or just uses the first element of 
  2030. * the array for the name. 
  2031. * 
  2032. * Passes to wp_register_widget_control() after the argument list has 
  2033. * been compiled. 
  2034. * 
  2035. * @since 2.2.0 
  2036. * @deprecated 2.8.0 Use wp_register_widget_control() 
  2037. * @see wp_register_widget_control() 
  2038. * 
  2039. * @param int|string $name Sidebar ID. 
  2040. * @param callable $control_callback Widget control callback to display and process form. 
  2041. * @param int $width Widget width. 
  2042. * @param int $height Widget height. 
  2043. */ 
  2044. function register_widget_control($name, $control_callback, $width = '', $height = '') { 
  2045. _deprecated_function( __FUNCTION__, '2.8.0', 'wp_register_widget_control()' ); 
  2046. // Compat 
  2047. if ( is_array($name) ) { 
  2048. if ( count($name) == 3 ) 
  2049. $name = sprintf($name[0], $name[2]); 
  2050. else 
  2051. $name = $name[0]; 
  2052.  
  2053. $id = sanitize_title($name); 
  2054. $options = array(); 
  2055. if ( !empty($width) ) 
  2056. $options['width'] = $width; 
  2057. if ( !empty($height) ) 
  2058. $options['height'] = $height; 
  2059. $params = array_slice(func_get_args(), 4); 
  2060. $args = array($id, $name, $control_callback, $options); 
  2061. if ( !empty($params) ) 
  2062. $args = array_merge($args, $params); 
  2063.  
  2064. call_user_func_array('wp_register_widget_control', $args); 
  2065.  
  2066. /** 
  2067. * Alias of wp_unregister_widget_control(). 
  2068. * 
  2069. * @since 2.2.0 
  2070. * @deprecated 2.8.0 Use wp_unregister_widget_control() 
  2071. * @see wp_unregister_widget_control() 
  2072. * 
  2073. * @param int|string $id Widget ID. 
  2074. */ 
  2075. function unregister_widget_control($id) { 
  2076. _deprecated_function( __FUNCTION__, '2.8.0', 'wp_unregister_widget_control()' ); 
  2077. return wp_unregister_widget_control($id); 
  2078.  
  2079. /** 
  2080. * Remove user meta data. 
  2081. * 
  2082. * @since 2.0.0 
  2083. * @deprecated 3.0.0 Use delete_user_meta() 
  2084. * @see delete_user_meta() 
  2085. * 
  2086. * @param int $user_id User ID. 
  2087. * @param string $meta_key Metadata key. 
  2088. * @param mixed $meta_value Metadata value. 
  2089. * @return bool True deletion completed and false if user_id is not a number. 
  2090. */ 
  2091. function delete_usermeta( $user_id, $meta_key, $meta_value = '' ) { 
  2092. _deprecated_function( __FUNCTION__, '3.0.0', 'delete_user_meta()' ); 
  2093. global $wpdb; 
  2094. if ( !is_numeric( $user_id ) ) 
  2095. return false; 
  2096. $meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key); 
  2097.  
  2098. if ( is_array($meta_value) || is_object($meta_value) ) 
  2099. $meta_value = serialize($meta_value); 
  2100. $meta_value = trim( $meta_value ); 
  2101.  
  2102. $cur = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) ); 
  2103.  
  2104. if ( $cur && $cur->umeta_id ) 
  2105. do_action( 'delete_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value ); 
  2106.  
  2107. if ( ! empty($meta_value) ) 
  2108. $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s AND meta_value = %s", $user_id, $meta_key, $meta_value) ); 
  2109. else 
  2110. $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) ); 
  2111.  
  2112. clean_user_cache( $user_id ); 
  2113. wp_cache_delete( $user_id, 'user_meta' ); 
  2114.  
  2115. if ( $cur && $cur->umeta_id ) 
  2116. do_action( 'deleted_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value ); 
  2117.  
  2118. return true; 
  2119.  
  2120. /** 
  2121. * Retrieve user metadata. 
  2122. * 
  2123. * If $user_id is not a number, then the function will fail over with a 'false' 
  2124. * boolean return value. Other returned values depend on whether there is only 
  2125. * one item to be returned, which be that single item type. If there is more 
  2126. * than one metadata value, then it will be list of metadata values. 
  2127. * 
  2128. * @since 2.0.0 
  2129. * @deprecated 3.0.0 Use get_user_meta() 
  2130. * @see get_user_meta() 
  2131. * 
  2132. * @param int $user_id User ID 
  2133. * @param string $meta_key Optional. Metadata key. 
  2134. * @return mixed 
  2135. */ 
  2136. function get_usermeta( $user_id, $meta_key = '' ) { 
  2137. _deprecated_function( __FUNCTION__, '3.0.0', 'get_user_meta()' ); 
  2138. global $wpdb; 
  2139. $user_id = (int) $user_id; 
  2140.  
  2141. if ( !$user_id ) 
  2142. return false; 
  2143.  
  2144. if ( !empty($meta_key) ) { 
  2145. $meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key); 
  2146. $user = wp_cache_get($user_id, 'users'); 
  2147. // Check the cached user object 
  2148. if ( false !== $user && isset($user->$meta_key) ) 
  2149. $metas = array($user->$meta_key); 
  2150. else 
  2151. $metas = $wpdb->get_col( $wpdb->prepare("SELECT meta_value FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) ); 
  2152. } else { 
  2153. $metas = $wpdb->get_col( $wpdb->prepare("SELECT meta_value FROM $wpdb->usermeta WHERE user_id = %d", $user_id) ); 
  2154.  
  2155. if ( empty($metas) ) { 
  2156. if ( empty($meta_key) ) 
  2157. return array(); 
  2158. else 
  2159. return ''; 
  2160.  
  2161. $metas = array_map('maybe_unserialize', $metas); 
  2162.  
  2163. if ( count($metas) == 1 ) 
  2164. return $metas[0]; 
  2165. else 
  2166. return $metas; 
  2167.  
  2168. /** 
  2169. * Update metadata of user. 
  2170. * 
  2171. * There is no need to serialize values, they will be serialized if it is 
  2172. * needed. The metadata key can only be a string with underscores. All else will 
  2173. * be removed. 
  2174. * 
  2175. * Will remove the metadata, if the meta value is empty. 
  2176. * 
  2177. * @since 2.0.0 
  2178. * @deprecated 3.0.0 Use update_user_meta() 
  2179. * @see update_user_meta() 
  2180. * 
  2181. * @param int $user_id User ID 
  2182. * @param string $meta_key Metadata key. 
  2183. * @param mixed $meta_value Metadata value. 
  2184. * @return bool True on successful update, false on failure. 
  2185. */ 
  2186. function update_usermeta( $user_id, $meta_key, $meta_value ) { 
  2187. _deprecated_function( __FUNCTION__, '3.0.0', 'update_user_meta()' ); 
  2188. global $wpdb; 
  2189. if ( !is_numeric( $user_id ) ) 
  2190. return false; 
  2191. $meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key); 
  2192.  
  2193. /** @todo Might need fix because usermeta data is assumed to be already escaped */ 
  2194. if ( is_string($meta_value) ) 
  2195. $meta_value = stripslashes($meta_value); 
  2196. $meta_value = maybe_serialize($meta_value); 
  2197.  
  2198. if (empty($meta_value)) { 
  2199. return delete_usermeta($user_id, $meta_key); 
  2200.  
  2201. $cur = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) ); 
  2202.  
  2203. if ( $cur ) 
  2204. do_action( 'update_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value ); 
  2205.  
  2206. if ( !$cur ) 
  2207. $wpdb->insert($wpdb->usermeta, compact('user_id', 'meta_key', 'meta_value') ); 
  2208. elseif ( $cur->meta_value != $meta_value ) 
  2209. $wpdb->update($wpdb->usermeta, compact('meta_value'), compact('user_id', 'meta_key') ); 
  2210. else 
  2211. return false; 
  2212.  
  2213. clean_user_cache( $user_id ); 
  2214. wp_cache_delete( $user_id, 'user_meta' ); 
  2215.  
  2216. if ( !$cur ) 
  2217. do_action( 'added_usermeta', $wpdb->insert_id, $user_id, $meta_key, $meta_value ); 
  2218. else 
  2219. do_action( 'updated_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value ); 
  2220.  
  2221. return true; 
  2222.  
  2223. /** 
  2224. * Get users for the site. 
  2225. * 
  2226. * For setups that use the multisite feature. Can be used outside of the 
  2227. * multisite feature. 
  2228. * 
  2229. * @since 2.2.0 
  2230. * @deprecated 3.1.0 Use get_users() 
  2231. * @see get_users() 
  2232. * 
  2233. * @global wpdb $wpdb WordPress database abstraction object. 
  2234. * @global int $blog_id The site ID of the site for those that use more than one site. 
  2235. * 
  2236. * @param int $id Site ID. 
  2237. * @return array List of users that are part of that site ID 
  2238. */ 
  2239. function get_users_of_blog( $id = '' ) { 
  2240. _deprecated_function( __FUNCTION__, '3.1.0', 'get_users()' ); 
  2241.  
  2242. global $wpdb, $blog_id; 
  2243. if ( empty($id) ) 
  2244. $id = (int) $blog_id; 
  2245. $blog_prefix = $wpdb->get_blog_prefix($id); 
  2246. $users = $wpdb->get_results( "SELECT user_id, user_id AS ID, user_login, display_name, user_email, meta_value FROM $wpdb->users, $wpdb->usermeta WHERE {$wpdb->users}.ID = {$wpdb->usermeta}.user_id AND meta_key = '{$blog_prefix}capabilities' ORDER BY {$wpdb->usermeta}.user_id" ); 
  2247. return $users; 
  2248.  
  2249. /** 
  2250. * Enable/disable automatic general feed link outputting. 
  2251. * 
  2252. * @since 2.8.0 
  2253. * @deprecated 3.0.0 Use add_theme_support() 
  2254. * @see add_theme_support() 
  2255. * 
  2256. * @param bool $add Optional, default is true. Add or remove links. Defaults to true. 
  2257. */ 
  2258. function automatic_feed_links( $add = true ) { 
  2259. _deprecated_function( __FUNCTION__, '3.0.0', "add_theme_support( 'automatic-feed-links' )" ); 
  2260.  
  2261. if ( $add ) 
  2262. add_theme_support( 'automatic-feed-links' ); 
  2263. else 
  2264. remove_action( 'wp_head', 'feed_links_extra', 3 ); // Just do this yourself in 3.0+ 
  2265.  
  2266. /** 
  2267. * Retrieve user data based on field. 
  2268. * 
  2269. * @since 1.5.0 
  2270. * @deprecated 3.0.0 Use get_the_author_meta() 
  2271. * @see get_the_author_meta() 
  2272. * 
  2273. * @param string $field User meta field. 
  2274. * @param false|int $user Optional. User ID to retrieve the field for. Default false (current user). 
  2275. * @return string The author's field from the current author's DB object. 
  2276. */ 
  2277. function get_profile( $field, $user = false ) { 
  2278. _deprecated_function( __FUNCTION__, '3.0.0', 'get_the_author_meta()' ); 
  2279. if ( $user ) { 
  2280. $user = get_user_by( 'login', $user ); 
  2281. $user = $user->ID; 
  2282. return get_the_author_meta( $field, $user ); 
  2283.  
  2284. /** 
  2285. * Retrieves the number of posts a user has written. 
  2286. * 
  2287. * @since 0.71 
  2288. * @deprecated 3.0.0 Use count_user_posts() 
  2289. * @see count_user_posts() 
  2290. * 
  2291. * @param int $userid User to count posts for. 
  2292. * @return int Number of posts the given user has written. 
  2293. */ 
  2294. function get_usernumposts( $userid ) { 
  2295. _deprecated_function( __FUNCTION__, '3.0.0', 'count_user_posts()' ); 
  2296. return count_user_posts( $userid ); 
  2297.  
  2298. /** 
  2299. * Callback used to change %uXXXX to &#YYY; syntax 
  2300. * 
  2301. * @since 2.8.0 
  2302. * @access private 
  2303. * @deprecated 3.0.0 
  2304. * 
  2305. * @param array $matches Single Match 
  2306. * @return string An HTML entity 
  2307. */ 
  2308. function funky_javascript_callback($matches) { 
  2309. return "&#".base_convert($matches[1], 16, 10).";"; 
  2310.  
  2311. /** 
  2312. * Fixes JavaScript bugs in browsers. 
  2313. * 
  2314. * Converts unicode characters to HTML numbered entities. 
  2315. * 
  2316. * @since 1.5.0 
  2317. * @deprecated 3.0.0 
  2318. * 
  2319. * @global $is_macIE 
  2320. * @global $is_winIE 
  2321. * 
  2322. * @param string $text Text to be made safe. 
  2323. * @return string Fixed text. 
  2324. */ 
  2325. function funky_javascript_fix($text) { 
  2326. _deprecated_function( __FUNCTION__, '3.0.0' ); 
  2327. // Fixes for browsers' JavaScript bugs. 
  2328. global $is_macIE, $is_winIE; 
  2329.  
  2330. if ( $is_winIE || $is_macIE ) 
  2331. $text = preg_replace_callback("/\%u([0-9A-F]{4, 4})/",  
  2332. "funky_javascript_callback",  
  2333. $text); 
  2334.  
  2335. return $text; 
  2336.  
  2337. /** 
  2338. * Checks that the taxonomy name exists. 
  2339. * 
  2340. * @since 2.3.0 
  2341. * @deprecated 3.0.0 Use taxonomy_exists() 
  2342. * @see taxonomy_exists() 
  2343. * 
  2344. * @param string $taxonomy Name of taxonomy object 
  2345. * @return bool Whether the taxonomy exists. 
  2346. */ 
  2347. function is_taxonomy( $taxonomy ) { 
  2348. _deprecated_function( __FUNCTION__, '3.0.0', 'taxonomy_exists()' ); 
  2349. return taxonomy_exists( $taxonomy ); 
  2350.  
  2351. /** 
  2352. * Check if Term exists. 
  2353. * 
  2354. * @since 2.3.0 
  2355. * @deprecated 3.0.0 Use term_exists() 
  2356. * @see term_exists() 
  2357. * 
  2358. * @param int|string $term The term to check 
  2359. * @param string $taxonomy The taxonomy name to use 
  2360. * @param int $parent ID of parent term under which to confine the exists search. 
  2361. * @return mixed Get the term id or Term Object, if exists. 
  2362. */ 
  2363. function is_term( $term, $taxonomy = '', $parent = 0 ) { 
  2364. _deprecated_function( __FUNCTION__, '3.0.0', 'term_exists()' ); 
  2365. return term_exists( $term, $taxonomy, $parent ); 
  2366.  
  2367. /** 
  2368. * Is the current admin page generated by a plugin? 
  2369. * 
  2370. * Use global $plugin_page and/or get_plugin_page_hookname() hooks. 
  2371. * 
  2372. * @since 1.5.0 
  2373. * @deprecated 3.1.0 
  2374. * 
  2375. * @global $plugin_page 
  2376. * 
  2377. * @return bool 
  2378. */ 
  2379. function is_plugin_page() { 
  2380. _deprecated_function( __FUNCTION__, '3.1.0' ); 
  2381.  
  2382. global $plugin_page; 
  2383.  
  2384. if ( isset($plugin_page) ) 
  2385. return true; 
  2386.  
  2387. return false; 
  2388.  
  2389. /** 
  2390. * Update the categories cache. 
  2391. * 
  2392. * This function does not appear to be used anymore or does not appear to be 
  2393. * needed. It might be a legacy function left over from when there was a need 
  2394. * for updating the category cache. 
  2395. * 
  2396. * @since 1.5.0 
  2397. * @deprecated 3.1.0 
  2398. * 
  2399. * @return bool Always return True 
  2400. */ 
  2401. function update_category_cache() { 
  2402. _deprecated_function( __FUNCTION__, '3.1.0' ); 
  2403.  
  2404. return true; 
  2405.  
  2406. /** 
  2407. * Check for PHP timezone support 
  2408. * 
  2409. * @since 2.9.0 
  2410. * @deprecated 3.2.0 
  2411. * 
  2412. * @return bool 
  2413. */ 
  2414. function wp_timezone_supported() { 
  2415. _deprecated_function( __FUNCTION__, '3.2.0' ); 
  2416.  
  2417. return true; 
  2418.  
  2419. /** 
  2420. * Displays an editor: TinyMCE, HTML, or both. 
  2421. * 
  2422. * @since 2.1.0 
  2423. * @deprecated 3.3.0 Use wp_editor() 
  2424. * @see wp_editor() 
  2425. * 
  2426. * @param string $content Textarea content. 
  2427. * @param string $id Optional. HTML ID attribute value. Default 'content'. 
  2428. * @param string $prev_id Optional. Unused. 
  2429. * @param bool $media_buttons Optional. Whether to display media buttons. Default true. 
  2430. * @param int $tab_index Optional. Unused. 
  2431. * @param bool $extended Optional. Unused. 
  2432. */ 
  2433. function the_editor($content, $id = 'content', $prev_id = 'title', $media_buttons = true, $tab_index = 2, $extended = true) { 
  2434. _deprecated_function( __FUNCTION__, '3.3.0', 'wp_editor()' ); 
  2435.  
  2436. wp_editor( $content, $id, array( 'media_buttons' => $media_buttons ) ); 
  2437.  
  2438. /** 
  2439. * Perform the query to get the $metavalues array(s) needed by _fill_user and _fill_many_users 
  2440. * 
  2441. * @since 3.0.0 
  2442. * @deprecated 3.3.0 
  2443. * 
  2444. * @param array $ids User ID numbers list. 
  2445. * @return array of arrays. The array is indexed by user_id, containing $metavalues object arrays. 
  2446. */ 
  2447. function get_user_metavalues($ids) { 
  2448. _deprecated_function( __FUNCTION__, '3.3.0' ); 
  2449.  
  2450. $objects = array(); 
  2451.  
  2452. $ids = array_map('intval', $ids); 
  2453. foreach ( $ids as $id ) 
  2454. $objects[$id] = array(); 
  2455.  
  2456. $metas = update_meta_cache('user', $ids); 
  2457.  
  2458. foreach ( $metas as $id => $meta ) { 
  2459. foreach ( $meta as $key => $metavalues ) { 
  2460. foreach ( $metavalues as $value ) { 
  2461. $objects[$id][] = (object)array( 'user_id' => $id, 'meta_key' => $key, 'meta_value' => $value); 
  2462.  
  2463. return $objects; 
  2464.  
  2465. /** 
  2466. * Sanitize every user field. 
  2467. * 
  2468. * If the context is 'raw', then the user object or array will get minimal santization of the int fields. 
  2469. * 
  2470. * @since 2.3.0 
  2471. * @deprecated 3.3.0 
  2472. * 
  2473. * @param object|array $user The User Object or Array 
  2474. * @param string $context Optional, default is 'display'. How to sanitize user fields. 
  2475. * @return object|array The now sanitized User Object or Array (will be the same type as $user) 
  2476. */ 
  2477. function sanitize_user_object($user, $context = 'display') { 
  2478. _deprecated_function( __FUNCTION__, '3.3.0' ); 
  2479.  
  2480. if ( is_object($user) ) { 
  2481. if ( !isset($user->ID) ) 
  2482. $user->ID = 0; 
  2483. if ( ! ( $user instanceof WP_User ) ) { 
  2484. $vars = get_object_vars($user); 
  2485. foreach ( array_keys($vars) as $field ) { 
  2486. if ( is_string($user->$field) || is_numeric($user->$field) ) 
  2487. $user->$field = sanitize_user_field($field, $user->$field, $user->ID, $context); 
  2488. $user->filter = $context; 
  2489. } else { 
  2490. if ( !isset($user['ID']) ) 
  2491. $user['ID'] = 0; 
  2492. foreach ( array_keys($user) as $field ) 
  2493. $user[$field] = sanitize_user_field($field, $user[$field], $user['ID'], $context); 
  2494. $user['filter'] = $context; 
  2495.  
  2496. return $user; 
  2497.  
  2498. /** 
  2499. * Get boundary post relational link. 
  2500. * 
  2501. * Can either be start or end post relational link. 
  2502. * 
  2503. * @since 2.8.0 
  2504. * @deprecated 3.3.0 
  2505. * 
  2506. * @param string $title Optional. Link title format. 
  2507. * @param bool $in_same_cat Optional. Whether link should be in a same category. 
  2508. * @param string $excluded_categories Optional. Excluded categories IDs. 
  2509. * @param bool $start Optional, default is true. Whether to display link to first or last post. 
  2510. * @return string 
  2511. */ 
  2512. function get_boundary_post_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '', $start = true) { 
  2513. _deprecated_function( __FUNCTION__, '3.3.0' ); 
  2514.  
  2515. $posts = get_boundary_post($in_same_cat, $excluded_categories, $start); 
  2516. // If there is no post stop. 
  2517. if ( empty($posts) ) 
  2518. return; 
  2519.  
  2520. // Even though we limited get_posts to return only 1 item it still returns an array of objects. 
  2521. $post = $posts[0]; 
  2522.  
  2523. if ( empty($post->post_title) ) 
  2524. $post->post_title = $start ? __('First Post') : __('Last Post'); 
  2525.  
  2526. $date = mysql2date(get_option('date_format'), $post->post_date); 
  2527.  
  2528. $title = str_replace('%title', $post->post_title, $title); 
  2529. $title = str_replace('%date', $date, $title); 
  2530. $title = apply_filters('the_title', $title, $post->ID); 
  2531.  
  2532. $link = $start ? "<link rel='start' title='" : "<link rel='end' title='"; 
  2533. $link .= esc_attr($title); 
  2534. $link .= "' href='" . get_permalink($post) . "' />\n"; 
  2535.  
  2536. $boundary = $start ? 'start' : 'end'; 
  2537. return apply_filters( "{$boundary}_post_rel_link", $link ); 
  2538.  
  2539. /** 
  2540. * Display relational link for the first post. 
  2541. * 
  2542. * @since 2.8.0 
  2543. * @deprecated 3.3.0 
  2544. * 
  2545. * @param string $title Optional. Link title format. 
  2546. * @param bool $in_same_cat Optional. Whether link should be in a same category. 
  2547. * @param string $excluded_categories Optional. Excluded categories IDs. 
  2548. */ 
  2549. function start_post_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '') { 
  2550. _deprecated_function( __FUNCTION__, '3.3.0' ); 
  2551.  
  2552. echo get_boundary_post_rel_link($title, $in_same_cat, $excluded_categories, true); 
  2553.  
  2554. /** 
  2555. * Get site index relational link. 
  2556. * 
  2557. * @since 2.8.0 
  2558. * @deprecated 3.3.0 
  2559. * 
  2560. * @return string 
  2561. */ 
  2562. function get_index_rel_link() { 
  2563. _deprecated_function( __FUNCTION__, '3.3.0' ); 
  2564.  
  2565. $link = "<link rel='index' title='" . esc_attr( get_bloginfo( 'name', 'display' ) ) . "' href='" . esc_url( user_trailingslashit( get_bloginfo( 'url', 'display' ) ) ) . "' />\n"; 
  2566. return apply_filters( "index_rel_link", $link ); 
  2567.  
  2568. /** 
  2569. * Display relational link for the site index. 
  2570. * 
  2571. * @since 2.8.0 
  2572. * @deprecated 3.3.0 
  2573. */ 
  2574. function index_rel_link() { 
  2575. _deprecated_function( __FUNCTION__, '3.3.0' ); 
  2576.  
  2577. echo get_index_rel_link(); 
  2578.  
  2579. /** 
  2580. * Get parent post relational link. 
  2581. * 
  2582. * @since 2.8.0 
  2583. * @deprecated 3.3.0 
  2584. * 
  2585. * @param string $title Optional. Link title format. Default '%title'. 
  2586. * @return string 
  2587. */ 
  2588. function get_parent_post_rel_link( $title = '%title' ) { 
  2589. _deprecated_function( __FUNCTION__, '3.3.0' ); 
  2590.  
  2591. if ( ! empty( $GLOBALS['post'] ) && ! empty( $GLOBALS['post']->post_parent ) ) 
  2592. $post = get_post($GLOBALS['post']->post_parent); 
  2593.  
  2594. if ( empty($post) ) 
  2595. return; 
  2596.  
  2597. $date = mysql2date(get_option('date_format'), $post->post_date); 
  2598.  
  2599. $title = str_replace('%title', $post->post_title, $title); 
  2600. $title = str_replace('%date', $date, $title); 
  2601. $title = apply_filters('the_title', $title, $post->ID); 
  2602.  
  2603. $link = "<link rel='up' title='"; 
  2604. $link .= esc_attr( $title ); 
  2605. $link .= "' href='" . get_permalink($post) . "' />\n"; 
  2606.  
  2607. return apply_filters( "parent_post_rel_link", $link ); 
  2608.  
  2609. /** 
  2610. * Display relational link for parent item 
  2611. * 
  2612. * @since 2.8.0 
  2613. * @deprecated 3.3.0 
  2614. * 
  2615. * @param string $title Optional. Link title format. Default '%title'. 
  2616. */ 
  2617. function parent_post_rel_link( $title = '%title' ) { 
  2618. _deprecated_function( __FUNCTION__, '3.3.0' ); 
  2619.  
  2620. echo get_parent_post_rel_link($title); 
  2621.  
  2622. /** 
  2623. * Add the "Dashboard"/"Visit Site" menu. 
  2624. * 
  2625. * @since 3.2.0 
  2626. * @deprecated 3.3.0 
  2627. * 
  2628. * @param WP_Admin_Bar $wp_admin_bar WP_Admin_Bar instance. 
  2629. */ 
  2630. function wp_admin_bar_dashboard_view_site_menu( $wp_admin_bar ) { 
  2631. _deprecated_function( __FUNCTION__, '3.3.0' ); 
  2632.  
  2633. $user_id = get_current_user_id(); 
  2634.  
  2635. if ( 0 != $user_id ) { 
  2636. if ( is_admin() ) 
  2637. $wp_admin_bar->add_menu( array( 'id' => 'view-site', 'title' => __( 'Visit Site' ), 'href' => home_url() ) ); 
  2638. elseif ( is_multisite() ) 
  2639. $wp_admin_bar->add_menu( array( 'id' => 'dashboard', 'title' => __( 'Dashboard' ), 'href' => get_dashboard_url( $user_id ) ) ); 
  2640. else 
  2641. $wp_admin_bar->add_menu( array( 'id' => 'dashboard', 'title' => __( 'Dashboard' ), 'href' => admin_url() ) ); 
  2642.  
  2643. /** 
  2644. * Checks if the current user belong to a given site. 
  2645. * 
  2646. * @since MU 
  2647. * @deprecated 3.3.0 Use is_user_member_of_blog() 
  2648. * @see is_user_member_of_blog() 
  2649. * 
  2650. * @param int $blog_id Site ID 
  2651. * @return bool True if the current users belong to $blog_id, false if not. 
  2652. */ 
  2653. function is_blog_user( $blog_id = 0 ) { 
  2654. _deprecated_function( __FUNCTION__, '3.3.0', 'is_user_member_of_blog()' ); 
  2655.  
  2656. return is_user_member_of_blog( get_current_user_id(), $blog_id ); 
  2657.  
  2658. /** 
  2659. * Open the file handle for debugging. 
  2660. * 
  2661. * @since 0.71 
  2662. * @deprecated 3.4.0 Use error_log() 
  2663. * @see error_log() 
  2664. * 
  2665. * @link https://secure.php.net/manual/en/function.error-log.php 
  2666. * 
  2667. * @param string $filename File name. 
  2668. * @param string $mode Type of access you required to the stream. 
  2669. * @return false Always false. 
  2670. */ 
  2671. function debug_fopen( $filename, $mode ) { 
  2672. _deprecated_function( __FUNCTION__, 'error_log()' ); 
  2673. return false; 
  2674.  
  2675. /** 
  2676. * Write contents to the file used for debugging. 
  2677. * 
  2678. * @since 0.71 
  2679. * @deprecated 3.4.0 Use error_log() 
  2680. * @see error_log() 
  2681. * 
  2682. * @link https://secure.php.net/manual/en/function.error-log.php 
  2683. * 
  2684. * @param mixed $fp Unused. 
  2685. * @param string $string Message to log. 
  2686. */ 
  2687. function debug_fwrite( $fp, $string ) { 
  2688. _deprecated_function( __FUNCTION__, 'error_log()' ); 
  2689. if ( ! empty( $GLOBALS['debug'] ) ) 
  2690. error_log( $string ); 
  2691.  
  2692. /** 
  2693. * Close the debugging file handle. 
  2694. * 
  2695. * @since 0.71 
  2696. * @deprecated 3.4.0 Use error_log() 
  2697. * @see error_log() 
  2698. * 
  2699. * @link https://secure.php.net/manual/en/function.error-log.php 
  2700. * 
  2701. * @param mixed $fp Unused. 
  2702. */ 
  2703. function debug_fclose( $fp ) { 
  2704. _deprecated_function( __FUNCTION__, 'error_log()' ); 
  2705.  
  2706. /** 
  2707. * Retrieve list of themes with theme data in theme directory. 
  2708. * 
  2709. * The theme is broken, if it doesn't have a parent theme and is missing either 
  2710. * style.css and, or index.php. If the theme has a parent theme then it is 
  2711. * broken, if it is missing style.css; index.php is optional. 
  2712. * 
  2713. * @since 1.5.0 
  2714. * @deprecated 3.4.0 Use wp_get_themes() 
  2715. * @see wp_get_themes() 
  2716. * 
  2717. * @return array Theme list with theme data. 
  2718. */ 
  2719. function get_themes() { 
  2720. _deprecated_function( __FUNCTION__, '3.4.0', 'wp_get_themes()' ); 
  2721.  
  2722. global $wp_themes; 
  2723. if ( isset( $wp_themes ) ) 
  2724. return $wp_themes; 
  2725.  
  2726. $themes = wp_get_themes(); 
  2727. $wp_themes = array(); 
  2728.  
  2729. foreach ( $themes as $theme ) { 
  2730. $name = $theme->get('Name'); 
  2731. if ( isset( $wp_themes[ $name ] ) ) 
  2732. $wp_themes[ $name . '/' . $theme->get_stylesheet() ] = $theme; 
  2733. else 
  2734. $wp_themes[ $name ] = $theme; 
  2735.  
  2736. return $wp_themes; 
  2737.  
  2738. /** 
  2739. * Retrieve theme data. 
  2740. * 
  2741. * @since 1.5.0 
  2742. * @deprecated 3.4.0 Use wp_get_theme() 
  2743. * @see wp_get_theme() 
  2744. * 
  2745. * @param string $theme Theme name. 
  2746. * @return array|null Null, if theme name does not exist. Theme data, if exists. 
  2747. */ 
  2748. function get_theme( $theme ) { 
  2749. _deprecated_function( __FUNCTION__, '3.4.0', 'wp_get_theme( $stylesheet )' ); 
  2750.  
  2751. $themes = get_themes(); 
  2752. if ( is_array( $themes ) && array_key_exists( $theme, $themes ) ) 
  2753. return $themes[ $theme ]; 
  2754. return null; 
  2755.  
  2756. /** 
  2757. * Retrieve current theme name. 
  2758. * 
  2759. * @since 1.5.0 
  2760. * @deprecated 3.4.0 Use wp_get_theme() 
  2761. * @see wp_get_theme() 
  2762. * 
  2763. * @return string 
  2764. */ 
  2765. function get_current_theme() { 
  2766. _deprecated_function( __FUNCTION__, '3.4.0', 'wp_get_theme()' ); 
  2767.  
  2768. if ( $theme = get_option( 'current_theme' ) ) 
  2769. return $theme; 
  2770.  
  2771. return wp_get_theme()->get('Name'); 
  2772.  
  2773. /** 
  2774. * Accepts matches array from preg_replace_callback in wpautop() or a string. 
  2775. * 
  2776. * Ensures that the contents of a `<pre>...</pre>` HTML block are not 
  2777. * converted into paragraphs or line-breaks. 
  2778. * 
  2779. * @since 1.2.0 
  2780. * @deprecated 3.4.0 
  2781. * 
  2782. * @param array|string $matches The array or string 
  2783. * @return string The pre block without paragraph/line-break conversion. 
  2784. */ 
  2785. function clean_pre($matches) { 
  2786. _deprecated_function( __FUNCTION__, '3.4.0' ); 
  2787.  
  2788. if ( is_array($matches) ) 
  2789. $text = $matches[1] . $matches[2] . "</pre>"; 
  2790. else 
  2791. $text = $matches; 
  2792.  
  2793. $text = str_replace(array('<br />', '<br/>', '<br>'), array('', '', ''), $text); 
  2794. $text = str_replace('<p>', "\n", $text); 
  2795. $text = str_replace('</p>', '', $text); 
  2796.  
  2797. return $text; 
  2798.  
  2799.  
  2800. /** 
  2801. * Add callbacks for image header display. 
  2802. * 
  2803. * @since 2.1.0 
  2804. * @deprecated 3.4.0 Use add_theme_support() 
  2805. * @see add_theme_support() 
  2806. * 
  2807. * @param callable $wp_head_callback Call on the {@see 'wp_head'} action. 
  2808. * @param callable $admin_head_callback Call on custom header administration screen. 
  2809. * @param callable $admin_preview_callback Output a custom header image div on the custom header administration screen. Optional. 
  2810. */ 
  2811. function add_custom_image_header( $wp_head_callback, $admin_head_callback, $admin_preview_callback = '' ) { 
  2812. _deprecated_function( __FUNCTION__, '3.4.0', 'add_theme_support( \'custom-header\', $args )' ); 
  2813. $args = array( 
  2814. 'wp-head-callback' => $wp_head_callback,  
  2815. 'admin-head-callback' => $admin_head_callback,  
  2816. ); 
  2817. if ( $admin_preview_callback ) 
  2818. $args['admin-preview-callback'] = $admin_preview_callback; 
  2819. return add_theme_support( 'custom-header', $args ); 
  2820.  
  2821. /** 
  2822. * Remove image header support. 
  2823. * 
  2824. * @since 3.1.0 
  2825. * @deprecated 3.4.0 Use remove_theme_support() 
  2826. * @see remove_theme_support() 
  2827. * 
  2828. * @return null|bool Whether support was removed. 
  2829. */ 
  2830. function remove_custom_image_header() { 
  2831. _deprecated_function( __FUNCTION__, '3.4.0', 'remove_theme_support( \'custom-header\' )' ); 
  2832. return remove_theme_support( 'custom-header' ); 
  2833.  
  2834. /** 
  2835. * Add callbacks for background image display. 
  2836. * 
  2837. * @since 3.0.0 
  2838. * @deprecated 3.4.0 Use add_theme_support() 
  2839. * @see add_theme_support() 
  2840. * 
  2841. * @param callable $wp_head_callback Call on the {@see 'wp_head'} action. 
  2842. * @param callable $admin_head_callback Call on custom background administration screen. 
  2843. * @param callable $admin_preview_callback Output a custom background image div on the custom background administration screen. Optional. 
  2844. */ 
  2845. function add_custom_background( $wp_head_callback = '', $admin_head_callback = '', $admin_preview_callback = '' ) { 
  2846. _deprecated_function( __FUNCTION__, '3.4.0', 'add_theme_support( \'custom-background\', $args )' ); 
  2847. $args = array(); 
  2848. if ( $wp_head_callback ) 
  2849. $args['wp-head-callback'] = $wp_head_callback; 
  2850. if ( $admin_head_callback ) 
  2851. $args['admin-head-callback'] = $admin_head_callback; 
  2852. if ( $admin_preview_callback ) 
  2853. $args['admin-preview-callback'] = $admin_preview_callback; 
  2854. return add_theme_support( 'custom-background', $args ); 
  2855.  
  2856. /** 
  2857. * Remove custom background support. 
  2858. * 
  2859. * @since 3.1.0 
  2860. * @deprecated 3.4.0 Use add_custom_background() 
  2861. * @see add_custom_background() 
  2862. * 
  2863. * @return null|bool Whether support was removed. 
  2864. */ 
  2865. function remove_custom_background() { 
  2866. _deprecated_function( __FUNCTION__, '3.4.0', 'remove_theme_support( \'custom-background\' )' ); 
  2867. return remove_theme_support( 'custom-background' ); 
  2868.  
  2869. /** 
  2870. * Retrieve theme data from parsed theme file. 
  2871. * 
  2872. * @since 1.5.0 
  2873. * @deprecated 3.4.0 Use wp_get_theme() 
  2874. * @see wp_get_theme() 
  2875. * 
  2876. * @param string $theme_file Theme file path. 
  2877. * @return array Theme data. 
  2878. */ 
  2879. function get_theme_data( $theme_file ) { 
  2880. _deprecated_function( __FUNCTION__, '3.4.0', 'wp_get_theme()' ); 
  2881. $theme = new WP_Theme( basename( dirname( $theme_file ) ), dirname( dirname( $theme_file ) ) ); 
  2882.  
  2883. $theme_data = array( 
  2884. 'Name' => $theme->get('Name'),  
  2885. 'URI' => $theme->display('ThemeURI', true, false),  
  2886. 'Description' => $theme->display('Description', true, false),  
  2887. 'Author' => $theme->display('Author', true, false),  
  2888. 'AuthorURI' => $theme->display('AuthorURI', true, false),  
  2889. 'Version' => $theme->get('Version'),  
  2890. 'Template' => $theme->get('Template'),  
  2891. 'Status' => $theme->get('Status'),  
  2892. 'Tags' => $theme->get('Tags'),  
  2893. 'Title' => $theme->get('Name'),  
  2894. 'AuthorName' => $theme->get('Author'),  
  2895. ); 
  2896.  
  2897. foreach ( apply_filters( 'extra_theme_headers', array() ) as $extra_header ) { 
  2898. if ( ! isset( $theme_data[ $extra_header ] ) ) 
  2899. $theme_data[ $extra_header ] = $theme->get( $extra_header ); 
  2900.  
  2901. return $theme_data; 
  2902.  
  2903. /** 
  2904. * Alias of update_post_cache(). 
  2905. * 
  2906. * @see update_post_cache() Posts and pages are the same, alias is intentional 
  2907. * 
  2908. * @since 1.5.1 
  2909. * @deprecated 3.4.0 Use update_post_cache() 
  2910. * @see update_post_cache() 
  2911. * 
  2912. * @param array $pages list of page objects 
  2913. */ 
  2914. function update_page_cache( &$pages ) { 
  2915. _deprecated_function( __FUNCTION__, '3.4.0', 'update_post_cache()' ); 
  2916.  
  2917. update_post_cache( $pages ); 
  2918.  
  2919. /** 
  2920. * Will clean the page in the cache. 
  2921. * 
  2922. * Clean (read: delete) page from cache that matches $id. Will also clean cache 
  2923. * associated with 'all_page_ids' and 'get_pages'. 
  2924. * 
  2925. * @since 2.0.0 
  2926. * @deprecated 3.4.0 Use clean_post_cache 
  2927. * @see clean_post_cache() 
  2928. * 
  2929. * @param int $id Page ID to clean 
  2930. */ 
  2931. function clean_page_cache( $id ) { 
  2932. _deprecated_function( __FUNCTION__, '3.4.0', 'clean_post_cache()' ); 
  2933.  
  2934. clean_post_cache( $id ); 
  2935.  
  2936. /** 
  2937. * Retrieve nonce action "Are you sure" message. 
  2938. * 
  2939. * Deprecated in 3.4.1 and 3.5.0. Backported to 3.3.3. 
  2940. * 
  2941. * @since 2.0.4 
  2942. * @deprecated 3.4.1 Use wp_nonce_ays() 
  2943. * @see wp_nonce_ays() 
  2944. * 
  2945. * @param string $action Nonce action. 
  2946. * @return string Are you sure message. 
  2947. */ 
  2948. function wp_explain_nonce( $action ) { 
  2949. _deprecated_function( __FUNCTION__, '3.4.1', 'wp_nonce_ays()' ); 
  2950. return __( 'Are you sure you want to do this?' ); 
  2951.  
  2952. /** 
  2953. * Display "sticky" CSS class, if a post is sticky. 
  2954. * 
  2955. * @since 2.7.0 
  2956. * @deprecated 3.5.0 Use post_class() 
  2957. * @see post_class() 
  2958. * 
  2959. * @param int $post_id An optional post ID. 
  2960. */ 
  2961. function sticky_class( $post_id = null ) { 
  2962. _deprecated_function( __FUNCTION__, '3.5.0', 'post_class()' ); 
  2963. if ( is_sticky( $post_id ) ) 
  2964. echo ' sticky'; 
  2965.  
  2966. /** 
  2967. * Retrieve post ancestors. 
  2968. * 
  2969. * This is no longer needed as WP_Post lazy-loads the ancestors 
  2970. * property with get_post_ancestors(). 
  2971. * 
  2972. * @since 2.3.4 
  2973. * @deprecated 3.5.0 Use get_post_ancestors() 
  2974. * @see get_post_ancestors() 
  2975. * 
  2976. * @param WP_Post &$post Post object, passed by reference (unused). 
  2977. */ 
  2978. function _get_post_ancestors( &$post ) { 
  2979. _deprecated_function( __FUNCTION__, '3.5.0' ); 
  2980.  
  2981. /** 
  2982. * Load an image from a string, if PHP supports it. 
  2983. * 
  2984. * @since 2.1.0 
  2985. * @deprecated 3.5.0 Use wp_get_image_editor() 
  2986. * @see wp_get_image_editor() 
  2987. * 
  2988. * @param string $file Filename of the image to load. 
  2989. * @return resource The resulting image resource on success, Error string on failure. 
  2990. */ 
  2991. function wp_load_image( $file ) { 
  2992. _deprecated_function( __FUNCTION__, '3.5.0', 'wp_get_image_editor()' ); 
  2993.  
  2994. if ( is_numeric( $file ) ) 
  2995. $file = get_attached_file( $file ); 
  2996.  
  2997. if ( ! is_file( $file ) ) 
  2998. return sprintf(__('File “%s” doesn’t exist?'), $file); 
  2999.  
  3000. if ( ! function_exists('imagecreatefromstring') ) 
  3001. return __('The GD image library is not installed.'); 
  3002.  
  3003. // Set artificially high because GD uses uncompressed images in memory. 
  3004. wp_raise_memory_limit( 'image' ); 
  3005.  
  3006. $image = imagecreatefromstring( file_get_contents( $file ) ); 
  3007.  
  3008. if ( !is_resource( $image ) ) 
  3009. return sprintf(__('File “%s” is not an image.'), $file); 
  3010.  
  3011. return $image; 
  3012.  
  3013. /** 
  3014. * Scale down an image to fit a particular size and save a new copy of the image. 
  3015. * 
  3016. * The PNG transparency will be preserved using the function, as well as the 
  3017. * image type. If the file going in is PNG, then the resized image is going to 
  3018. * be PNG. The only supported image types are PNG, GIF, and JPEG. 
  3019. * 
  3020. * Some functionality requires API to exist, so some PHP version may lose out 
  3021. * support. This is not the fault of WordPress (where functionality is 
  3022. * downgraded, not actual defects), but of your PHP version. 
  3023. * 
  3024. * @since 2.5.0 
  3025. * @deprecated 3.5.0 Use wp_get_image_editor() 
  3026. * @see wp_get_image_editor() 
  3027. * 
  3028. * @param string $file Image file path. 
  3029. * @param int $max_w Maximum width to resize to. 
  3030. * @param int $max_h Maximum height to resize to. 
  3031. * @param bool $crop Optional. Whether to crop image or resize. 
  3032. * @param string $suffix Optional. File suffix. 
  3033. * @param string $dest_path Optional. New image file path. 
  3034. * @param int $jpeg_quality Optional, default is 90. Image quality percentage. 
  3035. * @return mixed WP_Error on failure. String with new destination path. 
  3036. */ 
  3037. function image_resize( $file, $max_w, $max_h, $crop = false, $suffix = null, $dest_path = null, $jpeg_quality = 90 ) { 
  3038. _deprecated_function( __FUNCTION__, '3.5.0', 'wp_get_image_editor()' ); 
  3039.  
  3040. $editor = wp_get_image_editor( $file ); 
  3041. if ( is_wp_error( $editor ) ) 
  3042. return $editor; 
  3043. $editor->set_quality( $jpeg_quality ); 
  3044.  
  3045. $resized = $editor->resize( $max_w, $max_h, $crop ); 
  3046. if ( is_wp_error( $resized ) ) 
  3047. return $resized; 
  3048.  
  3049. $dest_file = $editor->generate_filename( $suffix, $dest_path ); 
  3050. $saved = $editor->save( $dest_file ); 
  3051.  
  3052. if ( is_wp_error( $saved ) ) 
  3053. return $saved; 
  3054.  
  3055. return $dest_file; 
  3056.  
  3057. /** 
  3058. * Retrieve a single post, based on post ID. 
  3059. * 
  3060. * Has categories in 'post_category' property or key. Has tags in 'tags_input' 
  3061. * property or key. 
  3062. * 
  3063. * @since 1.0.0 
  3064. * @deprecated 3.5.0 Use get_post() 
  3065. * @see get_post() 
  3066. * 
  3067. * @param int $postid Post ID. 
  3068. * @param string $mode How to return result, either OBJECT, ARRAY_N, or ARRAY_A. 
  3069. * @return WP_Post|null Post object or array holding post contents and information 
  3070. */ 
  3071. function wp_get_single_post( $postid = 0, $mode = OBJECT ) { 
  3072. _deprecated_function( __FUNCTION__, '3.5.0', 'get_post()' ); 
  3073. return get_post( $postid, $mode ); 
  3074.  
  3075. /** 
  3076. * Check that the user login name and password is correct. 
  3077. * 
  3078. * @since 0.71 
  3079. * @deprecated 3.5.0 Use wp_authenticate() 
  3080. * @see wp_authenticate() 
  3081. * 
  3082. * @param string $user_login User name. 
  3083. * @param string $user_pass User password. 
  3084. * @return bool False if does not authenticate, true if username and password authenticates. 
  3085. */ 
  3086. function user_pass_ok($user_login, $user_pass) { 
  3087. _deprecated_function( __FUNCTION__, '3.5.0', 'wp_authenticate()' ); 
  3088. $user = wp_authenticate( $user_login, $user_pass ); 
  3089. if ( is_wp_error( $user ) ) 
  3090. return false; 
  3091.  
  3092. return true; 
  3093.  
  3094. /** 
  3095. * Callback formerly fired on the save_post hook. No longer needed. 
  3096. * 
  3097. * @since 2.3.0 
  3098. * @deprecated 3.5.0 
  3099. */ 
  3100. function _save_post_hook() {} 
  3101.  
  3102. /** 
  3103. * Check if the installed version of GD supports particular image type 
  3104. * 
  3105. * @since 2.9.0 
  3106. * @deprecated 3.5.0 Use wp_image_editor_supports() 
  3107. * @see wp_image_editor_supports() 
  3108. * 
  3109. * @param string $mime_type 
  3110. * @return bool 
  3111. */ 
  3112. function gd_edit_image_support($mime_type) { 
  3113. _deprecated_function( __FUNCTION__, '3.5.0', 'wp_image_editor_supports()' ); 
  3114.  
  3115. if ( function_exists('imagetypes') ) { 
  3116. switch( $mime_type ) { 
  3117. case 'image/jpeg': 
  3118. return (imagetypes() & IMG_JPG) != 0; 
  3119. case 'image/png': 
  3120. return (imagetypes() & IMG_PNG) != 0; 
  3121. case 'image/gif': 
  3122. return (imagetypes() & IMG_GIF) != 0; 
  3123. } else { 
  3124. switch( $mime_type ) { 
  3125. case 'image/jpeg': 
  3126. return function_exists('imagecreatefromjpeg'); 
  3127. case 'image/png': 
  3128. return function_exists('imagecreatefrompng'); 
  3129. case 'image/gif': 
  3130. return function_exists('imagecreatefromgif'); 
  3131. return false; 
  3132.  
  3133. /** 
  3134. * Converts an integer byte value to a shorthand byte value. 
  3135. * 
  3136. * @since 2.3.0 
  3137. * @deprecated 3.6.0 Use size_format() 
  3138. * @see size_format() 
  3139. * 
  3140. * @param int $bytes An integer byte value. 
  3141. * @return string A shorthand byte value. 
  3142. */ 
  3143. function wp_convert_bytes_to_hr( $bytes ) { 
  3144. _deprecated_function( __FUNCTION__, '3.6.0', 'size_format()' ); 
  3145.  
  3146. $units = array( 0 => 'B', 1 => 'KB', 2 => 'MB', 3 => 'GB', 4 => 'TB' ); 
  3147. $log = log( $bytes, KB_IN_BYTES ); 
  3148. $power = (int) $log; 
  3149. $size = pow( KB_IN_BYTES, $log - $power ); 
  3150.  
  3151. if ( ! is_nan( $size ) && array_key_exists( $power, $units ) ) { 
  3152. $unit = $units[ $power ]; 
  3153. } else { 
  3154. $size = $bytes; 
  3155. $unit = $units[0]; 
  3156.  
  3157. return $size . $unit; 
  3158.  
  3159. /** 
  3160. * Formerly used internally to tidy up the search terms. 
  3161. * 
  3162. * @since 2.9.0 
  3163. * @access private 
  3164. * @deprecated 3.7.0 
  3165. * 
  3166. * @param string $t Search terms to "tidy", e.g. trim. 
  3167. * @return string Trimmed search terms. 
  3168. */ 
  3169. function _search_terms_tidy( $t ) { 
  3170. _deprecated_function( __FUNCTION__, '3.7.0' ); 
  3171. return trim( $t, "\"'\n\r " ); 
  3172.  
  3173. /** 
  3174. * Determine if TinyMCE is available. 
  3175. * 
  3176. * Checks to see if the user has deleted the tinymce files to slim down 
  3177. * their WordPress install. 
  3178. * 
  3179. * @since 2.1.0 
  3180. * @deprecated 3.9.0 
  3181. * 
  3182. * @return bool Whether TinyMCE exists. 
  3183. */ 
  3184. function rich_edit_exists() { 
  3185. global $wp_rich_edit_exists; 
  3186. _deprecated_function( __FUNCTION__, '3.9.0' ); 
  3187.  
  3188. if ( ! isset( $wp_rich_edit_exists ) ) 
  3189. $wp_rich_edit_exists = file_exists( ABSPATH . WPINC . '/js/tinymce/tinymce.js' ); 
  3190.  
  3191. return $wp_rich_edit_exists; 
  3192.  
  3193. /** 
  3194. * Old callback for tag link tooltips. 
  3195. * 
  3196. * @since 2.7.0 
  3197. * @access private 
  3198. * @deprecated 3.9.0 
  3199. * 
  3200. * @param int $count Number of topics. 
  3201. * @return int Number of topics. 
  3202. */ 
  3203. function default_topic_count_text( $count ) { 
  3204. return $count; 
  3205.  
  3206. /** 
  3207. * Formerly used to escape strings before inserting into the DB. 
  3208. * 
  3209. * Has not performed this function for many, many years. Use wpdb::prepare() instead. 
  3210. * 
  3211. * @since 0.71 
  3212. * @deprecated 3.9.0 
  3213. * 
  3214. * @param string $content The text to format. 
  3215. * @return string The very same text. 
  3216. */ 
  3217. function format_to_post( $content ) { 
  3218. _deprecated_function( __FUNCTION__, '3.9.0' ); 
  3219. return $content; 
  3220.  
  3221. /** 
  3222. * Formerly used to escape strings before searching the DB. It was poorly documented and never worked as described. 
  3223. * 
  3224. * @since 2.5.0 
  3225. * @deprecated 4.0.0 Use wpdb::esc_like() 
  3226. * @see wpdb::esc_like() 
  3227. * 
  3228. * @param string $text The text to be escaped. 
  3229. * @return string text, safe for inclusion in LIKE query. 
  3230. */ 
  3231. function like_escape($text) { 
  3232. _deprecated_function( __FUNCTION__, '4.0.0', 'wpdb::esc_like()' ); 
  3233. return str_replace( array( "%", "_" ), array( "\\%", "\\_" ), $text ); 
  3234.  
  3235. /** 
  3236. * Determines if the URL can be accessed over SSL. 
  3237. * 
  3238. * Determines if the URL can be accessed over SSL by using the WordPress HTTP API to access 
  3239. * the URL using https as the scheme. 
  3240. * 
  3241. * @since 2.5.0 
  3242. * @deprecated 4.0.0 
  3243. * 
  3244. * @param string $url The URL to test. 
  3245. * @return bool Whether SSL access is available. 
  3246. */ 
  3247. function url_is_accessable_via_ssl( $url ) { 
  3248. _deprecated_function( __FUNCTION__, '4.0.0' ); 
  3249.  
  3250. $response = wp_remote_get( set_url_scheme( $url, 'https' ) ); 
  3251.  
  3252. if ( !is_wp_error( $response ) ) { 
  3253. $status = wp_remote_retrieve_response_code( $response ); 
  3254. if ( 200 == $status || 401 == $status ) { 
  3255. return true; 
  3256.  
  3257. return false; 
  3258.  
  3259. /** 
  3260. * Start preview theme output buffer. 
  3261. * 
  3262. * Will only perform task if the user has permissions and template and preview 
  3263. * query variables exist. 
  3264. * 
  3265. * @since 2.6.0 
  3266. * @deprecated 4.3.0 
  3267. */ 
  3268. function preview_theme() { 
  3269. _deprecated_function( __FUNCTION__, '4.3.0' ); 
  3270.  
  3271. /** 
  3272. * Private function to modify the current template when previewing a theme 
  3273. * 
  3274. * @since 2.9.0 
  3275. * @deprecated 4.3.0 
  3276. * @access private 
  3277. * 
  3278. * @return string 
  3279. */ 
  3280. function _preview_theme_template_filter() { 
  3281. _deprecated_function( __FUNCTION__, '4.3.0' ); 
  3282. return ''; 
  3283.  
  3284. /** 
  3285. * Private function to modify the current stylesheet when previewing a theme 
  3286. * 
  3287. * @since 2.9.0 
  3288. * @deprecated 4.3.0 
  3289. * @access private 
  3290. * 
  3291. * @return string 
  3292. */ 
  3293. function _preview_theme_stylesheet_filter() { 
  3294. _deprecated_function( __FUNCTION__, '4.3.0' ); 
  3295. return ''; 
  3296.  
  3297. /** 
  3298. * Callback function for ob_start() to capture all links in the theme. 
  3299. * 
  3300. * @since 2.6.0 
  3301. * @deprecated 4.3.0 
  3302. * @access private 
  3303. * 
  3304. * @param string $content 
  3305. * @return string 
  3306. */ 
  3307. function preview_theme_ob_filter( $content ) { 
  3308. _deprecated_function( __FUNCTION__, '4.3.0' ); 
  3309. return $content; 
  3310.  
  3311. /** 
  3312. * Manipulates preview theme links in order to control and maintain location. 
  3313. * 
  3314. * Callback function for preg_replace_callback() to accept and filter matches. 
  3315. * 
  3316. * @since 2.6.0 
  3317. * @deprecated 4.3.0 
  3318. * @access private 
  3319. * 
  3320. * @param array $matches 
  3321. * @return string 
  3322. */ 
  3323. function preview_theme_ob_filter_callback( $matches ) { 
  3324. _deprecated_function( __FUNCTION__, '4.3.0' ); 
  3325. return ''; 
  3326.  
  3327. /** 
  3328. * Formats text for the rich text editor. 
  3329. * 
  3330. * The {@see 'richedit_pre'} filter is applied here. If $text is empty the filter will 
  3331. * be applied to an empty string. 
  3332. * 
  3333. * @since 2.0.0 
  3334. * @deprecated 4.3.0 
  3335. * 
  3336. * @param string $text The text to be formatted. 
  3337. * @return string The formatted text after filter is applied. 
  3338. */ 
  3339. function wp_richedit_pre($text) { 
  3340. _deprecated_function( __FUNCTION__, '4.3.0', 'format_for_editor()' ); 
  3341.  
  3342. if ( empty( $text ) ) { 
  3343. /** 
  3344. * Filters text returned for the rich text editor. 
  3345. * 
  3346. * This filter is first evaluated, and the value returned, if an empty string 
  3347. * is passed to wp_richedit_pre(). If an empty string is passed, it results 
  3348. * in a break tag and line feed. 
  3349. * 
  3350. * If a non-empty string is passed, the filter is evaluated on the wp_richedit_pre() 
  3351. * return after being formatted. 
  3352. * 
  3353. * @since 2.0.0 
  3354. * @deprecated 4.3.0 
  3355. * 
  3356. * @param string $output Text for the rich text editor. 
  3357. */ 
  3358. return apply_filters( 'richedit_pre', '' ); 
  3359.  
  3360. $output = convert_chars($text); 
  3361. $output = wpautop($output); 
  3362. $output = htmlspecialchars($output, ENT_NOQUOTES, get_option( 'blog_charset' ) ); 
  3363.  
  3364. /** This filter is documented in wp-includes/deprecated.php */ 
  3365. return apply_filters( 'richedit_pre', $output ); 
  3366.  
  3367. /** 
  3368. * Formats text for the HTML editor. 
  3369. * 
  3370. * Unless $output is empty it will pass through htmlspecialchars before the 
  3371. * {@see 'htmledit_pre'} filter is applied. 
  3372. * 
  3373. * @since 2.5.0 
  3374. * @deprecated 4.3.0 Use format_for_editor() 
  3375. * @see format_for_editor() 
  3376. * 
  3377. * @param string $output The text to be formatted. 
  3378. * @return string Formatted text after filter applied. 
  3379. */ 
  3380. function wp_htmledit_pre($output) { 
  3381. _deprecated_function( __FUNCTION__, '4.3.0', 'format_for_editor()' ); 
  3382.  
  3383. if ( !empty($output) ) 
  3384. $output = htmlspecialchars($output, ENT_NOQUOTES, get_option( 'blog_charset' ) ); // convert only < > & 
  3385.  
  3386. /** 
  3387. * Filters the text before it is formatted for the HTML editor. 
  3388. * 
  3389. * @since 2.5.0 
  3390. * @deprecated 4.3.0 
  3391. * 
  3392. * @param string $output The HTML-formatted text. 
  3393. */ 
  3394. return apply_filters( 'htmledit_pre', $output ); 
  3395.  
  3396. /** 
  3397. * Retrieve permalink from post ID. 
  3398. * 
  3399. * @since 1.0.0 
  3400. * @deprecated 4.4.0 Use get_permalink() 
  3401. * @see get_permalink() 
  3402. * 
  3403. * @param int|WP_Post $post_id Optional. Post ID or WP_Post object. Default is global $post. 
  3404. * @return string|false 
  3405. */ 
  3406. function post_permalink( $post_id = 0 ) { 
  3407. _deprecated_function( __FUNCTION__, '4.4.0', 'get_permalink()' ); 
  3408.  
  3409. return get_permalink( $post_id ); 
  3410.  
  3411. /** 
  3412. * Perform a HTTP HEAD or GET request. 
  3413. * 
  3414. * If $file_path is a writable filename, this will do a GET request and write 
  3415. * the file to that path. 
  3416. * 
  3417. * @since 2.5.0 
  3418. * @deprecated 4.4.0 Use WP_Http 
  3419. * @see WP_Http 
  3420. * 
  3421. * @param string $url URL to fetch. 
  3422. * @param string|bool $file_path Optional. File path to write request to. Default false. 
  3423. * @param int $red Optional. The number of Redirects followed, Upon 5 being hit,  
  3424. * returns false. Default 1. 
  3425. * @return bool|string False on failure and string of headers if HEAD request. 
  3426. */ 
  3427. function wp_get_http( $url, $file_path = false, $red = 1 ) { 
  3428. _deprecated_function( __FUNCTION__, '4.4.0', 'WP_Http' ); 
  3429.  
  3430. @set_time_limit( 60 ); 
  3431.  
  3432. if ( $red > 5 ) 
  3433. return false; 
  3434.  
  3435. $options = array(); 
  3436. $options['redirection'] = 5; 
  3437.  
  3438. if ( false == $file_path ) 
  3439. $options['method'] = 'HEAD'; 
  3440. else 
  3441. $options['method'] = 'GET'; 
  3442.  
  3443. $response = wp_safe_remote_request( $url, $options ); 
  3444.  
  3445. if ( is_wp_error( $response ) ) 
  3446. return false; 
  3447.  
  3448. $headers = wp_remote_retrieve_headers( $response ); 
  3449. $headers['response'] = wp_remote_retrieve_response_code( $response ); 
  3450.  
  3451. // WP_HTTP no longer follows redirects for HEAD requests. 
  3452. if ( 'HEAD' == $options['method'] && in_array($headers['response'], array(301, 302)) && isset( $headers['location'] ) ) { 
  3453. return wp_get_http( $headers['location'], $file_path, ++$red ); 
  3454.  
  3455. if ( false == $file_path ) 
  3456. return $headers; 
  3457.  
  3458. // GET request - write it to the supplied filename 
  3459. $out_fp = fopen($file_path, 'w'); 
  3460. if ( !$out_fp ) 
  3461. return $headers; 
  3462.  
  3463. fwrite( $out_fp, wp_remote_retrieve_body( $response ) ); 
  3464. fclose($out_fp); 
  3465. clearstatcache(); 
  3466.  
  3467. return $headers; 
  3468.  
  3469. /** 
  3470. * Whether SSL login should be forced. 
  3471. * 
  3472. * @since 2.6.0 
  3473. * @deprecated 4.4.0 Use force_ssl_admin() 
  3474. * @see force_ssl_admin() 
  3475. * 
  3476. * @param string|bool $force Optional Whether to force SSL login. Default null. 
  3477. * @return bool True if forced, false if not forced. 
  3478. */ 
  3479. function force_ssl_login( $force = null ) { 
  3480. _deprecated_function( __FUNCTION__, '4.4.0', 'force_ssl_admin()' ); 
  3481. return force_ssl_admin( $force ); 
  3482.  
  3483. /** 
  3484. * Retrieve path of comment popup template in current or parent template. 
  3485. * 
  3486. * @since 1.5.0 
  3487. * @deprecated 4.5.0 
  3488. * 
  3489. * @return string Full path to comments popup template file. 
  3490. */ 
  3491. function get_comments_popup_template() { 
  3492. _deprecated_function( __FUNCTION__, '4.5.0' ); 
  3493.  
  3494. return ''; 
  3495.  
  3496. /** 
  3497. * Whether the current URL is within the comments popup window. 
  3498. * 
  3499. * @since 1.5.0 
  3500. * @deprecated 4.5.0 
  3501. * 
  3502. * @return bool 
  3503. */ 
  3504. function is_comments_popup() { 
  3505. _deprecated_function( __FUNCTION__, '4.5.0' ); 
  3506.  
  3507. return false; 
  3508.  
  3509. /** 
  3510. * Display the JS popup script to show a comment. 
  3511. * 
  3512. * @since 0.71 
  3513. * @deprecated 4.5.0 
  3514. */ 
  3515. function comments_popup_script() { 
  3516. _deprecated_function( __FUNCTION__, '4.5.0' ); 
  3517.  
  3518. /** 
  3519. * Adds element attributes to open links in new windows. 
  3520. * 
  3521. * @since 0.71 
  3522. * @deprecated 4.5.0 
  3523. * 
  3524. * @param string $text Content to replace links to open in a new window. 
  3525. * @return string Content that has filtered links. 
  3526. */ 
  3527. function popuplinks( $text ) { 
  3528. _deprecated_function( __FUNCTION__, '4.5.0' ); 
  3529. $text = preg_replace('/<a (.+?)>/i', "<a $1 target='_blank' rel='external'>", $text); 
  3530. return $text; 
  3531.  
  3532. /** 
  3533. * The Google Video embed handler callback. 
  3534. * 
  3535. * Deprecated function that previously assisted in turning Google Video URLs 
  3536. * into embeds but that service has since been shut down. 
  3537. * 
  3538. * @since 2.9.0 
  3539. * @deprecated 4.6.0 
  3540. * 
  3541. * @return string An empty string. 
  3542. */ 
  3543. function wp_embed_handler_googlevideo( $matches, $attr, $url, $rawattr ) { 
  3544. _deprecated_function( __FUNCTION__, '4.6.0' ); 
  3545.  
  3546. return ''; 
.