diff -r 2e70094cc46e wp-includes/deprecated.php
|
a
|
b
|
|
| 16 | 16 | |
| 17 | 17 | /* |
| 18 | 18 | * 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); |
| 19 | 22 | */ |
| 20 | 23 | |
| 21 | 24 | // Use get_post(). |
| 22 | 25 | function get_postdata($postid) { |
| | 26 | user_error('get_postdata() is DEPRECIATED; please use get_post() instead.', E_USER_NOTICE); |
| 23 | 27 | $post = &get_post($postid); |
| 24 | 28 | |
| 25 | 29 | $postdata = array ( |
| … |
… |
function get_postdata($postid) { |
| 45 | 49 | |
| 46 | 50 | // Use the new post loop. |
| 47 | 51 | function start_wp() { |
| | 52 | user_error('start_wp() is DEPRECIATED; please use the new post loop instead.', E_USER_NOTICE); |
| 48 | 53 | global $wp_query, $post; |
| 49 | 54 | |
| 50 | 55 | // Since the old style loop is being used, advance the query iterator here. |
| … |
… |
function start_wp() { |
| 54 | 59 | } |
| 55 | 60 | |
| 56 | 61 | function the_category_ID($echo = true) { |
| | 62 | user_error('the_category_ID() is DEPRECIATED.', E_USER_NOTICE); |
| 57 | 63 | // Grab the first cat in the list. |
| 58 | 64 | $categories = get_the_category(); |
| 59 | 65 | $cat = $categories[0]->term_id; |
| … |
… |
function the_category_ID($echo = true) { |
| 65 | 71 | } |
| 66 | 72 | |
| 67 | 73 | function the_category_head($before='', $after='') { |
| | 74 | user_error('the_category_head() s DEPRECIATED.', E_USER_NOTICE); |
| 68 | 75 | global $currentcat, $previouscat; |
| 69 | 76 | // Grab the first cat in the list. |
| 70 | 77 | $categories = get_the_category(); |
| … |
… |
function the_category_head($before='', $ |
| 79 | 86 | |
| 80 | 87 | // Use previous_post_link(). |
| 81 | 88 | function 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); |
| 82 | 90 | |
| 83 | 91 | if ( empty($in_same_cat) || 'no' == $in_same_cat ) |
| 84 | 92 | $in_same_cat = false; |
| … |
… |
function previous_post($format='%', $pre |
| 100 | 108 | |
| 101 | 109 | // Use next_post_link(). |
| 102 | 110 | function 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); |
| 103 | 112 | |
| 104 | 113 | if ( empty($in_same_cat) || 'no' == $in_same_cat ) |
| 105 | 114 | $in_same_cat = false; |
| … |
… |
function next_post($format='%', $next='n |
| 125 | 134 | |
| 126 | 135 | /* returns true if $user_id can create a new post */ |
| 127 | 136 | function 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); |
| 128 | 138 | $author_data = get_userdata($user_id); |
| 129 | 139 | return ($author_data->user_level > 1); |
| 130 | 140 | } |
| 131 | 141 | |
| 132 | 142 | /* returns true if $user_id can create a new post */ |
| 133 | 143 | function 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); |
| 134 | 145 | $author_data = get_userdata($user_id); |
| 135 | 146 | return ($author_data->user_level >= 1); |
| 136 | 147 | } |
| 137 | 148 | |
| 138 | 149 | /* returns true if $user_id can edit $post_id */ |
| 139 | 150 | function 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); |
| 140 | 152 | $author_data = get_userdata($user_id); |
| 141 | 153 | $post = get_post($post_id); |
| 142 | 154 | $post_author_data = get_userdata($post->post_author); |
| … |
… |
function user_can_edit_post($user_id, $p |
| 152 | 164 | |
| 153 | 165 | /* returns true if $user_id can delete $post_id */ |
| 154 | 166 | function 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); |
| 155 | 168 | // right now if one can edit, one can delete |
| 156 | 169 | return user_can_edit_post($user_id, $post_id, $blog_id); |
| 157 | 170 | } |
| 158 | 171 | |
| 159 | 172 | /* returns true if $user_id can set new posts' dates on $blog_id */ |
| 160 | 173 | function 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); |
| 161 | 175 | $author_data = get_userdata($user_id); |
| 162 | 176 | return (($author_data->user_level > 4) && user_can_create_post($user_id, $blog_id, $category_id)); |
| 163 | 177 | } |
| 164 | 178 | |
| 165 | 179 | /* returns true if $user_id can edit $post_id's date */ |
| 166 | 180 | function 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); |
| 167 | 182 | $author_data = get_userdata($user_id); |
| 168 | 183 | return (($author_data->user_level > 4) && user_can_edit_post($user_id, $post_id, $blog_id)); |
| 169 | 184 | } |
| 170 | 185 | |
| 171 | 186 | /* returns true if $user_id can edit $post_id's comments */ |
| 172 | 187 | function 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); |
| 173 | 189 | // right now if one can edit a post, one can edit comments made on it |
| 174 | 190 | return user_can_edit_post($user_id, $post_id, $blog_id); |
| 175 | 191 | } |
| 176 | 192 | |
| 177 | 193 | /* returns true if $user_id can delete $post_id's comments */ |
| 178 | 194 | function 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); |
| 179 | 196 | // right now if one can edit comments, one can delete comments |
| 180 | 197 | return user_can_edit_post_comments($user_id, $post_id, $blog_id); |
| 181 | 198 | } |
| 182 | 199 | |
| 183 | 200 | function user_can_edit_user($user_id, $other_user) { |
| | 201 | user_error('user_can_edit_user() is DEPRECIATED; current_user_can() instead.', E_USER_NOTICE); |
| 184 | 202 | $user = get_userdata($user_id); |
| 185 | 203 | $other = get_userdata($other_user); |
| 186 | 204 | if ( $user->user_level > $other->user_level || $user->user_level > 8 || $user->ID == $other->ID ) |
| … |
… |
function get_linksbyname($cat_name = "no |
| 215 | 233 | $between = " ", $show_images = true, $orderby = 'id', |
| 216 | 234 | $show_description = true, $show_rating = false, |
| 217 | 235 | $limit = -1, $show_updated = 0) { |
| | 236 | user_error('get_linksbyname() is DEPRECIATED.', E_USER_NOTICE); |
| 218 | 237 | global $wpdb; |
| 219 | 238 | $cat_id = -1; |
| 220 | 239 | $cat = get_term_by('name', $cat_name, 'link_category'); |
| … |
… |
function get_linksbyname($cat_name = "no |
| 231 | 250 | ** category (no default) - The category to use. |
| 232 | 251 | **/ |
| 233 | 252 | function wp_get_linksbyname($category, $args = '') { |
| | 253 | user_error('wp_get_linksbyname() is DEPRECIATED.', E_USER_NOTICE); |
| 234 | 254 | global $wpdb; |
| 235 | 255 | |
| 236 | 256 | $cat = get_term_by('name', $cat_name, 'link_category'); |
| … |
… |
function wp_get_linksbyname($category, $ |
| 262 | 282 | ** } |
| 263 | 283 | **/ |
| 264 | 284 | function get_linkobjectsbyname($cat_name = "noname" , $orderby = 'name', $limit = -1) { |
| | 285 | user_error('get_linkobjectsbyname() is DEPRECIATED.', E_USER_NOTICE); |
| 265 | 286 | global $wpdb; |
| 266 | 287 | $cat_id = -1; |
| 267 | 288 | $cat = get_term_by('name', $cat_name, 'link_category'); |
| … |
… |
function get_linkobjectsbyname($cat_name |
| 308 | 329 | **/ |
| 309 | 330 | // Deprecate in favor of get_linkz(). |
| 310 | 331 | function get_linkobjects($category = 0, $orderby = 'name', $limit = 0) { |
| | 332 | user_error('get_linkobjects() is DEPRECIATED.', E_USER_NOTICE); |
| 311 | 333 | global $wpdb; |
| 312 | 334 | |
| 313 | 335 | $links = get_bookmarks("category=$category&orderby=$orderby&limit=$limit"); |
| … |
… |
function get_linksbyname_withrating($cat |
| 345 | 367 | $after = '<br />', $between = " ", |
| 346 | 368 | $show_images = true, $orderby = 'id', |
| 347 | 369 | $show_description = true, $limit = -1, $show_updated = 0) { |
| | 370 | user_error('get_linksbyname_withrating() is DEPRECIATED.', E_USER_NOTICE); |
| 348 | 371 | |
| 349 | 372 | get_linksbyname($cat_name, $before, $after, $between, $show_images, |
| 350 | 373 | $orderby, $show_description, true, $limit, $show_updated); |
| … |
… |
function get_links_withrating($category |
| 375 | 398 | $between = " ", $show_images = true, |
| 376 | 399 | $orderby = 'id', $show_description = true, |
| 377 | 400 | $limit = -1, $show_updated = 0) { |
| | 401 | user_error('get_links_withrating() is DEPRECIATED.', E_USER_NOTICE); |
| 378 | 402 | |
| 379 | 403 | get_links($category, $before, $after, $between, $show_images, $orderby, |
| 380 | 404 | $show_description, true, $limit, $show_updated); |
| … |
… |
function get_links_withrating($category |
| 386 | 410 | ** uses 0 |
| 387 | 411 | */ |
| 388 | 412 | function get_autotoggle($id = 0) { |
| | 413 | user_error('get_autotoggle() is DEPRECIATED.', E_USER_NOTICE); |
| 389 | 414 | return 0; |
| 390 | 415 | } |
| 391 | 416 | |
| 392 | 417 | // Use wp_list_cats(). |
| 393 | 418 | function 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); |
| 394 | 420 | $query = compact('optionall', 'all', 'sort_column', 'sort_order', 'file', 'list', 'optiondates', 'optioncount', 'hide_empty', 'use_desc_for_title', 'children', |
| 395 | 421 | 'child_of', 'categories', 'recurse', 'feed', 'feed_image', 'exclude', 'hierarchical'); |
| 396 | 422 | return wp_list_cats($query); |
| 397 | 423 | } |
| 398 | 424 | |
| 399 | 425 | function wp_list_cats($args = '') { |
| | 426 | user_error('wp_list_cats() is DEPRECIATED.', E_USER_NOTICE); |
| 400 | 427 | $r = wp_parse_args( $args ); |
| 401 | 428 | |
| 402 | 429 | // Map to new names. |
| … |
… |
function dropdown_cats($optionall = 1, $ |
| 420 | 447 | function dropdown_cats($optionall = 1, $all = 'All', $orderby = 'ID', $order = 'asc', |
| 421 | 448 | $show_last_update = 0, $show_count = 0, $hide_empty = 1, $optionnone = FALSE, |
| 422 | 449 | $selected = 0, $exclude = 0) { |
| | 450 | user_error('dropdown_cats() is DEPRECIATED.', E_USER_NOTICE); |
| 423 | 451 | |
| 424 | 452 | $show_option_all = ''; |
| 425 | 453 | if ( $optionall ) |
| … |
… |
function dropdown_cats($optionall = 1, $ |
| 437 | 465 | |
| 438 | 466 | // Use wp_print_scripts() or WP_Scripts. |
| 439 | 467 | function tinymce_include() { |
| | 468 | user_error('tinymce_include() is DEPRECIATED. Use wp_print_scripts() or WP_Scripts instead.', E_USER_NOTICE); |
| 440 | 469 | wp_print_script('wp_tiny_mce'); |
| 441 | 470 | } |
| 442 | 471 | |
| 443 | 472 | function 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); |
| 444 | 474 | $args = compact('optioncount', 'exclude_admin', 'show_fullname', 'hide_empty', 'feed', 'feed_image'); |
| 445 | 475 | return wp_list_authors($args); |
| 446 | 476 | } |
| 447 | 477 | |
| 448 | 478 | function wp_get_post_cats($blogid = '1', $post_ID = 0) { |
| | 479 | user_error('wp_get_post_cats() is DEPRECIATED.', E_USER_NOTICE); |
| 449 | 480 | return wp_get_post_categories($post_ID); |
| 450 | 481 | } |
| 451 | 482 | |
| 452 | 483 | function wp_set_post_cats($blogid = '1', $post_ID = 0, $post_categories = array()) { |
| | 484 | user_error('wp_set_post_cats() is DEPRECIATED.', E_USER_NOTICE); |
| 453 | 485 | return wp_set_post_categories($post_ID, $post_categories); |
| 454 | 486 | } |
| 455 | 487 | |
| 456 | 488 | // Use wp_get_archives(). |
| 457 | 489 | function 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); |
| 458 | 491 | $args = compact('type', 'limit', 'format', 'before', 'after', 'show_post_count'); |
| 459 | 492 | return wp_get_archives($args); |
| 460 | 493 | } |
| 461 | 494 | |
| 462 | 495 | // Use get_author_posts_url(). |
| 463 | 496 | function 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); |
| 464 | 498 | $link = get_author_posts_url($author_id, $author_nicename); |
| 465 | 499 | |
| 466 | 500 | if ( $echo ) |
| … |
… |
function get_author_link($echo = false, |
| 470 | 504 | |
| 471 | 505 | // Use wp_link_pages(). |
| 472 | 506 | function 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); |
| 473 | 508 | $args = compact('before', 'after', 'next_or_number', 'nextpagelink', 'previouspagelink', 'pagelink', 'more_file'); |
| 474 | 509 | return wp_link_pages($args); |
| 475 | 510 | } |
| 476 | 511 | |
| 477 | 512 | // Use get_option(). |
| 478 | 513 | function get_settings($option) { |
| | 514 | user_error('get_settings() is DEPRECIATED. Please use get_option() instead.', E_USER_NOTICE); |
| 479 | 515 | return get_option($option); |
| 480 | 516 | } |
| 481 | 517 | |
| 482 | 518 | // Use the_permalink(). |
| 483 | 519 | function permalink_link() { |
| | 520 | user_error('permalink_link() is DEPRECIATED. Please use the_permalink() instead.', E_USER_NOTICE); |
| 484 | 521 | the_permalink(); |
| 485 | 522 | } |
| 486 | 523 | |
| 487 | 524 | // Use the_permalink_rss() |
| 488 | 525 | function permalink_single_rss($file = '') { |
| | 526 | user_error('permalink_single_rss() is DEPRECIATED. Please use the_permalink_rss() instead.', E_USER_NOTICE); |
| 489 | 527 | the_permalink_rss(); |
| 490 | 528 | } |
| 491 | 529 | |
| … |
… |
function permalink_single_rss($file = '' |
| 497 | 535 | ** a query string |
| 498 | 536 | **/ |
| 499 | 537 | function wp_get_links($args = '') { |
| | 538 | user_error('wp_get_links() is DEPRECIATED.', E_USER_NOTICE); |
| 500 | 539 | global $wpdb; |
| 501 | 540 | |
| 502 | 541 | if ( strpos( $args, '=' ) === false ) { |
| … |
… |
function get_links($category = -1, |
| 553 | 592 | $limit = -1, |
| 554 | 593 | $show_updated = 1, |
| 555 | 594 | $echo = true) { |
| | 595 | user_error('get_links() is DEPRECIATED.', E_USER_NOTICE); |
| 556 | 596 | |
| 557 | 597 | global $wpdb; |
| 558 | 598 | |
| … |
… |
function get_links($category = -1, |
| 647 | 687 | * hide_if_empty (default true) - Supress listing empty link categories |
| 648 | 688 | */ |
| 649 | 689 | function get_links_list($order = 'name', $hide_if_empty = 'obsolete') { |
| | 690 | user_error('get_links_list() is DEPRECIATED.', E_USER_NOTICE); |
| 650 | 691 | $order = strtolower($order); |
| 651 | 692 | |
| 652 | 693 | // Handle link category sorting |
| … |
… |
function get_links_list($order = 'name', |
| 689 | 730 | ** count (default true) - the number of links in the db |
| 690 | 731 | */ |
| 691 | 732 | function 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); |
| 692 | 734 | if ( $count ) |
| 693 | 735 | $counts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->links"); |
| 694 | 736 | |
| … |
… |
function links_popup_script($text = 'Lin |
| 704 | 746 | |
| 705 | 747 | |
| 706 | 748 | function get_linkrating($link) { |
| | 749 | user_error('get_linkrating() is DEPRECIATED.', E_USER_NOTICE); |
| 707 | 750 | return sanitize_bookmark_field('link_rating', $link->link_rating, $link->link_id, 'display'); |
| 708 | 751 | } |
| 709 | 752 | |
| … |
… |
function get_linkrating($link) { |
| 713 | 756 | ** uses 0 |
| 714 | 757 | */ |
| 715 | 758 | function get_linkcatname($id = 0) { |
| | 759 | user_error('get_linkcatname() is DEPRECIATED.', E_USER_NOTICE); |
| 716 | 760 | $id = (int) $id; |
| 717 | 761 | |
| 718 | 762 | if ( empty($id) ) |