PageRenderTime 118ms CodeModel.GetById 29ms RepoModel.GetById 0ms app.codeStats 0ms

/wp-includes/deprecated.php

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