Making WordPress.org

Changeset 6404


Ignore:
Timestamp:
01/19/2018 11:27:25 PM (9 years ago)
Author:
obenland
Message:

Plugins: Always prefer SVG for icons.

H/t denisco.
Fixes #2646.

File:
1 edited

Legend:

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

    r6287 r6404  
    372372
    373373                                case '128x128':
    374                                         $icon = self::get_asset_url( $plugin, $info );
     374                                        $icon_1x = self::get_asset_url( $plugin, $info );
    375375                                        break;
    376376
    377377                                /* false = the resolution of the icon, this is NOT disabled */
    378378                                case false && 'icon.svg' == $file:
    379                                         $svg = self::get_asset_url( $plugin, $info );
    380                                         break;
    381                         }
    382                 }
    383 
    384                 // Fallback to SVG if it exists.
    385                 if ( ! $icon && $svg ) {
    386                         $icon = $svg;
     379                                        $icon = $svg = self::get_asset_url( $plugin, $info );
     380                                        break;
     381                        }
     382                }
     383
     384                // Fallback to 1x if it exists.
     385                if ( ! $icon && $icon_1x ) {
     386                        $icon = $icon_1x;
    387387                }
    388388
     
    412412                                $id    = "plugin-icon-{$plugin->post_name}";
    413413                                $html  = "<style type='text/css'>";
    414                                 $html .= "#{$id} { background-image: url('{$icon}'); } .plugin-icon { background-size: cover; height: 128px; width: 128px; }";
    415                                 if ( ! empty( $icon_2x ) && ! $generated ) {
     414                                $html .= "#{$id} { background-image: url('{$icon}'); }";
     415                                if ( ! empty( $icon_2x ) && ! $generated && ! $svg ) {
    416416                                        $html .= "@media only screen and (-webkit-min-device-pixel-ratio: 1.5), only screen and (min-resolution: 144dpi) { #{$id} { background-image: url('{$icon_2x}'); } }";
    417417                                }
Note: See TracChangeset for help on using the changeset viewer.