| 1 | diff -r 2e70094cc46e wp-includes/deprecated.php |
|---|
| 2 | --- a/wp-includes/deprecated.php Fri Oct 12 08:13:54 2007 -0400 |
|---|
| 3 | +++ b/wp-includes/deprecated.php Fri Oct 12 21:00:25 2007 -0400 |
|---|
| 4 | @@ -16,10 +16,14 @@ |
|---|
| 5 | |
|---|
| 6 | /* |
|---|
| 7 | * Deprecated functions come here to die. |
|---|
| 8 | + * |
|---|
| 9 | + * When adding a method to this list, please add an error log like so: |
|---|
| 10 | + * user_error('depricated_function() is DEPRECATED. Please use better_function() instead.', E_USER_NOTICE); |
|---|
| 11 | */ |
|---|
| 12 | |
|---|
| 13 | // Use get_post(). |
|---|
| 14 | function get_postdata($postid) { |
|---|
| 15 | + user_error('get_postdata() is DEPRECATED; please use get_post() instead.', E_USER_NOTICE); |
|---|
| 16 | $post = &get_post($postid); |
|---|
| 17 | |
|---|
| 18 | $postdata = array ( |
|---|
| 19 | @@ -45,6 +49,7 @@ function get_postdata($postid) { |
|---|
| 20 | |
|---|
| 21 | // Use the new post loop. |
|---|
| 22 | function start_wp() { |
|---|
| 23 | + user_error('start_wp() is DEPRECATED; please use the new post loop instead.', E_USER_NOTICE); |
|---|
| 24 | global $wp_query, $post; |
|---|
| 25 | |
|---|
| 26 | // Since the old style loop is being used, advance the query iterator here. |
|---|
| 27 | @@ -54,6 +59,7 @@ function start_wp() { |
|---|
| 28 | } |
|---|
| 29 | |
|---|
| 30 | function the_category_ID($echo = true) { |
|---|
| 31 | + user_error('the_category_ID() is DEPRECATED.', E_USER_NOTICE); |
|---|
| 32 | // Grab the first cat in the list. |
|---|
| 33 | $categories = get_the_category(); |
|---|
| 34 | $cat = $categories[0]->term_id; |
|---|
| 35 | @@ -65,6 +71,7 @@ function the_category_ID($echo = true) { |
|---|
| 36 | } |
|---|
| 37 | |
|---|
| 38 | function the_category_head($before='', $after='') { |
|---|
| 39 | + user_error('the_category_head() s DEPRECATED.', E_USER_NOTICE); |
|---|
| 40 | global $currentcat, $previouscat; |
|---|
| 41 | // Grab the first cat in the list. |
|---|
| 42 | $categories = get_the_category(); |
|---|
| 43 | @@ -79,6 +86,7 @@ function the_category_head($before='', $ |
|---|
| 44 | |
|---|
| 45 | // Use previous_post_link(). |
|---|
| 46 | function previous_post($format='%', $previous='previous post: ', $title='yes', $in_same_cat='no', $limitprev=1, $excluded_categories='') { |
|---|
| 47 | + user_error('previous_post() is DEPRECATED; please use previous_post() instead.', E_USER_NOTICE); |
|---|
| 48 | |
|---|
| 49 | if ( empty($in_same_cat) || 'no' == $in_same_cat ) |
|---|
| 50 | $in_same_cat = false; |
|---|
| 51 | @@ -100,6 +108,7 @@ function previous_post($format='%', $pre |
|---|
| 52 | |
|---|
| 53 | // Use next_post_link(). |
|---|
| 54 | function next_post($format='%', $next='next post: ', $title='yes', $in_same_cat='no', $limitnext=1, $excluded_categories='') { |
|---|
| 55 | + user_error('next_post() is DEPRECATED; please use next_post_link() instead.', E_USER_NOTICE); |
|---|
| 56 | |
|---|
| 57 | if ( empty($in_same_cat) || 'no' == $in_same_cat ) |
|---|
| 58 | $in_same_cat = false; |
|---|
| 59 | @@ -125,18 +134,21 @@ function next_post($format='%', $next='n |
|---|
| 60 | |
|---|
| 61 | /* returns true if $user_id can create a new post */ |
|---|
| 62 | function user_can_create_post($user_id, $blog_id = 1, $category_id = 'None') { |
|---|
| 63 | + user_error('user_can_create_post() is DEPRECATED; current_user_can() instead.', E_USER_NOTICE); |
|---|
| 64 | $author_data = get_userdata($user_id); |
|---|
| 65 | return ($author_data->user_level > 1); |
|---|
| 66 | } |
|---|
| 67 | |
|---|
| 68 | /* returns true if $user_id can create a new post */ |
|---|
| 69 | function user_can_create_draft($user_id, $blog_id = 1, $category_id = 'None') { |
|---|
| 70 | + user_error('user_can_create_draft() is DEPRECATED; current_user_can() instead.', E_USER_NOTICE); |
|---|
| 71 | $author_data = get_userdata($user_id); |
|---|
| 72 | return ($author_data->user_level >= 1); |
|---|
| 73 | } |
|---|
| 74 | |
|---|
| 75 | /* returns true if $user_id can edit $post_id */ |
|---|
| 76 | function user_can_edit_post($user_id, $post_id, $blog_id = 1) { |
|---|
| 77 | + user_error('user_can_edit_post() is DEPRECATED; current_user_can() instead.', E_USER_NOTICE); |
|---|
| 78 | $author_data = get_userdata($user_id); |
|---|
| 79 | $post = get_post($post_id); |
|---|
| 80 | $post_author_data = get_userdata($post->post_author); |
|---|
| 81 | @@ -152,35 +164,41 @@ function user_can_edit_post($user_id, $p |
|---|
| 82 | |
|---|
| 83 | /* returns true if $user_id can delete $post_id */ |
|---|
| 84 | function user_can_delete_post($user_id, $post_id, $blog_id = 1) { |
|---|
| 85 | + user_error('user_can_delete_post() is DEPRECATED; current_user_can() instead.', E_USER_NOTICE); |
|---|
| 86 | // right now if one can edit, one can delete |
|---|
| 87 | return user_can_edit_post($user_id, $post_id, $blog_id); |
|---|
| 88 | } |
|---|
| 89 | |
|---|
| 90 | /* returns true if $user_id can set new posts' dates on $blog_id */ |
|---|
| 91 | function user_can_set_post_date($user_id, $blog_id = 1, $category_id = 'None') { |
|---|
| 92 | + user_error('user_can_set_post_date() is DEPRECATED; current_user_can() instead.', E_USER_NOTICE); |
|---|
| 93 | $author_data = get_userdata($user_id); |
|---|
| 94 | return (($author_data->user_level > 4) && user_can_create_post($user_id, $blog_id, $category_id)); |
|---|
| 95 | } |
|---|
| 96 | |
|---|
| 97 | /* returns true if $user_id can edit $post_id's date */ |
|---|
| 98 | function user_can_edit_post_date($user_id, $post_id, $blog_id = 1) { |
|---|
| 99 | + user_error('user_can_edit_post_date() is DEPRECATED; current_user_can() instead.', E_USER_NOTICE); |
|---|
| 100 | $author_data = get_userdata($user_id); |
|---|
| 101 | return (($author_data->user_level > 4) && user_can_edit_post($user_id, $post_id, $blog_id)); |
|---|
| 102 | } |
|---|
| 103 | |
|---|
| 104 | /* returns true if $user_id can edit $post_id's comments */ |
|---|
| 105 | function user_can_edit_post_comments($user_id, $post_id, $blog_id = 1) { |
|---|
| 106 | + user_error('user_can_post_comments() is DEPRECATED; current_user_can() instead.', E_USER_NOTICE); |
|---|
| 107 | // right now if one can edit a post, one can edit comments made on it |
|---|
| 108 | return user_can_edit_post($user_id, $post_id, $blog_id); |
|---|
| 109 | } |
|---|
| 110 | |
|---|
| 111 | /* returns true if $user_id can delete $post_id's comments */ |
|---|
| 112 | function user_can_delete_post_comments($user_id, $post_id, $blog_id = 1) { |
|---|
| 113 | + user_error('user_can_delete_post_comments() is DEPRECATED; current_user_can() instead.', E_USER_NOTICE); |
|---|
| 114 | // right now if one can edit comments, one can delete comments |
|---|
| 115 | return user_can_edit_post_comments($user_id, $post_id, $blog_id); |
|---|
| 116 | } |
|---|
| 117 | |
|---|
| 118 | function user_can_edit_user($user_id, $other_user) { |
|---|
| 119 | + user_error('user_can_edit_user() is DEPRECATED; current_user_can() instead.', E_USER_NOTICE); |
|---|
| 120 | $user = get_userdata($user_id); |
|---|
| 121 | $other = get_userdata($other_user); |
|---|
| 122 | if ( $user->user_level > $other->user_level || $user->user_level > 8 || $user->ID == $other->ID ) |
|---|
| 123 | @@ -215,6 +233,7 @@ function get_linksbyname($cat_name = "no |
|---|
| 124 | $between = " ", $show_images = true, $orderby = 'id', |
|---|
| 125 | $show_description = true, $show_rating = false, |
|---|
| 126 | $limit = -1, $show_updated = 0) { |
|---|
| 127 | + user_error('get_linksbyname() is DEPRECATED.', E_USER_NOTICE); |
|---|
| 128 | global $wpdb; |
|---|
| 129 | $cat_id = -1; |
|---|
| 130 | $cat = get_term_by('name', $cat_name, 'link_category'); |
|---|
| 131 | @@ -231,6 +250,7 @@ function get_linksbyname($cat_name = "no |
|---|
| 132 | ** category (no default) - The category to use. |
|---|
| 133 | **/ |
|---|
| 134 | function wp_get_linksbyname($category, $args = '') { |
|---|
| 135 | + user_error('wp_get_linksbyname() is DEPRECATED.', E_USER_NOTICE); |
|---|
| 136 | global $wpdb; |
|---|
| 137 | |
|---|
| 138 | $cat = get_term_by('name', $cat_name, 'link_category'); |
|---|
| 139 | @@ -262,6 +282,7 @@ function wp_get_linksbyname($category, $ |
|---|
| 140 | ** } |
|---|
| 141 | **/ |
|---|
| 142 | function get_linkobjectsbyname($cat_name = "noname" , $orderby = 'name', $limit = -1) { |
|---|
| 143 | + user_error('get_linkobjectsbyname() is DEPRECATED.', E_USER_NOTICE); |
|---|
| 144 | global $wpdb; |
|---|
| 145 | $cat_id = -1; |
|---|
| 146 | $cat = get_term_by('name', $cat_name, 'link_category'); |
|---|
| 147 | @@ -308,6 +329,7 @@ function get_linkobjectsbyname($cat_name |
|---|
| 148 | **/ |
|---|
| 149 | // Deprecate in favor of get_linkz(). |
|---|
| 150 | function get_linkobjects($category = 0, $orderby = 'name', $limit = 0) { |
|---|
| 151 | + user_error('get_linkobjects() is DEPRECATED.', E_USER_NOTICE); |
|---|
| 152 | global $wpdb; |
|---|
| 153 | |
|---|
| 154 | $links = get_bookmarks("category=$category&orderby=$orderby&limit=$limit"); |
|---|
| 155 | @@ -345,6 +367,7 @@ function get_linksbyname_withrating($cat |
|---|
| 156 | $after = '<br />', $between = " ", |
|---|
| 157 | $show_images = true, $orderby = 'id', |
|---|
| 158 | $show_description = true, $limit = -1, $show_updated = 0) { |
|---|
| 159 | + user_error('get_linksbyname_withrating() is DEPRECATED.', E_USER_NOTICE); |
|---|
| 160 | |
|---|
| 161 | get_linksbyname($cat_name, $before, $after, $between, $show_images, |
|---|
| 162 | $orderby, $show_description, true, $limit, $show_updated); |
|---|
| 163 | @@ -375,6 +398,7 @@ function get_links_withrating($category |
|---|
| 164 | $between = " ", $show_images = true, |
|---|
| 165 | $orderby = 'id', $show_description = true, |
|---|
| 166 | $limit = -1, $show_updated = 0) { |
|---|
| 167 | + user_error('get_links_withrating() is DEPRECATED.', E_USER_NOTICE); |
|---|
| 168 | |
|---|
| 169 | get_links($category, $before, $after, $between, $show_images, $orderby, |
|---|
| 170 | $show_description, true, $limit, $show_updated); |
|---|
| 171 | @@ -386,17 +410,20 @@ function get_links_withrating($category |
|---|
| 172 | ** uses 0 |
|---|
| 173 | */ |
|---|
| 174 | function get_autotoggle($id = 0) { |
|---|
| 175 | + user_error('get_autotoggle() is DEPRECATED.', E_USER_NOTICE); |
|---|
| 176 | return 0; |
|---|
| 177 | } |
|---|
| 178 | |
|---|
| 179 | // Use wp_list_cats(). |
|---|
| 180 | 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) { |
|---|
| 181 | + user_error('list_cats() is DEPRECATED.', E_USER_NOTICE); |
|---|
| 182 | $query = compact('optionall', 'all', 'sort_column', 'sort_order', 'file', 'list', 'optiondates', 'optioncount', 'hide_empty', 'use_desc_for_title', 'children', |
|---|
| 183 | 'child_of', 'categories', 'recurse', 'feed', 'feed_image', 'exclude', 'hierarchical'); |
|---|
| 184 | return wp_list_cats($query); |
|---|
| 185 | } |
|---|
| 186 | |
|---|
| 187 | function wp_list_cats($args = '') { |
|---|
| 188 | + user_error('wp_list_cats() is DEPRECATED.', E_USER_NOTICE); |
|---|
| 189 | $r = wp_parse_args( $args ); |
|---|
| 190 | |
|---|
| 191 | // Map to new names. |
|---|
| 192 | @@ -420,6 +447,7 @@ function dropdown_cats($optionall = 1, $ |
|---|
| 193 | function dropdown_cats($optionall = 1, $all = 'All', $orderby = 'ID', $order = 'asc', |
|---|
| 194 | $show_last_update = 0, $show_count = 0, $hide_empty = 1, $optionnone = FALSE, |
|---|
| 195 | $selected = 0, $exclude = 0) { |
|---|
| 196 | + user_error('dropdown_cats() is DEPRECATED.', E_USER_NOTICE); |
|---|
| 197 | |
|---|
| 198 | $show_option_all = ''; |
|---|
| 199 | if ( $optionall ) |
|---|
| 200 | @@ -437,30 +465,36 @@ function dropdown_cats($optionall = 1, $ |
|---|
| 201 | |
|---|
| 202 | // Use wp_print_scripts() or WP_Scripts. |
|---|
| 203 | function tinymce_include() { |
|---|
| 204 | + user_error('tinymce_include() is DEPRECATED. Use wp_print_scripts() or WP_Scripts instead.', E_USER_NOTICE); |
|---|
| 205 | wp_print_script('wp_tiny_mce'); |
|---|
| 206 | } |
|---|
| 207 | |
|---|
| 208 | function list_authors($optioncount = false, $exclude_admin = true, $show_fullname = false, $hide_empty = true, $feed = '', $feed_image = '') { |
|---|
| 209 | + user_error('list_authors() is DEPRECATED.', E_USER_NOTICE); |
|---|
| 210 | $args = compact('optioncount', 'exclude_admin', 'show_fullname', 'hide_empty', 'feed', 'feed_image'); |
|---|
| 211 | return wp_list_authors($args); |
|---|
| 212 | } |
|---|
| 213 | |
|---|
| 214 | function wp_get_post_cats($blogid = '1', $post_ID = 0) { |
|---|
| 215 | + user_error('wp_get_post_cats() is DEPRECATED.', E_USER_NOTICE); |
|---|
| 216 | return wp_get_post_categories($post_ID); |
|---|
| 217 | } |
|---|
| 218 | |
|---|
| 219 | function wp_set_post_cats($blogid = '1', $post_ID = 0, $post_categories = array()) { |
|---|
| 220 | + user_error('wp_set_post_cats() is DEPRECATED.', E_USER_NOTICE); |
|---|
| 221 | return wp_set_post_categories($post_ID, $post_categories); |
|---|
| 222 | } |
|---|
| 223 | |
|---|
| 224 | // Use wp_get_archives(). |
|---|
| 225 | function get_archives($type='', $limit='', $format='html', $before = '', $after = '', $show_post_count = false) { |
|---|
| 226 | + user_error('get_archives() is DEPRECATED. Please use wp_get_archives() instead.', E_USER_NOTICE); |
|---|
| 227 | $args = compact('type', 'limit', 'format', 'before', 'after', 'show_post_count'); |
|---|
| 228 | return wp_get_archives($args); |
|---|
| 229 | } |
|---|
| 230 | |
|---|
| 231 | // Use get_author_posts_url(). |
|---|
| 232 | function get_author_link($echo = false, $author_id, $author_nicename = '') { |
|---|
| 233 | + user_error('get_link_link() is DEPRECATED. Please use get_author_posts_url() instead.', E_USER_NOTICE); |
|---|
| 234 | $link = get_author_posts_url($author_id, $author_nicename); |
|---|
| 235 | |
|---|
| 236 | if ( $echo ) |
|---|
| 237 | @@ -470,22 +504,26 @@ function get_author_link($echo = false, |
|---|
| 238 | |
|---|
| 239 | // Use wp_link_pages(). |
|---|
| 240 | function link_pages($before='<br />', $after='<br />', $next_or_number='number', $nextpagelink='next page', $previouspagelink='previous page', $pagelink='%', $more_file='') { |
|---|
| 241 | + user_error('link_pages() is DEPRECATED. Please use wp_link_pages() instead.', E_USER_NOTICE); |
|---|
| 242 | $args = compact('before', 'after', 'next_or_number', 'nextpagelink', 'previouspagelink', 'pagelink', 'more_file'); |
|---|
| 243 | return wp_link_pages($args); |
|---|
| 244 | } |
|---|
| 245 | |
|---|
| 246 | // Use get_option(). |
|---|
| 247 | function get_settings($option) { |
|---|
| 248 | + user_error('get_settings() is DEPRECATED. Please use get_option() instead.', E_USER_NOTICE); |
|---|
| 249 | return get_option($option); |
|---|
| 250 | } |
|---|
| 251 | |
|---|
| 252 | // Use the_permalink(). |
|---|
| 253 | function permalink_link() { |
|---|
| 254 | + user_error('permalink_link() is DEPRECATED. Please use the_permalink() instead.', E_USER_NOTICE); |
|---|
| 255 | the_permalink(); |
|---|
| 256 | } |
|---|
| 257 | |
|---|
| 258 | // Use the_permalink_rss() |
|---|
| 259 | function permalink_single_rss($file = '') { |
|---|
| 260 | + user_error('permalink_single_rss() is DEPRECATED. Please use the_permalink_rss() instead.', E_USER_NOTICE); |
|---|
| 261 | the_permalink_rss(); |
|---|
| 262 | } |
|---|
| 263 | |
|---|
| 264 | @@ -497,6 +535,7 @@ function permalink_single_rss($file = '' |
|---|
| 265 | ** a query string |
|---|
| 266 | **/ |
|---|
| 267 | function wp_get_links($args = '') { |
|---|
| 268 | + user_error('wp_get_links() is DEPRECATED.', E_USER_NOTICE); |
|---|
| 269 | global $wpdb; |
|---|
| 270 | |
|---|
| 271 | if ( strpos( $args, '=' ) === false ) { |
|---|
| 272 | @@ -553,6 +592,7 @@ function get_links($category = -1, |
|---|
| 273 | $limit = -1, |
|---|
| 274 | $show_updated = 1, |
|---|
| 275 | $echo = true) { |
|---|
| 276 | + user_error('get_links() is DEPRECATED.', E_USER_NOTICE); |
|---|
| 277 | |
|---|
| 278 | global $wpdb; |
|---|
| 279 | |
|---|
| 280 | @@ -647,6 +687,7 @@ function get_links($category = -1, |
|---|
| 281 | * hide_if_empty (default true) - Supress listing empty link categories |
|---|
| 282 | */ |
|---|
| 283 | function get_links_list($order = 'name', $hide_if_empty = 'obsolete') { |
|---|
| 284 | + user_error('get_links_list() is DEPRECATED.', E_USER_NOTICE); |
|---|
| 285 | $order = strtolower($order); |
|---|
| 286 | |
|---|
| 287 | // Handle link category sorting |
|---|
| 288 | @@ -689,6 +730,7 @@ function get_links_list($order = 'name', |
|---|
| 289 | ** count (default true) - the number of links in the db |
|---|
| 290 | */ |
|---|
| 291 | function links_popup_script($text = 'Links', $width=400, $height=400, $file='links.all.php', $count = true) { |
|---|
| 292 | + user_error('links_popup_script() is DEPRECATED.', E_USER_NOTICE); |
|---|
| 293 | if ( $count ) |
|---|
| 294 | $counts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->links"); |
|---|
| 295 | |
|---|
| 296 | @@ -704,6 +746,7 @@ function links_popup_script($text = 'Lin |
|---|
| 297 | |
|---|
| 298 | |
|---|
| 299 | function get_linkrating($link) { |
|---|
| 300 | + user_error('get_linkrating() is DEPRECATED.', E_USER_NOTICE); |
|---|
| 301 | return sanitize_bookmark_field('link_rating', $link->link_rating, $link->link_id, 'display'); |
|---|
| 302 | } |
|---|
| 303 | |
|---|
| 304 | @@ -713,6 +756,7 @@ function get_linkrating($link) { |
|---|
| 305 | ** uses 0 |
|---|
| 306 | */ |
|---|
| 307 | function get_linkcatname($id = 0) { |
|---|
| 308 | + user_error('get_linkcatname() is DEPRECATED.', E_USER_NOTICE); |
|---|
| 309 | $id = (int) $id; |
|---|
| 310 | |
|---|
| 311 | if ( empty($id) ) |
|---|