<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[27825] trunk/src/wp-includes/pluggable.php: Inline documentation for hooks in wp-includes/pluggable.php.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/27825">27825</a></dd>
<dt>Author</dt> <dd>DrewAPicture</dd>
<dt>Date</dt> <dd>2014-03-28 21:20:08 +0000 (Fri, 28 Mar 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Inline documentation for hooks in wp-includes/pluggable.php.

Props kpdesign for some cleanup.
Fixes <a href="http://core.trac.wordpress.org/ticket/26888">#26888</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpincludespluggablephp">trunk/src/wp-includes/pluggable.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpincludespluggablephp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/pluggable.php (27824 => 27825)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/pluggable.php      2014-03-28 20:43:29 UTC (rev 27824)
+++ trunk/src/wp-includes/pluggable.php 2014-03-28 21:20:08 UTC (rev 27825)
</span><span class="lines">@@ -18,7 +18,6 @@
</span><span class="cx">  *
</span><span class="cx">  * @since 2.0.3
</span><span class="cx">  * @global object $current_user The current user object which holds the user data.
</span><del>- * @uses do_action() Calls 'set_current_user' hook after setting the current user.
</del><span class="cx">  *
</span><span class="cx">  * @param int $id User ID
</span><span class="cx">  * @param string $name User's username
</span><span class="lines">@@ -34,7 +33,12 @@
</span><span class="cx"> 
</span><span class="cx">  setup_userdata( $current_user->ID );
</span><span class="cx"> 
</span><del>-       do_action('set_current_user');
</del><ins>+        /**
+        * Fires after the current user is set.
+        *
+        * @since 2.0.1
+        */
+       do_action( 'set_current_user' );
</ins><span class="cx"> 
</span><span class="cx">  return $current_user;
</span><span class="cx"> }
</span><span class="lines">@@ -105,7 +109,7 @@
</span><span class="cx">   *
</span><span class="cx">   * @since 3.9.0
</span><span class="cx">   *
</span><del>-        * @param int|boolean $user_id User ID if determined, or false otherwise.
</del><ins>+         * @param int|bool $user_id User ID if determined, or false otherwise.
</ins><span class="cx">    */
</span><span class="cx">  $user_id = apply_filters( 'determine_current_user', false );
</span><span class="cx">  if ( ! $user_id ) {
</span><span class="lines">@@ -204,13 +208,7 @@
</span><span class="cx">  * be set using the 'wp_mail_charset' filter.
</span><span class="cx">  *
</span><span class="cx">  * @since 1.2.1
</span><del>- * @uses apply_filters() Calls 'wp_mail' hook on an array of all of the parameters.
- * @uses apply_filters() Calls 'wp_mail_from' hook to get the from email address.
- * @uses apply_filters() Calls 'wp_mail_from_name' hook to get the from address name.
- * @uses apply_filters() Calls 'wp_mail_content_type' hook to get the email content type.
- * @uses apply_filters() Calls 'wp_mail_charset' hook to get the email charset
- * @uses do_action_ref_array() Calls 'phpmailer_init' hook on the reference to
- *             phpmailer object.
</del><ins>+ *
</ins><span class="cx">  * @uses PHPMailer
</span><span class="cx">  *
</span><span class="cx">  * @param string|array $to Array or comma-separated list of email addresses to send message.
</span><span class="lines">@@ -222,6 +220,15 @@
</span><span class="cx">  */
</span><span class="cx"> function wp_mail( $to, $subject, $message, $headers = '', $attachments = array() ) {
</span><span class="cx">  // Compact the input, apply the filters, and extract them back out
</span><ins>+
+       /**
+        * Filter the wp_mail() arguments.
+        *
+        * @since 2.2.0
+        *
+        * @param array $args A compacted array of wp_mail() arguments, including the "to" email,
+        *                    subject, message, headers, and attachments values.
+        */
</ins><span class="cx">   extract( apply_filters( 'wp_mail', compact( 'to', 'subject', 'message', 'headers', 'attachments' ) ) );
</span><span class="cx"> 
</span><span class="cx">  if ( !is_array($attachments) )
</span><span class="lines">@@ -342,10 +349,24 @@
</span><span class="cx">          $from_email = 'wordpress@' . $sitename;
</span><span class="cx">  }
</span><span class="cx"> 
</span><del>-       // Plugin authors can override the potentially troublesome default
-       $phpmailer->From     = apply_filters( 'wp_mail_from'     , $from_email );
-       $phpmailer->FromName = apply_filters( 'wp_mail_from_name', $from_name  );
</del><ins>+        /**
+        * Filter the email address to send from.
+        *
+        * @since 2.2.0
+        *
+        * @param string $from_email Email address to send from.
+        */
+       $phpmailer->From = apply_filters( 'wp_mail_from', $from_email );
</ins><span class="cx"> 
</span><ins>+       /**
+        * Filter the name to associate with the "from" email address.
+        *
+        * @since 2.3.0
+        *
+        * @param string $from_name Name associated with the "from" email address.
+        */
+       $phpmailer->FromName = apply_filters( 'wp_mail_from_name', $from_name );
+
</ins><span class="cx">   // Set destination addresses
</span><span class="cx">  if ( !is_array( $to ) )
</span><span class="cx">          $to = explode( ',', $to );
</span><span class="lines">@@ -415,6 +436,13 @@
</span><span class="cx">  if ( !isset( $content_type ) )
</span><span class="cx">          $content_type = 'text/plain';
</span><span class="cx"> 
</span><ins>+       /**
+        * Filter the wp_mail() content type.
+        *
+        * @since 2.3.0
+        *
+        * @param string $content_type Default wp_mail() content type.
+        */
</ins><span class="cx">   $content_type = apply_filters( 'wp_mail_content_type', $content_type );
</span><span class="cx"> 
</span><span class="cx">  $phpmailer->ContentType = $content_type;
</span><span class="lines">@@ -428,6 +456,14 @@
</span><span class="cx">          $charset = get_bloginfo( 'charset' );
</span><span class="cx"> 
</span><span class="cx">  // Set the content-type and charset
</span><ins>+
+       /**
+        * Filter the default wp_mail() charset.
+        *
+        * @since 2.3.0
+        *
+        * @param string $charset Default email charset.
+        */
</ins><span class="cx">   $phpmailer->CharSet = apply_filters( 'wp_mail_charset', $charset );
</span><span class="cx"> 
</span><span class="cx">  // Set custom headers
</span><span class="lines">@@ -450,6 +486,13 @@
</span><span class="cx">          }
</span><span class="cx">  }
</span><span class="cx"> 
</span><ins>+       /**
+        * Fires after PHPMailer is initialized.
+        *
+        * @since 2.2.0
+        *
+        * @param PHPMailer &$phpmailer The PHPMailer instance, passed by reference.
+        */
</ins><span class="cx">   do_action_ref_array( 'phpmailer_init', array( &$phpmailer ) );
</span><span class="cx"> 
</span><span class="cx">  // Send!
</span><span class="lines">@@ -475,7 +518,19 @@
</span><span class="cx">  $username = sanitize_user($username);
</span><span class="cx">  $password = trim($password);
</span><span class="cx"> 
</span><del>-       $user = apply_filters('authenticate', null, $username, $password);
</del><ins>+        /**
+        * Filter the user to authenticate.
+        *
+        * If a non-null value is passed, the filter will effectively short-circuit
+        * authentication, returning an error instead.
+        *
+        * @since 2.8.0
+        *
+        * @param null|WP_User $user     User to authenticate.
+        * @param string       $username User login.
+        * @param string       $password User password
+        */
+       $user = apply_filters( 'authenticate', null, $username, $password );
</ins><span class="cx"> 
</span><span class="cx">  if ( $user == null ) {
</span><span class="cx">          // TODO what should the error message be? (Or would these even happen?)
</span><span class="lines">@@ -486,7 +541,14 @@
</span><span class="cx">  $ignore_codes = array('empty_username', 'empty_password');
</span><span class="cx"> 
</span><span class="cx">  if (is_wp_error($user) && !in_array($user->get_error_code(), $ignore_codes) ) {
</span><del>-               do_action('wp_login_failed', $username);
</del><ins>+                /**
+                * Fires after a user login has failed.
+                *
+                * @since 2.5.0
+                *
+                * @param string $username User login.
+                */
+               do_action( 'wp_login_failed', $username );
</ins><span class="cx">   }
</span><span class="cx"> 
</span><span class="cx">  return $user;
</span><span class="lines">@@ -501,7 +563,13 @@
</span><span class="cx">  */
</span><span class="cx"> function wp_logout() {
</span><span class="cx">  wp_clear_auth_cookie();
</span><del>-       do_action('wp_logout');
</del><ins>+
+       /**
+        * Fires after a user is logged-out.
+        *
+        * @since 1.5.0
+        */
+       do_action( 'wp_logout' );
</ins><span class="cx"> }
</span><span class="cx"> endif;
</span><span class="cx"> 
</span><span class="lines">@@ -523,7 +591,16 @@
</span><span class="cx">  */
</span><span class="cx"> function wp_validate_auth_cookie($cookie = '', $scheme = '') {
</span><span class="cx">  if ( ! $cookie_elements = wp_parse_auth_cookie($cookie, $scheme) ) {
</span><del>-               do_action('auth_cookie_malformed', $cookie, $scheme);
</del><ins>+                /**
+                * Fires if an authentication cookie is malformed.
+                *
+                * @since 2.7.0
+                *
+                * @param string $cookie Malformed auth cookie.
+                * @param string $scheme Authentication scheme. Values include 'auth', 'secure_auth',
+                *                       or 'logged_in'.
+                */
+               do_action( 'auth_cookie_malformed', $cookie, $scheme );
</ins><span class="cx">           return false;
</span><span class="cx">  }
</span><span class="cx"> 
</span><span class="lines">@@ -537,13 +614,27 @@
</span><span class="cx"> 
</span><span class="cx">  // Quick check to see if an honest cookie has expired
</span><span class="cx">  if ( $expired < time() ) {
</span><del>-               do_action('auth_cookie_expired', $cookie_elements);
</del><ins>+                /**
+                * Fires once an authentication cookie has expired.
+                *
+                * @since 2.7.0
+                *
+                * @param array $cookie_elements An array of data for the authentication cookie.
+                */
+               do_action( 'auth_cookie_expired', $cookie_elements );
</ins><span class="cx">           return false;
</span><span class="cx">  }
</span><span class="cx"> 
</span><span class="cx">  $user = get_user_by('login', $username);
</span><span class="cx">  if ( ! $user ) {
</span><del>-               do_action('auth_cookie_bad_username', $cookie_elements);
</del><ins>+                /**
+                * Fires if a bad username is entered in the user authentication process.
+                *
+                * @since 2.7.0
+                *
+                * @param array $cookie_elements An array of data for the authentication cookie.
+                */
+               do_action( 'auth_cookie_bad_username', $cookie_elements );
</ins><span class="cx">           return false;
</span><span class="cx">  }
</span><span class="cx"> 
</span><span class="lines">@@ -553,14 +644,29 @@
</span><span class="cx">  $hash = hash_hmac('md5', $username . '|' . $expiration, $key);
</span><span class="cx"> 
</span><span class="cx">  if ( $hmac != $hash ) {
</span><del>-               do_action('auth_cookie_bad_hash', $cookie_elements);
</del><ins>+                /**
+                * Fires if a bad authentication cookie hash is encountered.
+                *
+                * @since 2.7.0
+                *
+                * @param array $cookie_elements An array of data for the authentication cookie.
+                */
+               do_action( 'auth_cookie_bad_hash', $cookie_elements );
</ins><span class="cx">           return false;
</span><span class="cx">  }
</span><span class="cx"> 
</span><span class="cx">  if ( $expiration < time() ) // AJAX/POST grace period set above
</span><span class="cx">          $GLOBALS['login_grace_period'] = 1;
</span><span class="cx"> 
</span><del>-       do_action('auth_cookie_valid', $cookie_elements, $user);
</del><ins>+        /**
+        * Fires once an authentication cookie has been validated.
+        *
+        * @since 2.7.0
+        *
+        * @param array   $cookie_elements An array of data for the authentication cookie.
+        * @param WP_User $user            User object.
+        */
+       do_action( 'auth_cookie_valid', $cookie_elements, $user );
</ins><span class="cx"> 
</span><span class="cx">  return $user->ID;
</span><span class="cx"> }
</span><span class="lines">@@ -572,9 +678,6 @@
</span><span class="cx">  *
</span><span class="cx">  * @since 2.5.0
</span><span class="cx">  *
</span><del>- * @uses apply_filters() Calls 'auth_cookie' hook on $cookie contents, User ID
- *             and expiration of cookie.
- *
</del><span class="cx">  * @param int $user_id User ID
</span><span class="cx">  * @param int $expiration Cookie expiration in seconds
</span><span class="cx">  * @param string $scheme Optional. The cookie scheme to use: auth, secure_auth, or logged_in
</span><span class="lines">@@ -590,7 +693,17 @@
</span><span class="cx"> 
</span><span class="cx">  $cookie = $user->user_login . '|' . $expiration . '|' . $hash;
</span><span class="cx"> 
</span><del>-       return apply_filters('auth_cookie', $cookie, $user_id, $expiration, $scheme);
</del><ins>+        /**
+        * Filter the authentication cookie.
+        *
+        * @since 2.5.0
+        *
+        * @param string $cookie     Authentication cookie.
+        * @param int    $user_id    User ID.
+        * @param int    $expiration Authentication cookie expiration in seconds.
+        * @param string $scheme     Cookie scheme used. Accepts 'auth', 'secure_auth', or 'logged_in'.
+        */
+       return apply_filters( 'auth_cookie', $cookie, $user_id, $expiration, $scheme );
</ins><span class="cx"> }
</span><span class="cx"> endif;
</span><span class="cx"> 
</span><span class="lines">@@ -656,21 +769,52 @@
</span><span class="cx">  */
</span><span class="cx"> function wp_set_auth_cookie($user_id, $remember = false, $secure = '') {
</span><span class="cx">  if ( $remember ) {
</span><del>-               $expiration = time() + apply_filters('auth_cookie_expiration', 14 * DAY_IN_SECONDS, $user_id, $remember);
-               // Ensure the browser will continue to send the cookie after the expiration time is reached.
-               // Needed for the login grace period in wp_validate_auth_cookie().
</del><ins>+                /**
+                * Filter the duration of the authentication cookie expiration period.
+                *
+                * @since 2.8.0
+                *
+                * @param int  $length   Duration of the expiration period in seconds.
+                * @param int  $user_id  User ID.
+                * @param bool $remember Whether to remember the user login. Default false.
+                */
+               $expiration = time() + apply_filters( 'auth_cookie_expiration', 14 * DAY_IN_SECONDS, $user_id, $remember );
+
+               /*
+                * Ensure the browser will continue to send the cookie after the expiration time is reached.
+                * Needed for the login grace period in wp_validate_auth_cookie().
+                */
</ins><span class="cx">           $expire = $expiration + ( 12 * HOUR_IN_SECONDS );
</span><span class="cx">  } else {
</span><del>-               $expiration = time() + apply_filters('auth_cookie_expiration', 2 * DAY_IN_SECONDS, $user_id, $remember);
</del><ins>+                /** This filter is documented in wp-includes/pluggable.php */
+               $expiration = time() + apply_filters( 'auth_cookie_expiration', 2 * DAY_IN_SECONDS, $user_id, $remember );
</ins><span class="cx">           $expire = 0;
</span><span class="cx">  }
</span><span class="cx"> 
</span><span class="cx">  if ( '' === $secure )
</span><span class="cx">          $secure = is_ssl();
</span><span class="cx"> 
</span><del>-       $secure = apply_filters('secure_auth_cookie', $secure, $user_id);
-       $secure_logged_in_cookie = apply_filters('secure_logged_in_cookie', false, $user_id, $secure);
</del><ins>+        /**
+        * Filter whether the connection is secure.
+        *
+        * @since 3.1.0
+        *
+        * @param bool $secure  Whether the connection is secure.
+        * @param int  $user_id User ID.
+        */
+       $secure = apply_filters( 'secure_auth_cookie', $secure, $user_id );
</ins><span class="cx"> 
</span><ins>+       /**
+        * Filter whether to use a secure cookie when logged-in.
+        *
+        * @since 3.1.0
+        *
+        * @param bool $cookie  Whether to use a secure cookie when logged-in.
+        * @param int  $user_id User ID.
+        * @param bool $secure  Whether the connection is secure.
+        */
+       $secure_logged_in_cookie = apply_filters( 'secure_logged_in_cookie', false, $user_id, $secure );
+
</ins><span class="cx">   if ( $secure ) {
</span><span class="cx">          $auth_cookie_name = SECURE_AUTH_COOKIE;
</span><span class="cx">          $scheme = 'secure_auth';
</span><span class="lines">@@ -682,9 +826,34 @@
</span><span class="cx">  $auth_cookie = wp_generate_auth_cookie($user_id, $expiration, $scheme);
</span><span class="cx">  $logged_in_cookie = wp_generate_auth_cookie($user_id, $expiration, 'logged_in');
</span><span class="cx"> 
</span><del>-       do_action('set_auth_cookie', $auth_cookie, $expire, $expiration, $user_id, $scheme);
-       do_action('set_logged_in_cookie', $logged_in_cookie, $expire, $expiration, $user_id, 'logged_in');
</del><ins>+        /**
+        * Fires immediately before the authentication cookie is set.
+        *
+        * @since 2.5.0
+        *
+        * @param string $auth_cookie Authentication cookie.
+        * @param int    $expire      Login grace period in seconds. Default 43,200 seconds, or 12 hours.
+        * @param int    $expiration  Duration in seconds the authentication cookie should be valid.
+        *                            Default 1,209,600 seconds, or 14 days.
+        * @param int    $user_id     User ID.
+        * @param string $scheme      Authentication scheme. Values include 'auth', 'secure_auth', or 'logged_in'.
+        */
+       do_action( 'set_auth_cookie', $auth_cookie, $expire, $expiration, $user_id, $scheme );
</ins><span class="cx"> 
</span><ins>+       /**
+        * Fires immediately before the secure authentication cookie is set.
+        *
+        * @since 2.6.0
+        *
+        * @param string $logged_in_cookie The logged-in cookie.
+        * @param int    $expire           Login grace period in seconds. Default 43,200 seconds, or 12 hours.
+        * @param int    $expiration       Duration in seconds the authentication cookie should be valid.
+        *                                 Default 1,209,600 seconds, or 14 days.
+        * @param int    $user_id          User ID.
+        * @param string $scheme           Authentication scheme. Default 'logged_in'.
+        */
+       do_action( 'set_logged_in_cookie', $logged_in_cookie, $expire, $expiration, $user_id, 'logged_in' );
+
</ins><span class="cx">   setcookie($auth_cookie_name, $auth_cookie, $expire, PLUGINS_COOKIE_PATH, COOKIE_DOMAIN, $secure, true);
</span><span class="cx">  setcookie($auth_cookie_name, $auth_cookie, $expire, ADMIN_COOKIE_PATH, COOKIE_DOMAIN, $secure, true);
</span><span class="cx">  setcookie(LOGGED_IN_COOKIE, $logged_in_cookie, $expire, COOKIEPATH, COOKIE_DOMAIN, $secure_logged_in_cookie, true);
</span><span class="lines">@@ -700,7 +869,12 @@
</span><span class="cx">  * @since 2.5.0
</span><span class="cx">  */
</span><span class="cx"> function wp_clear_auth_cookie() {
</span><del>-       do_action('clear_auth_cookie');
</del><ins>+        /**
+        * Fires just before the authentication cookies are cleared.
+        *
+        * @since 2.7.0
+        */
+       do_action( 'clear_auth_cookie' );
</ins><span class="cx"> 
</span><span class="cx">  setcookie( AUTH_COOKIE,        ' ', time() - YEAR_IN_SECONDS, ADMIN_COOKIE_PATH,   COOKIE_DOMAIN );
</span><span class="cx">  setcookie( SECURE_AUTH_COOKIE, ' ', time() - YEAR_IN_SECONDS, ADMIN_COOKIE_PATH,   COOKIE_DOMAIN );
</span><span class="lines">@@ -752,7 +926,14 @@
</span><span class="cx"> 
</span><span class="cx">  $secure = ( is_ssl() || force_ssl_admin() );
</span><span class="cx"> 
</span><del>-       $secure = apply_filters('secure_auth_redirect', $secure);
</del><ins>+        /**
+        * Filter whether to use a secure authentication redirect.
+        *
+        * @since 3.1.0
+        *
+        * @param bool $secure Whether to use a secure authentication redirect. Default false.
+        */
+       $secure = apply_filters( 'secure_auth_redirect', $secure );
</ins><span class="cx"> 
</span><span class="cx">  // If https is required and request is http, redirect
</span><span class="cx">  if ( $secure && !is_ssl() && false !== strpos($_SERVER['REQUEST_URI'], 'wp-admin') ) {
</span><span class="lines">@@ -765,13 +946,28 @@
</span><span class="cx">          }
</span><span class="cx">  }
</span><span class="cx"> 
</span><del>-       if ( is_user_admin() )
</del><ins>+        if ( is_user_admin() ) {
</ins><span class="cx">           $scheme = 'logged_in';
</span><del>-       else
</del><ins>+        } else {
+               /**
+                * Filter the authentication redirect scheme.
+                *
+                * @since 2.9.0
+                *
+                * @param string $scheme Authentication redirect scheme. Default empty.
+                */
</ins><span class="cx">           $scheme = apply_filters( 'auth_redirect_scheme', '' );
</span><ins>+       }
</ins><span class="cx"> 
</span><span class="cx">  if ( $user_id = wp_validate_auth_cookie( '',  $scheme) ) {
</span><del>-               do_action('auth_redirect', $user_id);
</del><ins>+                /**
+                * Fires before the authentication redirect.
+                *
+                * @since 2.8.0
+                *
+                * @param int $user_id User ID.
+                */
+               do_action( 'auth_redirect', $user_id );
</ins><span class="cx"> 
</span><span class="cx">          // If the user wants ssl but the session is not ssl, redirect.
</span><span class="cx">          if ( !$secure && get_user_option('use_ssl', $user_id) && false !== strpos($_SERVER['REQUEST_URI'], 'wp-admin') ) {
</span><span class="lines">@@ -806,7 +1002,6 @@
</span><span class="cx">  * To avoid security exploits.
</span><span class="cx">  *
</span><span class="cx">  * @since 1.2.0
</span><del>- * @uses do_action() Calls 'check_admin_referer' on $action.
</del><span class="cx">  *
</span><span class="cx">  * @param string $action Action nonce
</span><span class="cx">  * @param string $query_arg where to look for nonce in $_REQUEST (since 2.5)
</span><span class="lines">@@ -822,7 +1017,16 @@
</span><span class="cx">          wp_nonce_ays($action);
</span><span class="cx">          die();
</span><span class="cx">  }
</span><del>-       do_action('check_admin_referer', $action, $result);
</del><ins>+
+       /**
+        * Fires once the admin request has been validated or not.
+        *
+        * @since 1.5.1
+        *
+        * @param string $action The nonce action.
+        * @param bool   $result Whether the admin request nonce was validated.
+        */
+       do_action( 'check_admin_referer', $action, $result );
</ins><span class="cx">   return $result;
</span><span class="cx"> }
</span><span class="cx"> endif;
</span><span class="lines">@@ -855,7 +1059,15 @@
</span><span class="cx">                  die( '-1' );
</span><span class="cx">  }
</span><span class="cx"> 
</span><del>-       do_action('check_ajax_referer', $action, $result);
</del><ins>+        /**
+        * Fires once the AJAX request has been validated or not.
+        *
+        * @since 2.1.0
+        *
+        * @param string $action The AJAX nonce action.
+        * @param bool   $result Whether the AJAX request nonce was validated.
+        */
+       do_action( 'check_ajax_referer', $action, $result );
</ins><span class="cx"> 
</span><span class="cx">  return $result;
</span><span class="cx"> }
</span><span class="lines">@@ -866,7 +1078,6 @@
</span><span class="cx">  * Redirects to another page.
</span><span class="cx">  *
</span><span class="cx">  * @since 1.5.1
</span><del>- * @uses apply_filters() Calls 'wp_redirect' hook on $location and $status.
</del><span class="cx">  *
</span><span class="cx">  * @param string $location The path to redirect to.
</span><span class="cx">  * @param int $status Status code to use.
</span><span class="lines">@@ -968,8 +1179,6 @@
</span><span class="cx">  * If the host is not allowed, then the redirect is to $default supplied
</span><span class="cx">  *
</span><span class="cx">  * @since 2.8.1
</span><del>- * @uses apply_filters() Calls 'allowed_redirect_hosts' on an array containing
- *             WordPress host string and $location host string.
</del><span class="cx">  *
</span><span class="cx">  * @param string $location The redirect to validate
</span><span class="cx">  * @param string $default The value to return if $location is not allowed
</span><span class="lines">@@ -1000,7 +1209,15 @@
</span><span class="cx"> 
</span><span class="cx">  $wpp = parse_url(home_url());
</span><span class="cx"> 
</span><del>-       $allowed_hosts = (array) apply_filters('allowed_redirect_hosts', array($wpp['host']), isset($lp['host']) ? $lp['host'] : '');
</del><ins>+        /**
+        * Filter the whitelist of hosts to redirect to.
+        *
+        * @since 2.3.0
+        *
+        * @param array       $hosts An array of allowed hosts.
+        * @param bool|string $host  The parsed host; empty if not isset.
+        */
+       $allowed_hosts = (array) apply_filters( 'allowed_redirect_hosts', array($wpp['host']), isset($lp['host']) ? $lp['host'] : '' );
</ins><span class="cx"> 
</span><span class="cx">  if ( isset($lp['host']) && ( !in_array($lp['host'], $allowed_hosts) && $lp['host'] != strtolower($wpp['host'])) )
</span><span class="cx">          $location = $default;
</span><span class="lines">@@ -1038,14 +1255,14 @@
</span><span class="cx">  }
</span><span class="cx"> 
</span><span class="cx">  /**
</span><del>-        * Filter the list of emails to receive a comment notification.
</del><ins>+         * Filter the list of email addresses to receive a comment notification.
</ins><span class="cx">    *
</span><del>-        * Normally just post authors are notified of emails.
-        * This filter lets you add others.
</del><ins>+         * By default, only post authors are notified of comments. This filter allows
+        * others to be added.
</ins><span class="cx">    *
</span><span class="cx">   * @since 3.7.0
</span><span class="cx">   *
</span><del>-        * @param array $emails     Array of email addresses to receive a comment notification.
</del><ins>+         * @param array $emails     An array of email addresses to receive a comment notification.
</ins><span class="cx">    * @param int   $comment_id The comment ID.
</span><span class="cx">   */
</span><span class="cx">  $emails = apply_filters( 'comment_notification_recipients', $emails, $comment_id );
</span><span class="lines">@@ -1062,12 +1279,13 @@
</span><span class="cx">  /**
</span><span class="cx">   * Filter whether to notify comment authors of their comments on their own posts.
</span><span class="cx">   *
</span><del>-        * By default, comment authors don't get notified of their comments
-        * on their own post. This lets you override that.
</del><ins>+         * By default, comment authors aren't notified of their comments on their own
+        * posts. This filter allows you to override that.
</ins><span class="cx">    *
</span><span class="cx">   * @since 3.8.0
</span><span class="cx">   *
</span><del>-        * @param bool $notify     Whether to notify the post author of their own comment. Default false.
</del><ins>+         * @param bool $notify     Whether to notify the post author of their own comment.
+        *                         Default false.
</ins><span class="cx">    * @param int  $comment_id The comment ID.
</span><span class="cx">   */
</span><span class="cx">  $notify_author = apply_filters( 'comment_notification_notify_author', false, $comment_id );
</span><span class="lines">@@ -1163,10 +1381,36 @@
</span><span class="cx">  if ( isset($reply_to) )
</span><span class="cx">          $message_headers .= $reply_to . "\n";
</span><span class="cx"> 
</span><del>-       $notify_message  = apply_filters( 'comment_notification_text',       $notify_message,  $comment_id );
-       $subject         = apply_filters( 'comment_notification_subject',    $subject,         $comment_id );
-       $message_headers = apply_filters( 'comment_notification_headers',    $message_headers, $comment_id );
</del><ins>+        /**
+        * Filter the comment notification email text.
+        *
+        * @since 1.5.2
+        *
+        * @param string $notify_message The comment notification email text.
+        * @param int    $comment_id     Comment ID.
+        */
+       $notify_message = apply_filters( 'comment_notification_text', $notify_message, $comment_id );
</ins><span class="cx"> 
</span><ins>+       /**
+        * Filter the comment notification email subject.
+        *
+        * @since 1.5.2
+        *
+        * @param string $subject    The comment notification email subject.
+        * @param int    $comment_id Comment ID.
+        */
+       $subject = apply_filters( 'comment_notification_subject', $subject, $comment_id );
+
+       /**
+        * Filter the comment notification email headers.
+        *
+        * @since 1.5.2
+        *
+        * @param string $message_headers Headers for the comment notification email.
+        * @param int    $comment_id      Comment ID.
+        */
+       $message_headers = apply_filters( 'comment_notification_headers', $message_headers, $comment_id );
+
</ins><span class="cx">   foreach ( $emails as $email ) {
</span><span class="cx">          @wp_mail( $email, wp_specialchars_decode( $subject ), $notify_message, $message_headers );
</span><span class="cx">  }
</span><span class="lines">@@ -1249,11 +1493,46 @@
</span><span class="cx">  $subject = sprintf( __('[%1$s] Please moderate: "%2$s"'), $blogname, $post->post_title );
</span><span class="cx">  $message_headers = '';
</span><span class="cx"> 
</span><del>-       $emails          = apply_filters( 'comment_moderation_recipients', $emails,          $comment_id );
-       $notify_message  = apply_filters( 'comment_moderation_text',       $notify_message,  $comment_id );
-       $subject         = apply_filters( 'comment_moderation_subject',    $subject,         $comment_id );
-       $message_headers = apply_filters( 'comment_moderation_headers',    $message_headers, $comment_id );
</del><ins>+        /**
+        * Filter the list of recipients for comment moderation emails.
+        *
+        * @since 3.7.0
+        *
+        * @param array $emails     List of email addresses to notify for comment moderation.
+        * @param int   $comment_id Comment ID.
+        */
+       $emails = apply_filters( 'comment_moderation_recipients', $emails, $comment_id );
</ins><span class="cx"> 
</span><ins>+       /**
+        * Filter the comment moderation email text.
+        *
+        * @since 1.5.2
+        *
+        * @param string $notify_message Text of the comment moderation email.
+        * @param int    $comment_id     Comment ID.
+        */
+       $notify_message = apply_filters( 'comment_moderation_text', $notify_message, $comment_id );
+
+       /**
+        * Filter the comment moderation email subject.
+        *
+        * @since 1.5.2
+        *
+        * @param string $subject    Subject of the comment moderation email.
+        * @param int    $comment_id Comment ID.
+        */
+       $subject = apply_filters( 'comment_moderation_subject', $subject, $comment_id );
+
+       /**
+        * Filter the comment moderation email headers.
+        *
+        * @since 2.8.0
+        *
+        * @param string $message_headers Headers for the comment moderation email.
+        * @param int    $comment_id      Comment ID.
+        */
+       $message_headers = apply_filters( 'comment_moderation_headers', $message_headers, $comment_id );
+
</ins><span class="cx">   foreach ( $emails as $email ) {
</span><span class="cx">          @wp_mail( $email, wp_specialchars_decode( $subject ), $notify_message, $message_headers );
</span><span class="cx">  }
</span><span class="lines">@@ -1331,6 +1610,13 @@
</span><span class="cx">  * @return int
</span><span class="cx">  */
</span><span class="cx"> function wp_nonce_tick() {
</span><ins>+       /**
+        * Filter the lifespan of nonces in seconds.
+        *
+        * @since 2.5.0
+        *
+        * @param int $lifespan Lifespan of nonces in seconds. Default 86,400 seconds, or one day.
+        */
</ins><span class="cx">   $nonce_life = apply_filters( 'nonce_life', DAY_IN_SECONDS );
</span><span class="cx"> 
</span><span class="cx">  return ceil(time() / ( $nonce_life / 2 ));
</span><span class="lines">@@ -1353,8 +1639,17 @@
</span><span class="cx"> function wp_verify_nonce($nonce, $action = -1) {
</span><span class="cx">  $user = wp_get_current_user();
</span><span class="cx">  $uid = (int) $user->ID;
</span><del>-       if ( ! $uid )
</del><ins>+        if ( ! $uid ) {
+               /**
+                * Filter whether the user who generated the nonce is logged out.
+                *
+                * @since 3.5.0
+                *
+                * @param int    $uid    ID of the nonce-owning user.
+                * @param string $action The nonce action.
+                */
</ins><span class="cx">           $uid = apply_filters( 'nonce_user_logged_out', $uid, $action );
</span><ins>+       }
</ins><span class="cx"> 
</span><span class="cx">  $i = wp_nonce_tick();
</span><span class="cx"> 
</span><span class="lines">@@ -1381,8 +1676,10 @@
</span><span class="cx"> function wp_create_nonce($action = -1) {
</span><span class="cx">  $user = wp_get_current_user();
</span><span class="cx">  $uid = (int) $user->ID;
</span><del>-       if ( ! $uid )
</del><ins>+        if ( ! $uid ) {
+               /** This filter is documented in wp-includes/pluggable.php */
</ins><span class="cx">           $uid = apply_filters( 'nonce_user_logged_out', $uid, $action );
</span><ins>+       }
</ins><span class="cx"> 
</span><span class="cx">  $i = wp_nonce_tick();
</span><span class="cx"> 
</span><span class="lines">@@ -1427,8 +1724,18 @@
</span><span class="cx">  */
</span><span class="cx"> function wp_salt( $scheme = 'auth' ) {
</span><span class="cx">  static $cached_salts = array();
</span><del>-       if ( isset( $cached_salts[ $scheme ] ) )
</del><ins>+        if ( isset( $cached_salts[ $scheme ] ) ) {
+               /**
+                * Filter the WordPress salt.
+                *
+                * @since 2.5.0
+                *
+                * @param string $cached_salt Cached salt for the given scheme.
+                * @param string $scheme      Authentication scheme. Values include 'auth',
+                *                            'secure_auth', 'logged_in', and 'nonce'.
+                */
</ins><span class="cx">           return apply_filters( 'salt', $cached_salts[ $scheme ], $scheme );
</span><ins>+       }
</ins><span class="cx"> 
</span><span class="cx">  static $duplicated_keys;
</span><span class="cx">  if ( null === $duplicated_keys ) {
</span><span class="lines">@@ -1474,6 +1781,8 @@
</span><span class="cx">  }
</span><span class="cx"> 
</span><span class="cx">  $cached_salts[ $scheme ] = $key . $salt;
</span><ins>+
+       /** This filter is documented in wp-includes/pluggable.php */
</ins><span class="cx">   return apply_filters( 'salt', $cached_salts[ $scheme ], $scheme );
</span><span class="cx"> }
</span><span class="cx"> endif;
</span><span class="lines">@@ -1557,7 +1866,16 @@
</span><span class="cx">                  $hash = wp_hash_password($password);
</span><span class="cx">          }
</span><span class="cx"> 
</span><del>-               return apply_filters('check_password', $check, $password, $hash, $user_id);
</del><ins>+                /**
+                * Filter whether the plaintext password matches the encrypted password.
+                *
+                * @since 2.5.0
+                *
+                * @param bool   $check   Whether the passwords match.
+                * @param string $hash    The hashed password.
+                * @param int    $user_id User ID.
+                */
+               return apply_filters( 'check_password', $check, $password, $hash, $user_id );
</ins><span class="cx">   }
</span><span class="cx"> 
</span><span class="cx">  // If the stored hash is longer than an MD5, presume the
</span><span class="lines">@@ -1570,7 +1888,8 @@
</span><span class="cx"> 
</span><span class="cx">  $check = $wp_hasher->CheckPassword($password, $hash);
</span><span class="cx"> 
</span><del>-       return apply_filters('check_password', $check, $password, $hash, $user_id);
</del><ins>+        /** This filter is documented in wp-includes/pluggable.php */
+       return apply_filters( 'check_password', $check, $password, $hash, $user_id );
</ins><span class="cx"> }
</span><span class="cx"> endif;
</span><span class="cx"> 
</span><span class="lines">@@ -1598,8 +1917,14 @@
</span><span class="cx">          $password .= substr($chars, wp_rand(0, strlen($chars) - 1), 1);
</span><span class="cx">  }
</span><span class="cx"> 
</span><del>-       // random_password filter was previously in random_password function which was deprecated
-       return apply_filters('random_password', $password);
</del><ins>+        /**
+        * Filter the randomly-generated password.
+        *
+        * @since 3.0.0
+        *
+        * @param string $password The generated password.
+        */
+       return apply_filters( 'random_password', $password );
</ins><span class="cx"> }
</span><span class="cx"> endif;
</span><span class="cx"> 
</span><span class="lines">@@ -1707,6 +2032,14 @@
</span><span class="cx">                  $email = $user->user_email;
</span><span class="cx">  } elseif ( is_object($id_or_email) ) {
</span><span class="cx">          // No avatar for pingbacks or trackbacks
</span><ins>+
+               /**
+                * Filter the list of allowed comment types for retrieving avatars.
+                *
+                * @since 3.0.0
+                *
+                * @param array $types An array of content types. Default only contains 'comment'.
+                */
</ins><span class="cx">           $allowed_comment_types = apply_filters( 'get_avatar_comment_types', array( 'comment' ) );
</span><span class="cx">          if ( ! empty( $id_or_email->comment_type ) && ! in_array( $id_or_email->comment_type, (array) $allowed_comment_types ) )
</span><span class="cx">                  return false;
</span><span class="lines">@@ -1773,7 +2106,18 @@
</span><span class="cx">          $avatar = "<img alt='{$safe_alt}' src='{$default}' class='avatar avatar-{$size} photo avatar-default' height='{$size}' width='{$size}' />";
</span><span class="cx">  }
</span><span class="cx"> 
</span><del>-       return apply_filters('get_avatar', $avatar, $id_or_email, $size, $default, $alt);
</del><ins>+        /**
+        * Filter the avatar to retrieve.
+        *
+        * @since 2.5.0
+        *
+        * @param string            $avatar      Image tag for the user's avatar.
+        * @param int|object|string $id_or_email A user ID, email address, or comment object.
+        * @param int               $size        Square avatar width and height in pixels to retrieve.
+        * @param string            $alt         Alternative text to use in the avatar image tag.
+        *                                       Default empty.
+        */
+       return apply_filters( 'get_avatar', $avatar, $id_or_email, $size, $default, $alt );
</ins><span class="cx"> }
</span><span class="cx"> endif;
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>