Ticket #31469: miqro-31469.2.diff
File miqro-31469.2.diff, 5.6 KB (added by , 10 years ago) |
---|
-
src/wp-includes/link-template.php
3422 3422 * @param array $args { 3423 3423 * Optional. Arguments to return instead of the default arguments. 3424 3424 * 3425 * @type int $size Height and width of the avatar in pixels. Default 96. 3425 * @type int $size Height and width of the avatar image file in pixels. Default 96. 3426 * @type int $height Display height of the avatar in pixels. Default 96. 3427 * @type int $width Display width of the avatar in pixels. Default 96. 3426 3428 * @type string $default URL for the default image or a default type. Accepts '404' (return 3427 3429 * a 404 instead of a default image), 'retro' (8bit), 'monsterid' (monster), 3428 3430 * 'wavatar' (cartoon face), 'indenticon' (the "quilt"), 'mystery', 'mm', … … 3436 3438 * Default null. 3437 3439 * @type array $processed_args When the function returns, the value will be the processed/sanitized $args 3438 3440 * plus a "found_avatar" guess. Pass as a reference. Default null. 3441 * @type string $extra_attr HTML attribute to insert in the IMG element. Has no default and is not sanitized. 3439 3442 * } 3440 3443 * 3441 3444 * @return array $processed_args { … … 3449 3452 function get_avatar_data( $id_or_email, $args = null ) { 3450 3453 $args = wp_parse_args( $args, array( 3451 3454 'size' => 96, 3455 'height' => 96, 3456 'width' => 96, 3452 3457 'default' => get_option( 'avatar_default', 'mystery' ), 3453 3458 'force_default' => false, 3454 3459 'rating' => get_option( 'avatar_rating' ), 3455 3460 'scheme' => null, 3456 3461 'processed_args' => null, // if used, should be a reference 3462 'extra_attr' => '', 3457 3463 ) ); 3458 3464 3459 3465 if ( is_numeric( $args['size'] ) ) { … … 3465 3471 $args['size'] = 96; 3466 3472 } 3467 3473 3474 if ( is_numeric( $args['height'] ) ) { 3475 $args['height'] = absint( $args['height'] ); 3476 if ( ! $args['height'] ) { 3477 $args['height'] = 96; 3478 } 3479 } else { 3480 $args['height'] = 96; 3481 } 3482 3483 if ( is_numeric( $args['width'] ) ) { 3484 $args['width'] = absint( $args['width'] ); 3485 if ( ! $args['width'] ) { 3486 $args['width'] = 96; 3487 } 3488 } else { 3489 $args['width'] = 96; 3490 } 3491 3468 3492 if ( empty( $args['default'] ) ) { 3469 3493 $args['default'] = get_option( 'avatar_default', 'mystery' ); 3470 3494 } -
src/wp-includes/pluggable.php
2101 2101 * 2102 2102 * @param mixed $id_or_email The Gravatar to retrieve. Accepts a user_id, gravatar md5 hash, 2103 2103 * user email, WP_User object, WP_Post object, or comment object. 2104 * @param int $size Optional. Height and width of the avatar i n pixels. Default 96.2104 * @param int $size Optional. Height and width of the avatar image file in pixels. Default 96. 2105 2105 * @param string $default Optional. URL for the default image or a default type. Accepts '404' 2106 2106 * (return a 404 instead of a default image), 'retro' (8bit), 'monsterid' 2107 2107 * (monster), 'wavatar' (cartoon face), 'indenticon' (the "quilt"), … … 2112 2112 * @param array $args { 2113 2113 * Optional. Extra arguments to retrieve the avatar. 2114 2114 * 2115 * @type int $height Display height of the avatar in pixels. Default 96. 2116 * @type int $width Display width of the avatar in pixels. Default 96. 2115 2117 * @type bool $force_default Whether to always show the default image, never the Gravatar. Default false. 2116 2118 * @type string $rating What rating to display avatars up to. Accepts 'G', 'PG', 'R', 'X', and are 2117 2119 * judged in that order. Default is the value of the 'avatar_rating' option. … … 2121 2123 * Default null. 2122 2124 * @type bool $force_display Whether to always show the avatar - ignores the show_avatars option. 2123 2125 * Default false. 2126 * @type string $extra_attr HTML attribute to insert in the IMG element. Has no default and is not sanitized. 2124 2127 * } 2125 2128 * 2126 2129 * @return false|string `<img>` tag for the user's avatar. False on failure. … … 2129 2132 $defaults = array( 2130 2133 // get_avatar_data() args. 2131 2134 'size' => 96, 2135 'height' => 96, 2136 'width' => 96, 2132 2137 'default' => get_option( 'avatar_default', 'mystery' ), 2133 2138 'force_default' => false, 2134 2139 'rating' => get_option( 'avatar_rating' ), … … 2136 2141 'alt' => '', 2137 2142 'class' => null, 2138 2143 'force_display' => false, 2144 'extra_attr' => '', 2139 2145 ); 2140 2146 2141 2147 if ( empty( $args ) ) { … … 2145 2151 $args['size'] = $size; 2146 2152 $args['default'] = $default; 2147 2153 $args['alt'] = $alt; 2154 2155 if ( empty( $args['height'] ) { 2156 $args['height'] = $size; 2157 } 2158 if ( empty( $args['width'] ) { 2159 $args['width'] = $size; 2160 } 2148 2161 2149 2162 $args = wp_parse_args( $args, $defaults ); 2150 2163 … … 2193 2206 } 2194 2207 2195 2208 $avatar = sprintf( 2196 "<img alt='%s' src='%s' class='%s' height='%d' width='%d' />",2209 "<img alt='%s' src='%s' class='%s' height='%d' width='%d' %s/>", 2197 2210 esc_attr( $args['alt'] ), 2198 2211 esc_url( $url ), 2199 2212 esc_attr( join( ' ', $class ) ), 2200 (int) $args['size'], 2201 (int) $args['size'] 2213 (int) $args['height'], 2214 (int) $args['width'], 2215 $args['extra_attr'] 2202 2216 ); 2203 2217 2204 2218 /**