Changeset 47554 for trunk/src/wp-includes/pluggable.php
- Timestamp:
- 04/08/2020 12:53:18 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/pluggable.php
r47553 r47554 2607 2607 * @type bool $force_display Whether to always show the avatar - ignores the show_avatars option. 2608 2608 * Default false. 2609 * @type string $loading Value for the `loading` attribute. 2610 * Default null. 2609 2611 * @type string $extra_attr HTML attributes to insert in the IMG element. Is not sanitized. Default empty. 2610 2612 * } … … 2624 2626 'class' => null, 2625 2627 'force_display' => false, 2628 'loading' => null, 2626 2629 'extra_attr' => '', 2627 2630 ); 2631 2632 if ( wp_lazy_loading_enabled( 'img', 'get_avatar' ) ) { 2633 $defaults['loading'] = 'lazy'; 2634 } 2628 2635 2629 2636 if ( empty( $args ) ) { … … 2694 2701 $class[] = $args['class']; 2695 2702 } 2703 } 2704 2705 // Add `loading` attribute. 2706 $extra_attr = $args['extra_attr']; 2707 $loading = $args['loading']; 2708 2709 if ( in_array( $loading, array( 'lazy', 'eager' ), true ) && ! preg_match( '/\bloading\s*=/', $extra_attr ) ) { 2710 if ( ! empty( $extra_attr ) ) { 2711 $extra_attr .= ' '; 2712 } 2713 2714 $extra_attr .= "loading='{$loading}'"; 2696 2715 } 2697 2716 … … 2704 2723 (int) $args['height'], 2705 2724 (int) $args['width'], 2706 $ args['extra_attr']2725 $extra_attr 2707 2726 ); 2708 2727
Note: See TracChangeset
for help on using the changeset viewer.