Make WordPress Core

Ticket #26888: 26888.diff

File 26888.diff, 24.2 KB (added by DrewAPicture, 11 years ago)
  • src/wp-includes/pluggable.php

     
    1818 *
    1919 * @since 2.0.3
    2020 * @global object $current_user The current user object which holds the user data.
    21  * @uses do_action() Calls 'set_current_user' hook after setting the current user.
    2221 *
    2322 * @param int $id User ID
    2423 * @param string $name User's username
     
    3433
    3534        setup_userdata( $current_user->ID );
    3635
    37         do_action('set_current_user');
     36        /**
     37         * Fires after the current user is set.
     38         *
     39         * @since 2.0.1
     40         */
     41        do_action( 'set_current_user' );
    3842
    3943        return $current_user;
    4044}
     
    204208 * be set using the 'wp_mail_charset' filter.
    205209 *
    206210 * @since 1.2.1
    207  * @uses apply_filters() Calls 'wp_mail' hook on an array of all of the parameters.
    208  * @uses apply_filters() Calls 'wp_mail_from' hook to get the from email address.
    209  * @uses apply_filters() Calls 'wp_mail_from_name' hook to get the from address name.
    210  * @uses apply_filters() Calls 'wp_mail_content_type' hook to get the email content type.
    211  * @uses apply_filters() Calls 'wp_mail_charset' hook to get the email charset
    212  * @uses do_action_ref_array() Calls 'phpmailer_init' hook on the reference to
    213  *              phpmailer object.
     211 *
    214212 * @uses PHPMailer
    215213 *
    216214 * @param string|array $to Array or comma-separated list of email addresses to send message.
     
    222220 */
    223221function wp_mail( $to, $subject, $message, $headers = '', $attachments = array() ) {
    224222        // Compact the input, apply the filters, and extract them back out
     223        /**
     224         * Filter the wp_mail() arguments.
     225         *
     226         * @since 2.2.0
     227         *
     228         * @param array $args A compacted array of wp_mail() arguments, including the "to" email, subject, message,
     229         *                    headers, and attachments values.
     230         */
    225231        extract( apply_filters( 'wp_mail', compact( 'to', 'subject', 'message', 'headers', 'attachments' ) ) );
    226232
    227233        if ( !is_array($attachments) )
     
    342348                $from_email = 'wordpress@' . $sitename;
    343349        }
    344350
    345         // Plugin authors can override the potentially troublesome default
    346         $phpmailer->From     = apply_filters( 'wp_mail_from'     , $from_email );
     351        /**
     352         * Filter the email address to send from.
     353         *
     354         * @since 2.2.0
     355         *
     356         * @param string $from_email Email address to send from.
     357         */
     358        $phpmailer->From = apply_filters( 'wp_mail_from', $from_email );
     359
     360        /**
     361         * Filter the name to associate with the "from" email address.
     362         *
     363         * @since 2.3.0
     364         *
     365         * @param string $from_name Name associated with the "from" email address.
     366         */
    347367        $phpmailer->FromName = apply_filters( 'wp_mail_from_name', $from_name  );
    348368
    349369        // Set destination addresses
     
    415435        if ( !isset( $content_type ) )
    416436                $content_type = 'text/plain';
    417437
     438        /**
     439         * Filter the wp_mail() content type.
     440         *
     441         * @since 2.3.0
     442         *
     443         * @param string $content_type Default wp_mail() content type.
     444         */
    418445        $content_type = apply_filters( 'wp_mail_content_type', $content_type );
    419446
    420447        $phpmailer->ContentType = $content_type;
     
    428455                $charset = get_bloginfo( 'charset' );
    429456
    430457        // Set the content-type and charset
     458
     459        /**
     460         * Filter the default wp_mail() charset.
     461         *
     462         * @since 2.3.0
     463         *
     464         * @param string $charset Default email charset.
     465         */
    431466        $phpmailer->CharSet = apply_filters( 'wp_mail_charset', $charset );
    432467
    433468        // Set custom headers
     
    450485                }
    451486        }
    452487
     488        /**
     489         * Fires after PHPMailer is initialized.
     490         *
     491         * @since 2.2.0
     492         *
     493         * @param PHPMailer &$phpmailer The PHPMailer instance, passed by reference.
     494         */
    453495        do_action_ref_array( 'phpmailer_init', array( &$phpmailer ) );
    454496
    455497        // Send!
     
    475517        $username = sanitize_user($username);
    476518        $password = trim($password);
    477519
     520        /**
     521         * Filter the user to authenticate.
     522         *
     523         * If a non-null value is passed, the filter will effectively short-circuit
     524         * authentication, returning an error instead.
     525         *
     526         * @since 2.8.0
     527         *
     528         * @param null|WP_User $user     User to authenticate.
     529         * @param string       $username User login.
     530         * @param string       $password User password
     531         */
    478532        $user = apply_filters('authenticate', null, $username, $password);
    479533
    480534        if ( $user == null ) {
     
    486540        $ignore_codes = array('empty_username', 'empty_password');
    487541
    488542        if (is_wp_error($user) && !in_array($user->get_error_code(), $ignore_codes) ) {
    489                 do_action('wp_login_failed', $username);
     543                /**
     544                 * Fires after a user login as failed.
     545                 *
     546                 * @since 2.5.0
     547                 *
     548                 * @param string $username User login.
     549                 */
     550                do_action( 'wp_login_failed', $username );
    490551        }
    491552
    492553        return $user;
     
    501562 */
    502563function wp_logout() {
    503564        wp_clear_auth_cookie();
    504         do_action('wp_logout');
     565
     566        /**
     567         * Fires after a user is logged-out.
     568         *
     569         * @since 1.5.0
     570         */
     571        do_action( 'wp_logout' );
    505572}
    506573endif;
    507574
     
    523590 */
    524591function wp_validate_auth_cookie($cookie = '', $scheme = '') {
    525592        if ( ! $cookie_elements = wp_parse_auth_cookie($cookie, $scheme) ) {
    526                 do_action('auth_cookie_malformed', $cookie, $scheme);
     593                /**
     594                 * Fires if an authentication cookie is malformed.
     595                 *
     596                 * @since 2.7.0
     597                 *
     598                 * @param string $cookie Malformed auth cookie.
     599                 * @param string $scheme Authentication scheme. Values include 'auth', 'secure_auth',
     600                 *                       or 'logged_in'.
     601                 */
     602                do_action( 'auth_cookie_malformed', $cookie, $scheme );
    527603                return false;
    528604        }
    529605
     
    537613
    538614        // Quick check to see if an honest cookie has expired
    539615        if ( $expired < time() ) {
    540                 do_action('auth_cookie_expired', $cookie_elements);
     616                /**
     617                 * Fires once an authentication cookie has expired.
     618                 *
     619                 * @since 2.7.0
     620                 *
     621                 * @param array $cookie_elements Array of data for the authentication cookie.
     622                 */
     623                do_action( 'auth_cookie_expired', $cookie_elements );
    541624                return false;
    542625        }
    543626
    544627        $user = get_user_by('login', $username);
    545628        if ( ! $user ) {
    546                 do_action('auth_cookie_bad_username', $cookie_elements);
     629                /**
     630                 * Fires if a bad username is entered in the user authentication process.
     631                 *
     632                 * @since 2.7.0
     633                 *
     634                 * @param array $cookie_elements Array of data for the authentication cookie.
     635                 */
     636                do_action( 'auth_cookie_bad_username', $cookie_elements );
    547637                return false;
    548638        }
    549639
     
    553643        $hash = hash_hmac('md5', $username . '|' . $expiration, $key);
    554644
    555645        if ( $hmac != $hash ) {
    556                 do_action('auth_cookie_bad_hash', $cookie_elements);
     646                /**
     647                 * Fires if a bad authentication cookie hash is encountered.
     648                 *
     649                 * @since 2.7.0
     650                 *
     651                 * @param array $cookie_elements Array of data for the authentication cookie.
     652                 */
     653                do_action( 'auth_cookie_bad_hash', $cookie_elements );
    557654                return false;
    558655        }
    559656
    560657        if ( $expiration < time() ) // AJAX/POST grace period set above
    561658                $GLOBALS['login_grace_period'] = 1;
    562659
    563         do_action('auth_cookie_valid', $cookie_elements, $user);
     660        /**
     661         * Fires once an authentication cookie has been validated.
     662         *
     663         * @since 2.7.0
     664         *
     665         * @param array   $cookie_elements Array of data for the authentication cookie.
     666         * @param WP_User $user            User object.
     667         */
     668        do_action( 'auth_cookie_valid', $cookie_elements, $user );
    564669
    565670        return $user->ID;
    566671}
     
    572677 *
    573678 * @since 2.5.0
    574679 *
    575  * @uses apply_filters() Calls 'auth_cookie' hook on $cookie contents, User ID
    576  *              and expiration of cookie.
    577  *
    578680 * @param int $user_id User ID
    579681 * @param int $expiration Cookie expiration in seconds
    580682 * @param string $scheme Optional. The cookie scheme to use: auth, secure_auth, or logged_in
     
    590692
    591693        $cookie = $user->user_login . '|' . $expiration . '|' . $hash;
    592694
    593         return apply_filters('auth_cookie', $cookie, $user_id, $expiration, $scheme);
     695        /**
     696         * Filter the authentication cookie.
     697         *
     698         * @since 2.5.0
     699         *
     700         * @param string $cookie     Authentication cookie.
     701         * @param int    $user_id    User ID.
     702         * @param int    $expiration Authentication cookie expiration in seconds.
     703         * @param string $scheme     Cookie scheme used. Accepts 'auth', 'secure_auth', or 'logged_in'.
     704         */
     705        return apply_filters( 'auth_cookie', $cookie, $user_id, $expiration, $scheme );
    594706}
    595707endif;
    596708
     
    656768 */
    657769function wp_set_auth_cookie($user_id, $remember = false, $secure = '') {
    658770        if ( $remember ) {
    659                 $expiration = time() + apply_filters('auth_cookie_expiration', 14 * DAY_IN_SECONDS, $user_id, $remember);
    660                 // Ensure the browser will continue to send the cookie after the expiration time is reached.
    661                 // Needed for the login grace period in wp_validate_auth_cookie().
     771                /**
     772                 * Filter the length of the authentication cookie expiration period.
     773                 *
     774                 * @since 2.8.0
     775                 *
     776                 * @param int  $length   Length of the expiration period in seconds.
     777                 * @param int  $user_id  User ID.
     778                 * @param bool $remember Whether to remember the user login. Default false.
     779                 */
     780                $expiration = time() + apply_filters( 'auth_cookie_expiration', 14 * DAY_IN_SECONDS, $user_id, $remember );
     781
     782                /*
     783                 * Ensure the browser will continue to send the cookie after the expiration time is reached.
     784                 * Needed for the login grace period in wp_validate_auth_cookie().
     785                 */
    662786                $expire = $expiration + ( 12 * HOUR_IN_SECONDS );
    663787        } else {
    664                 $expiration = time() + apply_filters('auth_cookie_expiration', 2 * DAY_IN_SECONDS, $user_id, $remember);
     788                /** This filter is documented in wp-includes/pluggable.php */
     789                $expiration = time() + apply_filters( 'auth_cookie_expiration', 2 * DAY_IN_SECONDS, $user_id, $remember );
    665790                $expire = 0;
    666791        }
    667792
    668793        if ( '' === $secure )
    669794                $secure = is_ssl();
    670795
    671         $secure = apply_filters('secure_auth_cookie', $secure, $user_id);
    672         $secure_logged_in_cookie = apply_filters('secure_logged_in_cookie', false, $user_id, $secure);
     796        /**
     797         * Filter whether to use a secure authentication cookie.
     798         *
     799         * @since 3.1.0
     800         *
     801         * @param bool $secure  Whether to use a secure auth cookie. Default is value of is_ssl
     802         *                      or false.
     803         * @param int  $user_id User ID.
     804         */
     805        $secure = apply_filters( 'secure_auth_cookie', $secure, $user_id );
    673806
     807        /**
     808         * Filter the secure logged-in cookie.
     809         *
     810         * @since 3.1.0
     811         *
     812         * @param bool|string $cookie  The secure logged-in cookie. Default false.
     813         * @param int         $user_id User ID.
     814         * @param bool        $secure  Whether to use a secure auth cookie. Default is value
     815         *                             of is_ssl() or false.
     816         */
     817        $secure_logged_in_cookie = apply_filters( 'secure_logged_in_cookie', false, $user_id, $secure );
     818
    674819        if ( $secure ) {
    675820                $auth_cookie_name = SECURE_AUTH_COOKIE;
    676821                $scheme = 'secure_auth';
     
    682827        $auth_cookie = wp_generate_auth_cookie($user_id, $expiration, $scheme);
    683828        $logged_in_cookie = wp_generate_auth_cookie($user_id, $expiration, 'logged_in');
    684829
    685         do_action('set_auth_cookie', $auth_cookie, $expire, $expiration, $user_id, $scheme);
    686         do_action('set_logged_in_cookie', $logged_in_cookie, $expire, $expiration, $user_id, 'logged_in');
     830        /**
     831         * Fires immediately before the authentication cookie is set.
     832         *
     833         * @since 2.5.0
     834         *
     835         * @param string $auth_cookie Authentication cookie.
     836         * @param int    $expire      Login grace period in seconds. Default 43,200 seconds or 12 hours.
     837         * @param int    $expiration  Duration in seconds the authentication cookie should be valid.
     838         *                            Default 1,209,600 seconds or 14 days.
     839         * @param int    $user_id     User ID.
     840         * @param string $scheme      Authentication scheme. Values include 'auth', 'secure_auth', or 'logged_in'.
     841         */
     842        do_action( 'set_auth_cookie', $auth_cookie, $expire, $expiration, $user_id, $scheme );
    687843
     844        /**
     845         * Fires immediate before the secure authentication cookie is set.
     846         *
     847         * @since 2.6.0
     848         *
     849         * @param string $logged_in_cookie The logged-in cookie.
     850         * @param int    $expire      Login grace period in seconds. Default 43,200 seconds or 12 hours.
     851         * @param int    $expiration  Duration in seconds the authentication cookie should be valid.
     852         *                            Default 1,209,600 seconds or 14 days.
     853         * @param int    $user_id     User ID.
     854         * @param string $scheme      Authentication scheme. Default 'logged_in'.
     855         */
     856        do_action( 'set_logged_in_cookie', $logged_in_cookie, $expire, $expiration, $user_id, 'logged_in' );
     857
    688858        setcookie($auth_cookie_name, $auth_cookie, $expire, PLUGINS_COOKIE_PATH, COOKIE_DOMAIN, $secure, true);
    689859        setcookie($auth_cookie_name, $auth_cookie, $expire, ADMIN_COOKIE_PATH, COOKIE_DOMAIN, $secure, true);
    690860        setcookie(LOGGED_IN_COOKIE, $logged_in_cookie, $expire, COOKIEPATH, COOKIE_DOMAIN, $secure_logged_in_cookie, true);
     
    700870 * @since 2.5.0
    701871 */
    702872function wp_clear_auth_cookie() {
    703         do_action('clear_auth_cookie');
     873        /**
     874         * Fires just before the authentication cookie is cleared.
     875         *
     876         * @since 2.7.0
     877         */
     878        do_action( 'clear_auth_cookie' );
    704879
    705880        setcookie( AUTH_COOKIE,        ' ', time() - YEAR_IN_SECONDS, ADMIN_COOKIE_PATH,   COOKIE_DOMAIN );
    706881        setcookie( SECURE_AUTH_COOKIE, ' ', time() - YEAR_IN_SECONDS, ADMIN_COOKIE_PATH,   COOKIE_DOMAIN );
     
    752927
    753928        $secure = ( is_ssl() || force_ssl_admin() );
    754929
    755         $secure = apply_filters('secure_auth_redirect', $secure);
     930        /**
     931         * Filter whether to use a secure authentication redirect.
     932         *
     933         * @since 3.1.0
     934         *
     935         * @param bool $secure Whether to use a secure authentication redirect. Default false.
     936         */
     937        $secure = apply_filters( 'secure_auth_redirect', $secure );
    756938
    757939        // If https is required and request is http, redirect
    758940        if ( $secure && !is_ssl() && false !== strpos($_SERVER['REQUEST_URI'], 'wp-admin') ) {
     
    765947                }
    766948        }
    767949
    768         if ( is_user_admin() )
     950        if ( is_user_admin() ) {
    769951                $scheme = 'logged_in';
    770         else
     952        } else {
     953                /**
     954                 * Filter the authentication redirect scheme.
     955                 *
     956                 * @since 2.9.0
     957                 *
     958                 * @param string $scheme Autentication redirect scheme. Default empty.
     959                 */
    771960                $scheme = apply_filters( 'auth_redirect_scheme', '' );
     961        }
    772962
    773963        if ( $user_id = wp_validate_auth_cookie( '',  $scheme) ) {
    774                 do_action('auth_redirect', $user_id);
     964                /**
     965                 * Fires before the authentication redirect.
     966                 *
     967                 * @since 2.8.0
     968                 *
     969                 * @param int $user_id User ID.
     970                 */
     971                do_action( 'auth_redirect', $user_id );
    775972
    776973                // If the user wants ssl but the session is not ssl, redirect.
    777974                if ( !$secure && get_user_option('use_ssl', $user_id) && false !== strpos($_SERVER['REQUEST_URI'], 'wp-admin') ) {
     
    8061003 * To avoid security exploits.
    8071004 *
    8081005 * @since 1.2.0
    809  * @uses do_action() Calls 'check_admin_referer' on $action.
    8101006 *
    8111007 * @param string $action Action nonce
    8121008 * @param string $query_arg where to look for nonce in $_REQUEST (since 2.5)
     
    8221018                wp_nonce_ays($action);
    8231019                die();
    8241020        }
    825         do_action('check_admin_referer', $action, $result);
     1021
     1022        /**
     1023         * Fires once the admin request has been validated or not.
     1024         *
     1025         * @since 1.5.1
     1026         *
     1027         * @param string $action The nonce action.
     1028         * @param bool   $result Whether the admin request nonce was validated.
     1029         */
     1030        do_action( 'check_admin_referer', $action, $result );
    8261031        return $result;
    8271032}
    8281033endif;
     
    8551060                        die( '-1' );
    8561061        }
    8571062
    858         do_action('check_ajax_referer', $action, $result);
     1063        /**
     1064         * Fires once the AJAX request has been validated or not.
     1065         *
     1066         * @since 2.1.0
     1067         *
     1068         * @param string $action The AJAX nonce action.
     1069         * @param bool   $result Whether the AJAX request nonce was validated.
     1070         */
     1071        do_action( 'check_ajax_referer', $action, $result );
    8591072
    8601073        return $result;
    8611074}
     
    8661079 * Redirects to another page.
    8671080 *
    8681081 * @since 1.5.1
    869  * @uses apply_filters() Calls 'wp_redirect' hook on $location and $status.
    8701082 *
    8711083 * @param string $location The path to redirect to.
    8721084 * @param int $status Status code to use.
     
    9681180 * If the host is not allowed, then the redirect is to $default supplied
    9691181 *
    9701182 * @since 2.8.1
    971  * @uses apply_filters() Calls 'allowed_redirect_hosts' on an array containing
    972  *              WordPress host string and $location host string.
    9731183 *
    9741184 * @param string $location The redirect to validate
    9751185 * @param string $default The value to return if $location is not allowed
     
    10001210
    10011211        $wpp = parse_url(home_url());
    10021212
    1003         $allowed_hosts = (array) apply_filters('allowed_redirect_hosts', array($wpp['host']), isset($lp['host']) ? $lp['host'] : '');
     1213        /**
     1214         * Filter the list of hosts allowed to be redirected to.
     1215         *
     1216         * @since 2.3.0
     1217         *
     1218         * @param array       $hosts Array of allowed hosts.
     1219         * @param bool|string $host  The parsed host, empty if not isset.
     1220         */
     1221        $allowed_hosts = (array) apply_filters( 'allowed_redirect_hosts', array($wpp['host']), isset($lp['host']) ? $lp['host'] : '' );
    10041222
    10051223        if ( isset($lp['host']) && ( !in_array($lp['host'], $allowed_hosts) && $lp['host'] != strtolower($wpp['host'])) )
    10061224                $location = $default;
     
    11631381        if ( isset($reply_to) )
    11641382                $message_headers .= $reply_to . "\n";
    11651383
    1166         $notify_message  = apply_filters( 'comment_notification_text',       $notify_message,  $comment_id );
    1167         $subject         = apply_filters( 'comment_notification_subject',    $subject,         $comment_id );
    1168         $message_headers = apply_filters( 'comment_notification_headers',    $message_headers, $comment_id );
     1384        /**
     1385         * Filter the comment notification email text.
     1386         *
     1387         * @since 1.5.2
     1388         *
     1389         * @param string $notify_message The comment notification email text.
     1390         * @param int    $comment_id     Comment ID.
     1391         */
     1392        $notify_message = apply_filters( 'comment_notification_text', $notify_message, $comment_id );
    11691393
     1394        /**
     1395         * Filter the comment notification email subject.
     1396         *
     1397         * @since 1.5.2
     1398         *
     1399         * @param string $subject    The comment notification email subject.
     1400         * @param int    $comment_id Comment ID.
     1401         */
     1402        $subject = apply_filters( 'comment_notification_subject', $subject, $comment_id );
     1403
     1404        /**
     1405         * Filter the comment notification email headers.
     1406         *
     1407         * @since 1.5.2
     1408         *
     1409         * @param string $message_headers Headers for the comment notification email.
     1410         * @param int    $comment_id      Comment ID.
     1411         */
     1412        $message_headers = apply_filters( 'comment_notification_headers', $message_headers, $comment_id );
     1413
    11701414        foreach ( $emails as $email ) {
    11711415                @wp_mail( $email, $subject, $notify_message, $message_headers );
    11721416        }
     
    12491493        $subject = sprintf( __('[%1$s] Please moderate: "%2$s"'), $blogname, $post->post_title );
    12501494        $message_headers = '';
    12511495
    1252         $emails          = apply_filters( 'comment_moderation_recipients', $emails,          $comment_id );
    1253         $notify_message  = apply_filters( 'comment_moderation_text',       $notify_message,  $comment_id );
    1254         $subject         = apply_filters( 'comment_moderation_subject',    $subject,         $comment_id );
    1255         $message_headers = apply_filters( 'comment_moderation_headers',    $message_headers, $comment_id );
     1496        /**
     1497         * Filter the list of recipients for comment moderation emails.
     1498         *
     1499         * @since 3.7.0
     1500         *
     1501         * @param array $emails     List of email addresses to notify for comment moderation.
     1502         * @param int   $comment_id Comment ID.
     1503         */
     1504        $emails = apply_filters( 'comment_moderation_recipients', $emails, $comment_id );
    12561505
     1506        /**
     1507         * Filter the comment moderation email text.
     1508         *
     1509         * @since 1.5.2
     1510         *
     1511         * @param string $notify_message Text of the comment moderation email.
     1512         * @param int    $comment_id     Comment ID.
     1513         */
     1514        $notify_message = apply_filters( 'comment_moderation_text', $notify_message, $comment_id );
     1515
     1516        /**
     1517         * Filter the comment moderation email subject.
     1518         *
     1519         * @since 1.5.2
     1520         *
     1521         * @param string $subject    Subject of the comment moderation email.
     1522         * @param int    $comment_id Comment ID.
     1523         */
     1524        $subject = apply_filters( 'comment_moderation_subject', $subject, $comment_id );
     1525
     1526        /**
     1527         * Filter the comment moderation email headers.
     1528         *
     1529         * @since 2.8.0
     1530         *
     1531         * @param string $message_headers Headers for the comment moderation email.
     1532         * @param int    $comment_id      Comment ID.
     1533         */
     1534        $message_headers = apply_filters( 'comment_moderation_headers', $message_headers, $comment_id );
     1535
    12571536        foreach ( $emails as $email ) {
    12581537                @wp_mail( $email, $subject, $notify_message, $message_headers );
    12591538        }
     
    13311610 * @return int
    13321611 */
    13331612function wp_nonce_tick() {
     1613        /**
     1614         * Filter the lifespan of nonces in seconds.
     1615         *
     1616         * @since 2.5.0
     1617         *
     1618         * @param int $lifespan Lifespan of nonces in seconds. Default 86,400 seconds or one day.
     1619         */
    13341620        $nonce_life = apply_filters( 'nonce_life', DAY_IN_SECONDS );
    13351621
    13361622        return ceil(time() / ( $nonce_life / 2 ));
     
    13531639function wp_verify_nonce($nonce, $action = -1) {
    13541640        $user = wp_get_current_user();
    13551641        $uid = (int) $user->ID;
    1356         if ( ! $uid )
     1642        if ( ! $uid ) {
     1643                /**
     1644                 * Filter whether the user who generated the nonce is logged out.
     1645                 *
     1646                 * @since 3.5.0
     1647                 *
     1648                 * @param int    $uid    ID of the nonce-owning user.
     1649                 * @param string $action The nonce action.
     1650                 */
    13571651                $uid = apply_filters( 'nonce_user_logged_out', $uid, $action );
     1652        }
    13581653
    13591654        $i = wp_nonce_tick();
    13601655
     
    13811676function wp_create_nonce($action = -1) {
    13821677        $user = wp_get_current_user();
    13831678        $uid = (int) $user->ID;
    1384         if ( ! $uid )
     1679        if ( ! $uid ) {
     1680                /** This filter is documented in wp-includes/pluggable.php */
    13851681                $uid = apply_filters( 'nonce_user_logged_out', $uid, $action );
     1682        }
    13861683
    13871684        $i = wp_nonce_tick();
    13881685
     
    14271724 */
    14281725function wp_salt( $scheme = 'auth' ) {
    14291726        static $cached_salts = array();
    1430         if ( isset( $cached_salts[ $scheme ] ) )
     1727        if ( isset( $cached_salts[ $scheme ] ) ) {
     1728                /**
     1729                 * Filter the WP salt.
     1730                 *
     1731                 * @since 2.5.0
     1732                 *
     1733                 * @param string $cached_salt Cached salt for the given scheme.
     1734                 * @param string $scheme      Authentication scheme. Values include 'auth', 'secure_auth',
     1735                 *                            'logged_in', and 'nonce'.
     1736                 */
    14311737                return apply_filters( 'salt', $cached_salts[ $scheme ], $scheme );
     1738        }
    14321739
    14331740        static $duplicated_keys;
    14341741        if ( null === $duplicated_keys ) {
     
    14741781        }
    14751782
    14761783        $cached_salts[ $scheme ] = $key . $salt;
     1784
     1785        /** This filter is documented in wp-includes/pluggable.php */
    14771786        return apply_filters( 'salt', $cached_salts[ $scheme ], $scheme );
    14781787}
    14791788endif;
     
    15571866                        $hash = wp_hash_password($password);
    15581867                }
    15591868
    1560                 return apply_filters('check_password', $check, $password, $hash, $user_id);
     1869                /**
     1870                 * Filter whether the plaintext password matches the encrypted password.
     1871                 *
     1872                 * @since 2.5.0
     1873                 *
     1874                 * @param bool   $check   Whether the passwords match.
     1875                 * @param string $hash    The hashed password.
     1876                 * @param int    $user_id User ID.
     1877                 */
     1878                return apply_filters( 'check_password', $check, $password, $hash, $user_id );
    15611879        }
    15621880
    15631881        // If the stored hash is longer than an MD5, presume the
     
    15701888
    15711889        $check = $wp_hasher->CheckPassword($password, $hash);
    15721890
     1891        /** This filter is documented in wp-includes/pluggable.php */
    15731892        return apply_filters('check_password', $check, $password, $hash, $user_id);
    15741893}
    15751894endif;
     
    15981917                $password .= substr($chars, wp_rand(0, strlen($chars) - 1), 1);
    15991918        }
    16001919
    1601         // random_password filter was previously in random_password function which was deprecated
    1602         return apply_filters('random_password', $password);
     1920        /**
     1921         * Filter the randomly-generated password.
     1922         *
     1923         * @since 3.0.0
     1924         *
     1925         * @param string $password The generated password.
     1926         */
     1927        return apply_filters( 'random_password', $password );
    16031928}
    16041929endif;
    16051930
     
    17072032                        $email = $user->user_email;
    17082033        } elseif ( is_object($id_or_email) ) {
    17092034                // No avatar for pingbacks or trackbacks
     2035
     2036                /**
     2037                 * Filter the list of allowed comment types for retrieving avatars.
     2038                 *
     2039                 * @since 3.0.0
     2040                 *
     2041                 * @param array $types Array of content types. Default only contains 'comment'.
     2042                 */
    17102043                $allowed_comment_types = apply_filters( 'get_avatar_comment_types', array( 'comment' ) );
    17112044                if ( ! empty( $id_or_email->comment_type ) && ! in_array( $id_or_email->comment_type, (array) $allowed_comment_types ) )
    17122045                        return false;
     
    17732106                $avatar = "<img alt='{$safe_alt}' src='{$default}' class='avatar avatar-{$size} photo avatar-default' height='{$size}' width='{$size}' />";
    17742107        }
    17752108
    1776         return apply_filters('get_avatar', $avatar, $id_or_email, $size, $default, $alt);
     2109        /**
     2110         * Filter the avatar to retrieve.
     2111         *
     2112         * @since 2.5.0
     2113         *
     2114         * @param string            $avatar      <img> tag for the user's avatar.
     2115         * @param int|object|string $id_or_email A user ID, email address, or comment object.
     2116         * @param int               $size        Square avatar width and height in pixels to retrieve.
     2117         * @param string            $alt         Alternative text to use in the avatar image tag. Defaults empty.
     2118         */
     2119        return apply_filters( 'get_avatar', $avatar, $id_or_email, $size, $default, $alt );
    17772120}
    17782121endif;
    17792122