Projects : mp-wp : mp-wp_svg-screenshots-and-errorreporting-r2

mp-wp/wp-includes/deprecated.php

Dir - Raw

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