Ticket #4361: deprecated-trunk-6429.diff

File deprecated-trunk-6429.diff, 14.9 KB (added by docwhat, 4 years ago)

Patch against trunk at revision 6429

  • wp-includes/deprecated.php

     
    77 
    88/* 
    99 * 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); 
    1013 */ 
    1114 
    1215/** 
     
    8689 * @return array 
    8790 */ 
    8891function get_postdata($postid) { 
     92        user_error('get_postdata() is DEPRECATED; use get_post() instead.', E_USER_NOTICE); 
    8993        $post = &get_post($postid); 
    9094 
    9195        $postdata = array ( 
     
    116120 * @deprecated Since 1.5 - {@link http://codex.wordpress.org/The_Loop Use new WordPress Loop} 
    117121 */ 
    118122function start_wp() { 
     123        user_error('start_wp() is DEPRECATED; please use the new post loop instead.', E_USER_NOTICE); 
    119124        global $wp_query, $post; 
    120125 
    121126        // Since the old style loop is being used, advance the query iterator here. 
     
    135140 * @return null|int 
    136141 */ 
    137142function the_category_ID($echo = true) { 
     143        user_error('the_category_ID() is DEPRECATED.', E_USER_NOTICE); 
    138144        // Grab the first cat in the list. 
    139145        $categories = get_the_category(); 
    140146        $cat = $categories[0]->term_id; 
     
    156162 * @param string $after 
    157163 */ 
    158164function the_category_head($before='', $after='') { 
     165        user_error('the_category_head() s DEPRECATED.', E_USER_NOTICE); 
    159166        global $currentcat, $previouscat; 
    160167        // Grab the first cat in the list. 
    161168        $categories = get_the_category(); 
     
    183190 * @param string $excluded_categories 
    184191 */ 
    185192function 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); 
    186194 
    187195        if ( empty($in_same_cat) || 'no' == $in_same_cat ) 
    188196                $in_same_cat = false; 
     
    217225 * @param string $excluded_categories 
    218226 */ 
    219227function 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); 
    220229 
    221230        if ( empty($in_same_cat) || 'no' == $in_same_cat ) 
    222231                $in_same_cat = false; 
     
    249258 * @return bool 
    250259 */ 
    251260function 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); 
    252262        $author_data = get_userdata($user_id); 
    253263        return ($author_data->user_level > 1); 
    254264} 
     
    266276 * @return bool 
    267277 */ 
    268278function 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); 
    269280        $author_data = get_userdata($user_id); 
    270281        return ($author_data->user_level >= 1); 
    271282} 
     
    283294 * @return bool 
    284295 */ 
    285296function 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); 
    286298        $author_data = get_userdata($user_id); 
    287299        $post = get_post($post_id); 
    288300        $post_author_data = get_userdata($post->post_author); 
     
    309321 * @return bool 
    310322 */ 
    311323function 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); 
    312325        // right now if one can edit, one can delete 
    313326        return user_can_edit_post($user_id, $post_id, $blog_id); 
    314327} 
     
    326339 * @return bool 
    327340 */ 
    328341function 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); 
    329343        $author_data = get_userdata($user_id); 
    330344        return (($author_data->user_level > 4) && user_can_create_post($user_id, $blog_id, $category_id)); 
    331345} 
     
    344358 * @return bool 
    345359 */ 
    346360function 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); 
    347362        $author_data = get_userdata($user_id); 
    348363        return (($author_data->user_level > 4) && user_can_edit_post($user_id, $post_id, $blog_id)); 
    349364} 
     
    362377 * @return bool 
    363378 */ 
    364379function 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); 
    365382        // right now if one can edit a post, one can edit comments made on it 
    366383        return user_can_edit_post($user_id, $post_id, $blog_id); 
    367384} 
     
    380397 * @return bool 
    381398 */ 
    382399function 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); 
    383402        // right now if one can edit comments, one can delete comments 
    384403        return user_can_edit_post_comments($user_id, $post_id, $blog_id); 
    385404} 
     
    396415 * @return bool 
    397416 */ 
    398417function 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); 
    399420        $user  = get_userdata($user_id); 
    400421        $other = get_userdata($other_user); 
    401422        if ( $user->user_level > $other->user_level || $user->user_level > 8 || $user->ID == $other->ID ) 
     
    427448function get_linksbyname($cat_name = "noname", $before = '', $after = '<br />', $between = " ", $show_images = true, $orderby = 'id', 
    428449                                                 $show_description = true, $show_rating = false, 
    429450                                                 $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); 
    430453        $cat_id = -1; 
    431454        $cat = get_term_by('name', $cat_name, 'link_category'); 
    432455        if ( $cat ) 
     
    447470 * @return bool|null 
    448471 */ 
    449472function 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); 
    450475        $cat = get_term_by('name', $category, 'link_category'); 
    451476        if ( !$cat ) 
    452477                return false; 
     
    478503 * @return unknown 
    479504 */ 
    480505function 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); 
    481508        $cat_id = -1; 
    482509        $cat = get_term_by('name', $cat_name, 'link_category'); 
    483510        if ( $cat ) 
     
    529556 * @return unknown 
    530557 */ 
    531558function 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); 
    532561        $links = get_bookmarks("category=$category&orderby=$orderby&limit=$limit"); 
    533562 
    534563        $links_array = array(); 
     
    560589 */ 
    561590function get_linksbyname_withrating($cat_name = "noname", $before = '', $after = '<br />', $between = " ", 
    562591                                                                        $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); 
    563593 
    564594        get_linksbyname($cat_name, $before, $after, $between, $show_images, $orderby, $show_description, true, $limit, $show_updated); 
    565595} 
     
    586616 */ 
    587617function get_links_withrating($category = -1, $before = '', $after = '<br />', $between = " ", $show_images = true, 
    588618                                                          $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); 
    589620 
    590621        get_links($category, $before, $after, $between, $show_images, $orderby, $show_description, true, $limit, $show_updated); 
    591622} 
     
    600631 * @return int Only returns 0. 
    601632 */ 
    602633function get_autotoggle($id = 0) { 
     634        user_error('get_autotoggle() is DEPRECATED.', E_USER_NOTICE); 
    603635        return 0; 
    604636} 
    605637 
     
    631663function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_order = 'asc', $file = '', $list = true, $optiondates = 0,  
    632664                                   $optioncount = 0, $hide_empty = 1, $use_desc_for_title = 1, $children=false, $child_of=0, $categories=0,  
    633665                                   $recurse=0, $feed = '', $feed_image = '', $exclude = '', $hierarchical=false) { 
     666        user_error('list_cats() is DEPRECATED; use wp_list_categories() instead.', E_USER_NOTICE); 
    634667        $query = compact('optionall', 'all', 'sort_column', 'sort_order', 'file', 'list', 'optiondates', 'optioncount', 'hide_empty', 'use_desc_for_title', 'children', 
    635668                'child_of', 'categories', 'recurse', 'feed', 'feed_image', 'exclude', 'hierarchical'); 
    636669        return wp_list_cats($query); 
     
    645678 * @return unknown 
    646679 */ 
    647680function wp_list_cats($args = '') { 
     681        user_error('wp_list_cats() is DEPRECATED; use wp_list_categories() instead.', E_USER_NOTICE); 
    648682        $r = wp_parse_args( $args ); 
    649683 
    650684        // Map to new names. 
     
    683717 * @return unknown 
    684718 */ 
    685719function 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); 
    686721                $show_last_update = 0, $show_count = 0, $hide_empty = 1, $optionnone = false, 
    687722                $selected = 0, $exclude = 0) { 
     723        user_error('dropdown_cats() is DEPRECATED.', E_USER_NOTICE); 
    688724 
    689725        $show_option_all = ''; 
    690726        if ( $optionall ) 
     
    707743 * @see WP_Scripts 
    708744 */ 
    709745function tinymce_include() { 
     746        user_error('tinymce_include() is DEPRECATED; see wp_print_script().', E_USER_NOTICE); 
    710747        wp_print_script('wp_tiny_mce'); 
    711748} 
    712749 
     
    724761 * @return unknown 
    725762 */ 
    726763function 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); 
    727765        $args = compact('optioncount', 'exclude_admin', 'show_fullname', 'hide_empty', 'feed', 'feed_image'); 
    728766        return wp_list_authors($args); 
    729767} 
     
    738776 * @return unknown 
    739777 */ 
    740778function 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); 
    741780        return wp_get_post_categories($post_ID); 
    742781} 
    743782 
     
    754793 * @return unknown 
    755794 */ 
    756795function 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); 
    757797        return wp_set_post_categories($post_ID, $post_categories); 
    758798} 
    759799 
     
    771811 * @return unknown 
    772812 */ 
    773813function 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); 
    774815        $args = compact('type', 'limit', 'format', 'before', 'after', 'show_post_count'); 
    775816        return wp_get_archives($args); 
    776817} 
     
    788829 * @return string|null 
    789830 */ 
    790831function 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); 
    791833        $link = get_author_posts_url($author_id, $author_nicename); 
    792834 
    793835        if ( $echo ) 
     
    813855 */ 
    814856function link_pages($before='<br />', $after='<br />', $next_or_number='number', $nextpagelink='next page', $previouspagelink='previous page',  
    815857                                        $pagelink='%', $more_file='') { 
     858        user_error('link_pages() is DEPRECATED; use wp_link_pages() instead.', E_USER_NOTICE); 
    816859        $args = compact('before', 'after', 'next_or_number', 'nextpagelink', 'previouspagelink', 'pagelink', 'more_file'); 
    817860        return wp_link_pages($args); 
    818861} 
     
    828871 * @return string 
    829872 */ 
    830873function get_settings($option) { 
     874        user_error('get_settings() is DEPRECATED; use get_option() instead.', E_USER_NOTICE); 
    831875        return get_option($option); 
    832876} 
    833877 
     
    839883 * @see the_permalink() 
    840884 */ 
    841885function permalink_link() { 
     886        user_error('permalink_link() is DEPRECATED; use the_prermalink() instead.', E_USER_NOTICE); 
    842887        the_permalink(); 
    843888} 
    844889 
     
    852897 * @param string $file 
    853898 */ 
    854899function permalink_single_rss($file = '') { 
     900        user_error('permalink_single_rss() is DEPRECATED; use the_permalink_rss() instead.', E_USER_NOTICE); 
    855901        the_permalink_rss(); 
    856902} 
    857903 
     
    867913 * @return null|string 
    868914 */ 
    869915function wp_get_links($args = '') { 
     916        user_error('wp_get_links() is DEPRECATED; use get_bookmarks() instead.', E_USER_NOTICE); 
    870917        if ( strpos( $args, '=' ) === false ) { 
    871918                $cat_id = $args; 
    872919                $args = add_query_arg( 'category', $cat_id, $args ); 
     
    913960 */ 
    914961function get_links($category = -1, $before = '', $after = '<br />', $between = ' ', $show_images = true, $orderby = 'name', 
    915962                        $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); 
    916964 
    917965        $order = 'ASC'; 
    918966        if ( substr($orderby, 0, 1) == '_' ) { 
     
    10071055 * @param string $$deprecated Not Used  
    10081056 */ 
    10091057function get_links_list($order = 'name', $deprecated = '') { 
     1058        user_error('get_links_list() is DEPRECATED; use get_categories() instead.', E_USER_NOTICE); 
    10101059        $order = strtolower($order); 
    10111060 
    10121061        // Handle link category sorting 
     
    10531102 * @param bool $count the number of links in the db 
    10541103 */ 
    10551104function 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); 
    10561106        if ( $count ) 
    10571107                $counts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->links"); 
    10581108 
     
    10751125 * @return unknown 
    10761126 */ 
    10771127function get_linkrating($link) { 
     1128        user_error('get_linkrating() is DEPRECATED.', E_USER_NOTICE); 
    10781129        return sanitize_bookmark_field('link_rating', $link->link_rating, $link->link_id, 'display'); 
    10791130} 
    10801131 
     
    10891140 * @return string 
    10901141 */ 
    10911142function get_linkcatname($id = 0) { 
     1143        user_error('get_linkcatname() is DEPRECATED.', E_USER_NOTICE); 
    10921144        $id = (int) $id; 
    10931145 
    10941146        if ( empty($id) ) 
     
    11161168 * @param string $deprecated Not used 
    11171169 */ 
    11181170function 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); 
    11191172        post_comments_feed_link($link_text); 
    11201173} 
    11211174 
     
    11321185 * @return string|null 
    11331186 */ 
    11341187function 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); 
    11351189        $link = get_category_feed_link($cat_ID, $feed = 'rss2'); 
    11361190 
    11371191        if ( $echo ) 
     
    11521206 * @return string|null 
    11531207 */ 
    11541208function 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); 
    11551210        $link = get_author_feed_link($author_id); 
    11561211        if ( $echo ) 
    11571212                echo $link;