PageRenderTime 252ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/wp-includes/deprecated.php

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