Ticket #15926: final.patch

File final.patch, 3.6 KB (added by firetag, 2 years ago)
  • wp-admin/custom-header.php

     
    168168                        return; 
    169169 
    170170                $this->updated = true; 
    171  
     171                check_admin_referer( 'custom-header-options', '_wpnonce-custom-header-options' ); 
    172172                if ( isset( $_POST['resetheader'] ) ) { 
    173                         check_admin_referer( 'custom-header-options', '_wpnonce-custom-header-options' ); 
    174173                        remove_theme_mod( 'header_image' ); 
    175174                        return; 
    176175                } 
    177176 
    178177                if ( isset( $_POST['resettext'] ) ) { 
    179                         check_admin_referer( 'custom-header-options', '_wpnonce-custom-header-options' ); 
    180178                        remove_theme_mod('header_textcolor'); 
    181179                        return; 
    182180                } 
    183181 
    184182                if ( isset( $_POST['removeheader'] ) ) { 
    185                         check_admin_referer( 'custom-header-options', '_wpnonce-custom-header-options' ); 
    186183                        set_theme_mod( 'header_image', '' ); 
    187184                        return; 
    188185                } 
    189186 
    190187                if ( isset( $_POST['text-color'] ) ) { 
    191                         check_admin_referer( 'custom-header-options', '_wpnonce-custom-header-options' ); 
    192188                        $_POST['text-color'] = str_replace( '#', '', $_POST['text-color'] ); 
    193189                        if ( 'blank' == $_POST['text-color'] ) { 
    194190                                set_theme_mod( 'header_textcolor', 'blank' ); 
     
    200196                } 
    201197 
    202198                if ( isset($_POST['default-header']) ) { 
    203                         check_admin_referer( 'custom-header-options', '_wpnonce-custom-header-options' ); 
    204199                        $this->process_default_headers(); 
    205200                        if ( isset($this->default_headers[$_POST['default-header']]) ) 
    206201                                set_theme_mod('header_image', esc_url($this->default_headers[$_POST['default-header']]['url'])); 
    207202                } 
     203 
     204                if ( isset($_POST['alt-text']) ) { 
     205                        set_theme_mod('header_alt', esc_html($_POST['alt-text'])); 
     206                } 
    208207        } 
    209208 
    210209        /** 
     
    498497 
    499498        if ( get_header_image() ) : ?> 
    500499<tr valign="top"> 
     500<th scope="row"><?php _e( 'Alternative Text' ); ?></th> 
     501<td> 
     502<fieldset> 
     503    <legend class="screen-reader-text"> 
     504        <span><?php _e( 'Alternative Text' ); ?></span> 
     505    </legend> 
     506    <input type="text" name="alt-text" id="alt-text" value="<?php header_alt() ?>" /> 
     507</fieldset></td> 
     508</tr> 
     509<tr valign="top"> 
    501510<th scope="row"><?php _e( 'Remove Image' ); ?></th> 
    502511<td> 
    503512        <p><?php _e( 'This will remove the header image. You will not be able to restore any customizations.' ) ?></p> 
  • wp-content/themes/twentyten/header.php

     
    7474                                                // Houston, we have a new header image! 
    7575                                                echo get_the_post_thumbnail( $post->ID ); 
    7676                                        elseif ( get_header_image() ) : ?> 
    77                                                 <img src="<?php header_image(); ?>" width="<?php echo HEADER_IMAGE_WIDTH; ?>" height="<?php echo HEADER_IMAGE_HEIGHT; ?>" alt="" /> 
     77                                <img src="<?php header_image(); ?>" width="<?php echo HEADER_IMAGE_WIDTH; ?>" height="<?php echo HEADER_IMAGE_HEIGHT; ?>" alt="<?php header_alt(); ?>" /> 
    7878                                        <?php endif; ?> 
    7979                        </div><!-- #branding --> 
    8080 
  • wp-includes/theme.php

     
    14201420} 
    14211421 
    14221422/** 
     1423 * Retrieve background image alt attribute for custom background. 
     1424 * 
     1425 * @uses HEADER_ALT 
     1426 * 
     1427 * @return string 
     1428 */ 
     1429function get_header_alt() { 
     1430        $default = defined('HEADER_ALT') ? HEADER_ALT : ''; 
     1431 
     1432        return get_theme_mod('header_alt', $default); 
     1433} 
     1434 
     1435/** 
     1436 * Display background image alt attribute. 
     1437 * 
     1438 * 
     1439 */ 
     1440function header_alt() { 
     1441        echo get_header_alt(); 
     1442} 
     1443 
     1444/** 
    14231445 * Retrieve header image for custom header. 
    14241446 * 
    14251447 * @since 2.1.0