WordPress.org

Make WordPress Core

Changeset 32614


Ignore:
Timestamp:
05/27/2015 03:31:46 PM (5 years ago)
Author:
wonderboymusic
Message:

Add missing doc blocks for pluggable.php.
Correct some @return values.
is_user_logged_in() can simply return the ->exists() call instead of if/else'ing true/false.

See #32444.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/pluggable.php

    r32465 r32614  
    1818 *
    1919 * @since 2.0.3
    20  * @global object $current_user The current user object which holds the user data.
    21  *
    22  * @param int $id User ID
     20 * @global WP_User $current_user The current user object which holds the user data.
     21 *
     22 * @param int    $id  User ID
    2323 * @param string $name User's username
    2424 * @return WP_User Current user User object
     
    5050 *
    5151 * @since 2.0.3
     52 *
     53 * @global WP_User $current_user
    5254 *
    5355 * @return WP_User Current user WP_User object
     
    7274 * @since 0.71
    7375 *
    74  * @uses $current_user Checks if the current user is set
    75  *
    76  * @return null|false False on XML-RPC Request and invalid auth cookie. Null when current user set.
     76 * @global WP_User $current_user Checks if the current user is set
     77 *
     78 * @return false|void False on XML-RPC Request and invalid auth cookie.
    7779 */
    7880function get_currentuserinfo() {
     
    132134 *
    133135 * @param int $user_id User ID
    134  * @return WP_User|bool WP_User object on success, false on failure.
     136 * @return WP_User|false WP_User object on success, false on failure.
    135137 */
    136138function get_userdata( $user_id ) {
     
    145147 * @since 2.8.0
    146148 *
    147  * @param string $field The field to retrieve the user with. id | slug | email | login
     149 * @param string     $field The field to retrieve the user with. id | slug | email | login
    148150 * @param int|string $value A value for $field. A user ID, slug, email address, or login name.
    149  * @return WP_User|bool WP_User object on success, false on failure.
     151 * @return WP_User|false WP_User object on success, false on failure.
    150152 */
    151153function get_user_by( $field, $value ) {
     
    167169 *
    168170 * @since 3.0.0
     171 *
     172 * @global wpdb $wpdb
    169173 *
    170174 * @param array $user_ids User ID numbers list
     
    213217 * @since 1.2.1
    214218 *
    215  * @uses PHPMailer
    216  *
    217  * @param string|array $to Array or comma-separated list of email addresses to send message.
    218  * @param string $subject Email subject
    219  * @param string $message Message contents
    220  * @param string|array $headers Optional. Additional headers.
     219 * @global PHPMailer $phpmailer
     220 *
     221 * @param string|array $to          Array or comma-separated list of email addresses to send message.
     222 * @param string       $subject    Email subject
     223 * @param string       $message    Message contents
     224 * @param string|array $headers     Optional. Additional headers.
    221225 * @param string|array $attachments Optional. Files to attach.
    222226 * @return bool Whether the email contents were sent successfully.
     
    617621 * @since 2.5.0
    618622 *
     623 * @global int $login_grace_period
     624 *
    619625 * @param string $cookie Optional. If used, will validate contents instead of cookie's
    620626 * @param string $scheme Optional. The cookie scheme to use: auth, secure_auth, or logged_in
    621  * @return bool|int False if invalid cookie, User ID if valid.
     627 * @return false|int False if invalid cookie, User ID if valid.
    622628 */
    623629function wp_validate_auth_cookie($cookie = '', $scheme = '') {
     
    724730 * @since 2.5.0
    725731 *
    726  * @param int $user_id User ID
    727  * @param int $expiration Cookie expiration in seconds
    728  * @param string $scheme Optional. The cookie scheme to use: auth, secure_auth, or logged_in
    729  * @param string $token User's session token to use for this cookie
     732 * @param int    $user_id    User ID
     733 * @param int    $expiration Cookie expiration in seconds
     734 * @param string $scheme     Optional. The cookie scheme to use: auth, secure_auth, or logged_in
     735 * @param string $token      User's session token to use for this cookie
    730736 * @return string Authentication cookie contents. Empty string if user does not exist.
    731737 */
     
    774780 * @param string $cookie
    775781 * @param string $scheme Optional. The cookie scheme to use: auth, secure_auth, or logged_in
    776  * @return array Authentication cookie components
     782 * @return array|false Authentication cookie components
    777783 */
    778784function wp_parse_auth_cookie($cookie = '', $scheme = '') {
     
    825831 * @since 4.3.0 Added the `$token` parameter.
    826832 *
    827  * @param int $user_id User ID
    828  * @param bool $remember Whether to remember the user
    829  * @param mixed $secure  Whether the admin cookies should only be sent over HTTPS.
    830  *                       Default is_ssl().
    831  * @param string $token  Optional. User's session token to use for this cookie.
     833 * @param int    $user_id User ID
     834 * @param bool   $remember Whether to remember the user
     835 * @param mixed  $secure   Whether the admin cookies should only be sent over HTTPS.
     836 *                         Default is_ssl().
     837 * @param string $token    Optional. User's session token to use for this cookie.
    832838 */
    833839function wp_set_auth_cookie( $user_id, $remember = false, $secure = '', $token = '' ) {
     
    981987    $user = wp_get_current_user();
    982988
    983     if ( ! $user->exists() )
    984         return false;
    985 
    986     return true;
     989    return $user->exists();
    987990}
    988991endif;
     
    11631166 * @since 1.5.1
    11641167 *
     1168 * @global bool $is_IIS
     1169 *
    11651170 * @param string $location The path to redirect to.
    1166  * @param int $status Status code to use.
     1171 * @param int    $status  Status code to use.
    11671172 * @return bool False if $location is not provided, true otherwise.
    11681173 */
     
    12311236    // remove %0d and %0a from location
    12321237    $strip = array('%0d', '%0a', '%0D', '%0A');
    1233     $location = _deep_replace($strip, $location);
    1234     return $location;
     1238    return _deep_replace( $strip, $location );
    12351239}
    12361240
     
    12621266 *
    12631267 * @since 2.3.0
    1264  *
    1265  * @return void Does not return anything
    1266  **/
     1268 */
    12671269function wp_safe_redirect($location, $status = 302) {
    12681270
     
    12891291 *
    12901292 * @param string $location The redirect to validate
    1291  * @param string $default The value to return if $location is not allowed
     1293 * @param string $default  The value to return if $location is not allowed
    12921294 * @return string redirect-sanitized URL
    12931295 **/
     
    13401342 * @since 1.0.0
    13411343 *
    1342  * @param int $comment_id Comment ID
     1344 * @param int    $comment_id Comment ID
    13431345 * @param string $deprecated Not used
    13441346 * @return bool True on completion. False if no email addresses were specified.
     
    15361538 *
    15371539 * @param int $comment_id Comment ID
    1538  * @return bool Always returns true
     1540 * @return true Always returns true
    15391541 */
    15401542function wp_notify_moderator($comment_id) {
     
    18411843 * @link https://api.wordpress.org/secret-key/1.1/salt/ Create secrets for wp-config.php
    18421844 *
     1845 * @staticvar array $cached_salts
     1846 * @staticvar array $duplicated_keys
     1847 *
    18431848 * @param string $scheme Authentication scheme (auth, secure_auth, logged_in, nonce)
    18441849 * @return string Salt value
     
    19401945 * @since 2.5.0
    19411946 *
    1942  * @global object $wp_hasher PHPass object
    1943  * @uses PasswordHash::HashPassword
     1947 * @global PasswordHash $wp_hasher PHPass object
    19441948 *
    19451949 * @param string $password Plain text user password to hash
     
    19731977 * @since 2.5.0
    19741978 *
    1975  * @global object $wp_hasher PHPass object used for checking the password
     1979 * @global PasswordHash $wp_hasher PHPass object used for checking the password
    19761980 *  against the $hash + $password
    19771981 * @uses PasswordHash::CheckPassword
    19781982 *
    19791983 * @param string $password Plaintext user's password
    1980  * @param string $hash Hash of the user's password to check against.
     1984 * @param string $hash     Hash of the user's password to check against.
    19811985 * @return bool False, if the $password does not match the hashed password
    19821986 */
     
    20622066 *
    20632067 * @since 2.6.2
     2068 *
     2069 * @global string $rnd_value
     2070 * @staticvar string $seed
    20642071 *
    20652072 * @param int $min Lower limit for the generated number
     
    21202127 *
    21212128 * @param string $password The plaintext new user password
    2122  * @param int $user_id User ID
     2129 * @param int    $user_id User ID
    21232130 */
    21242131function wp_set_password( $password, $user_id ) {
     
    22982305 * @uses WP_Text_Diff_Renderer_Table
    22992306 *
    2300  * @param string $left_string "old" (left) version of string
    2301  * @param string $right_string "new" (right) version of string
    2302  * @param string|array $args Optional. Change 'title', 'title_left', and 'title_right' defaults.
     2307 * @param string       $left_string "old" (left) version of string
     2308 * @param string       $right_string "new" (right) version of string
     2309 * @param string|array $args         Optional. Change 'title', 'title_left', and 'title_right' defaults.
    23032310 * @return string Empty string if strings are equivalent or HTML with differences.
    23042311 */
Note: See TracChangeset for help on using the changeset viewer.