[ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * Deprecated functions from past WordPress versions. You shouldn't use these 4 * functions and look for the alternatives instead. The functions will be 5 * removed in a later version. 6 * 7 * @package WordPress 8 * @subpackage Deprecated 9 */ 10 11 /* 12 * Deprecated functions come here to die. 13 */ 14 15 /** 16 * Retrieves all post data for a given post. 17 * 18 * @since 0.71 19 * @deprecated 1.5.1 Use get_post() 20 * @see get_post() 21 * 22 * @param int $postid Post ID. 23 * @return array Post data. 24 */ 25 function get_postdata($postid) { 26 _deprecated_function( __FUNCTION__, '1.5.1', 'get_post()' ); 27 28 $post = get_post($postid); 29 30 $postdata = array ( 31 'ID' => $post->ID, 32 'Author_ID' => $post->post_author, 33 'Date' => $post->post_date, 34 'Content' => $post->post_content, 35 'Excerpt' => $post->post_excerpt, 36 'Title' => $post->post_title, 37 'Category' => $post->post_category, 38 'post_status' => $post->post_status, 39 'comment_status' => $post->comment_status, 40 'ping_status' => $post->ping_status, 41 'post_password' => $post->post_password, 42 'to_ping' => $post->to_ping, 43 'pinged' => $post->pinged, 44 'post_type' => $post->post_type, 45 'post_name' => $post->post_name 46 ); 47 48 return $postdata; 49 } 50 51 /** 52 * Sets up the WordPress Loop. 53 * 54 * Use The Loop instead. 55 * 56 * @link https://developer.wordpress.org/themes/basics/the-loop/ 57 * 58 * @since 1.0.1 59 * @deprecated 1.5.0 60 */ 61 function start_wp() { 62 global $wp_query; 63 64 _deprecated_function( __FUNCTION__, '1.5.0', __('new WordPress Loop') ); 65 66 // Since the old style loop is being used, advance the query iterator here. 67 $wp_query->next_post(); 68 69 setup_postdata( get_post() ); 70 } 71 72 /** 73 * Returns or prints a category ID. 74 * 75 * @since 0.71 76 * @deprecated 0.71 Use get_the_category() 77 * @see get_the_category() 78 * 79 * @param bool $echo Optional. Whether to echo the output. Default true. 80 * @return int Category ID. 81 */ 82 function the_category_ID($echo = true) { 83 _deprecated_function( __FUNCTION__, '0.71', 'get_the_category()' ); 84 85 // Grab the first cat in the list. 86 $categories = get_the_category(); 87 $cat = $categories[0]->term_id; 88 89 if ( $echo ) 90 echo $cat; 91 92 return $cat; 93 } 94 95 /** 96 * Prints a category with optional text before and after. 97 * 98 * @since 0.71 99 * @deprecated 0.71 Use get_the_category_by_ID() 100 * @see get_the_category_by_ID() 101 * 102 * @param string $before Optional. Text to display before the category. Default empty. 103 * @param string $after Optional. Text to display after the category. Default empty. 104 */ 105 function the_category_head( $before = '', $after = '' ) { 106 global $currentcat, $previouscat; 107 108 _deprecated_function( __FUNCTION__, '0.71', 'get_the_category_by_ID()' ); 109 110 // Grab the first cat in the list. 111 $categories = get_the_category(); 112 $currentcat = $categories[0]->category_id; 113 if ( $currentcat != $previouscat ) { 114 echo $before; 115 echo get_the_category_by_ID($currentcat); 116 echo $after; 117 $previouscat = $currentcat; 118 } 119 } 120 121 /** 122 * Prints a link to the previous post. 123 * 124 * @since 1.5.0 125 * @deprecated 2.0.0 Use previous_post_link() 126 * @see previous_post_link() 127 * 128 * @param string $format 129 * @param string $previous 130 * @param string $title 131 * @param string $in_same_cat 132 * @param int $limitprev 133 * @param string $excluded_categories 134 */ 135 function previous_post($format='%', $previous='previous post: ', $title='yes', $in_same_cat='no', $limitprev=1, $excluded_categories='') { 136 137 _deprecated_function( __FUNCTION__, '2.0.0', 'previous_post_link()' ); 138 139 if ( empty($in_same_cat) || 'no' == $in_same_cat ) 140 $in_same_cat = false; 141 else 142 $in_same_cat = true; 143 144 $post = get_previous_post($in_same_cat, $excluded_categories); 145 146 if ( !$post ) 147 return; 148 149 $string = '<a href="'.get_permalink($post->ID).'">'.$previous; 150 if ( 'yes' == $title ) 151 $string .= apply_filters('the_title', $post->post_title, $post->ID); 152 $string .= '</a>'; 153 $format = str_replace('%', $string, $format); 154 echo $format; 155 } 156 157 /** 158 * Prints link to the next post. 159 * 160 * @since 0.71 161 * @deprecated 2.0.0 Use next_post_link() 162 * @see next_post_link() 163 * 164 * @param string $format 165 * @param string $next 166 * @param string $title 167 * @param string $in_same_cat 168 * @param int $limitnext 169 * @param string $excluded_categories 170 */ 171 function next_post($format='%', $next='next post: ', $title='yes', $in_same_cat='no', $limitnext=1, $excluded_categories='') { 172 _deprecated_function( __FUNCTION__, '2.0.0', 'next_post_link()' ); 173 174 if ( empty($in_same_cat) || 'no' == $in_same_cat ) 175 $in_same_cat = false; 176 else 177 $in_same_cat = true; 178 179 $post = get_next_post($in_same_cat, $excluded_categories); 180 181 if ( !$post ) 182 return; 183 184 $string = '<a href="'.get_permalink($post->ID).'">'.$next; 185 if ( 'yes' == $title ) 186 $string .= apply_filters('the_title', $post->post_title, $post->ID); 187 $string .= '</a>'; 188 $format = str_replace('%', $string, $format); 189 echo $format; 190 } 191 192 /** 193 * Whether user can create a post. 194 * 195 * @since 1.5.0 196 * @deprecated 2.0.0 Use current_user_can() 197 * @see current_user_can() 198 * 199 * @param int $user_id 200 * @param int $blog_id Not Used 201 * @param int $category_id Not Used 202 * @return bool 203 */ 204 function user_can_create_post($user_id, $blog_id = 1, $category_id = 'None') { 205 _deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' ); 206 207 $author_data = get_userdata($user_id); 208 return ($author_data->user_level > 1); 209 } 210 211 /** 212 * Whether user can create a post. 213 * 214 * @since 1.5.0 215 * @deprecated 2.0.0 Use current_user_can() 216 * @see current_user_can() 217 * 218 * @param int $user_id 219 * @param int $blog_id Not Used 220 * @param int $category_id Not Used 221 * @return bool 222 */ 223 function user_can_create_draft($user_id, $blog_id = 1, $category_id = 'None') { 224 _deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' ); 225 226 $author_data = get_userdata($user_id); 227 return ($author_data->user_level >= 1); 228 } 229 230 /** 231 * Whether user can edit a post. 232 * 233 * @since 1.5.0 234 * @deprecated 2.0.0 Use current_user_can() 235 * @see current_user_can() 236 * 237 * @param int $user_id 238 * @param int $post_id 239 * @param int $blog_id Not Used 240 * @return bool 241 */ 242 function user_can_edit_post($user_id, $post_id, $blog_id = 1) { 243 _deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' ); 244 245 $author_data = get_userdata($user_id); 246 $post = get_post($post_id); 247 $post_author_data = get_userdata($post->post_author); 248 249 if ( (($user_id == $post_author_data->ID) && !($post->post_status == 'publish' && $author_data->user_level < 2)) 250 || ($author_data->user_level > $post_author_data->user_level) 251 || ($author_data->user_level >= 10) ) { 252 return true; 253 } else { 254 return false; 255 } 256 } 257 258 /** 259 * Whether user can delete a post. 260 * 261 * @since 1.5.0 262 * @deprecated 2.0.0 Use current_user_can() 263 * @see current_user_can() 264 * 265 * @param int $user_id 266 * @param int $post_id 267 * @param int $blog_id Not Used 268 * @return bool 269 */ 270 function user_can_delete_post($user_id, $post_id, $blog_id = 1) { 271 _deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' ); 272 273 // right now if one can edit, one can delete 274 return user_can_edit_post($user_id, $post_id, $blog_id); 275 } 276 277 /** 278 * Whether user can set new posts' dates. 279 * 280 * @since 1.5.0 281 * @deprecated 2.0.0 Use current_user_can() 282 * @see current_user_can() 283 * 284 * @param int $user_id 285 * @param int $blog_id Not Used 286 * @param int $category_id Not Used 287 * @return bool 288 */ 289 function user_can_set_post_date($user_id, $blog_id = 1, $category_id = 'None') { 290 _deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' ); 291 292 $author_data = get_userdata($user_id); 293 return (($author_data->user_level > 4) && user_can_create_post($user_id, $blog_id, $category_id)); 294 } 295 296 /** 297 * Whether user can delete a post. 298 * 299 * @since 1.5.0 300 * @deprecated 2.0.0 Use current_user_can() 301 * @see current_user_can() 302 * 303 * @param int $user_id 304 * @param int $post_id 305 * @param int $blog_id Not Used 306 * @return bool returns true if $user_id can edit $post_id's date 307 */ 308 function user_can_edit_post_date($user_id, $post_id, $blog_id = 1) { 309 _deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' ); 310 311 $author_data = get_userdata($user_id); 312 return (($author_data->user_level > 4) && user_can_edit_post($user_id, $post_id, $blog_id)); 313 } 314 315 /** 316 * Whether user can delete a post. 317 * 318 * @since 1.5.0 319 * @deprecated 2.0.0 Use current_user_can() 320 * @see current_user_can() 321 * 322 * @param int $user_id 323 * @param int $post_id 324 * @param int $blog_id Not Used 325 * @return bool returns true if $user_id can edit $post_id's comments 326 */ 327 function user_can_edit_post_comments($user_id, $post_id, $blog_id = 1) { 328 _deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' ); 329 330 // right now if one can edit a post, one can edit comments made on it 331 return user_can_edit_post($user_id, $post_id, $blog_id); 332 } 333 334 /** 335 * Whether user can delete a post. 336 * 337 * @since 1.5.0 338 * @deprecated 2.0.0 Use current_user_can() 339 * @see current_user_can() 340 * 341 * @param int $user_id 342 * @param int $post_id 343 * @param int $blog_id Not Used 344 * @return bool returns true if $user_id can delete $post_id's comments 345 */ 346 function user_can_delete_post_comments($user_id, $post_id, $blog_id = 1) { 347 _deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' ); 348 349 // right now if one can edit comments, one can delete comments 350 return user_can_edit_post_comments($user_id, $post_id, $blog_id); 351 } 352 353 /** 354 * Can user can edit other user. 355 * 356 * @since 1.5.0 357 * @deprecated 2.0.0 Use current_user_can() 358 * @see current_user_can() 359 * 360 * @param int $user_id 361 * @param int $other_user 362 * @return bool 363 */ 364 function user_can_edit_user($user_id, $other_user) { 365 _deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' ); 366 367 $user = get_userdata($user_id); 368 $other = get_userdata($other_user); 369 if ( $user->user_level > $other->user_level || $user->user_level > 8 || $user->ID == $other->ID ) 370 return true; 371 else 372 return false; 373 } 374 375 /** 376 * Gets the links associated with category $cat_name. 377 * 378 * @since 0.71 379 * @deprecated 2.1.0 Use get_bookmarks() 380 * @see get_bookmarks() 381 * 382 * @param string $cat_name Optional. The category name to use. If no match is found uses all. 383 * @param string $before Optional. The html to output before the link. 384 * @param string $after Optional. The html to output after the link. 385 * @param string $between Optional. The html to output between the link/image and its description. Not used if no image or $show_images is true. 386 * @param bool $show_images Optional. Whether to show images (if defined). 387 * @param string $orderby Optional. The order to output the links. E.g. 'id', 'name', 'url', 'description' or 'rating'. Or maybe owner. 388 * If you start the name with an underscore the order will be reversed. You can also specify 'rand' as the order which will return links in a 389 * random order. 390 * @param bool $show_description Optional. Whether to show the description if show_images=false/not defined. 391 * @param bool $show_rating Optional. Show rating stars/chars. 392 * @param int $limit Optional. Limit to X entries. If not specified, all entries are shown. 393 * @param int $show_updated Optional. Whether to show last updated timestamp 394 */ 395 function get_linksbyname($cat_name = "noname", $before = '', $after = '<br />', $between = " ", $show_images = true, $orderby = 'id', 396 $show_description = true, $show_rating = false, 397 $limit = -1, $show_updated = 0) { 398 _deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' ); 399 400 $cat_id = -1; 401 $cat = get_term_by('name', $cat_name, 'link_category'); 402 if ( $cat ) 403 $cat_id = $cat->term_id; 404 405 get_links($cat_id, $before, $after, $between, $show_images, $orderby, $show_description, $show_rating, $limit, $show_updated); 406 } 407 408 /** 409 * Gets the links associated with the named category. 410 * 411 * @since 1.0.1 412 * @deprecated 2.1.0 Use wp_list_bookmarks() 413 * @see wp_list_bookmarks() 414 * 415 * @param string $category The category to use. 416 * @param string $args 417 * @return string|null 418 */ 419 function wp_get_linksbyname($category, $args = '') { 420 _deprecated_function(__FUNCTION__, '2.1.0', 'wp_list_bookmarks()'); 421 422 $defaults = array( 423 'after' => '<br />', 424 'before' => '', 425 'categorize' => 0, 426 'category_after' => '', 427 'category_before' => '', 428 'category_name' => $category, 429 'show_description' => 1, 430 'title_li' => '', 431 ); 432 433 $parsed_args = wp_parse_args( $args, $defaults ); 434 435 return wp_list_bookmarks($parsed_args); 436 } 437 438 /** 439 * Gets an array of link objects associated with category $cat_name. 440 * 441 * $links = get_linkobjectsbyname( 'fred' ); 442 * foreach ( $links as $link ) { 443 * echo '<li>' . $link->link_name . '</li>'; 444 * } 445 * 446 * @since 1.0.1 447 * @deprecated 2.1.0 Use get_bookmarks() 448 * @see get_bookmarks() 449 * 450 * @param string $cat_name The category name to use. If no match is found uses all. 451 * @param string $orderby The order to output the links. E.g. 'id', 'name', 'url', 'description', or 'rating'. 452 * Or maybe owner. If you start the name with an underscore the order will be reversed. You can also 453 * specify 'rand' as the order which will return links in a random order. 454 * @param int $limit Limit to X entries. If not specified, all entries are shown. 455 * @return array 456 */ 457 function get_linkobjectsbyname($cat_name = "noname" , $orderby = 'name', $limit = -1) { 458 _deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' ); 459 460 $cat_id = -1; 461 $cat = get_term_by('name', $cat_name, 'link_category'); 462 if ( $cat ) 463 $cat_id = $cat->term_id; 464 465 return get_linkobjects($cat_id, $orderby, $limit); 466 } 467 468 /** 469 * Gets an array of link objects associated with category n. 470 * 471 * Usage: 472 * 473 * $links = get_linkobjects(1); 474 * if ($links) { 475 * foreach ($links as $link) { 476 * echo '<li>'.$link->link_name.'<br />'.$link->link_description.'</li>'; 477 * } 478 * } 479 * 480 * Fields are: 481 * 482 * - link_id 483 * - link_url 484 * - link_name 485 * - link_image 486 * - link_target 487 * - link_category 488 * - link_description 489 * - link_visible 490 * - link_owner 491 * - link_rating 492 * - link_updated 493 * - link_rel 494 * - link_notes 495 * 496 * @since 1.0.1 497 * @deprecated 2.1.0 Use get_bookmarks() 498 * @see get_bookmarks() 499 * 500 * @param int $category The category to use. If no category supplied uses all 501 * @param string $orderby the order to output the links. E.g. 'id', 'name', 'url', 502 * 'description', or 'rating'. Or maybe owner. If you start the name with an 503 * underscore the order will be reversed. You can also specify 'rand' as the 504 * order which will return links in a random order. 505 * @param int $limit Limit to X entries. If not specified, all entries are shown. 506 * @return array 507 */ 508 function get_linkobjects($category = 0, $orderby = 'name', $limit = 0) { 509 _deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' ); 510 511 $links = get_bookmarks( array( 'category' => $category, 'orderby' => $orderby, 'limit' => $limit ) ) ; 512 513 $links_array = array(); 514 foreach ($links as $link) 515 $links_array[] = $link; 516 517 return $links_array; 518 } 519 520 /** 521 * Gets the links associated with category 'cat_name' and display rating stars/chars. 522 * 523 * @since 0.71 524 * @deprecated 2.1.0 Use get_bookmarks() 525 * @see get_bookmarks() 526 * 527 * @param string $cat_name The category name to use. If no match is found uses all 528 * @param string $before The html to output before the link 529 * @param string $after The html to output after the link 530 * @param string $between The html to output between the link/image and its description. Not used if no image or show_images is true 531 * @param bool $show_images Whether to show images (if defined). 532 * @param string $orderby the order to output the links. E.g. 'id', 'name', 'url', 533 * 'description', or 'rating'. Or maybe owner. If you start the name with an 534 * underscore the order will be reversed. You can also specify 'rand' as the 535 * order which will return links in a random order. 536 * @param bool $show_description Whether to show the description if show_images=false/not defined 537 * @param int $limit Limit to X entries. If not specified, all entries are shown. 538 * @param int $show_updated Whether to show last updated timestamp 539 */ 540 function get_linksbyname_withrating($cat_name = "noname", $before = '', $after = '<br />', $between = " ", 541 $show_images = true, $orderby = 'id', $show_description = true, $limit = -1, $show_updated = 0) { 542 _deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' ); 543 544 get_linksbyname($cat_name, $before, $after, $between, $show_images, $orderby, $show_description, true, $limit, $show_updated); 545 } 546 547 /** 548 * Gets the links associated with category n and display rating stars/chars. 549 * 550 * @since 0.71 551 * @deprecated 2.1.0 Use get_bookmarks() 552 * @see get_bookmarks() 553 * 554 * @param int $category The category to use. If no category supplied uses all 555 * @param string $before The html to output before the link 556 * @param string $after The html to output after the link 557 * @param string $between The html to output between the link/image and its description. Not used if no image or show_images == true 558 * @param bool $show_images Whether to show images (if defined). 559 * @param string $orderby The order to output the links. E.g. 'id', 'name', 'url', 560 * 'description', or 'rating'. Or maybe owner. If you start the name with an 561 * underscore the order will be reversed. You can also specify 'rand' as the 562 * order which will return links in a random order. 563 * @param bool $show_description Whether to show the description if show_images=false/not defined. 564 * @param int $limit Limit to X entries. If not specified, all entries are shown. 565 * @param int $show_updated Whether to show last updated timestamp 566 */ 567 function get_links_withrating($category = -1, $before = '', $after = '<br />', $between = " ", $show_images = true, 568 $orderby = 'id', $show_description = true, $limit = -1, $show_updated = 0) { 569 _deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' ); 570 571 get_links($category, $before, $after, $between, $show_images, $orderby, $show_description, true, $limit, $show_updated); 572 } 573 574 /** 575 * Gets the auto_toggle setting. 576 * 577 * @since 0.71 578 * @deprecated 2.1.0 579 * 580 * @param int $id The category to get. If no category supplied uses 0 581 * @return int Only returns 0. 582 */ 583 function get_autotoggle($id = 0) { 584 _deprecated_function( __FUNCTION__, '2.1.0' ); 585 return 0; 586 } 587 588 /** 589 * Lists categories. 590 * 591 * @since 0.71 592 * @deprecated 2.1.0 Use wp_list_categories() 593 * @see wp_list_categories() 594 * 595 * @param int $optionall 596 * @param string $all 597 * @param string $sort_column 598 * @param string $sort_order 599 * @param string $file 600 * @param bool $list 601 * @param int $optiondates 602 * @param int $optioncount 603 * @param int $hide_empty 604 * @param int $use_desc_for_title 605 * @param bool $children 606 * @param int $child_of 607 * @param int $categories 608 * @param int $recurse 609 * @param string $feed 610 * @param string $feed_image 611 * @param string $exclude 612 * @param bool $hierarchical 613 * @return false|null 614 */ 615 function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_order = 'asc', $file = '', $list = true, $optiondates = 0, 616 $optioncount = 0, $hide_empty = 1, $use_desc_for_title = 1, $children=false, $child_of=0, $categories=0, 617 $recurse=0, $feed = '', $feed_image = '', $exclude = '', $hierarchical=false) { 618 _deprecated_function( __FUNCTION__, '2.1.0', 'wp_list_categories()' ); 619 620 $query = compact('optionall', 'all', 'sort_column', 'sort_order', 'file', 'list', 'optiondates', 'optioncount', 'hide_empty', 'use_desc_for_title', 'children', 621 'child_of', 'categories', 'recurse', 'feed', 'feed_image', 'exclude', 'hierarchical'); 622 return wp_list_cats($query); 623 } 624 625 /** 626 * Lists categories. 627 * 628 * @since 1.2.0 629 * @deprecated 2.1.0 Use wp_list_categories() 630 * @see wp_list_categories() 631 * 632 * @param string|array $args 633 * @return false|null|string 634 */ 635 function wp_list_cats($args = '') { 636 _deprecated_function( __FUNCTION__, '2.1.0', 'wp_list_categories()' ); 637 638 $parsed_args = wp_parse_args( $args ); 639 640 // Map to new names. 641 if ( isset($parsed_args['optionall']) && isset($parsed_args['all'])) 642 $parsed_args['show_option_all'] = $parsed_args['all']; 643 if ( isset($parsed_args['sort_column']) ) 644 $parsed_args['orderby'] = $parsed_args['sort_column']; 645 if ( isset($parsed_args['sort_order']) ) 646 $parsed_args['order'] = $parsed_args['sort_order']; 647 if ( isset($parsed_args['optiondates']) ) 648 $parsed_args['show_last_update'] = $parsed_args['optiondates']; 649 if ( isset($parsed_args['optioncount']) ) 650 $parsed_args['show_count'] = $parsed_args['optioncount']; 651 if ( isset($parsed_args['list']) ) 652 $parsed_args['style'] = $parsed_args['list'] ? 'list' : 'break'; 653 $parsed_args['title_li'] = ''; 654 655 return wp_list_categories($parsed_args); 656 } 657 658 /** 659 * Deprecated method for generating a drop-down of categories. 660 * 661 * @since 0.71 662 * @deprecated 2.1.0 Use wp_dropdown_categories() 663 * @see wp_dropdown_categories() 664 * 665 * @param int $optionall 666 * @param string $all 667 * @param string $orderby 668 * @param string $order 669 * @param int $show_last_update 670 * @param int $show_count 671 * @param int $hide_empty 672 * @param bool $optionnone 673 * @param int $selected 674 * @param int $exclude 675 * @return string 676 */ 677 function dropdown_cats($optionall = 1, $all = 'All', $orderby = 'ID', $order = 'asc', 678 $show_last_update = 0, $show_count = 0, $hide_empty = 1, $optionnone = false, 679 $selected = 0, $exclude = 0) { 680 _deprecated_function( __FUNCTION__, '2.1.0', 'wp_dropdown_categories()' ); 681 682 $show_option_all = ''; 683 if ( $optionall ) 684 $show_option_all = $all; 685 686 $show_option_none = ''; 687 if ( $optionnone ) 688 $show_option_none = __('None'); 689 690 $vars = compact('show_option_all', 'show_option_none', 'orderby', 'order', 691 'show_last_update', 'show_count', 'hide_empty', 'selected', 'exclude'); 692 $query = add_query_arg($vars, ''); 693 return wp_dropdown_categories($query); 694 } 695 696 /** 697 * Lists authors. 698 * 699 * @since 1.2.0 700 * @deprecated 2.1.0 Use wp_list_authors() 701 * @see wp_list_authors() 702 * 703 * @param bool $optioncount 704 * @param bool $exclude_admin 705 * @param bool $show_fullname 706 * @param bool $hide_empty 707 * @param string $feed 708 * @param string $feed_image 709 * @return null|string 710 */ 711 function list_authors($optioncount = false, $exclude_admin = true, $show_fullname = false, $hide_empty = true, $feed = '', $feed_image = '') { 712 _deprecated_function( __FUNCTION__, '2.1.0', 'wp_list_authors()' ); 713 714 $args = compact('optioncount', 'exclude_admin', 'show_fullname', 'hide_empty', 'feed', 'feed_image'); 715 return wp_list_authors($args); 716 } 717 718 /** 719 * Retrieves a list of post categories. 720 * 721 * @since 1.0.1 722 * @deprecated 2.1.0 Use wp_get_post_categories() 723 * @see wp_get_post_categories() 724 * 725 * @param int $blogid Not Used 726 * @param int $post_ID 727 * @return array 728 */ 729 function wp_get_post_cats($blogid = '1', $post_ID = 0) { 730 _deprecated_function( __FUNCTION__, '2.1.0', 'wp_get_post_categories()' ); 731 return wp_get_post_categories($post_ID); 732 } 733 734 /** 735 * Sets the categories that the post id belongs to. 736 * 737 * @since 1.0.1 738 * @deprecated 2.1.0 739 * @deprecated Use wp_set_post_categories() 740 * @see wp_set_post_categories() 741 * 742 * @param int $blogid Not used 743 * @param int $post_ID 744 * @param array $post_categories 745 * @return bool|mixed 746 */ 747 function wp_set_post_cats($blogid = '1', $post_ID = 0, $post_categories = array()) { 748 _deprecated_function( __FUNCTION__, '2.1.0', 'wp_set_post_categories()' ); 749 return wp_set_post_categories($post_ID, $post_categories); 750 } 751 752 /** 753 * Retrieves a list of archives. 754 * 755 * @since 0.71 756 * @deprecated 2.1.0 Use wp_get_archives() 757 * @see wp_get_archives() 758 * 759 * @param string $type 760 * @param string $limit 761 * @param string $format 762 * @param string $before 763 * @param string $after 764 * @param bool $show_post_count 765 * @return string|null 766 */ 767 function get_archives($type='', $limit='', $format='html', $before = '', $after = '', $show_post_count = false) { 768 _deprecated_function( __FUNCTION__, '2.1.0', 'wp_get_archives()' ); 769 $args = compact('type', 'limit', 'format', 'before', 'after', 'show_post_count'); 770 return wp_get_archives($args); 771 } 772 773 /** 774 * Returns or Prints link to the author's posts. 775 * 776 * @since 1.2.0 777 * @deprecated 2.1.0 Use get_author_posts_url() 778 * @see get_author_posts_url() 779 * 780 * @param bool $echo 781 * @param int $author_id 782 * @param string $author_nicename Optional. 783 * @return string|null 784 */ 785 function get_author_link($echo, $author_id, $author_nicename = '') { 786 _deprecated_function( __FUNCTION__, '2.1.0', 'get_author_posts_url()' ); 787 788 $link = get_author_posts_url($author_id, $author_nicename); 789 790 if ( $echo ) 791 echo $link; 792 return $link; 793 } 794 795 /** 796 * Print list of pages based on arguments. 797 * 798 * @since 0.71 799 * @deprecated 2.1.0 Use wp_link_pages() 800 * @see wp_link_pages() 801 * 802 * @param string $before 803 * @param string $after 804 * @param string $next_or_number 805 * @param string $nextpagelink 806 * @param string $previouspagelink 807 * @param string $pagelink 808 * @param string $more_file 809 * @return string 810 */ 811 function link_pages($before='<br />', $after='<br />', $next_or_number='number', $nextpagelink='next page', $previouspagelink='previous page', 812 $pagelink='%', $more_file='') { 813 _deprecated_function( __FUNCTION__, '2.1.0', 'wp_link_pages()' ); 814 815 $args = compact('before', 'after', 'next_or_number', 'nextpagelink', 'previouspagelink', 'pagelink', 'more_file'); 816 return wp_link_pages($args); 817 } 818 819 /** 820 * Get value based on option. 821 * 822 * @since 0.71 823 * @deprecated 2.1.0 Use get_option() 824 * @see get_option() 825 * 826 * @param string $option 827 * @return string 828 */ 829 function get_settings($option) { 830 _deprecated_function( __FUNCTION__, '2.1.0', 'get_option()' ); 831 832 return get_option($option); 833 } 834 835 /** 836 * Print the permalink of the current post in the loop. 837 * 838 * @since 0.71 839 * @deprecated 1.2.0 Use the_permalink() 840 * @see the_permalink() 841 */ 842 function permalink_link() { 843 _deprecated_function( __FUNCTION__, '1.2.0', 'the_permalink()' ); 844 the_permalink(); 845 } 846 847 /** 848 * Print the permalink to the RSS feed. 849 * 850 * @since 0.71 851 * @deprecated 2.3.0 Use the_permalink_rss() 852 * @see the_permalink_rss() 853 * 854 * @param string $deprecated 855 */ 856 function permalink_single_rss($deprecated = '') { 857 _deprecated_function( __FUNCTION__, '2.3.0', 'the_permalink_rss()' ); 858 the_permalink_rss(); 859 } 860 861 /** 862 * Gets the links associated with category. 863 * 864 * @since 1.0.1 865 * @deprecated 2.1.0 Use wp_list_bookmarks() 866 * @see wp_list_bookmarks() 867 * 868 * @param string $args a query string 869 * @return null|string 870 */ 871 function wp_get_links($args = '') { 872 _deprecated_function( __FUNCTION__, '2.1.0', 'wp_list_bookmarks()' ); 873 874 if ( strpos( $args, '=' ) === false ) { 875 $cat_id = $args; 876 $args = add_query_arg( 'category', $cat_id, $args ); 877 } 878 879 $defaults = array( 880 'after' => '<br />', 881 'before' => '', 882 'between' => ' ', 883 'categorize' => 0, 884 'category' => '', 885 'echo' => true, 886 'limit' => -1, 887 'orderby' => 'name', 888 'show_description' => true, 889 'show_images' => true, 890 'show_rating' => false, 891 'show_updated' => true, 892 'title_li' => '', 893 ); 894 895 $parsed_args = wp_parse_args( $args, $defaults ); 896 897 return wp_list_bookmarks($parsed_args); 898 } 899 900 /** 901 * Gets the links associated with category by id. 902 * 903 * @since 0.71 904 * @deprecated 2.1.0 Use get_bookmarks() 905 * @see get_bookmarks() 906 * 907 * @param int $category The category to use. If no category supplied uses all 908 * @param string $before the html to output before the link 909 * @param string $after the html to output after the link 910 * @param string $between the html to output between the link/image and its description. 911 * Not used if no image or show_images == true 912 * @param bool $show_images whether to show images (if defined). 913 * @param string $orderby the order to output the links. E.g. 'id', 'name', 'url', 914 * 'description', or 'rating'. Or maybe owner. If you start the name with an 915 * underscore the order will be reversed. You can also specify 'rand' as the order 916 * which will return links in a random order. 917 * @param bool $show_description whether to show the description if show_images=false/not defined. 918 * @param bool $show_rating show rating stars/chars 919 * @param int $limit Limit to X entries. If not specified, all entries are shown. 920 * @param int $show_updated whether to show last updated timestamp 921 * @param bool $echo whether to echo the results, or return them instead 922 * @return null|string 923 */ 924 function get_links($category = -1, $before = '', $after = '<br />', $between = ' ', $show_images = true, $orderby = 'name', 925 $show_description = true, $show_rating = false, $limit = -1, $show_updated = 1, $echo = true) { 926 _deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' ); 927 928 $order = 'ASC'; 929 if ( substr($orderby, 0, 1) == '_' ) { 930 $order = 'DESC'; 931 $orderby = substr($orderby, 1); 932 } 933 934 if ( $category == -1 ) //get_bookmarks uses '' to signify all categories 935 $category = ''; 936 937 $results = get_bookmarks(array('category' => $category, 'orderby' => $orderby, 'order' => $order, 'show_updated' => $show_updated, 'limit' => $limit)); 938 939 if ( !$results ) 940 return; 941 942 $output = ''; 943 944 foreach ( (array) $results as $row ) { 945 if ( !isset($row->recently_updated) ) 946 $row->recently_updated = false; 947 $output .= $before; 948 if ( $show_updated && $row->recently_updated ) 949 $output .= get_option('links_recently_updated_prepend'); 950 $the_link = '#'; 951 if ( !empty($row->link_url) ) 952 $the_link = esc_url($row->link_url); 953 $rel = $row->link_rel; 954 if ( '' != $rel ) 955 $rel = ' rel="' . $rel . '"'; 956 957 $desc = esc_attr(sanitize_bookmark_field('link_description', $row->link_description, $row->link_id, 'display')); 958 $name = esc_attr(sanitize_bookmark_field('link_name', $row->link_name, $row->link_id, 'display')); 959 $title = $desc; 960 961 if ( $show_updated ) 962 if (substr($row->link_updated_f, 0, 2) != '00') 963 $title .= ' ('.__('Last updated') . ' ' . gmdate(get_option('links_updated_date_format'), $row->link_updated_f + (get_option('gmt_offset') * HOUR_IN_SECONDS)) . ')'; 964 965 if ( '' != $title ) 966 $title = ' title="' . $title . '"'; 967 968 $alt = ' alt="' . $name . '"'; 969 970 $target = $row->link_target; 971 if ( '' != $target ) 972 $target = ' target="' . $target . '"'; 973 974 $output .= '<a href="' . $the_link . '"' . $rel . $title . $target. '>'; 975 976 if ( $row->link_image != null && $show_images ) { 977 if ( strpos($row->link_image, 'http') !== false ) 978 $output .= "<img src=\"$row->link_image\" $alt $title />"; 979 else // If it's a relative path 980 $output .= "<img src=\"" . get_option('siteurl') . "$row->link_image\" $alt $title />"; 981 } else { 982 $output .= $name; 983 } 984 985 $output .= '</a>'; 986 987 if ( $show_updated && $row->recently_updated ) 988 $output .= get_option('links_recently_updated_append'); 989 990 if ( $show_description && '' != $desc ) 991 $output .= $between . $desc; 992 993 if ($show_rating) { 994 $output .= $between . get_linkrating($row); 995 } 996 997 $output .= "$after\n"; 998 } // end while 999 1000 if ( !$echo ) 1001 return $output; 1002 echo $output; 1003 } 1004 1005 /** 1006 * Output entire list of links by category. 1007 * 1008 * Output a list of all links, listed by category, using the settings in 1009 * $wpdb->linkcategories and output it as a nested HTML unordered list. 1010 * 1011 * @since 1.0.1 1012 * @deprecated 2.1.0 Use wp_list_bookmarks() 1013 * @see wp_list_bookmarks() 1014 * 1015 * @param string $order Sort link categories by 'name' or 'id' 1016 */ 1017 function get_links_list($order = 'name') { 1018 _deprecated_function( __FUNCTION__, '2.1.0', 'wp_list_bookmarks()' ); 1019 1020 $order = strtolower($order); 1021 1022 // Handle link category sorting 1023 $direction = 'ASC'; 1024 if ( '_' == substr($order,0,1) ) { 1025 $direction = 'DESC'; 1026 $order = substr($order,1); 1027 } 1028 1029 if ( !isset($direction) ) 1030 $direction = ''; 1031 1032 $cats = get_categories(array('type' => 'link', 'orderby' => $order, 'order' => $direction, 'hierarchical' => 0)); 1033 1034 // Display each category 1035 if ( $cats ) { 1036 foreach ( (array) $cats as $cat ) { 1037 // Handle each category. 1038 1039 // Display the category name 1040 echo ' <li id="linkcat-' . $cat->term_id . '" class="linkcat"><h2>' . apply_filters('link_category', $cat->name ) . "</h2>\n\t<ul>\n"; 1041 // Call get_links() with all the appropriate params 1042 get_links($cat->term_id, '<li>', "</li>", "\n", true, 'name', false); 1043 1044 // Close the last category 1045 echo "\n\t</ul>\n</li>\n"; 1046 } 1047 } 1048 } 1049 1050 /** 1051 * Show the link to the links popup and the number of links. 1052 * 1053 * @since 0.71 1054 * @deprecated 2.1.0 1055 * 1056 * @param string $text the text of the link 1057 * @param int $width the width of the popup window 1058 * @param int $height the height of the popup window 1059 * @param string $file the page to open in the popup window 1060 * @param bool $count the number of links in the db 1061 */ 1062 function links_popup_script($text = 'Links', $width=400, $height=400, $file='links.all.php', $count = true) { 1063 _deprecated_function( __FUNCTION__, '2.1.0' ); 1064 } 1065 1066 /** 1067 * Legacy function that retrieved the value of a link's link_rating field. 1068 * 1069 * @since 1.0.1 1070 * @deprecated 2.1.0 Use sanitize_bookmark_field() 1071 * @see sanitize_bookmark_field() 1072 * 1073 * @param object $link Link object. 1074 * @return mixed Value of the 'link_rating' field, false otherwise. 1075 */ 1076 function get_linkrating( $link ) { 1077 _deprecated_function( __FUNCTION__, '2.1.0', 'sanitize_bookmark_field()' ); 1078 return sanitize_bookmark_field('link_rating', $link->link_rating, $link->link_id, 'display'); 1079 } 1080 1081 /** 1082 * Gets the name of category by id. 1083 * 1084 * @since 0.71 1085 * @deprecated 2.1.0 Use get_category() 1086 * @see get_category() 1087 * 1088 * @param int $id The category to get. If no category supplied uses 0 1089 * @return string 1090 */ 1091 function get_linkcatname($id = 0) { 1092 _deprecated_function( __FUNCTION__, '2.1.0', 'get_category()' ); 1093 1094 $id = (int) $id; 1095 1096 if ( empty($id) ) 1097 return ''; 1098 1099 $cats = wp_get_link_cats($id); 1100 1101 if ( empty($cats) || ! is_array($cats) ) 1102 return ''; 1103 1104 $cat_id = (int) $cats[0]; // Take the first cat. 1105 1106 $cat = get_category($cat_id); 1107 return $cat->name; 1108 } 1109 1110 /** 1111 * Print RSS comment feed link. 1112 * 1113 * @since 1.0.1 1114 * @deprecated 2.5.0 Use post_comments_feed_link() 1115 * @see post_comments_feed_link() 1116 * 1117 * @param string $link_text 1118 */ 1119 function comments_rss_link($link_text = 'Comments RSS') { 1120 _deprecated_function( __FUNCTION__, '2.5.0', 'post_comments_feed_link()' ); 1121 post_comments_feed_link($link_text); 1122 } 1123 1124 /** 1125 * Print/Return link to category RSS2 feed. 1126 * 1127 * @since 1.2.0 1128 * @deprecated 2.5.0 Use get_category_feed_link() 1129 * @see get_category_feed_link() 1130 * 1131 * @param bool $echo 1132 * @param int $cat_ID 1133 * @return string 1134 */ 1135 function get_category_rss_link($echo = false, $cat_ID = 1) { 1136 _deprecated_function( __FUNCTION__, '2.5.0', 'get_category_feed_link()' ); 1137 1138 $link = get_category_feed_link($cat_ID, 'rss2'); 1139 1140 if ( $echo ) 1141 echo $link; 1142 return $link; 1143 } 1144 1145 /** 1146 * Print/Return link to author RSS feed. 1147 * 1148 * @since 1.2.0 1149 * @deprecated 2.5.0 Use get_author_feed_link() 1150 * @see get_author_feed_link() 1151 * 1152 * @param bool $echo 1153 * @param int $author_id 1154 * @return string 1155 */ 1156 function get_author_rss_link($echo = false, $author_id = 1) { 1157 _deprecated_function( __FUNCTION__, '2.5.0', 'get_author_feed_link()' ); 1158 1159 $link = get_author_feed_link($author_id); 1160 if ( $echo ) 1161 echo $link; 1162 return $link; 1163 } 1164 1165 /** 1166 * Return link to the post RSS feed. 1167 * 1168 * @since 1.5.0 1169 * @deprecated 2.2.0 Use get_post_comments_feed_link() 1170 * @see get_post_comments_feed_link() 1171 * 1172 * @return string 1173 */ 1174 function comments_rss() { 1175 _deprecated_function( __FUNCTION__, '2.2.0', 'get_post_comments_feed_link()' ); 1176 return esc_url( get_post_comments_feed_link() ); 1177 } 1178 1179 /** 1180 * An alias of wp_create_user(). 1181 * 1182 * @since 2.0.0 1183 * @deprecated 2.0.0 Use wp_create_user() 1184 * @see wp_create_user() 1185 * 1186 * @param string $username The user's username. 1187 * @param string $password The user's password. 1188 * @param string $email The user's email. 1189 * @return int The new user's ID. 1190 */ 1191 function create_user($username, $password, $email) { 1192 _deprecated_function( __FUNCTION__, '2.0.0', 'wp_create_user()' ); 1193 return wp_create_user($username, $password, $email); 1194 } 1195 1196 /** 1197 * Unused function. 1198 * 1199 * @deprecated 2.5.0 1200 */ 1201 function gzip_compression() { 1202 _deprecated_function( __FUNCTION__, '2.5.0' ); 1203 return false; 1204 } 1205 1206 /** 1207 * Retrieve an array of comment data about comment $comment_ID. 1208 * 1209 * @since 0.71 1210 * @deprecated 2.7.0 Use get_comment() 1211 * @see get_comment() 1212 * 1213 * @param int $comment_ID The ID of the comment 1214 * @param int $no_cache Whether to use the cache (cast to bool) 1215 * @param bool $include_unapproved Whether to include unapproved comments 1216 * @return array The comment data 1217 */ 1218 function get_commentdata( $comment_ID, $no_cache = 0, $include_unapproved = false ) { 1219 _deprecated_function( __FUNCTION__, '2.7.0', 'get_comment()' ); 1220 return get_comment($comment_ID, ARRAY_A); 1221 } 1222 1223 /** 1224 * Retrieve the category name by the category ID. 1225 * 1226 * @since 0.71 1227 * @deprecated 2.8.0 Use get_cat_name() 1228 * @see get_cat_name() 1229 * 1230 * @param int $cat_ID Category ID 1231 * @return string category name 1232 */ 1233 function get_catname( $cat_ID ) { 1234 _deprecated_function( __FUNCTION__, '2.8.0', 'get_cat_name()' ); 1235 return get_cat_name( $cat_ID ); 1236 } 1237 1238 /** 1239 * Retrieve category children list separated before and after the term IDs. 1240 * 1241 * @since 1.2.0 1242 * @deprecated 2.8.0 Use get_term_children() 1243 * @see get_term_children() 1244 * 1245 * @param int $id Category ID to retrieve children. 1246 * @param string $before Optional. Prepend before category term ID. 1247 * @param string $after Optional, default is empty string. Append after category term ID. 1248 * @param array $visited Optional. Category Term IDs that have already been added. 1249 * @return string 1250 */ 1251 function get_category_children( $id, $before = '/', $after = '', $visited = array() ) { 1252 _deprecated_function( __FUNCTION__, '2.8.0', 'get_term_children()' ); 1253 if ( 0 == $id ) 1254 return ''; 1255 1256 $chain = ''; 1257 /** TODO: consult hierarchy */ 1258 $cat_ids = get_all_category_ids(); 1259 foreach ( (array) $cat_ids as $cat_id ) { 1260 if ( $cat_id == $id ) 1261 continue; 1262 1263 $category = get_category( $cat_id ); 1264 if ( is_wp_error( $category ) ) 1265 return $category; 1266 if ( $category->parent == $id && !in_array( $category->term_id, $visited ) ) { 1267 $visited[] = $category->term_id; 1268 $chain .= $before.$category->term_id.$after; 1269 $chain .= get_category_children( $category->term_id, $before, $after ); 1270 } 1271 } 1272 return $chain; 1273 } 1274 1275 /** 1276 * Retrieves all category IDs. 1277 * 1278 * @since 2.0.0 1279 * @deprecated 4.0.0 Use get_terms() 1280 * @see get_terms() 1281 * 1282 * @link https://developer.wordpress.org/reference/functions/get_all_category_ids/ 1283 * 1284 * @return object List of all of the category IDs. 1285 */ 1286 function get_all_category_ids() { 1287 _deprecated_function( __FUNCTION__, '4.0.0', 'get_terms()' ); 1288 1289 if ( ! $cat_ids = wp_cache_get( 'all_category_ids', 'category' ) ) { 1290 $cat_ids = get_terms( 1291 array( 1292 'taxonomy' => 'category', 1293 'fields' => 'ids', 1294 'get' => 'all', 1295 ) 1296 ); 1297 wp_cache_add( 'all_category_ids', $cat_ids, 'category' ); 1298 } 1299 1300 return $cat_ids; 1301 } 1302 1303 /** 1304 * Retrieve the description of the author of the current post. 1305 * 1306 * @since 1.5.0 1307 * @deprecated 2.8.0 Use get_the_author_meta() 1308 * @see get_the_author_meta() 1309 * 1310 * @return string The author's description. 1311 */ 1312 function get_the_author_description() { 1313 _deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'description\')' ); 1314 return get_the_author_meta('description'); 1315 } 1316 1317 /** 1318 * Display the description of the author of the current post. 1319 * 1320 * @since 1.0.0 1321 * @deprecated 2.8.0 Use the_author_meta() 1322 * @see the_author_meta() 1323 */ 1324 function the_author_description() { 1325 _deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'description\')' ); 1326 the_author_meta('description'); 1327 } 1328 1329 /** 1330 * Retrieve the login name of the author of the current post. 1331 * 1332 * @since 1.5.0 1333 * @deprecated 2.8.0 Use get_the_author_meta() 1334 * @see get_the_author_meta() 1335 * 1336 * @return string The author's login name (username). 1337 */ 1338 function get_the_author_login() { 1339 _deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'login\')' ); 1340 return get_the_author_meta('login'); 1341 } 1342 1343 /** 1344 * Display the login name of the author of the current post. 1345 * 1346 * @since 0.71 1347 * @deprecated 2.8.0 Use the_author_meta() 1348 * @see the_author_meta() 1349 */ 1350 function the_author_login() { 1351 _deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'login\')' ); 1352 the_author_meta('login'); 1353 } 1354 1355 /** 1356 * Retrieve the first name of the author of the current post. 1357 * 1358 * @since 1.5.0 1359 * @deprecated 2.8.0 Use get_the_author_meta() 1360 * @see get_the_author_meta() 1361 * 1362 * @return string The author's first name. 1363 */ 1364 function get_the_author_firstname() { 1365 _deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'first_name\')' ); 1366 return get_the_author_meta('first_name'); 1367 } 1368 1369 /** 1370 * Display the first name of the author of the current post. 1371 * 1372 * @since 0.71 1373 * @deprecated 2.8.0 Use the_author_meta() 1374 * @see the_author_meta() 1375 */ 1376 function the_author_firstname() { 1377 _deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'first_name\')' ); 1378 the_author_meta('first_name'); 1379 } 1380 1381 /** 1382 * Retrieve the last name of the author of the current post. 1383 * 1384 * @since 1.5.0 1385 * @deprecated 2.8.0 Use get_the_author_meta() 1386 * @see get_the_author_meta() 1387 * 1388 * @return string The author's last name. 1389 */ 1390 function get_the_author_lastname() { 1391 _deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'last_name\')' ); 1392 return get_the_author_meta('last_name'); 1393 } 1394 1395 /** 1396 * Display the last name of the author of the current post. 1397 * 1398 * @since 0.71 1399 * @deprecated 2.8.0 Use the_author_meta() 1400 * @see the_author_meta() 1401 */ 1402 function the_author_lastname() { 1403 _deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'last_name\')' ); 1404 the_author_meta('last_name'); 1405 } 1406 1407 /** 1408 * Retrieve the nickname of the author of the current post. 1409 * 1410 * @since 1.5.0 1411 * @deprecated 2.8.0 Use get_the_author_meta() 1412 * @see get_the_author_meta() 1413 * 1414 * @return string The author's nickname. 1415 */ 1416 function get_the_author_nickname() { 1417 _deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'nickname\')' ); 1418 return get_the_author_meta('nickname'); 1419 } 1420 1421 /** 1422 * Display the nickname of the author of the current post. 1423 * 1424 * @since 0.71 1425 * @deprecated 2.8.0 Use the_author_meta() 1426 * @see the_author_meta() 1427 */ 1428 function the_author_nickname() { 1429 _deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'nickname\')' ); 1430 the_author_meta('nickname'); 1431 } 1432 1433 /** 1434 * Retrieve the email of the author of the current post. 1435 * 1436 * @since 1.5.0 1437 * @deprecated 2.8.0 Use get_the_author_meta() 1438 * @see get_the_author_meta() 1439 * 1440 * @return string The author's username. 1441 */ 1442 function get_the_author_email() { 1443 _deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'email\')' ); 1444 return get_the_author_meta('email'); 1445 } 1446 1447 /** 1448 * Display the email of the author of the current post. 1449 * 1450 * @since 0.71 1451 * @deprecated 2.8.0 Use the_author_meta() 1452 * @see the_author_meta() 1453 */ 1454 function the_author_email() { 1455 _deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'email\')' ); 1456 the_author_meta('email'); 1457 } 1458 1459 /** 1460 * Retrieve the ICQ number of the author of the current post. 1461 * 1462 * @since 1.5.0 1463 * @deprecated 2.8.0 Use get_the_author_meta() 1464 * @see get_the_author_meta() 1465 * 1466 * @return string The author's ICQ number. 1467 */ 1468 function get_the_author_icq() { 1469 _deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'icq\')' ); 1470 return get_the_author_meta('icq'); 1471 } 1472 1473 /** 1474 * Display the ICQ number of the author of the current post. 1475 * 1476 * @since 0.71 1477 * @deprecated 2.8.0 Use the_author_meta() 1478 * @see the_author_meta() 1479 */ 1480 function the_author_icq() { 1481 _deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'icq\')' ); 1482 the_author_meta('icq'); 1483 } 1484 1485 /** 1486 * Retrieve the Yahoo! IM name of the author of the current post. 1487 * 1488 * @since 1.5.0 1489 * @deprecated 2.8.0 Use get_the_author_meta() 1490 * @see get_the_author_meta() 1491 * 1492 * @return string The author's Yahoo! IM name. 1493 */ 1494 function get_the_author_yim() { 1495 _deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'yim\')' ); 1496 return get_the_author_meta('yim'); 1497 } 1498 1499 /** 1500 * Display the Yahoo! IM name of the author of the current post. 1501 * 1502 * @since 0.71 1503 * @deprecated 2.8.0 Use the_author_meta() 1504 * @see the_author_meta() 1505 */ 1506 function the_author_yim() { 1507 _deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'yim\')' ); 1508 the_author_meta('yim'); 1509 } 1510 1511 /** 1512 * Retrieve the MSN address of the author of the current post. 1513 * 1514 * @since 1.5.0 1515 * @deprecated 2.8.0 Use get_the_author_meta() 1516 * @see get_the_author_meta() 1517 * 1518 * @return string The author's MSN address. 1519 */ 1520 function get_the_author_msn() { 1521 _deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'msn\')' ); 1522 return get_the_author_meta('msn'); 1523 } 1524 1525 /** 1526 * Display the MSN address of the author of the current post. 1527 * 1528 * @since 0.71 1529 * @deprecated 2.8.0 Use the_author_meta() 1530 * @see the_author_meta() 1531 */ 1532 function the_author_msn() { 1533 _deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'msn\')' ); 1534 the_author_meta('msn'); 1535 } 1536 1537 /** 1538 * Retrieve the AIM address of the author of the current post. 1539 * 1540 * @since 1.5.0 1541 * @deprecated 2.8.0 Use get_the_author_meta() 1542 * @see get_the_author_meta() 1543 * 1544 * @return string The author's AIM address. 1545 */ 1546 function get_the_author_aim() { 1547 _deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'aim\')' ); 1548 return get_the_author_meta('aim'); 1549 } 1550 1551 /** 1552 * Display the AIM address of the author of the current post. 1553 * 1554 * @since 0.71 1555 * @deprecated 2.8.0 Use the_author_meta('aim') 1556 * @see the_author_meta() 1557 */ 1558 function the_author_aim() { 1559 _deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'aim\')' ); 1560 the_author_meta('aim'); 1561 } 1562 1563 /** 1564 * Retrieve the specified author's preferred display name. 1565 * 1566 * @since 1.0.0 1567 * @deprecated 2.8.0 Use get_the_author_meta() 1568 * @see get_the_author_meta() 1569 * 1570 * @param int $auth_id The ID of the author. 1571 * @return string The author's display name. 1572 */ 1573 function get_author_name( $auth_id = false ) { 1574 _deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'display_name\')' ); 1575 return get_the_author_meta('display_name', $auth_id); 1576 } 1577 1578 /** 1579 * Retrieve the URL to the home page of the author of the current post. 1580 * 1581 * @since 1.5.0 1582 * @deprecated 2.8.0 Use get_the_author_meta() 1583 * @see get_the_author_meta() 1584 * 1585 * @return string The URL to the author's page. 1586 */ 1587 function get_the_author_url() { 1588 _deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'url\')' ); 1589 return get_the_author_meta('url'); 1590 } 1591 1592 /** 1593 * Display the URL to the home page of the author of the current post. 1594 * 1595 * @since 0.71 1596 * @deprecated 2.8.0 Use the_author_meta() 1597 * @see the_author_meta() 1598 */ 1599 function the_author_url() { 1600 _deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'url\')' ); 1601 the_author_meta('url'); 1602 } 1603 1604 /** 1605 * Retrieve the ID of the author of the current post. 1606 * 1607 * @since 1.5.0 1608 * @deprecated 2.8.0 Use get_the_author_meta() 1609 * @see get_the_author_meta() 1610 * 1611 * @return string|int The author's ID. 1612 */ 1613 function get_the_author_ID() { 1614 _deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'ID\')' ); 1615 return get_the_author_meta('ID'); 1616 } 1617 1618 /** 1619 * Display the ID of the author of the current post. 1620 * 1621 * @since 0.71 1622 * @deprecated 2.8.0 Use the_author_meta() 1623 * @see the_author_meta() 1624 */ 1625 function the_author_ID() { 1626 _deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'ID\')' ); 1627 the_author_meta('ID'); 1628 } 1629 1630 /** 1631 * Display the post content for the feed. 1632 * 1633 * For encoding the html or the $encode_html parameter, there are three possible 1634 * values. '0' will make urls footnotes and use make_url_footnote(). '1' will 1635 * encode special characters and automatically display all of the content. The 1636 * value of '2' will strip all HTML tags from the content. 1637 * 1638 * Also note that you cannot set the amount of words and not set the html 1639 * encoding. If that is the case, then the html encoding will default to 2, 1640 * which will strip all HTML tags. 1641 * 1642 * To restrict the amount of words of the content, you can use the cut 1643 * parameter. If the content is less than the amount, then there won't be any 1644 * dots added to the end. If there is content left over, then dots will be added 1645 * and the rest of the content will be removed. 1646 * 1647 * @since 0.71 1648 * 1649 * @deprecated 2.9.0 Use the_content_feed() 1650 * @see the_content_feed() 1651 * 1652 * @param string $more_link_text Optional. Text to display when more content is available but not displayed. 1653 * @param int $stripteaser Optional. Default is 0. 1654 * @param string $more_file Optional. 1655 * @param int $cut Optional. Amount of words to keep for the content. 1656 * @param int $encode_html Optional. How to encode the content. 1657 */ 1658 function the_content_rss($more_link_text='(more...)', $stripteaser=0, $more_file='', $cut = 0, $encode_html = 0) { 1659 _deprecated_function( __FUNCTION__, '2.9.0', 'the_content_feed()' ); 1660 $content = get_the_content($more_link_text, $stripteaser); 1661 1662 /** 1663 * Filters the post content in the context of an RSS feed. 1664 * 1665 * @since 0.71 1666 * 1667 * @param string $content Content of the current post. 1668 */ 1669 $content = apply_filters('the_content_rss', $content); 1670 if ( $cut && !$encode_html ) 1671 $encode_html = 2; 1672 if ( 1== $encode_html ) { 1673 $content = esc_html($content); 1674 $cut = 0; 1675 } elseif ( 0 == $encode_html ) { 1676 $content = make_url_footnote($content); 1677 } elseif ( 2 == $encode_html ) { 1678 $content = strip_tags($content); 1679 } 1680 if ( $cut ) { 1681 $blah = explode(' ', $content); 1682 if ( count($blah) > $cut ) { 1683 $k = $cut; 1684 $use_dotdotdot = 1; 1685 } else { 1686 $k = count($blah); 1687 $use_dotdotdot = 0; 1688 } 1689 1690 /** @todo Check performance, might be faster to use array slice instead. */ 1691 for ( $i=0; $i<$k; $i++ ) 1692 $excerpt .= $blah[$i].' '; 1693 $excerpt .= ($use_dotdotdot) ? '...' : ''; 1694 $content = $excerpt; 1695 } 1696 $content = str_replace(']]>', ']]>', $content); 1697 echo $content; 1698 } 1699 1700 /** 1701 * Strip HTML and put links at the bottom of stripped content. 1702 * 1703 * Searches for all of the links, strips them out of the content, and places 1704 * them at the bottom of the content with numbers. 1705 * 1706 * @since 0.71 1707 * @deprecated 2.9.0 1708 * 1709 * @param string $content Content to get links 1710 * @return string HTML stripped out of content with links at the bottom. 1711 */ 1712 function make_url_footnote( $content ) { 1713 _deprecated_function( __FUNCTION__, '2.9.0', '' ); 1714 preg_match_all( '/<a(.+?)href=\"(.+?)\"(.*?)>(.+?)<\/a>/', $content, $matches ); 1715 $links_summary = "\n"; 1716 for ( $i = 0, $c = count( $matches[0] ); $i < $c; $i++ ) { 1717 $link_match = $matches[0][$i]; 1718 $link_number = '['.($i+1).']'; 1719 $link_url = $matches[2][$i]; 1720 $link_text = $matches[4][$i]; 1721 $content = str_replace( $link_match, $link_text . ' ' . $link_number, $content ); 1722 $link_url = ( ( strtolower( substr( $link_url, 0, 7 ) ) != 'http://' ) && ( strtolower( substr( $link_url, 0, 8 ) ) != 'https://' ) ) ? get_option( 'home' ) . $link_url : $link_url; 1723 $links_summary .= "\n" . $link_number . ' ' . $link_url; 1724 } 1725 $content = strip_tags( $content ); 1726 $content .= $links_summary; 1727 return $content; 1728 } 1729 1730 /** 1731 * Retrieve translated string with vertical bar context 1732 * 1733 * Quite a few times, there will be collisions with similar translatable text 1734 * found in more than two places but with different translated context. 1735 * 1736 * In order to use the separate contexts, the _c() function is used and the 1737 * translatable string uses a pipe ('|') which has the context the string is in. 1738 * 1739 * When the translated string is returned, it is everything before the pipe, not 1740 * including the pipe character. If there is no pipe in the translated text then 1741 * everything is returned. 1742 * 1743 * @since 2.2.0 1744 * @deprecated 2.9.0 Use _x() 1745 * @see _x() 1746 * 1747 * @param string $text Text to translate 1748 * @param string $domain Optional. Domain to retrieve the translated text 1749 * @return string Translated context string without pipe 1750 */ 1751 function _c( $text, $domain = 'default' ) { 1752 _deprecated_function( __FUNCTION__, '2.9.0', '_x()' ); 1753 return before_last_bar( translate( $text, $domain ) ); 1754 } 1755 1756 /** 1757 * Translates $text like translate(), but assumes that the text 1758 * contains a context after its last vertical bar. 1759 * 1760 * @since 2.5.0 1761 * @deprecated 3.0.0 Use _x() 1762 * @see _x() 1763 * 1764 * @param string $text Text to translate 1765 * @param string $domain Domain to retrieve the translated text 1766 * @return string Translated text 1767 */ 1768 function translate_with_context( $text, $domain = 'default' ) { 1769 _deprecated_function( __FUNCTION__, '2.9.0', '_x()' ); 1770 return before_last_bar( translate( $text, $domain ) ); 1771 } 1772 1773 /** 1774 * Legacy version of _n(), which supports contexts. 1775 * 1776 * Strips everything from the translation after the last bar. 1777 * 1778 * @since 2.7.0 1779 * @deprecated 3.0.0 Use _nx() 1780 * @see _nx() 1781 * 1782 * @param string $single The text to be used if the number is singular. 1783 * @param string $plural The text to be used if the number is plural. 1784 * @param int $number The number to compare against to use either the singular or plural form. 1785 * @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings. 1786 * Default 'default'. 1787 * @return string The translated singular or plural form. 1788 */ 1789 function _nc( $single, $plural, $number, $domain = 'default' ) { 1790 _deprecated_function( __FUNCTION__, '2.9.0', '_nx()' ); 1791 return before_last_bar( _n( $single, $plural, $number, $domain ) ); 1792 } 1793 1794 /** 1795 * Retrieve the plural or single form based on the amount. 1796 * 1797 * @since 1.2.0 1798 * @deprecated 2.8.0 Use _n() 1799 * @see _n() 1800 */ 1801 function __ngettext( ...$args ) { // phpcs:ignore PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames.FunctionDoubleUnderscore 1802 _deprecated_function( __FUNCTION__, '2.8.0', '_n()' ); 1803 return _n( ...$args ); 1804 } 1805 1806 /** 1807 * Register plural strings in POT file, but don't translate them. 1808 * 1809 * @since 2.5.0 1810 * @deprecated 2.8.0 Use _n_noop() 1811 * @see _n_noop() 1812 */ 1813 function __ngettext_noop( ...$args ) { // phpcs:ignore PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames.FunctionDoubleUnderscore 1814 _deprecated_function( __FUNCTION__, '2.8.0', '_n_noop()' ); 1815 return _n_noop( ...$args ); 1816 1817 } 1818 1819 /** 1820 * Retrieve all autoload options, or all options if no autoloaded ones exist. 1821 * 1822 * @since 1.0.0 1823 * @deprecated 3.0.0 Use wp_load_alloptions()) 1824 * @see wp_load_alloptions() 1825 * 1826 * @return array List of all options. 1827 */ 1828 function get_alloptions() { 1829 _deprecated_function( __FUNCTION__, '3.0.0', 'wp_load_alloptions()' ); 1830 return wp_load_alloptions(); 1831 } 1832 1833 /** 1834 * Retrieve HTML content of attachment image with link. 1835 * 1836 * @since 2.0.0 1837 * @deprecated 2.5.0 Use wp_get_attachment_link() 1838 * @see wp_get_attachment_link() 1839 * 1840 * @param int $id Optional. Post ID. 1841 * @param bool $fullsize Optional, default is false. Whether to use full size image. 1842 * @param array $max_dims Optional. Max image dimensions. 1843 * @param bool $permalink Optional, default is false. Whether to include permalink to image. 1844 * @return string 1845 */ 1846 function get_the_attachment_link($id = 0, $fullsize = false, $max_dims = false, $permalink = false) { 1847 _deprecated_function( __FUNCTION__, '2.5.0', 'wp_get_attachment_link()' ); 1848 $id = (int) $id; 1849 $_post = get_post($id); 1850 1851 if ( ('attachment' != $_post->post_type) || !$url = wp_get_attachment_url($_post->ID) ) 1852 return __('Missing Attachment'); 1853 1854 if ( $permalink ) 1855 $url = get_attachment_link($_post->ID); 1856 1857 $post_title = esc_attr($_post->post_title); 1858 1859 $innerHTML = get_attachment_innerHTML($_post->ID, $fullsize, $max_dims); 1860 return "<a href='$url' title='$post_title'>$innerHTML</a>"; 1861 } 1862 1863 /** 1864 * Retrieve icon URL and Path. 1865 * 1866 * @since 2.1.0 1867 * @deprecated 2.5.0 Use wp_get_attachment_image_src() 1868 * @see wp_get_attachment_image_src() 1869 * 1870 * @param int $id Optional. Post ID. 1871 * @param bool $fullsize Optional, default to false. Whether to have full image. 1872 * @return array Icon URL and full path to file, respectively. 1873 */ 1874 function get_attachment_icon_src( $id = 0, $fullsize = false ) { 1875 _deprecated_function( __FUNCTION__, '2.5.0', 'wp_get_attachment_image_src()' ); 1876 $id = (int) $id; 1877 if ( !$post = get_post($id) ) 1878 return false; 1879 1880 $file = get_attached_file( $post->ID ); 1881 1882 if ( !$fullsize && $src = wp_get_attachment_thumb_url( $post->ID ) ) { 1883 // We have a thumbnail desired, specified and existing 1884 1885 $src_file = wp_basename($src); 1886 } elseif ( wp_attachment_is_image( $post->ID ) ) { 1887 // We have an image without a thumbnail 1888 1889 $src = wp_get_attachment_url( $post->ID ); 1890 $src_file = & $file; 1891 } elseif ( $src = wp_mime_type_icon( $post->ID ) ) { 1892 // No thumb, no image. We'll look for a mime-related icon instead. 1893 1894 $icon_dir = apply_filters( 'icon_dir', get_template_directory() . '/images' ); 1895 $src_file = $icon_dir . '/' . wp_basename($src); 1896 } 1897 1898 if ( !isset($src) || !$src ) 1899 return false; 1900 1901 return array($src, $src_file); 1902 } 1903 1904 /** 1905 * Retrieve HTML content of icon attachment image element. 1906 * 1907 * @since 2.0.0 1908 * @deprecated 2.5.0 Use wp_get_attachment_image() 1909 * @see wp_get_attachment_image() 1910 * 1911 * @param int $id Optional. Post ID. 1912 * @param bool $fullsize Optional, default to false. Whether to have full size image. 1913 * @param array $max_dims Optional. Dimensions of image. 1914 * @return false|string HTML content. 1915 */ 1916 function get_attachment_icon( $id = 0, $fullsize = false, $max_dims = false ) { 1917 _deprecated_function( __FUNCTION__, '2.5.0', 'wp_get_attachment_image()' ); 1918 $id = (int) $id; 1919 if ( !$post = get_post($id) ) 1920 return false; 1921 1922 if ( !$src = get_attachment_icon_src( $post->ID, $fullsize ) ) 1923 return false; 1924 1925 list($src, $src_file) = $src; 1926 1927 // Do we need to constrain the image? 1928 if ( ($max_dims = apply_filters('attachment_max_dims', $max_dims)) && file_exists($src_file) ) { 1929 1930 $imagesize = @getimagesize($src_file); 1931 1932 if (($imagesize[0] > $max_dims[0]) || $imagesize[1] > $max_dims[1] ) { 1933 $actual_aspect = $imagesize[0] / $imagesize[1]; 1934 $desired_aspect = $max_dims[0] / $max_dims[1]; 1935 1936 if ( $actual_aspect >= $desired_aspect ) { 1937 $height = $actual_aspect * $max_dims[0]; 1938 $constraint = "width='{$max_dims[0]}' "; 1939 $post->iconsize = array($max_dims[0], $height); 1940 } else { 1941 $width = $max_dims[1] / $actual_aspect; 1942 $constraint = "height='{$max_dims[1]}' "; 1943 $post->iconsize = array($width, $max_dims[1]); 1944 } 1945 } else { 1946 $post->iconsize = array($imagesize[0], $imagesize[1]); 1947 $constraint = ''; 1948 } 1949 } else { 1950 $constraint = ''; 1951 } 1952 1953 $post_title = esc_attr($post->post_title); 1954 1955 $icon = "<img src='$src' title='$post_title' alt='$post_title' $constraint/>"; 1956 1957 return apply_filters( 'attachment_icon', $icon, $post->ID ); 1958 } 1959 1960 /** 1961 * Retrieve HTML content of image element. 1962 * 1963 * @since 2.0.0 1964 * @deprecated 2.5.0 Use wp_get_attachment_image() 1965 * @see wp_get_attachment_image() 1966 * 1967 * @param int $id Optional. Post ID. 1968 * @param bool $fullsize Optional, default to false. Whether to have full size image. 1969 * @param array $max_dims Optional. Dimensions of image. 1970 * @return false|string 1971 */ 1972 function get_attachment_innerHTML($id = 0, $fullsize = false, $max_dims = false) { 1973 _deprecated_function( __FUNCTION__, '2.5.0', 'wp_get_attachment_image()' ); 1974 $id = (int) $id; 1975 if ( !$post = get_post($id) ) 1976 return false; 1977 1978 if ( $innerHTML = get_attachment_icon($post->ID, $fullsize, $max_dims)) 1979 return $innerHTML; 1980 1981 $innerHTML = esc_attr($post->post_title); 1982 1983 return apply_filters('attachment_innerHTML', $innerHTML, $post->ID); 1984 } 1985 1986 /** 1987 * Retrieves bookmark data based on ID. 1988 * 1989 * @since 2.0.0 1990 * @deprecated 2.1.0 Use get_bookmark() 1991 * @see get_bookmark() 1992 * 1993 * @param int $bookmark_id ID of link 1994 * @param string $output Optional. Type of output. Accepts OBJECT, ARRAY_N, or ARRAY_A. 1995 * Default OBJECT. 1996 * @param string $filter Optional. How to filter the link for output. Accepts 'raw', 'edit', 1997 * 'attribute', 'js', 'db', or 'display'. Default 'raw'. 1998 * @return object|array Bookmark object or array, depending on the type specified by `$output`. 1999 */ 2000 function get_link( $bookmark_id, $output = OBJECT, $filter = 'raw' ) { 2001 _deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmark()' ); 2002 return get_bookmark($bookmark_id, $output, $filter); 2003 } 2004 2005 /** 2006 * Performs esc_url() for database or redirect usage. 2007 * 2008 * @since 2.3.1 2009 * @deprecated 2.8.0 Use esc_url_raw() 2010 * @see esc_url_raw() 2011 * 2012 * @param string $url The URL to be cleaned. 2013 * @param array $protocols An array of acceptable protocols. 2014 * @return string The cleaned URL. 2015 */ 2016 function sanitize_url( $url, $protocols = null ) { 2017 _deprecated_function( __FUNCTION__, '2.8.0', 'esc_url_raw()' ); 2018 return esc_url_raw( $url, $protocols ); 2019 } 2020 2021 /** 2022 * Checks and cleans a URL. 2023 * 2024 * A number of characters are removed from the URL. If the URL is for displaying 2025 * (the default behaviour) ampersands are also replaced. The 'clean_url' filter 2026 * is applied to the returned cleaned URL. 2027 * 2028 * @since 1.2.0 2029 * @deprecated 3.0.0 Use esc_url() 2030 * @see esc_url() 2031 * 2032 * @param string $url The URL to be cleaned. 2033 * @param array $protocols Optional. An array of acceptable protocols. 2034 * @param string $context Optional. How the URL will be used. Default is 'display'. 2035 * @return string The cleaned $url after the {@see 'clean_url'} filter is applied. 2036 */ 2037 function clean_url( $url, $protocols = null, $context = 'display' ) { 2038 if ( $context == 'db' ) 2039 _deprecated_function( 'clean_url( $context = \'db\' )', '3.0.0', 'esc_url_raw()' ); 2040 else 2041 _deprecated_function( __FUNCTION__, '3.0.0', 'esc_url()' ); 2042 return esc_url( $url, $protocols, $context ); 2043 } 2044 2045 /** 2046 * Escape single quotes, specialchar double quotes, and fix line endings. 2047 * 2048 * The filter {@see 'js_escape'} is also applied by esc_js(). 2049 * 2050 * @since 2.0.4 2051 * @deprecated 2.8.0 Use esc_js() 2052 * @see esc_js() 2053 * 2054 * @param string $text The text to be escaped. 2055 * @return string Escaped text. 2056 */ 2057 function js_escape( $text ) { 2058 _deprecated_function( __FUNCTION__, '2.8.0', 'esc_js()' ); 2059 return esc_js( $text ); 2060 } 2061 2062 /** 2063 * Legacy escaping for HTML blocks. 2064 * 2065 * @deprecated 2.8.0 Use esc_html() 2066 * @see esc_html() 2067 * 2068 * @param string $string String to escape. 2069 * @param string $quote_style Unused. 2070 * @param false|string $charset Unused. 2071 * @param false $double_encode Whether to double encode. Unused. 2072 * @return string Escaped `$string`. 2073 */ 2074 function wp_specialchars( $string, $quote_style = ENT_NOQUOTES, $charset = false, $double_encode = false ) { 2075 _deprecated_function( __FUNCTION__, '2.8.0', 'esc_html()' ); 2076 if ( func_num_args() > 1 ) { // Maintain back-compat for people passing additional arguments. 2077 return _wp_specialchars( $string, $quote_style, $charset, $double_encode ); 2078 } else { 2079 return esc_html( $string ); 2080 } 2081 } 2082 2083 /** 2084 * Escaping for HTML attributes. 2085 * 2086 * @since 2.0.6 2087 * @deprecated 2.8.0 Use esc_attr() 2088 * @see esc_attr() 2089 * 2090 * @param string $text 2091 * @return string 2092 */ 2093 function attribute_escape( $text ) { 2094 _deprecated_function( __FUNCTION__, '2.8.0', 'esc_attr()' ); 2095 return esc_attr( $text ); 2096 } 2097 2098 /** 2099 * Register widget for sidebar with backward compatibility. 2100 * 2101 * Allows $name to be an array that accepts either three elements to grab the 2102 * first element and the third for the name or just uses the first element of 2103 * the array for the name. 2104 * 2105 * Passes to wp_register_sidebar_widget() after argument list and backward 2106 * compatibility is complete. 2107 * 2108 * @since 2.2.0 2109 * @deprecated 2.8.0 Use wp_register_sidebar_widget() 2110 * @see wp_register_sidebar_widget() 2111 * 2112 * @param string|int $name Widget ID. 2113 * @param callable $output_callback Run when widget is called. 2114 * @param string $classname Optional. Classname widget option. Default empty. 2115 * @param mixed ...$params Widget parameters. 2116 */ 2117 function register_sidebar_widget($name, $output_callback, $classname = '', ...$params) { 2118 _deprecated_function( __FUNCTION__, '2.8.0', 'wp_register_sidebar_widget()' ); 2119 // Compat 2120 if ( is_array( $name ) ) { 2121 if ( count( $name ) === 3 ) { 2122 $name = sprintf( $name[0], $name[2] ); 2123 } else { 2124 $name = $name[0]; 2125 } 2126 } 2127 2128 $id = sanitize_title( $name ); 2129 $options = array(); 2130 if ( ! empty( $classname ) && is_string( $classname ) ) { 2131 $options['classname'] = $classname; 2132 } 2133 2134 wp_register_sidebar_widget( $id, $name, $output_callback, $options, ...$params ); 2135 } 2136 2137 /** 2138 * Serves as an alias of wp_unregister_sidebar_widget(). 2139 * 2140 * @since 2.2.0 2141 * @deprecated 2.8.0 Use wp_unregister_sidebar_widget() 2142 * @see wp_unregister_sidebar_widget() 2143 * 2144 * @param int|string $id Widget ID. 2145 */ 2146 function unregister_sidebar_widget($id) { 2147 _deprecated_function( __FUNCTION__, '2.8.0', 'wp_unregister_sidebar_widget()' ); 2148 return wp_unregister_sidebar_widget($id); 2149 } 2150 2151 /** 2152 * Registers widget control callback for customizing options. 2153 * 2154 * Allows $name to be an array that accepts either three elements to grab the 2155 * first element and the third for the name or just uses the first element of 2156 * the array for the name. 2157 * 2158 * Passes to wp_register_widget_control() after the argument list has 2159 * been compiled. 2160 * 2161 * @since 2.2.0 2162 * @deprecated 2.8.0 Use wp_register_widget_control() 2163 * @see wp_register_widget_control() 2164 * 2165 * @param int|string $name Sidebar ID. 2166 * @param callable $control_callback Widget control callback to display and process form. 2167 * @param int $width Widget width. 2168 * @param int $height Widget height. 2169 * @param mixed ...$params Widget parameters. 2170 */ 2171 function register_widget_control($name, $control_callback, $width = '', $height = '', ...$params) { 2172 _deprecated_function( __FUNCTION__, '2.8.0', 'wp_register_widget_control()' ); 2173 // Compat 2174 if ( is_array( $name ) ) { 2175 if ( count( $name ) === 3 ) { 2176 $name = sprintf( $name[0], $name[2] ); 2177 } else { 2178 $name = $name[0]; 2179 } 2180 } 2181 2182 $id = sanitize_title( $name ); 2183 $options = array(); 2184 if ( ! empty( $width ) ) { 2185 $options['width'] = $width; 2186 } 2187 if ( ! empty( $height ) ) { 2188 $options['height'] = $height; 2189 } 2190 2191 wp_register_widget_control( $id, $name, $control_callback, $options, ...$params ); 2192 } 2193 2194 /** 2195 * Alias of wp_unregister_widget_control(). 2196 * 2197 * @since 2.2.0 2198 * @deprecated 2.8.0 Use wp_unregister_widget_control() 2199 * @see wp_unregister_widget_control() 2200 * 2201 * @param int|string $id Widget ID. 2202 */ 2203 function unregister_widget_control($id) { 2204 _deprecated_function( __FUNCTION__, '2.8.0', 'wp_unregister_widget_control()' ); 2205 return wp_unregister_widget_control($id); 2206 } 2207 2208 /** 2209 * Remove user meta data. 2210 * 2211 * @since 2.0.0 2212 * @deprecated 3.0.0 Use delete_user_meta() 2213 * @see delete_user_meta() 2214 * 2215 * @param int $user_id User ID. 2216 * @param string $meta_key Metadata key. 2217 * @param mixed $meta_value Metadata value. 2218 * @return bool True deletion completed and false if user_id is not a number. 2219 */ 2220 function delete_usermeta( $user_id, $meta_key, $meta_value = '' ) { 2221 _deprecated_function( __FUNCTION__, '3.0.0', 'delete_user_meta()' ); 2222 global $wpdb; 2223 if ( !is_numeric( $user_id ) ) 2224 return false; 2225 $meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key); 2226 2227 if ( is_array($meta_value) || is_object($meta_value) ) 2228 $meta_value = serialize($meta_value); 2229 $meta_value = trim( $meta_value ); 2230 2231 $cur = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) ); 2232 2233 if ( $cur && $cur->umeta_id ) 2234 do_action( 'delete_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value ); 2235 2236 if ( ! empty($meta_value) ) 2237 $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s AND meta_value = %s", $user_id, $meta_key, $meta_value) ); 2238 else 2239 $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) ); 2240 2241 clean_user_cache( $user_id ); 2242 wp_cache_delete( $user_id, 'user_meta' ); 2243 2244 if ( $cur && $cur->umeta_id ) 2245 do_action( 'deleted_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value ); 2246 2247 return true; 2248 } 2249 2250 /** 2251 * Retrieve user metadata. 2252 * 2253 * If $user_id is not a number, then the function will fail over with a 'false' 2254 * boolean return value. Other returned values depend on whether there is only 2255 * one item to be returned, which be that single item type. If there is more 2256 * than one metadata value, then it will be list of metadata values. 2257 * 2258 * @since 2.0.0 2259 * @deprecated 3.0.0 Use get_user_meta() 2260 * @see get_user_meta() 2261 * 2262 * @param int $user_id User ID 2263 * @param string $meta_key Optional. Metadata key. 2264 * @return mixed 2265 */ 2266 function get_usermeta( $user_id, $meta_key = '' ) { 2267 _deprecated_function( __FUNCTION__, '3.0.0', 'get_user_meta()' ); 2268 global $wpdb; 2269 $user_id = (int) $user_id; 2270 2271 if ( !$user_id ) 2272 return false; 2273 2274 if ( !empty($meta_key) ) { 2275 $meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key); 2276 $user = wp_cache_get($user_id, 'users'); 2277 // Check the cached user object 2278 if ( false !== $user && isset($user->$meta_key) ) 2279 $metas = array($user->$meta_key); 2280 else 2281 $metas = $wpdb->get_col( $wpdb->prepare("SELECT meta_value FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) ); 2282 } else { 2283 $metas = $wpdb->get_col( $wpdb->prepare("SELECT meta_value FROM $wpdb->usermeta WHERE user_id = %d", $user_id) ); 2284 } 2285 2286 if ( empty($metas) ) { 2287 if ( empty($meta_key) ) 2288 return array(); 2289 else 2290 return ''; 2291 } 2292 2293 $metas = array_map('maybe_unserialize', $metas); 2294 2295 if ( count($metas) == 1 ) 2296 return $metas[0]; 2297 else 2298 return $metas; 2299 } 2300 2301 /** 2302 * Update metadata of user. 2303 * 2304 * There is no need to serialize values, they will be serialized if it is 2305 * needed. The metadata key can only be a string with underscores. All else will 2306 * be removed. 2307 * 2308 * Will remove the metadata, if the meta value is empty. 2309 * 2310 * @since 2.0.0 2311 * @deprecated 3.0.0 Use update_user_meta() 2312 * @see update_user_meta() 2313 * 2314 * @param int $user_id User ID 2315 * @param string $meta_key Metadata key. 2316 * @param mixed $meta_value Metadata value. 2317 * @return bool True on successful update, false on failure. 2318 */ 2319 function update_usermeta( $user_id, $meta_key, $meta_value ) { 2320 _deprecated_function( __FUNCTION__, '3.0.0', 'update_user_meta()' ); 2321 global $wpdb; 2322 if ( !is_numeric( $user_id ) ) 2323 return false; 2324 $meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key); 2325 2326 /** @todo Might need fix because usermeta data is assumed to be already escaped */ 2327 if ( is_string($meta_value) ) 2328 $meta_value = stripslashes($meta_value); 2329 $meta_value = maybe_serialize($meta_value); 2330 2331 if (empty($meta_value)) { 2332 return delete_usermeta($user_id, $meta_key); 2333 } 2334 2335 $cur = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) ); 2336 2337 if ( $cur ) 2338 do_action( 'update_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value ); 2339 2340 if ( !$cur ) 2341 $wpdb->insert($wpdb->usermeta, compact('user_id', 'meta_key', 'meta_value') ); 2342 elseif ( $cur->meta_value != $meta_value ) 2343 $wpdb->update($wpdb->usermeta, compact('meta_value'), compact('user_id', 'meta_key') ); 2344 else 2345 return false; 2346 2347 clean_user_cache( $user_id ); 2348 wp_cache_delete( $user_id, 'user_meta' ); 2349 2350 if ( !$cur ) 2351 do_action( 'added_usermeta', $wpdb->insert_id, $user_id, $meta_key, $meta_value ); 2352 else 2353 do_action( 'updated_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value ); 2354 2355 return true; 2356 } 2357 2358 /** 2359 * Get users for the site. 2360 * 2361 * For setups that use the multisite feature. Can be used outside of the 2362 * multisite feature. 2363 * 2364 * @since 2.2.0 2365 * @deprecated 3.1.0 Use get_users() 2366 * @see get_users() 2367 * 2368 * @global wpdb $wpdb WordPress database abstraction object. 2369 * 2370 * @param int $id Site ID. 2371 * @return array List of users that are part of that site ID 2372 */ 2373 function get_users_of_blog( $id = '' ) { 2374 _deprecated_function( __FUNCTION__, '3.1.0', 'get_users()' ); 2375 2376 global $wpdb; 2377 if ( empty( $id ) ) { 2378 $id = get_current_blog_id(); 2379 } 2380 $blog_prefix = $wpdb->get_blog_prefix($id); 2381 $users = $wpdb->get_results( "SELECT user_id, user_id AS ID, user_login, display_name, user_email, meta_value FROM $wpdb->users, $wpdb->usermeta WHERE {$wpdb->users}.ID = {$wpdb->usermeta}.user_id AND meta_key = '{$blog_prefix}capabilities' ORDER BY {$wpdb->usermeta}.user_id" ); 2382 return $users; 2383 } 2384 2385 /** 2386 * Enable/disable automatic general feed link outputting. 2387 * 2388 * @since 2.8.0 2389 * @deprecated 3.0.0 Use add_theme_support() 2390 * @see add_theme_support() 2391 * 2392 * @param bool $add Optional, default is true. Add or remove links. Defaults to true. 2393 */ 2394 function automatic_feed_links( $add = true ) { 2395 _deprecated_function( __FUNCTION__, '3.0.0', "add_theme_support( 'automatic-feed-links' )" ); 2396 2397 if ( $add ) 2398 add_theme_support( 'automatic-feed-links' ); 2399 else 2400 remove_action( 'wp_head', 'feed_links_extra', 3 ); // Just do this yourself in 3.0+ 2401 } 2402 2403 /** 2404 * Retrieve user data based on field. 2405 * 2406 * @since 1.5.0 2407 * @deprecated 3.0.0 Use get_the_author_meta() 2408 * @see get_the_author_meta() 2409 * 2410 * @param string $field User meta field. 2411 * @param false|int $user Optional. User ID to retrieve the field for. Default false (current user). 2412 * @return string The author's field from the current author's DB object. 2413 */ 2414 function get_profile( $field, $user = false ) { 2415 _deprecated_function( __FUNCTION__, '3.0.0', 'get_the_author_meta()' ); 2416 if ( $user ) { 2417 $user = get_user_by( 'login', $user ); 2418 $user = $user->ID; 2419 } 2420 return get_the_author_meta( $field, $user ); 2421 } 2422 2423 /** 2424 * Retrieves the number of posts a user has written. 2425 * 2426 * @since 0.71 2427 * @deprecated 3.0.0 Use count_user_posts() 2428 * @see count_user_posts() 2429 * 2430 * @param int $userid User to count posts for. 2431 * @return int Number of posts the given user has written. 2432 */ 2433 function get_usernumposts( $userid ) { 2434 _deprecated_function( __FUNCTION__, '3.0.0', 'count_user_posts()' ); 2435 return count_user_posts( $userid ); 2436 } 2437 2438 /** 2439 * Callback used to change %uXXXX to &#YYY; syntax 2440 * 2441 * @since 2.8.0 2442 * @access private 2443 * @deprecated 3.0.0 2444 * 2445 * @param array $matches Single Match 2446 * @return string An HTML entity 2447 */ 2448 function funky_javascript_callback($matches) { 2449 return "&#".base_convert($matches[1],16,10).";"; 2450 } 2451 2452 /** 2453 * Fixes JavaScript bugs in browsers. 2454 * 2455 * Converts unicode characters to HTML numbered entities. 2456 * 2457 * @since 1.5.0 2458 * @deprecated 3.0.0 2459 * 2460 * @global $is_macIE 2461 * @global $is_winIE 2462 * 2463 * @param string $text Text to be made safe. 2464 * @return string Fixed text. 2465 */ 2466 function funky_javascript_fix($text) { 2467 _deprecated_function( __FUNCTION__, '3.0.0' ); 2468 // Fixes for browsers' JavaScript bugs. 2469 global $is_macIE, $is_winIE; 2470 2471 if ( $is_winIE || $is_macIE ) 2472 $text = preg_replace_callback("/\%u([0-9A-F]{4,4})/", 2473 "funky_javascript_callback", 2474 $text); 2475 2476 return $text; 2477 } 2478 2479 /** 2480 * Checks that the taxonomy name exists. 2481 * 2482 * @since 2.3.0 2483 * @deprecated 3.0.0 Use taxonomy_exists() 2484 * @see taxonomy_exists() 2485 * 2486 * @param string $taxonomy Name of taxonomy object 2487 * @return bool Whether the taxonomy exists. 2488 */ 2489 function is_taxonomy( $taxonomy ) { 2490 _deprecated_function( __FUNCTION__, '3.0.0', 'taxonomy_exists()' ); 2491 return taxonomy_exists( $taxonomy ); 2492 } 2493 2494 /** 2495 * Check if Term exists. 2496 * 2497 * @since 2.3.0 2498 * @deprecated 3.0.0 Use term_exists() 2499 * @see term_exists() 2500 * 2501 * @param int|string $term The term to check 2502 * @param string $taxonomy The taxonomy name to use 2503 * @param int $parent ID of parent term under which to confine the exists search. 2504 * @return mixed Get the term id or Term Object, if exists. 2505 */ 2506 function is_term( $term, $taxonomy = '', $parent = 0 ) { 2507 _deprecated_function( __FUNCTION__, '3.0.0', 'term_exists()' ); 2508 return term_exists( $term, $taxonomy, $parent ); 2509 } 2510 2511 /** 2512 * Determines whether the current admin page is generated by a plugin. 2513 * 2514 * Use global $plugin_page and/or get_plugin_page_hookname() hooks. 2515 * 2516 * For more information on this and similar theme functions, check out 2517 * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ 2518 * Conditional Tags} article in the Theme Developer Handbook. 2519 * 2520 * @since 1.5.0 2521 * @deprecated 3.1.0 2522 * 2523 * @global $plugin_page 2524 * 2525 * @return bool 2526 */ 2527 function is_plugin_page() { 2528 _deprecated_function( __FUNCTION__, '3.1.0' ); 2529 2530 global $plugin_page; 2531 2532 if ( isset($plugin_page) ) 2533 return true; 2534 2535 return false; 2536 } 2537 2538 /** 2539 * Update the categories cache. 2540 * 2541 * This function does not appear to be used anymore or does not appear to be 2542 * needed. It might be a legacy function left over from when there was a need 2543 * for updating the category cache. 2544 * 2545 * @since 1.5.0 2546 * @deprecated 3.1.0 2547 * 2548 * @return bool Always return True 2549 */ 2550 function update_category_cache() { 2551 _deprecated_function( __FUNCTION__, '3.1.0' ); 2552 2553 return true; 2554 } 2555 2556 /** 2557 * Check for PHP timezone support 2558 * 2559 * @since 2.9.0 2560 * @deprecated 3.2.0 2561 * 2562 * @return bool 2563 */ 2564 function wp_timezone_supported() { 2565 _deprecated_function( __FUNCTION__, '3.2.0' ); 2566 2567 return true; 2568 } 2569 2570 /** 2571 * Displays an editor: TinyMCE, HTML, or both. 2572 * 2573 * @since 2.1.0 2574 * @deprecated 3.3.0 Use wp_editor() 2575 * @see wp_editor() 2576 * 2577 * @param string $content Textarea content. 2578 * @param string $id Optional. HTML ID attribute value. Default 'content'. 2579 * @param string $prev_id Optional. Unused. 2580 * @param bool $media_buttons Optional. Whether to display media buttons. Default true. 2581 * @param int $tab_index Optional. Unused. 2582 * @param bool $extended Optional. Unused. 2583 */ 2584 function the_editor($content, $id = 'content', $prev_id = 'title', $media_buttons = true, $tab_index = 2, $extended = true) { 2585 _deprecated_function( __FUNCTION__, '3.3.0', 'wp_editor()' ); 2586 2587 wp_editor( $content, $id, array( 'media_buttons' => $media_buttons ) ); 2588 } 2589 2590 /** 2591 * Perform the query to get the $metavalues array(s) needed by _fill_user and _fill_many_users 2592 * 2593 * @since 3.0.0 2594 * @deprecated 3.3.0 2595 * 2596 * @param array $ids User ID numbers list. 2597 * @return array of arrays. The array is indexed by user_id, containing $metavalues object arrays. 2598 */ 2599 function get_user_metavalues($ids) { 2600 _deprecated_function( __FUNCTION__, '3.3.0' ); 2601 2602 $objects = array(); 2603 2604 $ids = array_map('intval', $ids); 2605 foreach ( $ids as $id ) 2606 $objects[$id] = array(); 2607 2608 $metas = update_meta_cache('user', $ids); 2609 2610 foreach ( $metas as $id => $meta ) { 2611 foreach ( $meta as $key => $metavalues ) { 2612 foreach ( $metavalues as $value ) { 2613 $objects[$id][] = (object)array( 'user_id' => $id, 'meta_key' => $key, 'meta_value' => $value); 2614 } 2615 } 2616 } 2617 2618 return $objects; 2619 } 2620 2621 /** 2622 * Sanitize every user field. 2623 * 2624 * If the context is 'raw', then the user object or array will get minimal santization of the int fields. 2625 * 2626 * @since 2.3.0 2627 * @deprecated 3.3.0 2628 * 2629 * @param object|array $user The User Object or Array 2630 * @param string $context Optional, default is 'display'. How to sanitize user fields. 2631 * @return object|array The now sanitized User Object or Array (will be the same type as $user) 2632 */ 2633 function sanitize_user_object($user, $context = 'display') { 2634 _deprecated_function( __FUNCTION__, '3.3.0' ); 2635 2636 if ( is_object($user) ) { 2637 if ( !isset($user->ID) ) 2638 $user->ID = 0; 2639 if ( ! ( $user instanceof WP_User ) ) { 2640 $vars = get_object_vars($user); 2641 foreach ( array_keys($vars) as $field ) { 2642 if ( is_string($user->$field) || is_numeric($user->$field) ) 2643 $user->$field = sanitize_user_field($field, $user->$field, $user->ID, $context); 2644 } 2645 } 2646 $user->filter = $context; 2647 } else { 2648 if ( !isset($user['ID']) ) 2649 $user['ID'] = 0; 2650 foreach ( array_keys($user) as $field ) 2651 $user[$field] = sanitize_user_field($field, $user[$field], $user['ID'], $context); 2652 $user['filter'] = $context; 2653 } 2654 2655 return $user; 2656 } 2657 2658 /** 2659 * Get boundary post relational link. 2660 * 2661 * Can either be start or end post relational link. 2662 * 2663 * @since 2.8.0 2664 * @deprecated 3.3.0 2665 * 2666 * @param string $title Optional. Link title format. 2667 * @param bool $in_same_cat Optional. Whether link should be in a same category. 2668 * @param string $excluded_categories Optional. Excluded categories IDs. 2669 * @param bool $start Optional, default is true. Whether to display link to first or last post. 2670 * @return string 2671 */ 2672 function get_boundary_post_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '', $start = true) { 2673 _deprecated_function( __FUNCTION__, '3.3.0' ); 2674 2675 $posts = get_boundary_post($in_same_cat, $excluded_categories, $start); 2676 // If there is no post stop. 2677 if ( empty($posts) ) 2678 return; 2679 2680 // Even though we limited get_posts to return only 1 item it still returns an array of objects. 2681 $post = $posts[0]; 2682 2683 if ( empty($post->post_title) ) 2684 $post->post_title = $start ? __('First Post') : __('Last Post'); 2685 2686 $date = mysql2date(get_option('date_format'), $post->post_date); 2687 2688 $title = str_replace('%title', $post->post_title, $title); 2689 $title = str_replace('%date', $date, $title); 2690 $title = apply_filters('the_title', $title, $post->ID); 2691 2692 $link = $start ? "<link rel='start' title='" : "<link rel='end' title='"; 2693 $link .= esc_attr($title); 2694 $link .= "' href='" . get_permalink($post) . "' />\n"; 2695 2696 $boundary = $start ? 'start' : 'end'; 2697 return apply_filters( "{$boundary}_post_rel_link", $link ); 2698 } 2699 2700 /** 2701 * Display relational link for the first post. 2702 * 2703 * @since 2.8.0 2704 * @deprecated 3.3.0 2705 * 2706 * @param string $title Optional. Link title format. 2707 * @param bool $in_same_cat Optional. Whether link should be in a same category. 2708 * @param string $excluded_categories Optional. Excluded categories IDs. 2709 */ 2710 function start_post_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '') { 2711 _deprecated_function( __FUNCTION__, '3.3.0' ); 2712 2713 echo get_boundary_post_rel_link($title, $in_same_cat, $excluded_categories, true); 2714 } 2715 2716 /** 2717 * Get site index relational link. 2718 * 2719 * @since 2.8.0 2720 * @deprecated 3.3.0 2721 * 2722 * @return string 2723 */ 2724 function get_index_rel_link() { 2725 _deprecated_function( __FUNCTION__, '3.3.0' ); 2726 2727 $link = "<link rel='index' title='" . esc_attr( get_bloginfo( 'name', 'display' ) ) . "' href='" . esc_url( user_trailingslashit( get_bloginfo( 'url', 'display' ) ) ) . "' />\n"; 2728 return apply_filters( "index_rel_link", $link ); 2729 } 2730 2731 /** 2732 * Display relational link for the site index. 2733 * 2734 * @since 2.8.0 2735 * @deprecated 3.3.0 2736 */ 2737 function index_rel_link() { 2738 _deprecated_function( __FUNCTION__, '3.3.0' ); 2739 2740 echo get_index_rel_link(); 2741 } 2742 2743 /** 2744 * Get parent post relational link. 2745 * 2746 * @since 2.8.0 2747 * @deprecated 3.3.0 2748 * 2749 * @param string $title Optional. Link title format. Default '%title'. 2750 * @return string 2751 */ 2752 function get_parent_post_rel_link( $title = '%title' ) { 2753 _deprecated_function( __FUNCTION__, '3.3.0' ); 2754 2755 if ( ! empty( $GLOBALS['post'] ) && ! empty( $GLOBALS['post']->post_parent ) ) 2756 $post = get_post($GLOBALS['post']->post_parent); 2757 2758 if ( empty($post) ) 2759 return; 2760 2761 $date = mysql2date(get_option('date_format'), $post->post_date); 2762 2763 $title = str_replace('%title', $post->post_title, $title); 2764 $title = str_replace('%date', $date, $title); 2765 $title = apply_filters('the_title', $title, $post->ID); 2766 2767 $link = "<link rel='up' title='"; 2768 $link .= esc_attr( $title ); 2769 $link .= "' href='" . get_permalink($post) . "' />\n"; 2770 2771 return apply_filters( "parent_post_rel_link", $link ); 2772 } 2773 2774 /** 2775 * Display relational link for parent item 2776 * 2777 * @since 2.8.0 2778 * @deprecated 3.3.0 2779 * 2780 * @param string $title Optional. Link title format. Default '%title'. 2781 */ 2782 function parent_post_rel_link( $title = '%title' ) { 2783 _deprecated_function( __FUNCTION__, '3.3.0' ); 2784 2785 echo get_parent_post_rel_link($title); 2786 } 2787 2788 /** 2789 * Add the "Dashboard"/"Visit Site" menu. 2790 * 2791 * @since 3.2.0 2792 * @deprecated 3.3.0 2793 * 2794 * @param WP_Admin_Bar $wp_admin_bar WP_Admin_Bar instance. 2795 */ 2796 function wp_admin_bar_dashboard_view_site_menu( $wp_admin_bar ) { 2797 _deprecated_function( __FUNCTION__, '3.3.0' ); 2798 2799 $user_id = get_current_user_id(); 2800 2801 if ( 0 != $user_id ) { 2802 if ( is_admin() ) 2803 $wp_admin_bar->add_menu( array( 'id' => 'view-site', 'title' => __( 'Visit Site' ), 'href' => home_url() ) ); 2804 elseif ( is_multisite() ) 2805 $wp_admin_bar->add_menu( array( 'id' => 'dashboard', 'title' => __( 'Dashboard' ), 'href' => get_dashboard_url( $user_id ) ) ); 2806 else 2807 $wp_admin_bar->add_menu( array( 'id' => 'dashboard', 'title' => __( 'Dashboard' ), 'href' => admin_url() ) ); 2808 } 2809 } 2810 2811 /** 2812 * Checks if the current user belong to a given site. 2813 * 2814 * @since MU (3.0.0) 2815 * @deprecated 3.3.0 Use is_user_member_of_blog() 2816 * @see is_user_member_of_blog() 2817 * 2818 * @param int $blog_id Site ID 2819 * @return bool True if the current users belong to $blog_id, false if not. 2820 */ 2821 function is_blog_user( $blog_id = 0 ) { 2822 _deprecated_function( __FUNCTION__, '3.3.0', 'is_user_member_of_blog()' ); 2823 2824 return is_user_member_of_blog( get_current_user_id(), $blog_id ); 2825 } 2826 2827 /** 2828 * Open the file handle for debugging. 2829 * 2830 * @since 0.71 2831 * @deprecated 3.4.0 Use error_log() 2832 * @see error_log() 2833 * 2834 * @link https://secure.php.net/manual/en/function.error-log.php 2835 * 2836 * @param string $filename File name. 2837 * @param string $mode Type of access you required to the stream. 2838 * @return false Always false. 2839 */ 2840 function debug_fopen( $filename, $mode ) { 2841 _deprecated_function( __FUNCTION__, '3.4.0', 'error_log()' ); 2842 return false; 2843 } 2844 2845 /** 2846 * Write contents to the file used for debugging. 2847 * 2848 * @since 0.71 2849 * @deprecated 3.4.0 Use error_log() 2850 * @see error_log() 2851 * 2852 * @link https://secure.php.net/manual/en/function.error-log.php 2853 * 2854 * @param mixed $fp Unused. 2855 * @param string $string Message to log. 2856 */ 2857 function debug_fwrite( $fp, $string ) { 2858 _deprecated_function( __FUNCTION__, '3.4.0', 'error_log()' ); 2859 if ( ! empty( $GLOBALS['debug'] ) ) 2860 error_log( $string ); 2861 } 2862 2863 /** 2864 * Close the debugging file handle. 2865 * 2866 * @since 0.71 2867 * @deprecated 3.4.0 Use error_log() 2868 * @see error_log() 2869 * 2870 * @link https://secure.php.net/manual/en/function.error-log.php 2871 * 2872 * @param mixed $fp Unused. 2873 */ 2874 function debug_fclose( $fp ) { 2875 _deprecated_function( __FUNCTION__, '3.4.0', 'error_log()' ); 2876 } 2877 2878 /** 2879 * Retrieve list of themes with theme data in theme directory. 2880 * 2881 * The theme is broken, if it doesn't have a parent theme and is missing either 2882 * style.css and, or index.php. If the theme has a parent theme then it is 2883 * broken, if it is missing style.css; index.php is optional. 2884 * 2885 * @since 1.5.0 2886 * @deprecated 3.4.0 Use wp_get_themes() 2887 * @see wp_get_themes() 2888 * 2889 * @return array Theme list with theme data. 2890 */ 2891 function get_themes() { 2892 _deprecated_function( __FUNCTION__, '3.4.0', 'wp_get_themes()' ); 2893 2894 global $wp_themes; 2895 if ( isset( $wp_themes ) ) 2896 return $wp_themes; 2897 2898 $themes = wp_get_themes(); 2899 $wp_themes = array(); 2900 2901 foreach ( $themes as $theme ) { 2902 $name = $theme->get('Name'); 2903 if ( isset( $wp_themes[ $name ] ) ) 2904 $wp_themes[ $name . '/' . $theme->get_stylesheet() ] = $theme; 2905 else 2906 $wp_themes[ $name ] = $theme; 2907 } 2908 2909 return $wp_themes; 2910 } 2911 2912 /** 2913 * Retrieve theme data. 2914 * 2915 * @since 1.5.0 2916 * @deprecated 3.4.0 Use wp_get_theme() 2917 * @see wp_get_theme() 2918 * 2919 * @param string $theme Theme name. 2920 * @return array|null Null, if theme name does not exist. Theme data, if exists. 2921 */ 2922 function get_theme( $theme ) { 2923 _deprecated_function( __FUNCTION__, '3.4.0', 'wp_get_theme( $stylesheet )' ); 2924 2925 $themes = get_themes(); 2926 if ( is_array( $themes ) && array_key_exists( $theme, $themes ) ) 2927 return $themes[ $theme ]; 2928 return null; 2929 } 2930 2931 /** 2932 * Retrieve current theme name. 2933 * 2934 * @since 1.5.0 2935 * @deprecated 3.4.0 Use wp_get_theme() 2936 * @see wp_get_theme() 2937 * 2938 * @return string 2939 */ 2940 function get_current_theme() { 2941 _deprecated_function( __FUNCTION__, '3.4.0', 'wp_get_theme()' ); 2942 2943 if ( $theme = get_option( 'current_theme' ) ) 2944 return $theme; 2945 2946 return wp_get_theme()->get('Name'); 2947 } 2948 2949 /** 2950 * Accepts matches array from preg_replace_callback in wpautop() or a string. 2951 * 2952 * Ensures that the contents of a `<pre>...</pre>` HTML block are not 2953 * converted into paragraphs or line-breaks. 2954 * 2955 * @since 1.2.0 2956 * @deprecated 3.4.0 2957 * 2958 * @param array|string $matches The array or string 2959 * @return string The pre block without paragraph/line-break conversion. 2960 */ 2961 function clean_pre($matches) { 2962 _deprecated_function( __FUNCTION__, '3.4.0' ); 2963 2964 if ( is_array($matches) ) 2965 $text = $matches[1] . $matches[2] . "</pre>"; 2966 else 2967 $text = $matches; 2968 2969 $text = str_replace(array('<br />', '<br/>', '<br>'), array('', '', ''), $text); 2970 $text = str_replace('<p>', "\n", $text); 2971 $text = str_replace('</p>', '', $text); 2972 2973 return $text; 2974 } 2975 2976 2977 /** 2978 * Add callbacks for image header display. 2979 * 2980 * @since 2.1.0 2981 * @deprecated 3.4.0 Use add_theme_support() 2982 * @see add_theme_support() 2983 * 2984 * @param callable $wp_head_callback Call on the {@see 'wp_head'} action. 2985 * @param callable $admin_head_callback Call on custom header administration screen. 2986 * @param callable $admin_preview_callback Output a custom header image div on the custom header administration screen. Optional. 2987 */ 2988 function add_custom_image_header( $wp_head_callback, $admin_head_callback, $admin_preview_callback = '' ) { 2989 _deprecated_function( __FUNCTION__, '3.4.0', 'add_theme_support( \'custom-header\', $args )' ); 2990 $args = array( 2991 'wp-head-callback' => $wp_head_callback, 2992 'admin-head-callback' => $admin_head_callback, 2993 ); 2994 if ( $admin_preview_callback ) 2995 $args['admin-preview-callback'] = $admin_preview_callback; 2996 return add_theme_support( 'custom-header', $args ); 2997 } 2998 2999 /** 3000 * Remove image header support. 3001 * 3002 * @since 3.1.0 3003 * @deprecated 3.4.0 Use remove_theme_support() 3004 * @see remove_theme_support() 3005 * 3006 * @return null|bool Whether support was removed. 3007 */ 3008 function remove_custom_image_header() { 3009 _deprecated_function( __FUNCTION__, '3.4.0', 'remove_theme_support( \'custom-header\' )' ); 3010 return remove_theme_support( 'custom-header' ); 3011 } 3012 3013 /** 3014 * Add callbacks for background image display. 3015 * 3016 * @since 3.0.0 3017 * @deprecated 3.4.0 Use add_theme_support() 3018 * @see add_theme_support() 3019 * 3020 * @param callable $wp_head_callback Call on the {@see 'wp_head'} action. 3021 * @param callable $admin_head_callback Call on custom background administration screen. 3022 * @param callable $admin_preview_callback Output a custom background image div on the custom background administration screen. Optional. 3023 */ 3024 function add_custom_background( $wp_head_callback = '', $admin_head_callback = '', $admin_preview_callback = '' ) { 3025 _deprecated_function( __FUNCTION__, '3.4.0', 'add_theme_support( \'custom-background\', $args )' ); 3026 $args = array(); 3027 if ( $wp_head_callback ) 3028 $args['wp-head-callback'] = $wp_head_callback; 3029 if ( $admin_head_callback ) 3030 $args['admin-head-callback'] = $admin_head_callback; 3031 if ( $admin_preview_callback ) 3032 $args['admin-preview-callback'] = $admin_preview_callback; 3033 return add_theme_support( 'custom-background', $args ); 3034 } 3035 3036 /** 3037 * Remove custom background support. 3038 * 3039 * @since 3.1.0 3040 * @deprecated 3.4.0 Use add_custom_background() 3041 * @see add_custom_background() 3042 * 3043 * @return null|bool Whether support was removed. 3044 */ 3045 function remove_custom_background() { 3046 _deprecated_function( __FUNCTION__, '3.4.0', 'remove_theme_support( \'custom-background\' )' ); 3047 return remove_theme_support( 'custom-background' ); 3048 } 3049 3050 /** 3051 * Retrieve theme data from parsed theme file. 3052 * 3053 * @since 1.5.0 3054 * @deprecated 3.4.0 Use wp_get_theme() 3055 * @see wp_get_theme() 3056 * 3057 * @param string $theme_file Theme file path. 3058 * @return array Theme data. 3059 */ 3060 function get_theme_data( $theme_file ) { 3061 _deprecated_function( __FUNCTION__, '3.4.0', 'wp_get_theme()' ); 3062 $theme = new WP_Theme( wp_basename( dirname( $theme_file ) ), dirname( dirname( $theme_file ) ) ); 3063 3064 $theme_data = array( 3065 'Name' => $theme->get('Name'), 3066 'URI' => $theme->display('ThemeURI', true, false), 3067 'Description' => $theme->display('Description', true, false), 3068 'Author' => $theme->display('Author', true, false), 3069 'AuthorURI' => $theme->display('AuthorURI', true, false), 3070 'Version' => $theme->get('Version'), 3071 'Template' => $theme->get('Template'), 3072 'Status' => $theme->get('Status'), 3073 'Tags' => $theme->get('Tags'), 3074 'Title' => $theme->get('Name'), 3075 'AuthorName' => $theme->get('Author'), 3076 ); 3077 3078 foreach ( apply_filters( 'extra_theme_headers', array() ) as $extra_header ) { 3079 if ( ! isset( $theme_data[ $extra_header ] ) ) 3080 $theme_data[ $extra_header ] = $theme->get( $extra_header ); 3081 } 3082 3083 return $theme_data; 3084 } 3085 3086 /** 3087 * Alias of update_post_cache(). 3088 * 3089 * @see update_post_cache() Posts and pages are the same, alias is intentional 3090 * 3091 * @since 1.5.1 3092 * @deprecated 3.4.0 Use update_post_cache() 3093 * @see update_post_cache() 3094 * 3095 * @param array $pages list of page objects 3096 */ 3097 function update_page_cache( &$pages ) { 3098 _deprecated_function( __FUNCTION__, '3.4.0', 'update_post_cache()' ); 3099 3100 update_post_cache( $pages ); 3101 } 3102 3103 /** 3104 * Will clean the page in the cache. 3105 * 3106 * Clean (read: delete) page from cache that matches $id. Will also clean cache 3107 * associated with 'all_page_ids' and 'get_pages'. 3108 * 3109 * @since 2.0.0 3110 * @deprecated 3.4.0 Use clean_post_cache 3111 * @see clean_post_cache() 3112 * 3113 * @param int $id Page ID to clean 3114 */ 3115 function clean_page_cache( $id ) { 3116 _deprecated_function( __FUNCTION__, '3.4.0', 'clean_post_cache()' ); 3117 3118 clean_post_cache( $id ); 3119 } 3120 3121 /** 3122 * Retrieve nonce action "Are you sure" message. 3123 * 3124 * Deprecated in 3.4.1 and 3.5.0. Backported to 3.3.3. 3125 * 3126 * @since 2.0.4 3127 * @deprecated 3.4.1 Use wp_nonce_ays() 3128 * @see wp_nonce_ays() 3129 * 3130 * @param string $action Nonce action. 3131 * @return string Are you sure message. 3132 */ 3133 function wp_explain_nonce( $action ) { 3134 _deprecated_function( __FUNCTION__, '3.4.1', 'wp_nonce_ays()' ); 3135 return __( 'Are you sure you want to do this?' ); 3136 } 3137 3138 /** 3139 * Display "sticky" CSS class, if a post is sticky. 3140 * 3141 * @since 2.7.0 3142 * @deprecated 3.5.0 Use post_class() 3143 * @see post_class() 3144 * 3145 * @param int $post_id An optional post ID. 3146 */ 3147 function sticky_class( $post_id = null ) { 3148 _deprecated_function( __FUNCTION__, '3.5.0', 'post_class()' ); 3149 if ( is_sticky( $post_id ) ) 3150 echo ' sticky'; 3151 } 3152 3153 /** 3154 * Retrieve post ancestors. 3155 * 3156 * This is no longer needed as WP_Post lazy-loads the ancestors 3157 * property with get_post_ancestors(). 3158 * 3159 * @since 2.3.4 3160 * @deprecated 3.5.0 Use get_post_ancestors() 3161 * @see get_post_ancestors() 3162 * 3163 * @param WP_Post $post Post object, passed by reference (unused). 3164 */ 3165 function _get_post_ancestors( &$post ) { 3166 _deprecated_function( __FUNCTION__, '3.5.0' ); 3167 } 3168 3169 /** 3170 * Load an image from a string, if PHP supports it. 3171 * 3172 * @since 2.1.0 3173 * @deprecated 3.5.0 Use wp_get_image_editor() 3174 * @see wp_get_image_editor() 3175 * 3176 * @param string $file Filename of the image to load. 3177 * @return resource The resulting image resource on success, Error string on failure. 3178 */ 3179 function wp_load_image( $file ) { 3180 _deprecated_function( __FUNCTION__, '3.5.0', 'wp_get_image_editor()' ); 3181 3182 if ( is_numeric( $file ) ) 3183 $file = get_attached_file( $file ); 3184 3185 if ( ! is_file( $file ) ) { 3186 /* translators: %s: File name. */ 3187 return sprintf( __( 'File “%s” doesn’t exist?' ), $file ); 3188 } 3189 3190 if ( ! function_exists('imagecreatefromstring') ) 3191 return __('The GD image library is not installed.'); 3192 3193 // Set artificially high because GD uses uncompressed images in memory. 3194 wp_raise_memory_limit( 'image' ); 3195 3196 $image = imagecreatefromstring( file_get_contents( $file ) ); 3197 3198 if ( ! is_resource( $image ) ) { 3199 /* translators: %s: File name. */ 3200 return sprintf( __( 'File “%s” is not an image.' ), $file ); 3201 } 3202 3203 return $image; 3204 } 3205 3206 /** 3207 * Scale down an image to fit a particular size and save a new copy of the image. 3208 * 3209 * The PNG transparency will be preserved using the function, as well as the 3210 * image type. If the file going in is PNG, then the resized image is going to 3211 * be PNG. The only supported image types are PNG, GIF, and JPEG. 3212 * 3213 * Some functionality requires API to exist, so some PHP version may lose out 3214 * support. This is not the fault of WordPress (where functionality is 3215 * downgraded, not actual defects), but of your PHP version. 3216 * 3217 * @since 2.5.0 3218 * @deprecated 3.5.0 Use wp_get_image_editor() 3219 * @see wp_get_image_editor() 3220 * 3221 * @param string $file Image file path. 3222 * @param int $max_w Maximum width to resize to. 3223 * @param int $max_h Maximum height to resize to. 3224 * @param bool $crop Optional. Whether to crop image or resize. 3225 * @param string $suffix Optional. File suffix. 3226 * @param string $dest_path Optional. New image file path. 3227 * @param int $jpeg_quality Optional, default is 90. Image quality percentage. 3228 * @return mixed WP_Error on failure. String with new destination path. 3229 */ 3230 function image_resize( $file, $max_w, $max_h, $crop = false, $suffix = null, $dest_path = null, $jpeg_quality = 90 ) { 3231 _deprecated_function( __FUNCTION__, '3.5.0', 'wp_get_image_editor()' ); 3232 3233 $editor = wp_get_image_editor( $file ); 3234 if ( is_wp_error( $editor ) ) 3235 return $editor; 3236 $editor->set_quality( $jpeg_quality ); 3237 3238 $resized = $editor->resize( $max_w, $max_h, $crop ); 3239 if ( is_wp_error( $resized ) ) 3240 return $resized; 3241 3242 $dest_file = $editor->generate_filename( $suffix, $dest_path ); 3243 $saved = $editor->save( $dest_file ); 3244 3245 if ( is_wp_error( $saved ) ) 3246 return $saved; 3247 3248 return $dest_file; 3249 } 3250 3251 /** 3252 * Retrieve a single post, based on post ID. 3253 * 3254 * Has categories in 'post_category' property or key. Has tags in 'tags_input' 3255 * property or key. 3256 * 3257 * @since 1.0.0 3258 * @deprecated 3.5.0 Use get_post() 3259 * @see get_post() 3260 * 3261 * @param int $postid Post ID. 3262 * @param string $mode How to return result, either OBJECT, ARRAY_N, or ARRAY_A. 3263 * @return WP_Post|null Post object or array holding post contents and information 3264 */ 3265 function wp_get_single_post( $postid = 0, $mode = OBJECT ) { 3266 _deprecated_function( __FUNCTION__, '3.5.0', 'get_post()' ); 3267 return get_post( $postid, $mode ); 3268 } 3269 3270 /** 3271 * Check that the user login name and password is correct. 3272 * 3273 * @since 0.71 3274 * @deprecated 3.5.0 Use wp_authenticate() 3275 * @see wp_authenticate() 3276 * 3277 * @param string $user_login User name. 3278 * @param string $user_pass User password. 3279 * @return bool False if does not authenticate, true if username and password authenticates. 3280 */ 3281 function user_pass_ok($user_login, $user_pass) { 3282 _deprecated_function( __FUNCTION__, '3.5.0', 'wp_authenticate()' ); 3283 $user = wp_authenticate( $user_login, $user_pass ); 3284 if ( is_wp_error( $user ) ) 3285 return false; 3286 3287 return true; 3288 } 3289 3290 /** 3291 * Callback formerly fired on the save_post hook. No longer needed. 3292 * 3293 * @since 2.3.0 3294 * @deprecated 3.5.0 3295 */ 3296 function _save_post_hook() {} 3297 3298 /** 3299 * Check if the installed version of GD supports particular image type 3300 * 3301 * @since 2.9.0 3302 * @deprecated 3.5.0 Use wp_image_editor_supports() 3303 * @see wp_image_editor_supports() 3304 * 3305 * @param string $mime_type 3306 * @return bool 3307 */ 3308 function gd_edit_image_support($mime_type) { 3309 _deprecated_function( __FUNCTION__, '3.5.0', 'wp_image_editor_supports()' ); 3310 3311 if ( function_exists('imagetypes') ) { 3312 switch( $mime_type ) { 3313 case 'image/jpeg': 3314 return (imagetypes() & IMG_JPG) != 0; 3315 case 'image/png': 3316 return (imagetypes() & IMG_PNG) != 0; 3317 case 'image/gif': 3318 return (imagetypes() & IMG_GIF) != 0; 3319 } 3320 } else { 3321 switch( $mime_type ) { 3322 case 'image/jpeg': 3323 return function_exists('imagecreatefromjpeg'); 3324 case 'image/png': 3325 return function_exists('imagecreatefrompng'); 3326 case 'image/gif': 3327 return function_exists('imagecreatefromgif'); 3328 } 3329 } 3330 return false; 3331 } 3332 3333 /** 3334 * Converts an integer byte value to a shorthand byte value. 3335 * 3336 * @since 2.3.0 3337 * @deprecated 3.6.0 Use size_format() 3338 * @see size_format() 3339 * 3340 * @param int $bytes An integer byte value. 3341 * @return string A shorthand byte value. 3342 */ 3343 function wp_convert_bytes_to_hr( $bytes ) { 3344 _deprecated_function( __FUNCTION__, '3.6.0', 'size_format()' ); 3345 3346 $units = array( 0 => 'B', 1 => 'KB', 2 => 'MB', 3 => 'GB', 4 => 'TB' ); 3347 $log = log( $bytes, KB_IN_BYTES ); 3348 $power = (int) $log; 3349 $size = KB_IN_BYTES ** ( $log - $power ); 3350 3351 if ( ! is_nan( $size ) && array_key_exists( $power, $units ) ) { 3352 $unit = $units[ $power ]; 3353 } else { 3354 $size = $bytes; 3355 $unit = $units[0]; 3356 } 3357 3358 return $size . $unit; 3359 } 3360 3361 /** 3362 * Formerly used internally to tidy up the search terms. 3363 * 3364 * @since 2.9.0 3365 * @access private 3366 * @deprecated 3.7.0 3367 * 3368 * @param string $t Search terms to "tidy", e.g. trim. 3369 * @return string Trimmed search terms. 3370 */ 3371 function _search_terms_tidy( $t ) { 3372 _deprecated_function( __FUNCTION__, '3.7.0' ); 3373 return trim( $t, "\"'\n\r " ); 3374 } 3375 3376 /** 3377 * Determine if TinyMCE is available. 3378 * 3379 * Checks to see if the user has deleted the tinymce files to slim down 3380 * their WordPress installation. 3381 * 3382 * @since 2.1.0 3383 * @deprecated 3.9.0 3384 * 3385 * @return bool Whether TinyMCE exists. 3386 */ 3387 function rich_edit_exists() { 3388 global $wp_rich_edit_exists; 3389 _deprecated_function( __FUNCTION__, '3.9.0' ); 3390 3391 if ( ! isset( $wp_rich_edit_exists ) ) 3392 $wp_rich_edit_exists = file_exists( ABSPATH . WPINC . '/js/tinymce/tinymce.js' ); 3393 3394 return $wp_rich_edit_exists; 3395 } 3396 3397 /** 3398 * Old callback for tag link tooltips. 3399 * 3400 * @since 2.7.0 3401 * @access private 3402 * @deprecated 3.9.0 3403 * 3404 * @param int $count Number of topics. 3405 * @return int Number of topics. 3406 */ 3407 function default_topic_count_text( $count ) { 3408 return $count; 3409 } 3410 3411 /** 3412 * Formerly used to escape strings before inserting into the DB. 3413 * 3414 * Has not performed this function for many, many years. Use wpdb::prepare() instead. 3415 * 3416 * @since 0.71 3417 * @deprecated 3.9.0 3418 * 3419 * @param string $content The text to format. 3420 * @return string The very same text. 3421 */ 3422 function format_to_post( $content ) { 3423 _deprecated_function( __FUNCTION__, '3.9.0' ); 3424 return $content; 3425 } 3426 3427 /** 3428 * Formerly used to escape strings before searching the DB. It was poorly documented and never worked as described. 3429 * 3430 * @since 2.5.0 3431 * @deprecated 4.0.0 Use wpdb::esc_like() 3432 * @see wpdb::esc_like() 3433 * 3434 * @param string $text The text to be escaped. 3435 * @return string text, safe for inclusion in LIKE query. 3436 */ 3437 function like_escape($text) { 3438 _deprecated_function( __FUNCTION__, '4.0.0', 'wpdb::esc_like()' ); 3439 return str_replace( array( "%", "_" ), array( "\\%", "\\_" ), $text ); 3440 } 3441 3442 /** 3443 * Determines if the URL can be accessed over SSL. 3444 * 3445 * Determines if the URL can be accessed over SSL by using the WordPress HTTP API to access 3446 * the URL using https as the scheme. 3447 * 3448 * @since 2.5.0 3449 * @deprecated 4.0.0 3450 * 3451 * @param string $url The URL to test. 3452 * @return bool Whether SSL access is available. 3453 */ 3454 function url_is_accessable_via_ssl( $url ) { 3455 _deprecated_function( __FUNCTION__, '4.0.0' ); 3456 3457 $response = wp_remote_get( set_url_scheme( $url, 'https' ) ); 3458 3459 if ( !is_wp_error( $response ) ) { 3460 $status = wp_remote_retrieve_response_code( $response ); 3461 if ( 200 == $status || 401 == $status ) { 3462 return true; 3463 } 3464 } 3465 3466 return false; 3467 } 3468 3469 /** 3470 * Start preview theme output buffer. 3471 * 3472 * Will only perform task if the user has permissions and template and preview 3473 * query variables exist. 3474 * 3475 * @since 2.6.0 3476 * @deprecated 4.3.0 3477 */ 3478 function preview_theme() { 3479 _deprecated_function( __FUNCTION__, '4.3.0' ); 3480 } 3481 3482 /** 3483 * Private function to modify the current template when previewing a theme 3484 * 3485 * @since 2.9.0 3486 * @deprecated 4.3.0 3487 * @access private 3488 * 3489 * @return string 3490 */ 3491 function _preview_theme_template_filter() { 3492 _deprecated_function( __FUNCTION__, '4.3.0' ); 3493 return ''; 3494 } 3495 3496 /** 3497 * Private function to modify the current stylesheet when previewing a theme 3498 * 3499 * @since 2.9.0 3500 * @deprecated 4.3.0 3501 * @access private 3502 * 3503 * @return string 3504 */ 3505 function _preview_theme_stylesheet_filter() { 3506 _deprecated_function( __FUNCTION__, '4.3.0' ); 3507 return ''; 3508 } 3509 3510 /** 3511 * Callback function for ob_start() to capture all links in the theme. 3512 * 3513 * @since 2.6.0 3514 * @deprecated 4.3.0 3515 * @access private 3516 * 3517 * @param string $content 3518 * @return string 3519 */ 3520 function preview_theme_ob_filter( $content ) { 3521 _deprecated_function( __FUNCTION__, '4.3.0' ); 3522 return $content; 3523 } 3524 3525 /** 3526 * Manipulates preview theme links in order to control and maintain location. 3527 * 3528 * Callback function for preg_replace_callback() to accept and filter matches. 3529 * 3530 * @since 2.6.0 3531 * @deprecated 4.3.0 3532 * @access private 3533 * 3534 * @param array $matches 3535 * @return string 3536 */ 3537 function preview_theme_ob_filter_callback( $matches ) { 3538 _deprecated_function( __FUNCTION__, '4.3.0' ); 3539 return ''; 3540 } 3541 3542 /** 3543 * Formats text for the rich text editor. 3544 * 3545 * The {@see 'richedit_pre'} filter is applied here. If $text is empty the filter will 3546 * be applied to an empty string. 3547 * 3548 * @since 2.0.0 3549 * @deprecated 4.3.0 Use format_for_editor() 3550 * @see format_for_editor() 3551 * 3552 * @param string $text The text to be formatted. 3553 * @return string The formatted text after filter is applied. 3554 */ 3555 function wp_richedit_pre($text) { 3556 _deprecated_function( __FUNCTION__, '4.3.0', 'format_for_editor()' ); 3557 3558 if ( empty( $text ) ) { 3559 /** 3560 * Filters text returned for the rich text editor. 3561 * 3562 * This filter is first evaluated, and the value returned, if an empty string 3563 * is passed to wp_richedit_pre(). If an empty string is passed, it results 3564 * in a break tag and line feed. 3565 * 3566 * If a non-empty string is passed, the filter is evaluated on the wp_richedit_pre() 3567 * return after being formatted. 3568 * 3569 * @since 2.0.0 3570 * @deprecated 4.3.0 3571 * 3572 * @param string $output Text for the rich text editor. 3573 */ 3574 return apply_filters( 'richedit_pre', '' ); 3575 } 3576 3577 $output = convert_chars($text); 3578 $output = wpautop($output); 3579 $output = htmlspecialchars($output, ENT_NOQUOTES, get_option( 'blog_charset' ) ); 3580 3581 /** This filter is documented in wp-includes/deprecated.php */ 3582 return apply_filters( 'richedit_pre', $output ); 3583 } 3584 3585 /** 3586 * Formats text for the HTML editor. 3587 * 3588 * Unless $output is empty it will pass through htmlspecialchars before the 3589 * {@see 'htmledit_pre'} filter is applied. 3590 * 3591 * @since 2.5.0 3592 * @deprecated 4.3.0 Use format_for_editor() 3593 * @see format_for_editor() 3594 * 3595 * @param string $output The text to be formatted. 3596 * @return string Formatted text after filter applied. 3597 */ 3598 function wp_htmledit_pre($output) { 3599 _deprecated_function( __FUNCTION__, '4.3.0', 'format_for_editor()' ); 3600 3601 if ( !empty($output) ) 3602 $output = htmlspecialchars($output, ENT_NOQUOTES, get_option( 'blog_charset' ) ); // convert only < > & 3603 3604 /** 3605 * Filters the text before it is formatted for the HTML editor. 3606 * 3607 * @since 2.5.0 3608 * @deprecated 4.3.0 3609 * 3610 * @param string $output The HTML-formatted text. 3611 */ 3612 return apply_filters( 'htmledit_pre', $output ); 3613 } 3614 3615 /** 3616 * Retrieve permalink from post ID. 3617 * 3618 * @since 1.0.0 3619 * @deprecated 4.4.0 Use get_permalink() 3620 * @see get_permalink() 3621 * 3622 * @param int|WP_Post $post_id Optional. Post ID or WP_Post object. Default is global $post. 3623 * @return string|false 3624 */ 3625 function post_permalink( $post_id = 0 ) { 3626 _deprecated_function( __FUNCTION__, '4.4.0', 'get_permalink()' ); 3627 3628 return get_permalink( $post_id ); 3629 } 3630 3631 /** 3632 * Perform a HTTP HEAD or GET request. 3633 * 3634 * If $file_path is a writable filename, this will do a GET request and write 3635 * the file to that path. 3636 * 3637 * @since 2.5.0 3638 * @deprecated 4.4.0 Use WP_Http 3639 * @see WP_Http 3640 * 3641 * @param string $url URL to fetch. 3642 * @param string|bool $file_path Optional. File path to write request to. Default false. 3643 * @param int $red Optional. The number of Redirects followed, Upon 5 being hit, 3644 * returns false. Default 1. 3645 * @return bool|string False on failure and string of headers if HEAD request. 3646 */ 3647 function wp_get_http( $url, $file_path = false, $red = 1 ) { 3648 _deprecated_function( __FUNCTION__, '4.4.0', 'WP_Http' ); 3649 3650 @set_time_limit( 60 ); 3651 3652 if ( $red > 5 ) 3653 return false; 3654 3655 $options = array(); 3656 $options['redirection'] = 5; 3657 3658 if ( false == $file_path ) 3659 $options['method'] = 'HEAD'; 3660 else 3661 $options['method'] = 'GET'; 3662 3663 $response = wp_safe_remote_request( $url, $options ); 3664 3665 if ( is_wp_error( $response ) ) 3666 return false; 3667 3668 $headers = wp_remote_retrieve_headers( $response ); 3669 $headers['response'] = wp_remote_retrieve_response_code( $response ); 3670 3671 // WP_HTTP no longer follows redirects for HEAD requests. 3672 if ( 'HEAD' == $options['method'] && in_array($headers['response'], array(301, 302)) && isset( $headers['location'] ) ) { 3673 return wp_get_http( $headers['location'], $file_path, ++$red ); 3674 } 3675 3676 if ( false == $file_path ) 3677 return $headers; 3678 3679 // GET request - write it to the supplied filename 3680 $out_fp = fopen($file_path, 'w'); 3681 if ( !$out_fp ) 3682 return $headers; 3683 3684 fwrite( $out_fp, wp_remote_retrieve_body( $response ) ); 3685 fclose($out_fp); 3686 clearstatcache(); 3687 3688 return $headers; 3689 } 3690 3691 /** 3692 * Whether SSL login should be forced. 3693 * 3694 * @since 2.6.0 3695 * @deprecated 4.4.0 Use force_ssl_admin() 3696 * @see force_ssl_admin() 3697 * 3698 * @param string|bool $force Optional Whether to force SSL login. Default null. 3699 * @return bool True if forced, false if not forced. 3700 */ 3701 function force_ssl_login( $force = null ) { 3702 _deprecated_function( __FUNCTION__, '4.4.0', 'force_ssl_admin()' ); 3703 return force_ssl_admin( $force ); 3704 } 3705 3706 /** 3707 * Retrieve path of comment popup template in current or parent template. 3708 * 3709 * @since 1.5.0 3710 * @deprecated 4.5.0 3711 * 3712 * @return string Full path to comments popup template file. 3713 */ 3714 function get_comments_popup_template() { 3715 _deprecated_function( __FUNCTION__, '4.5.0' ); 3716 3717 return ''; 3718 } 3719 3720 /** 3721 * Determines whether the current URL is within the comments popup window. 3722 * 3723 * For more information on this and similar theme functions, check out 3724 * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ 3725 * Conditional Tags} article in the Theme Developer Handbook. 3726 * 3727 * @since 1.5.0 3728 * @deprecated 4.5.0 3729 * 3730 * @return bool 3731 */ 3732 function is_comments_popup() { 3733 _deprecated_function( __FUNCTION__, '4.5.0' ); 3734 3735 return false; 3736 } 3737 3738 /** 3739 * Display the JS popup script to show a comment. 3740 * 3741 * @since 0.71 3742 * @deprecated 4.5.0 3743 */ 3744 function comments_popup_script() { 3745 _deprecated_function( __FUNCTION__, '4.5.0' ); 3746 } 3747 3748 /** 3749 * Adds element attributes to open links in new tabs. 3750 * 3751 * @since 0.71 3752 * @deprecated 4.5.0 3753 * 3754 * @param string $text Content to replace links to open in a new tab. 3755 * @return string Content that has filtered links. 3756 */ 3757 function popuplinks( $text ) { 3758 _deprecated_function( __FUNCTION__, '4.5.0' ); 3759 $text = preg_replace('/<a (.+?)>/i', "<a $1 target='_blank' rel='external'>", $text); 3760 return $text; 3761 } 3762 3763 /** 3764 * The Google Video embed handler callback. 3765 * 3766 * Deprecated function that previously assisted in turning Google Video URLs 3767 * into embeds but that service has since been shut down. 3768 * 3769 * @since 2.9.0 3770 * @deprecated 4.6.0 3771 * 3772 * @return string An empty string. 3773 */ 3774 function wp_embed_handler_googlevideo( $matches, $attr, $url, $rawattr ) { 3775 _deprecated_function( __FUNCTION__, '4.6.0' ); 3776 3777 return ''; 3778 } 3779 3780 /** 3781 * Retrieve path of paged template in current or parent template. 3782 * 3783 * @since 1.5.0 3784 * @deprecated 4.7.0 The paged.php template is no longer part of the theme template hierarchy. 3785 * 3786 * @return string Full path to paged template file. 3787 */ 3788 function get_paged_template() { 3789 _deprecated_function( __FUNCTION__, '4.7.0' ); 3790 3791 return get_query_template( 'paged' ); 3792 } 3793 3794 /** 3795 * Removes the HTML JavaScript entities found in early versions of Netscape 4. 3796 * 3797 * Previously, this function was pulled in from the original 3798 * import of kses and removed a specific vulnerability only 3799 * existent in early version of Netscape 4. However, this 3800 * vulnerability never affected any other browsers and can 3801 * be considered safe for the modern web. 3802 * 3803 * The regular expression which sanitized this vulnerability 3804 * has been removed in consideration of the performance and 3805 * energy demands it placed, now merely passing through its 3806 * input to the return. 3807 * 3808 * @since 1.0.0 3809 * @deprecated 4.7.0 Officially dropped security support for Netscape 4. 3810 * 3811 * @param string $string 3812 * @return string 3813 */ 3814 function wp_kses_js_entities( $string ) { 3815 _deprecated_function( __FUNCTION__, '4.7.0' ); 3816 3817 return preg_replace( '%&\s*\{[^}]*(\}\s*;?|$)%', '', $string ); 3818 } 3819 3820 /** 3821 * Sort categories by ID. 3822 * 3823 * Used by usort() as a callback, should not be used directly. Can actually be 3824 * used to sort any term object. 3825 * 3826 * @since 2.3.0 3827 * @deprecated 4.7.0 Use wp_list_sort() 3828 * @access private 3829 * 3830 * @param object $a 3831 * @param object $b 3832 * @return int 3833 */ 3834 function _usort_terms_by_ID( $a, $b ) { 3835 _deprecated_function( __FUNCTION__, '4.7.0', 'wp_list_sort()' ); 3836 3837 if ( $a->term_id > $b->term_id ) 3838 return 1; 3839 elseif ( $a->term_id < $b->term_id ) 3840 return -1; 3841 else 3842 return 0; 3843 } 3844 3845 /** 3846 * Sort categories by name. 3847 * 3848 * Used by usort() as a callback, should not be used directly. Can actually be 3849 * used to sort any term object. 3850 * 3851 * @since 2.3.0 3852 * @deprecated 4.7.0 Use wp_list_sort() 3853 * @access private 3854 * 3855 * @param object $a 3856 * @param object $b 3857 * @return int 3858 */ 3859 function _usort_terms_by_name( $a, $b ) { 3860 _deprecated_function( __FUNCTION__, '4.7.0', 'wp_list_sort()' ); 3861 3862 return strcmp( $a->name, $b->name ); 3863 } 3864 3865 /** 3866 * Sort menu items by the desired key. 3867 * 3868 * @since 3.0.0 3869 * @deprecated 4.7.0 Use wp_list_sort() 3870 * @access private 3871 * 3872 * @global string $_menu_item_sort_prop 3873 * 3874 * @param object $a The first object to compare 3875 * @param object $b The second object to compare 3876 * @return int -1, 0, or 1 if $a is considered to be respectively less than, equal to, or greater than $b. 3877 */ 3878 function _sort_nav_menu_items( $a, $b ) { 3879 global $_menu_item_sort_prop; 3880 3881 _deprecated_function( __FUNCTION__, '4.7.0', 'wp_list_sort()' ); 3882 3883 if ( empty( $_menu_item_sort_prop ) ) 3884 return 0; 3885 3886 if ( ! isset( $a->$_menu_item_sort_prop ) || ! isset( $b->$_menu_item_sort_prop ) ) 3887 return 0; 3888 3889 $_a = (int) $a->$_menu_item_sort_prop; 3890 $_b = (int) $b->$_menu_item_sort_prop; 3891 3892 if ( $a->$_menu_item_sort_prop == $b->$_menu_item_sort_prop ) 3893 return 0; 3894 elseif ( $_a == $a->$_menu_item_sort_prop && $_b == $b->$_menu_item_sort_prop ) 3895 return $_a < $_b ? -1 : 1; 3896 else 3897 return strcmp( $a->$_menu_item_sort_prop, $b->$_menu_item_sort_prop ); 3898 } 3899 3900 /** 3901 * Retrieves the Press This bookmarklet link. 3902 * 3903 * @since 2.6.0 3904 * @deprecated 4.9.0 3905 * 3906 */ 3907 function get_shortcut_link() { 3908 _deprecated_function( __FUNCTION__, '4.9.0' ); 3909 3910 $link = ''; 3911 3912 /** 3913 * Filters the Press This bookmarklet link. 3914 * 3915 * @since 2.6.0 3916 * @deprecated 4.9.0 3917 * 3918 * @param string $link The Press This bookmarklet link. 3919 */ 3920 return apply_filters( 'shortcut_link', $link ); 3921 } 3922 3923 /** 3924 * Ajax handler for saving a post from Press This. 3925 * 3926 * @since 4.2.0 3927 * @deprecated 4.9.0 3928 */ 3929 function wp_ajax_press_this_save_post() { 3930 _deprecated_function( __FUNCTION__, '4.9.0' ); 3931 if ( is_plugin_active( 'press-this/press-this-plugin.php' ) ) { 3932 include( WP_PLUGIN_DIR . '/press-this/class-wp-press-this-plugin.php' ); 3933 $wp_press_this = new WP_Press_This_Plugin(); 3934 $wp_press_this->save_post(); 3935 } else { 3936 wp_send_json_error( array( 'errorMessage' => __( 'The Press This plugin is required.' ) ) ); 3937 } 3938 } 3939 3940 /** 3941 * Ajax handler for creating new category from Press This. 3942 * 3943 * @since 4.2.0 3944 * @deprecated 4.9.0 3945 */ 3946 function wp_ajax_press_this_add_category() { 3947 _deprecated_function( __FUNCTION__, '4.9.0' ); 3948 if ( is_plugin_active( 'press-this/press-this-plugin.php' ) ) { 3949 include( WP_PLUGIN_DIR . '/press-this/class-wp-press-this-plugin.php' ); 3950 $wp_press_this = new WP_Press_This_Plugin(); 3951 $wp_press_this->add_category(); 3952 } else { 3953 wp_send_json_error( array( 'errorMessage' => __( 'The Press This plugin is required.' ) ) ); 3954 } 3955 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sat Nov 23 20:47:33 2019 | Cross-referenced by PHPXref 0.7 |