PageRenderTime 41ms CodeModel.GetById 33ms RepoModel.GetById 0ms app.codeStats 0ms

/wp-includes/deprecated.php

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