Make WordPress Core

Ticket #28038: 28038.3.diff

File 28038.3.diff, 1.6 KB (added by ericlewis, 10 years ago)
  • wp-includes/media-template.php

    diff --git a/wp-includes/media-template.php b/wp-includes/media-template.php
    index 59c018c..bb02a44 100644
    a b function wp_print_media_templates() { 
    286286        </script>
    287287
    288288        <script type="text/html" id="tmpl-attachment-details">
     289<#  var settings = wp.media.view.settings; #>
    289290                <h3>
    290291                        <?php _e('Attachment Details'); ?>
    291292
    function wp_print_media_templates() { 
    314315                                        <# } #>
    315316
    316317                                        <# if ( data.can.save ) { #>
    317                                                 <a class="edit-attachment" href="{{ data.editLink }}&amp;image-editor" target="_blank"><?php _e( 'Edit Image' ); ?></a>
     318                                                <# if ( _.contains( settings.imageEditorSupports, data.mime ) ) { #>
     319                                                        <a class="edit-attachment" href="{{ data.editLink }}&amp;image-editor" target="_blank"><?php _e( 'Edit Image' ); ?></a>
     320                                                <# } #>
    318321                                                <a class="refresh-attachment" href="#"><?php _e( 'Refresh' ); ?></a>
    319322                                        <# } #>
    320323                                <# } #>
  • wp-includes/media.php

    diff --git a/wp-includes/media.php b/wp-includes/media.php
    index 43b5aab..b08c34a 100644
    a b function wp_enqueue_media( $args = array() ) { 
    27882788                }
    27892789        }
    27902790
     2791        $image_mime_types = array( 'image/bmp', 'image/gif', 'image/jpeg', 'image/jpeg', 'image/jpeg', 'image/png', 'image/tiff', 'image/tiff', );
     2792        $settings['imageEditorSupports'] = array();
     2793        foreach ( $image_mime_types as $mime_type ) {
     2794                if ( wp_image_editor_supports( array( 'mime_type' => $mime_type ) ) )
     2795                        $settings['imageEditorSupports'][] = $mime_type;
     2796        }
     2797
    27912798        $hier = $post && is_post_type_hierarchical( $post->post_type );
    27922799
    27932800        $strings = array(