Make WordPress Core

Ticket #28038: 28038.2.diff

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

    diff --git a/src/wp-includes/media-template.php b/src/wp-includes/media-template.php
    index 65803d4..c9774a7 100644
    a b function wp_print_media_templates() { 
    276276        </script>
    277277
    278278        <script type="text/html" id="tmpl-attachment-details">
     279<#  var settings = wp.media.view.settings; #>
    279280                <h3>
    280281                        <?php _e('Attachment Details'); ?>
    281282
    function wp_print_media_templates() { 
    304305                                        <# } #>
    305306
    306307                                        <# if ( data.can.save ) { #>
    307                                                 <a class="edit-attachment" href="{{ data.editLink }}&amp;image-editor" target="_blank"><?php _e( 'Edit Image' ); ?></a>
     308                                                <# if ( _.contains( settings.imageEditorSupports, data.mime ) ) { #>
     309                                                        <a class="edit-attachment" href="{{ data.editLink }}&amp;image-editor" target="_blank"><?php _e( 'Edit Image' ); ?></a>
     310                                                <# } #>
    308311                                                <a class="refresh-attachment" href="#"><?php _e( 'Refresh' ); ?></a>
    309312                                        <# } #>
    310313                                <# } #>
  • src/wp-includes/media.php

    diff --git a/src/wp-includes/media.php b/src/wp-includes/media.php
    index f9b47e4..615e706 100644
    a b function wp_enqueue_media( $args = array() ) { 
    27822782                }
    27832783        }
    27842784
     2785        $image_mime_types = array( 'image/bmp', 'image/gif', 'image/jpeg', 'image/jpeg', 'image/jpeg', 'image/png', 'image/tiff', 'image/tiff', );
     2786        $image_editor_supports = array();
     2787        foreach ( $image_mime_types as $mime_type ) {
     2788                if ( wp_image_editor_supports( array( 'mime_type' => $mime_type ) ) )
     2789                        $settings['imageEditorSupports'][] = $mime_type;
     2790        }
     2791
    27852792        $hier = $post && is_post_type_hierarchical( $post->post_type );
    27862793
    27872794        $strings = array(