PageRenderTime 49ms CodeModel.GetById 13ms RepoModel.GetById 0ms app.codeStats 0ms

/wp-includes/deprecated.php

https://github.com/schr/wordpress
PHP | 1341 lines | 464 code | 161 blank | 716 comment | 93 complexity | fa190e3a028354224204cb31505792a1 MD5 | raw file
  1. <?php
  2. /**
  3. * Deprecated functions from past WordPress versions. You shouldn't use these
  4. * globals and functions and look for the alternatives instead. The functions
  5. * and globals will be removed in a later version.
  6. *
  7. * @package WordPress
  8. * @subpackage Deprecated
  9. */
  10. /*
  11. * Deprecated global variables.
  12. */
  13. /**
  14. * The name of the Posts table
  15. * @global string $tableposts
  16. * @deprecated Use $wpdb->posts
  17. */
  18. $tableposts = $wpdb->posts;
  19. /**
  20. * The name of the Users table
  21. * @global string $tableusers
  22. * @deprecated Use $wpdb->users
  23. */
  24. $tableusers = $wpdb->users;
  25. /**
  26. * The name of the Categories table
  27. * @global string $tablecategories
  28. * @deprecated Use $wpdb->categories
  29. */
  30. $tablecategories = $wpdb->categories;
  31. /**
  32. * The name of the post to category table
  33. * @global string $tablepost2cat
  34. * @deprecated Use $wpdb->post2cat;
  35. */
  36. $tablepost2cat = $wpdb->post2cat;
  37. /**
  38. * The name of the comments table
  39. * @global string $tablecomments
  40. * @deprecated Use $wpdb->comments;
  41. */
  42. $tablecomments = $wpdb->comments;
  43. /**
  44. * The name of the links table
  45. * @global string $tablelinks
  46. * @deprecated Use $wpdb->links;
  47. */
  48. $tablelinks = $wpdb->links;
  49. /**
  50. * @global string $tablelinkcategories
  51. * @deprecated Not used anymore;
  52. */
  53. $tablelinkcategories = 'linkcategories_is_gone';
  54. /**
  55. * The name of the options table
  56. * @global string $tableoptions
  57. * @deprecated Use $wpdb->options;
  58. */
  59. $tableoptions = $wpdb->options;
  60. /**
  61. * The name of the postmeta table
  62. * @global string $tablepostmeta
  63. * @deprecated Use $wpdb->postmeta;
  64. */
  65. $tablepostmeta = $wpdb->postmeta;
  66. /*
  67. * Deprecated functions come here to die.
  68. */
  69. /**
  70. * Entire Post data.
  71. *
  72. * @since 0.71
  73. * @deprecated Use get_post()
  74. * @see get_post()
  75. *
  76. * @param int $postid
  77. * @return array
  78. */
  79. function get_postdata($postid) {
  80. _deprecated_function(__FUNCTION__, '0.0', 'get_post()');
  81. $post = &get_post($postid);
  82. $postdata = array (
  83. 'ID' => $post->ID,
  84. 'Author_ID' => $post->post_author,
  85. 'Date' => $post->post_date,
  86. 'Content' => $post->post_content,
  87. 'Excerpt' => $post->post_excerpt,
  88. 'Title' => $post->post_title,
  89. 'Category' => $post->post_category,
  90. 'post_status' => $post->post_status,
  91. 'comment_status' => $post->comment_status,
  92. 'ping_status' => $post->ping_status,
  93. 'post_password' => $post->post_password,
  94. 'to_ping' => $post->to_ping,
  95. 'pinged' => $post->pinged,
  96. 'post_type' => $post->post_type,
  97. 'post_name' => $post->post_name
  98. );
  99. return $postdata;
  100. }
  101. /**
  102. * Sets up the WordPress Loop.
  103. *
  104. * @since 1.0.1
  105. * @deprecated Since 1.5 - {@link http://codex.wordpress.org/The_Loop Use new WordPress Loop}
  106. */
  107. function start_wp() {
  108. global $wp_query, $post;
  109. _deprecated_function(__FUNCTION__, '1.5', __('new WordPress Loop') );
  110. // Since the old style loop is being used, advance the query iterator here.
  111. $wp_query->next_post();
  112. setup_postdata($post);
  113. }
  114. /**
  115. * Return or Print Category ID.
  116. *
  117. * @since 0.71
  118. * @deprecated use get_the_category()
  119. * @see get_the_category()
  120. *
  121. * @param bool $echo
  122. * @return null|int
  123. */
  124. function the_category_ID($echo = true) {
  125. _deprecated_function(__FUNCTION__, '0.0', 'get_the_category()');
  126. // Grab the first cat in the list.
  127. $categories = get_the_category();
  128. $cat = $categories[0]->term_id;
  129. if ( $echo )
  130. echo $cat;
  131. return $cat;
  132. }
  133. /**
  134. * Print category with optional text before and after.
  135. *
  136. * @since 0.71
  137. * @deprecated use get_the_category_by_ID()
  138. * @see get_the_category_by_ID()
  139. *
  140. * @param string $before
  141. * @param string $after
  142. */
  143. function the_category_head($before='', $after='') {
  144. global $currentcat, $previouscat;
  145. _deprecated_function(__FUNCTION__, '0.0', 'get_the_category_by_ID()');
  146. // Grab the first cat in the list.
  147. $categories = get_the_category();
  148. $currentcat = $categories[0]->category_id;
  149. if ( $currentcat != $previouscat ) {
  150. echo $before;
  151. echo get_the_category_by_ID($currentcat);
  152. echo $after;
  153. $previouscat = $currentcat;
  154. }
  155. }
  156. /**
  157. * Prints link to the previous post.
  158. *
  159. * @since 1.5
  160. * @deprecated Use previous_post_link()
  161. * @see previous_post_link()
  162. *
  163. * @param string $format
  164. * @param string $previous
  165. * @param string $title
  166. * @param string $in_same_cat
  167. * @param int $limitprev
  168. * @param string $excluded_categories
  169. */
  170. function previous_post($format='%', $previous='previous post: ', $title='yes', $in_same_cat='no', $limitprev=1, $excluded_categories='') {
  171. _deprecated_function(__FUNCTION__, '0.0', 'previous_post_link()');
  172. if ( empty($in_same_cat) || 'no' == $in_same_cat )
  173. $in_same_cat = false;
  174. else
  175. $in_same_cat = true;
  176. $post = get_previous_post($in_same_cat, $excluded_categories);
  177. if ( !$post )
  178. return;
  179. $string = '<a href="'.get_permalink($post->ID).'">'.$previous;
  180. if ( 'yes' == $title )
  181. $string .= apply_filters('the_title', $post->post_title, $post);
  182. $string .= '</a>';
  183. $format = str_replace('%', $string, $format);
  184. echo $format;
  185. }
  186. /**
  187. * Prints link to the next post.
  188. *
  189. * @since 0.71
  190. * @deprecated Use next_post_link()
  191. * @see next_post_link()
  192. *
  193. * @param string $format
  194. * @param string $previous
  195. * @param string $title
  196. * @param string $in_same_cat
  197. * @param int $limitprev
  198. * @param string $excluded_categories
  199. */
  200. function next_post($format='%', $next='next post: ', $title='yes', $in_same_cat='no', $limitnext=1, $excluded_categories='') {
  201. _deprecated_function(__FUNCTION__, '0.0', 'next_post_link()');
  202. if ( empty($in_same_cat) || 'no' == $in_same_cat )
  203. $in_same_cat = false;
  204. else
  205. $in_same_cat = true;
  206. $post = get_next_post($in_same_cat, $excluded_categories);
  207. if ( !$post )
  208. return;
  209. $string = '<a href="'.get_permalink($post->ID).'">'.$next;
  210. if ( 'yes' == $title )
  211. $string .= apply_filters('the_title', $post->post_title, $nextpost);
  212. $string .= '</a>';
  213. $format = str_replace('%', $string, $format);
  214. echo $format;
  215. }
  216. /**
  217. * Whether user can create a post.
  218. *
  219. * @since 1.5
  220. * @deprecated Use current_user_can()
  221. * @see current_user_can()
  222. *
  223. * @param int $user_id
  224. * @param int $blog_id Not Used
  225. * @param int $category_id Not Used
  226. * @return bool
  227. */
  228. function user_can_create_post($user_id, $blog_id = 1, $category_id = 'None') {
  229. _deprecated_function(__FUNCTION__, '0.0', 'current_user_can()');
  230. $author_data = get_userdata($user_id);
  231. return ($author_data->user_level > 1);
  232. }
  233. /**
  234. * Whether user can create a post.
  235. *
  236. * @since 1.5
  237. * @deprecated Use current_user_can()
  238. * @see current_user_can()
  239. *
  240. * @param int $user_id
  241. * @param int $blog_id Not Used
  242. * @param int $category_id Not Used
  243. * @return bool
  244. */
  245. function user_can_create_draft($user_id, $blog_id = 1, $category_id = 'None') {
  246. _deprecated_function(__FUNCTION__, '0.0', 'current_user_can()');
  247. $author_data = get_userdata($user_id);
  248. return ($author_data->user_level >= 1);
  249. }
  250. /**
  251. * Whether user can edit a post.
  252. *
  253. * @since 1.5
  254. * @deprecated Use current_user_can()
  255. * @see current_user_can()
  256. *
  257. * @param int $user_id
  258. * @param int $post_id
  259. * @param int $blog_id Not Used
  260. * @return bool
  261. */
  262. function user_can_edit_post($user_id, $post_id, $blog_id = 1) {
  263. _deprecated_function(__FUNCTION__, '0', 'current_user_can()');
  264. $author_data = get_userdata($user_id);
  265. $post = get_post($post_id);
  266. $post_author_data = get_userdata($post->post_author);
  267. if ( (($user_id == $post_author_data->ID) && !($post->post_status == 'publish' && $author_data->user_level < 2))
  268. || ($author_data->user_level > $post_author_data->user_level)
  269. || ($author_data->user_level >= 10) ) {
  270. return true;
  271. } else {
  272. return false;
  273. }
  274. }
  275. /**
  276. * Whether user can delete a post.
  277. *
  278. * @since 1.5
  279. * @deprecated Use current_user_can()
  280. * @see current_user_can()
  281. *
  282. * @param int $user_id
  283. * @param int $post_id
  284. * @param int $blog_id Not Used
  285. * @return bool
  286. */
  287. function user_can_delete_post($user_id, $post_id, $blog_id = 1) {
  288. _deprecated_function(__FUNCTION__, '0.0', 'current_user_can()');
  289. // right now if one can edit, one can delete
  290. return user_can_edit_post($user_id, $post_id, $blog_id);
  291. }
  292. /**
  293. * Whether user can set new posts' dates.
  294. *
  295. * @since 1.5
  296. * @deprecated Use current_user_can()
  297. * @see current_user_can()
  298. *
  299. * @param int $user_id
  300. * @param int $blog_id Not Used
  301. * @param int $category_id Not Used
  302. * @return bool
  303. */
  304. function user_can_set_post_date($user_id, $blog_id = 1, $category_id = 'None') {
  305. _deprecated_function(__FUNCTION__, '0.0', 'current_user_can()');
  306. $author_data = get_userdata($user_id);
  307. return (($author_data->user_level > 4) && user_can_create_post($user_id, $blog_id, $category_id));
  308. }
  309. /**
  310. * Whether user can delete a post.
  311. *
  312. * @since 1.5
  313. * @deprecated Use current_user_can()
  314. * @see current_user_can()
  315. *
  316. * @param int $user_id
  317. * @param int $post_id
  318. * @param int $blog_id Not Used
  319. * @return bool returns true if $user_id can edit $post_id's date
  320. */
  321. function user_can_edit_post_date($user_id, $post_id, $blog_id = 1) {
  322. _deprecated_function(__FUNCTION__, '0.0', 'current_user_can()');
  323. $author_data = get_userdata($user_id);
  324. return (($author_data->user_level > 4) && user_can_edit_post($user_id, $post_id, $blog_id));
  325. }
  326. /**
  327. * Whether user can delete a post.
  328. *
  329. * @since 1.5
  330. * @deprecated Use current_user_can()
  331. * @see current_user_can()
  332. *
  333. * @param int $user_id
  334. * @param int $post_id
  335. * @param int $blog_id Not Used
  336. * @return bool returns true if $user_id can edit $post_id's comments
  337. */
  338. function user_can_edit_post_comments($user_id, $post_id, $blog_id = 1) {
  339. _deprecated_function(__FUNCTION__, '0.0', 'current_user_can()');
  340. // right now if one can edit a post, one can edit comments made on it
  341. return user_can_edit_post($user_id, $post_id, $blog_id);
  342. }
  343. /**
  344. * Whether user can delete a post.
  345. *
  346. * @since 1.5
  347. * @deprecated Use current_user_can()
  348. * @see current_user_can()
  349. *
  350. * @param int $user_id
  351. * @param int $post_id
  352. * @param int $blog_id Not Used
  353. * @return bool returns true if $user_id can delete $post_id's comments
  354. */
  355. function user_can_delete_post_comments($user_id, $post_id, $blog_id = 1) {
  356. _deprecated_function(__FUNCTION__, '0.0', 'current_user_can()');
  357. // right now if one can edit comments, one can delete comments
  358. return user_can_edit_post_comments($user_id, $post_id, $blog_id);
  359. }
  360. /**
  361. * Can user can edit other user.
  362. *
  363. * @since 1.5
  364. * @deprecated Use current_user_can()
  365. * @see current_user_can()
  366. *
  367. * @param int $user_id
  368. * @param int $other_user
  369. * @return bool
  370. */
  371. function user_can_edit_user($user_id, $other_user) {
  372. _deprecated_function(__FUNCTION__, '0.0', 'current_user_can()');
  373. $user = get_userdata($user_id);
  374. $other = get_userdata($other_user);
  375. if ( $user->user_level > $other->user_level || $user->user_level > 8 || $user->ID == $other->ID )
  376. return true;
  377. else
  378. return false;
  379. }
  380. /**
  381. * Gets the links associated with category $cat_name.
  382. *
  383. * @since 0.71
  384. * @deprecated Use get_links()
  385. * @see get_links()
  386. *
  387. * @param string $cat_name Optional. The category name to use. If no match is found uses all.
  388. * @param string $before Optional. The html to output before the link.
  389. * @param string $after Optional. The html to output after the link.
  390. * @param string $between Optional. The html to output between the link/image and it's description. Not used if no image or $show_images is true.
  391. * @param bool $show_images Optional. Whether to show images (if defined).
  392. * @param string $orderby Optional. The order to output the links. E.g. 'id', 'name', 'url', 'description' or 'rating'. Or maybe owner.
  393. * 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
  394. * random order.
  395. * @param bool $show_description Optional. Whether to show the description if show_images=false/not defined.
  396. * @param bool $show_rating Optional. Show rating stars/chars.
  397. * @param int $limit Optional. Limit to X entries. If not specified, all entries are shown.
  398. * @param int $show_updated Optional. Whether to show last updated timestamp
  399. */
  400. function get_linksbyname($cat_name = "noname", $before = '', $after = '<br />', $between = " ", $show_images = true, $orderby = 'id',
  401. $show_description = true, $show_rating = false,
  402. $limit = -1, $show_updated = 0) {
  403. _deprecated_function(__FUNCTION__, '0.0', 'get_links()');
  404. $cat_id = -1;
  405. $cat = get_term_by('name', $cat_name, 'link_category');
  406. if ( $cat )
  407. $cat_id = $cat->term_id;
  408. get_links($cat_id, $before, $after, $between, $show_images, $orderby, $show_description, $show_rating, $limit, $show_updated);
  409. }
  410. /**
  411. * Gets the links associated with the named category.
  412. *
  413. * @since 1.0.1
  414. * @deprecated Use wp_get_links()
  415. * @see wp_get_links()
  416. *
  417. * @param string $category The category to use.
  418. * @param string $args
  419. * @return bool|null
  420. */
  421. function wp_get_linksbyname($category, $args = '') {
  422. _deprecated_function(__FUNCTION__, '0.0', 'wp_get_links()');
  423. $cat = get_term_by('name', $category, 'link_category');
  424. if ( !$cat )
  425. return false;
  426. $cat_id = $cat->term_id;
  427. $args = add_query_arg('category', $cat_id, $args);
  428. wp_get_links($args);
  429. }
  430. /**
  431. * Gets an array of link objects associated with category $cat_name.
  432. *
  433. * <code>
  434. * $links = get_linkobjectsbyname('fred');
  435. * foreach ($links as $link) {
  436. * echo '<li>'.$link->link_name.'</li>';
  437. * }
  438. * </code>
  439. *
  440. * @since 1.0.1
  441. * @deprecated Use get_linkobjects()
  442. * @see get_linkobjects()
  443. *
  444. * @param string $cat_name The category name to use. If no match is found uses all.
  445. * @param string $orderby The order to output the links. E.g. 'id', 'name', 'url', 'description', or 'rating'.
  446. * Or maybe owner. If you start the name with an underscore the order will be reversed. You can also
  447. * specify 'rand' as the order which will return links in a random order.
  448. * @param int $limit Limit to X entries. If not specified, all entries are shown.
  449. * @return unknown
  450. */
  451. function get_linkobjectsbyname($cat_name = "noname" , $orderby = 'name', $limit = -1) {
  452. _deprecated_function(__FUNCTION__, '0.0', 'get_linkobjects()');
  453. $cat_id = -1;
  454. $cat = get_term_by('name', $cat_name, 'link_category');
  455. if ( $cat )
  456. $cat_id = $cat->term_id;
  457. return get_linkobjects($cat_id, $orderby, $limit);
  458. }
  459. /**
  460. * Gets an array of link objects associated with category n.
  461. *
  462. * Usage:
  463. * <code>
  464. * $links = get_linkobjects(1);
  465. * if ($links) {
  466. * foreach ($links as $link) {
  467. * echo '<li>'.$link->link_name.'<br />'.$link->link_description.'</li>';
  468. * }
  469. * }
  470. * </code>
  471. *
  472. * Fields are:
  473. * <ol>
  474. * <li>link_id</li>
  475. * <li>link_url</li>
  476. * <li>link_name</li>
  477. * <li>link_image</li>
  478. * <li>link_target</li>
  479. * <li>link_category</li>
  480. * <li>link_description</li>
  481. * <li>link_visible</li>
  482. * <li>link_owner</li>
  483. * <li>link_rating</li>
  484. * <li>link_updated</li>
  485. * <li>link_rel</li>
  486. * <li>link_notes</li>
  487. * </ol>
  488. *
  489. * @since 1.0.1
  490. * @deprecated Use get_bookmarks()
  491. * @see get_bookmarks()
  492. *
  493. * @param int $category The category to use. If no category supplied uses all
  494. * @param string $orderby the order to output the links. E.g. 'id', 'name', 'url',
  495. * 'description', or 'rating'. Or maybe owner. If you start the name with an
  496. * underscore the order will be reversed. You can also specify 'rand' as the
  497. * order which will return links in a random order.
  498. * @param int $limit Limit to X entries. If not specified, all entries are shown.
  499. * @return unknown
  500. */
  501. function get_linkobjects($category = 0, $orderby = 'name', $limit = 0) {
  502. _deprecated_function(__FUNCTION__, '0.0', 'get_bookmarks()');
  503. $links = get_bookmarks("category=$category&orderby=$orderby&limit=$limit");
  504. $links_array = array();
  505. foreach ($links as $link)
  506. $links_array[] = $link;
  507. return $links_array;
  508. }
  509. /**
  510. * Gets the links associated with category 'cat_name' and display rating stars/chars.
  511. *
  512. * @since 0.71
  513. * @deprecated Use get_bookmarks()
  514. * @see get_bookmarks()
  515. *
  516. * @param string $cat_name The category name to use. If no match is found uses all
  517. * @param string $before The html to output before the link
  518. * @param string $after The html to output after the link
  519. * @param string $between The html to output between the link/image and it's description. Not used if no image or show_images is true
  520. * @param bool $show_images Whether to show images (if defined).
  521. * @param string $orderby the order to output the links. E.g. 'id', 'name', 'url',
  522. * 'description', or 'rating'. Or maybe owner. If you start the name with an
  523. * underscore the order will be reversed. You can also specify 'rand' as the
  524. * order which will return links in a random order.
  525. * @param bool $show_description Whether to show the description if show_images=false/not defined
  526. * @param int $limit Limit to X entries. If not specified, all entries are shown.
  527. * @param int $show_updated Whether to show last updated timestamp
  528. */
  529. function get_linksbyname_withrating($cat_name = "noname", $before = '', $after = '<br />', $between = " ",
  530. $show_images = true, $orderby = 'id', $show_description = true, $limit = -1, $show_updated = 0) {
  531. _deprecated_function(__FUNCTION__, '0.0', 'get_bookmarks()');
  532. get_linksbyname($cat_name, $before, $after, $between, $show_images, $orderby, $show_description, true, $limit, $show_updated);
  533. }
  534. /**
  535. * Gets the links associated with category n and display rating stars/chars.
  536. *
  537. * @since 0.71
  538. * @deprecated Use get_bookmarks()
  539. * @see get_bookmarks()
  540. *
  541. * @param int $category The category to use. If no category supplied uses all
  542. * @param string $before The html to output before the link
  543. * @param string $after The html to output after the link
  544. * @param string $between The html to output between the link/image and it's description. Not used if no image or show_images == true
  545. * @param bool $show_images Whether to show images (if defined).
  546. * @param string $orderby The order to output the links. E.g. 'id', 'name', 'url',
  547. * 'description', or 'rating'. Or maybe owner. If you start the name with an
  548. * underscore the order will be reversed. You can also specify 'rand' as the
  549. * order which will return links in a random order.
  550. * @param bool $show_description Whether to show the description if show_images=false/not defined.
  551. * @param string $limit Limit to X entries. If not specified, all entries are shown.
  552. * @param int $show_updated Whether to show last updated timestamp
  553. */
  554. function get_links_withrating($category = -1, $before = '', $after = '<br />', $between = " ", $show_images = true,
  555. $orderby = 'id', $show_description = true, $limit = -1, $show_updated = 0) {
  556. _deprecated_function(__FUNCTION__, '0.0', 'get_bookmarks()');
  557. get_links($category, $before, $after, $between, $show_images, $orderby, $show_description, true, $limit, $show_updated);
  558. }
  559. /**
  560. * Gets the auto_toggle setting.
  561. *
  562. * @since 0.71
  563. * @deprecated No alternative function available
  564. *
  565. * @param int $id The category to get. If no category supplied uses 0
  566. * @return int Only returns 0.
  567. */
  568. function get_autotoggle($id = 0) {
  569. _deprecated_function(__FUNCTION__, '0.0' );
  570. return 0;
  571. }
  572. /**
  573. * @since 0.71
  574. * @deprecated Use wp_list_categories()
  575. * @see wp_list_categories()
  576. *
  577. * @param int $optionall
  578. * @param string $all
  579. * @param string $sort_column
  580. * @param string $sort_order
  581. * @param string $file
  582. * @param bool $list
  583. * @param int $optiondates
  584. * @param int $optioncount
  585. * @param int $hide_empty
  586. * @param int $use_desc_for_title
  587. * @param bool $children
  588. * @param int $child_of
  589. * @param int $categories
  590. * @param int $recurse
  591. * @param string $feed
  592. * @param string $feed_image
  593. * @param string $exclude
  594. * @param bool $hierarchical
  595. * @return unknown
  596. */
  597. function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_order = 'asc', $file = '', $list = true, $optiondates = 0,
  598. $optioncount = 0, $hide_empty = 1, $use_desc_for_title = 1, $children=false, $child_of=0, $categories=0,
  599. $recurse=0, $feed = '', $feed_image = '', $exclude = '', $hierarchical=false) {
  600. _deprecated_function(__FUNCTION__, '0.0', 'wp_list_categories()');
  601. $query = compact('optionall', 'all', 'sort_column', 'sort_order', 'file', 'list', 'optiondates', 'optioncount', 'hide_empty', 'use_desc_for_title', 'children',
  602. 'child_of', 'categories', 'recurse', 'feed', 'feed_image', 'exclude', 'hierarchical');
  603. return wp_list_cats($query);
  604. }
  605. /**
  606. * @since 1.2
  607. * @deprecated Use wp_list_categories()
  608. * @see wp_list_categories()
  609. *
  610. * @param string|array $args
  611. * @return unknown
  612. */
  613. function wp_list_cats($args = '') {
  614. _deprecated_function(__FUNCTION__, '0.0', 'wp_list_categories()');
  615. $r = wp_parse_args( $args );
  616. // Map to new names.
  617. if ( isset($r['optionall']) && isset($r['all']))
  618. $r['show_option_all'] = $r['all'];
  619. if ( isset($r['sort_column']) )
  620. $r['orderby'] = $r['sort_column'];
  621. if ( isset($r['sort_order']) )
  622. $r['order'] = $r['sort_order'];
  623. if ( isset($r['optiondates']) )
  624. $r['show_last_update'] = $r['optiondates'];
  625. if ( isset($r['optioncount']) )
  626. $r['show_count'] = $r['optioncount'];
  627. if ( isset($r['list']) )
  628. $r['style'] = $r['list'] ? 'list' : 'break';
  629. $r['title_li'] = '';
  630. return wp_list_categories($r);
  631. }
  632. /**
  633. * @since 0.71
  634. * @deprecated Use wp_dropdown_categories()
  635. * @see wp_dropdown_categories()
  636. *
  637. * @param int $optionall
  638. * @param string $all
  639. * @param string $orderby
  640. * @param string $order
  641. * @param int $show_last_update
  642. * @param int $show_count
  643. * @param int $hide_empty
  644. * @param bool $optionnone
  645. * @param int $selected
  646. * @param int $exclude
  647. * @return unknown
  648. */
  649. function dropdown_cats($optionall = 1, $all = 'All', $orderby = 'ID', $order = 'asc',
  650. $show_last_update = 0, $show_count = 0, $hide_empty = 1, $optionnone = false,
  651. $selected = 0, $exclude = 0) {
  652. _deprecated_function(__FUNCTION__, '0.0', 'wp_dropdown_categories()');
  653. $show_option_all = '';
  654. if ( $optionall )
  655. $show_option_all = $all;
  656. $show_option_none = '';
  657. if ( $optionnone )
  658. $show_option_none = __('None');
  659. $vars = compact('show_option_all', 'show_option_none', 'orderby', 'order',
  660. 'show_last_update', 'show_count', 'hide_empty', 'selected', 'exclude');
  661. $query = add_query_arg($vars, '');
  662. return wp_dropdown_categories($query);
  663. }
  664. /**
  665. * @since 2.1
  666. * @deprecated Use wp_tiny_mce().
  667. * @see wp_tiny_mce()
  668. */
  669. function tinymce_include() {
  670. _deprecated_function(__FUNCTION__, '0.0', 'wp_tiny_mce()');
  671. wp_tiny_mce();
  672. }
  673. /**
  674. * @since 1.2
  675. * @deprecated Use wp_list_authors()
  676. * @see wp_list_authors()
  677. *
  678. * @param bool $optioncount
  679. * @param bool $exclude_admin
  680. * @param bool $show_fullname
  681. * @param bool $hide_empty
  682. * @param string $feed
  683. * @param string $feed_image
  684. * @return unknown
  685. */
  686. function list_authors($optioncount = false, $exclude_admin = true, $show_fullname = false, $hide_empty = true, $feed = '', $feed_image = '') {
  687. _deprecated_function(__FUNCTION__, '0.0', 'wp_list_authors()');
  688. $args = compact('optioncount', 'exclude_admin', 'show_fullname', 'hide_empty', 'feed', 'feed_image');
  689. return wp_list_authors($args);
  690. }
  691. /**
  692. * @since 1.0.1
  693. * @deprecated Use wp_get_post_categories()
  694. * @see wp_get_post_categories()
  695. *
  696. * @param int $blogid Not Used
  697. * @param int $post_ID
  698. * @return unknown
  699. */
  700. function wp_get_post_cats($blogid = '1', $post_ID = 0) {
  701. _deprecated_function(__FUNCTION__, '0.0', 'wp_get_post_categories()');
  702. return wp_get_post_categories($post_ID);
  703. }
  704. /**
  705. * Sets the categories that the post id belongs to.
  706. *
  707. * @since 1.0.1
  708. * @deprecated Use wp_set_post_categories()
  709. * @see wp_set_post_categories()
  710. *
  711. * @param int $blogid Not used
  712. * @param int $post_ID
  713. * @param array $post_categories
  714. * @return unknown
  715. */
  716. function wp_set_post_cats($blogid = '1', $post_ID = 0, $post_categories = array()) {
  717. _deprecated_function(__FUNCTION__, '0.0', 'wp_set_post_categories()');
  718. return wp_set_post_categories($post_ID, $post_categories);
  719. }
  720. /**
  721. * @since 0.71
  722. * @deprecated Use wp_get_archives()
  723. * @see wp_get_archives()
  724. *
  725. * @param string $type
  726. * @param string $limit
  727. * @param string $format
  728. * @param string $before
  729. * @param string $after
  730. * @param bool $show_post_count
  731. * @return unknown
  732. */
  733. function get_archives($type='', $limit='', $format='html', $before = '', $after = '', $show_post_count = false) {
  734. _deprecated_function(__FUNCTION__, '0.0', 'wp_get_archives()');
  735. $args = compact('type', 'limit', 'format', 'before', 'after', 'show_post_count');
  736. return wp_get_archives($args);
  737. }
  738. /**
  739. * Returns or Prints link to the author's posts.
  740. *
  741. * @since 1.2
  742. * @deprecated Use get_author_posts_url()
  743. * @see get_author_posts_url()
  744. *
  745. * @param bool $echo Optional.
  746. * @param int $author_id Required.
  747. * @param string $author_nicename Optional.
  748. * @return string|null
  749. */
  750. function get_author_link($echo = false, $author_id, $author_nicename = '') {
  751. _deprecated_function(__FUNCTION__, '0.0', 'get_author_posts_url()');
  752. $link = get_author_posts_url($author_id, $author_nicename);
  753. if ( $echo )
  754. echo $link;
  755. return $link;
  756. }
  757. /**
  758. * Print list of pages based on arguments.
  759. *
  760. * @since 0.71
  761. * @deprecated Use wp_link_pages()
  762. * @see wp_link_pages()
  763. *
  764. * @param string $before
  765. * @param string $after
  766. * @param string $next_or_number
  767. * @param string $nextpagelink
  768. * @param string $previouspagelink
  769. * @param string $pagelink
  770. * @param string $more_file
  771. * @return string
  772. */
  773. function link_pages($before='<br />', $after='<br />', $next_or_number='number', $nextpagelink='next page', $previouspagelink='previous page',
  774. $pagelink='%', $more_file='') {
  775. _deprecated_function(__FUNCTION__, '0.0', 'wp_link_pages()');
  776. $args = compact('before', 'after', 'next_or_number', 'nextpagelink', 'previouspagelink', 'pagelink', 'more_file');
  777. return wp_link_pages($args);
  778. }
  779. /**
  780. * Get value based on option.
  781. *
  782. * @since 0.71
  783. * @deprecated Use get_option()
  784. * @see get_option()
  785. *
  786. * @param string $option
  787. * @return string
  788. */
  789. function get_settings($option) {
  790. _deprecated_function(__FUNCTION__, '0.0', 'get_option()');
  791. return get_option($option);
  792. }
  793. /**
  794. * Print the permalink of the current post in the loop.
  795. *
  796. * @since 0.71
  797. * @deprecated Use the_permalink()
  798. * @see the_permalink()
  799. */
  800. function permalink_link() {
  801. _deprecated_function(__FUNCTION__, '0.0', 'the_permalink()');
  802. the_permalink();
  803. }
  804. /**
  805. * Print the permalink to the RSS feed.
  806. *
  807. * @since 0.71
  808. * @deprecated Use the_permalink_rss()
  809. * @see the_permalink_rss()
  810. *
  811. * @param string $file
  812. */
  813. function permalink_single_rss($deprecated = '') {
  814. _deprecated_function(__FUNCTION__, '0.0', 'the_permalink_rss()');
  815. the_permalink_rss();
  816. }
  817. /**
  818. * Gets the links associated with category.
  819. *
  820. * @see get_links() for argument information that can be used in $args
  821. * @since 1.0.1
  822. * @deprecated Use get_bookmarks()
  823. * @see get_bookmarks()
  824. *
  825. * @param string $args a query string
  826. * @return null|string
  827. */
  828. function wp_get_links($args = '') {
  829. _deprecated_function(__FUNCTION__, '0.0', 'get_bookmarks()');
  830. if ( strpos( $args, '=' ) === false ) {
  831. $cat_id = $args;
  832. $args = add_query_arg( 'category', $cat_id, $args );
  833. }
  834. $defaults = array(
  835. 'category' => -1, 'before' => '',
  836. 'after' => '<br />', 'between' => ' ',
  837. 'show_images' => true, 'orderby' => 'name',
  838. 'show_description' => true, 'show_rating' => false,
  839. 'limit' => -1, 'show_updated' => true,
  840. 'echo' => true
  841. );
  842. $r = wp_parse_args( $args, $defaults );
  843. extract( $r, EXTR_SKIP );
  844. return get_links($category, $before, $after, $between, $show_images, $orderby, $show_description, $show_rating, $limit, $show_updated, $echo);
  845. }
  846. /**
  847. * Gets the links associated with category by id.
  848. *
  849. * @since 0.71
  850. * @deprecated Use get_bookmarks()
  851. * @see get_bookmarks()
  852. *
  853. * @param int $category The category to use. If no category supplied uses all
  854. * @param string $before the html to output before the link
  855. * @param string $after the html to output after the link
  856. * @param string $between the html to output between the link/image and its description.
  857. * Not used if no image or show_images == true
  858. * @param bool $show_images whether to show images (if defined).
  859. * @param string $orderby the order to output the links. E.g. 'id', 'name', 'url',
  860. * 'description', or 'rating'. Or maybe owner. If you start the name with an
  861. * underscore the order will be reversed. You can also specify 'rand' as the order
  862. * which will return links in a random order.
  863. * @param bool $show_description whether to show the description if show_images=false/not defined.
  864. * @param bool $show_rating show rating stars/chars
  865. * @param int $limit Limit to X entries. If not specified, all entries are shown.
  866. * @param int $show_updated whether to show last updated timestamp
  867. * @param bool $echo whether to echo the results, or return them instead
  868. * @return null|string
  869. */
  870. function get_links($category = -1, $before = '', $after = '<br />', $between = ' ', $show_images = true, $orderby = 'name',
  871. $show_description = true, $show_rating = false, $limit = -1, $show_updated = 1, $echo = true) {
  872. _deprecated_function(__FUNCTION__, '0.0', 'get_bookmarks()');
  873. $order = 'ASC';
  874. if ( substr($orderby, 0, 1) == '_' ) {
  875. $order = 'DESC';
  876. $orderby = substr($orderby, 1);
  877. }
  878. if ( $category == -1 ) //get_bookmarks uses '' to signify all categories
  879. $category = '';
  880. $results = get_bookmarks("category=$category&orderby=$orderby&order=$order&show_updated=$show_updated&limit=$limit");
  881. if ( !$results )
  882. return;
  883. $output = '';
  884. foreach ( (array) $results as $row ) {
  885. if ( !isset($row->recently_updated) )
  886. $row->recently_updated = false;
  887. $output .= $before;
  888. if ( $show_updated && $row->recently_updated )
  889. $output .= get_option('links_recently_updated_prepend');
  890. $the_link = '#';
  891. if ( !empty($row->link_url) )
  892. $the_link = clean_url($row->link_url);
  893. $rel = $row->link_rel;
  894. if ( '' != $rel )
  895. $rel = ' rel="' . $rel . '"';
  896. $desc = attribute_escape(sanitize_bookmark_field('link_description', $row->link_description, $row->link_id, 'display'));
  897. $name = attribute_escape(sanitize_bookmark_field('link_name', $row->link_name, $row->link_id, 'display'));
  898. $title = $desc;
  899. if ( $show_updated )
  900. if (substr($row->link_updated_f, 0, 2) != '00')
  901. $title .= ' ('.__('Last updated') . ' ' . date(get_option('links_updated_date_format'), $row->link_updated_f + (get_option('gmt_offset') * 3600)) . ')';
  902. if ( '' != $title )
  903. $title = ' title="' . $title . '"';
  904. $alt = ' alt="' . $name . '"';
  905. $target = $row->link_target;
  906. if ( '' != $target )
  907. $target = ' target="' . $target . '"';
  908. $output .= '<a href="' . $the_link . '"' . $rel . $title . $target. '>';
  909. if ( $row->link_image != null && $show_images ) {
  910. if ( strpos($row->link_image, 'http') !== false )
  911. $output .= "<img src=\"$row->link_image\" $alt $title />";
  912. else // If it's a relative path
  913. $output .= "<img src=\"" . get_option('siteurl') . "$row->link_image\" $alt $title />";
  914. } else {
  915. $output .= $name;
  916. }
  917. $output .= '</a>';
  918. if ( $show_updated && $row->recently_updated )
  919. $output .= get_option('links_recently_updated_append');
  920. if ( $show_description && '' != $desc )
  921. $output .= $between . $desc;
  922. if ($show_rating) {
  923. $output .= $between . get_linkrating($row);
  924. }
  925. $output .= "$after\n";
  926. } // end while
  927. if ( !$echo )
  928. return $output;
  929. echo $output;
  930. }
  931. /**
  932. * Output entire list of links by category.
  933. *
  934. * Output a list of all links, listed by category, using the settings in
  935. * $wpdb->linkcategories and output it as a nested HTML unordered list.
  936. *
  937. * @author Dougal
  938. * @since 1.0.1
  939. * @deprecated Use wp_list_bookmarks()
  940. * @see wp_list_bookmarks()
  941. *
  942. * @param string $order Sort link categories by 'name' or 'id'
  943. * @param string $$deprecated Not Used
  944. */
  945. function get_links_list($order = 'name', $deprecated = '') {
  946. _deprecated_function(__FUNCTION__, '0.0', 'wp_list_bookmarks()');
  947. $order = strtolower($order);
  948. // Handle link category sorting
  949. $direction = 'ASC';
  950. if ( '_' == substr($order,0,1) ) {
  951. $direction = 'DESC';
  952. $order = substr($order,1);
  953. }
  954. if ( !isset($direction) )
  955. $direction = '';
  956. $cats = get_categories("type=link&orderby=$order&order=$direction&hierarchical=0");
  957. // Display each category
  958. if ( $cats ) {
  959. foreach ( (array) $cats as $cat ) {
  960. // Handle each category.
  961. // Display the category name
  962. echo ' <li id="linkcat-' . $cat->term_id . '" class="linkcat"><h2>' . apply_filters('link_category', $cat->name ) . "</h2>\n\t<ul>\n";
  963. // Call get_links() with all the appropriate params
  964. get_links($cat->term_id, '<li>', "</li>", "\n", true, 'name', false);
  965. // Close the last category
  966. echo "\n\t</ul>\n</li>\n";
  967. }
  968. }
  969. }
  970. /**
  971. * Show the link to the links popup and the number of links.
  972. *
  973. * @author Fullo
  974. * @link http://sprite.csr.unibo.it/fullo/
  975. *
  976. * @since 0.71
  977. * @deprecated {@internal Use function instead is unknown}}
  978. *
  979. * @param string $text the text of the link
  980. * @param int $width the width of the popup window
  981. * @param int $height the height of the popup window
  982. * @param string $file the page to open in the popup window
  983. * @param bool $count the number of links in the db
  984. */
  985. function links_popup_script($text = 'Links', $width=400, $height=400, $file='links.all.php', $count = true) {
  986. _deprecated_function(__FUNCTION__, '0.0' );
  987. if ( $count )
  988. $counts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->links");
  989. $javascript = "<a href=\"#\" onclick=\"javascript:window.open('$file?popup=1', '_blank', 'width=$width,height=$height,scrollbars=yes,status=no'); return false\">";
  990. $javascript .= $text;
  991. if ( $count )
  992. $javascript .= " ($counts)";
  993. $javascript .= "</a>\n\n";
  994. echo $javascript;
  995. }
  996. /**
  997. * @since 1.0.1
  998. * @deprecated Use sanitize_bookmark_field()
  999. * @see sanitize_bookmark_field()
  1000. *
  1001. * @param object $link
  1002. * @return unknown
  1003. */
  1004. function get_linkrating($link) {
  1005. _deprecated_function(__FUNCTION__, '0.0', 'sanitize_bookmark_field()');
  1006. return sanitize_bookmark_field('link_rating', $link->link_rating, $link->link_id, 'display');
  1007. }
  1008. /**
  1009. * Gets the name of category by id.
  1010. *
  1011. * @since 0.71
  1012. * @deprecated Use get_category()
  1013. * @see get_category()
  1014. *
  1015. * @param int $id The category to get. If no category supplied uses 0
  1016. * @return string
  1017. */
  1018. function get_linkcatname($id = 0) {
  1019. _deprecated_function(__FUNCTION__, '0.0', 'get_category()');
  1020. $id = (int) $id;
  1021. if ( empty($id) )
  1022. return '';
  1023. $cats = wp_get_link_cats($id);
  1024. if ( empty($cats) || ! is_array($cats) )
  1025. return '';
  1026. $cat_id = (int) $cats[0]; // Take the first cat.
  1027. $cat = get_category($cat_id);
  1028. return $cat->name;
  1029. }
  1030. /**
  1031. * Print RSS comment feed link.
  1032. *
  1033. * @since 1.0.1
  1034. * @deprecated Use post_comments_feed_link()
  1035. * @see post_comments_feed_link()
  1036. *
  1037. * @param string $link_text
  1038. * @param string $deprecated Not used
  1039. */
  1040. function comments_rss_link($link_text = 'Comments RSS', $deprecated = '') {
  1041. _deprecated_function(__FUNCTION__, '0.0', 'post_comments_feed_link()');
  1042. post_comments_feed_link($link_text);
  1043. }
  1044. /**
  1045. * Print/Return link to category RSS2 feed.
  1046. *
  1047. * @since 1.2
  1048. * @deprecated Use get_category_feed_link()
  1049. * @see get_category_feed_link()
  1050. *
  1051. * @param bool $echo
  1052. * @param int $cat_ID
  1053. * @param string $deprecated Not used
  1054. * @return string|null
  1055. */
  1056. function get_category_rss_link($echo = false, $cat_ID = 1, $deprecated = '') {
  1057. _deprecated_function(__FUNCTION__, '0.0', 'get_category_feed_link()');
  1058. $link = get_category_feed_link($cat_ID, 'rss2');
  1059. if ( $echo )
  1060. echo $link;
  1061. return $link;
  1062. }
  1063. /**
  1064. * Print/Return link to author RSS feed.
  1065. *
  1066. * @since 1.2
  1067. * @deprecated Use get_author_feed_link()
  1068. * @see get_author_feed_link()
  1069. *
  1070. * @param bool $echo
  1071. * @param int $author_id
  1072. * @param string $deprecated Not used
  1073. * @return string|null
  1074. */
  1075. function get_author_rss_link($echo = false, $author_id = 1, $deprecated = '') {
  1076. _deprecated_function(__FUNCTION__, '0.0', 'get_author_feed_link()');
  1077. $link = get_author_feed_link($author_id);
  1078. if ( $echo )
  1079. echo $link;
  1080. return $link;
  1081. }
  1082. /**
  1083. * Return link to the post RSS feed.
  1084. *
  1085. * @since 1.5
  1086. * @deprecated Use get_post_comments_feed_link()
  1087. * @see get_post_comments_feed_link()
  1088. *
  1089. * @param string $deprecated Not used
  1090. * @return string
  1091. */
  1092. function comments_rss($deprecated = '') {
  1093. _deprecated_function(__FUNCTION__, '2.2', 'get_post_comments_feed_link()');
  1094. return get_post_comments_feed_link();
  1095. }
  1096. /**
  1097. * An alias of wp_create_user().
  1098. *
  1099. * @param string $username The user's username.
  1100. * @param string $password The user's password.
  1101. * @param string $email The user's email (optional).
  1102. * @return int The new user's ID.
  1103. * @deprecated Use wp_create_user()
  1104. * @see wp_create_user()
  1105. */
  1106. function create_user($username, $password, $email) {
  1107. _deprecated_function( __FUNCTION__, '2.0', 'wp_create_user()' );
  1108. return wp_create_user($username, $password, $email);
  1109. }
  1110. /**
  1111. * Unused Admin function.
  1112. *
  1113. * @since 2.0
  1114. * @param string $deprecated Unknown
  1115. * @deprecated 2.5
  1116. */
  1117. function documentation_link( $deprecated = '' ) {
  1118. _deprecated_function( __FUNCTION__, '2.5', '' );
  1119. return;
  1120. }
  1121. /**
  1122. * Unused function.
  1123. *
  1124. * @deprecated 2.5
  1125. */
  1126. function gzip_compression() {
  1127. return false;
  1128. }
  1129. /**
  1130. * Retrieve an array of comment data about comment $comment_ID.
  1131. *
  1132. * @deprecated Use get_comment()
  1133. * @see get_comment()
  1134. * @since 0.71
  1135. *
  1136. * @uses $id
  1137. * @uses $wpdb Database Object
  1138. *
  1139. * @param int $comment_ID The ID of the comment
  1140. * @param int $no_cache Whether to use the cache or not (casted to bool)
  1141. * @param bool $include_unapproved Whether to include unapproved comments or not
  1142. * @return array The comment data
  1143. */
  1144. function get_commentdata( $comment_ID, $no_cache = 0, $include_unapproved = false ) {
  1145. _deprecated_function( __FUNCTION__, '2.7', 'get_comment()' );
  1146. return get_comment($comment_ID, ARRAY_A);
  1147. }
  1148. /**
  1149. * Retrieve category children list separated before and after the term IDs.
  1150. *
  1151. * @since 1.2.0
  1152. *
  1153. * @param int $id Category ID to retrieve children.
  1154. * @param string $before Optional. Prepend before category term ID.
  1155. * @param string $after Optional, default is empty string. Append after category term ID.
  1156. * @param array $visited Optional. Category Term IDs that have already been added.
  1157. * @return string
  1158. */
  1159. function get_category_children( $id, $before = '/', $after = '', $visited = array() ) {
  1160. _deprecated_function(__FUNCTION__, '2.8', 'get_term_children()');
  1161. if ( 0 == $id )
  1162. return '';
  1163. $chain = '';
  1164. /** TODO: consult hierarchy */
  1165. $cat_ids = get_all_category_ids();
  1166. foreach ( (array) $cat_ids as $cat_id ) {
  1167. if ( $cat_id == $id )
  1168. continue;
  1169. $category = get_category( $cat_id );
  1170. if ( is_wp_error( $category ) )
  1171. return $category;
  1172. if ( $category->parent == $id && !in_array( $category->term_id, $visited ) ) {
  1173. $visited[] = $category->term_id;
  1174. $chain .= $before.$category->term_id.$after;
  1175. $chain .= get_category_children( $category->term_id, $before, $after );
  1176. }
  1177. }
  1178. return $chain;
  1179. }
  1180. ?>