Ticket #4361: deprecated.api.#4361.2.2.patch
| File deprecated.api.#4361.2.2.patch, 21.7 KB (added by , 18 years ago) |
|---|
-
wp-includes/author-template.php
24 24 /** 25 25 * the_author() - Echo the name of the author of the current post in the Loop. 26 26 * 27 * The behavior of this function is based off of old functionality predating get_the_author(). 28 * This function is not deprecated, but is designed to echo the value from get_the_author() 29 * and as an result of any old theme that might still use the old behavior will also 30 * pass the value from get_the_author(). 31 * 32 * The normal, expected behavior of this function is to echo the author and not return it. 33 * However, backwards compatiability has to be maintained. 34 * 27 35 * @since 0.71 28 36 * @see get_the_author() 29 * @deprecated Use get_the_author()30 37 * 31 38 * @param string $deprecated Deprecated. 32 39 * @param string $deprecated_echo Echo the string or return it. Deprecated, use get_the_author(). -
wp-includes/bookmark.php
37 37 38 38 // Deprecate 39 39 function get_link($bookmark_id, $output = OBJECT) { 40 wp_mark_deprecated(__FUNCTION__, 'get_bookmark()'); 40 41 return get_bookmark($bookmark_id, $output); 41 42 } 42 43 -
wp-includes/deprecated.php
86 86 * @return array 87 87 */ 88 88 function get_postdata($postid) { 89 wp_mark_deprecated(__FUNCTION__, 'get_post()'); 90 89 91 $post = &get_post($postid); 90 92 91 93 $postdata = array ( … … 118 120 function start_wp() { 119 121 global $wp_query, $post; 120 122 123 wp_mark_deprecated(__FUNCTION__, __('new WordPress Loop') ); 124 121 125 // Since the old style loop is being used, advance the query iterator here. 122 126 $wp_query->next_post(); 123 127 … … 135 139 * @return null|int 136 140 */ 137 141 function the_category_ID($echo = true) { 142 wp_mark_deprecated(__FUNCTION__, 'get_the_category()'); 143 138 144 // Grab the first cat in the list. 139 145 $categories = get_the_category(); 140 146 $cat = $categories[0]->term_id; … … 157 163 */ 158 164 function the_category_head($before='', $after='') { 159 165 global $currentcat, $previouscat; 166 167 wp_mark_deprecated(__FUNCTION__, 'get_the_category_by_ID()'); 168 160 169 // Grab the first cat in the list. 161 170 $categories = get_the_category(); 162 171 $currentcat = $categories[0]->category_id; … … 184 193 */ 185 194 function previous_post($format='%', $previous='previous post: ', $title='yes', $in_same_cat='no', $limitprev=1, $excluded_categories='') { 186 195 196 wp_mark_deprecated(__FUNCTION__, 'previous_post_link()'); 197 187 198 if ( empty($in_same_cat) || 'no' == $in_same_cat ) 188 199 $in_same_cat = false; 189 200 else … … 217 228 * @param string $excluded_categories 218 229 */ 219 230 function next_post($format='%', $next='next post: ', $title='yes', $in_same_cat='no', $limitnext=1, $excluded_categories='') { 231 wp_mark_deprecated(__FUNCTION__, 'next_post_link()'); 220 232 221 233 if ( empty($in_same_cat) || 'no' == $in_same_cat ) 222 234 $in_same_cat = false; … … 249 261 * @return bool 250 262 */ 251 263 function user_can_create_post($user_id, $blog_id = 1, $category_id = 'None') { 264 wp_mark_deprecated(__FUNCTION__, 'current_user_can()'); 265 252 266 $author_data = get_userdata($user_id); 253 267 return ($author_data->user_level > 1); 254 268 } … … 266 280 * @return bool 267 281 */ 268 282 function user_can_create_draft($user_id, $blog_id = 1, $category_id = 'None') { 283 wp_mark_deprecated(__FUNCTION__, 'current_user_can()'); 284 269 285 $author_data = get_userdata($user_id); 270 286 return ($author_data->user_level >= 1); 271 287 } … … 283 299 * @return bool 284 300 */ 285 301 function user_can_edit_post($user_id, $post_id, $blog_id = 1) { 302 wp_mark_deprecated(__FUNCTION__, 'current_user_can()'); 303 286 304 $author_data = get_userdata($user_id); 287 305 $post = get_post($post_id); 288 306 $post_author_data = get_userdata($post->post_author); … … 309 327 * @return bool 310 328 */ 311 329 function user_can_delete_post($user_id, $post_id, $blog_id = 1) { 330 wp_mark_deprecated(__FUNCTION__, 'current_user_can()'); 331 312 332 // right now if one can edit, one can delete 313 333 return user_can_edit_post($user_id, $post_id, $blog_id); 314 334 } … … 326 346 * @return bool 327 347 */ 328 348 function user_can_set_post_date($user_id, $blog_id = 1, $category_id = 'None') { 349 wp_mark_deprecated(__FUNCTION__, 'current_user_can()'); 350 329 351 $author_data = get_userdata($user_id); 330 352 return (($author_data->user_level > 4) && user_can_create_post($user_id, $blog_id, $category_id)); 331 353 } … … 344 366 * @return bool 345 367 */ 346 368 function user_can_edit_post_date($user_id, $post_id, $blog_id = 1) { 369 wp_mark_deprecated(__FUNCTION__, 'current_user_can()'); 370 347 371 $author_data = get_userdata($user_id); 348 372 return (($author_data->user_level > 4) && user_can_edit_post($user_id, $post_id, $blog_id)); 349 373 } … … 362 386 * @return bool 363 387 */ 364 388 function user_can_edit_post_comments($user_id, $post_id, $blog_id = 1) { 389 wp_mark_deprecated(__FUNCTION__, 'current_user_can()'); 390 365 391 // right now if one can edit a post, one can edit comments made on it 366 392 return user_can_edit_post($user_id, $post_id, $blog_id); 367 393 } … … 380 406 * @return bool 381 407 */ 382 408 function user_can_delete_post_comments($user_id, $post_id, $blog_id = 1) { 409 wp_mark_deprecated(__FUNCTION__, 'current_user_can()'); 410 383 411 // right now if one can edit comments, one can delete comments 384 412 return user_can_edit_post_comments($user_id, $post_id, $blog_id); 385 413 } … … 396 424 * @return bool 397 425 */ 398 426 function user_can_edit_user($user_id, $other_user) { 427 wp_mark_deprecated(__FUNCTION__, 'current_user_can()'); 428 399 429 $user = get_userdata($user_id); 400 430 $other = get_userdata($other_user); 401 431 if ( $user->user_level > $other->user_level || $user->user_level > 8 || $user->ID == $other->ID ) … … 427 457 function get_linksbyname($cat_name = "noname", $before = '', $after = '<br />', $between = " ", $show_images = true, $orderby = 'id', 428 458 $show_description = true, $show_rating = false, 429 459 $limit = -1, $show_updated = 0) { 460 wp_mark_deprecated(__FUNCTION__, 'get_links()'); 461 430 462 $cat_id = -1; 431 463 $cat = get_term_by('name', $cat_name, 'link_category'); 432 464 if ( $cat ) … … 447 479 * @return bool|null 448 480 */ 449 481 function wp_get_linksbyname($category, $args = '') { 482 wp_mark_deprecated(__FUNCTION__, 'wp_get_links()'); 483 450 484 $cat = get_term_by('name', $category, 'link_category'); 451 485 if ( !$cat ) 452 486 return false; … … 478 512 * @return unknown 479 513 */ 480 514 function get_linkobjectsbyname($cat_name = "noname" , $orderby = 'name', $limit = -1) { 515 wp_mark_deprecated(__FUNCTION__, 'get_linkobjects()'); 516 481 517 $cat_id = -1; 482 518 $cat = get_term_by('name', $cat_name, 'link_category'); 483 519 if ( $cat ) … … 529 565 * @return unknown 530 566 */ 531 567 function get_linkobjects($category = 0, $orderby = 'name', $limit = 0) { 568 wp_mark_deprecated(__FUNCTION__, 'get_bookmarks()'); 569 532 570 $links = get_bookmarks("category=$category&orderby=$orderby&limit=$limit"); 533 571 534 572 $links_array = array(); … … 560 598 */ 561 599 function get_linksbyname_withrating($cat_name = "noname", $before = '', $after = '<br />', $between = " ", 562 600 $show_images = true, $orderby = 'id', $show_description = true, $limit = -1, $show_updated = 0) { 601 wp_mark_deprecated(__FUNCTION__, 'get_bookmarks()'); 563 602 564 603 get_linksbyname($cat_name, $before, $after, $between, $show_images, $orderby, $show_description, true, $limit, $show_updated); 565 604 } … … 586 625 */ 587 626 function get_links_withrating($category = -1, $before = '', $after = '<br />', $between = " ", $show_images = true, 588 627 $orderby = 'id', $show_description = true, $limit = -1, $show_updated = 0) { 628 wp_mark_deprecated(__FUNCTION__, 'get_bookmarks()'); 589 629 590 630 get_links($category, $before, $after, $between, $show_images, $orderby, $show_description, true, $limit, $show_updated); 591 631 } … … 600 640 * @return int Only returns 0. 601 641 */ 602 642 function get_autotoggle($id = 0) { 643 wp_mark_deprecated( __FUNCTION__ ); 603 644 return 0; 604 645 } 605 646 … … 631 672 function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_order = 'asc', $file = '', $list = true, $optiondates = 0, 632 673 $optioncount = 0, $hide_empty = 1, $use_desc_for_title = 1, $children=false, $child_of=0, $categories=0, 633 674 $recurse=0, $feed = '', $feed_image = '', $exclude = '', $hierarchical=false) { 675 wp_mark_deprecated(__FUNCTION__, 'wp_list_categories()'); 676 634 677 $query = compact('optionall', 'all', 'sort_column', 'sort_order', 'file', 'list', 'optiondates', 'optioncount', 'hide_empty', 'use_desc_for_title', 'children', 635 678 'child_of', 'categories', 'recurse', 'feed', 'feed_image', 'exclude', 'hierarchical'); 636 679 return wp_list_cats($query); … … 645 688 * @return unknown 646 689 */ 647 690 function wp_list_cats($args = '') { 691 wp_mark_deprecated(__FUNCTION__, 'wp_list_categories()'); 692 648 693 $r = wp_parse_args( $args ); 649 694 650 695 // Map to new names. … … 685 730 function dropdown_cats($optionall = 1, $all = 'All', $orderby = 'ID', $order = 'asc', 686 731 $show_last_update = 0, $show_count = 0, $hide_empty = 1, $optionnone = false, 687 732 $selected = 0, $exclude = 0) { 733 wp_mark_deprecated(__FUNCTION__, 'wp_dropdown_categories()'); 688 734 689 735 $show_option_all = ''; 690 736 if ( $optionall ) … … 707 753 * @see WP_Scripts 708 754 */ 709 755 function tinymce_include() { 756 wp_mark_deprecated(__FUNCTION__, 'wp_print_scripts()/WP_Scripts'); 757 710 758 wp_print_script('wp_tiny_mce'); 711 759 } 712 760 … … 724 772 * @return unknown 725 773 */ 726 774 function list_authors($optioncount = false, $exclude_admin = true, $show_fullname = false, $hide_empty = true, $feed = '', $feed_image = '') { 775 wp_mark_deprecated(__FUNCTION__, 'wp_list_authors()'); 776 727 777 $args = compact('optioncount', 'exclude_admin', 'show_fullname', 'hide_empty', 'feed', 'feed_image'); 728 778 return wp_list_authors($args); 729 779 } … … 738 788 * @return unknown 739 789 */ 740 790 function wp_get_post_cats($blogid = '1', $post_ID = 0) { 791 wp_mark_deprecated(__FUNCTION__, 'wp_get_post_categories()'); 741 792 return wp_get_post_categories($post_ID); 742 793 } 743 794 … … 754 805 * @return unknown 755 806 */ 756 807 function wp_set_post_cats($blogid = '1', $post_ID = 0, $post_categories = array()) { 808 wp_mark_deprecated(__FUNCTION__, 'wp_set_post_categories()'); 757 809 return wp_set_post_categories($post_ID, $post_categories); 758 810 } 759 811 … … 771 823 * @return unknown 772 824 */ 773 825 function get_archives($type='', $limit='', $format='html', $before = '', $after = '', $show_post_count = false) { 826 wp_mark_deprecated(__FUNCTION__, 'wp_get_archives()'); 774 827 $args = compact('type', 'limit', 'format', 'before', 'after', 'show_post_count'); 775 828 return wp_get_archives($args); 776 829 } … … 788 841 * @return string|null 789 842 */ 790 843 function get_author_link($echo = false, $author_id, $author_nicename = '') { 844 wp_mark_deprecated(__FUNCTION__, 'get_author_posts_url()'); 845 791 846 $link = get_author_posts_url($author_id, $author_nicename); 792 847 793 848 if ( $echo ) … … 813 868 */ 814 869 function link_pages($before='<br />', $after='<br />', $next_or_number='number', $nextpagelink='next page', $previouspagelink='previous page', 815 870 $pagelink='%', $more_file='') { 871 wp_mark_deprecated(__FUNCTION__, 'wp_link_pages()'); 872 816 873 $args = compact('before', 'after', 'next_or_number', 'nextpagelink', 'previouspagelink', 'pagelink', 'more_file'); 817 874 return wp_link_pages($args); 818 875 } … … 828 885 * @return string 829 886 */ 830 887 function get_settings($option) { 888 wp_mark_deprecated(__FUNCTION__, 'get_option()'); 889 831 890 return get_option($option); 832 891 } 833 892 … … 839 898 * @see the_permalink() 840 899 */ 841 900 function permalink_link() { 901 wp_mark_deprecated(__FUNCTION__, 'the_permalink()'); 842 902 the_permalink(); 843 903 } 844 904 … … 852 912 * @param string $file 853 913 */ 854 914 function permalink_single_rss($file = '') { 915 wp_mark_deprecated(__FUNCTION__, 'the_permalink_rss()'); 855 916 the_permalink_rss(); 856 917 } 857 918 … … 867 928 * @return null|string 868 929 */ 869 930 function wp_get_links($args = '') { 931 wp_mark_deprecated(__FUNCTION__, 'get_bookmarks()'); 932 870 933 if ( strpos( $args, '=' ) === false ) { 871 934 $cat_id = $args; 872 935 $args = add_query_arg( 'category', $cat_id, $args ); … … 913 976 */ 914 977 function get_links($category = -1, $before = '', $after = '<br />', $between = ' ', $show_images = true, $orderby = 'name', 915 978 $show_description = true, $show_rating = false, $limit = -1, $show_updated = 1, $echo = true) { 979 wp_mark_deprecated(__FUNCTION__, 'get_bookmarks()'); 916 980 917 981 $order = 'ASC'; 918 982 if ( substr($orderby, 0, 1) == '_' ) { … … 1007 1071 * @param string $$deprecated Not Used 1008 1072 */ 1009 1073 function get_links_list($order = 'name', $deprecated = '') { 1074 wp_mark_deprecated(__FUNCTION__, 'get_categories()'); 1075 1010 1076 $order = strtolower($order); 1011 1077 1012 1078 // Handle link category sorting … … 1053 1119 * @param bool $count the number of links in the db 1054 1120 */ 1055 1121 function links_popup_script($text = 'Links', $width=400, $height=400, $file='links.all.php', $count = true) { 1122 wp_mark_deprecated( __FUNCTION__ ); 1123 1056 1124 if ( $count ) 1057 1125 $counts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->links"); 1058 1126 … … 1075 1143 * @return unknown 1076 1144 */ 1077 1145 function get_linkrating($link) { 1146 wp_mark_deprecated(__FUNCTION__, 'sanitize_bookmark_field()'); 1078 1147 return sanitize_bookmark_field('link_rating', $link->link_rating, $link->link_id, 'display'); 1079 1148 } 1080 1149 … … 1089 1158 * @return string 1090 1159 */ 1091 1160 function get_linkcatname($id = 0) { 1161 wp_mark_deprecated(__FUNCTION__, 'get_category()'); 1162 1092 1163 $id = (int) $id; 1093 1164 1094 1165 if ( empty($id) ) … … 1116 1187 * @param string $deprecated Not used 1117 1188 */ 1118 1189 function comments_rss_link($link_text = 'Comments RSS', $deprecated = '') { 1190 wp_mark_deprecated(__FUNCTION__, 'post_comments_feed_link()'); 1119 1191 post_comments_feed_link($link_text); 1120 1192 } 1121 1193 … … 1132 1204 * @return string|null 1133 1205 */ 1134 1206 function get_category_rss_link($echo = false, $cat_ID = 1, $deprecated = '') { 1207 wp_mark_deprecated(__FUNCTION__, 'get_category_feed_link()'); 1208 1135 1209 $link = get_category_feed_link($cat_ID, $feed = 'rss2'); 1136 1210 1137 1211 if ( $echo ) … … 1152 1226 * @return string|null 1153 1227 */ 1154 1228 function get_author_rss_link($echo = false, $author_id = 1, $deprecated = '') { 1229 wp_mark_deprecated(__FUNCTION__, 'get_author_feed_link()'); 1230 1155 1231 $link = get_author_feed_link($author_id); 1156 1232 if ( $echo ) 1157 1233 echo $link; -
wp-includes/feed.php
98 98 } 99 99 100 100 function comments_rss($deprecated = '') { 101 wp_mark_deprecated(__FUNCTION__, 'get_post_comments_feed_link()'); 101 102 return get_post_comments_feed_link(); 102 103 } 103 104 … … 178 179 } 179 180 180 181 /** 181 * prep_atom_text_construct() - determine if given string of data is 182 * type text, html, or xhtml, per RFC 4287 section 3.1. 182 * prep_atom_text_construct() - Determine the type of a given string of data 183 183 * 184 * Tell whether the type is text, html, or xhtml, per RFC 4287 section 3.1. 185 * 184 186 * In the case of WordPress, text is defined as containing no markup, 185 187 * xhtml is defined as "well formed", and html as tag soup (i.e., the rest). 186 188 * 187 189 * Container div tags are added to xhtml values, per section 3.1.1.3. 188 190 * 191 * @link http://www.atomenabled.org/developers/syndication/atom-format-spec.php#rfc.section.3.1 192 * 189 193 * @package WordPress 190 194 * @subpackage Feed 191 195 * @since 2.4 192 196 * 193 197 * @param string $data input string 194 198 * @return array $result array(type, value) 195 * @link http://www.atomenabled.org/developers/syndication/atom-format-spec.php#rfc.section.3.1196 199 */ 197 200 function prep_atom_text_construct($data) { 198 201 if (strpos($data, '<') === false && strpos($data, '&') === false) { … … 205 208 xml_parser_free($parser); 206 209 207 210 if (!$code) { 208 if (strpos($data, '<') === false) {209 return array('text', $data);210 } else {211 $data = "<div xmlns='http://www.w3.org/1999/xhtml'>$data</div>";212 return array('xhtml', $data);213 }211 if (strpos($data, '<') === false) { 212 return array('text', $data); 213 } else { 214 $data = "<div xmlns='http://www.w3.org/1999/xhtml'>$data</div>"; 215 return array('xhtml', $data); 216 } 214 217 } 215 218 216 219 if (strpos($data, ']]>') == false) { -
wp-includes/functions.php
485 485 fclose( $fp ); 486 486 } 487 487 488 /** 489 * wp_mark_deprecated() - Marks a function as deprecated and informs when it has been used. 490 * 491 * There is a hook that will be called that can be used to get the backtrace up to what file 492 * and function called the deprecated function. That behavior is not defined here, because of 493 * preformance. 494 * 495 * The current behavior is to trigger an user error if WP_DEBUG is defined and is true. In later 496 * versions, this behavior could be changed to a more reasonable and less drastic approach of 497 * letting the user know that deprecated functions were used. However, normal usage will NOT 498 * trigger these errors, so only those that purposefully enable WP_DEBUG will see them. 499 * 500 * This function could be used in every place, including hooks that allows for calling the function. 501 * The common use will be for functions but can be for hooks, parameters, etc that is deprecated. 502 * 503 * @link http://trac.wordpress.org/ticket/4361 History of this function 504 * 505 * @package WordPress 506 * @package Debug 507 * @since 2.4 508 * 509 * @uses do_action() Calls 'deprecated_function_run' and passes the function name and what to use instead. 510 * @uses apply_filters() Calls 'deprecated_function_trigger_error' and expects boolean value of true to do trigger or false to not trigger error. 511 * 512 * @param string $used The function that was called 513 * @param string $seeinstead Optional. The function that should have been called 514 */ 515 function wp_mark_deprecated($used, $seeinstead=null) { 516 // Allow plugin to overwrite the error => forward thinking 517 $outputError = true; 518 519 // We can't know if another function will trigger this function before plugins.php is included. 520 // Test anyway. Small performance lost is okay since this function should not be called at all. 521 if( function_exists('do_action') ) { 522 do_action('deprecated_function_run', $function, $seeinstead); 523 524 // Allow plugin to filter the output error trigger 525 $outputError = apply_filters( 'deprecated_function_trigger_error', $outputError ); 526 } 527 528 if( $outputError && defined('WP_DEBUG') && true === WP_DEBUG ) { 529 if( !is_null($seeinstead) ) 530 trigger_error( printf( __("%s is <strong>deprecated</strong>! Use %s instead."), $used, $seeinstead ) ); 531 else 532 trigger_error( printf( __("%s is <strong>deprecated</strong with no alternative available."), $used ) ); 533 } 534 } 535 488 536 function do_enclose( $content, $post_ID ) { 489 537 global $wpdb; 490 538 include_once( ABSPATH . WPINC . '/class-IXR.php' ); -
wp-includes/pluggable.php
788 788 // Deprecated. Use wp_set_auth_cookie() 789 789 if ( !function_exists('wp_setcookie') ) : 790 790 function wp_setcookie($username, $password = '', $already_md5 = false, $home = '', $siteurl = '', $remember = false) { 791 wp_mark_deprecated( __FUNCTION__ ); 791 792 $user = get_userdatabylogin($username); 792 793 wp_set_auth_cookie($user->ID, $remember); 793 794 } … … 796 797 // Deprecated. Use wp_clear_auth_cookie() 797 798 if ( !function_exists('wp_clearcookie') ) : 798 799 function wp_clearcookie() { 800 wp_mark_deprecated( __FUNCTION__ ); 799 801 wp_clear_auth_cookie(); 800 802 } 801 803 endif; … … 803 805 // Deprecated. No alternative. 804 806 if ( !function_exists('wp_get_cookie_login') ): 805 807 function wp_get_cookie_login() { 808 wp_mark_deprecated( __FUNCTION__ ); 806 809 return false; 807 810 } 808 811 endif; -
wp-includes/registration-functions.php
1 1 <?php 2 2 // Deprecated. Use registration.php. 3 wp_mark_deprecated( basename(__FILE__), 'registration.php' ); 3 4 require_once(ABSPATH . WPINC . '/registration.php'); 4 5 ?> -
wp-includes/registration.php
177 177 178 178 /** 179 179 * A simpler way of inserting an user into the database. 180 * See also:wp_insert_user().180 * @see wp_insert_user(). 181 181 * @global object $wpdb WordPress database layer. 182 182 * @param string $username The user's username. 183 183 * @param string $password The user's password. … … 201 201 * @param string $password The user's password. 202 202 * @param string $email The user's email (optional). 203 203 * @return int The new user's ID. 204 * @deprecated 204 * @deprecated Use wp_create_user() 205 * @see wp_create_user() 205 206 */ 206 207 function create_user($username, $password, $email) { 208 wp_mark_deprecated( __FUNCTION__, 'wp_create_user()' ); 207 209 return wp_create_user($username, $password, $email); 208 210 } 209 211 -
wp-includes/rss-functions.php
1 1 <?php 2 2 // Deprecated. Use rss.php instead. 3 4 wp_mark_deprecated( basename(__FILE__), 'rss.php' ); 3 5 require_once (ABSPATH . WPINC . '/rss.php'); 4 6 ?> -
wp-settings.php
156 156 if (defined('WP_DEBUG') and WP_DEBUG == true) { 157 157 error_reporting(E_ALL); 158 158 } else { 159 error_reporting(E_ALL ^ E_NOTICE );159 error_reporting(E_ALL ^ E_NOTICE ^ E_USER_NOTICE); 160 160 } 161 161 162 162 // For an advanced caching plugin to use, static because you would only want one