PageRenderTime 37ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/wp-includes/deprecated.php

https://gitlab.com/Gashler/dp
PHP | 1753 lines | 601 code | 173 blank | 979 comment | 103 complexity | e6e0c3e563da110c305c15db6aafca00 MD5 | raw file
  1. <?php
  2. /**
  3. * Deprecated functions from past WordPress versions. You shouldn't use these
  4. * functions and look for the alternatives instead. The functions will be
  5. * removed in a later version.
  6. *
  7. * @package WordPress
  8. * @subpackage Deprecated
  9. */
  10. /*
  11. * Deprecated functions come here to die.
  12. */
  13. /**
  14. * Entire Post data.
  15. *
  16. * @since 0.71
  17. * @deprecated 1.5.1
  18. * @deprecated Use get_post()
  19. * @see get_post()
  20. *
  21. * @param int $postid
  22. * @return array
  23. */
  24. function get_postdata($postid) {
  25. _deprecated_function( __FUNCTION__, '1.5.1', 'get_post()' );
  26. $post = get_post($postid);
  27. $postdata = array (
  28. 'ID' => $post->ID,
  29. 'Author_ID' => $post->post_author,
  30. 'Date' => $post->post_date,
  31. 'Content' => $post->post_content,
  32. 'Excerpt' => $post->post_excerpt,
  33. 'Title' => $post->post_title,
  34. 'Category' => $post->post_category,
  35. 'post_status' => $post->post_status,
  36. 'comment_status' => $post->comment_status,
  37. 'ping_status' => $post->ping_status,
  38. 'post_password' => $post->post_password,
  39. 'to_ping' => $post->to_ping,
  40. 'pinged' => $post->pinged,
  41. 'post_type' => $post->post_type,
  42. 'post_name' => $post->post_name
  43. );
  44. return $postdata;
  45. }
  46. /**
  47. * Sets up the WordPress Loop.
  48. *
  49. * @since 1.0.1
  50. * @deprecated 1.5
  51. * @deprecated Use The Loop - {@link http://codex.wordpress.org/The_Loop Use new WordPress Loop}
  52. */
  53. function start_wp() {
  54. global $wp_query;
  55. _deprecated_function( __FUNCTION__, '1.5', __('new WordPress Loop') );
  56. // Since the old style loop is being used, advance the query iterator here.
  57. $wp_query->next_post();
  58. setup_postdata( get_post() );
  59. }
  60. /**
  61. * Return or Print Category ID.
  62. *
  63. * @since 0.71
  64. * @deprecated 0.71
  65. * @deprecated use get_the_category()
  66. * @see get_the_category()
  67. *
  68. * @param bool $echo
  69. * @return null|int
  70. */
  71. function the_category_ID($echo = true) {
  72. _deprecated_function( __FUNCTION__, '0.71', 'get_the_category()' );
  73. // Grab the first cat in the list.
  74. $categories = get_the_category();
  75. $cat = $categories[0]->term_id;
  76. if ( $echo )
  77. echo $cat;
  78. return $cat;
  79. }
  80. /**
  81. * Print category with optional text before and after.
  82. *
  83. * @since 0.71
  84. * @deprecated 0.71
  85. * @deprecated use get_the_category_by_ID()
  86. * @see get_the_category_by_ID()
  87. *
  88. * @param string $before
  89. * @param string $after
  90. */
  91. function the_category_head($before='', $after='') {
  92. global $currentcat, $previouscat;
  93. _deprecated_function( __FUNCTION__, '0.71', 'get_the_category_by_ID()' );
  94. // Grab the first cat in the list.
  95. $categories = get_the_category();
  96. $currentcat = $categories[0]->category_id;
  97. if ( $currentcat != $previouscat ) {
  98. echo $before;
  99. echo get_the_category_by_ID($currentcat);
  100. echo $after;
  101. $previouscat = $currentcat;
  102. }
  103. }
  104. /**
  105. * Prints link to the previous post.
  106. *
  107. * @since 1.5
  108. * @deprecated 2.0
  109. * @deprecated Use previous_post_link()
  110. * @see previous_post_link()
  111. *
  112. * @param string $format
  113. * @param string $previous
  114. * @param string $title
  115. * @param string $in_same_cat
  116. * @param int $limitprev
  117. * @param string $excluded_categories
  118. */
  119. function previous_post($format='%', $previous='previous post: ', $title='yes', $in_same_cat='no', $limitprev=1, $excluded_categories='') {
  120. _deprecated_function( __FUNCTION__, '2.0', 'previous_post_link()' );
  121. if ( empty($in_same_cat) || 'no' == $in_same_cat )
  122. $in_same_cat = false;
  123. else
  124. $in_same_cat = true;
  125. $post = get_previous_post($in_same_cat, $excluded_categories);
  126. if ( !$post )
  127. return;
  128. $string = '<a href="'.get_permalink($post->ID).'">'.$previous;
  129. if ( 'yes' == $title )
  130. $string .= apply_filters('the_title', $post->post_title, $post->ID);
  131. $string .= '</a>';
  132. $format = str_replace('%', $string, $format);
  133. echo $format;
  134. }
  135. /**
  136. * Prints link to the next post.
  137. *
  138. * @since 0.71
  139. * @deprecated 2.0
  140. * @deprecated Use next_post_link()
  141. * @see next_post_link()
  142. *
  143. * @param string $format
  144. * @param string $next
  145. * @param string $title
  146. * @param string $in_same_cat
  147. * @param int $limitnext
  148. * @param string $excluded_categories
  149. */
  150. function next_post($format='%', $next='next post: ', $title='yes', $in_same_cat='no', $limitnext=1, $excluded_categories='') {
  151. _deprecated_function( __FUNCTION__, '2.0', 'next_post_link()' );
  152. if ( empty($in_same_cat) || 'no' == $in_same_cat )
  153. $in_same_cat = false;
  154. else
  155. $in_same_cat = true;
  156. $post = get_next_post($in_same_cat, $excluded_categories);
  157. if ( !$post )
  158. return;
  159. $string = '<a href="'.get_permalink($post->ID).'">'.$next;
  160. if ( 'yes' == $title )
  161. $string .= apply_filters('the_title', $post->post_title, $post->ID);
  162. $string .= '</a>';
  163. $format = str_replace('%', $string, $format);
  164. echo $format;
  165. }
  166. /**
  167. * Whether user can create a post.
  168. *
  169. * @since 1.5
  170. * @deprecated 2.0
  171. * @deprecated Use current_user_can()
  172. * @see current_user_can()
  173. *
  174. * @param int $user_id
  175. * @param int $blog_id Not Used
  176. * @param int $category_id Not Used
  177. * @return bool
  178. */
  179. function user_can_create_post($user_id, $blog_id = 1, $category_id = 'None') {
  180. _deprecated_function( __FUNCTION__, '2.0', 'current_user_can()' );
  181. $author_data = get_userdata($user_id);
  182. return ($author_data->user_level > 1);
  183. }
  184. /**
  185. * Whether user can create a post.
  186. *
  187. * @since 1.5
  188. * @deprecated 2.0
  189. * @deprecated Use current_user_can()
  190. * @see current_user_can()
  191. *
  192. * @param int $user_id
  193. * @param int $blog_id Not Used
  194. * @param int $category_id Not Used
  195. * @return bool
  196. */
  197. function user_can_create_draft($user_id, $blog_id = 1, $category_id = 'None') {
  198. _deprecated_function( __FUNCTION__, '2.0', 'current_user_can()' );
  199. $author_data = get_userdata($user_id);
  200. return ($author_data->user_level >= 1);
  201. }
  202. /**
  203. * Whether user can edit a post.
  204. *
  205. * @since 1.5
  206. * @deprecated 2.0
  207. * @deprecated Use current_user_can()
  208. * @see current_user_can()
  209. *
  210. * @param int $user_id
  211. * @param int $post_id
  212. * @param int $blog_id Not Used
  213. * @return bool
  214. */
  215. function user_can_edit_post($user_id, $post_id, $blog_id = 1) {
  216. _deprecated_function( __FUNCTION__, '2.0', 'current_user_can()' );
  217. $author_data = get_userdata($user_id);
  218. $post = get_post($post_id);
  219. $post_author_data = get_userdata($post->post_author);
  220. if ( (($user_id == $post_author_data->ID) && !($post->post_status == 'publish' && $author_data->user_level < 2))
  221. || ($author_data->user_level > $post_author_data->user_level)
  222. || ($author_data->user_level >= 10) ) {
  223. return true;
  224. } else {
  225. return false;
  226. }
  227. }
  228. /**
  229. * Whether user can delete a post.
  230. *
  231. * @since 1.5
  232. * @deprecated 2.0
  233. * @deprecated Use current_user_can()
  234. * @see current_user_can()
  235. *
  236. * @param int $user_id
  237. * @param int $post_id
  238. * @param int $blog_id Not Used
  239. * @return bool
  240. */
  241. function user_can_delete_post($user_id, $post_id, $blog_id = 1) {
  242. _deprecated_function( __FUNCTION__, '2.0', 'current_user_can()' );
  243. // right now if one can edit, one can delete
  244. return user_can_edit_post($user_id, $post_id, $blog_id);
  245. }
  246. /**
  247. * Whether user can set new posts' dates.
  248. *
  249. * @since 1.5
  250. * @deprecated 2.0
  251. * @deprecated Use current_user_can()
  252. * @see current_user_can()
  253. *
  254. * @param int $user_id
  255. * @param int $blog_id Not Used
  256. * @param int $category_id Not Used
  257. * @return bool
  258. */
  259. function user_can_set_post_date($user_id, $blog_id = 1, $category_id = 'None') {
  260. _deprecated_function( __FUNCTION__, '2.0', 'current_user_can()' );
  261. $author_data = get_userdata($user_id);
  262. return (($author_data->user_level > 4) && user_can_create_post($user_id, $blog_id, $category_id));
  263. }
  264. /**
  265. * Whether user can delete a post.
  266. *
  267. * @since 1.5
  268. * @deprecated 2.0
  269. * @deprecated Use current_user_can()
  270. * @see current_user_can()
  271. *
  272. * @param int $user_id
  273. * @param int $post_id
  274. * @param int $blog_id Not Used
  275. * @return bool returns true if $user_id can edit $post_id's date
  276. */
  277. function user_can_edit_post_date($user_id, $post_id, $blog_id = 1) {
  278. _deprecated_function( __FUNCTION__, '2.0', 'current_user_can()' );
  279. $author_data = get_userdata($user_id);
  280. return (($author_data->user_level > 4) && user_can_edit_post($user_id, $post_id, $blog_id));
  281. }
  282. /**
  283. * Whether user can delete a post.
  284. *
  285. * @since 1.5
  286. * @deprecated 2.0
  287. * @deprecated Use current_user_can()
  288. * @see current_user_can()
  289. *
  290. * @param int $user_id
  291. * @param int $post_id
  292. * @param int $blog_id Not Used
  293. * @return bool returns true if $user_id can edit $post_id's comments
  294. */
  295. function user_can_edit_post_comments($user_id, $post_id, $blog_id = 1) {
  296. _deprecated_function( __FUNCTION__, '2.0', 'current_user_can()' );
  297. // right now if one can edit a post, one can edit comments made on it
  298. return user_can_edit_post($user_id, $post_id, $blog_id);
  299. }
  300. /**
  301. * Whether user can delete a post.
  302. *
  303. * @since 1.5
  304. * @deprecated 2.0
  305. * @deprecated Use current_user_can()
  306. * @see current_user_can()
  307. *
  308. * @param int $user_id
  309. * @param int $post_id
  310. * @param int $blog_id Not Used
  311. * @return bool returns true if $user_id can delete $post_id's comments
  312. */
  313. function user_can_delete_post_comments($user_id, $post_id, $blog_id = 1) {
  314. _deprecated_function( __FUNCTION__, '2.0', 'current_user_can()' );
  315. // right now if one can edit comments, one can delete comments
  316. return user_can_edit_post_comments($user_id, $post_id, $blog_id);
  317. }
  318. /**
  319. * Can user can edit other user.
  320. *
  321. * @since 1.5
  322. * @deprecated 2.0
  323. * @deprecated Use current_user_can()
  324. * @see current_user_can()
  325. *
  326. * @param int $user_id
  327. * @param int $other_user
  328. * @return bool
  329. */
  330. function user_can_edit_user($user_id, $other_user) {
  331. _deprecated_function( __FUNCTION__, '2.0', 'current_user_can()' );
  332. $user = get_userdata($user_id);
  333. $other = get_userdata($other_user);
  334. if ( $user->user_level > $other->user_level || $user->user_level > 8 || $user->ID == $other->ID )
  335. return true;
  336. else
  337. return false;
  338. }
  339. /**
  340. * Gets the links associated with category $cat_name.
  341. *
  342. * @since 0.71
  343. * @deprecated 2.1
  344. * @deprecated Use get_bookmarks()
  345. * @see get_bookmarks()
  346. *
  347. * @param string $cat_name Optional. The category name to use. If no match is found uses all.
  348. * @param string $before Optional. The html to output before the link.
  349. * @param string $after Optional. The html to output after the link.
  350. * @param string $between Optional. The html to output between the link/image and its description. Not used if no image or $show_images is true.
  351. * @param bool $show_images Optional. Whether to show images (if defined).
  352. * @param string $orderby Optional. The order to output the links. E.g. 'id', 'name', 'url', 'description' or 'rating'. Or maybe owner.
  353. * If you start the name with an underscore the order will be reversed. You can also specify 'rand' as the order which will return links in a
  354. * random order.
  355. * @param bool $show_description Optional. Whether to show the description if show_images=false/not defined.
  356. * @param bool $show_rating Optional. Show rating stars/chars.
  357. * @param int $limit Optional. Limit to X entries. If not specified, all entries are shown.
  358. * @param int $show_updated Optional. Whether to show last updated timestamp
  359. */
  360. function get_linksbyname($cat_name = "noname", $before = '', $after = '<br />', $between = " ", $show_images = true, $orderby = 'id',
  361. $show_description = true, $show_rating = false,
  362. $limit = -1, $show_updated = 0) {
  363. _deprecated_function( __FUNCTION__, '2.1', 'get_bookmarks()' );
  364. $cat_id = -1;
  365. $cat = get_term_by('name', $cat_name, 'link_category');
  366. if ( $cat )
  367. $cat_id = $cat->term_id;
  368. get_links($cat_id, $before, $after, $between, $show_images, $orderby, $show_description, $show_rating, $limit, $show_updated);
  369. }
  370. /**
  371. * Gets the links associated with the named category.
  372. *
  373. * @since 1.0.1
  374. * @deprecated 2.1
  375. * @deprecated Use wp_list_bookmarks()
  376. * @see wp_list_bookmarks()
  377. *
  378. * @param string $category The category to use.
  379. * @param string $args
  380. * @return bool|null
  381. */
  382. function wp_get_linksbyname($category, $args = '') {
  383. _deprecated_function(__FUNCTION__, '2.1', 'wp_list_bookmarks()');
  384. $defaults = array(
  385. 'after' => '<br />',
  386. 'before' => '',
  387. 'categorize' => 0,
  388. 'category_after' => '',
  389. 'category_before' => '',
  390. 'category_name' => $category,
  391. 'show_description' => 1,
  392. 'title_li' => '',
  393. );
  394. $r = wp_parse_args( $args, $defaults );
  395. return wp_list_bookmarks($r);
  396. }
  397. /**
  398. * Gets an array of link objects associated with category $cat_name.
  399. *
  400. * <code>
  401. * $links = get_linkobjectsbyname('fred');
  402. * foreach ($links as $link) {
  403. * echo '<li>'.$link->link_name.'</li>';
  404. * }
  405. * </code>
  406. *
  407. * @since 1.0.1
  408. * @deprecated 2.1
  409. * @deprecated Use get_bookmarks()
  410. * @see get_bookmarks()
  411. *
  412. * @param string $cat_name The category name to use. If no match is found uses all.
  413. * @param string $orderby The order to output the links. E.g. 'id', 'name', 'url', 'description', or 'rating'.
  414. * Or maybe owner. If you start the name with an underscore the order will be reversed. You can also
  415. * specify 'rand' as the order which will return links in a random order.
  416. * @param int $limit Limit to X entries. If not specified, all entries are shown.
  417. * @return unknown
  418. */
  419. function get_linkobjectsbyname($cat_name = "noname" , $orderby = 'name', $limit = -1) {
  420. _deprecated_function( __FUNCTION__, '2.1', 'get_bookmarks()' );
  421. $cat_id = -1;
  422. $cat = get_term_by('name', $cat_name, 'link_category');
  423. if ( $cat )
  424. $cat_id = $cat->term_id;
  425. return get_linkobjects($cat_id, $orderby, $limit);
  426. }
  427. /**
  428. * Gets an array of link objects associated with category n.
  429. *
  430. * Usage:
  431. * <code>
  432. * $links = get_linkobjects(1);
  433. * if ($links) {
  434. * foreach ($links as $link) {
  435. * echo '<li>'.$link->link_name.'<br />'.$link->link_description.'</li>';
  436. * }
  437. * }
  438. * </code>
  439. *
  440. * Fields are:
  441. * <ol>
  442. * <li>link_id</li>
  443. * <li>link_url</li>
  444. * <li>link_name</li>
  445. * <li>link_image</li>
  446. * <li>link_target</li>
  447. * <li>link_category</li>
  448. * <li>link_description</li>
  449. * <li>link_visible</li>
  450. * <li>link_owner</li>
  451. * <li>link_rating</li>
  452. * <li>link_updated</li>
  453. * <li>link_rel</li>
  454. * <li>link_notes</li>
  455. * </ol>
  456. *
  457. * @since 1.0.1
  458. * @deprecated 2.1
  459. * @deprecated Use get_bookmarks()
  460. * @see get_bookmarks()
  461. *
  462. * @param int $category The category to use. If no category supplied uses all
  463. * @param string $orderby the order to output the links. E.g. 'id', 'name', 'url',
  464. * 'description', or 'rating'. Or maybe owner. If you start the name with an
  465. * underscore the order will be reversed. You can also specify 'rand' as the
  466. * order which will return links in a random order.
  467. * @param int $limit Limit to X entries. If not specified, all entries are shown.
  468. * @return unknown
  469. */
  470. function get_linkobjects($category = 0, $orderby = 'name', $limit = 0) {
  471. _deprecated_function( __FUNCTION__, '2.1', 'get_bookmarks()' );
  472. $links = get_bookmarks( array( 'category' => $category, 'orderby' => $orderby, 'limit' => $limit ) ) ;
  473. $links_array = array();
  474. foreach ($links as $link)
  475. $links_array[] = $link;
  476. return $links_array;
  477. }
  478. /**
  479. * Gets the links associated with category 'cat_name' and display rating stars/chars.
  480. *
  481. * @since 0.71
  482. * @deprecated 2.1
  483. * @deprecated Use get_bookmarks()
  484. * @see get_bookmarks()
  485. *
  486. * @param string $cat_name The category name to use. If no match is found uses all
  487. * @param string $before The html to output before the link
  488. * @param string $after The html to output after the link
  489. * @param string $between The html to output between the link/image and its description. Not used if no image or show_images is true
  490. * @param bool $show_images Whether to show images (if defined).
  491. * @param string $orderby the order to output the links. E.g. 'id', 'name', 'url',
  492. * 'description', or 'rating'. Or maybe owner. If you start the name with an
  493. * underscore the order will be reversed. You can also specify 'rand' as the
  494. * order which will return links in a random order.
  495. * @param bool $show_description Whether to show the description if show_images=false/not defined
  496. * @param int $limit Limit to X entries. If not specified, all entries are shown.
  497. * @param int $show_updated Whether to show last updated timestamp
  498. */
  499. function get_linksbyname_withrating($cat_name = "noname", $before = '', $after = '<br />', $between = " ",
  500. $show_images = true, $orderby = 'id', $show_description = true, $limit = -1, $show_updated = 0) {
  501. _deprecated_function( __FUNCTION__, '2.1', 'get_bookmarks()' );
  502. get_linksbyname($cat_name, $before, $after, $between, $show_images, $orderby, $show_description, true, $limit, $show_updated);
  503. }
  504. /**
  505. * Gets the links associated with category n and display rating stars/chars.
  506. *
  507. * @since 0.71
  508. * @deprecated 2.1
  509. * @deprecated Use get_bookmarks()
  510. * @see get_bookmarks()
  511. *
  512. * @param int $category The category to use. If no category supplied uses all
  513. * @param string $before The html to output before the link
  514. * @param string $after The html to output after the link
  515. * @param string $between The html to output between the link/image and its description. Not used if no image or show_images == true
  516. * @param bool $show_images Whether to show images (if defined).
  517. * @param string $orderby The order to output the links. E.g. 'id', 'name', 'url',
  518. * 'description', or 'rating'. Or maybe owner. If you start the name with an
  519. * underscore the order will be reversed. You can also specify 'rand' as the
  520. * order which will return links in a random order.
  521. * @param bool $show_description Whether to show the description if show_images=false/not defined.
  522. * @param string $limit Limit to X entries. If not specified, all entries are shown.
  523. * @param int $show_updated Whether to show last updated timestamp
  524. */
  525. function get_links_withrating($category = -1, $before = '', $after = '<br />', $between = " ", $show_images = true,
  526. $orderby = 'id', $show_description = true, $limit = -1, $show_updated = 0) {
  527. _deprecated_function( __FUNCTION__, '2.1', 'get_bookmarks()' );
  528. get_links($category, $before, $after, $between, $show_images, $orderby, $show_description, true, $limit, $show_updated);
  529. }
  530. /**
  531. * Gets the auto_toggle setting.
  532. *
  533. * @since 0.71
  534. * @deprecated 2.1
  535. * @deprecated No alternative function available
  536. *
  537. * @param int $id The category to get. If no category supplied uses 0
  538. * @return int Only returns 0.
  539. */
  540. function get_autotoggle($id = 0) {
  541. _deprecated_function( __FUNCTION__, '2.1' );
  542. return 0;
  543. }
  544. /**
  545. * @since 0.71
  546. * @deprecated 2.1
  547. * @deprecated Use wp_list_categories()
  548. * @see wp_list_categories()
  549. *
  550. * @param int $optionall
  551. * @param string $all
  552. * @param string $sort_column
  553. * @param string $sort_order
  554. * @param string $file
  555. * @param bool $list
  556. * @param int $optiondates
  557. * @param int $optioncount
  558. * @param int $hide_empty
  559. * @param int $use_desc_for_title
  560. * @param bool $children
  561. * @param int $child_of
  562. * @param int $categories
  563. * @param int $recurse
  564. * @param string $feed
  565. * @param string $feed_image
  566. * @param string $exclude
  567. * @param bool $hierarchical
  568. * @return unknown
  569. */
  570. function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_order = 'asc', $file = '', $list = true, $optiondates = 0,
  571. $optioncount = 0, $hide_empty = 1, $use_desc_for_title = 1, $children=false, $child_of=0, $categories=0,
  572. $recurse=0, $feed = '', $feed_image = '', $exclude = '', $hierarchical=false) {
  573. _deprecated_function( __FUNCTION__, '2.1', 'wp_list_categories()' );
  574. $query = compact('optionall', 'all', 'sort_column', 'sort_order', 'file', 'list', 'optiondates', 'optioncount', 'hide_empty', 'use_desc_for_title', 'children',
  575. 'child_of', 'categories', 'recurse', 'feed', 'feed_image', 'exclude', 'hierarchical');
  576. return wp_list_cats($query);
  577. }
  578. /**
  579. * @since 1.2
  580. * @deprecated 2.1
  581. * @deprecated Use wp_list_categories()
  582. * @see wp_list_categories()
  583. *
  584. * @param string|array $args
  585. * @return unknown
  586. */
  587. function wp_list_cats($args = '') {
  588. _deprecated_function( __FUNCTION__, '2.1', 'wp_list_categories()' );
  589. $r = wp_parse_args( $args );
  590. // Map to new names.
  591. if ( isset($r['optionall']) && isset($r['all']))
  592. $r['show_option_all'] = $r['all'];
  593. if ( isset($r['sort_column']) )
  594. $r['orderby'] = $r['sort_column'];
  595. if ( isset($r['sort_order']) )
  596. $r['order'] = $r['sort_order'];
  597. if ( isset($r['optiondates']) )
  598. $r['show_last_update'] = $r['optiondates'];
  599. if ( isset($r['optioncount']) )
  600. $r['show_count'] = $r['optioncount'];
  601. if ( isset($r['list']) )
  602. $r['style'] = $r['list'] ? 'list' : 'break';
  603. $r['title_li'] = '';
  604. return wp_list_categories($r);
  605. }
  606. /**
  607. * @since 0.71
  608. * @deprecated 2.1
  609. * @deprecated Use wp_dropdown_categories()
  610. * @see wp_dropdown_categories()
  611. *
  612. * @param int $optionall
  613. * @param string $all
  614. * @param string $orderby
  615. * @param string $order
  616. * @param int $show_last_update
  617. * @param int $show_count
  618. * @param int $hide_empty
  619. * @param bool $optionnone
  620. * @param int $selected
  621. * @param int $exclude
  622. * @return unknown
  623. */
  624. function dropdown_cats($optionall = 1, $all = 'All', $orderby = 'ID', $order = 'asc',
  625. $show_last_update = 0, $show_count = 0, $hide_empty = 1, $optionnone = false,
  626. $selected = 0, $exclude = 0) {
  627. _deprecated_function( __FUNCTION__, '2.1', 'wp_dropdown_categories()' );
  628. $show_option_all = '';
  629. if ( $optionall )
  630. $show_option_all = $all;
  631. $show_option_none = '';
  632. if ( $optionnone )
  633. $show_option_none = __('None');
  634. $vars = compact('show_option_all', 'show_option_none', 'orderby', 'order',
  635. 'show_last_update', 'show_count', 'hide_empty', 'selected', 'exclude');
  636. $query = add_query_arg($vars, '');
  637. return wp_dropdown_categories($query);
  638. }
  639. /**
  640. * @since 1.2
  641. * @deprecated 2.1
  642. * @deprecated 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 unknown
  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', '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. * @since 1.0.1
  660. * @deprecated 2.1
  661. * @deprecated Use wp_get_post_categories()
  662. * @see wp_get_post_categories()
  663. *
  664. * @param int $blogid Not Used
  665. * @param int $post_ID
  666. * @return unknown
  667. */
  668. function wp_get_post_cats($blogid = '1', $post_ID = 0) {
  669. _deprecated_function( __FUNCTION__, '2.1', 'wp_get_post_categories()' );
  670. return wp_get_post_categories($post_ID);
  671. }
  672. /**
  673. * Sets the categories that the post id belongs to.
  674. *
  675. * @since 1.0.1
  676. * @deprecated 2.1
  677. * @deprecated Use wp_set_post_categories()
  678. * @see wp_set_post_categories()
  679. *
  680. * @param int $blogid Not used
  681. * @param int $post_ID
  682. * @param array $post_categories
  683. * @return unknown
  684. */
  685. function wp_set_post_cats($blogid = '1', $post_ID = 0, $post_categories = array()) {
  686. _deprecated_function( __FUNCTION__, '2.1', 'wp_set_post_categories()' );
  687. return wp_set_post_categories($post_ID, $post_categories);
  688. }
  689. /**
  690. * @since 0.71
  691. * @deprecated 2.1
  692. * @deprecated Use wp_get_archives()
  693. * @see wp_get_archives()
  694. *
  695. * @param string $type
  696. * @param string $limit
  697. * @param string $format
  698. * @param string $before
  699. * @param string $after
  700. * @param bool $show_post_count
  701. * @return unknown
  702. */
  703. function get_archives($type='', $limit='', $format='html', $before = '', $after = '', $show_post_count = false) {
  704. _deprecated_function( __FUNCTION__, '2.1', 'wp_get_archives()' );
  705. $args = compact('type', 'limit', 'format', 'before', 'after', 'show_post_count');
  706. return wp_get_archives($args);
  707. }
  708. /**
  709. * Returns or Prints link to the author's posts.
  710. *
  711. * @since 1.2
  712. * @deprecated 2.1
  713. * @deprecated Use get_author_posts_url()
  714. * @see get_author_posts_url()
  715. *
  716. * @param bool $echo
  717. * @param int $author_id
  718. * @param string $author_nicename Optional.
  719. * @return string|null
  720. */
  721. function get_author_link($echo, $author_id, $author_nicename = '') {
  722. _deprecated_function( __FUNCTION__, '2.1', 'get_author_posts_url()' );
  723. $link = get_author_posts_url($author_id, $author_nicename);
  724. if ( $echo )
  725. echo $link;
  726. return $link;
  727. }
  728. /**
  729. * Print list of pages based on arguments.
  730. *
  731. * @since 0.71
  732. * @deprecated 2.1
  733. * @deprecated 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', '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
  756. * @deprecated Use get_option()
  757. * @see get_option()
  758. *
  759. * @param string $option
  760. * @return string
  761. */
  762. function get_settings($option) {
  763. _deprecated_function( __FUNCTION__, '2.1', 'get_option()' );
  764. return get_option($option);
  765. }
  766. /**
  767. * Print the permalink of the current post in the loop.
  768. *
  769. * @since 0.71
  770. * @deprecated 1.2
  771. * @deprecated Use the_permalink()
  772. * @see the_permalink()
  773. */
  774. function permalink_link() {
  775. _deprecated_function( __FUNCTION__, '1.2', 'the_permalink()' );
  776. the_permalink();
  777. }
  778. /**
  779. * Print the permalink to the RSS feed.
  780. *
  781. * @since 0.71
  782. * @deprecated 2.3
  783. * @deprecated Use the_permalink_rss()
  784. * @see the_permalink_rss()
  785. *
  786. * @param string $deprecated
  787. */
  788. function permalink_single_rss($deprecated = '') {
  789. _deprecated_function( __FUNCTION__, '2.3', 'the_permalink_rss()' );
  790. the_permalink_rss();
  791. }
  792. /**
  793. * Gets the links associated with category.
  794. *
  795. * @see get_links() for argument information that can be used in $args
  796. * @since 1.0.1
  797. * @deprecated 2.1
  798. * @deprecated Use wp_list_bookmarks()
  799. * @see wp_list_bookmarks()
  800. *
  801. * @param string $args a query string
  802. * @return null|string
  803. */
  804. function wp_get_links($args = '') {
  805. _deprecated_function( __FUNCTION__, '2.1', 'wp_list_bookmarks()' );
  806. if ( strpos( $args, '=' ) === false ) {
  807. $cat_id = $args;
  808. $args = add_query_arg( 'category', $cat_id, $args );
  809. }
  810. $defaults = array(
  811. 'after' => '<br />',
  812. 'before' => '',
  813. 'between' => ' ',
  814. 'categorize' => 0,
  815. 'category' => '',
  816. 'echo' => true,
  817. 'limit' => -1,
  818. 'orderby' => 'name',
  819. 'show_description' => true,
  820. 'show_images' => true,
  821. 'show_rating' => false,
  822. 'show_updated' => true,
  823. 'title_li' => '',
  824. );
  825. $r = wp_parse_args( $args, $defaults );
  826. return wp_list_bookmarks($r);
  827. }
  828. /**
  829. * Gets the links associated with category by id.
  830. *
  831. * @since 0.71
  832. * @deprecated 2.1
  833. * @deprecated Use get_bookmarks()
  834. * @see get_bookmarks()
  835. *
  836. * @param int $category The category to use. If no category supplied uses all
  837. * @param string $before the html to output before the link
  838. * @param string $after the html to output after the link
  839. * @param string $between the html to output between the link/image and its description.
  840. * Not used if no image or show_images == true
  841. * @param bool $show_images whether to show images (if defined).
  842. * @param string $orderby the order to output the links. E.g. 'id', 'name', 'url',
  843. * 'description', or 'rating'. Or maybe owner. If you start the name with an
  844. * underscore the order will be reversed. You can also specify 'rand' as the order
  845. * which will return links in a random order.
  846. * @param bool $show_description whether to show the description if show_images=false/not defined.
  847. * @param bool $show_rating show rating stars/chars
  848. * @param int $limit Limit to X entries. If not specified, all entries are shown.
  849. * @param int $show_updated whether to show last updated timestamp
  850. * @param bool $echo whether to echo the results, or return them instead
  851. * @return null|string
  852. */
  853. function get_links($category = -1, $before = '', $after = '<br />', $between = ' ', $show_images = true, $orderby = 'name',
  854. $show_description = true, $show_rating = false, $limit = -1, $show_updated = 1, $echo = true) {
  855. _deprecated_function( __FUNCTION__, '2.1', 'get_bookmarks()' );
  856. $order = 'ASC';
  857. if ( substr($orderby, 0, 1) == '_' ) {
  858. $order = 'DESC';
  859. $orderby = substr($orderby, 1);
  860. }
  861. if ( $category == -1 ) //get_bookmarks uses '' to signify all categories
  862. $category = '';
  863. $results = get_bookmarks(array('category' => $category, 'orderby' => $orderby, 'order' => $order, 'show_updated' => $show_updated, 'limit' => $limit));
  864. if ( !$results )
  865. return;
  866. $output = '';
  867. foreach ( (array) $results as $row ) {
  868. if ( !isset($row->recently_updated) )
  869. $row->recently_updated = false;
  870. $output .= $before;
  871. if ( $show_updated && $row->recently_updated )
  872. $output .= get_option('links_recently_updated_prepend');
  873. $the_link = '#';
  874. if ( !empty($row->link_url) )
  875. $the_link = esc_url($row->link_url);
  876. $rel = $row->link_rel;
  877. if ( '' != $rel )
  878. $rel = ' rel="' . $rel . '"';
  879. $desc = esc_attr(sanitize_bookmark_field('link_description', $row->link_description, $row->link_id, 'display'));
  880. $name = esc_attr(sanitize_bookmark_field('link_name', $row->link_name, $row->link_id, 'display'));
  881. $title = $desc;
  882. if ( $show_updated )
  883. if (substr($row->link_updated_f, 0, 2) != '00')
  884. $title .= ' ('.__('Last updated') . ' ' . date(get_option('links_updated_date_format'), $row->link_updated_f + (get_option('gmt_offset') * HOUR_IN_SECONDS)) . ')';
  885. if ( '' != $title )
  886. $title = ' title="' . $title . '"';
  887. $alt = ' alt="' . $name . '"';
  888. $target = $row->link_target;
  889. if ( '' != $target )
  890. $target = ' target="' . $target . '"';
  891. $output .= '<a href="' . $the_link . '"' . $rel . $title . $target. '>';
  892. if ( $row->link_image != null && $show_images ) {
  893. if ( strpos($row->link_image, 'http') !== false )
  894. $output .= "<img src=\"$row->link_image\" $alt $title />";
  895. else // If it's a relative path
  896. $output .= "<img src=\"" . get_option('siteurl') . "$row->link_image\" $alt $title />";
  897. } else {
  898. $output .= $name;
  899. }
  900. $output .= '</a>';
  901. if ( $show_updated && $row->recently_updated )
  902. $output .= get_option('links_recently_updated_append');
  903. if ( $show_description && '' != $desc )
  904. $output .= $between . $desc;
  905. if ($show_rating) {
  906. $output .= $between . get_linkrating($row);
  907. }
  908. $output .= "$after\n";
  909. } // end while
  910. if ( !$echo )
  911. return $output;
  912. echo $output;
  913. }
  914. /**
  915. * Output entire list of links by category.
  916. *
  917. * Output a list of all links, listed by category, using the settings in
  918. * $wpdb->linkcategories and output it as a nested HTML unordered list.
  919. *
  920. * @since 1.0.1
  921. * @deprecated 2.1
  922. * @deprecated Use wp_list_bookmarks()
  923. * @see wp_list_bookmarks()
  924. *
  925. * @param string $order Sort link categories by 'name' or 'id'
  926. */
  927. function get_links_list($order = 'name') {
  928. _deprecated_function( __FUNCTION__, '2.1', 'wp_list_bookmarks()' );
  929. $order = strtolower($order);
  930. // Handle link category sorting
  931. $direction = 'ASC';
  932. if ( '_' == substr($order,0,1) ) {
  933. $direction = 'DESC';
  934. $order = substr($order,1);
  935. }
  936. if ( !isset($direction) )
  937. $direction = '';
  938. $cats = get_categories(array('type' => 'link', 'orderby' => $order, 'order' => $direction, 'hierarchical' => 0));
  939. // Display each category
  940. if ( $cats ) {
  941. foreach ( (array) $cats as $cat ) {
  942. // Handle each category.
  943. // Display the category name
  944. echo ' <li id="linkcat-' . $cat->term_id . '" class="linkcat"><h2>' . apply_filters('link_category', $cat->name ) . "</h2>\n\t<ul>\n";
  945. // Call get_links() with all the appropriate params
  946. get_links($cat->term_id, '<li>', "</li>", "\n", true, 'name', false);
  947. // Close the last category
  948. echo "\n\t</ul>\n</li>\n";
  949. }
  950. }
  951. }
  952. /**
  953. * Show the link to the links popup and the number of links.
  954. *
  955. * @since 0.71
  956. * @deprecated 2.1
  957. * @deprecated {@internal Use function instead is unknown}}
  958. *
  959. * @param string $text the text of the link
  960. * @param int $width the width of the popup window
  961. * @param int $height the height of the popup window
  962. * @param string $file the page to open in the popup window
  963. * @param bool $count the number of links in the db
  964. */
  965. function links_popup_script($text = 'Links', $width=400, $height=400, $file='links.all.php', $count = true) {
  966. _deprecated_function( __FUNCTION__, '2.1' );
  967. }
  968. /**
  969. * @since 1.0.1
  970. * @deprecated 2.1
  971. * @deprecated Use sanitize_bookmark_field()
  972. * @see sanitize_bookmark_field()
  973. *
  974. * @param object $link
  975. * @return unknown
  976. */
  977. function get_linkrating($link) {
  978. _deprecated_function( __FUNCTION__, '2.1', 'sanitize_bookmark_field()' );
  979. return sanitize_bookmark_field('link_rating', $link->link_rating, $link->link_id, 'display');
  980. }
  981. /**
  982. * Gets the name of category by id.
  983. *
  984. * @since 0.71
  985. * @deprecated 2.1
  986. * @deprecated Use get_category()
  987. * @see get_category()
  988. *
  989. * @param int $id The category to get. If no category supplied uses 0
  990. * @return string
  991. */
  992. function get_linkcatname($id = 0) {
  993. _deprecated_function( __FUNCTION__, '2.1', 'get_category()' );
  994. $id = (int) $id;
  995. if ( empty($id) )
  996. return '';
  997. $cats = wp_get_link_cats($id);
  998. if ( empty($cats) || ! is_array($cats) )
  999. return '';
  1000. $cat_id = (int) $cats[0]; // Take the first cat.
  1001. $cat = get_category($cat_id);
  1002. return $cat->name;
  1003. }
  1004. /**
  1005. * Print RSS comment feed link.
  1006. *
  1007. * @since 1.0.1
  1008. * @deprecated 2.5
  1009. * @deprecated Use post_comments_feed_link()
  1010. * @see post_comments_feed_link()
  1011. *
  1012. * @param string $link_text
  1013. */
  1014. function comments_rss_link($link_text = 'Comments RSS') {
  1015. _deprecated_function( __FUNCTION__, '2.5', 'post_comments_feed_link()' );
  1016. post_comments_feed_link($link_text);
  1017. }
  1018. /**
  1019. * Print/Return link to category RSS2 feed.
  1020. *
  1021. * @since 1.2
  1022. * @deprecated 2.5
  1023. * @deprecated Use get_category_feed_link()
  1024. * @see get_category_feed_link()
  1025. *
  1026. * @param bool $echo
  1027. * @param int $cat_ID
  1028. * @return string|null
  1029. */
  1030. function get_category_rss_link($echo = false, $cat_ID = 1) {
  1031. _deprecated_function( __FUNCTION__, '2.5', 'get_category_feed_link()' );
  1032. $link = get_category_feed_link($cat_ID, 'rss2');
  1033. if ( $echo )
  1034. echo $link;
  1035. return $link;
  1036. }
  1037. /**
  1038. * Print/Return link to author RSS feed.
  1039. *
  1040. * @since 1.2
  1041. * @deprecated 2.5
  1042. * @deprecated Use get_author_feed_link()
  1043. * @see get_author_feed_link()
  1044. *
  1045. * @param bool $echo
  1046. * @param int $author_id
  1047. * @return string|null
  1048. */
  1049. function get_author_rss_link($echo = false, $author_id = 1) {
  1050. _deprecated_function( __FUNCTION__, '2.5', 'get_author_feed_link()' );
  1051. $link = get_author_feed_link($author_id);
  1052. if ( $echo )
  1053. echo $link;
  1054. return $link;
  1055. }
  1056. /**
  1057. * Return link to the post RSS feed.
  1058. *
  1059. * @since 1.5
  1060. * @deprecated 2.2
  1061. * @deprecated Use get_post_comments_feed_link()
  1062. * @see get_post_comments_feed_link()
  1063. *
  1064. * @return string
  1065. */
  1066. function comments_rss() {
  1067. _deprecated_function( __FUNCTION__, '2.2', 'get_post_comments_feed_link()' );
  1068. return esc_url( get_post_comments_feed_link() );
  1069. }
  1070. /**
  1071. * An alias of wp_create_user().
  1072. *
  1073. * @since 2.0
  1074. * @deprecated 2.0
  1075. * @deprecated Use wp_create_user()
  1076. * @see wp_create_user()
  1077. *
  1078. * @param string $username The user's username.
  1079. * @param string $password The user's password.
  1080. * @param string $email The user's email (optional).
  1081. * @return int The new user's ID.
  1082. */
  1083. function create_user($username, $password, $email) {
  1084. _deprecated_function( __FUNCTION__, '2.0', 'wp_create_user()' );
  1085. return wp_create_user($username, $password, $email);
  1086. }
  1087. /**
  1088. * Unused function.
  1089. *
  1090. * @deprecated 2.5
  1091. */
  1092. function gzip_compression() {
  1093. _deprecated_function( __FUNCTION__, '2.5' );
  1094. return false;
  1095. }
  1096. /**
  1097. * Retrieve an array of comment data about comment $comment_ID.
  1098. *
  1099. * @since 0.71
  1100. * @deprecated 2.7
  1101. * @deprecated Use get_comment()
  1102. * @see get_comment()
  1103. *
  1104. * @param int $comment_ID The ID of the comment
  1105. * @param int $no_cache Whether to use the cache (cast to bool)
  1106. * @param bool $include_unapproved Whether to include unapproved comments
  1107. * @return array The comment data
  1108. */
  1109. function get_commentdata( $comment_ID, $no_cache = 0, $include_unapproved = false ) {
  1110. _deprecated_function( __FUNCTION__, '2.7', 'get_comment()' );
  1111. return get_comment($comment_ID, ARRAY_A);
  1112. }
  1113. /**
  1114. * Retrieve the category name by the category ID.
  1115. *
  1116. * @since 0.71
  1117. * @deprecated 2.8
  1118. * @deprecated Use get_cat_name()
  1119. * @see get_cat_name()
  1120. *
  1121. * @param int $cat_ID Category ID
  1122. * @return string category name
  1123. */
  1124. function get_catname( $cat_ID ) {
  1125. _deprecated_function( __FUNCTION__, '2.8', 'get_cat_name()' );
  1126. return get_cat_name( $cat_ID );
  1127. }
  1128. /**
  1129. * Retrieve category children list separated before and after the term IDs.
  1130. *
  1131. * @since 1.2.0
  1132. * @deprecated 2.8
  1133. * @deprecated Use get_term_children()
  1134. * @see get_term_children()
  1135. *
  1136. * @param int $id Category ID to retrieve children.
  1137. * @param string $before Optional. Prepend before category term ID.
  1138. * @param string $after Optional, default is empty string. Append after category term ID.
  1139. * @param array $visited Optional. Category Term IDs that have already been added.
  1140. * @return string
  1141. */
  1142. function get_category_children( $id, $before = '/', $after = '', $visited = array() ) {
  1143. _deprecated_function( __FUNCTION__, '2.8', 'get_term_children()' );
  1144. if ( 0 == $id )
  1145. return '';
  1146. $chain = '';
  1147. /** TODO: consult hierarchy */
  1148. $cat_ids = get_all_category_ids();
  1149. foreach ( (array) $cat_ids as $cat_id ) {
  1150. if ( $cat_id == $id )
  1151. continue;
  1152. $category = get_category( $cat_id );
  1153. if ( is_wp_error( $category ) )
  1154. return $category;
  1155. if ( $category->parent == $id && !in_array( $category->term_id, $visited ) ) {
  1156. $visited[] = $category->term_id;
  1157. $chain .= $before.$category->term_id.$after;
  1158. $chain .= get_category_children( $category->term_id, $before, $after );
  1159. }
  1160. }
  1161. return $chain;
  1162. }
  1163. /**
  1164. * Retrieve the description of the author of the current post.
  1165. *
  1166. * @since 1.5
  1167. * @deprecated 2.8
  1168. * @deprecated Use get_the_author_meta('description')
  1169. * @see get_the_author_meta()
  1170. *
  1171. * @return string The author's description.
  1172. */
  1173. function get_the_author_description() {
  1174. _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'description\')' );
  1175. return get_the_author_meta('description');
  1176. }
  1177. /**
  1178. * Display the description of the author of the current post.
  1179. *
  1180. * @since 1.0.0
  1181. * @deprecated 2.8
  1182. * @deprecated Use the_author_meta('description')
  1183. * @see the_author_meta()
  1184. */
  1185. function the_author_description() {
  1186. _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'description\')' );
  1187. the_author_meta('description');
  1188. }
  1189. /**
  1190. * Retrieve the login name of the author of the current post.
  1191. *
  1192. * @since 1.5
  1193. * @deprecated 2.8
  1194. * @deprecated Use get_the_author_meta('login')
  1195. * @see get_the_author_meta()
  1196. *
  1197. * @return string The author's login name (username).
  1198. */
  1199. function get_the_author_login() {
  1200. _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'login\')' );
  1201. return get_the_author_meta('login');
  1202. }
  1203. /**
  1204. * Display the login name of the author of the current post.
  1205. *
  1206. * @since 0.71
  1207. * @deprecated 2.8
  1208. * @deprecated Use the_author_meta('login')
  1209. * @see the_author_meta()
  1210. */
  1211. function the_author_login() {
  1212. _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'login\')' );
  1213. the_author_meta('login');
  1214. }
  1215. /**
  1216. * Retrieve the first name of the author of the current post.
  1217. *
  1218. * @since 1.5
  1219. * @deprecated 2.8
  1220. * @deprecated Use get_the_author_meta('first_name')
  1221. * @see get_the_author_meta()
  1222. *
  1223. * @return string The author's first name.
  1224. */
  1225. function get_the_author_firstname() {
  1226. _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'first_name\')' );
  1227. return get_the_author_meta('first_name');
  1228. }
  1229. /**
  1230. * Display the first name of the author of the current post.
  1231. *
  1232. * @since 0.71
  1233. * @deprecated 2.8
  1234. * @deprecated Use the_author_meta('first_name')
  1235. * @see the_author_meta()
  1236. */
  1237. function the_author_firstname() {
  1238. _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'first_name\')' );
  1239. the_author_meta('first_name');
  1240. }
  1241. /**
  1242. * Retrieve the last name of the author of the current post.
  1243. *
  1244. * @since 1.5
  1245. * @deprecated 2.8
  1246. * @deprecated Use get_the_author_meta('last_name')
  1247. * @see get_the_author_meta()
  1248. *
  1249. * @return string The author's last name.
  1250. */
  1251. function get_the_author_lastname() {
  1252. _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'last_name\')' );
  1253. return get_the_author_meta('last_name');
  1254. }
  1255. /**
  1256. * Display the last name of the author of the current post.
  1257. *
  1258. * @since 0.71
  1259. * @deprecated 2.8
  1260. * @deprecated Use the_author_meta('last_name')
  1261. * @see the_author_meta()
  1262. */
  1263. function the_author_lastname() {
  1264. _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'last_name\')' );
  1265. the_author_meta('last_name');
  1266. }
  1267. /**
  1268. * Retrieve the nickname of the author of the current post.
  1269. *
  1270. * @since 1.5
  1271. * @deprecated 2.8
  1272. * @deprecated Use get_the_author_meta('nickname')
  1273. * @see get_the_author_meta()
  1274. *
  1275. * @return string The author's nickname.
  1276. */
  1277. function get_the_author_nickname() {
  1278. _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'nickname\')' );
  1279. return get_the_author_meta('nickname');
  1280. }
  1281. /**
  1282. * Display the nickname of the author of the current post.
  1283. *
  1284. * @since 0.71
  1285. * @deprecated 2.8
  1286. * @deprecated Use the_author_meta('nickname')
  1287. * @see the_author_meta()
  1288. */
  1289. function the_author_nickname() {
  1290. _deprecated_function( __FUNCTION__, '2.8', '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
  1297. * @deprecated 2.8
  1298. * @deprecated Use get_the_author_meta('email')
  1299. * @see get_the_author_meta()
  1300. *
  1301. * @return string The author's username.
  1302. */
  1303. function get_the_author_email() {
  1304. _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'email\')' );
  1305. return get_the_author_meta('email');
  1306. }
  1307. /**
  1308. * Display the email of the author of the current post.
  1309. *
  1310. * @since 0.71
  1311. * @deprecated 2.8
  1312. * @deprecated Use the_author_meta('email')
  1313. * @see the_author_meta()
  1314. */
  1315. function the_author_email() {
  1316. _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'email\')' );
  1317. the_author_meta('email');
  1318. }
  1319. /**
  1320. * Retrieve the ICQ number of the author of the current post.
  1321. *
  1322. * @since 1.5
  1323. * @deprecated 2.8
  1324. * @deprecated Use get_the_author_meta('icq')
  1325. * @see get_the_author_meta()
  1326. *
  1327. * @return string The author's ICQ number.
  1328. */
  1329. function get_the_author_icq() {
  1330. _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'icq\')' );
  1331. return get_the_author_meta('icq');
  1332. }
  1333. /**
  1334. * Display the ICQ number of the author of the current post.
  1335. *
  1336. * @since 0.71
  1337. * @deprecated 2.8
  1338. * @deprecated Use the_author_meta('icq')
  1339. * @see the_author_meta()
  1340. */
  1341. function the_author_icq() {
  1342. _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'icq\')' );
  1343. the_author_meta('icq');
  1344. }
  1345. /**
  1346. * Retrieve the Yahoo! IM name of the author of the current post.
  1347. *
  1348. * @since 1.5
  1349. * @deprecated 2.8
  1350. * @deprecated Use get_the_author_meta('yim')
  1351. * @see get_the_author_meta()
  1352. *
  1353. * @return string The author's Yahoo! IM name.
  1354. */
  1355. function get_the_author_yim() {
  1356. _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'yim\')' );
  1357. return get_the_author_meta('yim');
  1358. }
  1359. /**
  1360. * Display the Yahoo! IM name of the author of the current post.
  1361. *
  1362. * @since 0.71
  1363. * @deprecated 2.8
  1364. * @deprecated Use the_author_meta('yim')
  1365. * @see the_author_meta()
  1366. */
  1367. function the_author_yim() {
  1368. _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'yim\')' );
  1369. the_author_meta('yim');
  1370. }
  1371. /**
  1372. * Retrieve the MSN address of the author of the current post.
  1373. *
  1374. * @since 1.5
  1375. * @deprecated 2.8
  1376. * @deprecated Use get_the_author_meta('msn')
  1377. * @see get_the_author_meta()
  1378. *
  1379. * @return string The author's MSN address.
  1380. */
  1381. function get_the_author_msn() {
  1382. _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'msn\')' );
  1383. return get_the_author_meta('msn');
  1384. }
  1385. /**
  1386. * Display the MSN address of the author of the current post.
  1387. *
  1388. * @since 0.71
  1389. * @deprecated 2.8
  1390. * @deprecated Use the_author_meta('msn')
  1391. * @see the_author_meta()
  1392. */
  1393. function the_author_msn() {
  1394. _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'msn\')' );
  1395. the_author_meta('msn');
  1396. }
  1397. /**
  1398. * Retrieve the AIM address of the author of the current post.
  1399. *
  1400. * @since 1.5
  1401. * @deprecated 2.8
  1402. * @deprecated Use get_the_author_meta('aim')
  1403. * @see get_the_author_meta()
  1404. *
  1405. * @return string The author's AIM address.
  1406. */
  1407. function get_the_author_aim() {
  1408. _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'aim\')' );
  1409. return get_the_author_meta('aim');
  1410. }
  1411. /**
  1412. * Display the AIM address of the author of the current post.
  1413. *
  1414. * @since 0.71
  1415. * @see the_author_meta()
  1416. * @deprecated 2.8
  1417. * @deprecated Use the_author_meta('aim')
  1418. */
  1419. function the_author_aim() {
  1420. _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'aim\')' );
  1421. the_author_meta('aim');
  1422. }
  1423. /**
  1424. * Retrieve the specified author's preferred display name.
  1425. *
  1426. * @since 1.0.0
  1427. * @deprecated 2.8
  1428. * @deprecated Use get_the_author_meta('display_name')
  1429. * @see get_the_author_meta()
  1430. *
  1431. * @param int $auth_id The ID of the author.
  1432. * @return string The author's display name.
  1433. */
  1434. function get_author_name( $auth_id = false ) {
  1435. _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'display_name\')' );
  1436. return get_the_author_meta('display_name', $auth_id);
  1437. }
  1438. /**
  1439. * Retrieve the URL to the home page of the author of the current post.
  1440. *
  1441. * @since 1.5
  1442. * @deprecated 2.8
  1443. * @deprecated Use get_the_author_meta('url')
  1444. * @see get_the_author_meta()
  1445. *
  1446. * @return string The URL to the author's page.
  1447. */
  1448. function get_the_author_url() {
  1449. _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'url\')' );
  1450. return get_the_author_meta('url');
  1451. }
  1452. /**
  1453. * Display the URL to the home page of the author of the current post.
  1454. *
  1455. * @since 0.71
  1456. * @deprecated 2.8
  1457. * @deprecated Use the_author_meta('url')
  1458. * @see the_author_meta()
  1459. */
  1460. function the_author_url() {
  1461. _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'url\')' );
  1462. the_author_meta('url');
  1463. }
  1464. /**
  1465. * Retrieve the ID of the author of the current post.
  1466. *
  1467. * @since 1.5
  1468. * @deprecated 2.8
  1469. * @deprecated Use get_the_author_meta('ID')
  1470. * @see get_the_author_meta()
  1471. *
  1472. * @return int The author's ID.
  1473. */
  1474. function get_the_author_ID() {
  1475. _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'ID\')' );
  1476. return get_the_author_meta('ID');
  1477. }
  1478. /**
  1479. * Display the ID of the author of the current post.
  1480. *
  1481. * @since 0.71
  1482. * @deprecated 2.8
  1483. * @deprecated Use the_author_meta('ID')
  1484. * @see the_author_meta()
  1485. */
  1486. function the_author_ID() {
  1487. _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'ID\')' );
  1488. the_author_meta('ID');
  1489. }
  1490. /**
  1491. * Display the post content for the feed.
  1492. *
  1493. * For encoding the html or the $encode_html parameter, there are three possible
  1494. * values. '0' will make urls footnotes and use make_url_footnote(). '1' will
  1495. * encode special characters and automatically display all of the content. The
  1496. * value of '2' will strip all HTML tags from the content.
  1497. *
  1498. * Also note that you cannot set the amount of words and not set the html
  1499. * encoding. If that is the case, then the html encoding will default to 2,
  1500. * which will strip all HTML tags.
  1501. *
  1502. * To restrict the amount of words of the content, you can use the cut
  1503. * parameter. If the content is less than the amount, then there won't be any
  1504. * dots added to the end. If there is content left over, then dots will be added
  1505. * and the rest of the content will be removed.
  1506. *
  1507. * @package WordPress
  1508. * @subpackage Feed
  1509. * @since 0.71
  1510. * @uses apply_filters() Calls 'the_content_rss' on the content before processing.
  1511. *
  1512. * @deprecated 2.9.0
  1513. * @deprecated Use the_content_feed()
  1514. * @see the_content_feed()
  1515. *
  1516. * @param string $more_link_text Optional. Text to display when more content is available but not displayed.
  1517. * @param int|bool $stripteaser Optional. Default is 0.
  1518. * @param string $more_file Optional.
  1519. * @param int $cut Optional. Amount of words to keep for the content.
  1520. * @param int $encode_html Optional. How to encode the content.
  1521. */
  1522. function the_content_rss($more_link_text='(more...)', $stripteaser=0, $more_file='', $cut = 0, $encode_html = 0) {
  1523. _deprecated_function( __FUNCTION__, '2.9', 'the_content_feed' );
  1524. $content = get_the_content($more_link_text, $stripteaser);
  1525. $content = apply_filters('the_content_rss', $content);
  1526. if ( $cut && !$encode_html )
  1527. $encode_html = 2;
  1528. if ( 1== $encode_html ) {
  1529. $content = esc_html($content);
  1530. $cut = 0;
  1531. } elseif ( 0 == $encode_html ) {
  1532. $content = make_url_footnote($content);
  1533. } elseif ( 2 == $encode_html ) {
  1534. $content = strip_tags($content);
  1535. }
  1536. if ( $cut ) {
  1537. $blah = explode(' ', $content);
  1538. if ( count($blah) > $cut ) {
  1539. $k = $cut;
  1540. $use_dotdotdot = 1;
  1541. } else {
  1542. $k = count($blah);
  1543. $use_dotdotdot = 0;
  1544. }
  1545. /** @todo Check performance, might be faster to use array slice instead. */
  1546. for ( $i=0; $i<$k; $i++ )
  1547. $excerpt .= $blah[$i].' ';
  1548. $excerpt .= ($use_dotdotdot) ? '...' : '';
  1549. $content = $excerpt;
  1550. }
  1551. $content = str_replace(']]>', ']]&gt;', $content);
  1552. echo $content;
  1553. }
  1554. /**
  1555. * Strip HTML and put links at the bottom of stripped content.
  1556. *
  1557. * Searches for all of the links, strips them out of the content, and places
  1558. * them at the bottom of the content with numbers.
  1559. *
  1560. * @since 0.71
  1561. * @deprecated 2.9.0
  1562. *
  1563. * @param string $content Content to get links
  1564. * @return string HTML stripped out of content with links at the bottom.
  1565. */
  1566. function make_url_footnote( $content ) {
  1567. _deprecated_function( __FUNCTION__, '2.9', '' );
  1568. preg_match_all( '/<a(.+?)href=\"(.+?)\"(.*?)>(.+?)<\/a>/', $content, $matches );
  1569. $links_summary = "\n";
  1570. for ( $i=0; $i<count($matches[0]); $i++ ) {
  1571. $link_match = $matches[0][$i];
  1572. $link_number = '['.($i+1).']';
  1573. $link_url = $matches[2][$i];
  1574. $link_text = $matches[4][$i];
  1575. $content = str_replace( $link_match, $link_text . ' ' . $link_number, $content );
  1576. $link_url = ( ( strtolower( substr( $link_url, 0, 7 ) ) != 'http://' ) && ( strtolower( substr( $link_url, 0, 8 ) ) != 'https://' ) ) ? get_option( 'home' ) . $link_url : $link_url;
  1577. $links_summary .= "\n" . $link_number . ' ' . $link_url;
  1578. }
  1579. $content = strip_tags( $content );
  1580. $content .= $links_summar