Ticket #5509: pluggable.phpdoc.r6473.diff
| File pluggable.phpdoc.r6473.diff, 15.5 kB (added by darkdragon, 7 months ago) |
|---|
-
pluggable.php
old new 1 1 <?php 2 /** 3 * These functions can be replaced via plugins. They are loaded after 4 * plugins are loaded. 5 * 6 * @package WordPress 7 */ 2 8 3 /* These functions can be replaced via plugins. They are loaded after4 plugins are loaded. */5 6 9 if ( !function_exists('set_current_user') ) : 10 /** 11 * set_current_user() - {@internal Missing Short Description}} 12 * 13 * {@internal Missing Long Description 14 * Documentation must describe why set_current_user() would be override 15 * instead of wp_set_current_user(). There is a reason and must look for it. 16 * If exists on the codex, then link to that instead. 17 * }} 18 * 19 * @since 2.0.1 20 * @see wp_set_current_user() An alias of wp_set_current_user() 21 * 22 * @param int $id 23 * @param string $name 24 * @return object returns wp_set_current_user() 25 */ 7 26 function set_current_user($id, $name = '') { 8 27 return wp_set_current_user($id, $name); 9 28 } 10 29 endif; 11 30 12 31 if ( !function_exists('wp_set_current_user') ) : 32 /** 33 * wp_set_current_user() - {@internal Missing Short Description}} 34 * 35 * {@internal Missing Long Description 36 * Documentation must describe why wp_set_current_user() would be override 37 * instead of set_current_user(). There is a reason and must look for it. 38 * If exists on the codex, then link to that instead. 39 * }} 40 * 41 * @since 42 * @global object $current_user The current user object which holds the user data. 43 * 44 * @param int $id 45 * @param string $name 46 * @return object 47 */ 13 48 function wp_set_current_user($id, $name = '') { 14 49 global $current_user; 15 50 … … 27 62 endif; 28 63 29 64 if ( !function_exists('wp_get_current_user') ) : 65 /** 66 * wp_get_current_user() - 67 * 68 * @since 69 * 70 * @return unknown 71 */ 30 72 function wp_get_current_user() { 31 73 global $current_user; 32 74 … … 37 79 endif; 38 80 39 81 if ( !function_exists('get_currentuserinfo') ) : 82 /** 83 * get_currentuserinfo() - 84 * 85 * @since 86 * 87 * @return unknown 88 */ 40 89 function get_currentuserinfo() { 41 90 global $current_user; 42 91 … … 56 105 endif; 57 106 58 107 if ( !function_exists('get_userdata') ) : 108 /** 109 * get_userdata() - 110 * 111 * @since 112 * 113 * @param unknown_type $user_id 114 * @return unknown 115 */ 59 116 function get_userdata( $user_id ) { 60 117 global $wpdb; 61 118 … … 82 139 endif; 83 140 84 141 if ( !function_exists('update_user_cache') ) : 142 /** 143 * update_user_cache() - 144 * 145 * @since 146 * 147 * @return bool Only returns true 148 */ 85 149 function update_user_cache() { 86 150 return true; 87 151 } 88 152 endif; 89 153 90 154 if ( !function_exists('get_userdatabylogin') ) : 155 /** 156 * get_userdatabylogin() - 157 * 158 * @since 159 * 160 * @param unknown_type $user_login 161 * @return unknown 162 */ 91 163 function get_userdatabylogin($user_login) { 92 164 global $wpdb; 93 165 $user_login = sanitize_user( $user_login ); … … 118 190 endif; 119 191 120 192 if ( !function_exists('get_user_by_email') ) : 193 /** 194 * get_user_by_email() - 195 * 196 * @since 197 * 198 * @param unknown_type $email 199 * @return unknown 200 */ 121 201 function get_user_by_email($email) { 122 202 global $wpdb; 123 203 … … 145 225 endif; 146 226 147 227 if ( !function_exists( 'wp_mail' ) ) : 228 /** 229 * wp_mail() - 230 * 231 * @since 232 * 233 * @param unknown_type $to 234 * @param unknown_type $subject 235 * @param unknown_type $message 236 * @param unknown_type $headers 237 * @return unknown 238 */ 148 239 function wp_mail( $to, $subject, $message, $headers = '' ) { 149 240 // Compact the input, apply the filters, and extract them back out 150 241 extract( apply_filters( 'wp_mail', compact( 'to', 'subject', 'message', 'headers' ) ) ); … … 291 382 endif; 292 383 293 384 if ( !function_exists('wp_login') ) : 385 /** 386 * wp_login() - 387 * 388 * @since 389 * 390 * @param unknown_type $username 391 * @param unknown_type $password 392 * @param unknown_type $deprecated 393 * @return unknown 394 */ 294 395 function wp_login($username, $password, $deprecated = false) { 295 396 global $wpdb, $error; 296 397 … … 325 426 endif; 326 427 327 428 if ( !function_exists('wp_validate_auth_cookie') ) : 429 /** 430 * wp_validate_auth_cookie() - 431 * 432 * @since 433 * 434 * @param unknown_type $cookie 435 * @return unknown 436 */ 328 437 function wp_validate_auth_cookie($cookie = '') { 329 438 if ( empty($cookie) ) { 330 439 if ( empty($_COOKIE[AUTH_COOKIE]) ) … … 358 467 endif; 359 468 360 469 if ( !function_exists('wp_set_auth_cookie') ) : 470 /** 471 * wp_set_auth_cookie() - 472 * 473 * @since 474 * 475 * @param unknown_type $user_id 476 * @param unknown_type $remember 477 */ 361 478 function wp_set_auth_cookie($user_id, $remember = false) { 362 479 $user = get_userdata($user_id); 363 480 … … 380 497 endif; 381 498 382 499 if ( !function_exists('wp_clear_auth_cookie') ) : 500 /** 501 * wp_clear_auth_cookie() - 502 * 503 * @since 504 * 505 */ 383 506 function wp_clear_auth_cookie() { 384 507 setcookie(AUTH_COOKIE, ' ', time() - 31536000, COOKIEPATH, COOKIE_DOMAIN); 385 508 setcookie(AUTH_COOKIE, ' ', time() - 31536000, SITECOOKIEPATH, COOKIE_DOMAIN); … … 393 516 endif; 394 517 395 518 if ( !function_exists('is_user_logged_in') ) : 519 /** 520 * is_user_logged_in() - 521 * 522 * @since 523 * 524 * @return bool 525 */ 396 526 function is_user_logged_in() { 397 527 $user = wp_get_current_user(); 398 528 … … 404 534 endif; 405 535 406 536 if ( !function_exists('auth_redirect') ) : 537 /** 538 * auth_redirect() - 539 * 540 * @since 541 * 542 */ 407 543 function auth_redirect() { 408 544 // Checks if a user is logged in, if not redirects them to the login page 409 545 if ( (!empty($_COOKIE[AUTH_COOKIE]) && … … 418 554 endif; 419 555 420 556 if ( !function_exists('check_admin_referer') ) : 557 /** 558 * check_admin_referer() - 559 * 560 * @param unknown_type $action 561 */ 421 562 function check_admin_referer($action = -1) { 422 563 $adminurl = strtolower(get_option('siteurl')).'/wp-admin'; 423 564 $referer = strtolower(wp_get_referer()); … … 430 571 }endif; 431 572 432 573 if ( !function_exists('check_ajax_referer') ) : 574 /** 575 * check_ajax_referer() - 576 * 577 * @since 578 * 579 * @param unknown_type $action 580 */ 433 581 function check_ajax_referer( $action = -1 ) { 434 582 $nonce = $_REQUEST['_ajax_nonce'] ? $_REQUEST['_ajax_nonce'] : $_REQUEST['_wpnonce']; 435 583 if ( !wp_verify_nonce( $nonce, $action ) ) { … … 462 610 // Cookie safe redirect. Works around IIS Set-Cookie bug. 463 611 // http://support.microsoft.com/kb/q176113/ 464 612 if ( !function_exists('wp_redirect') ) : 613 /** 614 * wp_redirect() - 615 * 616 * @since 617 * 618 * @param unknown_type $location 619 * @param unknown_type $status 620 * @return unknown 621 */ 465 622 function wp_redirect($location, $status = 302) { 466 623 global $is_IIS; 467 624 … … 484 641 485 642 if ( !function_exists('wp_sanitize_redirect') ) : 486 643 /** 487 * sanitizes a URL for use in a redirect 644 * wp_sanitize_redirect() - Sanitizes a URL for use in a redirect 645 * 646 * @since 647 * 488 648 * @return string redirect-sanitized URL 489 649 **/ 490 650 function wp_sanitize_redirect($location) { … … 509 669 510 670 if ( !function_exists('wp_safe_redirect') ) : 511 671 /** 512 * performs a safe (local) redirect, using wp_redirect() 672 * wp_safe_redirect() - Performs a safe (local) redirect, using wp_redirect() 673 * 674 * @since 2.3 675 * 513 676 * @return void 514 677 **/ 515 678 function wp_safe_redirect($location, $status = 302) { … … 534 697 endif; 535 698 536 699 if ( ! function_exists('wp_notify_postauthor') ) : 700 /** 701 * wp_notify_postauthor() - Notify an author of a comment/trackback/pingback to one of their posts 702 * 703 * @since 1.0.1 704 * 705 * @param int $comment_id Comment ID 706 * @param string $comment_type Optional. The comment type either 'comment' (default), 'trackback', or 'pingback' 707 * @return bool False if user email does not exist. True on completion. 708 */ 537 709 function wp_notify_postauthor($comment_id, $comment_type='') { 538 710 $comment = get_comment($comment_id); 539 711 $post = get_post($comment->comment_post_ID); … … 603 775 } 604 776 endif; 605 777 606 /* wp_notify_moderator 607 notifies the moderator of the blog (usually the admin) 608 about a new comment that waits for approval 609 always returns true 778 if ( !function_exists('wp_notify_moderator') ) : 779 /** 780 * wp_notify_moderator() - Notifies the moderator of the blog about a new comment that is awaiting approval 781 * 782 * @since 1.0.1 783 * @uses $wpdb 784 * 785 * @param int $comment_id Comment ID 786 * @return bool Always returns true 610 787 */ 611 if ( !function_exists('wp_notify_moderator') ) :612 788 function wp_notify_moderator($comment_id) { 613 789 global $wpdb; 614 790 … … 648 824 endif; 649 825 650 826 if ( !function_exists('wp_new_user_notification') ) : 827 /** 828 * wp_new_user_notification() - Notify the blog admin of a new user, normally via email 829 * 830 * @since 2.0 831 * 832 * @param int $user_id User ID 833 * @param string $plaintext_pass Optional. The user's plaintext password 834 */ 651 835 function wp_new_user_notification($user_id, $plaintext_pass = '') { 652 836 $user = new WP_User($user_id); 653 837 … … 673 857 endif; 674 858 675 859 if ( !function_exists('wp_verify_nonce') ) : 860 /** 861 * wp_verify_nonce() - Verify that correct nonce was used with time limit 862 * 863 * The user is given an amount of time to use the token, so therefore, since 864 * the UID and $action remain the same, the independent variable is the time. 865 * 866 * @since 2.0.4 867 * 868 * @param string $nonce 869 * @param string|int $action Should give context to what is taking place and be the same when nonce was created. 870 * @return bool Whether the nonce check passed or failed. 871 */ 676 872 function wp_verify_nonce($nonce, $action = -1) { 677 873 $user = wp_get_current_user(); 678 874 $uid = (int) $user->id; … … 687 883 endif; 688 884 689 885 if ( !function_exists('wp_create_nonce') ) : 886 /** 887 * wp_create_nonce() - Creates a random, one use token 888 * 889 * @since 2.0.4 890 * 891 * @param string|int $action Scalar value to add context to the nonce. 892 * @return string The one use form token 893 */ 690 894 function wp_create_nonce($action = -1) { 691 895 $user = wp_get_current_user(); 692 896 $uid = (int) $user->id; … … 698 902 endif; 699 903 700 904 if ( !function_exists('wp_salt') ) : 905 /** 906 * wp_salt() - Get salt to add to hashes to help prevent attacks 907 * 908 * You can set the salt by defining two areas. One is in the database and 909 * the other is in your wp-config.php file. The database location is defined 910 * in the option named 'secret', but most likely will not need to be changed. 911 * 912 * The second, located in wp-config.php, is a constant named 'SECRET_KEY', but 913 * is not required. If the constant is not defined then the database constants 914 * will be used, since they are most likely given to be unique. However, given 915 * that the salt will be added to the password and can be seen, the constant 916 * is recommended to be set manually. 917 * 918 * <code> 919 * define('SECRET_KEY', 'mAry1HadA15|\/|b17w55w1t3asSn09w'); 920 * </code> 921 * 922 * Attention: Do not use above example! 923 * 924 * Salting passwords helps against tools which has stored hashed values 925 * of common dictionary strings. The added values makes it harder to crack 926 * if given salt string is not weak. 927 * 928 * Salting only helps if the string is not predictable and should be 929 * made up of various characters. Think of the salt as a password for 930 * securing your passwords, but common among all of your passwords. 931 * Therefore the salt should be as long as possible as as difficult as 932 * possible, because you will not have to remember it. 933 * 934 * @since 2.4 935 * 936 * @return unknown 937 */ 701 938 function wp_salt() { 702 939 703 940 if ( defined('SECRET_KEY') && '' != SECRET_KEY ) … … 714 951 endif; 715 952 716 953 if ( !function_exists('wp_hash') ) : 954 /** 955 * wp_hash() - Get hash of given string 956 * 957 * @since 2.0.4 958 * @uses wp_salt() Get WordPress salt 959 * 960 * @param string $data Plain text to hash 961 * @return string Hash of $data 962 */ 717 963 function wp_hash($data) { 718 964 $salt = wp_salt(); 719 965 … … 726 972 endif; 727 973 728 974 if ( !function_exists('wp_hash_password') ) : 975 /** 976 * wp_hash_password() - Create a hash (encrypt) of a plain text password 977 * 978 * For integration with other applications, this function can be 979 * overwritten to instead use the other package password checking 980 * algorithm. 981 * 982 * @since 2.4 983 * @global object $wp_hasher PHPass object 984 * @uses PasswordHash::HashPassword 985 * 986 * @param string $password Plain text user password to hash 987 * @return string The hash string of the password 988 */ 729 989 function wp_hash_password($password) { 730 990 global $wp_hasher; 731 991 … … 740 1000 endif; 741 1001 742 1002 if ( !function_exists('wp_check_password') ) : 1003 /** 1004 * wp_check_password() - Checks the plaintext password against the encrypted Password 1005 * 1006 * Maintains compatibility between old version and the new cookie 1007 * authentication protocol using PHPass library. The $hash parameter 1008 * is the encrypted password and the function compares the plain text 1009 * password when encypted similarly against the already encrypted 1010 * password to see if they match. 1011 * 1012 * For integration with other applications, this function can be 1013 * overwritten to instead use the other package password checking 1014 * algorithm. 1015 * 1016 * @since 2.4 1017 * @global object $wp_hasher PHPass object used for checking the password 1018 * against the $hash + $password 1019 * @uses PasswordHash::CheckPassword 1020 * 1021 * @param string $password 1022 * @param string $hash 1023 * @return bool False, if the $password does not match the hashed password 1024 */ 743 1025 function wp_check_password($password, $hash) { 744 1026 global $wp_hasher; 745 1027 … … 760 1042 761 1043 if ( !function_exists('wp_generate_password') ) : 762 1044 /** 763 * Generates a random password drawn from the defined set of characters 764 * @return string the password 1045 * wp_generate_password() - Generates a random password drawn from the defined set of characters 1046 * 1047 * @since 2.4 1048 * 1049 * @return string The random password 765 1050 **/ 766 1051 function wp_generate_password() { 767 1052 $chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; … … 774 1059 endif; 775 1060 776 1061 if ( !function_exists('wp_set_password') ) : 1062 /** 1063 * wp_set_password() - Updates the user's password with a new encrypted one 1064 * 1065 * For integration with other applications, this function can be 1066 * overwritten to instead use the other package password checking 1067 * algorithm. 1068 * 1069 * @since 2.4 1070 * @uses $wpdb WordPress database object for queries 1071 * @uses wp_hash_password() Used to encrypt the user's password before passing to the database 1072 * 1073 * @param string $password The plaintext new user password 1074 * @param int $user_id User ID 1075 */ 777 1076 function wp_set_password( $password, $user_id ) { 778 1077 global $wpdb; 779 1078 … … 784 1083 } 785 1084 endif; 786 1085 787 // Deprecated. Use wp_set_auth_cookie()788 1086 if ( !function_exists('wp_setcookie') ) : 1087 /** 1088 * wp_setcookie() - Sets a cookie for a user who just logged in 1089 * 1090 * @since 1.5 1091 * @deprecated Use wp_set_auth_cookie() 1092 * @see wp_set_auth_cookie() 1093 * 1094 * @param string $username The user's username 1095 * @param string $password Optional. The user's password 1096 * @param bool $already_md5 Optional. Whether the password has already been through MD5 1097 * @param string $home Optional. Will be used instead of COOKIEPATH if set 1098 * @param string $siteurl Optional. Will be used instead of SITECOOKIEPATH if set 1099 * @param bool $remember Optional. Remember that the user is logged in 1100 */ 789 1101 function wp_setcookie($username, $password = '', $already_md5 = false, $home = '', $siteurl = '', $remember = false) { 790 1102 $user = get_userdatabylogin($username); 791 1103 wp_set_auth_cookie($user->ID, $remember); 792 1104 } 793 1105 endif; 794 1106 795 // Deprecated. Use wp_clear_auth_cookie()796 1107 if ( !function_exists('wp_clearcookie') ) : 1108 /** 1109 * wp_clearcookie() - Clears the authentication cookie, logging the user out 1110 * 1111 * @since 1.5 1112 * @deprecated Use wp_clear_auth_cookie() 1113 * @see wp_clear_auth_cookie() 1114 */ 797 1115 function wp_clearcookie() { 798 1116 wp_clear_auth_cookie(); 799 1117 } 800 1118 endif; 801 1119 802 // Deprecated. No alternative.803 1120 if ( !function_exists('wp_get_cookie_login') ): 1121 /** 1122 * wp_get_cookie_login() - {@internal Missing Short Description}} 1123 * 1124 * @since 2.0.4 1125 * @deprecated No alternative 1126 * 1127 * @return bool Always returns false 1128 */ 804 1129 function wp_get_cookie_login() { 805 1130 return false; 806 1131 }
