Make WordPress Core

Ticket #25449: 25449.2.diff

File 25449.2.diff, 1.8 KB (added by thomaswm, 9 years ago)

as suggested in comment 10

  • wp-includes/functions.php

     
    18461846 * @param string $time Optional. Time formatted in 'yyyy/mm'. Default null.
    18471847 * @param bool   $create_dir Optional. Whether to check and create the uploads directory. Default true (backwards compatible).
    18481848 * @param bool   $refresh_cache Optional. Whether to refresh the cache. Default false.
     1849 * @param string $scheme Optional. Scheme to give the upload url context. See set_url_scheme().
    18491850 * @return array See above for description.
    18501851 */
    1851 function wp_upload_dir( $time = null, $create_dir = true, $refresh_cache = false ) {
     1852function wp_upload_dir( $time = null, $create_dir = true, $refresh_cache = false, $scheme = null ) {
    18521853        static $cache = array();
    18531854
    18541855        $key = sprintf( '%d-%s', get_current_blog_id(), (string) $time );
     
    18561857        if ( $refresh_cache || empty( $cache[ $key ] ) ) {
    18571858                $cache[ $key ] = _wp_upload_dir( $time );
    18581859        }
     1860       
     1861        $uploads['url'] = set_url_scheme( $uploads['url'], $scheme );
     1862        $uploads['baseurl'] = set_url_scheme( $uploads['baseurl'], $scheme );
    18591863
    18601864        /**
    18611865         * Filter the uploads directory data.
  • wp-includes/media.php

     
    333333
    334334        list( $img_src, $width, $height ) = image_downsize($id, $size);
    335335        $hwstring = image_hwstring($width, $height);
     336       
     337        // Scheme of the image source URL should match frontend scheme
     338        $scheme = parse_url( get_option( 'home' ), PHP_URL_SCHEME );
     339        $img_src = set_url_scheme( $img_src, $scheme );
    336340
    337341        $title = $title ? 'title="' . esc_attr( $title ) . '" ' : '';
    338342