Make WordPress Core

Ticket #32860: 32860.diff

File 32860.diff, 3.9 KB (added by obenland, 10 years ago)
  • src/wp-admin/includes/class-wp-site-icon.php

     
    176176                ?>
    177177                <p class="hide-if-no-js">
    178178                        <label class="screen-reader-text" for="choose-from-library-link"><?php _e( 'Choose an image from your media library:' ); ?></label>
    179                         <button type="button" id="choose-from-library-link" class="button" data-update-link="<?php echo esc_attr( $update_url ); ?>" data-choose="<?php esc_attr_e( 'Choose a Site Icon' ); ?>" data-update="<?php esc_attr_e( 'Set as Site Icon' ); ?>"><?php _e( 'Choose Image' ); ?></button>
     179                        <button type="button" id="choose-from-library-link" class="button" data-size="<?php echo absint( $this->min_size ); ?>" data-update-link="<?php echo esc_attr( $update_url ); ?>" data-choose="<?php esc_attr_e( 'Choose a Site Icon' ); ?>" data-update="<?php esc_attr_e( 'Set as Site Icon' ); ?>"><?php _e( 'Choose Image' ); ?></button>
    180180                </p>
    181181                <form class="hide-if-js" action="<?php echo esc_url( admin_url( 'options-general.php?page=site-icon' ) ); ?>" method="post" enctype="multipart/form-data">
    182182                        <input name="action" value="crop_site_icon" type="hidden" />
  • src/wp-admin/js/site-icon.js

     
    33
    44        $( function() {
    55                // Build the choose from library frame.
    6                 $( '#choose-from-library-link' ).click( function( event ) {
     6                $( '#choose-from-library-link' ).on( 'click', function( event ) {
    77                        var $el = $(this);
    88                        event.preventDefault();
    99
     
    1414                        }
    1515
    1616                        // Create the media frame.
    17                         frame = wp.media.frames.customHeader = wp.media({
    18                                 // Set the title of the modal.
    19                                 title: $el.data('choose'),
    20 
    21                                 // Tell the modal to show only images.
    22                                 library: {
    23                                         type: 'image'
    24                                 },
    25 
     17                        frame = wp.media({
    2618                                // Customize the submit button.
    2719                                button: {
    2820                                        // Set the text of the button.
     
    3022                                        // Tell the button not to close the modal, since we're
    3123                                        // going to refresh the page when the image is selected.
    3224                                        close: false
    33                                 }
     25                                },
     26                                states: [
     27                                        new wp.media.controller.Library({
     28                                                title:           $el.data( 'choose' ),
     29                                                library:         wp.media.query({ type: 'image' }),
     30                                                multiple:        false,
     31                                                date:            false,
     32                                                suggestedWidth:  $el.data( 'size' ),
     33                                                suggestedHeight: $el.data( 'size' )
     34                                        })
     35                                ]
    3436                        });
    3537
    3638                        // When an image is selected, run a callback.
  • src/wp-admin/options-general.php

     
    146146        <img class="avatar avatar-150" src="<?php site_icon_url( null, 150 ); ?>" height="150" width="150" />
    147147        <p class="hide-if-no-js">
    148148                <label class="screen-reader-text" for="choose-from-library-link"><?php _e( 'Choose an image from your media library:' ); ?></label>
    149                 <button type="button" id="choose-from-library-link" class="button" data-update-link="<?php echo esc_attr( $update_url ); ?>" data-choose="<?php esc_attr_e( 'Choose a Site Icon' ); ?>" data-update="<?php esc_attr_e( 'Set as Site Icon' ); ?>"><?php _e( 'Update Site Icon' ); ?></button>
     149                <button type="button" id="choose-from-library-link" class="button" data-size="<?php echo absint( $GLOBALS['wp_site_icon']->min_size ); ?>" data-update-link="<?php echo esc_attr( $update_url ); ?>" data-choose="<?php esc_attr_e( 'Choose a Site Icon' ); ?>" data-update="<?php esc_attr_e( 'Set as Site Icon' ); ?>"><?php _e( 'Update Site Icon' ); ?></button>
    150150                <a href="<?php echo esc_url( $remove_url ); ?>"><?php _e( 'Remove Site Icon' ); ?></a>
    151151        </p>
    152152        <p class="hide-if-js">