325 * @return bool returns true if $user_id can edit $post_id's comments |
325 * @return bool returns true if $user_id can edit $post_id's comments |
326 */ |
326 */ |
327 function user_can_edit_post_comments($user_id, $post_id, $blog_id = 1) { |
327 function user_can_edit_post_comments($user_id, $post_id, $blog_id = 1) { |
328 _deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' ); |
328 _deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' ); |
329 |
329 |
330 // right now if one can edit a post, one can edit comments made on it |
330 // Right now if one can edit a post, one can edit comments made on it. |
331 return user_can_edit_post($user_id, $post_id, $blog_id); |
331 return user_can_edit_post($user_id, $post_id, $blog_id); |
332 } |
332 } |
333 |
333 |
334 /** |
334 /** |
335 * Whether user can delete a post. |
335 * Whether user can delete a post. |
344 * @return bool returns true if $user_id can delete $post_id's comments |
344 * @return bool returns true if $user_id can delete $post_id's comments |
345 */ |
345 */ |
346 function user_can_delete_post_comments($user_id, $post_id, $blog_id = 1) { |
346 function user_can_delete_post_comments($user_id, $post_id, $blog_id = 1) { |
347 _deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' ); |
347 _deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' ); |
348 |
348 |
349 // right now if one can edit comments, one can delete comments |
349 // Right now if one can edit comments, one can delete comments. |
350 return user_can_edit_post_comments($user_id, $post_id, $blog_id); |
350 return user_can_edit_post_comments($user_id, $post_id, $blog_id); |
351 } |
351 } |
352 |
352 |
353 /** |
353 /** |
354 * Can user can edit other user. |
354 * Can user can edit other user. |
377 * |
377 * |
378 * @since 0.71 |
378 * @since 0.71 |
379 * @deprecated 2.1.0 Use get_bookmarks() |
379 * @deprecated 2.1.0 Use get_bookmarks() |
380 * @see get_bookmarks() |
380 * @see get_bookmarks() |
381 * |
381 * |
382 * @param string $cat_name Optional. The category name to use. If no match is found uses all. |
382 * @param string $cat_name Optional. The category name to use. If no match is found, uses all. |
383 * @param string $before Optional. The html to output before the link. |
383 * Default 'noname'. |
384 * @param string $after Optional. The html to output after the link. |
384 * @param string $before Optional. The HTML to output before the link. Default empty. |
385 * @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. |
385 * @param string $after Optional. The HTML to output after the link. Default '<br />'. |
386 * @param bool $show_images Optional. Whether to show images (if defined). |
386 * @param string $between Optional. The HTML to output between the link/image and its description. |
387 * @param string $orderby Optional. The order to output the links. E.g. 'id', 'name', 'url', 'description' or 'rating'. Or maybe owner. |
387 * Not used if no image or $show_images is true. Default ' '. |
388 * 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 |
388 * @param bool $show_images Optional. Whether to show images (if defined). Default true. |
389 * random order. |
389 * @param string $orderby Optional. The order to output the links. E.g. 'id', 'name', 'url', |
390 * @param bool $show_description Optional. Whether to show the description if show_images=false/not defined. |
390 * 'description', 'rating', or 'owner'. Default 'id'. |
391 * @param bool $show_rating Optional. Show rating stars/chars. |
391 * If you start the name with an underscore, the order will be reversed. |
392 * @param int $limit Optional. Limit to X entries. If not specified, all entries are shown. |
392 * Specifying 'rand' as the order will return links in a random order. |
393 * @param int $show_updated Optional. Whether to show last updated timestamp |
393 * @param bool $show_description Optional. Whether to show the description if show_images=false/not defined. |
|
394 * Default true. |
|
395 * @param bool $show_rating Optional. Show rating stars/chars. Default false. |
|
396 * @param int $limit Optional. Limit to X entries. If not specified, all entries are shown. |
|
397 * Default -1. |
|
398 * @param int $show_updated Optional. Whether to show last updated timestamp. Default 0. |
394 */ |
399 */ |
395 function get_linksbyname($cat_name = "noname", $before = '', $after = '<br />', $between = " ", $show_images = true, $orderby = 'id', |
400 function get_linksbyname($cat_name = "noname", $before = '', $after = '<br />', $between = " ", $show_images = true, $orderby = 'id', |
396 $show_description = true, $show_rating = false, |
401 $show_description = true, $show_rating = false, |
397 $limit = -1, $show_updated = 0) { |
402 $limit = -1, $show_updated = 0) { |
398 _deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' ); |
403 _deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' ); |
399 |
404 |
400 $cat_id = -1; |
405 $cat_id = -1; |
401 $cat = get_term_by('name', $cat_name, 'link_category'); |
406 $cat = get_term_by('name', $cat_name, 'link_category'); |
402 if ( $cat ) |
407 if ( $cat ) |
445 * |
450 * |
446 * @since 1.0.1 |
451 * @since 1.0.1 |
447 * @deprecated 2.1.0 Use get_bookmarks() |
452 * @deprecated 2.1.0 Use get_bookmarks() |
448 * @see get_bookmarks() |
453 * @see get_bookmarks() |
449 * |
454 * |
450 * @param string $cat_name The category name to use. If no match is found uses all. |
455 * @param string $cat_name Optional. The category name to use. If no match is found, uses all. |
451 * @param string $orderby The order to output the links. E.g. 'id', 'name', 'url', 'description', or 'rating'. |
456 * Default 'noname'. |
452 * Or maybe owner. If you start the name with an underscore the order will be reversed. You can also |
457 * @param string $orderby Optional. The order to output the links. E.g. 'id', 'name', 'url', |
453 * specify 'rand' as the order which will return links in a random order. |
458 * 'description', 'rating', or 'owner'. Default 'name'. |
454 * @param int $limit Limit to X entries. If not specified, all entries are shown. |
459 * If you start the name with an underscore, the order will be reversed. |
|
460 * Specifying 'rand' as the order will return links in a random order. |
|
461 * @param int $limit Optional. Limit to X entries. If not specified, all entries are shown. |
|
462 * Default -1. |
455 * @return array |
463 * @return array |
456 */ |
464 */ |
457 function get_linkobjectsbyname($cat_name = "noname" , $orderby = 'name', $limit = -1) { |
465 function get_linkobjectsbyname($cat_name = "noname" , $orderby = 'name', $limit = -1) { |
458 _deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' ); |
466 _deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' ); |
459 |
467 |
495 * |
503 * |
496 * @since 1.0.1 |
504 * @since 1.0.1 |
497 * @deprecated 2.1.0 Use get_bookmarks() |
505 * @deprecated 2.1.0 Use get_bookmarks() |
498 * @see get_bookmarks() |
506 * @see get_bookmarks() |
499 * |
507 * |
500 * @param int $category The category to use. If no category supplied uses all |
508 * @param int $category Optional. The category to use. If no category supplied, uses all. |
501 * @param string $orderby the order to output the links. E.g. 'id', 'name', 'url', |
509 * Default 0. |
502 * 'description', or 'rating'. Or maybe owner. If you start the name with an |
510 * @param string $orderby Optional. The order to output the links. E.g. 'id', 'name', 'url', |
503 * underscore the order will be reversed. You can also specify 'rand' as the |
511 * 'description', 'rating', or 'owner'. Default 'name'. |
504 * order which will return links in a random order. |
512 * If you start the name with an underscore, the order will be reversed. |
505 * @param int $limit Limit to X entries. If not specified, all entries are shown. |
513 * Specifying 'rand' as the order will return links in a random order. |
|
514 * @param int $limit Optional. Limit to X entries. If not specified, all entries are shown. |
|
515 * Default 0. |
506 * @return array |
516 * @return array |
507 */ |
517 */ |
508 function get_linkobjects($category = 0, $orderby = 'name', $limit = 0) { |
518 function get_linkobjects($category = 0, $orderby = 'name', $limit = 0) { |
509 _deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' ); |
519 _deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' ); |
510 |
520 |
522 * |
532 * |
523 * @since 0.71 |
533 * @since 0.71 |
524 * @deprecated 2.1.0 Use get_bookmarks() |
534 * @deprecated 2.1.0 Use get_bookmarks() |
525 * @see get_bookmarks() |
535 * @see get_bookmarks() |
526 * |
536 * |
527 * @param string $cat_name The category name to use. If no match is found uses all |
537 * @param string $cat_name Optional. The category name to use. If no match is found, uses all. |
528 * @param string $before The html to output before the link |
538 * Default 'noname'. |
529 * @param string $after The html to output after the link |
539 * @param string $before Optional. The HTML to output before the link. Default empty. |
530 * @param string $between The html to output between the link/image and its description. Not used if no image or show_images is true |
540 * @param string $after Optional. The HTML to output after the link. Default '<br />'. |
531 * @param bool $show_images Whether to show images (if defined). |
541 * @param string $between Optional. The HTML to output between the link/image and its description. |
532 * @param string $orderby the order to output the links. E.g. 'id', 'name', 'url', |
542 * Not used if no image or $show_images is true. Default ' '. |
533 * 'description', or 'rating'. Or maybe owner. If you start the name with an |
543 * @param bool $show_images Optional. Whether to show images (if defined). Default true. |
534 * underscore the order will be reversed. You can also specify 'rand' as the |
544 * @param string $orderby Optional. The order to output the links. E.g. 'id', 'name', 'url', |
535 * order which will return links in a random order. |
545 * 'description', 'rating', or 'owner'. Default 'id'. |
536 * @param bool $show_description Whether to show the description if show_images=false/not defined |
546 * If you start the name with an underscore, the order will be reversed. |
537 * @param int $limit Limit to X entries. If not specified, all entries are shown. |
547 * Specifying 'rand' as the order will return links in a random order. |
538 * @param int $show_updated Whether to show last updated timestamp |
548 * @param bool $show_description Optional. Whether to show the description if show_images=false/not defined. |
|
549 * Default true. |
|
550 * @param int $limit Optional. Limit to X entries. If not specified, all entries are shown. |
|
551 * Default -1. |
|
552 * @param int $show_updated Optional. Whether to show last updated timestamp. Default 0. |
539 */ |
553 */ |
540 function get_linksbyname_withrating($cat_name = "noname", $before = '', $after = '<br />', $between = " ", |
554 function get_linksbyname_withrating($cat_name = "noname", $before = '', $after = '<br />', $between = " ", |
541 $show_images = true, $orderby = 'id', $show_description = true, $limit = -1, $show_updated = 0) { |
555 $show_images = true, $orderby = 'id', $show_description = true, $limit = -1, $show_updated = 0) { |
542 _deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' ); |
556 _deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' ); |
543 |
557 |
549 * |
563 * |
550 * @since 0.71 |
564 * @since 0.71 |
551 * @deprecated 2.1.0 Use get_bookmarks() |
565 * @deprecated 2.1.0 Use get_bookmarks() |
552 * @see get_bookmarks() |
566 * @see get_bookmarks() |
553 * |
567 * |
554 * @param int $category The category to use. If no category supplied uses all |
568 * @param int $category Optional. The category to use. If no category supplied, uses all. |
555 * @param string $before The html to output before the link |
569 * Default 0. |
556 * @param string $after The html to output after the link |
570 * @param string $before Optional. The HTML to output before the link. Default empty. |
557 * @param string $between The html to output between the link/image and its description. Not used if no image or show_images == true |
571 * @param string $after Optional. The HTML to output after the link. Default '<br />'. |
558 * @param bool $show_images Whether to show images (if defined). |
572 * @param string $between Optional. The HTML to output between the link/image and its description. |
559 * @param string $orderby The order to output the links. E.g. 'id', 'name', 'url', |
573 * Not used if no image or $show_images is true. Default ' '. |
560 * 'description', or 'rating'. Or maybe owner. If you start the name with an |
574 * @param bool $show_images Optional. Whether to show images (if defined). Default true. |
561 * underscore the order will be reversed. You can also specify 'rand' as the |
575 * @param string $orderby Optional. The order to output the links. E.g. 'id', 'name', 'url', |
562 * order which will return links in a random order. |
576 * 'description', 'rating', or 'owner'. Default 'id'. |
563 * @param bool $show_description Whether to show the description if show_images=false/not defined. |
577 * If you start the name with an underscore, the order will be reversed. |
564 * @param int $limit Limit to X entries. If not specified, all entries are shown. |
578 * Specifying 'rand' as the order will return links in a random order. |
565 * @param int $show_updated Whether to show last updated timestamp |
579 * @param bool $show_description Optional. Whether to show the description if show_images=false/not defined. |
|
580 * Default true. |
|
581 * @param int $limit Optional. Limit to X entries. If not specified, all entries are shown. |
|
582 * Default -1. |
|
583 * @param int $show_updated Optional. Whether to show last updated timestamp. Default 0. |
566 */ |
584 */ |
567 function get_links_withrating($category = -1, $before = '', $after = '<br />', $between = " ", $show_images = true, |
585 function get_links_withrating($category = -1, $before = '', $after = '<br />', $between = " ", $show_images = true, |
568 $orderby = 'id', $show_description = true, $limit = -1, $show_updated = 0) { |
586 $orderby = 'id', $show_description = true, $limit = -1, $show_updated = 0) { |
569 _deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' ); |
587 _deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' ); |
570 |
588 |
571 get_links($category, $before, $after, $between, $show_images, $orderby, $show_description, true, $limit, $show_updated); |
589 get_links($category, $before, $after, $between, $show_images, $orderby, $show_description, true, $limit, $show_updated); |
572 } |
590 } |
573 |
591 |
608 * @param int $recurse |
626 * @param int $recurse |
609 * @param string $feed |
627 * @param string $feed |
610 * @param string $feed_image |
628 * @param string $feed_image |
611 * @param string $exclude |
629 * @param string $exclude |
612 * @param bool $hierarchical |
630 * @param bool $hierarchical |
613 * @return false|null |
631 * @return null|false |
614 */ |
632 */ |
615 function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_order = 'asc', $file = '', $list = true, $optiondates = 0, |
633 function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_order = 'asc', $file = '', $list = true, $optiondates = 0, |
616 $optioncount = 0, $hide_empty = 1, $use_desc_for_title = 1, $children=false, $child_of=0, $categories=0, |
634 $optioncount = 0, $hide_empty = 1, $use_desc_for_title = 1, $children=false, $child_of=0, $categories=0, |
617 $recurse=0, $feed = '', $feed_image = '', $exclude = '', $hierarchical=false) { |
635 $recurse=0, $feed = '', $feed_image = '', $exclude = '', $hierarchical=false) { |
618 _deprecated_function( __FUNCTION__, '2.1.0', 'wp_list_categories()' ); |
636 _deprecated_function( __FUNCTION__, '2.1.0', 'wp_list_categories()' ); |
619 |
637 |
620 $query = compact('optionall', 'all', 'sort_column', 'sort_order', 'file', 'list', 'optiondates', 'optioncount', 'hide_empty', 'use_desc_for_title', 'children', |
638 $query = compact('optionall', 'all', 'sort_column', 'sort_order', 'file', 'list', 'optiondates', 'optioncount', 'hide_empty', 'use_desc_for_title', 'children', |
621 'child_of', 'categories', 'recurse', 'feed', 'feed_image', 'exclude', 'hierarchical'); |
639 'child_of', 'categories', 'recurse', 'feed', 'feed_image', 'exclude', 'hierarchical'); |
622 return wp_list_cats($query); |
640 return wp_list_cats($query); |
628 * @since 1.2.0 |
646 * @since 1.2.0 |
629 * @deprecated 2.1.0 Use wp_list_categories() |
647 * @deprecated 2.1.0 Use wp_list_categories() |
630 * @see wp_list_categories() |
648 * @see wp_list_categories() |
631 * |
649 * |
632 * @param string|array $args |
650 * @param string|array $args |
633 * @return false|null|string |
651 * @return null|string|false |
634 */ |
652 */ |
635 function wp_list_cats($args = '') { |
653 function wp_list_cats($args = '') { |
636 _deprecated_function( __FUNCTION__, '2.1.0', 'wp_list_categories()' ); |
654 _deprecated_function( __FUNCTION__, '2.1.0', 'wp_list_categories()' ); |
637 |
655 |
638 $r = wp_parse_args( $args ); |
656 $parsed_args = wp_parse_args( $args ); |
639 |
657 |
640 // Map to new names. |
658 // Map to new names. |
641 if ( isset($r['optionall']) && isset($r['all'])) |
659 if ( isset($parsed_args['optionall']) && isset($parsed_args['all'])) |
642 $r['show_option_all'] = $r['all']; |
660 $parsed_args['show_option_all'] = $parsed_args['all']; |
643 if ( isset($r['sort_column']) ) |
661 if ( isset($parsed_args['sort_column']) ) |
644 $r['orderby'] = $r['sort_column']; |
662 $parsed_args['orderby'] = $parsed_args['sort_column']; |
645 if ( isset($r['sort_order']) ) |
663 if ( isset($parsed_args['sort_order']) ) |
646 $r['order'] = $r['sort_order']; |
664 $parsed_args['order'] = $parsed_args['sort_order']; |
647 if ( isset($r['optiondates']) ) |
665 if ( isset($parsed_args['optiondates']) ) |
648 $r['show_last_update'] = $r['optiondates']; |
666 $parsed_args['show_last_update'] = $parsed_args['optiondates']; |
649 if ( isset($r['optioncount']) ) |
667 if ( isset($parsed_args['optioncount']) ) |
650 $r['show_count'] = $r['optioncount']; |
668 $parsed_args['show_count'] = $parsed_args['optioncount']; |
651 if ( isset($r['list']) ) |
669 if ( isset($parsed_args['list']) ) |
652 $r['style'] = $r['list'] ? 'list' : 'break'; |
670 $parsed_args['style'] = $parsed_args['list'] ? 'list' : 'break'; |
653 $r['title_li'] = ''; |
671 $parsed_args['title_li'] = ''; |
654 |
672 |
655 return wp_list_categories($r); |
673 return wp_list_categories($parsed_args); |
656 } |
674 } |
657 |
675 |
658 /** |
676 /** |
659 * Deprecated method for generating a drop-down of categories. |
677 * Deprecated method for generating a drop-down of categories. |
660 * |
678 * |
890 'show_rating' => false, |
908 'show_rating' => false, |
891 'show_updated' => true, |
909 'show_updated' => true, |
892 'title_li' => '', |
910 'title_li' => '', |
893 ); |
911 ); |
894 |
912 |
895 $r = wp_parse_args( $args, $defaults ); |
913 $parsed_args = wp_parse_args( $args, $defaults ); |
896 |
914 |
897 return wp_list_bookmarks($r); |
915 return wp_list_bookmarks($parsed_args); |
898 } |
916 } |
899 |
917 |
900 /** |
918 /** |
901 * Gets the links associated with category by id. |
919 * Gets the links associated with category by ID. |
902 * |
920 * |
903 * @since 0.71 |
921 * @since 0.71 |
904 * @deprecated 2.1.0 Use get_bookmarks() |
922 * @deprecated 2.1.0 Use get_bookmarks() |
905 * @see get_bookmarks() |
923 * @see get_bookmarks() |
906 * |
924 * |
907 * @param int $category The category to use. If no category supplied uses all |
925 * @param int $category Optional. The category to use. If no category supplied uses all. |
908 * @param string $before the html to output before the link |
926 * Default 0. |
909 * @param string $after the html to output after the link |
927 * @param string $before Optional. The HTML to output before the link. Default empty. |
910 * @param string $between the html to output between the link/image and its description. |
928 * @param string $after Optional. The HTML to output after the link. Default '<br />'. |
911 * Not used if no image or show_images == true |
929 * @param string $between Optional. The HTML to output between the link/image and its description. |
912 * @param bool $show_images whether to show images (if defined). |
930 * Not used if no image or $show_images is true. Default ' '. |
913 * @param string $orderby the order to output the links. E.g. 'id', 'name', 'url', |
931 * @param bool $show_images Optional. Whether to show images (if defined). Default true. |
914 * 'description', or 'rating'. Or maybe owner. If you start the name with an |
932 * @param string $orderby Optional. The order to output the links. E.g. 'id', 'name', 'url', |
915 * underscore the order will be reversed. You can also specify 'rand' as the order |
933 * 'description', 'rating', or 'owner'. Default 'name'. |
916 * which will return links in a random order. |
934 * If you start the name with an underscore, the order will be reversed. |
917 * @param bool $show_description whether to show the description if show_images=false/not defined. |
935 * Specifying 'rand' as the order will return links in a random order. |
918 * @param bool $show_rating show rating stars/chars |
936 * @param bool $show_description Optional. Whether to show the description if show_images=false/not defined. |
919 * @param int $limit Limit to X entries. If not specified, all entries are shown. |
937 * Default true. |
920 * @param int $show_updated whether to show last updated timestamp |
938 * @param bool $show_rating Optional. Show rating stars/chars. Default false. |
921 * @param bool $echo whether to echo the results, or return them instead |
939 * @param int $limit Optional. Limit to X entries. If not specified, all entries are shown. |
|
940 * Default -1. |
|
941 * @param int $show_updated Optional. Whether to show last updated timestamp. Default 1. |
|
942 * @param bool $echo Whether to echo the results, or return them instead. |
922 * @return null|string |
943 * @return null|string |
923 */ |
944 */ |
924 function get_links($category = -1, $before = '', $after = '<br />', $between = ' ', $show_images = true, $orderby = 'name', |
945 function get_links($category = -1, $before = '', $after = '<br />', $between = ' ', $show_images = true, $orderby = 'name', |
925 $show_description = true, $show_rating = false, $limit = -1, $show_updated = 1, $echo = true) { |
946 $show_description = true, $show_rating = false, $limit = -1, $show_updated = 1, $echo = true) { |
926 _deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' ); |
947 _deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' ); |
1029 if ( !isset($direction) ) |
1050 if ( !isset($direction) ) |
1030 $direction = ''; |
1051 $direction = ''; |
1031 |
1052 |
1032 $cats = get_categories(array('type' => 'link', 'orderby' => $order, 'order' => $direction, 'hierarchical' => 0)); |
1053 $cats = get_categories(array('type' => 'link', 'orderby' => $order, 'order' => $direction, 'hierarchical' => 0)); |
1033 |
1054 |
1034 // Display each category |
1055 // Display each category. |
1035 if ( $cats ) { |
1056 if ( $cats ) { |
1036 foreach ( (array) $cats as $cat ) { |
1057 foreach ( (array) $cats as $cat ) { |
1037 // Handle each category. |
1058 // Handle each category. |
1038 |
1059 |
1039 // Display the category name |
1060 // Display the category name. |
1040 echo ' <li id="linkcat-' . $cat->term_id . '" class="linkcat"><h2>' . apply_filters('link_category', $cat->name ) . "</h2>\n\t<ul>\n"; |
1061 echo ' <li id="linkcat-' . $cat->term_id . '" class="linkcat"><h2>' . apply_filters('link_category', $cat->name ) . "</h2>\n\t<ul>\n"; |
1041 // Call get_links() with all the appropriate params |
1062 // Call get_links() with all the appropriate params. |
1042 get_links($cat->term_id, '<li>', "</li>", "\n", true, 'name', false); |
1063 get_links($cat->term_id, '<li>', "</li>", "\n", true, 'name', false); |
1043 |
1064 |
1044 // Close the last category |
1065 // Close the last category. |
1045 echo "\n\t</ul>\n</li>\n"; |
1066 echo "\n\t</ul>\n</li>\n"; |
1046 } |
1067 } |
1047 } |
1068 } |
1048 } |
1069 } |
1049 |
1070 |
1240 * |
1261 * |
1241 * @since 1.2.0 |
1262 * @since 1.2.0 |
1242 * @deprecated 2.8.0 Use get_term_children() |
1263 * @deprecated 2.8.0 Use get_term_children() |
1243 * @see get_term_children() |
1264 * @see get_term_children() |
1244 * |
1265 * |
1245 * @param int $id Category ID to retrieve children. |
1266 * @param int $id Category ID to retrieve children. |
1246 * @param string $before Optional. Prepend before category term ID. |
1267 * @param string $before Optional. Prepend before category term ID. Default '/'. |
1247 * @param string $after Optional, default is empty string. Append after category term ID. |
1268 * @param string $after Optional. Append after category term ID. Default empty string. |
1248 * @param array $visited Optional. Category Term IDs that have already been added. |
1269 * @param array $visited Optional. Category Term IDs that have already been added. |
|
1270 * Default empty array. |
1249 * @return string |
1271 * @return string |
1250 */ |
1272 */ |
1251 function get_category_children( $id, $before = '/', $after = '', $visited = array() ) { |
1273 function get_category_children( $id, $before = '/', $after = '', $visited = array() ) { |
1252 _deprecated_function( __FUNCTION__, '2.8.0', 'get_term_children()' ); |
1274 _deprecated_function( __FUNCTION__, '2.8.0', 'get_term_children()' ); |
1253 if ( 0 == $id ) |
1275 if ( 0 == $id ) |
1254 return ''; |
1276 return ''; |
1255 |
1277 |
1256 $chain = ''; |
1278 $chain = ''; |
1257 /** TODO: consult hierarchy */ |
1279 /** TODO: Consult hierarchy */ |
1258 $cat_ids = get_all_category_ids(); |
1280 $cat_ids = get_all_category_ids(); |
1259 foreach ( (array) $cat_ids as $cat_id ) { |
1281 foreach ( (array) $cat_ids as $cat_id ) { |
1260 if ( $cat_id == $id ) |
1282 if ( $cat_id == $id ) |
1261 continue; |
1283 continue; |
1262 |
1284 |
1622 } |
1647 } |
1623 |
1648 |
1624 /** |
1649 /** |
1625 * Display the post content for the feed. |
1650 * Display the post content for the feed. |
1626 * |
1651 * |
1627 * For encoding the html or the $encode_html parameter, there are three possible |
1652 * For encoding the HTML or the $encode_html parameter, there are three possible values: |
1628 * values. '0' will make urls footnotes and use make_url_footnote(). '1' will |
1653 * - '0' will make urls footnotes and use make_url_footnote(). |
1629 * encode special characters and automatically display all of the content. The |
1654 * - '1' will encode special characters and automatically display all of the content. |
1630 * value of '2' will strip all HTML tags from the content. |
1655 * - '2' will strip all HTML tags from the content. |
1631 * |
1656 * |
1632 * Also note that you cannot set the amount of words and not set the html |
1657 * Also note that you cannot set the amount of words and not set the HTML encoding. |
1633 * encoding. If that is the case, then the html encoding will default to 2, |
1658 * If that is the case, then the HTML encoding will default to 2, which will strip |
1634 * which will strip all HTML tags. |
1659 * all HTML tags. |
1635 * |
1660 * |
1636 * To restrict the amount of words of the content, you can use the cut |
1661 * To restrict the amount of words of the content, you can use the cut parameter. |
1637 * parameter. If the content is less than the amount, then there won't be any |
1662 * If the content is less than the amount, then there won't be any dots added to the end. |
1638 * dots added to the end. If there is content left over, then dots will be added |
1663 * If there is content left over, then dots will be added and the rest of the content |
1639 * and the rest of the content will be removed. |
1664 * will be removed. |
1640 * |
1665 * |
1641 * @since 0.71 |
1666 * @since 0.71 |
1642 * |
1667 * |
1643 * @deprecated 2.9.0 Use the_content_feed() |
1668 * @deprecated 2.9.0 Use the_content_feed() |
1644 * @see the_content_feed() |
1669 * @see the_content_feed() |
1645 * |
1670 * |
1646 * @param string $more_link_text Optional. Text to display when more content is available but not displayed. |
1671 * @param string $more_link_text Optional. Text to display when more content is available |
1647 * @param int $stripteaser Optional. Default is 0. |
1672 * but not displayed. Default '(more...)'. |
1648 * @param string $more_file Optional. |
1673 * @param int $stripteaser Optional. Default 0. |
1649 * @param int $cut Optional. Amount of words to keep for the content. |
1674 * @param string $more_file Optional. |
1650 * @param int $encode_html Optional. How to encode the content. |
1675 * @param int $cut Optional. Amount of words to keep for the content. |
|
1676 * @param int $encode_html Optional. How to encode the content. |
1651 */ |
1677 */ |
1652 function the_content_rss($more_link_text='(more...)', $stripteaser=0, $more_file='', $cut = 0, $encode_html = 0) { |
1678 function the_content_rss($more_link_text='(more...)', $stripteaser=0, $more_file='', $cut = 0, $encode_html = 0) { |
1653 _deprecated_function( __FUNCTION__, '2.9.0', 'the_content_feed()' ); |
1679 _deprecated_function( __FUNCTION__, '2.9.0', 'the_content_feed()' ); |
1654 $content = get_the_content($more_link_text, $stripteaser); |
1680 $content = get_the_content($more_link_text, $stripteaser); |
1655 |
1681 |
1790 * |
1816 * |
1791 * @since 1.2.0 |
1817 * @since 1.2.0 |
1792 * @deprecated 2.8.0 Use _n() |
1818 * @deprecated 2.8.0 Use _n() |
1793 * @see _n() |
1819 * @see _n() |
1794 */ |
1820 */ |
1795 function __ngettext() { |
1821 function __ngettext( ...$args ) { // phpcs:ignore PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames.FunctionDoubleUnderscore |
1796 _deprecated_function( __FUNCTION__, '2.8.0', '_n()' ); |
1822 _deprecated_function( __FUNCTION__, '2.8.0', '_n()' ); |
1797 $args = func_get_args(); |
1823 return _n( ...$args ); |
1798 return call_user_func_array('_n', $args); |
|
1799 } |
1824 } |
1800 |
1825 |
1801 /** |
1826 /** |
1802 * Register plural strings in POT file, but don't translate them. |
1827 * Register plural strings in POT file, but don't translate them. |
1803 * |
1828 * |
1804 * @since 2.5.0 |
1829 * @since 2.5.0 |
1805 * @deprecated 2.8.0 Use _n_noop() |
1830 * @deprecated 2.8.0 Use _n_noop() |
1806 * @see _n_noop() |
1831 * @see _n_noop() |
1807 */ |
1832 */ |
1808 function __ngettext_noop() { |
1833 function __ngettext_noop( ...$args ) { // phpcs:ignore PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames.FunctionDoubleUnderscore |
1809 _deprecated_function( __FUNCTION__, '2.8.0', '_n_noop()' ); |
1834 _deprecated_function( __FUNCTION__, '2.8.0', '_n_noop()' ); |
1810 $args = func_get_args(); |
1835 return _n_noop( ...$args ); |
1811 return call_user_func_array('_n_noop', $args); |
|
1812 |
1836 |
1813 } |
1837 } |
1814 |
1838 |
1815 /** |
1839 /** |
1816 * Retrieve all autoload options, or all options if no autoloaded ones exist. |
1840 * Retrieve all autoload options, or all options if no autoloaded ones exist. |
1831 * |
1855 * |
1832 * @since 2.0.0 |
1856 * @since 2.0.0 |
1833 * @deprecated 2.5.0 Use wp_get_attachment_link() |
1857 * @deprecated 2.5.0 Use wp_get_attachment_link() |
1834 * @see wp_get_attachment_link() |
1858 * @see wp_get_attachment_link() |
1835 * |
1859 * |
1836 * @param int $id Optional. Post ID. |
1860 * @param int $id Optional. Post ID. |
1837 * @param bool $fullsize Optional, default is false. Whether to use full size image. |
1861 * @param bool $fullsize Optional. Whether to use full size image. Default false. |
1838 * @param array $max_dims Optional. Max image dimensions. |
1862 * @param array $max_dims Optional. Max image dimensions. |
1839 * @param bool $permalink Optional, default is false. Whether to include permalink to image. |
1863 * @param bool $permalink Optional. Whether to include permalink to image. Default false. |
1840 * @return string |
1864 * @return string |
1841 */ |
1865 */ |
1842 function get_the_attachment_link($id = 0, $fullsize = false, $max_dims = false, $permalink = false) { |
1866 function get_the_attachment_link($id = 0, $fullsize = false, $max_dims = false, $permalink = false) { |
1843 _deprecated_function( __FUNCTION__, '2.5.0', 'wp_get_attachment_link()' ); |
1867 _deprecated_function( __FUNCTION__, '2.5.0', 'wp_get_attachment_link()' ); |
1844 $id = (int) $id; |
1868 $id = (int) $id; |
1874 return false; |
1898 return false; |
1875 |
1899 |
1876 $file = get_attached_file( $post->ID ); |
1900 $file = get_attached_file( $post->ID ); |
1877 |
1901 |
1878 if ( !$fullsize && $src = wp_get_attachment_thumb_url( $post->ID ) ) { |
1902 if ( !$fullsize && $src = wp_get_attachment_thumb_url( $post->ID ) ) { |
1879 // We have a thumbnail desired, specified and existing |
1903 // We have a thumbnail desired, specified and existing. |
1880 |
1904 |
1881 $src_file = wp_basename($src); |
1905 $src_file = wp_basename($src); |
1882 } elseif ( wp_attachment_is_image( $post->ID ) ) { |
1906 } elseif ( wp_attachment_is_image( $post->ID ) ) { |
1883 // We have an image without a thumbnail |
1907 // We have an image without a thumbnail. |
1884 |
1908 |
1885 $src = wp_get_attachment_url( $post->ID ); |
1909 $src = wp_get_attachment_url( $post->ID ); |
1886 $src_file = & $file; |
1910 $src_file = & $file; |
1887 } elseif ( $src = wp_mime_type_icon( $post->ID ) ) { |
1911 } elseif ( $src = wp_mime_type_icon( $post->ID ) ) { |
1888 // No thumb, no image. We'll look for a mime-related icon instead. |
1912 // No thumb, no image. We'll look for a mime-related icon instead. |
1902 * |
1926 * |
1903 * @since 2.0.0 |
1927 * @since 2.0.0 |
1904 * @deprecated 2.5.0 Use wp_get_attachment_image() |
1928 * @deprecated 2.5.0 Use wp_get_attachment_image() |
1905 * @see wp_get_attachment_image() |
1929 * @see wp_get_attachment_image() |
1906 * |
1930 * |
1907 * @param int $id Optional. Post ID. |
1931 * @param int $id Optional. Post ID. |
1908 * @param bool $fullsize Optional, default to false. Whether to have full size image. |
1932 * @param bool $fullsize Optional. Whether to have full size image. Default false. |
1909 * @param array $max_dims Optional. Dimensions of image. |
1933 * @param array $max_dims Optional. Dimensions of image. |
1910 * @return false|string HTML content. |
1934 * @return string|false HTML content. |
1911 */ |
1935 */ |
1912 function get_attachment_icon( $id = 0, $fullsize = false, $max_dims = false ) { |
1936 function get_attachment_icon( $id = 0, $fullsize = false, $max_dims = false ) { |
1913 _deprecated_function( __FUNCTION__, '2.5.0', 'wp_get_attachment_image()' ); |
1937 _deprecated_function( __FUNCTION__, '2.5.0', 'wp_get_attachment_image()' ); |
1914 $id = (int) $id; |
1938 $id = (int) $id; |
1915 if ( !$post = get_post($id) ) |
1939 if ( !$post = get_post($id) ) |
1958 * |
1982 * |
1959 * @since 2.0.0 |
1983 * @since 2.0.0 |
1960 * @deprecated 2.5.0 Use wp_get_attachment_image() |
1984 * @deprecated 2.5.0 Use wp_get_attachment_image() |
1961 * @see wp_get_attachment_image() |
1985 * @see wp_get_attachment_image() |
1962 * |
1986 * |
1963 * @param int $id Optional. Post ID. |
1987 * @param int $id Optional. Post ID. |
1964 * @param bool $fullsize Optional, default to false. Whether to have full size image. |
1988 * @param bool $fullsize Optional. Whether to have full size image. Default false. |
1965 * @param array $max_dims Optional. Dimensions of image. |
1989 * @param array $max_dims Optional. Dimensions of image. |
1966 * @return false|string |
1990 * @return string|false |
1967 */ |
1991 */ |
1968 function get_attachment_innerHTML($id = 0, $fullsize = false, $max_dims = false) { |
1992 function get_attachment_innerHTML($id = 0, $fullsize = false, $max_dims = false) { |
1969 _deprecated_function( __FUNCTION__, '2.5.0', 'wp_get_attachment_image()' ); |
1993 _deprecated_function( __FUNCTION__, '2.5.0', 'wp_get_attachment_image()' ); |
1970 $id = (int) $id; |
1994 $id = (int) $id; |
1971 if ( !$post = get_post($id) ) |
1995 if ( !$post = get_post($id) ) |
2068 * @return string Escaped `$string`. |
2092 * @return string Escaped `$string`. |
2069 */ |
2093 */ |
2070 function wp_specialchars( $string, $quote_style = ENT_NOQUOTES, $charset = false, $double_encode = false ) { |
2094 function wp_specialchars( $string, $quote_style = ENT_NOQUOTES, $charset = false, $double_encode = false ) { |
2071 _deprecated_function( __FUNCTION__, '2.8.0', 'esc_html()' ); |
2095 _deprecated_function( __FUNCTION__, '2.8.0', 'esc_html()' ); |
2072 if ( func_num_args() > 1 ) { // Maintain back-compat for people passing additional arguments. |
2096 if ( func_num_args() > 1 ) { // Maintain back-compat for people passing additional arguments. |
2073 $args = func_get_args(); |
2097 return _wp_specialchars( $string, $quote_style, $charset, $double_encode ); |
2074 return call_user_func_array( '_wp_specialchars', $args ); |
|
2075 } else { |
2098 } else { |
2076 return esc_html( $string ); |
2099 return esc_html( $string ); |
2077 } |
2100 } |
2078 } |
2101 } |
2079 |
2102 |
2107 * @see wp_register_sidebar_widget() |
2130 * @see wp_register_sidebar_widget() |
2108 * |
2131 * |
2109 * @param string|int $name Widget ID. |
2132 * @param string|int $name Widget ID. |
2110 * @param callable $output_callback Run when widget is called. |
2133 * @param callable $output_callback Run when widget is called. |
2111 * @param string $classname Optional. Classname widget option. Default empty. |
2134 * @param string $classname Optional. Classname widget option. Default empty. |
2112 * @param mixed $params ,... Widget parameters. |
2135 * @param mixed ...$params Widget parameters. |
2113 */ |
2136 */ |
2114 function register_sidebar_widget($name, $output_callback, $classname = '') { |
2137 function register_sidebar_widget($name, $output_callback, $classname = '', ...$params) { |
2115 _deprecated_function( __FUNCTION__, '2.8.0', 'wp_register_sidebar_widget()' ); |
2138 _deprecated_function( __FUNCTION__, '2.8.0', 'wp_register_sidebar_widget()' ); |
2116 // Compat |
2139 // Compat. |
2117 if ( is_array($name) ) { |
2140 if ( is_array( $name ) ) { |
2118 if ( count($name) == 3 ) |
2141 if ( count( $name ) === 3 ) { |
2119 $name = sprintf($name[0], $name[2]); |
2142 $name = sprintf( $name[0], $name[2] ); |
2120 else |
2143 } else { |
2121 $name = $name[0]; |
2144 $name = $name[0]; |
|
2145 } |
2122 } |
2146 } |
2123 |
2147 |
2124 $id = sanitize_title($name); |
2148 $id = sanitize_title( $name ); |
2125 $options = array(); |
2149 $options = array(); |
2126 if ( !empty($classname) && is_string($classname) ) |
2150 if ( ! empty( $classname ) && is_string( $classname ) ) { |
2127 $options['classname'] = $classname; |
2151 $options['classname'] = $classname; |
2128 $params = array_slice(func_get_args(), 2); |
2152 } |
2129 $args = array($id, $name, $output_callback, $options); |
2153 |
2130 if ( !empty($params) ) |
2154 wp_register_sidebar_widget( $id, $name, $output_callback, $options, ...$params ); |
2131 $args = array_merge($args, $params); |
|
2132 |
|
2133 call_user_func_array('wp_register_sidebar_widget', $args); |
|
2134 } |
2155 } |
2135 |
2156 |
2136 /** |
2157 /** |
2137 * Serves as an alias of wp_unregister_sidebar_widget(). |
2158 * Serves as an alias of wp_unregister_sidebar_widget(). |
2138 * |
2159 * |
2159 * |
2180 * |
2160 * @since 2.2.0 |
2181 * @since 2.2.0 |
2161 * @deprecated 2.8.0 Use wp_register_widget_control() |
2182 * @deprecated 2.8.0 Use wp_register_widget_control() |
2162 * @see wp_register_widget_control() |
2183 * @see wp_register_widget_control() |
2163 * |
2184 * |
2164 * @param int|string $name Sidebar ID. |
2185 * @param int|string $name Sidebar ID. |
2165 * @param callable $control_callback Widget control callback to display and process form. |
2186 * @param callable $control_callback Widget control callback to display and process form. |
2166 * @param int $width Widget width. |
2187 * @param int $width Widget width. |
2167 * @param int $height Widget height. |
2188 * @param int $height Widget height. |
2168 */ |
2189 * @param mixed ...$params Widget parameters. |
2169 function register_widget_control($name, $control_callback, $width = '', $height = '') { |
2190 */ |
|
2191 function register_widget_control($name, $control_callback, $width = '', $height = '', ...$params) { |
2170 _deprecated_function( __FUNCTION__, '2.8.0', 'wp_register_widget_control()' ); |
2192 _deprecated_function( __FUNCTION__, '2.8.0', 'wp_register_widget_control()' ); |
2171 // Compat |
2193 // Compat. |
2172 if ( is_array($name) ) { |
2194 if ( is_array( $name ) ) { |
2173 if ( count($name) == 3 ) |
2195 if ( count( $name ) === 3 ) { |
2174 $name = sprintf($name[0], $name[2]); |
2196 $name = sprintf( $name[0], $name[2] ); |
2175 else |
2197 } else { |
2176 $name = $name[0]; |
2198 $name = $name[0]; |
|
2199 } |
2177 } |
2200 } |
2178 |
2201 |
2179 $id = sanitize_title($name); |
2202 $id = sanitize_title( $name ); |
2180 $options = array(); |
2203 $options = array(); |
2181 if ( !empty($width) ) |
2204 if ( ! empty( $width ) ) { |
2182 $options['width'] = $width; |
2205 $options['width'] = $width; |
2183 if ( !empty($height) ) |
2206 } |
|
2207 if ( ! empty( $height ) ) { |
2184 $options['height'] = $height; |
2208 $options['height'] = $height; |
2185 $params = array_slice(func_get_args(), 4); |
2209 } |
2186 $args = array($id, $name, $control_callback, $options); |
2210 |
2187 if ( !empty($params) ) |
2211 wp_register_widget_control( $id, $name, $control_callback, $options, ...$params ); |
2188 $args = array_merge($args, $params); |
|
2189 |
|
2190 call_user_func_array('wp_register_widget_control', $args); |
|
2191 } |
2212 } |
2192 |
2213 |
2193 /** |
2214 /** |
2194 * Alias of wp_unregister_widget_control(). |
2215 * Alias of wp_unregister_widget_control(). |
2195 * |
2216 * |
2211 * @deprecated 3.0.0 Use delete_user_meta() |
2232 * @deprecated 3.0.0 Use delete_user_meta() |
2212 * @see delete_user_meta() |
2233 * @see delete_user_meta() |
2213 * |
2234 * |
2214 * @param int $user_id User ID. |
2235 * @param int $user_id User ID. |
2215 * @param string $meta_key Metadata key. |
2236 * @param string $meta_key Metadata key. |
2216 * @param mixed $meta_value Metadata value. |
2237 * @param mixed $meta_value Optional. Metadata value. Default empty. |
2217 * @return bool True deletion completed and false if user_id is not a number. |
2238 * @return bool True deletion completed and false if user_id is not a number. |
2218 */ |
2239 */ |
2219 function delete_usermeta( $user_id, $meta_key, $meta_value = '' ) { |
2240 function delete_usermeta( $user_id, $meta_key, $meta_value = '' ) { |
2220 _deprecated_function( __FUNCTION__, '3.0.0', 'delete_user_meta()' ); |
2241 _deprecated_function( __FUNCTION__, '3.0.0', 'delete_user_meta()' ); |
2221 global $wpdb; |
2242 global $wpdb; |
2271 return false; |
2292 return false; |
2272 |
2293 |
2273 if ( !empty($meta_key) ) { |
2294 if ( !empty($meta_key) ) { |
2274 $meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key); |
2295 $meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key); |
2275 $user = wp_cache_get($user_id, 'users'); |
2296 $user = wp_cache_get($user_id, 'users'); |
2276 // Check the cached user object |
2297 // Check the cached user object. |
2277 if ( false !== $user && isset($user->$meta_key) ) |
2298 if ( false !== $user && isset($user->$meta_key) ) |
2278 $metas = array($user->$meta_key); |
2299 $metas = array($user->$meta_key); |
2279 else |
2300 else |
2280 $metas = $wpdb->get_col( $wpdb->prepare("SELECT meta_value FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) ); |
2301 $metas = $wpdb->get_col( $wpdb->prepare("SELECT meta_value FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) ); |
2281 } else { |
2302 } else { |
2386 * |
2407 * |
2387 * @since 2.8.0 |
2408 * @since 2.8.0 |
2388 * @deprecated 3.0.0 Use add_theme_support() |
2409 * @deprecated 3.0.0 Use add_theme_support() |
2389 * @see add_theme_support() |
2410 * @see add_theme_support() |
2390 * |
2411 * |
2391 * @param bool $add Optional, default is true. Add or remove links. Defaults to true. |
2412 * @param bool $add Optional. Add or remove links. Default true. |
2392 */ |
2413 */ |
2393 function automatic_feed_links( $add = true ) { |
2414 function automatic_feed_links( $add = true ) { |
2394 _deprecated_function( __FUNCTION__, '3.0.0', "add_theme_support( 'automatic-feed-links' )" ); |
2415 _deprecated_function( __FUNCTION__, '3.0.0', "add_theme_support( 'automatic-feed-links' )" ); |
2395 |
2416 |
2396 if ( $add ) |
2417 if ( $add ) |
2397 add_theme_support( 'automatic-feed-links' ); |
2418 add_theme_support( 'automatic-feed-links' ); |
2398 else |
2419 else |
2399 remove_action( 'wp_head', 'feed_links_extra', 3 ); // Just do this yourself in 3.0+ |
2420 remove_action( 'wp_head', 'feed_links_extra', 3 ); // Just do this yourself in 3.0+. |
2400 } |
2421 } |
2401 |
2422 |
2402 /** |
2423 /** |
2403 * Retrieve user data based on field. |
2424 * Retrieve user data based on field. |
2404 * |
2425 * |
2405 * @since 1.5.0 |
2426 * @since 1.5.0 |
2406 * @deprecated 3.0.0 Use get_the_author_meta() |
2427 * @deprecated 3.0.0 Use get_the_author_meta() |
2407 * @see get_the_author_meta() |
2428 * @see get_the_author_meta() |
2408 * |
2429 * |
2409 * @param string $field User meta field. |
2430 * @param string $field User meta field. |
2410 * @param false|int $user Optional. User ID to retrieve the field for. Default false (current user). |
2431 * @param false|int $user Optional. User ID to retrieve the field for. Default false (current user). |
2411 * @return string The author's field from the current author's DB object. |
2432 * @return string The author's field from the current author's DB object. |
2412 */ |
2433 */ |
2413 function get_profile( $field, $user = false ) { |
2434 function get_profile( $field, $user = false ) { |
2414 _deprecated_function( __FUNCTION__, '3.0.0', 'get_the_author_meta()' ); |
2435 _deprecated_function( __FUNCTION__, '3.0.0', 'get_the_author_meta()' ); |
2415 if ( $user ) { |
2436 if ( $user ) { |
2498 * @see term_exists() |
2519 * @see term_exists() |
2499 * |
2520 * |
2500 * @param int|string $term The term to check |
2521 * @param int|string $term The term to check |
2501 * @param string $taxonomy The taxonomy name to use |
2522 * @param string $taxonomy The taxonomy name to use |
2502 * @param int $parent ID of parent term under which to confine the exists search. |
2523 * @param int $parent ID of parent term under which to confine the exists search. |
2503 * @return mixed Get the term id or Term Object, if exists. |
2524 * @return mixed Get the term ID or term object, if exists. |
2504 */ |
2525 */ |
2505 function is_term( $term, $taxonomy = '', $parent = 0 ) { |
2526 function is_term( $term, $taxonomy = '', $parent = 0 ) { |
2506 _deprecated_function( __FUNCTION__, '3.0.0', 'term_exists()' ); |
2527 _deprecated_function( __FUNCTION__, '3.0.0', 'term_exists()' ); |
2507 return term_exists( $term, $taxonomy, $parent ); |
2528 return term_exists( $term, $taxonomy, $parent ); |
2508 } |
2529 } |
2509 |
2530 |
2510 /** |
2531 /** |
2511 * Determines whether the current admin page is generated by a plugin. |
2532 * Determines whether the current admin page is generated by a plugin. |
2512 * |
2533 * |
2513 * Use global $plugin_page and/or get_plugin_page_hookname() hooks. |
2534 * Use global $plugin_page and/or get_plugin_page_hookname() hooks. |
2514 * |
2535 * |
2515 * For more information on this and similar theme functions, check out |
2536 * For more information on this and similar theme functions, check out |
2516 * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ |
2537 * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ |
2517 * Conditional Tags} article in the Theme Developer Handbook. |
2538 * Conditional Tags} article in the Theme Developer Handbook. |
2518 * |
2539 * |
2519 * @since 1.5.0 |
2540 * @since 1.5.0 |
2520 * @deprecated 3.1.0 |
2541 * @deprecated 3.1.0 |
2521 * |
2542 * |
2522 * @global $plugin_page |
2543 * @global $plugin_page |
2523 * |
2544 * |
2660 * Can either be start or end post relational link. |
2681 * Can either be start or end post relational link. |
2661 * |
2682 * |
2662 * @since 2.8.0 |
2683 * @since 2.8.0 |
2663 * @deprecated 3.3.0 |
2684 * @deprecated 3.3.0 |
2664 * |
2685 * |
2665 * @param string $title Optional. Link title format. |
2686 * @param string $title Optional. Link title format. Default '%title'. |
2666 * @param bool $in_same_cat Optional. Whether link should be in a same category. |
2687 * @param bool $in_same_cat Optional. Whether link should be in a same category. |
2667 * @param string $excluded_categories Optional. Excluded categories IDs. |
2688 * Default false. |
2668 * @param bool $start Optional, default is true. Whether to display link to first or last post. |
2689 * @param string $excluded_categories Optional. Excluded categories IDs. Default empty. |
|
2690 * @param bool $start Optional. Whether to display link to first or last post. |
|
2691 * Default true. |
2669 * @return string |
2692 * @return string |
2670 */ |
2693 */ |
2671 function get_boundary_post_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '', $start = true) { |
2694 function get_boundary_post_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '', $start = true) { |
2672 _deprecated_function( __FUNCTION__, '3.3.0' ); |
2695 _deprecated_function( __FUNCTION__, '3.3.0' ); |
2673 |
2696 |
2674 $posts = get_boundary_post($in_same_cat, $excluded_categories, $start); |
2697 $posts = get_boundary_post($in_same_cat, $excluded_categories, $start); |
2675 // If there is no post stop. |
2698 // If there is no post, stop. |
2676 if ( empty($posts) ) |
2699 if ( empty($posts) ) |
2677 return; |
2700 return; |
2678 |
2701 |
2679 // Even though we limited get_posts to return only 1 item it still returns an array of objects. |
2702 // Even though we limited get_posts() to return only 1 item it still returns an array of objects. |
2680 $post = $posts[0]; |
2703 $post = $posts[0]; |
2681 |
2704 |
2682 if ( empty($post->post_title) ) |
2705 if ( empty($post->post_title) ) |
2683 $post->post_title = $start ? __('First Post') : __('Last Post'); |
2706 $post->post_title = $start ? __('First Post') : __('Last Post'); |
2684 |
2707 |
3215 * |
3238 * |
3216 * @since 2.5.0 |
3239 * @since 2.5.0 |
3217 * @deprecated 3.5.0 Use wp_get_image_editor() |
3240 * @deprecated 3.5.0 Use wp_get_image_editor() |
3218 * @see wp_get_image_editor() |
3241 * @see wp_get_image_editor() |
3219 * |
3242 * |
3220 * @param string $file Image file path. |
3243 * @param string $file Image file path. |
3221 * @param int $max_w Maximum width to resize to. |
3244 * @param int $max_w Maximum width to resize to. |
3222 * @param int $max_h Maximum height to resize to. |
3245 * @param int $max_h Maximum height to resize to. |
3223 * @param bool $crop Optional. Whether to crop image or resize. |
3246 * @param bool $crop Optional. Whether to crop image or resize. Default false. |
3224 * @param string $suffix Optional. File suffix. |
3247 * @param string $suffix Optional. File suffix. Default null. |
3225 * @param string $dest_path Optional. New image file path. |
3248 * @param string $dest_path Optional. New image file path. Default null. |
3226 * @param int $jpeg_quality Optional, default is 90. Image quality percentage. |
3249 * @param int $jpeg_quality Optional. Image quality percentage. Default 90. |
3227 * @return mixed WP_Error on failure. String with new destination path. |
3250 * @return mixed WP_Error on failure. String with new destination path. |
3228 */ |
3251 */ |
3229 function image_resize( $file, $max_w, $max_h, $crop = false, $suffix = null, $dest_path = null, $jpeg_quality = 90 ) { |
3252 function image_resize( $file, $max_w, $max_h, $crop = false, $suffix = null, $dest_path = null, $jpeg_quality = 90 ) { |
3230 _deprecated_function( __FUNCTION__, '3.5.0', 'wp_get_image_editor()' ); |
3253 _deprecated_function( __FUNCTION__, '3.5.0', 'wp_get_image_editor()' ); |
3231 |
3254 |
3343 _deprecated_function( __FUNCTION__, '3.6.0', 'size_format()' ); |
3366 _deprecated_function( __FUNCTION__, '3.6.0', 'size_format()' ); |
3344 |
3367 |
3345 $units = array( 0 => 'B', 1 => 'KB', 2 => 'MB', 3 => 'GB', 4 => 'TB' ); |
3368 $units = array( 0 => 'B', 1 => 'KB', 2 => 'MB', 3 => 'GB', 4 => 'TB' ); |
3346 $log = log( $bytes, KB_IN_BYTES ); |
3369 $log = log( $bytes, KB_IN_BYTES ); |
3347 $power = (int) $log; |
3370 $power = (int) $log; |
3348 $size = pow( KB_IN_BYTES, $log - $power ); |
3371 $size = KB_IN_BYTES ** ( $log - $power ); |
3349 |
3372 |
3350 if ( ! is_nan( $size ) && array_key_exists( $power, $units ) ) { |
3373 if ( ! is_nan( $size ) && array_key_exists( $power, $units ) ) { |
3351 $unit = $units[ $power ]; |
3374 $unit = $units[ $power ]; |
3352 } else { |
3375 } else { |
3353 $size = $bytes; |
3376 $size = $bytes; |
3943 * @deprecated 4.9.0 |
3966 * @deprecated 4.9.0 |
3944 */ |
3967 */ |
3945 function wp_ajax_press_this_add_category() { |
3968 function wp_ajax_press_this_add_category() { |
3946 _deprecated_function( __FUNCTION__, '4.9.0' ); |
3969 _deprecated_function( __FUNCTION__, '4.9.0' ); |
3947 if ( is_plugin_active( 'press-this/press-this-plugin.php' ) ) { |
3970 if ( is_plugin_active( 'press-this/press-this-plugin.php' ) ) { |
3948 include( WP_PLUGIN_DIR . '/press-this/class-wp-press-this-plugin.php' ); |
3971 include WP_PLUGIN_DIR . '/press-this/class-wp-press-this-plugin.php'; |
3949 $wp_press_this = new WP_Press_This_Plugin(); |
3972 $wp_press_this = new WP_Press_This_Plugin(); |
3950 $wp_press_this->add_category(); |
3973 $wp_press_this->add_category(); |
3951 } else { |
3974 } else { |
3952 wp_send_json_error( array( 'errorMessage' => __( 'The Press This plugin is required.' ) ) ); |
3975 wp_send_json_error( array( 'errorMessage' => __( 'The Press This plugin is required.' ) ) ); |
3953 } |
3976 } |
3954 } |
3977 } |
|
3978 |
|
3979 /** |
|
3980 * Return the user request object for the specified request ID. |
|
3981 * |
|
3982 * @since 4.9.6 |
|
3983 * @deprecated 5.4.0 Use wp_get_user_request() |
|
3984 * @see wp_get_user_request() |
|
3985 * |
|
3986 * @param int $request_id The ID of the user request. |
|
3987 * @return WP_User_Request|false |
|
3988 */ |
|
3989 function wp_get_user_request_data( $request_id ) { |
|
3990 _deprecated_function( __FUNCTION__, '5.4.0', 'wp_get_user_request()' ); |
|
3991 return wp_get_user_request( $request_id ); |
|
3992 } |
|
3993 |
|
3994 /** |
|
3995 * Filters 'img' elements in post content to add 'srcset' and 'sizes' attributes. |
|
3996 * |
|
3997 * @since 4.4.0 |
|
3998 * @deprecated 5.5.0 |
|
3999 * |
|
4000 * @see wp_image_add_srcset_and_sizes() |
|
4001 * |
|
4002 * @param string $content The raw post content to be filtered. |
|
4003 * @return string Converted content with 'srcset' and 'sizes' attributes added to images. |
|
4004 */ |
|
4005 function wp_make_content_images_responsive( $content ) { |
|
4006 _deprecated_function( __FUNCTION__, '5.5.0', 'wp_filter_content_tags()' ); |
|
4007 |
|
4008 // This will also add the `loading` attribute to `img` tags, if enabled. |
|
4009 return wp_filter_content_tags( $content ); |
|
4010 } |
|
4011 |
|
4012 /** |
|
4013 * Turn register globals off. |
|
4014 * |
|
4015 * @since 2.1.0 |
|
4016 * @access private |
|
4017 * @deprecated 5.5.0 |
|
4018 */ |
|
4019 function wp_unregister_GLOBALS() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid |
|
4020 // register_globals was deprecated in PHP 5.3 and removed entirely in PHP 5.4. |
|
4021 _deprecated_function( __FUNCTION__, '5.5.0' ); |
|
4022 } |
|
4023 |
|
4024 /** |
|
4025 * Does comment contain disallowed characters or words. |
|
4026 * |
|
4027 * @since 1.5.0 |
|
4028 * @deprecated 5.5.0 Use wp_check_comment_disallowed_list() instead. |
|
4029 * Please consider writing more inclusive code. |
|
4030 * |
|
4031 * @param string $author The author of the comment |
|
4032 * @param string $email The email of the comment |
|
4033 * @param string $url The url used in the comment |
|
4034 * @param string $comment The comment content |
|
4035 * @param string $user_ip The comment author's IP address |
|
4036 * @param string $user_agent The author's browser user agent |
|
4037 * @return bool True if comment contains disallowed content, false if comment does not |
|
4038 */ |
|
4039 function wp_blacklist_check( $author, $email, $url, $comment, $user_ip, $user_agent ) { |
|
4040 _deprecated_function( __FUNCTION__, '5.5.0', 'wp_check_comment_disallowed_list()' ); |
|
4041 |
|
4042 return wp_check_comment_disallowed_list( $author, $email, $url, $comment, $user_ip, $user_agent ); |
|
4043 } |
|
4044 |
|
4045 /** |
|
4046 * Filters out `register_meta()` args based on an allowed list. |
|
4047 * |
|
4048 * `register_meta()` args may change over time, so requiring the allowed list |
|
4049 * to be explicitly turned off is a warranty seal of sorts. |
|
4050 * |
|
4051 * @access private |
|
4052 * @since 4.6.0 |
|
4053 * @deprecated 5.5.0 Use _wp_register_meta_args_allowed_list() instead. |
|
4054 * Please consider writing more inclusive code. |
|
4055 * |
|
4056 * @param array $args Arguments from `register_meta()`. |
|
4057 * @param array $default_args Default arguments for `register_meta()`. |
|
4058 * @return array Filtered arguments. |
|
4059 */ |
|
4060 function _wp_register_meta_args_whitelist( $args, $default_args ) { |
|
4061 _deprecated_function( __FUNCTION__, '5.5.0', '_wp_register_meta_args_allowed_list()' ); |
|
4062 |
|
4063 return _wp_register_meta_args_allowed_list( $args, $default_args ); |
|
4064 } |
|
4065 |
|
4066 /** |
|
4067 * Adds an array of options to the list of allowed options. |
|
4068 * |
|
4069 * @since 2.7.0 |
|
4070 * @deprecated 5.5.0 Use add_allowed_options() instead. |
|
4071 * Please consider writing more inclusive code. |
|
4072 * |
|
4073 * @global array $allowed_options |
|
4074 * |
|
4075 * @param array $new_options |
|
4076 * @param string|array $options |
|
4077 * @return array |
|
4078 */ |
|
4079 function add_option_whitelist( $new_options, $options = '' ) { |
|
4080 _deprecated_function( __FUNCTION__, '5.5.0', 'add_allowed_options()' ); |
|
4081 |
|
4082 return add_allowed_options( $new_options, $options ); |
|
4083 } |
|
4084 |
|
4085 /** |
|
4086 * Removes a list of options from the allowed options list. |
|
4087 * |
|
4088 * @since 2.7.0 |
|
4089 * @deprecated 5.5.0 Use remove_allowed_options() instead. |
|
4090 * Please consider writing more inclusive code. |
|
4091 * |
|
4092 * @global array $allowed_options |
|
4093 * |
|
4094 * @param array $del_options |
|
4095 * @param string|array $options |
|
4096 * @return array |
|
4097 */ |
|
4098 function remove_option_whitelist( $del_options, $options = '' ) { |
|
4099 _deprecated_function( __FUNCTION__, '5.5.0', 'remove_allowed_options()' ); |
|
4100 |
|
4101 return remove_allowed_options( $del_options, $options ); |
|
4102 } |