WordPress.org

Making WordPress.org

Changeset 9235


Ignore:
Timestamp:
10/24/2019 08:33:08 AM (6 months ago)
Author:
dd32
Message:

Plugin Directory: Trial using <img> for plugin icons.

Props joyously.
See #4730.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-template.php

    r9233 r9235  
    504504        switch ( $output ) {
    505505            case 'html':
    506                 $id    = "plugin-icon-{$plugin->post_name}";
    507                 $html  = "<style type='text/css'>";
    508                 $html .= ".{$id} { background-image: url('{$icon}'); }";
    509                 if ( ! empty( $icon_2x ) && ! $generated && ! $svg ) {
    510                     $html .= "@media only screen and (-webkit-min-device-pixel-ratio: 1.5), only screen and (min-resolution: 144dpi) { .{$id} { background-image: url('{$icon_2x}'); } }";
     506
     507                if ( $icon_2x && $icon_2x !== $icon ) {
     508                    return "<img class='plugin-icon' srcset='{$icon_2x} 256w' src='{$icon}'>";
     509                } else {
     510                    return "<img class='plugin-icon' src='{$icon}'>";
    511511                }
    512                 $html .= '</style>';
    513                 $html .= "<div class='plugin-icon {$id}'></div>";
    514 
    515                 return $html;
    516512                break;
    517513
Note: See TracChangeset for help on using the changeset viewer.