WordPress.org

Make WordPress Core

Ticket #4361: depreciated.3.diff

File depreciated.3.diff, 13.5 KB (added by docwhat, 12 years ago)
  • wp-includes/deprecated.php

    diff -r 2e70094cc46e wp-includes/deprecated.php
    a b  
    1616
    1717/*
    1818 * Deprecated functions come here to die.
     19 *
     20 * When adding a method to this list, please add an error log like so:
     21 *   user_error('depricated_function() is DEPRECIATED. Please use better_function() instead.', E_USER_NOTICE);
    1922 */
    2023
    2124// Use get_post().
    2225function get_postdata($postid) {
     26        user_error('get_postdata() is DEPRECIATED; please use get_post() instead.', E_USER_NOTICE);
    2327        $post = &get_post($postid);
    2428
    2529        $postdata = array (
    function get_postdata($postid) { 
    4549
    4650// Use the new post loop.
    4751function start_wp() {
     52        user_error('start_wp() is DEPRECIATED; please use the new post loop instead.', E_USER_NOTICE);
    4853        global $wp_query, $post;
    4954
    5055        // Since the old style loop is being used, advance the query iterator here.
    function start_wp() { 
    5459}
    5560
    5661function the_category_ID($echo = true) {
     62        user_error('the_category_ID() is DEPRECIATED.', E_USER_NOTICE);
    5763        // Grab the first cat in the list.
    5864        $categories = get_the_category();
    5965        $cat = $categories[0]->term_id;
    function the_category_ID($echo = true) { 
    6571}
    6672
    6773function the_category_head($before='', $after='') {
     74        user_error('the_category_head() s DEPRECIATED.', E_USER_NOTICE);
    6875        global $currentcat, $previouscat;
    6976        // Grab the first cat in the list.
    7077        $categories = get_the_category();
    function the_category_head($before='', $ 
    7986
    8087// Use previous_post_link().
    8188function previous_post($format='%', $previous='previous post: ', $title='yes', $in_same_cat='no', $limitprev=1, $excluded_categories='') {
     89        user_error('previous_post() is DEPRECIATED; please use previous_post() instead.', E_USER_NOTICE);
    8290
    8391        if ( empty($in_same_cat) || 'no' == $in_same_cat )
    8492                $in_same_cat = false;
    function previous_post($format='%', $pre 
    100108
    101109// Use next_post_link().
    102110function next_post($format='%', $next='next post: ', $title='yes', $in_same_cat='no', $limitnext=1, $excluded_categories='') {
     111        user_error('next_post() is DEPRECIATED; please use next_post_link() instead.', E_USER_NOTICE);
    103112
    104113        if ( empty($in_same_cat) || 'no' == $in_same_cat )
    105114                $in_same_cat = false;
    function next_post($format='%', $next='n 
    125134
    126135/* returns true if $user_id can create a new post */
    127136function user_can_create_post($user_id, $blog_id = 1, $category_id = 'None') {
     137        user_error('user_can_create_post() is DEPRECIATED; current_user_can() instead.', E_USER_NOTICE);
    128138        $author_data = get_userdata($user_id);
    129139        return ($author_data->user_level > 1);
    130140}
    131141
    132142/* returns true if $user_id can create a new post */
    133143function user_can_create_draft($user_id, $blog_id = 1, $category_id = 'None') {
     144        user_error('user_can_create_draft() is DEPRECIATED; current_user_can() instead.', E_USER_NOTICE);
    134145        $author_data = get_userdata($user_id);
    135146        return ($author_data->user_level >= 1);
    136147}
    137148
    138149/* returns true if $user_id can edit $post_id */
    139150function user_can_edit_post($user_id, $post_id, $blog_id = 1) {
     151        user_error('user_can_edit_post() is DEPRECIATED; current_user_can() instead.', E_USER_NOTICE);
    140152        $author_data = get_userdata($user_id);
    141153        $post = get_post($post_id);
    142154        $post_author_data = get_userdata($post->post_author);
    function user_can_edit_post($user_id, $p 
    152164
    153165/* returns true if $user_id can delete $post_id */
    154166function user_can_delete_post($user_id, $post_id, $blog_id = 1) {
     167        user_error('user_can_delete_post() is DEPRECIATED; current_user_can() instead.', E_USER_NOTICE);
    155168        // right now if one can edit, one can delete
    156169        return user_can_edit_post($user_id, $post_id, $blog_id);
    157170}
    158171
    159172/* returns true if $user_id can set new posts' dates on $blog_id */
    160173function user_can_set_post_date($user_id, $blog_id = 1, $category_id = 'None') {
     174        user_error('user_can_set_post_date() is DEPRECIATED; current_user_can() instead.', E_USER_NOTICE);
    161175        $author_data = get_userdata($user_id);
    162176        return (($author_data->user_level > 4) && user_can_create_post($user_id, $blog_id, $category_id));
    163177}
    164178
    165179/* returns true if $user_id can edit $post_id's date */
    166180function user_can_edit_post_date($user_id, $post_id, $blog_id = 1) {
     181        user_error('user_can_edit_post_date() is DEPRECIATED; current_user_can() instead.', E_USER_NOTICE);
    167182        $author_data = get_userdata($user_id);
    168183        return (($author_data->user_level > 4) && user_can_edit_post($user_id, $post_id, $blog_id));
    169184}
    170185
    171186/* returns true if $user_id can edit $post_id's comments */
    172187function user_can_edit_post_comments($user_id, $post_id, $blog_id = 1) {
     188        user_error('user_can_post_comments() is DEPRECIATED; current_user_can() instead.', E_USER_NOTICE);
    173189        // right now if one can edit a post, one can edit comments made on it
    174190        return user_can_edit_post($user_id, $post_id, $blog_id);
    175191}
    176192
    177193/* returns true if $user_id can delete $post_id's comments */
    178194function user_can_delete_post_comments($user_id, $post_id, $blog_id = 1) {
     195        user_error('user_can_delete_post_comments() is DEPRECIATED; current_user_can() instead.', E_USER_NOTICE);
    179196        // right now if one can edit comments, one can delete comments
    180197        return user_can_edit_post_comments($user_id, $post_id, $blog_id);
    181198}
    182199
    183200function user_can_edit_user($user_id, $other_user) {
     201        user_error('user_can_edit_user() is DEPRECIATED; current_user_can() instead.', E_USER_NOTICE);
    184202        $user  = get_userdata($user_id);
    185203        $other = get_userdata($other_user);
    186204        if ( $user->user_level > $other->user_level || $user->user_level > 8 || $user->ID == $other->ID )
    function get_linksbyname($cat_name = "no 
    215233                                                                                                 $between = " ", $show_images = true, $orderby = 'id',
    216234                                                                                                 $show_description = true, $show_rating = false,
    217235                                                                                                 $limit = -1, $show_updated = 0) {
     236                user_error('get_linksbyname() is DEPRECIATED.', E_USER_NOTICE);
    218237                global $wpdb;
    219238                $cat_id = -1;
    220239                $cat = get_term_by('name', $cat_name, 'link_category');
    function get_linksbyname($cat_name = "no 
    231250 **   category (no default)  - The category to use.
    232251 **/
    233252function wp_get_linksbyname($category, $args = '') {
     253        user_error('wp_get_linksbyname() is DEPRECIATED.', E_USER_NOTICE);
    234254        global $wpdb;
    235255
    236256        $cat = get_term_by('name', $cat_name, 'link_category');
    function wp_get_linksbyname($category, $ 
    262282 ** }
    263283 **/
    264284function get_linkobjectsbyname($cat_name = "noname" , $orderby = 'name', $limit = -1) {
     285                user_error('get_linkobjectsbyname() is DEPRECIATED.', E_USER_NOTICE);
    265286                global $wpdb;
    266287                $cat_id = -1;
    267288                $cat = get_term_by('name', $cat_name, 'link_category');
    function get_linkobjectsbyname($cat_name 
    308329 **/
    309330// Deprecate in favor of get_linkz().
    310331function get_linkobjects($category = 0, $orderby = 'name', $limit = 0) {
     332                user_error('get_linkobjects() is DEPRECIATED.', E_USER_NOTICE);
    311333                global $wpdb;
    312334
    313335                $links = get_bookmarks("category=$category&orderby=$orderby&limit=$limit");
    function get_linksbyname_withrating($cat 
    345367                                                                                                                                                $after = '<br />', $between = " ",
    346368                                                                                                                                                $show_images = true, $orderby = 'id',
    347369                                                                                                                                                $show_description = true, $limit = -1, $show_updated = 0) {
     370                user_error('get_linksbyname_withrating() is DEPRECIATED.', E_USER_NOTICE);
    348371
    349372                get_linksbyname($cat_name, $before, $after, $between, $show_images,
    350373                                                                                $orderby, $show_description, true, $limit, $show_updated);
    function get_links_withrating($category  
    375398                                                                                                                        $between = " ", $show_images = true,
    376399                                                                                                                        $orderby = 'id', $show_description = true,
    377400                                                                                                                        $limit = -1, $show_updated = 0) {
     401                user_error('get_links_withrating() is DEPRECIATED.', E_USER_NOTICE);
    378402
    379403                get_links($category, $before, $after, $between, $show_images, $orderby,
    380404                                                        $show_description, true, $limit, $show_updated);
    function get_links_withrating($category  
    386410 **                uses 0
    387411 */
    388412function get_autotoggle($id = 0) {
     413        user_error('get_autotoggle() is DEPRECIATED.', E_USER_NOTICE);
    389414        return 0;
    390415}
    391416
    392417// Use wp_list_cats().
    393418function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_order = 'asc', $file = '', $list = true, $optiondates = 0, $optioncount = 0, $hide_empty = 1, $use_desc_for_title = 1, $children=FALSE, $child_of=0, $categories=0, $recurse=0, $feed = '', $feed_image = '', $exclude = '', $hierarchical=FALSE) {
     419        user_error('list_cats() is DEPRECIATED.', E_USER_NOTICE);
    394420        $query = compact('optionall', 'all', 'sort_column', 'sort_order', 'file', 'list', 'optiondates', 'optioncount', 'hide_empty', 'use_desc_for_title', 'children',
    395421                'child_of', 'categories', 'recurse', 'feed', 'feed_image', 'exclude', 'hierarchical');
    396422        return wp_list_cats($query);
    397423}
    398424
    399425function wp_list_cats($args = '') {
     426        user_error('wp_list_cats() is DEPRECIATED.', E_USER_NOTICE);
    400427        $r = wp_parse_args( $args );
    401428
    402429        // Map to new names.
    function dropdown_cats($optionall = 1, $ 
    420447function dropdown_cats($optionall = 1, $all = 'All', $orderby = 'ID', $order = 'asc',
    421448                $show_last_update = 0, $show_count = 0, $hide_empty = 1, $optionnone = FALSE,
    422449                $selected = 0, $exclude = 0) {
     450        user_error('dropdown_cats() is DEPRECIATED.', E_USER_NOTICE);
    423451
    424452        $show_option_all = '';
    425453        if ( $optionall )
    function dropdown_cats($optionall = 1, $ 
    437465
    438466// Use wp_print_scripts() or WP_Scripts.
    439467function tinymce_include() {
     468        user_error('tinymce_include() is DEPRECIATED. Use wp_print_scripts() or WP_Scripts instead.', E_USER_NOTICE);
    440469        wp_print_script('wp_tiny_mce');
    441470}
    442471
    443472function list_authors($optioncount = false, $exclude_admin = true, $show_fullname = false, $hide_empty = true, $feed = '', $feed_image = '') {
     473        user_error('list_authors() is DEPRECIATED.', E_USER_NOTICE);
    444474        $args = compact('optioncount', 'exclude_admin', 'show_fullname', 'hide_empty', 'feed', 'feed_image');
    445475        return wp_list_authors($args);
    446476}
    447477
    448478function wp_get_post_cats($blogid = '1', $post_ID = 0) {
     479        user_error('wp_get_post_cats() is DEPRECIATED.', E_USER_NOTICE);
    449480        return wp_get_post_categories($post_ID);
    450481}
    451482
    452483function wp_set_post_cats($blogid = '1', $post_ID = 0, $post_categories = array()) {
     484        user_error('wp_set_post_cats() is DEPRECIATED.', E_USER_NOTICE);
    453485        return wp_set_post_categories($post_ID, $post_categories);
    454486}
    455487
    456488// Use wp_get_archives().
    457489function get_archives($type='', $limit='', $format='html', $before = '', $after = '', $show_post_count = false) {
     490        user_error('get_archives() is DEPRECIATED. Please use wp_get_archives() instead.', E_USER_NOTICE);
    458491        $args = compact('type', 'limit', 'format', 'before', 'after', 'show_post_count');
    459492        return wp_get_archives($args);
    460493}
    461494
    462495// Use get_author_posts_url().
    463496function get_author_link($echo = false, $author_id, $author_nicename = '') {
     497        user_error('get_link_link() is DEPRECIATED. Please use get_author_posts_url() instead.', E_USER_NOTICE);
    464498        $link = get_author_posts_url($author_id, $author_nicename);
    465499
    466500        if ( $echo )
    function get_author_link($echo = false,  
    470504
    471505// Use wp_link_pages().
    472506function link_pages($before='<br />', $after='<br />', $next_or_number='number', $nextpagelink='next page', $previouspagelink='previous page', $pagelink='%', $more_file='') {
     507        user_error('link_pages() is DEPRECIATED. Please use wp_link_pages() instead.', E_USER_NOTICE);
    473508        $args = compact('before', 'after', 'next_or_number', 'nextpagelink', 'previouspagelink', 'pagelink', 'more_file');
    474509        return wp_link_pages($args);
    475510}
    476511
    477512// Use get_option().
    478513function get_settings($option) {
     514        user_error('get_settings() is DEPRECIATED. Please use get_option() instead.', E_USER_NOTICE);
    479515        return get_option($option);
    480516}
    481517
    482518// Use the_permalink().
    483519function permalink_link() {
     520        user_error('permalink_link() is DEPRECIATED. Please use the_permalink() instead.', E_USER_NOTICE);
    484521        the_permalink();
    485522}
    486523
    487524// Use the_permalink_rss()
    488525function permalink_single_rss($file = '') {
     526        user_error('permalink_single_rss() is DEPRECIATED. Please use the_permalink_rss() instead.', E_USER_NOTICE);
    489527        the_permalink_rss();
    490528}
    491529
    function permalink_single_rss($file = '' 
    497535 **   a query string
    498536 **/
    499537function wp_get_links($args = '') {
     538        user_error('wp_get_links() is DEPRECIATED.', E_USER_NOTICE);
    500539        global $wpdb;
    501540
    502541        if ( strpos( $args, '=' ) === false ) {
    function get_links($category = -1, 
    553592                        $limit = -1,
    554593                        $show_updated = 1,
    555594                        $echo = true) {
     595        user_error('get_links() is DEPRECIATED.', E_USER_NOTICE);
    556596
    557597        global $wpdb;
    558598
    function get_links($category = -1, 
    647687 *   hide_if_empty (default true)  - Supress listing empty link categories
    648688 */
    649689function get_links_list($order = 'name', $hide_if_empty = 'obsolete') {
     690        user_error('get_links_list() is DEPRECIATED.', E_USER_NOTICE);
    650691        $order = strtolower($order);
    651692
    652693        // Handle link category sorting
    function get_links_list($order = 'name', 
    689730 **   count (default true) - the number of links in the db
    690731 */
    691732function links_popup_script($text = 'Links', $width=400, $height=400, $file='links.all.php', $count = true) {
     733        user_error('links_popup_script() is DEPRECIATED.', E_USER_NOTICE);
    692734        if ( $count )
    693735                $counts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->links");
    694736
    function links_popup_script($text = 'Lin 
    704746
    705747
    706748function get_linkrating($link) {
     749        user_error('get_linkrating() is DEPRECIATED.', E_USER_NOTICE);
    707750        return sanitize_bookmark_field('link_rating', $link->link_rating, $link->link_id, 'display');
    708751}
    709752
    function get_linkrating($link) { 
    713756 **                uses 0
    714757 */
    715758function get_linkcatname($id = 0) {
     759        user_error('get_linkcatname() is DEPRECIATED.', E_USER_NOTICE);
    716760        $id = (int) $id;
    717761
    718762        if ( empty($id) )