Make WordPress Core

Ticket #38557: 38557.diff

File 38557.diff, 4.3 KB (added by bradyvercher, 8 years ago)
  • src/wp-admin/custom-header.php

     
    246246                }
    247247
    248248                $this->default_headers = $_wp_default_headers;
    249                 $template_directory_uri = get_template_directory_uri();
    250                 $stylesheet_directory_uri = get_stylesheet_directory_uri();
    251                 foreach ( array_keys($this->default_headers) as $header ) {
    252                         $this->default_headers[$header]['url'] =  sprintf( $this->default_headers[$header]['url'], $template_directory_uri, $stylesheet_directory_uri );
    253                         $this->default_headers[$header]['thumbnail_url'] =  sprintf( $this->default_headers[$header]['thumbnail_url'], $template_directory_uri, $stylesheet_directory_uri );
    254                 }
    255249        }
    256250
    257251        /**
     
    10801074                        $this->remove_header_image();
    10811075                        return;
    10821076                }
    1083                 $default = sprintf( $default, get_template_directory_uri(), get_stylesheet_directory_uri() );
    10841077
    10851078                $default_data = array();
    10861079                foreach ( $this->default_headers as $header => $details ) {
     
    13331326                        return $this->default_headers; // easy peasy.
    13341327                }
    13351328
    1336                 $default = sprintf( $default, get_template_directory_uri(), get_stylesheet_directory_uri() );
    13371329                $already_has_default = false;
    13381330
    13391331                foreach ( $this->default_headers as $k => $h ) {
  • src/wp-includes/class-wp-customize-manager.php

     
    34353435                ) );
    34363436
    34373437                $this->add_setting( new WP_Customize_Filter_Setting( $this, 'header_image', array(
    3438                         'default'        => get_theme_support( 'custom-header', 'default-image' ),
     3438                        'default'        => sprintf( get_theme_support( 'custom-header', 'default-image' ), get_template_directory_uri(), get_stylesheet_directory_uri() ),
    34393439                        'theme_supports' => 'custom-header',
    34403440                ) ) );
    34413441
  • src/wp-includes/theme.php

     
    11281128                        return new stdClass;
    11291129
    11301130                $_wp_random_header = (object) $headers[ array_rand( $headers ) ];
    1131 
    1132                 $_wp_random_header->url =  sprintf( $_wp_random_header->url, get_template_directory_uri(), get_stylesheet_directory_uri() );
    1133                 $_wp_random_header->thumbnail_url =  sprintf( $_wp_random_header->thumbnail_url, get_template_directory_uri(), get_stylesheet_directory_uri() );
    11341131        }
    11351132        return $_wp_random_header;
    11361133}
     
    12421239        } else {
    12431240                $data = get_theme_mod( 'header_image_data' );
    12441241                if ( ! $data && current_theme_supports( 'custom-header', 'default-image' ) ) {
    1245                         $directory_args = array( get_template_directory_uri(), get_stylesheet_directory_uri() );
    12461242                        $data = array();
    1247                         $data['url'] = $data['thumbnail_url'] = vsprintf( get_theme_support( 'custom-header', 'default-image' ), $directory_args );
     1243                        $data['url'] = $data['thumbnail_url'] = get_theme_support( 'custom-header', 'default-image' );
    12481244                        if ( ! empty( $_wp_default_headers ) ) {
    12491245                                foreach ( (array) $_wp_default_headers as $default_header ) {
    1250                                         $url = vsprintf( $default_header['url'], $directory_args );
    1251                                         if ( $data['url'] == $url ) {
     1246                                        if ( $data['url'] == $default_header['url'] ) {
    12521247                                                $data = $default_header;
    1253                                                 $data['url'] = $url;
    1254                                                 $data['thumbnail_url'] = vsprintf( $data['thumbnail_url'], $directory_args );
    12551248                                                break;
    12561249                                        }
    12571250                                }
     
    12811274function register_default_headers( $headers ) {
    12821275        global $_wp_default_headers;
    12831276
     1277        $directory_args = array( get_template_directory_uri(), get_stylesheet_directory_uri() );
     1278
     1279        foreach ( (array) $headers as $key => $header ) {
     1280                if ( isset( $header['url'] ) ) {
     1281                        $headers[ $key ]['url'] = vsprintf( $header['url'], $directory_args );
     1282                }
     1283
     1284                if ( isset( $header['thumbnail_url'] ) ) {
     1285                        $headers[ $key ]['thumbnail_url'] = vsprintf( $header['thumbnail_url'], $directory_args );
     1286                }
     1287        }
     1288
    12841289        $_wp_default_headers = array_merge( (array) $_wp_default_headers, (array) $headers );
    12851290}
    12861291
     
    20942099                                        $args[0]['flex-height'] = true;
    20952100                        }
    20962101
     2102                        $args[0]['default-image'] = sprintf( $args[0]['default-image'], get_template_directory_uri(), get_stylesheet_directory_uri() );
     2103
    20972104                        break;
    20982105
    20992106                case 'custom-background' :