WordPress.org

Make WordPress Core

Ticket #14837: custom-header-15606.diff

File custom-header-15606.diff, 2.1 KB (added by jorbin, 4 years ago)
  • wp-includes/theme.php

     
    14021402                add_action('wp_head', $header_callback); 
    14031403 
    14041404        add_theme_support( 'custom-header' ); 
     1405        add_theme_support( 'custom-header-uploads' ); 
    14051406 
    14061407        if ( ! is_admin() ) 
    14071408                return; 
  • wp-admin/custom-header.php

     
    456456        <?php } ?> 
    457457</td> 
    458458</tr> 
    459  
     459<?php if (  current_theme_supports( 'custom-header-uploads' ) ):  ?> 
    460460<tr valign="top"> 
    461461<th scope="row"><?php _e( 'Upload Image' ); ?></th> 
    462462<td> 
     
    473473        </form> 
    474474</td> 
    475475</tr> 
     476<?php endif; ?> 
    476477</tbody> 
    477478</table> 
    478479 
     
    483484<tr valign="top"> 
    484485<th scope="row"><?php _e( 'Default Images' ); ?></th> 
    485486<td> 
     487<?php if ( current_theme_supports( 'custom-header-uploads' )  ):  ?> 
    486488        <p><?php _e( 'If you don&lsquo;t want to upload your own image, you can use one of these cool headers.' ) ?></p> 
     489<?php else: ?> 
     490        <p><?php _e( 'You can use of these cool headers' ) ?> 
     491<?php endif; ?> 
    487492        <?php 
    488493                $this->show_default_header_selector(); 
    489494        ?> 
     
    568573         */ 
    569574        function step_2() { 
    570575                check_admin_referer('custom-header-upload', '_wpnonce-custom-header-upload'); 
     576                if ( ! current_theme_supports('custom-header-uploads') ): 
     577                        _e( 'You are not authorized to upload custom headers' ); 
     578                        return; 
     579                endif; 
     580                 
    571581                $overrides = array('test_form' => false); 
    572582                $file = wp_handle_upload($_FILES['import'], $overrides); 
    573583 
     
    647657         * @since 2.1.0 
    648658         */ 
    649659        function step_3() { 
    650                 check_admin_referer('custom-header-crop-image'); 
     660                check_admin_referer('custom-header-crop-image');         
     661                if ( ! current_theme_supports('custom-header-uploads') ): 
     662                        _e( 'You are not authorized to upload custom headers' ); 
     663                        return; 
     664                endif; 
    651665                if ( $_POST['oitar'] > 1 ) { 
    652666                        $_POST['x1'] = $_POST['x1'] * $_POST['oitar']; 
    653667                        $_POST['y1'] = $_POST['y1'] * $_POST['oitar'];