Edit File by line
/home/zeestwma/richards.../wp-inclu...
File: pluggable.php
global $wpdb;
[3000] Fix | Delete
[3001] Fix | Delete
$old_user_data = get_userdata( $user_id );
[3002] Fix | Delete
[3003] Fix | Delete
$hash = wp_hash_password( $password );
[3004] Fix | Delete
$wpdb->update(
[3005] Fix | Delete
$wpdb->users,
[3006] Fix | Delete
array(
[3007] Fix | Delete
'user_pass' => $hash,
[3008] Fix | Delete
'user_activation_key' => '',
[3009] Fix | Delete
),
[3010] Fix | Delete
array( 'ID' => $user_id )
[3011] Fix | Delete
);
[3012] Fix | Delete
[3013] Fix | Delete
clean_user_cache( $user_id );
[3014] Fix | Delete
[3015] Fix | Delete
/**
[3016] Fix | Delete
* Fires after the user password is set.
[3017] Fix | Delete
*
[3018] Fix | Delete
* @since 6.2.0
[3019] Fix | Delete
* @since 6.7.0 The `$old_user_data` parameter was added.
[3020] Fix | Delete
*
[3021] Fix | Delete
* @param string $password The plaintext password just set.
[3022] Fix | Delete
* @param int $user_id The ID of the user whose password was just set.
[3023] Fix | Delete
* @param WP_User $old_user_data Object containing user's data prior to update.
[3024] Fix | Delete
*/
[3025] Fix | Delete
do_action( 'wp_set_password', $password, $user_id, $old_user_data );
[3026] Fix | Delete
}
[3027] Fix | Delete
endif;
[3028] Fix | Delete
[3029] Fix | Delete
if ( ! function_exists( 'get_avatar' ) ) :
[3030] Fix | Delete
/**
[3031] Fix | Delete
* Retrieves the avatar `<img>` tag for a user, email address, MD5 hash, comment, or post.
[3032] Fix | Delete
*
[3033] Fix | Delete
* @since 2.5.0
[3034] Fix | Delete
* @since 4.2.0 Added the optional `$args` parameter.
[3035] Fix | Delete
* @since 5.5.0 Added the `loading` argument.
[3036] Fix | Delete
* @since 6.1.0 Added the `decoding` argument.
[3037] Fix | Delete
* @since 6.3.0 Added the `fetchpriority` argument.
[3038] Fix | Delete
*
[3039] Fix | Delete
* @param mixed $id_or_email The avatar to retrieve. Accepts a user ID, Gravatar MD5 hash,
[3040] Fix | Delete
* user email, WP_User object, WP_Post object, or WP_Comment object.
[3041] Fix | Delete
* @param int $size Optional. Height and width of the avatar in pixels. Default 96.
[3042] Fix | Delete
* @param string $default_value URL for the default image or a default type. Accepts:
[3043] Fix | Delete
* - '404' (return a 404 instead of a default image)
[3044] Fix | Delete
* - 'retro' (a 8-bit arcade-style pixelated face)
[3045] Fix | Delete
* - 'robohash' (a robot)
[3046] Fix | Delete
* - 'monsterid' (a monster)
[3047] Fix | Delete
* - 'wavatar' (a cartoon face)
[3048] Fix | Delete
* - 'identicon' (the "quilt", a geometric pattern)
[3049] Fix | Delete
* - 'mystery', 'mm', or 'mysteryman' (The Oyster Man)
[3050] Fix | Delete
* - 'blank' (transparent GIF)
[3051] Fix | Delete
* - 'gravatar_default' (the Gravatar logo)
[3052] Fix | Delete
* Default is the value of the 'avatar_default' option,
[3053] Fix | Delete
* with a fallback of 'mystery'.
[3054] Fix | Delete
* @param string $alt Optional. Alternative text to use in the avatar image tag.
[3055] Fix | Delete
* Default empty.
[3056] Fix | Delete
* @param array $args {
[3057] Fix | Delete
* Optional. Extra arguments to retrieve the avatar.
[3058] Fix | Delete
*
[3059] Fix | Delete
* @type int $height Display height of the avatar in pixels. Defaults to $size.
[3060] Fix | Delete
* @type int $width Display width of the avatar in pixels. Defaults to $size.
[3061] Fix | Delete
* @type bool $force_default Whether to always show the default image, never the Gravatar.
[3062] Fix | Delete
* Default false.
[3063] Fix | Delete
* @type string $rating What rating to display avatars up to. Accepts:
[3064] Fix | Delete
* - 'G' (suitable for all audiences)
[3065] Fix | Delete
* - 'PG' (possibly offensive, usually for audiences 13 and above)
[3066] Fix | Delete
* - 'R' (intended for adult audiences above 17)
[3067] Fix | Delete
* - 'X' (even more mature than above)
[3068] Fix | Delete
* Default is the value of the 'avatar_rating' option.
[3069] Fix | Delete
* @type string $scheme URL scheme to use. See set_url_scheme() for accepted values.
[3070] Fix | Delete
* Default null.
[3071] Fix | Delete
* @type array|string $class Array or string of additional classes to add to the img element.
[3072] Fix | Delete
* Default null.
[3073] Fix | Delete
* @type bool $force_display Whether to always show the avatar - ignores the show_avatars option.
[3074] Fix | Delete
* Default false.
[3075] Fix | Delete
* @type string $loading Value for the `loading` attribute.
[3076] Fix | Delete
* Default null.
[3077] Fix | Delete
* @type string $fetchpriority Value for the `fetchpriority` attribute.
[3078] Fix | Delete
* Default null.
[3079] Fix | Delete
* @type string $decoding Value for the `decoding` attribute.
[3080] Fix | Delete
* Default null.
[3081] Fix | Delete
* @type string $extra_attr HTML attributes to insert in the IMG element. Is not sanitized.
[3082] Fix | Delete
* Default empty.
[3083] Fix | Delete
* }
[3084] Fix | Delete
* @return string|false `<img>` tag for the user's avatar. False on failure.
[3085] Fix | Delete
*/
[3086] Fix | Delete
function get_avatar( $id_or_email, $size = 96, $default_value = '', $alt = '', $args = null ) {
[3087] Fix | Delete
$defaults = array(
[3088] Fix | Delete
// get_avatar_data() args.
[3089] Fix | Delete
'size' => 96,
[3090] Fix | Delete
'height' => null,
[3091] Fix | Delete
'width' => null,
[3092] Fix | Delete
'default' => get_option( 'avatar_default', 'mystery' ),
[3093] Fix | Delete
'force_default' => false,
[3094] Fix | Delete
'rating' => get_option( 'avatar_rating' ),
[3095] Fix | Delete
'scheme' => null,
[3096] Fix | Delete
'alt' => '',
[3097] Fix | Delete
'class' => null,
[3098] Fix | Delete
'force_display' => false,
[3099] Fix | Delete
'loading' => null,
[3100] Fix | Delete
'fetchpriority' => null,
[3101] Fix | Delete
'decoding' => null,
[3102] Fix | Delete
'extra_attr' => '',
[3103] Fix | Delete
);
[3104] Fix | Delete
[3105] Fix | Delete
if ( empty( $args ) ) {
[3106] Fix | Delete
$args = array();
[3107] Fix | Delete
}
[3108] Fix | Delete
[3109] Fix | Delete
$args['size'] = (int) $size;
[3110] Fix | Delete
$args['default'] = $default_value;
[3111] Fix | Delete
$args['alt'] = $alt;
[3112] Fix | Delete
[3113] Fix | Delete
$args = wp_parse_args( $args, $defaults );
[3114] Fix | Delete
[3115] Fix | Delete
if ( empty( $args['height'] ) ) {
[3116] Fix | Delete
$args['height'] = $args['size'];
[3117] Fix | Delete
}
[3118] Fix | Delete
if ( empty( $args['width'] ) ) {
[3119] Fix | Delete
$args['width'] = $args['size'];
[3120] Fix | Delete
}
[3121] Fix | Delete
[3122] Fix | Delete
// Update args with loading optimized attributes.
[3123] Fix | Delete
$loading_optimization_attr = wp_get_loading_optimization_attributes( 'img', $args, 'get_avatar' );
[3124] Fix | Delete
[3125] Fix | Delete
$args = array_merge( $args, $loading_optimization_attr );
[3126] Fix | Delete
[3127] Fix | Delete
if ( is_object( $id_or_email ) && isset( $id_or_email->comment_ID ) ) {
[3128] Fix | Delete
$id_or_email = get_comment( $id_or_email );
[3129] Fix | Delete
}
[3130] Fix | Delete
[3131] Fix | Delete
/**
[3132] Fix | Delete
* Allows the HTML for a user's avatar to be returned early.
[3133] Fix | Delete
*
[3134] Fix | Delete
* Returning a non-null value will effectively short-circuit get_avatar(), passing
[3135] Fix | Delete
* the value through the {@see 'get_avatar'} filter and returning early.
[3136] Fix | Delete
*
[3137] Fix | Delete
* @since 4.2.0
[3138] Fix | Delete
*
[3139] Fix | Delete
* @param string|null $avatar HTML for the user's avatar. Default null.
[3140] Fix | Delete
* @param mixed $id_or_email The avatar to retrieve. Accepts a user ID, Gravatar MD5 hash,
[3141] Fix | Delete
* user email, WP_User object, WP_Post object, or WP_Comment object.
[3142] Fix | Delete
* @param array $args Arguments passed to get_avatar_url(), after processing.
[3143] Fix | Delete
*/
[3144] Fix | Delete
$avatar = apply_filters( 'pre_get_avatar', null, $id_or_email, $args );
[3145] Fix | Delete
[3146] Fix | Delete
if ( ! is_null( $avatar ) ) {
[3147] Fix | Delete
/** This filter is documented in wp-includes/pluggable.php */
[3148] Fix | Delete
return apply_filters( 'get_avatar', $avatar, $id_or_email, $args['size'], $args['default'], $args['alt'], $args );
[3149] Fix | Delete
}
[3150] Fix | Delete
[3151] Fix | Delete
if ( ! $args['force_display'] && ! get_option( 'show_avatars' ) ) {
[3152] Fix | Delete
return false;
[3153] Fix | Delete
}
[3154] Fix | Delete
[3155] Fix | Delete
$url2x = get_avatar_url( $id_or_email, array_merge( $args, array( 'size' => $args['size'] * 2 ) ) );
[3156] Fix | Delete
[3157] Fix | Delete
$args = get_avatar_data( $id_or_email, $args );
[3158] Fix | Delete
[3159] Fix | Delete
$url = $args['url'];
[3160] Fix | Delete
[3161] Fix | Delete
if ( ! $url || is_wp_error( $url ) ) {
[3162] Fix | Delete
return false;
[3163] Fix | Delete
}
[3164] Fix | Delete
[3165] Fix | Delete
$class = array( 'avatar', 'avatar-' . (int) $args['size'], 'photo' );
[3166] Fix | Delete
[3167] Fix | Delete
if ( ! $args['found_avatar'] || $args['force_default'] ) {
[3168] Fix | Delete
$class[] = 'avatar-default';
[3169] Fix | Delete
}
[3170] Fix | Delete
[3171] Fix | Delete
if ( $args['class'] ) {
[3172] Fix | Delete
if ( is_array( $args['class'] ) ) {
[3173] Fix | Delete
$class = array_merge( $class, $args['class'] );
[3174] Fix | Delete
} else {
[3175] Fix | Delete
$class[] = $args['class'];
[3176] Fix | Delete
}
[3177] Fix | Delete
}
[3178] Fix | Delete
[3179] Fix | Delete
// Add `loading`, `fetchpriority`, and `decoding` attributes.
[3180] Fix | Delete
$extra_attr = $args['extra_attr'];
[3181] Fix | Delete
[3182] Fix | Delete
if ( in_array( $args['loading'], array( 'lazy', 'eager' ), true )
[3183] Fix | Delete
&& ! preg_match( '/\bloading\s*=/', $extra_attr )
[3184] Fix | Delete
) {
[3185] Fix | Delete
if ( ! empty( $extra_attr ) ) {
[3186] Fix | Delete
$extra_attr .= ' ';
[3187] Fix | Delete
}
[3188] Fix | Delete
[3189] Fix | Delete
$extra_attr .= "loading='{$args['loading']}'";
[3190] Fix | Delete
}
[3191] Fix | Delete
[3192] Fix | Delete
if ( in_array( $args['fetchpriority'], array( 'high', 'low', 'auto' ), true )
[3193] Fix | Delete
&& ! preg_match( '/\bfetchpriority\s*=/', $extra_attr )
[3194] Fix | Delete
) {
[3195] Fix | Delete
if ( ! empty( $extra_attr ) ) {
[3196] Fix | Delete
$extra_attr .= ' ';
[3197] Fix | Delete
}
[3198] Fix | Delete
[3199] Fix | Delete
$extra_attr .= "fetchpriority='{$args['fetchpriority']}'";
[3200] Fix | Delete
}
[3201] Fix | Delete
[3202] Fix | Delete
if ( in_array( $args['decoding'], array( 'async', 'sync', 'auto' ), true )
[3203] Fix | Delete
&& ! preg_match( '/\bdecoding\s*=/', $extra_attr )
[3204] Fix | Delete
) {
[3205] Fix | Delete
if ( ! empty( $extra_attr ) ) {
[3206] Fix | Delete
$extra_attr .= ' ';
[3207] Fix | Delete
}
[3208] Fix | Delete
[3209] Fix | Delete
$extra_attr .= "decoding='{$args['decoding']}'";
[3210] Fix | Delete
}
[3211] Fix | Delete
[3212] Fix | Delete
$avatar = sprintf(
[3213] Fix | Delete
"<img alt='%s' src='%s' srcset='%s' class='%s' height='%d' width='%d' %s/>",
[3214] Fix | Delete
esc_attr( $args['alt'] ),
[3215] Fix | Delete
esc_url( $url ),
[3216] Fix | Delete
esc_url( $url2x ) . ' 2x',
[3217] Fix | Delete
esc_attr( implode( ' ', $class ) ),
[3218] Fix | Delete
(int) $args['height'],
[3219] Fix | Delete
(int) $args['width'],
[3220] Fix | Delete
$extra_attr
[3221] Fix | Delete
);
[3222] Fix | Delete
[3223] Fix | Delete
/**
[3224] Fix | Delete
* Filters the HTML for a user's avatar.
[3225] Fix | Delete
*
[3226] Fix | Delete
* @since 2.5.0
[3227] Fix | Delete
* @since 4.2.0 Added the `$args` parameter.
[3228] Fix | Delete
*
[3229] Fix | Delete
* @param string $avatar HTML for the user's avatar.
[3230] Fix | Delete
* @param mixed $id_or_email The avatar to retrieve. Accepts a user ID, Gravatar MD5 hash,
[3231] Fix | Delete
* user email, WP_User object, WP_Post object, or WP_Comment object.
[3232] Fix | Delete
* @param int $size Height and width of the avatar in pixels.
[3233] Fix | Delete
* @param string $default_value URL for the default image or a default type. Accepts:
[3234] Fix | Delete
* - '404' (return a 404 instead of a default image)
[3235] Fix | Delete
* - 'retro' (a 8-bit arcade-style pixelated face)
[3236] Fix | Delete
* - 'robohash' (a robot)
[3237] Fix | Delete
* - 'monsterid' (a monster)
[3238] Fix | Delete
* - 'wavatar' (a cartoon face)
[3239] Fix | Delete
* - 'identicon' (the "quilt", a geometric pattern)
[3240] Fix | Delete
* - 'mystery', 'mm', or 'mysteryman' (The Oyster Man)
[3241] Fix | Delete
* - 'blank' (transparent GIF)
[3242] Fix | Delete
* - 'gravatar_default' (the Gravatar logo)
[3243] Fix | Delete
* @param string $alt Alternative text to use in the avatar image tag.
[3244] Fix | Delete
* @param array $args Arguments passed to get_avatar_data(), after processing.
[3245] Fix | Delete
*/
[3246] Fix | Delete
return apply_filters( 'get_avatar', $avatar, $id_or_email, $args['size'], $args['default'], $args['alt'], $args );
[3247] Fix | Delete
}
[3248] Fix | Delete
endif;
[3249] Fix | Delete
[3250] Fix | Delete
if ( ! function_exists( 'wp_text_diff' ) ) :
[3251] Fix | Delete
/**
[3252] Fix | Delete
* Displays a human readable HTML representation of the difference between two strings.
[3253] Fix | Delete
*
[3254] Fix | Delete
* The Diff is available for getting the changes between versions. The output is
[3255] Fix | Delete
* HTML, so the primary use is for displaying the changes. If the two strings
[3256] Fix | Delete
* are equivalent, then an empty string will be returned.
[3257] Fix | Delete
*
[3258] Fix | Delete
* @since 2.6.0
[3259] Fix | Delete
*
[3260] Fix | Delete
* @see wp_parse_args() Used to change defaults to user defined settings.
[3261] Fix | Delete
* @uses Text_Diff
[3262] Fix | Delete
* @uses WP_Text_Diff_Renderer_Table
[3263] Fix | Delete
*
[3264] Fix | Delete
* @param string $left_string "old" (left) version of string.
[3265] Fix | Delete
* @param string $right_string "new" (right) version of string.
[3266] Fix | Delete
* @param string|array $args {
[3267] Fix | Delete
* Associative array of options to pass to WP_Text_Diff_Renderer_Table().
[3268] Fix | Delete
*
[3269] Fix | Delete
* @type string $title Titles the diff in a manner compatible
[3270] Fix | Delete
* with the output. Default empty.
[3271] Fix | Delete
* @type string $title_left Change the HTML to the left of the title.
[3272] Fix | Delete
* Default empty.
[3273] Fix | Delete
* @type string $title_right Change the HTML to the right of the title.
[3274] Fix | Delete
* Default empty.
[3275] Fix | Delete
* @type bool $show_split_view True for split view (two columns), false for
[3276] Fix | Delete
* un-split view (single column). Default true.
[3277] Fix | Delete
* }
[3278] Fix | Delete
* @return string Empty string if strings are equivalent or HTML with differences.
[3279] Fix | Delete
*/
[3280] Fix | Delete
function wp_text_diff( $left_string, $right_string, $args = null ) {
[3281] Fix | Delete
$defaults = array(
[3282] Fix | Delete
'title' => '',
[3283] Fix | Delete
'title_left' => '',
[3284] Fix | Delete
'title_right' => '',
[3285] Fix | Delete
'show_split_view' => true,
[3286] Fix | Delete
);
[3287] Fix | Delete
$args = wp_parse_args( $args, $defaults );
[3288] Fix | Delete
[3289] Fix | Delete
if ( ! class_exists( 'WP_Text_Diff_Renderer_Table', false ) ) {
[3290] Fix | Delete
require ABSPATH . WPINC . '/wp-diff.php';
[3291] Fix | Delete
}
[3292] Fix | Delete
[3293] Fix | Delete
$left_string = normalize_whitespace( $left_string );
[3294] Fix | Delete
$right_string = normalize_whitespace( $right_string );
[3295] Fix | Delete
[3296] Fix | Delete
$left_lines = explode( "\n", $left_string );
[3297] Fix | Delete
$right_lines = explode( "\n", $right_string );
[3298] Fix | Delete
$text_diff = new Text_Diff( $left_lines, $right_lines );
[3299] Fix | Delete
$renderer = new WP_Text_Diff_Renderer_Table( $args );
[3300] Fix | Delete
$diff = $renderer->render( $text_diff );
[3301] Fix | Delete
[3302] Fix | Delete
if ( ! $diff ) {
[3303] Fix | Delete
return '';
[3304] Fix | Delete
}
[3305] Fix | Delete
[3306] Fix | Delete
$is_split_view = ! empty( $args['show_split_view'] );
[3307] Fix | Delete
$is_split_view_class = $is_split_view ? ' is-split-view' : '';
[3308] Fix | Delete
[3309] Fix | Delete
$r = "<table class='diff$is_split_view_class'>\n";
[3310] Fix | Delete
[3311] Fix | Delete
if ( $args['title'] ) {
[3312] Fix | Delete
$r .= "<caption class='diff-title'>$args[title]</caption>\n";
[3313] Fix | Delete
}
[3314] Fix | Delete
[3315] Fix | Delete
if ( $args['title_left'] || $args['title_right'] ) {
[3316] Fix | Delete
$r .= '<thead>';
[3317] Fix | Delete
}
[3318] Fix | Delete
[3319] Fix | Delete
if ( $args['title_left'] || $args['title_right'] ) {
[3320] Fix | Delete
$th_or_td_left = empty( $args['title_left'] ) ? 'td' : 'th';
[3321] Fix | Delete
$th_or_td_right = empty( $args['title_right'] ) ? 'td' : 'th';
[3322] Fix | Delete
[3323] Fix | Delete
$r .= "<tr class='diff-sub-title'>\n";
[3324] Fix | Delete
$r .= "\t<$th_or_td_left>$args[title_left]</$th_or_td_left>\n";
[3325] Fix | Delete
if ( $is_split_view ) {
[3326] Fix | Delete
$r .= "\t<$th_or_td_right>$args[title_right]</$th_or_td_right>\n";
[3327] Fix | Delete
}
[3328] Fix | Delete
$r .= "</tr>\n";
[3329] Fix | Delete
}
[3330] Fix | Delete
[3331] Fix | Delete
if ( $args['title_left'] || $args['title_right'] ) {
[3332] Fix | Delete
$r .= "</thead>\n";
[3333] Fix | Delete
}
[3334] Fix | Delete
[3335] Fix | Delete
$r .= "<tbody>\n$diff\n</tbody>\n";
[3336] Fix | Delete
$r .= '</table>';
[3337] Fix | Delete
[3338] Fix | Delete
return $r;
[3339] Fix | Delete
}
[3340] Fix | Delete
endif;
[3341] Fix | Delete
[3342] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function