Ticket #4361: deprecated-trunk-6429.diff
File deprecated-trunk-6429.diff, 14.9 KB (added by , 15 years ago) |
---|
-
wp-includes/deprecated.php
7 7 8 8 /* 9 9 * Deprecated global variables. 10 * 11 * When adding a method to this list, please add an error log like so: 12 * user_error('depricated_function() is DEPRECATED. Please use better_function() instead.', E_USER_NOTICE); 10 13 */ 11 14 12 15 /** … … 86 89 * @return array 87 90 */ 88 91 function get_postdata($postid) { 92 user_error('get_postdata() is DEPRECATED; use get_post() instead.', E_USER_NOTICE); 89 93 $post = &get_post($postid); 90 94 91 95 $postdata = array ( … … 116 120 * @deprecated Since 1.5 - {@link http://codex.wordpress.org/The_Loop Use new WordPress Loop} 117 121 */ 118 122 function start_wp() { 123 user_error('start_wp() is DEPRECATED; please use the new post loop instead.', E_USER_NOTICE); 119 124 global $wp_query, $post; 120 125 121 126 // Since the old style loop is being used, advance the query iterator here. … … 135 140 * @return null|int 136 141 */ 137 142 function the_category_ID($echo = true) { 143 user_error('the_category_ID() is DEPRECATED.', E_USER_NOTICE); 138 144 // Grab the first cat in the list. 139 145 $categories = get_the_category(); 140 146 $cat = $categories[0]->term_id; … … 156 162 * @param string $after 157 163 */ 158 164 function the_category_head($before='', $after='') { 165 user_error('the_category_head() s DEPRECATED.', E_USER_NOTICE); 159 166 global $currentcat, $previouscat; 160 167 // Grab the first cat in the list. 161 168 $categories = get_the_category(); … … 183 190 * @param string $excluded_categories 184 191 */ 185 192 function previous_post($format='%', $previous='previous post: ', $title='yes', $in_same_cat='no', $limitprev=1, $excluded_categories='') { 193 user_error('previous_post() is DEPRECATED; please use previous_post() instead.', E_USER_NOTICE); 186 194 187 195 if ( empty($in_same_cat) || 'no' == $in_same_cat ) 188 196 $in_same_cat = false; … … 217 225 * @param string $excluded_categories 218 226 */ 219 227 function next_post($format='%', $next='next post: ', $title='yes', $in_same_cat='no', $limitnext=1, $excluded_categories='') { 228 user_error('next_post() is DEPRECATED; please use next_post_link() instead.', E_USER_NOTICE); 220 229 221 230 if ( empty($in_same_cat) || 'no' == $in_same_cat ) 222 231 $in_same_cat = false; … … 249 258 * @return bool 250 259 */ 251 260 function user_can_create_post($user_id, $blog_id = 1, $category_id = 'None') { 261 user_error('user_can_create_post() is DEPRECATED; use current_user_can() instead.', E_USER_NOTICE); 252 262 $author_data = get_userdata($user_id); 253 263 return ($author_data->user_level > 1); 254 264 } … … 266 276 * @return bool 267 277 */ 268 278 function user_can_create_draft($user_id, $blog_id = 1, $category_id = 'None') { 279 user_error('user_can_create_draft() is DEPRECATED; use current_user_can() instead.', E_USER_NOTICE); 269 280 $author_data = get_userdata($user_id); 270 281 return ($author_data->user_level >= 1); 271 282 } … … 283 294 * @return bool 284 295 */ 285 296 function user_can_edit_post($user_id, $post_id, $blog_id = 1) { 297 user_error('user_can_edit_post() is DEPRECATED; use current_user_can() instead.', E_USER_NOTICE); 286 298 $author_data = get_userdata($user_id); 287 299 $post = get_post($post_id); 288 300 $post_author_data = get_userdata($post->post_author); … … 309 321 * @return bool 310 322 */ 311 323 function user_can_delete_post($user_id, $post_id, $blog_id = 1) { 324 user_error('user_can_delete_post() is DEPRECATED; use current_user_can() instead.', E_USER_NOTICE); 312 325 // right now if one can edit, one can delete 313 326 return user_can_edit_post($user_id, $post_id, $blog_id); 314 327 } … … 326 339 * @return bool 327 340 */ 328 341 function user_can_set_post_date($user_id, $blog_id = 1, $category_id = 'None') { 342 user_error('user_can_set_post_date() is DEPRECATED; use current_user_can() instead.', E_USER_NOTICE); 329 343 $author_data = get_userdata($user_id); 330 344 return (($author_data->user_level > 4) && user_can_create_post($user_id, $blog_id, $category_id)); 331 345 } … … 344 358 * @return bool 345 359 */ 346 360 function user_can_edit_post_date($user_id, $post_id, $blog_id = 1) { 361 user_error('user_can_edit_post_date() is DEPRECATED; current_user_can() instead.', E_USER_NOTICE); 347 362 $author_data = get_userdata($user_id); 348 363 return (($author_data->user_level > 4) && user_can_edit_post($user_id, $post_id, $blog_id)); 349 364 } … … 362 377 * @return bool 363 378 */ 364 379 function user_can_edit_post_comments($user_id, $post_id, $blog_id = 1) { 380 user_error('user_can_edit_post_comments() is DEPRECATED; current_user_can() instead.', E_USER_NOTICE); 381 $author_data = get_userdata($user_id); 365 382 // right now if one can edit a post, one can edit comments made on it 366 383 return user_can_edit_post($user_id, $post_id, $blog_id); 367 384 } … … 380 397 * @return bool 381 398 */ 382 399 function user_can_delete_post_comments($user_id, $post_id, $blog_id = 1) { 400 user_error('user_can_delete_post_comments() is DEPRECATED; current_user_can() instead.', E_USER_NOTICE); 401 $author_data = get_userdata($user_id); 383 402 // right now if one can edit comments, one can delete comments 384 403 return user_can_edit_post_comments($user_id, $post_id, $blog_id); 385 404 } … … 396 415 * @return bool 397 416 */ 398 417 function user_can_edit_user($user_id, $other_user) { 418 user_error('user_can_edit_user() is DEPRECATED; current_user_can() instead.', E_USER_NOTICE); 419 $author_data = get_userdata($user_id); 399 420 $user = get_userdata($user_id); 400 421 $other = get_userdata($other_user); 401 422 if ( $user->user_level > $other->user_level || $user->user_level > 8 || $user->ID == $other->ID ) … … 427 448 function get_linksbyname($cat_name = "noname", $before = '', $after = '<br />', $between = " ", $show_images = true, $orderby = 'id', 428 449 $show_description = true, $show_rating = false, 429 450 $limit = -1, $show_updated = 0) { 451 user_error('get_linksbyname() is DEPRECATED; use get_links() instead.', E_USER_NOTICE); 452 $author_data = get_userdata($user_id); 430 453 $cat_id = -1; 431 454 $cat = get_term_by('name', $cat_name, 'link_category'); 432 455 if ( $cat ) … … 447 470 * @return bool|null 448 471 */ 449 472 function wp_get_linksbyname($category, $args = '') { 473 user_error('wp_get_linksbyname() is DEPRECATED; use wp_get_links() instead.', E_USER_NOTICE); 474 $author_data = get_userdata($user_id); 450 475 $cat = get_term_by('name', $category, 'link_category'); 451 476 if ( !$cat ) 452 477 return false; … … 478 503 * @return unknown 479 504 */ 480 505 function get_linkobjectsbyname($cat_name = "noname" , $orderby = 'name', $limit = -1) { 506 user_error('get_linkobjectsbyname() is DEPRECATED; use get_linkobjects() instead.', E_USER_NOTICE); 507 $author_data = get_userdata($user_id); 481 508 $cat_id = -1; 482 509 $cat = get_term_by('name', $cat_name, 'link_category'); 483 510 if ( $cat ) … … 529 556 * @return unknown 530 557 */ 531 558 function get_linkobjects($category = 0, $orderby = 'name', $limit = 0) { 559 user_error('get_linkobjectss() is DEPRECATED; use get_bookmarks() instead.', E_USER_NOTICE); 560 $author_data = get_userdata($user_id); 532 561 $links = get_bookmarks("category=$category&orderby=$orderby&limit=$limit"); 533 562 534 563 $links_array = array(); … … 560 589 */ 561 590 function get_linksbyname_withrating($cat_name = "noname", $before = '', $after = '<br />', $between = " ", 562 591 $show_images = true, $orderby = 'id', $show_description = true, $limit = -1, $show_updated = 0) { 592 user_error('get_linksbyname_withrating() is DEPRECATED; use get_bookmarks() instead.', E_USER_NOTICE); 563 593 564 594 get_linksbyname($cat_name, $before, $after, $between, $show_images, $orderby, $show_description, true, $limit, $show_updated); 565 595 } … … 586 616 */ 587 617 function get_links_withrating($category = -1, $before = '', $after = '<br />', $between = " ", $show_images = true, 588 618 $orderby = 'id', $show_description = true, $limit = -1, $show_updated = 0) { 619 user_error('get_links_withrating() is DEPRECATED; use get_bookmarks() instead.', E_USER_NOTICE); 589 620 590 621 get_links($category, $before, $after, $between, $show_images, $orderby, $show_description, true, $limit, $show_updated); 591 622 } … … 600 631 * @return int Only returns 0. 601 632 */ 602 633 function get_autotoggle($id = 0) { 634 user_error('get_autotoggle() is DEPRECATED.', E_USER_NOTICE); 603 635 return 0; 604 636 } 605 637 … … 631 663 function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_order = 'asc', $file = '', $list = true, $optiondates = 0, 632 664 $optioncount = 0, $hide_empty = 1, $use_desc_for_title = 1, $children=false, $child_of=0, $categories=0, 633 665 $recurse=0, $feed = '', $feed_image = '', $exclude = '', $hierarchical=false) { 666 user_error('list_cats() is DEPRECATED; use wp_list_categories() instead.', E_USER_NOTICE); 634 667 $query = compact('optionall', 'all', 'sort_column', 'sort_order', 'file', 'list', 'optiondates', 'optioncount', 'hide_empty', 'use_desc_for_title', 'children', 635 668 'child_of', 'categories', 'recurse', 'feed', 'feed_image', 'exclude', 'hierarchical'); 636 669 return wp_list_cats($query); … … 645 678 * @return unknown 646 679 */ 647 680 function wp_list_cats($args = '') { 681 user_error('wp_list_cats() is DEPRECATED; use wp_list_categories() instead.', E_USER_NOTICE); 648 682 $r = wp_parse_args( $args ); 649 683 650 684 // Map to new names. … … 683 717 * @return unknown 684 718 */ 685 719 function dropdown_cats($optionall = 1, $all = 'All', $orderby = 'ID', $order = 'asc', 720 user_error('dropdown_cats() is DEPRECATED; use wp_dropdown_categories() instead.', E_USER_NOTICE); 686 721 $show_last_update = 0, $show_count = 0, $hide_empty = 1, $optionnone = false, 687 722 $selected = 0, $exclude = 0) { 723 user_error('dropdown_cats() is DEPRECATED.', E_USER_NOTICE); 688 724 689 725 $show_option_all = ''; 690 726 if ( $optionall ) … … 707 743 * @see WP_Scripts 708 744 */ 709 745 function tinymce_include() { 746 user_error('tinymce_include() is DEPRECATED; see wp_print_script().', E_USER_NOTICE); 710 747 wp_print_script('wp_tiny_mce'); 711 748 } 712 749 … … 724 761 * @return unknown 725 762 */ 726 763 function list_authors($optioncount = false, $exclude_admin = true, $show_fullname = false, $hide_empty = true, $feed = '', $feed_image = '') { 764 user_error('list_authors() is DEPRECATED; use wp_list_authors() instead.', E_USER_NOTICE); 727 765 $args = compact('optioncount', 'exclude_admin', 'show_fullname', 'hide_empty', 'feed', 'feed_image'); 728 766 return wp_list_authors($args); 729 767 } … … 738 776 * @return unknown 739 777 */ 740 778 function wp_get_post_cats($blogid = '1', $post_ID = 0) { 779 user_error('wp_get_post_cats() is DEPRECATED; use wp_get_post_categories() instead.', E_USER_NOTICE); 741 780 return wp_get_post_categories($post_ID); 742 781 } 743 782 … … 754 793 * @return unknown 755 794 */ 756 795 function wp_set_post_cats($blogid = '1', $post_ID = 0, $post_categories = array()) { 796 user_error('wp_set_post_cats() is DEPRECATED; use wp_set_post_categories() instead.', E_USER_NOTICE); 757 797 return wp_set_post_categories($post_ID, $post_categories); 758 798 } 759 799 … … 771 811 * @return unknown 772 812 */ 773 813 function get_archives($type='', $limit='', $format='html', $before = '', $after = '', $show_post_count = false) { 814 user_error('get_archives() is DEPRECATED; use wp_get_archives() instead.', E_USER_NOTICE); 774 815 $args = compact('type', 'limit', 'format', 'before', 'after', 'show_post_count'); 775 816 return wp_get_archives($args); 776 817 } … … 788 829 * @return string|null 789 830 */ 790 831 function get_author_link($echo = false, $author_id, $author_nicename = '') { 832 user_error('get_author_link() is DEPRECATED; use get_author_posts_url() instead.', E_USER_NOTICE); 791 833 $link = get_author_posts_url($author_id, $author_nicename); 792 834 793 835 if ( $echo ) … … 813 855 */ 814 856 function link_pages($before='<br />', $after='<br />', $next_or_number='number', $nextpagelink='next page', $previouspagelink='previous page', 815 857 $pagelink='%', $more_file='') { 858 user_error('link_pages() is DEPRECATED; use wp_link_pages() instead.', E_USER_NOTICE); 816 859 $args = compact('before', 'after', 'next_or_number', 'nextpagelink', 'previouspagelink', 'pagelink', 'more_file'); 817 860 return wp_link_pages($args); 818 861 } … … 828 871 * @return string 829 872 */ 830 873 function get_settings($option) { 874 user_error('get_settings() is DEPRECATED; use get_option() instead.', E_USER_NOTICE); 831 875 return get_option($option); 832 876 } 833 877 … … 839 883 * @see the_permalink() 840 884 */ 841 885 function permalink_link() { 886 user_error('permalink_link() is DEPRECATED; use the_prermalink() instead.', E_USER_NOTICE); 842 887 the_permalink(); 843 888 } 844 889 … … 852 897 * @param string $file 853 898 */ 854 899 function permalink_single_rss($file = '') { 900 user_error('permalink_single_rss() is DEPRECATED; use the_permalink_rss() instead.', E_USER_NOTICE); 855 901 the_permalink_rss(); 856 902 } 857 903 … … 867 913 * @return null|string 868 914 */ 869 915 function wp_get_links($args = '') { 916 user_error('wp_get_links() is DEPRECATED; use get_bookmarks() instead.', E_USER_NOTICE); 870 917 if ( strpos( $args, '=' ) === false ) { 871 918 $cat_id = $args; 872 919 $args = add_query_arg( 'category', $cat_id, $args ); … … 913 960 */ 914 961 function get_links($category = -1, $before = '', $after = '<br />', $between = ' ', $show_images = true, $orderby = 'name', 915 962 $show_description = true, $show_rating = false, $limit = -1, $show_updated = 1, $echo = true) { 963 user_error('get_links() is DEPRECATED; use get_bookmarks() instead.', E_USER_NOTICE); 916 964 917 965 $order = 'ASC'; 918 966 if ( substr($orderby, 0, 1) == '_' ) { … … 1007 1055 * @param string $$deprecated Not Used 1008 1056 */ 1009 1057 function get_links_list($order = 'name', $deprecated = '') { 1058 user_error('get_links_list() is DEPRECATED; use get_categories() instead.', E_USER_NOTICE); 1010 1059 $order = strtolower($order); 1011 1060 1012 1061 // Handle link category sorting … … 1053 1102 * @param bool $count the number of links in the db 1054 1103 */ 1055 1104 function links_popup_script($text = 'Links', $width=400, $height=400, $file='links.all.php', $count = true) { 1105 user_error('links_popup_script() is DEPRECATED.', E_USER_NOTICE); 1056 1106 if ( $count ) 1057 1107 $counts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->links"); 1058 1108 … … 1075 1125 * @return unknown 1076 1126 */ 1077 1127 function get_linkrating($link) { 1128 user_error('get_linkrating() is DEPRECATED.', E_USER_NOTICE); 1078 1129 return sanitize_bookmark_field('link_rating', $link->link_rating, $link->link_id, 'display'); 1079 1130 } 1080 1131 … … 1089 1140 * @return string 1090 1141 */ 1091 1142 function get_linkcatname($id = 0) { 1143 user_error('get_linkcatname() is DEPRECATED.', E_USER_NOTICE); 1092 1144 $id = (int) $id; 1093 1145 1094 1146 if ( empty($id) ) … … 1116 1168 * @param string $deprecated Not used 1117 1169 */ 1118 1170 function comments_rss_link($link_text = 'Comments RSS', $deprecated = '') { 1171 user_error('comment_rss_link() is DEPRECATED; use post_comments_feed_link() instead.', E_USER_NOTICE); 1119 1172 post_comments_feed_link($link_text); 1120 1173 } 1121 1174 … … 1132 1185 * @return string|null 1133 1186 */ 1134 1187 function get_category_rss_link($echo = false, $cat_ID = 1, $deprecated = '') { 1188 user_error('get_category_rss_link() is DEPRECATED; use get_category_feed_link() instead.', E_USER_NOTICE); 1135 1189 $link = get_category_feed_link($cat_ID, $feed = 'rss2'); 1136 1190 1137 1191 if ( $echo ) … … 1152 1206 * @return string|null 1153 1207 */ 1154 1208 function get_author_rss_link($echo = false, $author_id = 1, $deprecated = '') { 1209 user_error('get_author_rss_link() is DEPRECATED; use get_author_feed_link() instead.', E_USER_NOTICE); 1155 1210 $link = get_author_feed_link($author_id); 1156 1211 if ( $echo ) 1157 1212 echo $link;