--- a/wp/wp-includes/pluggable.php Wed Sep 21 18:19:35 2022 +0200
+++ b/wp/wp-includes/pluggable.php Tue Sep 27 16:37:53 2022 +0200
@@ -20,9 +20,9 @@
*
* @global WP_User $current_user The current user object which holds the user data.
*
- * @param int $id User ID
- * @param string $name User's username
- * @return WP_User Current user User object
+ * @param int|null $id User ID.
+ * @param string $name User's username.
+ * @return WP_User Current user User object.
*/
function wp_set_current_user( $id, $name = '' ) {
global $current_user;
@@ -127,7 +127,7 @@
*
* @global wpdb $wpdb WordPress database abstraction object.
*
- * @param array $user_ids User ID numbers list
+ * @param int[] $user_ids User ID numbers list
*/
function cache_users( $user_ids ) {
global $wpdb;
@@ -378,12 +378,16 @@
*/
if ( ! isset( $from_email ) ) {
// Get the site domain and get rid of www.
- $sitename = wp_parse_url( network_home_url(), PHP_URL_HOST );
- if ( 'www.' === substr( $sitename, 0, 4 ) ) {
- $sitename = substr( $sitename, 4 );
+ $sitename = wp_parse_url( network_home_url(), PHP_URL_HOST );
+ $from_email = 'wordpress@';
+
+ if ( null !== $sitename ) {
+ if ( 'www.' === substr( $sitename, 0, 4 ) ) {
+ $sitename = substr( $sitename, 4 );
+ }
+
+ $from_email .= $sitename;
}
-
- $from_email = 'wordpress@' . $sitename;
}
/**
@@ -537,13 +541,36 @@
*/
do_action_ref_array( 'phpmailer_init', array( &$phpmailer ) );
+ $mail_data = compact( 'to', 'subject', 'message', 'headers', 'attachments' );
+
// Send!
try {
- return $phpmailer->send();
+ $send = $phpmailer->send();
+
+ /**
+ * Fires after PHPMailer has successfully sent an email.
+ *
+ * The firing of this action does not necessarily mean that the recipient(s) received the
+ * email successfully. It only means that the `send` method above was able to
+ * process the request without any errors.
+ *
+ * @since 5.9.0
+ *
+ * @param array $mail_data {
+ * An array containing the email recipient(s), subject, message, headers, and attachments.
+ *
+ * @type string[] $to Email addresses to send message.
+ * @type string $subject Email subject.
+ * @type string $message Message contents.
+ * @type string[] $headers Additional headers.
+ * @type string[] $attachments Paths to files to attach.
+ * }
+ */
+ do_action( 'wp_mail_succeeded', $mail_data );
+
+ return $send;
} catch ( PHPMailer\PHPMailer\Exception $e ) {
-
- $mail_error_data = compact( 'to', 'subject', 'message', 'headers', 'attachments' );
- $mail_error_data['phpmailer_exception_code'] = $e->getCode();
+ $mail_data['phpmailer_exception_code'] = $e->getCode();
/**
* Fires after a PHPMailer\PHPMailer\Exception is caught.
@@ -553,7 +580,7 @@
* @param WP_Error $error A WP_Error object with the PHPMailer\PHPMailer\Exception message, and an array
* containing the mail recipient, subject, message, headers, and attachments.
*/
- do_action( 'wp_mail_failed', new WP_Error( 'wp_mail_failed', $e->getMessage(), $mail_error_data ) );
+ do_action( 'wp_mail_failed', new WP_Error( 'wp_mail_failed', $e->getMessage(), $mail_data ) );
return false;
}
@@ -698,7 +725,16 @@
*
* @since 2.7.0
*
- * @param string[] $cookie_elements An array of data for the authentication cookie.
+ * @param string[] $cookie_elements {
+ * Authentication cookie components. None of the components should be assumed
+ * to be valid as they come directly from a client-provided cookie value.
+ *
+ * @type string $username User's username.
+ * @type string $expiration The time the cookie expires as a UNIX timestamp.
+ * @type string $token User's session token used.
+ * @type string $hmac The security hash for the cookie.
+ * @type string $scheme The cookie scheme to use.
+ * }
*/
do_action( 'auth_cookie_expired', $cookie_elements );
return false;
@@ -711,7 +747,16 @@
*
* @since 2.7.0
*
- * @param string[] $cookie_elements An array of data for the authentication cookie.
+ * @param string[] $cookie_elements {
+ * Authentication cookie components. None of the components should be assumed
+ * to be valid as they come directly from a client-provided cookie value.
+ *
+ * @type string $username User's username.
+ * @type string $expiration The time the cookie expires as a UNIX timestamp.
+ * @type string $token User's session token used.
+ * @type string $hmac The security hash for the cookie.
+ * @type string $scheme The cookie scheme to use.
+ * }
*/
do_action( 'auth_cookie_bad_username', $cookie_elements );
return false;
@@ -731,7 +776,16 @@
*
* @since 2.7.0
*
- * @param string[] $cookie_elements An array of data for the authentication cookie.
+ * @param string[] $cookie_elements {
+ * Authentication cookie components. None of the components should be assumed
+ * to be valid as they come directly from a client-provided cookie value.
+ *
+ * @type string $username User's username.
+ * @type string $expiration The time the cookie expires as a UNIX timestamp.
+ * @type string $token User's session token used.
+ * @type string $hmac The security hash for the cookie.
+ * @type string $scheme The cookie scheme to use.
+ * }
*/
do_action( 'auth_cookie_bad_hash', $cookie_elements );
return false;
@@ -744,7 +798,16 @@
*
* @since 4.0.0
*
- * @param string[] $cookie_elements An array of data for the authentication cookie.
+ * @param string[] $cookie_elements {
+ * Authentication cookie components. None of the components should be assumed
+ * to be valid as they come directly from a client-provided cookie value.
+ *
+ * @type string $username User's username.
+ * @type string $expiration The time the cookie expires as a UNIX timestamp.
+ * @type string $token User's session token used.
+ * @type string $hmac The security hash for the cookie.
+ * @type string $scheme The cookie scheme to use.
+ * }
*/
do_action( 'auth_cookie_bad_session_token', $cookie_elements );
return false;
@@ -760,7 +823,15 @@
*
* @since 2.7.0
*
- * @param string[] $cookie_elements An array of data for the authentication cookie.
+ * @param string[] $cookie_elements {
+ * Authentication cookie components.
+ *
+ * @type string $username User's username.
+ * @type string $expiration The time the cookie expires as a UNIX timestamp.
+ * @type string $token User's session token used.
+ * @type string $hmac The security hash for the cookie.
+ * @type string $scheme The cookie scheme to use.
+ * }
* @param WP_User $user User object.
*/
do_action( 'auth_cookie_valid', $cookie_elements, $user );
@@ -828,7 +899,17 @@
*
* @param string $cookie Authentication cookie.
* @param string $scheme Optional. The cookie scheme to use: 'auth', 'secure_auth', or 'logged_in'.
- * @return string[]|false Authentication cookie components.
+ * @return string[]|false {
+ * Authentication cookie components. None of the components should be assumed
+ * to be valid as they come directly from a client-provided cookie value. If
+ * the cookie value is malformed, false is returned.
+ *
+ * @type string $username User's username.
+ * @type string $expiration The time the cookie expires as a UNIX timestamp.
+ * @type string $token User's session token used.
+ * @type string $hmac The security hash for the cookie.
+ * @type string $scheme The cookie scheme to use.
+ * }
*/
function wp_parse_auth_cookie( $cookie = '', $scheme = '' ) {
if ( empty( $cookie ) ) {
@@ -1569,7 +1650,7 @@
* @since 3.7.0
*
* @param string[] $emails An array of email addresses to receive a comment notification.
- * @param int $comment_id The comment ID.
+ * @param string $comment_id The comment ID as a numeric string.
*/
$emails = apply_filters( 'comment_notification_recipients', $emails, $comment->comment_ID );
$emails = array_filter( $emails );
@@ -1590,9 +1671,9 @@
*
* @since 3.8.0
*
- * @param bool $notify Whether to notify the post author of their own comment.
- * Default false.
- * @param int $comment_id The comment ID.
+ * @param bool $notify Whether to notify the post author of their own comment.
+ * Default false.
+ * @param string $comment_id The comment ID as a numeric string.
*/
$notify_author = apply_filters( 'comment_notification_notify_author', false, $comment->comment_ID );
@@ -1725,7 +1806,7 @@
* @since 1.5.2
*
* @param string $notify_message The comment notification email text.
- * @param int $comment_id Comment ID.
+ * @param string $comment_id Comment ID as a numeric string.
*/
$notify_message = apply_filters( 'comment_notification_text', $notify_message, $comment->comment_ID );
@@ -1735,7 +1816,7 @@
* @since 1.5.2
*
* @param string $subject The comment notification email subject.
- * @param int $comment_id Comment ID.
+ * @param string $comment_id Comment ID as a numeric string.
*/
$subject = apply_filters( 'comment_notification_subject', $subject, $comment->comment_ID );
@@ -1745,7 +1826,7 @@
* @since 1.5.2
*
* @param string $message_headers Headers for the comment notification email.
- * @param int $comment_id Comment ID.
+ * @param string $comment_id Comment ID as a numeric string.
*/
$message_headers = apply_filters( 'comment_notification_headers', $message_headers, $comment->comment_ID );
@@ -2678,7 +2759,7 @@
);
if ( wp_lazy_loading_enabled( 'img', 'get_avatar' ) ) {
- $defaults['loading'] = 'lazy';
+ $defaults['loading'] = wp_get_loading_attr_default( 'get_avatar' );
}
if ( empty( $args ) ) {
@@ -2705,7 +2786,7 @@
/**
* Allows the HTML for a user's avatar to be returned early.
*
- * Passing a non-null value will effectively short-circuit get_avatar(), passing
+ * Returning a non-null value will effectively short-circuit get_avatar(), passing
* the value through the {@see 'get_avatar'} filter and returning early.
*
* @since 4.2.0
@@ -2785,8 +2866,7 @@
* @param int $size Square avatar width and height in pixels to retrieve.
* @param string $default URL for the default image or a default type. Accepts '404', 'retro', 'monsterid',
* 'wavatar', 'indenticon', 'mystery', 'mm', 'mysteryman', 'blank', or 'gravatar_default'.
- * Default is the value of the 'avatar_default' option, with a fallback of 'mystery'.
- * @param string $alt Alternative text to use in the avatar image tag. Default empty.
+ * @param string $alt Alternative text to use in the avatar image tag.
* @param array $args Arguments passed to get_avatar_data(), after processing.
*/
return apply_filters( 'get_avatar', $avatar, $id_or_email, $args['size'], $args['default'], $args['alt'], $args );