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 | /* |
12 | * Deprecated functions come here to die. |
13 | */ |
14 | |
15 | /** |
16 | * Entire Post data. |
17 | * |
18 | * @since 0.71 |
19 | * @deprecated 1.5.1 |
20 | * @deprecated Use get_post() |
21 | * @see get_post() |
22 | * |
23 | * @param int $postid |
24 | * @return array |
25 | */ |
26 | function get_postdata($postid) { |
27 | _deprecated_function( __FUNCTION__, '1.5.1', 'get_post()' ); |
28 | |
29 | $post = &get_post($postid); |
30 | |
31 | $postdata = array ( |
32 | 'ID' => $post->ID, |
33 | 'Author_ID' => $post->post_author, |
34 | 'Date' => $post->post_date, |
35 | 'Content' => $post->post_content, |
36 | 'Excerpt' => $post->post_excerpt, |
37 | 'Title' => $post->post_title, |
38 | 'Category' => $post->post_category, |
39 | 'post_status' => $post->post_status, |
40 | 'comment_status' => $post->comment_status, |
41 | 'ping_status' => $post->ping_status, |
42 | 'post_password' => $post->post_password, |
43 | 'to_ping' => $post->to_ping, |
44 | 'pinged' => $post->pinged, |
45 | 'post_type' => $post->post_type, |
46 | 'post_name' => $post->post_name |
47 | ); |
48 | |
49 | return $postdata; |
50 | } |
51 | |
52 | /** |
53 | * Sets up the WordPress Loop. |
54 | * |
55 | * @since 1.0.1 |
56 | * @deprecated 1.5 |
57 | * @deprecated Use The Loop - {@link http://codex.wordpress.org/The_Loop Use new WordPress Loop} |
58 | */ |
59 | function start_wp() { |
60 | global $wp_query, $post; |
61 | |
62 | _deprecated_function( __FUNCTION__, '1.5', __('new WordPress Loop') ); |
63 | |
64 | // Since the old style loop is being used, advance the query iterator here. |
65 | $wp_query->next_post(); |
66 | |
67 | setup_postdata($post); |
68 | } |
69 | |
70 | /** |
71 | * Return or Print Category ID. |
72 | * |
73 | * @since 0.71 |
74 | * @deprecated 0.71 |
75 | * @deprecated use get_the_category() |
76 | * @see get_the_category() |
77 | * |
78 | * @param bool $echo |
79 | * @return null|int |
80 | */ |
81 | function the_category_ID($echo = true) { |
82 | _deprecated_function( __FUNCTION__, '0.71', 'get_the_category()' ); |
83 | |
84 | // Grab the first cat in the list. |
85 | $categories = get_the_category(); |
86 | $cat = $categories[0]->term_id; |
87 | |
88 | if ( $echo ) |
89 | echo $cat; | //Cross Site Scripting
|
90 | |
91 | return $cat; |
92 | } |
93 | |
94 | /** |
95 | * Print category with optional text before and after. |
96 | * |
97 | * @since 0.71 |
98 | * @deprecated 0.71 |
99 | * @deprecated use get_the_category_by_ID() |
100 | * @see get_the_category_by_ID() |
101 | * |
102 | * @param string $before |
103 | * @param string $after |
104 | */ |
105 | function the_category_head($before='', $after='') { |
106 | global $currentcat, $previouscat; |
107 | |
108 | _deprecated_function( __FUNCTION__, '0.71', 'get_the_category_by_ID()' ); |
109 | |
110 | // Grab the first cat in the list. |
111 | $categories = get_the_category(); |
112 | $currentcat = $categories[0]->category_id; |
113 | if ( $currentcat != $previouscat ) { |
114 | echo $before; | //Cross Site Scripting
|
115 | echo get_the_category_by_ID($currentcat); |
116 | echo $after; | //Cross Site Scripting
|
117 | $previouscat = $currentcat; |
118 | } |
119 | } |
120 | |
121 | /** |
122 | * Prints link to the previous post. |
123 | * |
124 | * @since 1.5 |
125 | * @deprecated 2.0 |
126 | * @deprecated Use previous_post_link() |
127 | * @see previous_post_link() |
128 | * |
129 | * @param string $format |
130 | * @param string $previous |
131 | * @param string $title |
132 | * @param string $in_same_cat |
133 | * @param int $limitprev |
134 | * @param string $excluded_categories |
135 | */ |
136 | function previous_post($format='%', $previous='previous post: ', $title='yes', $in_same_cat='no', $limitprev=1, $excluded_categories='') { |
137 | |
138 | _deprecated_function( __FUNCTION__, '2.0', 'previous_post_link()' ); |
139 | |
140 | if ( empty($in_same_cat) || 'no' == $in_same_cat ) |
141 | $in_same_cat = false; |
142 | else |
143 | $in_same_cat = true; |
144 | |
145 | $post = get_previous_post($in_same_cat, $excluded_categories); |
146 | |
147 | if ( !$post ) |
148 | return; |
149 | |
150 | $string = '<a href="'.get_permalink($post->ID).'">'.$previous; |
151 | if ( 'yes' == $title ) |
152 | $string .= apply_filters('the_title', $post->post_title, $post); |
153 | $string .= '</a>'; |
154 | $format = str_replace('%', $string, $format); |
155 | echo $format; | //Cross Site Scripting
|
156 | } |
157 | |
158 | /** |
159 | * Prints link to the next post. |
160 | * |
161 | * @since 0.71 |
162 | * @deprecated 2.0 |
163 | * @deprecated Use next_post_link() |
164 | * @see next_post_link() |
165 | * |
166 | * @param string $format |
167 | * @param string $previous |
168 | * @param string $title |
169 | * @param string $in_same_cat |
170 | * @param int $limitprev |
171 | * @param string $excluded_categories |
172 | */ |
173 | function next_post($format='%', $next='next post: ', $title='yes', $in_same_cat='no', $limitnext=1, $excluded_categories='') { |
174 | _deprecated_function( __FUNCTION__, '2.0', 'next_post_link()' ); |
175 | |
176 | if ( empty($in_same_cat) || 'no' == $in_same_cat ) |
177 | $in_same_cat = false; |
178 | else |
179 | $in_same_cat = true; |
180 | |
181 | $post = get_next_post($in_same_cat, $excluded_categories); |
182 | |
183 | if ( !$post ) |
184 | return; |
185 | |
186 | $string = '<a href="'.get_permalink($post->ID).'">'.$next; |
187 | if ( 'yes' == $title ) |
188 | $string .= apply_filters('the_title', $post->post_title, $nextpost); |
189 | $string .= '</a>'; |
190 | $format = str_replace('%', $string, $format); |
191 | echo $format; | //Cross Site Scripting
|
192 | } |
193 | |
194 | /** |
195 | * Whether user can create a post. |
196 | * |
197 | * @since 1.5 |
198 | * @deprecated 2.0 |
199 | * @deprecated Use current_user_can() |
200 | * @see current_user_can() |
201 | * |
202 | * @param int $user_id |
203 | * @param int $blog_id Not Used |
204 | * @param int $category_id Not Used |
205 | * @return bool |
206 | */ |
207 | function user_can_create_post($user_id, $blog_id = 1, $category_id = 'None') { |
208 | _deprecated_function( __FUNCTION__, '2.0', 'current_user_can()' ); |
209 | |
210 | $author_data = get_userdata($user_id); |
211 | return ($author_data->user_level > 1); |
212 | } |
213 | |
214 | /** |
215 | * Whether user can create a post. |
216 | * |
217 | * @since 1.5 |
218 | * @deprecated 2.0 |
219 | * @deprecated Use current_user_can() |
220 | * @see current_user_can() |
221 | * |
222 | * @param int $user_id |
223 | * @param int $blog_id Not Used |
224 | * @param int $category_id Not Used |
225 | * @return bool |
226 | */ |
227 | function user_can_create_draft($user_id, $blog_id = 1, $category_id = 'None') { |
228 | _deprecated_function( __FUNCTION__, '2.0', 'current_user_can()' ); |
229 | |
230 | $author_data = get_userdata($user_id); |
231 | return ($author_data->user_level >= 1); |
232 | } |
233 | |
234 | /** |
235 | * Whether user can edit a post. |
236 | * |
237 | * @since 1.5 |
238 | * @deprecated 2.0 |
239 | * @deprecated Use current_user_can() |
240 | * @see current_user_can() |
241 | * |
242 | * @param int $user_id |
243 | * @param int $post_id |
244 | * @param int $blog_id Not Used |
245 | * @return bool |
246 | */ |
247 | function user_can_edit_post($user_id, $post_id, $blog_id = 1) { |
248 | _deprecated_function( __FUNCTION__, '2.0', 'current_user_can()' ); |
249 | |
250 | $author_data = get_userdata($user_id); |
251 | $post = get_post($post_id); |
252 | $post_author_data = get_userdata($post->post_author); |
253 | |
254 | if ( (($user_id == $post_author_data->ID) && !($post->post_status == 'publish' && $author_data->user_level < 2)) |
255 | || ($author_data->user_level > $post_author_data->user_level) |
256 | || ($author_data->user_level >= 10) ) { |
257 | return true; |
258 | } else { |
259 | return false; |
260 | } |
261 | } |
262 | |
263 | /** |
264 | * Whether user can delete a post. |
265 | * |
266 | * @since 1.5 |
267 | * @deprecated 2.0 |
268 | * @deprecated Use current_user_can() |
269 | * @see current_user_can() |
270 | * |
271 | * @param int $user_id |
272 | * @param int $post_id |
273 | * @param int $blog_id Not Used |
274 | * @return bool |
275 | */ |
276 | function user_can_delete_post($user_id, $post_id, $blog_id = 1) { |
277 | _deprecated_function( __FUNCTION__, '2.0', 'current_user_can()' ); |
278 | |
279 | // right now if one can edit, one can delete |
280 | return user_can_edit_post($user_id, $post_id, $blog_id); |
281 | } |
282 | |
283 | /** |
284 | * Whether user can set new posts' dates. |
285 | * |
286 | * @since 1.5 |
287 | * @deprecated 2.0 |
288 | * @deprecated Use current_user_can() |
289 | * @see current_user_can() |
290 | * |
291 | * @param int $user_id |
292 | * @param int $blog_id Not Used |
293 | * @param int $category_id Not Used |
294 | * @return bool |
295 | */ |
296 | function user_can_set_post_date($user_id, $blog_id = 1, $category_id = 'None') { |
297 | _deprecated_function( __FUNCTION__, '2.0', 'current_user_can()' ); |
298 | |
299 | $author_data = get_userdata($user_id); |
300 | return (($author_data->user_level > 4) && user_can_create_post($user_id, $blog_id, $category_id)); |
301 | } |
302 | |
303 | /** |
304 | * Whether user can delete a post. |
305 | * |
306 | * @since 1.5 |
307 | * @deprecated 2.0 |
308 | * @deprecated Use current_user_can() |
309 | * @see current_user_can() |
310 | * |
311 | * @param int $user_id |
312 | * @param int $post_id |
313 | * @param int $blog_id Not Used |
314 | * @return bool returns true if $user_id can edit $post_id's date |
315 | */ |
316 | function user_can_edit_post_date($user_id, $post_id, $blog_id = 1) { |
317 | _deprecated_function( __FUNCTION__, '2.0', 'current_user_can()' ); |
318 | |
319 | $author_data = get_userdata($user_id); |
320 | return (($author_data->user_level > 4) && user_can_edit_post($user_id, $post_id, $blog_id)); |
321 | } |
322 | |
323 | /** |
324 | * Whether user can delete a post. |
325 | * |
326 | * @since 1.5 |
327 | * @deprecated 2.0 |
328 | * @deprecated Use current_user_can() |
329 | * @see current_user_can() |
330 | * |
331 | * @param int $user_id |
332 | * @param int $post_id |
333 | * @param int $blog_id Not Used |
334 | * @return bool returns true if $user_id can edit $post_id's comments |
335 | */ |
336 | function user_can_edit_post_comments($user_id, $post_id, $blog_id = 1) { |
337 | _deprecated_function( __FUNCTION__, '2.0', 'current_user_can()' ); |
338 | |
339 | // right now if one can edit a post, one can edit comments made on it |
340 | return user_can_edit_post($user_id, $post_id, $blog_id); |
341 | } |
342 | |
343 | /** |
344 | * Whether user can delete a post. |
345 | * |
346 | * @since 1.5 |
347 | * @deprecated 2.0 |
348 | * @deprecated Use current_user_can() |
349 | * @see current_user_can() |
350 | * |
351 | * @param int $user_id |
352 | * @param int $post_id |
353 | * @param int $blog_id Not Used |
354 | * @return bool returns true if $user_id can delete $post_id's comments |
355 | */ |
356 | function user_can_delete_post_comments($user_id, $post_id, $blog_id = 1) { |
357 | _deprecated_function( __FUNCTION__, '2.0', 'current_user_can()' ); |
358 | |
359 | // right now if one can edit comments, one can delete comments |
360 | return user_can_edit_post_comments($user_id, $post_id, $blog_id); |
361 | } |
362 | |
363 | /** |
364 | * Can user can edit other user. |
365 | * |
366 | * @since 1.5 |
367 | * @deprecated 2.0 |
368 | * @deprecated Use current_user_can() |
369 | * @see current_user_can() |
370 | * |
371 | * @param int $user_id |
372 | * @param int $other_user |
373 | * @return bool |
374 | */ |
375 | function user_can_edit_user($user_id, $other_user) { |
376 | _deprecated_function( __FUNCTION__, '2.0', 'current_user_can()' ); |
377 | |
378 | $user = get_userdata($user_id); |
379 | $other = get_userdata($other_user); |
380 | if ( $user->user_level > $other->user_level || $user->user_level > 8 || $user->ID == $other->ID ) |
381 | return true; |
382 | else |
383 | return false; |
384 | } |
385 | |
386 | /** |
387 | * Gets the links associated with category $cat_name. |
388 | * |
389 | * @since 0.71 |
390 | * @deprecated 2.1 |
391 | * @deprecated Use get_bookmarks() |
392 | * @see get_bookmarks() |
393 | * |
394 | * @param string $cat_name Optional. The category name to use. If no match is found uses all. |
395 | * @param string $before Optional. The html to output before the link. |
396 | * @param string $after Optional. The html to output after the link. |
397 | * @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. |
398 | * @param bool $show_images Optional. Whether to show images (if defined). |
399 | * @param string $orderby Optional. The order to output the links. E.g. 'id', 'name', 'url', 'description' or 'rating'. Or maybe owner. |
400 | * 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 |
401 | * random order. |
402 | * @param bool $show_description Optional. Whether to show the description if show_images=false/not defined. |
403 | * @param bool $show_rating Optional. Show rating stars/chars. |
404 | * @param int $limit Optional. Limit to X entries. If not specified, all entries are shown. |
405 | * @param int $show_updated Optional. Whether to show last updated timestamp |
406 | */ |
407 | function get_linksbyname($cat_name = "noname", $before = '', $after = '<br />', $between = " ", $show_images = true, $orderby = 'id', |
408 | $show_description = true, $show_rating = false, |
409 | $limit = -1, $show_updated = 0) { |
410 | _deprecated_function( __FUNCTION__, '2.1', 'get_bookmarks()' ); |
411 | |
412 | $cat_id = -1; |
413 | $cat = get_term_by('name', $cat_name, 'link_category'); |
414 | if ( $cat ) |
415 | $cat_id = $cat->term_id; |
416 | |
417 | get_links($cat_id, $before, $after, $between, $show_images, $orderby, $show_description, $show_rating, $limit, $show_updated); |
418 | } |
419 | |
420 | /** |
421 | * Gets the links associated with the named category. |
422 | * |
423 | * @since 1.0.1 |
424 | * @deprecated 2.1 |
425 | * @deprecated Use wp_list_bookmarks() |
426 | * @see wp_list_bookmarks() |
427 | * |
428 | * @param string $category The category to use. |
429 | * @param string $args |
430 | * @return bool|null |
431 | */ |
432 | function wp_get_linksbyname($category, $args = '') { |
433 | _deprecated_function(__FUNCTION__, '0.0', 'wp_list_bookmarks()'); |
434 | |
435 | $defaults = array( |
436 | 'after' => '<br />', |
437 | 'before' => '', |
438 | 'categorize' => 0, |
439 | 'category_after' => '', |
440 | 'category_before' => '', |
441 | 'category_name' => $category, |
442 | 'show_description' => 1, |
443 | 'title_li' => '', |
444 | ); |
445 | |
446 | $r = wp_parse_args( $args, $defaults ); |
447 | |
448 | return wp_list_bookmarks($r); |
449 | } |
450 | |
451 | /** |
452 | * Gets an array of link objects associated with category $cat_name. |
453 | * |
454 | * <code> |
455 | * $links = get_linkobjectsbyname('fred'); |
456 | * foreach ($links as $link) { |
457 | * echo '<li>'.$link->link_name.'</li>'; |
458 | * } |
459 | * </code> |
460 | * |
461 | * @since 1.0.1 |
462 | * @deprecated 2.1 |
463 | * @deprecated Use get_bookmarks() |
464 | * @see get_bookmarks() |
465 | * |
466 | * @param string $cat_name The category name to use. If no match is found uses all. |
467 | * @param string $orderby The order to output the links. E.g. 'id', 'name', 'url', 'description', or 'rating'. |
468 | * Or maybe owner. If you start the name with an underscore the order will be reversed. You can also |
469 | * specify 'rand' as the order which will return links in a random order. |
470 | * @param int $limit Limit to X entries. If not specified, all entries are shown. |
471 | * @return unknown |
472 | */ |
473 | function get_linkobjectsbyname($cat_name = "noname" , $orderby = 'name', $limit = -1) { |
474 | _deprecated_function( __FUNCTION__, '2.1', 'get_bookmarks()' ); |
475 | |
476 | $cat_id = -1; |
477 | $cat = get_term_by('name', $cat_name, 'link_category'); |
478 | if ( $cat ) |
479 | $cat_id = $cat->term_id; |
480 | |
481 | return get_linkobjects($cat_id, $orderby, $limit); |
482 | } |
483 | |
484 | /** |
485 | * Gets an array of link objects associated with category n. |
486 | * |
487 | * Usage: |
488 | * <code> |
489 | * $links = get_linkobjects(1); |
490 | * if ($links) { |
491 | * foreach ($links as $link) { |
492 | * echo '<li>'.$link->link_name.'<br />'.$link->link_description.'</li>'; |
493 | * } |
494 | * } |
495 | * </code> |
496 | * |
497 | * Fields are: |
498 | * <ol> |
499 | * <li>link_id</li> |
500 | * <li>link_url</li> |
501 | * <li>link_name</li> |
502 | * <li>link_image</li> |
503 | * <li>link_target</li> |
504 | * <li>link_category</li> |
505 | * <li>link_description</li> |
506 | * <li>link_visible</li> |
507 | * <li>link_owner</li> |
508 | * <li>link_rating</li> |
509 | * <li>link_updated</li> |
510 | * <li>link_rel</li> |
511 | * <li>link_notes</li> |
512 | * </ol> |
513 | * |
514 | * @since 1.0.1 |
515 | * @deprecated 2.1 |
516 | * @deprecated Use get_bookmarks() |
517 | * @see get_bookmarks() |
518 | * |
519 | * @param int $category The category to use. If no category supplied uses all |
520 | * @param string $orderby the order to output the links. E.g. 'id', 'name', 'url', |
521 | * 'description', or 'rating'. Or maybe owner. If you start the name with an |
522 | * underscore the order will be reversed. You can also specify 'rand' as the |
523 | * order which will return links in a random order. |
524 | * @param int $limit Limit to X entries. If not specified, all entries are shown. |
525 | * @return unknown |
526 | */ |
527 | function get_linkobjects($category = 0, $orderby = 'name', $limit = 0) { |
528 | _deprecated_function( __FUNCTION__, '2.1', 'get_bookmarks()' ); |
529 | |
530 | $links = get_bookmarks( array( 'category' => $category, 'orderby' => $orderby, 'limit' => $limit ) ) ; |
531 | |
532 | $links_array = array(); |
533 | foreach ($links as $link) |
534 | $links_array[] = $link; |
535 | |
536 | return $links_array; |
537 | } |
538 | |
539 | /** |
540 | * Gets the links associated with category 'cat_name' and display rating stars/chars. |
541 | * |
542 | * @since 0.71 |
543 | * @deprecated 2.1 |
544 | * @deprecated Use get_bookmarks() |
545 | * @see get_bookmarks() |
546 | * |
547 | * @param string $cat_name The category name to use. If no match is found uses all |
548 | * @param string $before The html to output before the link |
549 | * @param string $after The html to output after the link |
550 | * @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 |
551 | * @param bool $show_images Whether to show images (if defined). |
552 | * @param string $orderby the order to output the links. E.g. 'id', 'name', 'url', |
553 | * 'description', or 'rating'. Or maybe owner. If you start the name with an |
554 | * underscore the order will be reversed. You can also specify 'rand' as the |
555 | * order which will return links in a random order. |
556 | * @param bool $show_description Whether to show the description if show_images=false/not defined |
557 | * @param int $limit Limit to X entries. If not specified, all entries are shown. |
558 | * @param int $show_updated Whether to show last updated timestamp |
559 | */ |
560 | function get_linksbyname_withrating($cat_name = "noname", $before = '', $after = '<br />', $between = " ", |
561 | $show_images = true, $orderby = 'id', $show_description = true, $limit = -1, $show_updated = 0) { |
562 | _deprecated_function( __FUNCTION__, '2.1', 'get_bookmarks()' ); |
563 | |
564 | get_linksbyname($cat_name, $before, $after, $between, $show_images, $orderby, $show_description, true, $limit, $show_updated); |
565 | } |
566 | |
567 | /** |
568 | * Gets the links associated with category n and display rating stars/chars. |
569 | * |
570 | * @since 0.71 |
571 | * @deprecated 2.1 |
572 | * @deprecated Use get_bookmarks() |
573 | * @see get_bookmarks() |
574 | * |
575 | * @param int $category The category to use. If no category supplied uses all |
576 | * @param string $before The html to output before the link |
577 | * @param string $after The html to output after the link |
578 | * @param string $between The html to output between the link/image and it's description. Not used if no image or show_images == true |
579 | * @param bool $show_images Whether to show images (if defined). |
580 | * @param string $orderby The order to output the links. E.g. 'id', 'name', 'url', |
581 | * 'description', or 'rating'. Or maybe owner. If you start the name with an |
582 | * underscore the order will be reversed. You can also specify 'rand' as the |
583 | * order which will return links in a random order. |
584 | * @param bool $show_description Whether to show the description if show_images=false/not defined. |
585 | * @param string $limit Limit to X entries. If not specified, all entries are shown. |
586 | * @param int $show_updated Whether to show last updated timestamp |
587 | */ |
588 | function get_links_withrating($category = -1, $before = '', $after = '<br />', $between = " ", $show_images = true, |
589 | $orderby = 'id', $show_description = true, $limit = -1, $show_updated = 0) { |
590 | _deprecated_function( __FUNCTION__, '2.1', 'get_bookmarks()' ); |
591 | |
592 | get_links($category, $before, $after, $between, $show_images, $orderby, $show_description, true, $limit, $show_updated); |
593 | } |
594 | |
595 | /** |
596 | * Gets the auto_toggle setting. |
597 | * |
598 | * @since 0.71 |
599 | * @deprecated 2.1 |
600 | * @deprecated No alternative function available |
601 | * |
602 | * @param int $id The category to get. If no category supplied uses 0 |
603 | * @return int Only returns 0. |
604 | */ |
605 | function get_autotoggle($id = 0) { |
606 | _deprecated_function( __FUNCTION__, '2.1' ); |
607 | return 0; |
608 | } |
609 | |
610 | /** |
611 | * @since 0.71 |
612 | * @deprecated 2.1 |
613 | * @deprecated Use wp_list_categories() |
614 | * @see wp_list_categories() |
615 | * |
616 | * @param int $optionall |
617 | * @param string $all |
618 | * @param string $sort_column |
619 | * @param string $sort_order |
620 | * @param string $file |
621 | * @param bool $list |
622 | * @param int $optiondates |
623 | * @param int $optioncount |
624 | * @param int $hide_empty |
625 | * @param int $use_desc_for_title |
626 | * @param bool $children |
627 | * @param int $child_of |
628 | * @param int $categories |
629 | * @param int $recurse |
630 | * @param string $feed |
631 | * @param string $feed_image |
632 | * @param string $exclude |
633 | * @param bool $hierarchical |
634 | * @return unknown |
635 | */ |
636 | function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_order = 'asc', $file = '', $list = true, $optiondates = 0, |
637 | $optioncount = 0, $hide_empty = 1, $use_desc_for_title = 1, $children=false, $child_of=0, $categories=0, |
638 | $recurse=0, $feed = '', $feed_image = '', $exclude = '', $hierarchical=false) { |
639 | _deprecated_function( __FUNCTION__, '2.1', 'wp_list_categories()' ); |
640 | |
641 | $query = compact('optionall', 'all', 'sort_column', 'sort_order', 'file', 'list', 'optiondates', 'optioncount', 'hide_empty', 'use_desc_for_title', 'children', |
642 | 'child_of', 'categories', 'recurse', 'feed', 'feed_image', 'exclude', 'hierarchical'); |
643 | return wp_list_cats($query); |
644 | } |
645 | |
646 | /** |
647 | * @since 1.2 |
648 | * @deprecated 2.1 |
649 | * @deprecated Use wp_list_categories() |
650 | * @see wp_list_categories() |
651 | * |
652 | * @param string|array $args |
653 | * @return unknown |
654 | */ |
655 | function wp_list_cats($args = '') { |
656 | _deprecated_function( __FUNCTION__, '2.1', 'wp_list_categories()' ); |
657 | |
658 | $r = wp_parse_args( $args ); |
659 | |
660 | // Map to new names. |
661 | if ( isset($r['optionall']) && isset($r['all'])) |
662 | $r['show_option_all'] = $r['all']; |
663 | if ( isset($r['sort_column']) ) |
664 | $r['orderby'] = $r['sort_column']; |
665 | if ( isset($r['sort_order']) ) |
666 | $r['order'] = $r['sort_order']; |
667 | if ( isset($r['optiondates']) ) |
668 | $r['show_last_update'] = $r['optiondates']; |
669 | if ( isset($r['optioncount']) ) |
670 | $r['show_count'] = $r['optioncount']; |
671 | if ( isset($r['list']) ) |
672 | $r['style'] = $r['list'] ? 'list' : 'break'; |
673 | $r['title_li'] = ''; |
674 | |
675 | return wp_list_categories($r); |
676 | } |
677 | |
678 | /** |
679 | * @since 0.71 |
680 | * @deprecated 2.1 |
681 | * @deprecated Use wp_dropdown_categories() |
682 | * @see wp_dropdown_categories() |
683 | * |
684 | * @param int $optionall |
685 | * @param string $all |
686 | * @param string $orderby |
687 | * @param string $order |
688 | * @param int $show_last_update |
689 | * @param int $show_count |
690 | * @param int $hide_empty |
691 | * @param bool $optionnone |
692 | * @param int $selected |
693 | * @param int $exclude |
694 | * @return unknown |
695 | */ |
696 | function dropdown_cats($optionall = 1, $all = 'All', $orderby = 'ID', $order = 'asc', |
697 | $show_last_update = 0, $show_count = 0, $hide_empty = 1, $optionnone = false, |
698 | $selected = 0, $exclude = 0) { |
699 | _deprecated_function( __FUNCTION__, '2.1', 'wp_dropdown_categories()' ); |
700 | |
701 | $show_option_all = ''; |
702 | if ( $optionall ) |
703 | $show_option_all = $all; |
704 | |
705 | $show_option_none = ''; |
706 | if ( $optionnone ) |
707 | $show_option_none = __('None'); |
708 | |
709 | $vars = compact('show_option_all', 'show_option_none', 'orderby', 'order', |
710 | 'show_last_update', 'show_count', 'hide_empty', 'selected', 'exclude'); |
711 | $query = add_query_arg($vars, ''); |
712 | return wp_dropdown_categories($query); |
713 | } |
714 | |
715 | /** |
716 | * @since 1.2 |
717 | * @deprecated 2.1 |
718 | * @deprecated Use wp_list_authors() |
719 | * @see wp_list_authors() |
720 | * |
721 | * @param bool $optioncount |
722 | * @param bool $exclude_admin |
723 | * @param bool $show_fullname |
724 | * @param bool $hide_empty |
725 | * @param string $feed |
726 | * @param string $feed_image |
727 | * @return unknown |
728 | */ |
729 | function list_authors($optioncount = false, $exclude_admin = true, $show_fullname = false, $hide_empty = true, $feed = '', $feed_image = '') { |
730 | _deprecated_function( __FUNCTION__, '2.1', 'wp_list_authors()' ); |
731 | |
732 | $args = compact('optioncount', 'exclude_admin', 'show_fullname', 'hide_empty', 'feed', 'feed_image'); |
733 | return wp_list_authors($args); |
734 | } |
735 | |
736 | /** |
737 | * @since 1.0.1 |
738 | * @deprecated 2.1 |
739 | * @deprecated Use wp_get_post_categories() |
740 | * @see wp_get_post_categories() |
741 | * |
742 | * @param int $blogid Not Used |
743 | * @param int $post_ID |
744 | * @return unknown |
745 | */ |
746 | function wp_get_post_cats($blogid = '1', $post_ID = 0) { |
747 | _deprecated_function( __FUNCTION__, '2.1', 'wp_get_post_categories()' ); |
748 | return wp_get_post_categories($post_ID); |
749 | } |
750 | |
751 | /** |
752 | * Sets the categories that the post id belongs to. |
753 | * |
754 | * @since 1.0.1 |
755 | * @deprecated 2.1 |
756 | * @deprecated Use wp_set_post_categories() |
757 | * @see wp_set_post_categories() |
758 | * |
759 | * @param int $blogid Not used |
760 | * @param int $post_ID |
761 | * @param array $post_categories |
762 | * @return unknown |
763 | */ |
764 | function wp_set_post_cats($blogid = '1', $post_ID = 0, $post_categories = array()) { |
765 | _deprecated_function( __FUNCTION__, '2.1', 'wp_set_post_categories()' ); |
766 | return wp_set_post_categories($post_ID, $post_categories); |
767 | } |
768 | |
769 | /** |
770 | * @since 0.71 |
771 | * @deprecated 2.1 |
772 | * @deprecated Use wp_get_archives() |
773 | * @see wp_get_archives() |
774 | * |
775 | * @param string $type |
776 | * @param string $limit |
777 | * @param string $format |
778 | * @param string $before |
779 | * @param string $after |
780 | * @param bool $show_post_count |
781 | * @return unknown |
782 | */ |
783 | function get_archives($type='', $limit='', $format='html', $before = '', $after = '', $show_post_count = false) { |
784 | _deprecated_function( __FUNCTION__, '2.1', 'wp_get_archives()' ); |
785 | $args = compact('type', 'limit', 'format', 'before', 'after', 'show_post_count'); |
786 | return wp_get_archives($args); |
787 | } |
788 | |
789 | /** |
790 | * Returns or Prints link to the author's posts. |
791 | * |
792 | * @since 1.2 |
793 | * @deprecated 2.1 |
794 | * @deprecated Use get_author_posts_url() |
795 | * @see get_author_posts_url() |
796 | * |
797 | * @param bool $echo Optional. |
798 | * @param int $author_id Required. |
799 | * @param string $author_nicename Optional. |
800 | * @return string|null |
801 | */ |
802 | function get_author_link($echo = false, $author_id, $author_nicename = '') { |
803 | _deprecated_function( __FUNCTION__, '2.1', 'get_author_posts_url()' ); |
804 | |
805 | $link = get_author_posts_url($author_id, $author_nicename); |
806 | |
807 | if ( $echo ) |
808 | echo $link; | //Cross Site Scripting
|
809 | return $link; |
810 | } |
811 | |
812 | /** |
813 | * Print list of pages based on arguments. |
814 | * |
815 | * @since 0.71 |
816 | * @deprecated 2.1 |
817 | * @deprecated Use wp_link_pages() |
818 | * @see wp_link_pages() |
819 | * |
820 | * @param string $before |
821 | * @param string $after |
822 | * @param string $next_or_number |
823 | * @param string $nextpagelink |
824 | * @param string $previouspagelink |
825 | * @param string $pagelink |
826 | * @param string $more_file |
827 | * @return string |
828 | */ |
829 | function link_pages($before='<br />', $after='<br />', $next_or_number='number', $nextpagelink='next page', $previouspagelink='previous page', |
830 | $pagelink='%', $more_file='') { |
831 | _deprecated_function( __FUNCTION__, '2.1', 'wp_link_pages()' ); |
832 | |
833 | $args = compact('before', 'after', 'next_or_number', 'nextpagelink', 'previouspagelink', 'pagelink', 'more_file'); |
834 | return wp_link_pages($args); |
835 | } |
836 | |
837 | /** |
838 | * Get value based on option. |
839 | * |
840 | * @since 0.71 |
841 | * @deprecated 2.1 |
842 | * @deprecated Use get_option() |
843 | * @see get_option() |
844 | * |
845 | * @param string $option |
846 | * @return string |
847 | */ |
848 | function get_settings($option) { |
849 | _deprecated_function( __FUNCTION__, '2.1', 'get_option()' ); |
850 | |
851 | return get_option($option); |
852 | } |
853 | |
854 | /** |
855 | * Print the permalink of the current post in the loop. |
856 | * |
857 | * @since 0.71 |
858 | * @deprecated 1.2 |
859 | * @deprecated Use the_permalink() |
860 | * @see the_permalink() |
861 | */ |
862 | function permalink_link() { |
863 | _deprecated_function( __FUNCTION__, '1.2', 'the_permalink()' ); |
864 | the_permalink(); |
865 | } |
866 | |
867 | /** |
868 | * Print the permalink to the RSS feed. |
869 | * |
870 | * @since 0.71 |
871 | * @deprecated 2.3 |
872 | * @deprecated Use the_permalink_rss() |
873 | * @see the_permalink_rss() |
874 | * |
875 | * @param string $file |
876 | */ |
877 | function permalink_single_rss($deprecated = '') { |
878 | _deprecated_function( __FUNCTION__, '0.0', 'the_permalink_rss()' ); |
879 | the_permalink_rss(); |
880 | } |
881 | |
882 | /** |
883 | * Gets the links associated with category. |
884 | * |
885 | * @see get_links() for argument information that can be used in $args |
886 | * @since 1.0.1 |
887 | * @deprecated 2.1 |
888 | * @deprecated Use wp_list_bookmarks() |
889 | * @see wp_list_bookmarks() |
890 | * |
891 | * @param string $args a query string |
892 | * @return null|string |
893 | */ |
894 | function wp_get_links($args = '') { |
895 | _deprecated_function( __FUNCTION__, '0.0', 'wp_list_bookmarks()' ); |
896 | |
897 | if ( strpos( $args, '=' ) === false ) { |
898 | $cat_id = $args; |
899 | $args = add_query_arg( 'category', $cat_id, $args ); |
900 | } |
901 | |
902 | $defaults = array( |
903 | 'after' => '<br />', |
904 | 'before' => '', |
905 | 'between' => ' ', |
906 | 'categorize' => 0, |
907 | 'category' => '', |
908 | 'echo' => true, |
909 | 'limit' => -1, |
910 | 'orderby' => 'name', |
911 | 'show_description' => true, |
912 | 'show_images' => true, |
913 | 'show_rating' => false, |
914 | 'show_updated' => true, |
915 | 'title_li' => '', |
916 | ); |
917 | |
918 | $r = wp_parse_args( $args, $defaults ); |
919 | |
920 | return wp_list_bookmarks($r); |
921 | } |
922 | |
923 | /** |
924 | * Gets the links associated with category by id. |
925 | * |
926 | * @since 0.71 |
927 | * @deprecated 2.1 |
928 | * @deprecated Use get_bookmarks() |
929 | * @see get_bookmarks() |
930 | * |
931 | * @param int $category The category to use. If no category supplied uses all |
932 | * @param string $before the html to output before the link |
933 | * @param string $after the html to output after the link |
934 | * @param string $between the html to output between the link/image and its description. |
935 | * Not used if no image or show_images == true |
936 | * @param bool $show_images whether to show images (if defined). |
937 | * @param string $orderby the order to output the links. E.g. 'id', 'name', 'url', |
938 | * 'description', or 'rating'. Or maybe owner. If you start the name with an |
939 | * underscore the order will be reversed. You can also specify 'rand' as the order |
940 | * which will return links in a random order. |
941 | * @param bool $show_description whether to show the description if show_images=false/not defined. |
942 | * @param bool $show_rating show rating stars/chars |
943 | * @param int $limit Limit to X entries. If not specified, all entries are shown. |
944 | * @param int $show_updated whether to show last updated timestamp |
945 | * @param bool $echo whether to echo the results, or return them instead |
946 | * @return null|string |
947 | */ |
948 | function get_links($category = -1, $before = '', $after = '<br />', $between = ' ', $show_images = true, $orderby = 'name', |
949 | $show_description = true, $show_rating = false, $limit = -1, $show_updated = 1, $echo = true) { |
950 | _deprecated_function( __FUNCTION__, '2.1', 'get_bookmarks()' ); |
951 | |
952 | $order = 'ASC'; |
953 | if ( substr($orderby, 0, 1) == '_' ) { |
954 | $order = 'DESC'; |
955 | $orderby = substr($orderby, 1); |
956 | } |
957 | |
958 | if ( $category == -1 ) //get_bookmarks uses '' to signify all categories |
959 | $category = ''; |
960 | |
961 | $results = get_bookmarks(array('category' => $category, 'orderby' => $orderby, 'order' => $order, 'show_updated' => $show_updated, 'limit' => $limit)); |
962 | |
963 | if ( !$results ) |
964 | return; |
965 | |
966 | $output = ''; |
967 | |
968 | foreach ( (array) $results as $row ) { |
969 | if ( !isset($row->recently_updated) ) |
970 | $row->recently_updated = false; |
971 | $output .= $before; |
972 | if ( $show_updated && $row->recently_updated ) |
973 | $output .= get_option('links_recently_updated_prepend'); |
974 | $the_link = '#'; |
975 | if ( !empty($row->link_url) ) |
976 | $the_link = esc_url($row->link_url); |
977 | $rel = $row->link_rel; |
978 | if ( '' != $rel ) |
979 | $rel = ' rel="' . $rel . '"'; |
980 | |
981 | $desc = esc_attr(sanitize_bookmark_field('link_description', $row->link_description, $row->link_id, 'display')); |
982 | $name = esc_attr(sanitize_bookmark_field('link_name', $row->link_name, $row->link_id, 'display')); |
983 | $title = $desc; |
984 | |
985 | if ( $show_updated ) |
986 | if (substr($row->link_updated_f, 0, 2) != '00') |
987 | $title .= ' ('.__('Last updated') . ' ' . date(get_option('links_updated_date_format'), $row->link_updated_f + (get_option('gmt_offset') * 3600)) . ')'; |
988 | |
989 | if ( '' != $title ) |
990 | $title = ' title="' . $title . '"'; |
991 | |
992 | $alt = ' alt="' . $name . '"'; |
993 | |
994 | $target = $row->link_target; |
995 | if ( '' != $target ) |
996 | $target = ' target="' . $target . '"'; |
997 | |
998 | $output .= '<a href="' . $the_link . '"' . $rel . $title . $target. '>'; |
999 | |
1000 | if ( $row->link_image != null && $show_images ) { |