|
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; |
|
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( get_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; |
|
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; |
|
115 echo get_the_category_by_ID($currentcat); |
|
116 echo $after; |
|
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->ID); |
|
153 $string .= '</a>'; |
|
154 $format = str_replace('%', $string, $format); |
|
155 echo $format; |
|
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 $next |
|
168 * @param string $title |
|
169 * @param string $in_same_cat |
|
170 * @param int $limitnext |
|
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, $post->ID); |
|
189 $string .= '</a>'; |
|
190 $format = str_replace('%', $string, $format); |
|
191 echo $format; |
|
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 its 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__, '2.1', '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 its 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 its 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 |
|
798 * @param int $author_id |
|
799 * @param string $author_nicename Optional. |
|
800 * @return string|null |
|
801 */ |
|
802 function get_author_link($echo, $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; |
|
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 $deprecated |
|
876 */ |
|
877 function permalink_single_rss($deprecated = '') { |
|
878 _deprecated_function( __FUNCTION__, '2.3', '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__, '2.1', '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') * HOUR_IN_SECONDS)) . ')'; |
|
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 ) { |
|
1001 if ( strpos($row->link_image, 'http') !== false ) |
|
1002 $output .= "<img src=\"$row->link_image\" $alt $title />"; |
|
1003 else // If it's a relative path |
|
1004 $output .= "<img src=\"" . get_option('siteurl') . "$row->link_image\" $alt $title />"; |
|
1005 } else { |
|
1006 $output .= $name; |
|
1007 } |
|
1008 |
|
1009 $output .= '</a>'; |
|
1010 |
|
1011 if ( $show_updated && $row->recently_updated ) |
|
1012 $output .= get_option('links_recently_updated_append'); |
|
1013 |
|
1014 if ( $show_description && '' != $desc ) |
|
1015 $output .= $between . $desc; |
|
1016 |
|
1017 if ($show_rating) { |
|
1018 $output .= $between . get_linkrating($row); |
|
1019 } |
|
1020 |
|
1021 $output .= "$after\n"; |
|
1022 } // end while |
|
1023 |
|
1024 if ( !$echo ) |
|
1025 return $output; |
|
1026 echo $output; |
|
1027 } |
|
1028 |
|
1029 /** |
|
1030 * Output entire list of links by category. |
|
1031 * |
|
1032 * Output a list of all links, listed by category, using the settings in |
|
1033 * $wpdb->linkcategories and output it as a nested HTML unordered list. |
|
1034 * |
|
1035 * @since 1.0.1 |
|
1036 * @deprecated 2.1 |
|
1037 * @deprecated Use wp_list_bookmarks() |
|
1038 * @see wp_list_bookmarks() |
|
1039 * |
|
1040 * @param string $order Sort link categories by 'name' or 'id' |
|
1041 */ |
|
1042 function get_links_list($order = 'name') { |
|
1043 _deprecated_function( __FUNCTION__, '2.1', 'wp_list_bookmarks()' ); |
|
1044 |
|
1045 $order = strtolower($order); |
|
1046 |
|
1047 // Handle link category sorting |
|
1048 $direction = 'ASC'; |
|
1049 if ( '_' == substr($order,0,1) ) { |
|
1050 $direction = 'DESC'; |
|
1051 $order = substr($order,1); |
|
1052 } |
|
1053 |
|
1054 if ( !isset($direction) ) |
|
1055 $direction = ''; |
|
1056 |
|
1057 $cats = get_categories(array('type' => 'link', 'orderby' => $order, 'order' => $direction, 'hierarchical' => 0)); |
|
1058 |
|
1059 // Display each category |
|
1060 if ( $cats ) { |
|
1061 foreach ( (array) $cats as $cat ) { |
|
1062 // Handle each category. |
|
1063 |
|
1064 // Display the category name |
|
1065 echo ' <li id="linkcat-' . $cat->term_id . '" class="linkcat"><h2>' . apply_filters('link_category', $cat->name ) . "</h2>\n\t<ul>\n"; |
|
1066 // Call get_links() with all the appropriate params |
|
1067 get_links($cat->term_id, '<li>', "</li>", "\n", true, 'name', false); |
|
1068 |
|
1069 // Close the last category |
|
1070 echo "\n\t</ul>\n</li>\n"; |
|
1071 } |
|
1072 } |
|
1073 } |
|
1074 |
|
1075 /** |
|
1076 * Show the link to the links popup and the number of links. |
|
1077 * |
|
1078 * @since 0.71 |
|
1079 * @deprecated 2.1 |
|
1080 * @deprecated {@internal Use function instead is unknown}} |
|
1081 * |
|
1082 * @param string $text the text of the link |
|
1083 * @param int $width the width of the popup window |
|
1084 * @param int $height the height of the popup window |
|
1085 * @param string $file the page to open in the popup window |
|
1086 * @param bool $count the number of links in the db |
|
1087 */ |
|
1088 function links_popup_script($text = 'Links', $width=400, $height=400, $file='links.all.php', $count = true) { |
|
1089 _deprecated_function( __FUNCTION__, '2.1' ); |
|
1090 } |
|
1091 |
|
1092 /** |
|
1093 * @since 1.0.1 |
|
1094 * @deprecated 2.1 |
|
1095 * @deprecated Use sanitize_bookmark_field() |
|
1096 * @see sanitize_bookmark_field() |
|
1097 * |
|
1098 * @param object $link |
|
1099 * @return unknown |
|
1100 */ |
|
1101 function get_linkrating($link) { |
|
1102 _deprecated_function( __FUNCTION__, '2.1', 'sanitize_bookmark_field()' ); |
|
1103 return sanitize_bookmark_field('link_rating', $link->link_rating, $link->link_id, 'display'); |
|
1104 } |
|
1105 |
|
1106 /** |
|
1107 * Gets the name of category by id. |
|
1108 * |
|
1109 * @since 0.71 |
|
1110 * @deprecated 2.1 |
|
1111 * @deprecated Use get_category() |
|
1112 * @see get_category() |
|
1113 * |
|
1114 * @param int $id The category to get. If no category supplied uses 0 |
|
1115 * @return string |
|
1116 */ |
|
1117 function get_linkcatname($id = 0) { |
|
1118 _deprecated_function( __FUNCTION__, '2.1', 'get_category()' ); |
|
1119 |
|
1120 $id = (int) $id; |
|
1121 |
|
1122 if ( empty($id) ) |
|
1123 return ''; |
|
1124 |
|
1125 $cats = wp_get_link_cats($id); |
|
1126 |
|
1127 if ( empty($cats) || ! is_array($cats) ) |
|
1128 return ''; |
|
1129 |
|
1130 $cat_id = (int) $cats[0]; // Take the first cat. |
|
1131 |
|
1132 $cat = get_category($cat_id); |
|
1133 return $cat->name; |
|
1134 } |
|
1135 |
|
1136 /** |
|
1137 * Print RSS comment feed link. |
|
1138 * |
|
1139 * @since 1.0.1 |
|
1140 * @deprecated 2.5 |
|
1141 * @deprecated Use post_comments_feed_link() |
|
1142 * @see post_comments_feed_link() |
|
1143 * |
|
1144 * @param string $link_text |
|
1145 */ |
|
1146 function comments_rss_link($link_text = 'Comments RSS') { |
|
1147 _deprecated_function( __FUNCTION__, '2.5', 'post_comments_feed_link()' ); |
|
1148 post_comments_feed_link($link_text); |
|
1149 } |
|
1150 |
|
1151 /** |
|
1152 * Print/Return link to category RSS2 feed. |
|
1153 * |
|
1154 * @since 1.2 |
|
1155 * @deprecated 2.5 |
|
1156 * @deprecated Use get_category_feed_link() |
|
1157 * @see get_category_feed_link() |
|
1158 * |
|
1159 * @param bool $echo |
|
1160 * @param int $cat_ID |
|
1161 * @return string|null |
|
1162 */ |
|
1163 function get_category_rss_link($echo = false, $cat_ID = 1) { |
|
1164 _deprecated_function( __FUNCTION__, '2.5', 'get_category_feed_link()' ); |
|
1165 |
|
1166 $link = get_category_feed_link($cat_ID, 'rss2'); |
|
1167 |
|
1168 if ( $echo ) |
|
1169 echo $link; |
|
1170 return $link; |
|
1171 } |
|
1172 |
|
1173 /** |
|
1174 * Print/Return link to author RSS feed. |
|
1175 * |
|
1176 * @since 1.2 |
|
1177 * @deprecated 2.5 |
|
1178 * @deprecated Use get_author_feed_link() |
|
1179 * @see get_author_feed_link() |
|
1180 * |
|
1181 * @param bool $echo |
|
1182 * @param int $author_id |
|
1183 * @return string|null |
|
1184 */ |
|
1185 function get_author_rss_link($echo = false, $author_id = 1) { |
|
1186 _deprecated_function( __FUNCTION__, '2.5', 'get_author_feed_link()' ); |
|
1187 |
|
1188 $link = get_author_feed_link($author_id); |
|
1189 if ( $echo ) |
|
1190 echo $link; |
|
1191 return $link; |
|
1192 } |
|
1193 |
|
1194 /** |
|
1195 * Return link to the post RSS feed. |
|
1196 * |
|
1197 * @since 1.5 |
|
1198 * @deprecated 2.2 |
|
1199 * @deprecated Use get_post_comments_feed_link() |
|
1200 * @see get_post_comments_feed_link() |
|
1201 * |
|
1202 * @return string |
|
1203 */ |
|
1204 function comments_rss() { |
|
1205 _deprecated_function( __FUNCTION__, '2.2', 'get_post_comments_feed_link()' ); |
|
1206 return esc_url( get_post_comments_feed_link() ); |
|
1207 } |
|
1208 |
|
1209 /** |
|
1210 * An alias of wp_create_user(). |
|
1211 * |
|
1212 * @since 2.0 |
|
1213 * @deprecated 2.0 |
|
1214 * @deprecated Use wp_create_user() |
|
1215 * @see wp_create_user() |
|
1216 * |
|
1217 * @param string $username The user's username. |
|
1218 * @param string $password The user's password. |
|
1219 * @param string $email The user's email (optional). |
|
1220 * @return int The new user's ID. |
|
1221 */ |
|
1222 function create_user($username, $password, $email) { |
|
1223 _deprecated_function( __FUNCTION__, '2.0', 'wp_create_user()' ); |
|
1224 return wp_create_user($username, $password, $email); |
|
1225 } |
|
1226 |
|
1227 /** |
|
1228 * Unused function. |
|
1229 * |
|
1230 * @deprecated 2.5 |
|
1231 */ |
|
1232 function gzip_compression() { |
|
1233 _deprecated_function( __FUNCTION__, '2.5' ); |
|
1234 return false; |
|
1235 } |
|
1236 |
|
1237 /** |
|
1238 * Retrieve an array of comment data about comment $comment_ID. |
|
1239 * |
|
1240 * @since 0.71 |
|
1241 * @deprecated 2.7 |
|
1242 * @deprecated Use get_comment() |
|
1243 * @see get_comment() |
|
1244 * |
|
1245 * @param int $comment_ID The ID of the comment |
|
1246 * @param int $no_cache Whether to use the cache (cast to bool) |
|
1247 * @param bool $include_unapproved Whether to include unapproved comments |
|
1248 * @return array The comment data |
|
1249 */ |
|
1250 function get_commentdata( $comment_ID, $no_cache = 0, $include_unapproved = false ) { |
|
1251 _deprecated_function( __FUNCTION__, '2.7', 'get_comment()' ); |
|
1252 return get_comment($comment_ID, ARRAY_A); |
|
1253 } |
|
1254 |
|
1255 /** |
|
1256 * Retrieve the category name by the category ID. |
|
1257 * |
|
1258 * @since 0.71 |
|
1259 * @deprecated 2.8 |
|
1260 * @deprecated Use get_cat_name() |
|
1261 * @see get_cat_name() |
|
1262 * |
|
1263 * @param int $cat_ID Category ID |
|
1264 * @return string category name |
|
1265 */ |
|
1266 function get_catname( $cat_ID ) { |
|
1267 _deprecated_function( __FUNCTION__, '2.8', 'get_cat_name()' ); |
|
1268 return get_cat_name( $cat_ID ); |
|
1269 } |
|
1270 |
|
1271 /** |
|
1272 * Retrieve category children list separated before and after the term IDs. |
|
1273 * |
|
1274 * @since 1.2.0 |
|
1275 * @deprecated 2.8 |
|
1276 * @deprecated Use get_term_children() |
|
1277 * @see get_term_children() |
|
1278 * |
|
1279 * @param int $id Category ID to retrieve children. |
|
1280 * @param string $before Optional. Prepend before category term ID. |
|
1281 * @param string $after Optional, default is empty string. Append after category term ID. |
|
1282 * @param array $visited Optional. Category Term IDs that have already been added. |
|
1283 * @return string |
|
1284 */ |
|
1285 function get_category_children( $id, $before = '/', $after = '', $visited = array() ) { |
|
1286 _deprecated_function( __FUNCTION__, '2.8', 'get_term_children()' ); |
|
1287 if ( 0 == $id ) |
|
1288 return ''; |
|
1289 |
|
1290 $chain = ''; |
|
1291 /** TODO: consult hierarchy */ |
|
1292 $cat_ids = get_all_category_ids(); |
|
1293 foreach ( (array) $cat_ids as $cat_id ) { |
|
1294 if ( $cat_id == $id ) |
|
1295 continue; |
|
1296 |
|
1297 $category = get_category( $cat_id ); |
|
1298 if ( is_wp_error( $category ) ) |
|
1299 return $category; |
|
1300 if ( $category->parent == $id && !in_array( $category->term_id, $visited ) ) { |
|
1301 $visited[] = $category->term_id; |
|
1302 $chain .= $before.$category->term_id.$after; |
|
1303 $chain .= get_category_children( $category->term_id, $before, $after ); |
|
1304 } |
|
1305 } |
|
1306 return $chain; |
|
1307 } |
|
1308 |
|
1309 /** |
|
1310 * Retrieve the description of the author of the current post. |
|
1311 * |
|
1312 * @since 1.5 |
|
1313 * @deprecated 2.8 |
|
1314 * @deprecated Use get_the_author_meta('description') |
|
1315 * @see get_the_author_meta() |
|
1316 * |
|
1317 * @return string The author's description. |
|
1318 */ |
|
1319 function get_the_author_description() { |
|
1320 _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'description\')' ); |
|
1321 return get_the_author_meta('description'); |
|
1322 } |
|
1323 |
|
1324 /** |
|
1325 * Display the description of the author of the current post. |
|
1326 * |
|
1327 * @since 1.0.0 |
|
1328 * @deprecated 2.8 |
|
1329 * @deprecated Use the_author_meta('description') |
|
1330 * @see the_author_meta() |
|
1331 */ |
|
1332 function the_author_description() { |
|
1333 _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'description\')' ); |
|
1334 the_author_meta('description'); |
|
1335 } |
|
1336 |
|
1337 /** |
|
1338 * Retrieve the login name of the author of the current post. |
|
1339 * |
|
1340 * @since 1.5 |
|
1341 * @deprecated 2.8 |
|
1342 * @deprecated Use get_the_author_meta('login') |
|
1343 * @see get_the_author_meta() |
|
1344 * |
|
1345 * @return string The author's login name (username). |
|
1346 */ |
|
1347 function get_the_author_login() { |
|
1348 _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'login\')' ); |
|
1349 return get_the_author_meta('login'); |
|
1350 } |
|
1351 |
|
1352 /** |
|
1353 * Display the login name of the author of the current post. |
|
1354 * |
|
1355 * @since 0.71 |
|
1356 * @deprecated 2.8 |
|
1357 * @deprecated Use the_author_meta('login') |
|
1358 * @see the_author_meta() |
|
1359 */ |
|
1360 function the_author_login() { |
|
1361 _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'login\')' ); |
|
1362 the_author_meta('login'); |
|
1363 } |
|
1364 |
|
1365 /** |
|
1366 * Retrieve the first name of the author of the current post. |
|
1367 * |
|
1368 * @since 1.5 |
|
1369 * @deprecated 2.8 |
|
1370 * @deprecated Use get_the_author_meta('first_name') |
|
1371 * @see get_the_author_meta() |
|
1372 * |
|
1373 * @return string The author's first name. |
|
1374 */ |
|
1375 function get_the_author_firstname() { |
|
1376 _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'first_name\')' ); |
|
1377 return get_the_author_meta('first_name'); |
|
1378 } |
|
1379 |
|
1380 /** |
|
1381 * Display the first name of the author of the current post. |
|
1382 * |
|
1383 * @since 0.71 |
|
1384 * @deprecated 2.8 |
|
1385 * @deprecated Use the_author_meta('first_name') |
|
1386 * @see the_author_meta() |
|
1387 */ |
|
1388 function the_author_firstname() { |
|
1389 _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'first_name\')' ); |
|
1390 the_author_meta('first_name'); |
|
1391 } |
|
1392 |
|
1393 /** |
|
1394 * Retrieve the last name of the author of the current post. |
|
1395 * |
|
1396 * @since 1.5 |
|
1397 * @deprecated 2.8 |
|
1398 * @deprecated Use get_the_author_meta('last_name') |
|
1399 * @see get_the_author_meta() |
|
1400 * |
|
1401 * @return string The author's last name. |
|
1402 */ |
|
1403 function get_the_author_lastname() { |
|
1404 _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'last_name\')' ); |
|
1405 return get_the_author_meta('last_name'); |
|
1406 } |
|
1407 |
|
1408 /** |
|
1409 * Display the last name of the author of the current post. |
|
1410 * |
|
1411 * @since 0.71 |
|
1412 * @deprecated 2.8 |
|
1413 * @deprecated Use the_author_meta('last_name') |
|
1414 * @see the_author_meta() |
|
1415 */ |
|
1416 function the_author_lastname() { |
|
1417 _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'last_name\')' ); |
|
1418 the_author_meta('last_name'); |
|
1419 } |
|
1420 |
|
1421 /** |
|
1422 * Retrieve the nickname of the author of the current post. |
|
1423 * |
|
1424 * @since 1.5 |
|
1425 * @deprecated 2.8 |
|
1426 * @deprecated Use get_the_author_meta('nickname') |
|
1427 * @see get_the_author_meta() |
|
1428 * |
|
1429 * @return string The author's nickname. |
|
1430 */ |
|
1431 function get_the_author_nickname() { |
|
1432 _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'nickname\')' ); |
|
1433 return get_the_author_meta('nickname'); |
|
1434 } |
|
1435 |
|
1436 /** |
|
1437 * Display the nickname of the author of the current post. |
|
1438 * |
|
1439 * @since 0.71 |
|
1440 * @deprecated 2.8 |
|
1441 * @deprecated Use the_author_meta('nickname') |
|
1442 * @see the_author_meta() |
|
1443 */ |
|
1444 function the_author_nickname() { |
|
1445 _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'nickname\')' ); |
|
1446 the_author_meta('nickname'); |
|
1447 } |
|
1448 |
|
1449 /** |
|
1450 * Retrieve the email of the author of the current post. |
|
1451 * |
|
1452 * @since 1.5 |
|
1453 * @deprecated 2.8 |
|
1454 * @deprecated Use get_the_author_meta('email') |
|
1455 * @see get_the_author_meta() |
|
1456 * |
|
1457 * @return string The author's username. |
|
1458 */ |
|
1459 function get_the_author_email() { |
|
1460 _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'email\')' ); |
|
1461 return get_the_author_meta('email'); |
|
1462 } |
|
1463 |
|
1464 /** |
|
1465 * Display the email of the author of the current post. |
|
1466 * |
|
1467 * @since 0.71 |
|
1468 * @deprecated 2.8 |
|
1469 * @deprecated Use the_author_meta('email') |
|
1470 * @see the_author_meta() |
|
1471 */ |
|
1472 function the_author_email() { |
|
1473 _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'email\')' ); |
|
1474 the_author_meta('email'); |
|
1475 } |
|
1476 |
|
1477 /** |
|
1478 * Retrieve the ICQ number of the author of the current post. |
|
1479 * |
|
1480 * @since 1.5 |
|
1481 * @deprecated 2.8 |
|
1482 * @deprecated Use get_the_author_meta('icq') |
|
1483 * @see get_the_author_meta() |
|
1484 * |
|
1485 * @return string The author's ICQ number. |
|
1486 */ |
|
1487 function get_the_author_icq() { |
|
1488 _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'icq\')' ); |
|
1489 return get_the_author_meta('icq'); |
|
1490 } |
|
1491 |
|
1492 /** |
|
1493 * Display the ICQ number of the author of the current post. |
|
1494 * |
|
1495 * @since 0.71 |
|
1496 * @deprecated 2.8 |
|
1497 * @deprecated Use the_author_meta('icq') |
|
1498 * @see the_author_meta() |
|
1499 */ |
|
1500 function the_author_icq() { |
|
1501 _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'icq\')' ); |
|
1502 the_author_meta('icq'); |
|
1503 } |
|
1504 |
|
1505 /** |
|
1506 * Retrieve the Yahoo! IM name of the author of the current post. |
|
1507 * |
|
1508 * @since 1.5 |
|
1509 * @deprecated 2.8 |
|
1510 * @deprecated Use get_the_author_meta('yim') |
|
1511 * @see get_the_author_meta() |
|
1512 * |
|
1513 * @return string The author's Yahoo! IM name. |
|
1514 */ |
|
1515 function get_the_author_yim() { |
|
1516 _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'yim\')' ); |
|
1517 return get_the_author_meta('yim'); |
|
1518 } |
|
1519 |
|
1520 /** |
|
1521 * Display the Yahoo! IM name of the author of the current post. |
|
1522 * |
|
1523 * @since 0.71 |
|
1524 * @deprecated 2.8 |
|
1525 * @deprecated Use the_author_meta('yim') |
|
1526 * @see the_author_meta() |
|
1527 */ |
|
1528 function the_author_yim() { |
|
1529 _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'yim\')' ); |
|
1530 the_author_meta('yim'); |
|
1531 } |
|
1532 |
|
1533 /** |
|
1534 * Retrieve the MSN address of the author of the current post. |
|
1535 * |
|
1536 * @since 1.5 |
|
1537 * @deprecated 2.8 |
|
1538 * @deprecated Use get_the_author_meta('msn') |
|
1539 * @see get_the_author_meta() |
|
1540 * |
|
1541 * @return string The author's MSN address. |
|
1542 */ |
|
1543 function get_the_author_msn() { |
|
1544 _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'msn\')' ); |
|
1545 return get_the_author_meta('msn'); |
|
1546 } |
|
1547 |
|
1548 /** |
|
1549 * Display the MSN address of the author of the current post. |
|
1550 * |
|
1551 * @since 0.71 |
|
1552 * @deprecated 2.8 |
|
1553 * @deprecated Use the_author_meta('msn') |
|
1554 * @see the_author_meta() |
|
1555 */ |
|
1556 function the_author_msn() { |
|
1557 _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'msn\')' ); |
|
1558 the_author_meta('msn'); |
|
1559 } |
|
1560 |
|
1561 /** |
|
1562 * Retrieve the AIM address of the author of the current post. |
|
1563 * |
|
1564 * @since 1.5 |
|
1565 * @deprecated 2.8 |
|
1566 * @deprecated Use get_the_author_meta('aim') |
|
1567 * @see get_the_author_meta() |
|
1568 * |
|
1569 * @return string The author's AIM address. |
|
1570 */ |
|
1571 function get_the_author_aim() { |
|
1572 _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'aim\')' ); |
|
1573 return get_the_author_meta('aim'); |
|
1574 } |
|
1575 |
|
1576 /** |
|
1577 * Display the AIM address of the author of the current post. |
|
1578 * |
|
1579 * @since 0.71 |
|
1580 * @see the_author_meta() |
|
1581 * @deprecated 2.8 |
|
1582 * @deprecated Use the_author_meta('aim') |
|
1583 */ |
|
1584 function the_author_aim() { |
|
1585 _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'aim\')' ); |
|
1586 the_author_meta('aim'); |
|
1587 } |
|
1588 |
|
1589 /** |
|
1590 * Retrieve the specified author's preferred display name. |
|
1591 * |
|
1592 * @since 1.0.0 |
|
1593 * @deprecated 2.8 |
|
1594 * @deprecated Use get_the_author_meta('display_name') |
|
1595 * @see get_the_author_meta() |
|
1596 * |
|
1597 * @param int $auth_id The ID of the author. |
|
1598 * @return string The author's display name. |
|
1599 */ |
|
1600 function get_author_name( $auth_id = false ) { |
|
1601 _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'display_name\')' ); |
|
1602 return get_the_author_meta('display_name', $auth_id); |
|
1603 } |
|
1604 |
|
1605 /** |
|
1606 * Retrieve the URL to the home page of the author of the current post. |
|
1607 * |
|
1608 * @since 1.5 |
|
1609 * @deprecated 2.8 |
|
1610 * @deprecated Use get_the_author_meta('url') |
|
1611 * @see get_the_author_meta() |
|
1612 * |
|
1613 * @return string The URL to the author's page. |
|
1614 */ |
|
1615 function get_the_author_url() { |
|
1616 _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'url\')' ); |
|
1617 return get_the_author_meta('url'); |
|
1618 } |
|
1619 |
|
1620 /** |
|
1621 * Display the URL to the home page of the author of the current post. |
|
1622 * |
|
1623 * @since 0.71 |
|
1624 * @deprecated 2.8 |
|
1625 * @deprecated Use the_author_meta('url') |
|
1626 * @see the_author_meta() |
|
1627 */ |
|
1628 function the_author_url() { |
|
1629 _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'url\')' ); |
|
1630 the_author_meta('url'); |
|
1631 } |
|
1632 |
|
1633 /** |
|
1634 * Retrieve the ID of the author of the current post. |
|
1635 * |
|
1636 * @since 1.5 |
|
1637 * @deprecated 2.8 |
|
1638 * @deprecated Use get_the_author_meta('ID') |
|
1639 * @see get_the_author_meta() |
|
1640 * |
|
1641 * @return int The author's ID. |
|
1642 */ |
|
1643 function get_the_author_ID() { |
|
1644 _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'ID\')' ); |
|
1645 return get_the_author_meta('ID'); |
|
1646 } |
|
1647 |
|
1648 /** |
|
1649 * Display the ID of the author of the current post. |
|
1650 * |
|
1651 * @since 0.71 |
|
1652 * @deprecated 2.8 |
|
1653 * @deprecated Use the_author_meta('ID') |
|
1654 * @see the_author_meta() |
|
1655 */ |
|
1656 function the_author_ID() { |
|
1657 _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'ID\')' ); |
|
1658 the_author_meta('ID'); |
|
1659 } |
|
1660 |
|
1661 /** |
|
1662 * Display the post content for the feed. |
|
1663 * |
|
1664 * For encoding the html or the $encode_html parameter, there are three possible |
|
1665 * values. '0' will make urls footnotes and use make_url_footnote(). '1' will |
|
1666 * encode special characters and automatically display all of the content. The |
|
1667 * value of '2' will strip all HTML tags from the content. |
|
1668 * |
|
1669 * Also note that you cannot set the amount of words and not set the html |
|
1670 * encoding. If that is the case, then the html encoding will default to 2, |
|
1671 * which will strip all HTML tags. |
|
1672 * |
|
1673 * To restrict the amount of words of the content, you can use the cut |
|
1674 * parameter. If the content is less than the amount, then there won't be any |
|
1675 * dots added to the end. If there is content left over, then dots will be added |
|
1676 * and the rest of the content will be removed. |
|
1677 * |
|
1678 * @package WordPress |
|
1679 * @subpackage Feed |
|
1680 * @since 0.71 |
|
1681 * @uses apply_filters() Calls 'the_content_rss' on the content before processing. |
|
1682 * |
|
1683 * @deprecated 2.9.0 |
|
1684 * @deprecated Use the_content_feed() |
|
1685 * @see the_content_feed() |
|
1686 * |
|
1687 * @param string $more_link_text Optional. Text to display when more content is available but not displayed. |
|
1688 * @param int|bool $stripteaser Optional. Default is 0. |
|
1689 * @param string $more_file Optional. |
|
1690 * @param int $cut Optional. Amount of words to keep for the content. |
|
1691 * @param int $encode_html Optional. How to encode the content. |
|
1692 */ |
|
1693 function the_content_rss($more_link_text='(more...)', $stripteaser=0, $more_file='', $cut = 0, $encode_html = 0) { |
|
1694 _deprecated_function( __FUNCTION__, '2.9', 'the_content_feed' ); |
|
1695 $content = get_the_content($more_link_text, $stripteaser); |
|
1696 $content = apply_filters('the_content_rss', $content); |
|
1697 if ( $cut && !$encode_html ) |
|
1698 $encode_html = 2; |
|
1699 if ( 1== $encode_html ) { |
|
1700 $content = esc_html($content); |
|
1701 $cut = 0; |
|
1702 } elseif ( 0 == $encode_html ) { |
|
1703 $content = make_url_footnote($content); |
|
1704 } elseif ( 2 == $encode_html ) { |
|
1705 $content = strip_tags($content); |
|
1706 } |
|
1707 if ( $cut ) { |
|
1708 $blah = explode(' ', $content); |
|
1709 if ( count($blah) > $cut ) { |
|
1710 $k = $cut; |
|
1711 $use_dotdotdot = 1; |
|
1712 } else { |
|
1713 $k = count($blah); |
|
1714 $use_dotdotdot = 0; |
|
1715 } |
|
1716 |
|
1717 /** @todo Check performance, might be faster to use array slice instead. */ |
|
1718 for ( $i=0; $i<$k; $i++ ) |
|
1719 $excerpt .= $blah[$i].' '; |
|
1720 $excerpt .= ($use_dotdotdot) ? '...' : ''; |
|
1721 $content = $excerpt; |
|
1722 } |
|
1723 $content = str_replace(']]>', ']]>', $content); |
|
1724 echo $content; |
|
1725 } |
|
1726 |
|
1727 /** |
|
1728 * Strip HTML and put links at the bottom of stripped content. |
|
1729 * |
|
1730 * Searches for all of the links, strips them out of the content, and places |
|
1731 * them at the bottom of the content with numbers. |
|
1732 * |
|
1733 * @since 0.71 |
|
1734 * @deprecated 2.9.0 |
|
1735 * |
|
1736 * @param string $content Content to get links |
|
1737 * @return string HTML stripped out of content with links at the bottom. |
|
1738 */ |
|
1739 function make_url_footnote( $content ) { |
|
1740 _deprecated_function( __FUNCTION__, '2.9', '' ); |
|
1741 preg_match_all( '/<a(.+?)href=\"(.+?)\"(.*?)>(.+?)<\/a>/', $content, $matches ); |
|
1742 $links_summary = "\n"; |
|
1743 for ( $i=0; $i<count($matches[0]); $i++ ) { |
|
1744 $link_match = $matches[0][$i]; |
|
1745 $link_number = '['.($i+1).']'; |
|
1746 $link_url = $matches[2][$i]; |
|
1747 $link_text = $matches[4][$i]; |
|
1748 $content = str_replace( $link_match, $link_text . ' ' . $link_number, $content ); |
|
1749 $link_url = ( ( strtolower( substr( $link_url, 0, 7 ) ) != 'http://' ) && ( strtolower( substr( $link_url, 0, 8 ) ) != 'https://' ) ) ? get_option( 'home' ) . $link_url : $link_url; |
|
1750 $links_summary .= "\n" . $link_number . ' ' . $link_url; |
|
1751 } |
|
1752 $content = strip_tags( $content ); |
|
1753 $content .= $links_summary; |
|
1754 return $content; |
|
1755 } |
|
1756 |
|
1757 /** |
|
1758 * Retrieve translated string with vertical bar context |
|
1759 * |
|
1760 * Quite a few times, there will be collisions with similar translatable text |
|
1761 * found in more than two places but with different translated context. |
|
1762 * |
|
1763 * In order to use the separate contexts, the _c() function is used and the |
|
1764 * translatable string uses a pipe ('|') which has the context the string is in. |
|
1765 * |
|
1766 * When the translated string is returned, it is everything before the pipe, not |
|
1767 * including the pipe character. If there is no pipe in the translated text then |
|
1768 * everything is returned. |
|
1769 * |
|
1770 * @since 2.2.0 |
|
1771 * @deprecated 2.9.0 |
|
1772 * @deprecated Use _x() |
|
1773 * @see _x() |
|
1774 * |
|
1775 * @param string $text Text to translate |
|
1776 * @param string $domain Optional. Domain to retrieve the translated text |
|
1777 * @return string Translated context string without pipe |
|
1778 */ |
|
1779 function _c( $text, $domain = 'default' ) { |
|
1780 _deprecated_function( __FUNCTION__, '2.9', '_x()' ); |
|
1781 return before_last_bar( translate( $text, $domain ) ); |
|
1782 } |
|
1783 |
|
1784 /** |
|
1785 * Translates $text like translate(), but assumes that the text |
|
1786 * contains a context after its last vertical bar. |
|
1787 * |
|
1788 * @since 2.5 |
|
1789 * @uses translate() |
|
1790 * @deprecated 3.0.0 |
|
1791 * @deprecated Use _x() |
|
1792 * @see _x() |
|
1793 * |
|
1794 * @param string $text Text to translate |
|
1795 * @param string $domain Domain to retrieve the translated text |
|
1796 * @return string Translated text |
|
1797 */ |
|
1798 function translate_with_context( $text, $domain = 'default' ) { |
|
1799 _deprecated_function( __FUNCTION__, '2.9', '_x()' ); |
|
1800 return before_last_bar( translate( $text, $domain ) ); |
|
1801 } |
|
1802 |
|
1803 /** |
|
1804 * A version of _n(), which supports contexts. |
|
1805 * Strips everything from the translation after the last bar. |
|
1806 * |
|
1807 * @since 2.7.0 |
|
1808 * @deprecated 3.0.0 |
|
1809 * @deprecated Use _nx() |
|
1810 * @see _nx() |
|
1811 * @see _n() For parameters. |
|
1812 * @see _c() For parameters. _c() is deprecated. |
|
1813 * |
|
1814 */ |
|
1815 function _nc( $single, $plural, $number, $domain = 'default' ) { |
|
1816 _deprecated_function( __FUNCTION__, '2.9', '_nx()' ); |
|
1817 return before_last_bar( _n( $single, $plural, $number, $domain ) ); |
|
1818 } |
|
1819 |
|
1820 /** |
|
1821 * Retrieve the plural or single form based on the amount. |
|
1822 * |
|
1823 * @since 1.2.0 |
|
1824 * @deprecated 2.8.0 |
|
1825 * @deprecated Use _n() |
|
1826 * @see _n() |
|
1827 */ |
|
1828 function __ngettext() { |
|
1829 _deprecated_function( __FUNCTION__, '2.8', '_n()' ); |
|
1830 $args = func_get_args(); |
|
1831 return call_user_func_array('_n', $args); |
|
1832 } |
|
1833 |
|
1834 /** |
|
1835 * Register plural strings in POT file, but don't translate them. |
|
1836 * |
|
1837 * @since 2.5 |
|
1838 * @deprecated 2.8.0 |
|
1839 * @deprecated Use _n_noop() |
|
1840 * @see _n_noop() |
|
1841 */ |
|
1842 function __ngettext_noop() { |
|
1843 _deprecated_function( __FUNCTION__, '2.8', '_n_noop()' ); |
|
1844 $args = func_get_args(); |
|
1845 return call_user_func_array('_n_noop', $args); |
|
1846 |
|
1847 } |
|
1848 |
|
1849 /** |
|
1850 * Retrieve all autoload options, or all options if no autoloaded ones exist. |
|
1851 * |
|
1852 * @since 1.0.0 |
|
1853 * @deprecated 3.0.0 |
|
1854 * @deprecated Use wp_load_alloptions()) |
|
1855 * @see wp_load_alloptions() |
|
1856 * |
|
1857 * @return array List of all options. |
|
1858 */ |
|
1859 function get_alloptions() { |
|
1860 _deprecated_function( __FUNCTION__, '3.0', 'wp_load_alloptions()' ); |
|
1861 return wp_load_alloptions(); |
|
1862 } |
|
1863 |
|
1864 /** |
|
1865 * Retrieve HTML content of attachment image with link. |
|
1866 * |
|
1867 * @since 2.0.0 |
|
1868 * @deprecated 2.5.0 |
|
1869 * @deprecated Use wp_get_attachment_link() |
|
1870 * @see wp_get_attachment_link() |
|
1871 * |
|
1872 * @param int $id Optional. Post ID. |
|
1873 * @param bool $fullsize Optional, default is false. Whether to use full size image. |
|
1874 * @param array $max_dims Optional. Max image dimensions. |
|
1875 * @param bool $permalink Optional, default is false. Whether to include permalink to image. |
|
1876 * @return string |
|
1877 */ |
|
1878 function get_the_attachment_link($id = 0, $fullsize = false, $max_dims = false, $permalink = false) { |
|
1879 _deprecated_function( __FUNCTION__, '2.5', 'wp_get_attachment_link()' ); |
|
1880 $id = (int) $id; |
|
1881 $_post = get_post($id); |
|
1882 |
|
1883 if ( ('attachment' != $_post->post_type) || !$url = wp_get_attachment_url($_post->ID) ) |
|
1884 return __('Missing Attachment'); |
|
1885 |
|
1886 if ( $permalink ) |
|
1887 $url = get_attachment_link($_post->ID); |
|
1888 |
|
1889 $post_title = esc_attr($_post->post_title); |
|
1890 |
|
1891 $innerHTML = get_attachment_innerHTML($_post->ID, $fullsize, $max_dims); |
|
1892 return "<a href='$url' title='$post_title'>$innerHTML</a>"; |
|
1893 } |
|
1894 |
|
1895 /** |
|
1896 * Retrieve icon URL and Path. |
|
1897 * |
|
1898 * @since 2.1.0 |
|
1899 * @deprecated 2.5.0 |
|
1900 * @deprecated Use wp_get_attachment_image_src() |
|
1901 * @see wp_get_attachment_image_src() |
|
1902 * |
|
1903 * @param int $id Optional. Post ID. |
|
1904 * @param bool $fullsize Optional, default to false. Whether to have full image. |
|
1905 * @return array Icon URL and full path to file, respectively. |
|
1906 */ |
|
1907 function get_attachment_icon_src( $id = 0, $fullsize = false ) { |
|
1908 _deprecated_function( __FUNCTION__, '2.5', 'wp_get_attachment_image_src()' ); |
|
1909 $id = (int) $id; |
|
1910 if ( !$post = get_post($id) ) |
|
1911 return false; |
|
1912 |
|
1913 $file = get_attached_file( $post->ID ); |
|
1914 |
|
1915 if ( !$fullsize && $src = wp_get_attachment_thumb_url( $post->ID ) ) { |
|
1916 // We have a thumbnail desired, specified and existing |
|
1917 |
|
1918 $src_file = basename($src); |
|
1919 $class = 'attachmentthumb'; |
|
1920 } elseif ( wp_attachment_is_image( $post->ID ) ) { |
|
1921 // We have an image without a thumbnail |
|
1922 |
|
1923 $src = wp_get_attachment_url( $post->ID ); |
|
1924 $src_file = & $file; |
|
1925 $class = 'attachmentimage'; |
|
1926 } elseif ( $src = wp_mime_type_icon( $post->ID ) ) { |
|
1927 // No thumb, no image. We'll look for a mime-related icon instead. |
|
1928 |
|
1929 $icon_dir = apply_filters( 'icon_dir', get_template_directory() . '/images' ); |
|
1930 $src_file = $icon_dir . '/' . basename($src); |
|
1931 } |
|
1932 |
|
1933 if ( !isset($src) || !$src ) |
|
1934 return false; |
|
1935 |
|
1936 return array($src, $src_file); |
|
1937 } |
|
1938 |
|
1939 /** |
|
1940 * Retrieve HTML content of icon attachment image element. |
|
1941 * |
|
1942 * @since 2.0.0 |
|
1943 * @deprecated 2.5.0 |
|
1944 * @deprecated Use wp_get_attachment_image() |
|
1945 * @see wp_get_attachment_image() |
|
1946 * |
|
1947 * @param int $id Optional. Post ID. |
|
1948 * @param bool $fullsize Optional, default to false. Whether to have full size image. |
|
1949 * @param array $max_dims Optional. Dimensions of image. |
|
1950 * @return string HTML content. |
|
1951 */ |
|
1952 function get_attachment_icon( $id = 0, $fullsize = false, $max_dims = false ) { |
|
1953 _deprecated_function( __FUNCTION__, '2.5', 'wp_get_attachment_image()' ); |
|
1954 $id = (int) $id; |
|
1955 if ( !$post = get_post($id) ) |
|
1956 return false; |
|
1957 |
|
1958 if ( !$src = get_attachment_icon_src( $post->ID, $fullsize ) ) |
|
1959 return false; |
|
1960 |
|
1961 list($src, $src_file) = $src; |
|
1962 |
|
1963 // Do we need to constrain the image? |
|
1964 if ( ($max_dims = apply_filters('attachment_max_dims', $max_dims)) && file_exists($src_file) ) { |
|
1965 |
|
1966 $imagesize = getimagesize($src_file); |
|
1967 |
|
1968 if (($imagesize[0] > $max_dims[0]) || $imagesize[1] > $max_dims[1] ) { |
|
1969 $actual_aspect = $imagesize[0] / $imagesize[1]; |
|
1970 $desired_aspect = $max_dims[0] / $max_dims[1]; |
|
1971 |
|
1972 if ( $actual_aspect >= $desired_aspect ) { |
|
1973 $height = $actual_aspect * $max_dims[0]; |
|
1974 $constraint = "width='{$max_dims[0]}' "; |
|
1975 $post->iconsize = array($max_dims[0], $height); |
|
1976 } else { |
|
1977 $width = $max_dims[1] / $actual_aspect; |
|
1978 $constraint = "height='{$max_dims[1]}' "; |
|
1979 $post->iconsize = array($width, $max_dims[1]); |
|
1980 } |
|
1981 } else { |
|
1982 $post->iconsize = array($imagesize[0], $imagesize[1]); |
|
1983 $constraint = ''; |
|
1984 } |
|
1985 } else { |
|
1986 $constraint = ''; |
|
1987 } |
|
1988 |
|
1989 $post_title = esc_attr($post->post_title); |
|
1990 |
|
1991 $icon = "<img src='$src' title='$post_title' alt='$post_title' $constraint/>"; |
|
1992 |
|
1993 return apply_filters( 'attachment_icon', $icon, $post->ID ); |
|
1994 } |
|
1995 |
|
1996 /** |
|
1997 * Retrieve HTML content of image element. |
|
1998 * |
|
1999 * @since 2.0.0 |
|
2000 * @deprecated 2.5.0 |
|
2001 * @deprecated Use wp_get_attachment_image() |
|
2002 * @see wp_get_attachment_image() |
|
2003 * |
|
2004 * @param int $id Optional. Post ID. |
|
2005 * @param bool $fullsize Optional, default to false. Whether to have full size image. |
|
2006 * @param array $max_dims Optional. Dimensions of image. |
|
2007 * @return string |
|
2008 */ |
|
2009 function get_attachment_innerHTML($id = 0, $fullsize = false, $max_dims = false) { |
|
2010 _deprecated_function( __FUNCTION__, '2.5', 'wp_get_attachment_image()' ); |
|
2011 $id = (int) $id; |
|
2012 if ( !$post = get_post($id) ) |
|
2013 return false; |
|
2014 |
|
2015 if ( $innerHTML = get_attachment_icon($post->ID, $fullsize, $max_dims)) |
|
2016 return $innerHTML; |
|
2017 |
|
2018 $innerHTML = esc_attr($post->post_title); |
|
2019 |
|
2020 return apply_filters('attachment_innerHTML', $innerHTML, $post->ID); |
|
2021 } |
|
2022 |
|
2023 /** |
|
2024 * Retrieve bookmark data based on ID. |
|
2025 * |
|
2026 * @since 2.0.0 |
|
2027 * @deprecated 2.1.0 |
|
2028 * @deprecated Use get_bookmark() |
|
2029 * @see get_bookmark() |
|
2030 * |
|
2031 * @param int $bookmark_id ID of link |
|
2032 * @param string $output OBJECT, ARRAY_N, or ARRAY_A |
|
2033 * @return object|array |
|
2034 */ |
|
2035 function get_link($bookmark_id, $output = OBJECT, $filter = 'raw') { |
|
2036 _deprecated_function( __FUNCTION__, '2.1', 'get_bookmark()' ); |
|
2037 return get_bookmark($bookmark_id, $output, $filter); |
|
2038 } |
|
2039 |
|
2040 /** |
|
2041 * Performs esc_url() for database or redirect usage. |
|
2042 * |
|
2043 * @since 2.3.1 |
|
2044 * @deprecated 2.8.0 |
|
2045 * @deprecated Use esc_url_raw() |
|
2046 * @see esc_url_raw() |
|
2047 * |
|
2048 * @param string $url The URL to be cleaned. |
|
2049 * @param array $protocols An array of acceptable protocols. |
|
2050 * @return string The cleaned URL. |
|
2051 */ |
|
2052 function sanitize_url( $url, $protocols = null ) { |
|
2053 _deprecated_function( __FUNCTION__, '2.8', 'esc_url_raw()' ); |
|
2054 return esc_url_raw( $url, $protocols ); |
|
2055 } |
|
2056 |
|
2057 /** |
|
2058 * Checks and cleans a URL. |
|
2059 * |
|
2060 * A number of characters are removed from the URL. If the URL is for displaying |
|
2061 * (the default behaviour) ampersands are also replaced. The 'clean_url' filter |
|
2062 * is applied to the returned cleaned URL. |
|
2063 * |
|
2064 * @since 1.2.0 |
|
2065 * @deprecated 3.0.0 |
|
2066 * @deprecated Use esc_url() |
|
2067 * @see Alias for esc_url() |
|
2068 * |
|
2069 * @param string $url The URL to be cleaned. |
|
2070 * @param array $protocols Optional. An array of acceptable protocols. |
|
2071 * @param string $context Optional. How the URL will be used. Default is 'display'. |
|
2072 * @return string The cleaned $url after the 'clean_url' filter is applied. |
|
2073 */ |
|
2074 function clean_url( $url, $protocols = null, $context = 'display' ) { |
|
2075 if ( $context == 'db' ) |
|
2076 _deprecated_function( 'clean_url( $context = \'db\' )', '3.0', 'esc_url_raw()' ); |
|
2077 else |
|
2078 _deprecated_function( __FUNCTION__, '3.0', 'esc_url()' ); |
|
2079 return esc_url( $url, $protocols, $context ); |
|
2080 } |
|
2081 |
|
2082 /** |
|
2083 * Escape single quotes, specialchar double quotes, and fix line endings. |
|
2084 * |
|
2085 * The filter 'js_escape' is also applied by esc_js() |
|
2086 * |
|
2087 * @since 2.0.4 |
|
2088 * @deprecated 2.8.0 |
|
2089 * @deprecated Use esc_js() |
|
2090 * @see esc_js() |
|
2091 * |
|
2092 * @param string $text The text to be escaped. |
|
2093 * @return string Escaped text. |
|
2094 */ |
|
2095 function js_escape( $text ) { |
|
2096 _deprecated_function( __FUNCTION__, '2.8', 'esc_js()' ); |
|
2097 return esc_js( $text ); |
|
2098 } |
|
2099 |
|
2100 /** |
|
2101 * Escaping for HTML blocks. |
|
2102 * |
|
2103 * @deprecated 2.8.0 |
|
2104 * @deprecated Use esc_html() |
|
2105 * @see esc_html() |
|
2106 */ |
|
2107 function wp_specialchars( $string, $quote_style = ENT_NOQUOTES, $charset = false, $double_encode = false ) { |
|
2108 _deprecated_function( __FUNCTION__, '2.8', 'esc_html()' ); |
|
2109 if ( func_num_args() > 1 ) { // Maintain backwards compat for people passing additional args |
|
2110 $args = func_get_args(); |
|
2111 return call_user_func_array( '_wp_specialchars', $args ); |
|
2112 } else { |
|
2113 return esc_html( $string ); |
|
2114 } |
|
2115 } |
|
2116 |
|
2117 /** |
|
2118 * Escaping for HTML attributes. |
|
2119 * |
|
2120 * @since 2.0.6 |
|
2121 * @deprecated 2.8.0 |
|
2122 * @deprecated Use esc_attr() |
|
2123 * @see esc_attr() |
|
2124 * |
|
2125 * @param string $text |
|
2126 * @return string |
|
2127 */ |
|
2128 function attribute_escape( $text ) { |
|
2129 _deprecated_function( __FUNCTION__, '2.8', 'esc_attr()' ); |
|
2130 return esc_attr( $text ); |
|
2131 } |
|
2132 |
|
2133 /** |
|
2134 * Register widget for sidebar with backwards compatibility. |
|
2135 * |
|
2136 * Allows $name to be an array that accepts either three elements to grab the |
|
2137 * first element and the third for the name or just uses the first element of |
|
2138 * the array for the name. |
|
2139 * |
|
2140 * Passes to {@link wp_register_sidebar_widget()} after argument list and |
|
2141 * backwards compatibility is complete. |
|
2142 * |
|
2143 * @since 2.2.0 |
|
2144 * @deprecated 2.8.0 |
|
2145 * @deprecated Use wp_register_sidebar_widget() |
|
2146 * @see wp_register_sidebar_widget() |
|
2147 * |
|
2148 * @param string|int $name Widget ID. |
|
2149 * @param callback $output_callback Run when widget is called. |
|
2150 * @param string $classname Classname widget option. |
|
2151 * @param mixed $params,... Widget parameters. |
|
2152 */ |
|
2153 function register_sidebar_widget($name, $output_callback, $classname = '') { |
|
2154 _deprecated_function( __FUNCTION__, '2.8', 'wp_register_sidebar_widget()' ); |
|
2155 // Compat |
|
2156 if ( is_array($name) ) { |
|
2157 if ( count($name) == 3 ) |
|
2158 $name = sprintf($name[0], $name[2]); |
|
2159 else |
|
2160 $name = $name[0]; |
|
2161 } |
|
2162 |
|
2163 $id = sanitize_title($name); |
|
2164 $options = array(); |
|
2165 if ( !empty($classname) && is_string($classname) ) |
|
2166 $options['classname'] = $classname; |
|
2167 $params = array_slice(func_get_args(), 2); |
|
2168 $args = array($id, $name, $output_callback, $options); |
|
2169 if ( !empty($params) ) |
|
2170 $args = array_merge($args, $params); |
|
2171 |
|
2172 call_user_func_array('wp_register_sidebar_widget', $args); |
|
2173 } |
|
2174 |
|
2175 /** |
|
2176 * Alias of {@link wp_unregister_sidebar_widget()}. |
|
2177 * |
|
2178 * @since 2.2.0 |
|
2179 * @deprecated 2.8.0 |
|
2180 * @deprecated Use wp_unregister_sidebar_widget() |
|
2181 * @see wp_unregister_sidebar_widget() |
|
2182 * |
|
2183 * @param int|string $id Widget ID. |
|
2184 */ |
|
2185 function unregister_sidebar_widget($id) { |
|
2186 _deprecated_function( __FUNCTION__, '2.8', 'wp_unregister_sidebar_widget()' ); |
|
2187 return wp_unregister_sidebar_widget($id); |
|
2188 } |
|
2189 |
|
2190 /** |
|
2191 * Registers widget control callback for customizing options. |
|
2192 * |
|
2193 * Allows $name to be an array that accepts either three elements to grab the |
|
2194 * first element and the third for the name or just uses the first element of |
|
2195 * the array for the name. |
|
2196 * |
|
2197 * Passes to {@link wp_register_widget_control()} after the argument list has |
|
2198 * been compiled. |
|
2199 * |
|
2200 * @since 2.2.0 |
|
2201 * @deprecated 2.8.0 |
|
2202 * @deprecated Use wp_register_widget_control() |
|
2203 * @see wp_register_widget_control() |
|
2204 * |
|
2205 * @param int|string $name Sidebar ID. |
|
2206 * @param callback $control_callback Widget control callback to display and process form. |
|
2207 * @param int $width Widget width. |
|
2208 * @param int $height Widget height. |
|
2209 */ |
|
2210 function register_widget_control($name, $control_callback, $width = '', $height = '') { |
|
2211 _deprecated_function( __FUNCTION__, '2.8', 'wp_register_widget_control()' ); |
|
2212 // Compat |
|
2213 if ( is_array($name) ) { |
|
2214 if ( count($name) == 3 ) |
|
2215 $name = sprintf($name[0], $name[2]); |
|
2216 else |
|
2217 $name = $name[0]; |
|
2218 } |
|
2219 |
|
2220 $id = sanitize_title($name); |
|
2221 $options = array(); |
|
2222 if ( !empty($width) ) |
|
2223 $options['width'] = $width; |
|
2224 if ( !empty($height) ) |
|
2225 $options['height'] = $height; |
|
2226 $params = array_slice(func_get_args(), 4); |
|
2227 $args = array($id, $name, $control_callback, $options); |
|
2228 if ( !empty($params) ) |
|
2229 $args = array_merge($args, $params); |
|
2230 |
|
2231 call_user_func_array('wp_register_widget_control', $args); |
|
2232 } |
|
2233 |
|
2234 /** |
|
2235 * Alias of {@link wp_unregister_widget_control()}. |
|
2236 * |
|
2237 * @since 2.2.0 |
|
2238 * @deprecated 2.8.0 |
|
2239 * @deprecated Use wp_unregister_widget_control() |
|
2240 * @see wp_unregister_widget_control() |
|
2241 * |
|
2242 * @param int|string $id Widget ID. |
|
2243 */ |
|
2244 function unregister_widget_control($id) { |
|
2245 _deprecated_function( __FUNCTION__, '2.8', 'wp_unregister_widget_control()' ); |
|
2246 return wp_unregister_widget_control($id); |
|
2247 } |
|
2248 |
|
2249 /** |
|
2250 * Remove user meta data. |
|
2251 * |
|
2252 * @since 2.0.0 |
|
2253 * @deprecated 3.0.0 |
|
2254 * @deprecated Use delete_user_meta() |
|
2255 * @see delete_user_meta() |
|
2256 * |
|
2257 * @param int $user_id User ID. |
|
2258 * @param string $meta_key Metadata key. |
|
2259 * @param mixed $meta_value Metadata value. |
|
2260 * @return bool True deletion completed and false if user_id is not a number. |
|
2261 */ |
|
2262 function delete_usermeta( $user_id, $meta_key, $meta_value = '' ) { |
|
2263 _deprecated_function( __FUNCTION__, '3.0', 'delete_user_meta()' ); |
|
2264 global $wpdb; |
|
2265 if ( !is_numeric( $user_id ) ) |
|
2266 return false; |
|
2267 $meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key); |
|
2268 |
|
2269 if ( is_array($meta_value) || is_object($meta_value) ) |
|
2270 $meta_value = serialize($meta_value); |
|
2271 $meta_value = trim( $meta_value ); |
|
2272 |
|
2273 $cur = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) ); |
|
2274 |
|
2275 if ( $cur && $cur->umeta_id ) |
|
2276 do_action( 'delete_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value ); |
|
2277 |
|
2278 if ( ! empty($meta_value) ) |
|
2279 $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s AND meta_value = %s", $user_id, $meta_key, $meta_value) ); |
|
2280 else |
|
2281 $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) ); |
|
2282 |
|
2283 clean_user_cache( $user_id ); |
|
2284 wp_cache_delete( $user_id, 'user_meta' ); |
|
2285 |
|
2286 if ( $cur && $cur->umeta_id ) |
|
2287 do_action( 'deleted_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value ); |
|
2288 |
|
2289 return true; |
|
2290 } |
|
2291 |
|
2292 /** |
|
2293 * Retrieve user metadata. |
|
2294 * |
|
2295 * If $user_id is not a number, then the function will fail over with a 'false' |
|
2296 * boolean return value. Other returned values depend on whether there is only |
|
2297 * one item to be returned, which be that single item type. If there is more |
|
2298 * than one metadata value, then it will be list of metadata values. |
|
2299 * |
|
2300 * @since 2.0.0 |
|
2301 * @deprecated 3.0.0 |
|
2302 * @deprecated Use get_user_meta() |
|
2303 * @see get_user_meta() |
|
2304 * |
|
2305 * @param int $user_id User ID |
|
2306 * @param string $meta_key Optional. Metadata key. |
|
2307 * @return mixed |
|
2308 */ |
|
2309 function get_usermeta( $user_id, $meta_key = '' ) { |
|
2310 _deprecated_function( __FUNCTION__, '3.0', 'get_user_meta()' ); |
|
2311 global $wpdb; |
|
2312 $user_id = (int) $user_id; |
|
2313 |
|
2314 if ( !$user_id ) |
|
2315 return false; |
|
2316 |
|
2317 if ( !empty($meta_key) ) { |
|
2318 $meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key); |
|
2319 $user = wp_cache_get($user_id, 'users'); |
|
2320 // Check the cached user object |
|
2321 if ( false !== $user && isset($user->$meta_key) ) |
|
2322 $metas = array($user->$meta_key); |
|
2323 else |
|
2324 $metas = $wpdb->get_col( $wpdb->prepare("SELECT meta_value FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) ); |
|
2325 } else { |
|
2326 $metas = $wpdb->get_col( $wpdb->prepare("SELECT meta_value FROM $wpdb->usermeta WHERE user_id = %d", $user_id) ); |
|
2327 } |
|
2328 |
|
2329 if ( empty($metas) ) { |
|
2330 if ( empty($meta_key) ) |
|
2331 return array(); |
|
2332 else |
|
2333 return ''; |
|
2334 } |
|
2335 |
|
2336 $metas = array_map('maybe_unserialize', $metas); |
|
2337 |
|
2338 if ( count($metas) == 1 ) |
|
2339 return $metas[0]; |
|
2340 else |
|
2341 return $metas; |
|
2342 } |
|
2343 |
|
2344 /** |
|
2345 * Update metadata of user. |
|
2346 * |
|
2347 * There is no need to serialize values, they will be serialized if it is |
|
2348 * needed. The metadata key can only be a string with underscores. All else will |
|
2349 * be removed. |
|
2350 * |
|
2351 * Will remove the metadata, if the meta value is empty. |
|
2352 * |
|
2353 * @since 2.0.0 |
|
2354 * @deprecated 3.0.0 |
|
2355 * @deprecated Use update_user_meta() |
|
2356 * @see update_user_meta() |
|
2357 * |
|
2358 * @param int $user_id User ID |
|
2359 * @param string $meta_key Metadata key. |
|
2360 * @param mixed $meta_value Metadata value. |
|
2361 * @return bool True on successful update, false on failure. |
|
2362 */ |
|
2363 function update_usermeta( $user_id, $meta_key, $meta_value ) { |
|
2364 _deprecated_function( __FUNCTION__, '3.0', 'update_user_meta()' ); |
|
2365 global $wpdb; |
|
2366 if ( !is_numeric( $user_id ) ) |
|
2367 return false; |
|
2368 $meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key); |
|
2369 |
|
2370 /** @todo Might need fix because usermeta data is assumed to be already escaped */ |
|
2371 if ( is_string($meta_value) ) |
|
2372 $meta_value = stripslashes($meta_value); |
|
2373 $meta_value = maybe_serialize($meta_value); |
|
2374 |
|
2375 if (empty($meta_value)) { |
|
2376 return delete_usermeta($user_id, $meta_key); |
|
2377 } |
|
2378 |
|
2379 $cur = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) ); |
|
2380 |
|
2381 if ( $cur ) |
|
2382 do_action( 'update_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value ); |
|
2383 |
|
2384 if ( !$cur ) |
|
2385 $wpdb->insert($wpdb->usermeta, compact('user_id', 'meta_key', 'meta_value') ); |
|
2386 else if ( $cur->meta_value != $meta_value ) |
|
2387 $wpdb->update($wpdb->usermeta, compact('meta_value'), compact('user_id', 'meta_key') ); |
|
2388 else |
|
2389 return false; |
|
2390 |
|
2391 clean_user_cache( $user_id ); |
|
2392 wp_cache_delete( $user_id, 'user_meta' ); |
|
2393 |
|
2394 if ( !$cur ) |
|
2395 do_action( 'added_usermeta', $wpdb->insert_id, $user_id, $meta_key, $meta_value ); |
|
2396 else |
|
2397 do_action( 'updated_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value ); |
|
2398 |
|
2399 return true; |
|
2400 } |
|
2401 |
|
2402 /** |
|
2403 * Get users for the blog. |
|
2404 * |
|
2405 * For setups that use the multi-blog feature. Can be used outside of the |
|
2406 * multi-blog feature. |
|
2407 * |
|
2408 * @since 2.2.0 |
|
2409 * @deprecated 3.1.0 |
|
2410 * @uses $wpdb WordPress database object for queries |
|
2411 * @uses $blog_id The Blog id of the blog for those that use more than one blog |
|
2412 * |
|
2413 * @param int $id Blog ID. |
|
2414 * @return array List of users that are part of that Blog ID |
|
2415 */ |
|
2416 function get_users_of_blog( $id = '' ) { |
|
2417 _deprecated_function( __FUNCTION__, '3.1', 'get_users()' ); |
|
2418 |
|
2419 global $wpdb, $blog_id; |
|
2420 if ( empty($id) ) |
|
2421 $id = (int) $blog_id; |
|
2422 $blog_prefix = $wpdb->get_blog_prefix($id); |
|
2423 $users = $wpdb->get_results( "SELECT user_id, user_id AS ID, user_login, display_name, user_email, meta_value FROM $wpdb->users, $wpdb->usermeta WHERE {$wpdb->users}.ID = {$wpdb->usermeta}.user_id AND meta_key = '{$blog_prefix}capabilities' ORDER BY {$wpdb->usermeta}.user_id" ); |
|
2424 return $users; |
|
2425 } |
|
2426 |
|
2427 /** |
|
2428 * Enable/disable automatic general feed link outputting. |
|
2429 * |
|
2430 * @since 2.8.0 |
|
2431 * @deprecated 3.0.0 |
|
2432 * @deprecated Use add_theme_support( 'automatic-feed-links' ) |
|
2433 * |
|
2434 * @param boolean $add Optional, default is true. Add or remove links. Defaults to true. |
|
2435 */ |
|
2436 function automatic_feed_links( $add = true ) { |
|
2437 _deprecated_function( __FUNCTION__, '3.0', "add_theme_support( 'automatic-feed-links' )" ); |
|
2438 |
|
2439 if ( $add ) |
|
2440 add_theme_support( 'automatic-feed-links' ); |
|
2441 else |
|
2442 remove_action( 'wp_head', 'feed_links_extra', 3 ); // Just do this yourself in 3.0+ |
|
2443 } |
|
2444 |
|
2445 /** |
|
2446 * Retrieve user data based on field. |
|
2447 * |
|
2448 * @since 1.5.0 |
|
2449 * @deprecated 3.0.0 |
|
2450 * @deprecated Use get_the_author_meta() |
|
2451 * @see get_the_author_meta() |
|
2452 */ |
|
2453 function get_profile( $field, $user = false ) { |
|
2454 _deprecated_function( __FUNCTION__, '3.0', 'get_the_author_meta()' ); |
|
2455 if ( $user ) { |
|
2456 $user = get_user_by( 'login', $user ); |
|
2457 $user = $user->ID; |
|
2458 } |
|
2459 return get_the_author_meta( $field, $user ); |
|
2460 } |
|
2461 |
|
2462 /** |
|
2463 * Number of posts user has written. |
|
2464 * |
|
2465 * @since 0.71 |
|
2466 * @deprecated 3.0.0 |
|
2467 * @deprecated Use count_user_posts() |
|
2468 * @see count_user_posts() |
|
2469 */ |
|
2470 function get_usernumposts( $userid ) { |
|
2471 _deprecated_function( __FUNCTION__, '3.0', 'count_user_posts()' ); |
|
2472 return count_user_posts( $userid ); |
|
2473 } |
|
2474 |
|
2475 /** |
|
2476 * Callback used to change %uXXXX to &#YYY; syntax |
|
2477 * |
|
2478 * @since 2.8.0 |
|
2479 * @access private |
|
2480 * @deprecated 3.0.0 |
|
2481 * |
|
2482 * @param array $matches Single Match |
|
2483 * @return string An HTML entity |
|
2484 */ |
|
2485 function funky_javascript_callback($matches) { |
|
2486 return "&#".base_convert($matches[1],16,10).";"; |
|
2487 } |
|
2488 |
|
2489 /** |
|
2490 * Fixes javascript bugs in browsers. |
|
2491 * |
|
2492 * Converts unicode characters to HTML numbered entities. |
|
2493 * |
|
2494 * @since 1.5.0 |
|
2495 * @uses $is_macIE |
|
2496 * @uses $is_winIE |
|
2497 * @deprecated 3.0.0 |
|
2498 * |
|
2499 * @param string $text Text to be made safe. |
|
2500 * @return string Fixed text. |
|
2501 */ |
|
2502 function funky_javascript_fix($text) { |
|
2503 _deprecated_function( __FUNCTION__, '3.0' ); |
|
2504 // Fixes for browsers' javascript bugs |
|
2505 global $is_macIE, $is_winIE; |
|
2506 |
|
2507 if ( $is_winIE || $is_macIE ) |
|
2508 $text = preg_replace_callback("/\%u([0-9A-F]{4,4})/", |
|
2509 "funky_javascript_callback", |
|
2510 $text); |
|
2511 |
|
2512 return $text; |
|
2513 } |
|
2514 |
|
2515 /** |
|
2516 * Checks that the taxonomy name exists. |
|
2517 * |
|
2518 * @since 2.3.0 |
|
2519 * @deprecated 3.0.0 |
|
2520 * @deprecated Use taxonomy_exists() |
|
2521 * @see taxonomy_exists() |
|
2522 * |
|
2523 * @param string $taxonomy Name of taxonomy object |
|
2524 * @return bool Whether the taxonomy exists. |
|
2525 */ |
|
2526 function is_taxonomy( $taxonomy ) { |
|
2527 _deprecated_function( __FUNCTION__, '3.0', 'taxonomy_exists()' ); |
|
2528 return taxonomy_exists( $taxonomy ); |
|
2529 } |
|
2530 |
|
2531 /** |
|
2532 * Check if Term exists. |
|
2533 * |
|
2534 * @since 2.3.0 |
|
2535 * @deprecated 3.0.0 |
|
2536 * @deprecated Use term_exists() |
|
2537 * @see term_exists() |
|
2538 * |
|
2539 * @param int|string $term The term to check |
|
2540 * @param string $taxonomy The taxonomy name to use |
|
2541 * @param int $parent ID of parent term under which to confine the exists search. |
|
2542 * @return mixed Get the term id or Term Object, if exists. |
|
2543 */ |
|
2544 function is_term( $term, $taxonomy = '', $parent = 0 ) { |
|
2545 _deprecated_function( __FUNCTION__, '3.0', 'term_exists()' ); |
|
2546 return term_exists( $term, $taxonomy, $parent ); |
|
2547 } |
|
2548 |
|
2549 /** |
|
2550 * Is the current admin page generated by a plugin? |
|
2551 * |
|
2552 * @since 1.5.0 |
|
2553 * @deprecated 3.1.0 |
|
2554 * @deprecated Use global $plugin_page and/or get_plugin_page_hookname() hooks. |
|
2555 * |
|
2556 * @global $plugin_page |
|
2557 * |
|
2558 * @return bool |
|
2559 */ |
|
2560 function is_plugin_page() { |
|
2561 _deprecated_function( __FUNCTION__, '3.1' ); |
|
2562 |
|
2563 global $plugin_page; |
|
2564 |
|
2565 if ( isset($plugin_page) ) |
|
2566 return true; |
|
2567 |
|
2568 return false; |
|
2569 } |
|
2570 |
|
2571 /** |
|
2572 * Update the categories cache. |
|
2573 * |
|
2574 * This function does not appear to be used anymore or does not appear to be |
|
2575 * needed. It might be a legacy function left over from when there was a need |
|
2576 * for updating the category cache. |
|
2577 * |
|
2578 * @since 1.5.0 |
|
2579 * @deprecated 3.1.0 |
|
2580 * |
|
2581 * @return bool Always return True |
|
2582 */ |
|
2583 function update_category_cache() { |
|
2584 _deprecated_function( __FUNCTION__, '3.1' ); |
|
2585 |
|
2586 return true; |
|
2587 } |
|
2588 |
|
2589 /** |
|
2590 * Check for PHP timezone support |
|
2591 * |
|
2592 * @since 2.9.0 |
|
2593 * @deprecated 3.2.0 |
|
2594 * |
|
2595 * @return bool |
|
2596 */ |
|
2597 function wp_timezone_supported() { |
|
2598 _deprecated_function( __FUNCTION__, '3.2' ); |
|
2599 |
|
2600 return true; |
|
2601 } |
|
2602 |
|
2603 /** |
|
2604 * Display editor: TinyMCE, HTML, or both. |
|
2605 * |
|
2606 * @since 2.1.0 |
|
2607 * @deprecated 3.3.0 |
|
2608 * @deprecated Use wp_editor() |
|
2609 * @see wp_editor() |
|
2610 * |
|
2611 * @param string $content Textarea content. |
|
2612 * @param string $id Optional, default is 'content'. HTML ID attribute value. |
|
2613 * @param string $prev_id Optional, not used |
|
2614 * @param bool $media_buttons Optional, default is true. Whether to display media buttons. |
|
2615 * @param int $tab_index Optional, not used |
|
2616 */ |
|
2617 function the_editor($content, $id = 'content', $prev_id = 'title', $media_buttons = true, $tab_index = 2, $extended = true) { |
|
2618 _deprecated_function( __FUNCTION__, '3.3', 'wp_editor()' ); |
|
2619 |
|
2620 wp_editor( $content, $id, array( 'media_buttons' => $media_buttons ) ); |
|
2621 return; |
|
2622 } |
|
2623 |
|
2624 /** |
|
2625 * Perform the query to get the $metavalues array(s) needed by _fill_user and _fill_many_users |
|
2626 * |
|
2627 * @since 3.0.0 |
|
2628 * @deprecated 3.3.0 |
|
2629 * |
|
2630 * @param array $ids User ID numbers list. |
|
2631 * @return array of arrays. The array is indexed by user_id, containing $metavalues object arrays. |
|
2632 */ |
|
2633 function get_user_metavalues($ids) { |
|
2634 _deprecated_function( __FUNCTION__, '3.3' ); |
|
2635 |
|
2636 $objects = array(); |
|
2637 |
|
2638 $ids = array_map('intval', $ids); |
|
2639 foreach ( $ids as $id ) |
|
2640 $objects[$id] = array(); |
|
2641 |
|
2642 $metas = update_meta_cache('user', $ids); |
|
2643 |
|
2644 foreach ( $metas as $id => $meta ) { |
|
2645 foreach ( $meta as $key => $metavalues ) { |
|
2646 foreach ( $metavalues as $value ) { |
|
2647 $objects[$id][] = (object)array( 'user_id' => $id, 'meta_key' => $key, 'meta_value' => $value); |
|
2648 } |
|
2649 } |
|
2650 } |
|
2651 |
|
2652 return $objects; |
|
2653 } |
|
2654 |
|
2655 /** |
|
2656 * Sanitize every user field. |
|
2657 * |
|
2658 * If the context is 'raw', then the user object or array will get minimal santization of the int fields. |
|
2659 * |
|
2660 * @since 2.3.0 |
|
2661 * @deprecated 3.3.0 |
|
2662 * |
|
2663 * @param object|array $user The User Object or Array |
|
2664 * @param string $context Optional, default is 'display'. How to sanitize user fields. |
|
2665 * @return object|array The now sanitized User Object or Array (will be the same type as $user) |
|
2666 */ |
|
2667 function sanitize_user_object($user, $context = 'display') { |
|
2668 _deprecated_function( __FUNCTION__, '3.3' ); |
|
2669 |
|
2670 if ( is_object($user) ) { |
|
2671 if ( !isset($user->ID) ) |
|
2672 $user->ID = 0; |
|
2673 if ( !is_a( $user, 'WP_User' ) ) { |
|
2674 $vars = get_object_vars($user); |
|
2675 foreach ( array_keys($vars) as $field ) { |
|
2676 if ( is_string($user->$field) || is_numeric($user->$field) ) |
|
2677 $user->$field = sanitize_user_field($field, $user->$field, $user->ID, $context); |
|
2678 } |
|
2679 } |
|
2680 $user->filter = $context; |
|
2681 } else { |
|
2682 if ( !isset($user['ID']) ) |
|
2683 $user['ID'] = 0; |
|
2684 foreach ( array_keys($user) as $field ) |
|
2685 $user[$field] = sanitize_user_field($field, $user[$field], $user['ID'], $context); |
|
2686 $user['filter'] = $context; |
|
2687 } |
|
2688 |
|
2689 return $user; |
|
2690 } |
|
2691 |
|
2692 /** |
|
2693 * Get boundary post relational link. |
|
2694 * |
|
2695 * Can either be start or end post relational link. |
|
2696 * |
|
2697 * @since 2.8.0 |
|
2698 * @deprecated 3.3.0 |
|
2699 * |
|
2700 * @param string $title Optional. Link title format. |
|
2701 * @param bool $in_same_cat Optional. Whether link should be in a same category. |
|
2702 * @param string $excluded_categories Optional. Excluded categories IDs. |
|
2703 * @param bool $start Optional, default is true. Whether to display link to first or last post. |
|
2704 * @return string |
|
2705 */ |
|
2706 function get_boundary_post_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '', $start = true) { |
|
2707 _deprecated_function( __FUNCTION__, '3.3' ); |
|
2708 |
|
2709 $posts = get_boundary_post($in_same_cat, $excluded_categories, $start); |
|
2710 // If there is no post stop. |
|
2711 if ( empty($posts) ) |
|
2712 return; |
|
2713 |
|
2714 // Even though we limited get_posts to return only 1 item it still returns an array of objects. |
|
2715 $post = $posts[0]; |
|
2716 |
|
2717 if ( empty($post->post_title) ) |
|
2718 $post->post_title = $start ? __('First Post') : __('Last Post'); |
|
2719 |
|
2720 $date = mysql2date(get_option('date_format'), $post->post_date); |
|
2721 |
|
2722 $title = str_replace('%title', $post->post_title, $title); |
|
2723 $title = str_replace('%date', $date, $title); |
|
2724 $title = apply_filters('the_title', $title, $post->ID); |
|
2725 |
|
2726 $link = $start ? "<link rel='start' title='" : "<link rel='end' title='"; |
|
2727 $link .= esc_attr($title); |
|
2728 $link .= "' href='" . get_permalink($post) . "' />\n"; |
|
2729 |
|
2730 $boundary = $start ? 'start' : 'end'; |
|
2731 return apply_filters( "{$boundary}_post_rel_link", $link ); |
|
2732 } |
|
2733 |
|
2734 /** |
|
2735 * Display relational link for the first post. |
|
2736 * |
|
2737 * @since 2.8.0 |
|
2738 * @deprecated 3.3.0 |
|
2739 * |
|
2740 * @param string $title Optional. Link title format. |
|
2741 * @param bool $in_same_cat Optional. Whether link should be in a same category. |
|
2742 * @param string $excluded_categories Optional. Excluded categories IDs. |
|
2743 */ |
|
2744 function start_post_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '') { |
|
2745 _deprecated_function( __FUNCTION__, '3.3' ); |
|
2746 |
|
2747 echo get_boundary_post_rel_link($title, $in_same_cat, $excluded_categories, true); |
|
2748 } |
|
2749 |
|
2750 /** |
|
2751 * Get site index relational link. |
|
2752 * |
|
2753 * @since 2.8.0 |
|
2754 * @deprecated 3.3.0 |
|
2755 * |
|
2756 * @return string |
|
2757 */ |
|
2758 function get_index_rel_link() { |
|
2759 _deprecated_function( __FUNCTION__, '3.3' ); |
|
2760 |
|
2761 $link = "<link rel='index' title='" . esc_attr( get_bloginfo( 'name', 'display' ) ) . "' href='" . esc_url( user_trailingslashit( get_bloginfo( 'url', 'display' ) ) ) . "' />\n"; |
|
2762 return apply_filters( "index_rel_link", $link ); |
|
2763 } |
|
2764 |
|
2765 /** |
|
2766 * Display relational link for the site index. |
|
2767 * |
|
2768 * @since 2.8.0 |
|
2769 * @deprecated 3.3.0 |
|
2770 */ |
|
2771 function index_rel_link() { |
|
2772 _deprecated_function( __FUNCTION__, '3.3' ); |
|
2773 |
|
2774 echo get_index_rel_link(); |
|
2775 } |
|
2776 |
|
2777 /** |
|
2778 * Get parent post relational link. |
|
2779 * |
|
2780 * @since 2.8.0 |
|
2781 * @deprecated 3.3.0 |
|
2782 * |
|
2783 * @param string $title Optional. Link title format. |
|
2784 * @return string |
|
2785 */ |
|
2786 function get_parent_post_rel_link($title = '%title') { |
|
2787 _deprecated_function( __FUNCTION__, '3.3' ); |
|
2788 |
|
2789 if ( ! empty( $GLOBALS['post'] ) && ! empty( $GLOBALS['post']->post_parent ) ) |
|
2790 $post = get_post($GLOBALS['post']->post_parent); |
|
2791 |
|
2792 if ( empty($post) ) |
|
2793 return; |
|
2794 |
|
2795 $date = mysql2date(get_option('date_format'), $post->post_date); |
|
2796 |
|
2797 $title = str_replace('%title', $post->post_title, $title); |
|
2798 $title = str_replace('%date', $date, $title); |
|
2799 $title = apply_filters('the_title', $title, $post->ID); |
|
2800 |
|
2801 $link = "<link rel='up' title='"; |
|
2802 $link .= esc_attr( $title ); |
|
2803 $link .= "' href='" . get_permalink($post) . "' />\n"; |
|
2804 |
|
2805 return apply_filters( "parent_post_rel_link", $link ); |
|
2806 } |
|
2807 |
|
2808 /** |
|
2809 * Display relational link for parent item |
|
2810 * |
|
2811 * @since 2.8.0 |
|
2812 * @deprecated 3.3.0 |
|
2813 */ |
|
2814 function parent_post_rel_link($title = '%title') { |
|
2815 _deprecated_function( __FUNCTION__, '3.3' ); |
|
2816 |
|
2817 echo get_parent_post_rel_link($title); |
|
2818 } |
|
2819 |
|
2820 /** |
|
2821 * Add the "Dashboard"/"Visit Site" menu. |
|
2822 * |
|
2823 * @since 3.2.0 |
|
2824 * @deprecated 3.3.0 |
|
2825 */ |
|
2826 function wp_admin_bar_dashboard_view_site_menu( $wp_admin_bar ) { |
|
2827 _deprecated_function( __FUNCTION__, '3.3' ); |
|
2828 |
|
2829 $user_id = get_current_user_id(); |
|
2830 |
|
2831 if ( 0 != $user_id ) { |
|
2832 if ( is_admin() ) |
|
2833 $wp_admin_bar->add_menu( array( 'id' => 'view-site', 'title' => __( 'Visit Site' ), 'href' => home_url() ) ); |
|
2834 elseif ( is_multisite() ) |
|
2835 $wp_admin_bar->add_menu( array( 'id' => 'dashboard', 'title' => __( 'Dashboard' ), 'href' => get_dashboard_url( $user_id ) ) ); |
|
2836 else |
|
2837 $wp_admin_bar->add_menu( array( 'id' => 'dashboard', 'title' => __( 'Dashboard' ), 'href' => admin_url() ) ); |
|
2838 } |
|
2839 } |
|
2840 |
|
2841 /** |
|
2842 * Checks if the current user belong to a given blog. |
|
2843 * |
|
2844 * @since MU |
|
2845 * @deprecated 3.3.0 |
|
2846 * @deprecated Use is_user_member_of_blog() |
|
2847 * @see is_user_member_of_blog() |
|
2848 * |
|
2849 * @param int $blog_id Blog ID |
|
2850 * @return bool True if the current users belong to $blog_id, false if not. |
|
2851 */ |
|
2852 function is_blog_user( $blog_id = 0 ) { |
|
2853 _deprecated_function( __FUNCTION__, '3.3', 'is_user_member_of_blog()' ); |
|
2854 |
|
2855 return is_user_member_of_blog( get_current_user_id(), $blog_id ); |
|
2856 } |
|
2857 |
|
2858 /** |
|
2859 * Open the file handle for debugging. |
|
2860 * |
|
2861 * @since 0.71 |
|
2862 * @deprecated Use error_log() |
|
2863 * @link http://www.php.net/manual/en/function.error-log.php |
|
2864 * @deprecated 3.4.0 |
|
2865 */ |
|
2866 function debug_fopen( $filename, $mode ) { |
|
2867 _deprecated_function( __FUNCTION__, 'error_log()' ); |
|
2868 return false; |
|
2869 } |
|
2870 |
|
2871 /** |
|
2872 * Write contents to the file used for debugging. |
|
2873 * |
|
2874 * @since 0.71 |
|
2875 * @deprecated Use error_log() instead. |
|
2876 * @link http://www.php.net/manual/en/function.error-log.php |
|
2877 * @deprecated 3.4.0 |
|
2878 */ |
|
2879 function debug_fwrite( $fp, $string ) { |
|
2880 _deprecated_function( __FUNCTION__, 'error_log()' ); |
|
2881 if ( ! empty( $GLOBALS['debug'] ) ) |
|
2882 error_log( $string ); |
|
2883 } |
|
2884 |
|
2885 /** |
|
2886 * Close the debugging file handle. |
|
2887 * |
|
2888 * @since 0.71 |
|
2889 * @deprecated Use error_log() |
|
2890 * @link http://www.php.net/manual/en/function.error-log.php |
|
2891 * @deprecated 3.4.0 |
|
2892 */ |
|
2893 function debug_fclose( $fp ) { |
|
2894 _deprecated_function( __FUNCTION__, 'error_log()' ); |
|
2895 } |
|
2896 |
|
2897 /** |
|
2898 * Retrieve list of themes with theme data in theme directory. |
|
2899 * |
|
2900 * The theme is broken, if it doesn't have a parent theme and is missing either |
|
2901 * style.css and, or index.php. If the theme has a parent theme then it is |
|
2902 * broken, if it is missing style.css; index.php is optional. |
|
2903 * |
|
2904 * @since 1.5.0 |
|
2905 * @deprecated 3.4.0 |
|
2906 * @deprecated Use wp_get_themes() |
|
2907 * @see wp_get_themes() |
|
2908 * |
|
2909 * @return array Theme list with theme data. |
|
2910 */ |
|
2911 function get_themes() { |
|
2912 _deprecated_function( __FUNCTION__, '3.4', 'wp_get_themes()' ); |
|
2913 |
|
2914 global $wp_themes; |
|
2915 if ( isset( $wp_themes ) ) |
|
2916 return $wp_themes; |
|
2917 |
|
2918 $themes = wp_get_themes(); |
|
2919 $wp_themes = array(); |
|
2920 |
|
2921 foreach ( $themes as $theme ) { |
|
2922 $name = $theme->get('Name'); |
|
2923 if ( isset( $wp_themes[ $name ] ) ) |
|
2924 $wp_themes[ $name . '/' . $theme->get_stylesheet() ] = $theme; |
|
2925 else |
|
2926 $wp_themes[ $name ] = $theme; |
|
2927 } |
|
2928 |
|
2929 return $wp_themes; |
|
2930 } |
|
2931 |
|
2932 /** |
|
2933 * Retrieve theme data. |
|
2934 * |
|
2935 * @since 1.5.0 |
|
2936 * @deprecated 3.4.0 |
|
2937 * @deprecated Use wp_get_theme() |
|
2938 * @see wp_get_theme() |
|
2939 * |
|
2940 * @param string $theme Theme name. |
|
2941 * @return array|null Null, if theme name does not exist. Theme data, if exists. |
|
2942 */ |
|
2943 function get_theme( $theme ) { |
|
2944 _deprecated_function( __FUNCTION__, '3.4', 'wp_get_theme( $stylesheet )' ); |
|
2945 |
|
2946 $themes = get_themes(); |
|
2947 if ( is_array( $themes ) && array_key_exists( $theme, $themes ) ) |
|
2948 return $themes[ $theme ]; |
|
2949 return null; |
|
2950 } |
|
2951 |
|
2952 /** |
|
2953 * Retrieve current theme name. |
|
2954 * |
|
2955 * @since 1.5.0 |
|
2956 * @deprecated 3.4.0 |
|
2957 * @deprecated Use (string) wp_get_theme() |
|
2958 * @see wp_get_theme() |
|
2959 * |
|
2960 * @return string |
|
2961 */ |
|
2962 function get_current_theme() { |
|
2963 _deprecated_function( __FUNCTION__, '3.4', 'wp_get_theme()' ); |
|
2964 |
|
2965 if ( $theme = get_option( 'current_theme' ) ) |
|
2966 return $theme; |
|
2967 |
|
2968 return wp_get_theme()->get('Name'); |
|
2969 } |
|
2970 |
|
2971 /** |
|
2972 * Accepts matches array from preg_replace_callback in wpautop() or a string. |
|
2973 * |
|
2974 * Ensures that the contents of a <<pre>>...<</pre>> HTML block are not |
|
2975 * converted into paragraphs or line-breaks. |
|
2976 * |
|
2977 * @since 1.2.0 |
|
2978 * @deprecated 3.4.0 |
|
2979 * |
|
2980 * @param array|string $matches The array or string |
|
2981 * @return string The pre block without paragraph/line-break conversion. |
|
2982 */ |
|
2983 function clean_pre($matches) { |
|
2984 _deprecated_function( __FUNCTION__, '3.4' ); |
|
2985 |
|
2986 if ( is_array($matches) ) |
|
2987 $text = $matches[1] . $matches[2] . "</pre>"; |
|
2988 else |
|
2989 $text = $matches; |
|
2990 |
|
2991 $text = str_replace(array('<br />', '<br/>', '<br>'), array('', '', ''), $text); |
|
2992 $text = str_replace('<p>', "\n", $text); |
|
2993 $text = str_replace('</p>', '', $text); |
|
2994 |
|
2995 return $text; |
|
2996 } |
|
2997 |
|
2998 |
|
2999 /** |
|
3000 * Add callbacks for image header display. |
|
3001 * |
|
3002 * @since 2.1.0 |
|
3003 * @deprecated 3.4.0 |
|
3004 * @deprecated Use add_theme_support('custom-header', $args) |
|
3005 * @see add_theme_support() |
|
3006 * |
|
3007 * @param callback $wp_head_callback Call on 'wp_head' action. |
|
3008 * @param callback $admin_head_callback Call on custom header administration screen. |
|
3009 * @param callback $admin_preview_callback Output a custom header image div on the custom header administration screen. Optional. |
|
3010 */ |
|
3011 function add_custom_image_header( $wp_head_callback, $admin_head_callback, $admin_preview_callback = '' ) { |
|
3012 _deprecated_function( __FUNCTION__, '3.4', 'add_theme_support( \'custom-header\', $args )' ); |
|
3013 $args = array( |
|
3014 'wp-head-callback' => $wp_head_callback, |
|
3015 'admin-head-callback' => $admin_head_callback, |
|
3016 ); |
|
3017 if ( $admin_preview_callback ) |
|
3018 $args['admin-preview-callback'] = $admin_preview_callback; |
|
3019 return add_theme_support( 'custom-header', $args ); |
|
3020 } |
|
3021 |
|
3022 /** |
|
3023 * Remove image header support. |
|
3024 * |
|
3025 * @since 3.1.0 |
|
3026 * @deprecated 3.4.0 |
|
3027 * @deprecated Use remove_theme_support('custom-header') |
|
3028 * @see remove_theme_support() |
|
3029 * |
|
3030 * @return bool Whether support was removed. |
|
3031 */ |
|
3032 function remove_custom_image_header() { |
|
3033 _deprecated_function( __FUNCTION__, '3.4', 'remove_theme_support( \'custom-header\' )' ); |
|
3034 return remove_theme_support( 'custom-header' ); |
|
3035 } |
|
3036 |
|
3037 /** |
|
3038 * Add callbacks for background image display. |
|
3039 * |
|
3040 * @since 3.0.0 |
|
3041 * @deprecated 3.4.0 |
|
3042 * @deprecated Use add_theme_support('custom-background, $args) |
|
3043 * @see add_theme_support() |
|
3044 * |
|
3045 * @param callback $wp_head_callback Call on 'wp_head' action. |
|
3046 * @param callback $admin_head_callback Call on custom background administration screen. |
|
3047 * @param callback $admin_preview_callback Output a custom background image div on the custom background administration screen. Optional. |
|
3048 */ |
|
3049 function add_custom_background( $wp_head_callback = '', $admin_head_callback = '', $admin_preview_callback = '' ) { |
|
3050 _deprecated_function( __FUNCTION__, '3.4', 'add_theme_support( \'custom-background\', $args )' ); |
|
3051 $args = array(); |
|
3052 if ( $wp_head_callback ) |
|
3053 $args['wp-head-callback'] = $wp_head_callback; |
|
3054 if ( $admin_head_callback ) |
|
3055 $args['admin-head-callback'] = $admin_head_callback; |
|
3056 if ( $admin_preview_callback ) |
|
3057 $args['admin-preview-callback'] = $admin_preview_callback; |
|
3058 return add_theme_support( 'custom-background', $args ); |
|
3059 } |
|
3060 |
|
3061 /** |
|
3062 * Remove custom background support. |
|
3063 * |
|
3064 * @since 3.1.0 |
|
3065 * @see add_custom_background() |
|
3066 * |
|
3067 * @return bool Whether support was removed. |
|
3068 */ |
|
3069 function remove_custom_background() { |
|
3070 _deprecated_function( __FUNCTION__, '3.4', 'remove_theme_support( \'custom-background\' )' ); |
|
3071 return remove_theme_support( 'custom-background' ); |
|
3072 } |
|
3073 |
|
3074 /** |
|
3075 * Retrieve theme data from parsed theme file. |
|
3076 * |
|
3077 * @since 1.5.0 |
|
3078 * @deprecated 3.4.0 |
|
3079 * @deprecated Use wp_get_theme() |
|
3080 * @see wp_get_theme() |
|
3081 * |
|
3082 * @param string $theme_file Theme file path. |
|
3083 * @return array Theme data. |
|
3084 */ |
|
3085 function get_theme_data( $theme_file ) { |
|
3086 _deprecated_function( __FUNCTION__, '3.4', 'wp_get_theme()' ); |
|
3087 $theme = new WP_Theme( basename( dirname( $theme_file ) ), dirname( dirname( $theme_file ) ) ); |
|
3088 |
|
3089 $theme_data = array( |
|
3090 'Name' => $theme->get('Name'), |
|
3091 'URI' => $theme->display('ThemeURI', true, false), |
|
3092 'Description' => $theme->display('Description', true, false), |
|
3093 'Author' => $theme->display('Author', true, false), |
|
3094 'AuthorURI' => $theme->display('AuthorURI', true, false), |
|
3095 'Version' => $theme->get('Version'), |
|
3096 'Template' => $theme->get('Template'), |
|
3097 'Status' => $theme->get('Status'), |
|
3098 'Tags' => $theme->get('Tags'), |
|
3099 'Title' => $theme->get('Name'), |
|
3100 'AuthorName' => $theme->get('Author'), |
|
3101 ); |
|
3102 |
|
3103 foreach ( apply_filters( 'extra_theme_headers', array() ) as $extra_header ) { |
|
3104 if ( ! isset( $theme_data[ $extra_header ] ) ) |
|
3105 $theme_data[ $extra_header ] = $theme->get( $extra_header ); |
|
3106 } |
|
3107 |
|
3108 return $theme_data; |
|
3109 } |
|
3110 |
|
3111 /** |
|
3112 * Alias of update_post_cache(). |
|
3113 * |
|
3114 * @see update_post_cache() Posts and pages are the same, alias is intentional |
|
3115 * |
|
3116 * @since 1.5.1 |
|
3117 * @deprecated 3.4.0 |
|
3118 * |
|
3119 * @param array $pages list of page objects |
|
3120 */ |
|
3121 function update_page_cache( &$pages ) { |
|
3122 _deprecated_function( __FUNCTION__, '3.4', 'update_post_cache()' ); |
|
3123 |
|
3124 update_post_cache( $pages ); |
|
3125 } |
|
3126 |
|
3127 /** |
|
3128 * Will clean the page in the cache. |
|
3129 * |
|
3130 * Clean (read: delete) page from cache that matches $id. Will also clean cache |
|
3131 * associated with 'all_page_ids' and 'get_pages'. |
|
3132 * |
|
3133 * @since 2.0.0 |
|
3134 * @deprecated 3.4.0 |
|
3135 * |
|
3136 * @uses do_action() Will call the 'clean_page_cache' hook action. |
|
3137 * |
|
3138 * @param int $id Page ID to clean |
|
3139 */ |
|
3140 function clean_page_cache( $id ) { |
|
3141 _deprecated_function( __FUNCTION__, '3.4', 'clean_post_cache()' ); |
|
3142 |
|
3143 clean_post_cache( $id ); |
|
3144 } |
|
3145 |
|
3146 /** |
|
3147 * Retrieve nonce action "Are you sure" message. |
|
3148 * |
|
3149 * Deprecated in 3.4.1 and 3.5.0. Backported to 3.3.3. |
|
3150 * |
|
3151 * @since 2.0.4 |
|
3152 * @deprecated 3.4.1 |
|
3153 * @deprecated Use wp_nonce_ays() |
|
3154 * @see wp_nonce_ays() |
|
3155 * |
|
3156 * @param string $action Nonce action. |
|
3157 * @return string Are you sure message. |
|
3158 */ |
|
3159 function wp_explain_nonce( $action ) { |
|
3160 _deprecated_function( __FUNCTION__, '3.4.1', 'wp_nonce_ays()' ); |
|
3161 return __( 'Are you sure you want to do this?' ); |
|
3162 } |
|
3163 |
|
3164 /** |
|
3165 * Display "sticky" CSS class, if a post is sticky. |
|
3166 * |
|
3167 * @since 2.7.0 |
|
3168 * @deprecated 3.5.0 |
|
3169 * @deprecated Use post_class() |
|
3170 * @see post_class() |
|
3171 * |
|
3172 * @param int $post_id An optional post ID. |
|
3173 */ |
|
3174 function sticky_class( $post_id = null ) { |
|
3175 _deprecated_function( __FUNCTION__, '3.5', 'post_class()' ); |
|
3176 if ( is_sticky( $post_id ) ) |
|
3177 echo ' sticky'; |
|
3178 } |
|
3179 |
|
3180 /** |
|
3181 * Retrieve post ancestors. |
|
3182 * |
|
3183 * This is no longer needed as WP_Post lazy-loads the ancestors |
|
3184 * property with get_post_ancestors(). |
|
3185 * |
|
3186 * @since 2.3.4 |
|
3187 * @deprecated 3.5.0 |
|
3188 * @see get_post_ancestors() |
|
3189 */ |
|
3190 function _get_post_ancestors( &$post ) { |
|
3191 _deprecated_function( __FUNCTION__, '3.5' ); |
|
3192 } |
|
3193 |
|
3194 /** |
|
3195 * Load an image from a string, if PHP supports it. |
|
3196 * |
|
3197 * @since 2.1.0 |
|
3198 * @deprecated 3.5.0 |
|
3199 * @see wp_get_image_editor() |
|
3200 * |
|
3201 * @param string $file Filename of the image to load. |
|
3202 * @return resource The resulting image resource on success, Error string on failure. |
|
3203 */ |
|
3204 function wp_load_image( $file ) { |
|
3205 _deprecated_function( __FUNCTION__, '3.5', 'wp_get_image_editor()' ); |
|
3206 |
|
3207 if ( is_numeric( $file ) ) |
|
3208 $file = get_attached_file( $file ); |
|
3209 |
|
3210 if ( ! is_file( $file ) ) |
|
3211 return sprintf(__('File “%s” doesn’t exist?'), $file); |
|
3212 |
|
3213 if ( ! function_exists('imagecreatefromstring') ) |
|
3214 return __('The GD image library is not installed.'); |
|
3215 |
|
3216 // Set artificially high because GD uses uncompressed images in memory |
|
3217 @ini_set( 'memory_limit', apply_filters( 'image_memory_limit', WP_MAX_MEMORY_LIMIT ) ); |
|
3218 $image = imagecreatefromstring( file_get_contents( $file ) ); |
|
3219 |
|
3220 if ( !is_resource( $image ) ) |
|
3221 return sprintf(__('File “%s” is not an image.'), $file); |
|
3222 |
|
3223 return $image; |
|
3224 } |
|
3225 |
|
3226 /** |
|
3227 * Scale down an image to fit a particular size and save a new copy of the image. |
|
3228 * |
|
3229 * The PNG transparency will be preserved using the function, as well as the |
|
3230 * image type. If the file going in is PNG, then the resized image is going to |
|
3231 * be PNG. The only supported image types are PNG, GIF, and JPEG. |
|
3232 * |
|
3233 * Some functionality requires API to exist, so some PHP version may lose out |
|
3234 * support. This is not the fault of WordPress (where functionality is |
|
3235 * downgraded, not actual defects), but of your PHP version. |
|
3236 * |
|
3237 * @since 2.5.0 |
|
3238 * @deprecated 3.5.0 |
|
3239 * @see wp_get_image_editor() |
|
3240 * |
|
3241 * @param string $file Image file path. |
|
3242 * @param int $max_w Maximum width to resize to. |
|
3243 * @param int $max_h Maximum height to resize to. |
|
3244 * @param bool $crop Optional. Whether to crop image or resize. |
|
3245 * @param string $suffix Optional. File suffix. |
|
3246 * @param string $dest_path Optional. New image file path. |
|
3247 * @param int $jpeg_quality Optional, default is 90. Image quality percentage. |
|
3248 * @return mixed WP_Error on failure. String with new destination path. |
|
3249 */ |
|
3250 function image_resize( $file, $max_w, $max_h, $crop = false, $suffix = null, $dest_path = null, $jpeg_quality = 90 ) { |
|
3251 _deprecated_function( __FUNCTION__, '3.5', 'wp_get_image_editor()' ); |
|
3252 |
|
3253 $editor = wp_get_image_editor( $file ); |
|
3254 if ( is_wp_error( $editor ) ) |
|
3255 return $editor; |
|
3256 $editor->set_quality( $jpeg_quality ); |
|
3257 |
|
3258 $resized = $editor->resize( $max_w, $max_h, $crop ); |
|
3259 if ( is_wp_error( $resized ) ) |
|
3260 return $resized; |
|
3261 |
|
3262 $dest_file = $editor->generate_filename( $suffix, $dest_path ); |
|
3263 $saved = $editor->save( $dest_file ); |
|
3264 |
|
3265 if ( is_wp_error( $saved ) ) |
|
3266 return $saved; |
|
3267 |
|
3268 return $dest_file; |
|
3269 } |
|
3270 |
|
3271 /** |
|
3272 * Retrieve a single post, based on post ID. |
|
3273 * |
|
3274 * Has categories in 'post_category' property or key. Has tags in 'tags_input' |
|
3275 * property or key. |
|
3276 * |
|
3277 * @since 1.0.0 |
|
3278 * @deprecated 3.5.0 |
|
3279 * @see get_post() |
|
3280 * |
|
3281 * @param int $postid Post ID. |
|
3282 * @param string $mode How to return result, either OBJECT, ARRAY_N, or ARRAY_A. |
|
3283 * @return object|array Post object or array holding post contents and information |
|
3284 */ |
|
3285 function wp_get_single_post( $postid = 0, $mode = OBJECT ) { |
|
3286 _deprecated_function( __FUNCTION__, '3.5', 'get_post()' ); |
|
3287 return get_post( $postid, $mode ); |
|
3288 } |
|
3289 |
|
3290 /** |
|
3291 * Check that the user login name and password is correct. |
|
3292 * |
|
3293 * @since 0.71 |
|
3294 * @deprecated 3.5.0 |
|
3295 * @deprecated Use wp_authenticate() |
|
3296 * @see wp_authenticate() |
|
3297 * |
|
3298 * @param string $user_login User name. |
|
3299 * @param string $user_pass User password. |
|
3300 * @return bool False if does not authenticate, true if username and password authenticates. |
|
3301 */ |
|
3302 function user_pass_ok($user_login, $user_pass) { |
|
3303 _deprecated_function( __FUNCTION__, '3.5', 'wp_authenticate()' ); |
|
3304 $user = wp_authenticate( $user_login, $user_pass ); |
|
3305 if ( is_wp_error( $user ) ) |
|
3306 return false; |
|
3307 |
|
3308 return true; |
|
3309 } |
|
3310 |
|
3311 /** |
|
3312 * Callback formerly fired on the save_post hook. No longer needed. |
|
3313 * |
|
3314 * @since 2.3.0 |
|
3315 * @deprecated 3.5.0 |
|
3316 */ |
|
3317 function _save_post_hook() {} |
|
3318 |
|
3319 /** |
|
3320 * Check if the installed version of GD supports particular image type |
|
3321 * |
|
3322 * @since 2.9.0 |
|
3323 * @deprecated 3.5.0 |
|
3324 * @see wp_image_editor_supports() |
|
3325 * |
|
3326 * @param string $mime_type |
|
3327 * @return bool |
|
3328 */ |
|
3329 function gd_edit_image_support($mime_type) { |
|
3330 _deprecated_function( __FUNCTION__, '3.5', 'wp_image_editor_supports()' ); |
|
3331 |
|
3332 if ( function_exists('imagetypes') ) { |
|
3333 switch( $mime_type ) { |
|
3334 case 'image/jpeg': |
|
3335 return (imagetypes() & IMG_JPG) != 0; |
|
3336 case 'image/png': |
|
3337 return (imagetypes() & IMG_PNG) != 0; |
|
3338 case 'image/gif': |
|
3339 return (imagetypes() & IMG_GIF) != 0; |
|
3340 } |
|
3341 } else { |
|
3342 switch( $mime_type ) { |
|
3343 case 'image/jpeg': |
|
3344 return function_exists('imagecreatefromjpeg'); |
|
3345 case 'image/png': |
|
3346 return function_exists('imagecreatefrompng'); |
|
3347 case 'image/gif': |
|
3348 return function_exists('imagecreatefromgif'); |
|
3349 } |
|
3350 } |
|
3351 return false; |
|
3352 } |
|
3353 |
|
3354 /** |
|
3355 * Converts an integer byte value to a shorthand byte value. |
|
3356 * |
|
3357 * @since 2.3.0 |
|
3358 * @deprecated 3.6.0 |
|
3359 * @deprecated Use size_format() |
|
3360 * |
|
3361 * @param int $bytes An integer byte value. |
|
3362 * @return string A shorthand byte value. |
|
3363 */ |
|
3364 function wp_convert_bytes_to_hr( $bytes ) { |
|
3365 _deprecated_function( __FUNCTION__, '3.6', 'size_format()' ); |
|
3366 |
|
3367 $units = array( 0 => 'B', 1 => 'kB', 2 => 'MB', 3 => 'GB', 4 => 'TB' ); |
|
3368 $log = log( $bytes, 1024 ); |
|
3369 $power = (int) $log; |
|
3370 $size = pow( 1024, $log - $power ); |
|
3371 |
|
3372 if ( ! is_nan( $size ) && array_key_exists( $power, $units ) ) { |
|
3373 $unit = $units[ $power ]; |
|
3374 } else { |
|
3375 $size = $bytes; |
|
3376 $unit = $units[0]; |
|
3377 } |
|
3378 |
|
3379 return $size . $unit; |
|
3380 } |
|
3381 |
|
3382 /** |
|
3383 * Formerly used internally to tidy up the search terms. |
|
3384 * |
|
3385 * @access private |
|
3386 * @since 2.9.0 |
|
3387 * @deprecated 3.7.0 |
|
3388 */ |
|
3389 function _search_terms_tidy( $t ) { |
|
3390 _deprecated_function( __FUNCTION__, '3.7' ); |
|
3391 return trim( $t, "\"'\n\r " ); |
|
3392 } |