Plugin Directory

Changeset 1465345


Ignore:
Timestamp:
08/01/2016 05:48:47 PM (10 years ago)
Author:
sterlo
Message:

Syncing with GitHub repository.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • scalable-vector-graphics-svg/trunk/scalable-vector-graphics.php

    r1463278 r1465345  
    7373// Thus the below is needed.
    7474//
    75 // Consider this the "client side" fix for dimensions.
     75// Consider this the "client side" fix for dimensions. But only for the Administration.
    7676//
    7777// WordPress requires inline administration styles to be wrapped in an actionable function.
    7878// These styles specifically address the Media Listing styling and Featured Image
    7979// styling so that the images show up in the Administration area.
    80 function styles() {
     80function administration_styles() {
    8181    // Media Listing Fix
    8282    wp_add_inline_style( 'wp-admin', ".media .media-icon img[src$='.svg'] { width: auto; height: auto; }" );
     
    8585}
    8686
     87// Browsers may or may not show SVG files properly without a height/width.
     88// WordPress specifically defines width/height as "0" if it cannot figure it out.
     89// Thus the below is needed.
     90//
     91// Consider this the "client side" fix for dimensions. But only for the End User.
     92function public_styles() {
     93    // Featured Image Fix
     94    echo "<style>.post-thumbnail img[src$='.svg'] { width: 100%; height: auto; }</style>";
     95}
     96
    8797// Do work son.
    8898add_filter( 'upload_mimes', __NAMESPACE__ . '\\allow_svg_uploads' );
    8999add_filter( 'wp_prepare_attachment_for_js', __NAMESPACE__ . '\\adjust_response_for_svg', 10, 3 );
    90 add_action( 'admin_enqueue_scripts', __NAMESPACE__ . '\\styles' );
     100add_action( 'admin_enqueue_scripts', __NAMESPACE__ . '\\administration_styles' );
     101add_action( 'wp_head', __NAMESPACE__ . '\\public_styles' );
    91102
    92103?>
Note: See TracChangeset for help on using the changeset viewer.