Make WordPress Core

Ticket #14867: 14867-protocol-args.diff

File 14867-protocol-args.diff, 3.3 KB (added by adambackstrom, 14 years ago)
  • wp-includes/ms-blogs.php

     
    3030 * @since MU
    3131 *
    3232 * @param int $blog_id Blog ID
     33 * @param bool $ssl true for https, false for http. null (default) for autodetect.
    3334 * @return string
    3435 */
    35 function get_blogaddress_by_id( $blog_id ) {
     36function get_blogaddress_by_id( $blog_id, $ssl = null ) {
     37        if ( !isset($ssl) ) {
     38                $ssl = is_ssl();
     39        }
     40        $protocol = $ssl ? ' https://' : ' http://';
     41
    3642        $bloginfo = get_blog_details( (int) $blog_id, false ); // only get bare details!
    37         return esc_url( 'http://' . $bloginfo->domain . $bloginfo->path );
     43        return esc_url( $protocol . $bloginfo->domain . $bloginfo->path );
    3844}
    3945
    4046/**
     
    6773 *
    6874 * @param string $domain
    6975 * @param string $path
     76 * @param bool $ssl true for https, false for http. null (default) for autodetect.
    7077 * @return string
    7178 */
    72 function get_blogaddress_by_domain( $domain, $path ) {
     79function get_blogaddress_by_domain( $domain, $path, $ssl = null ) {
     80        if ( !isset($ssl) ) {
     81                $ssl = is_ssl();
     82        }
     83
     84        $protocol = $ssl ? ' https://' : ' http://';
     85
    7386        if ( is_subdomain_install() ) {
    74                 $url = "http://".$domain.$path;
     87                $url = $protocol.$domain.$path;
    7588        } else {
    7689                if ( $domain != $_SERVER['HTTP_HOST'] ) {
    7790                        $blogname = substr( $domain, 0, strpos( $domain, '.' ) );
    78                         $url = 'http://' . substr( $domain, strpos( $domain, '.' ) + 1 ) . $path;
     91                        $url = $protocol . substr( $domain, strpos( $domain, '.' ) + 1 ) . $path;
    7992                        // we're not installing the main blog
    8093                        if ( $blogname != 'www.' )
    8194                                $url .= $blogname . '/';
    8295                } else { // main blog
    83                         $url = 'http://' . $domain . $path;
     96                        $url = $protocol . $domain . $path;
    8497                }
    8598        }
    8699        return esc_url( $url );
  • wp-admin/network/site-info.php

     
    3333        switch_to_blog( $id );
    3434
    3535        if ( isset( $_POST['update_home_url'] ) && $_POST['update_home_url'] == 'update' ) {
    36                 $blog_address = get_blogaddress_by_domain( $_POST['blog']['domain'], $_POST['blog']['path'] );
     36                $ssl = 'https' === $_POST['blog']['protocol'];
     37                $blog_address = get_blogaddress_by_domain( $_POST['blog']['domain'], $_POST['blog']['path'], $ssl );
    3738                if ( get_option( 'siteurl' ) != $blog_address )
    3839                        update_option( 'siteurl', $blog_address );
    3940
     
    104105                        if ( $is_main_site ) { ?>
    105106                        <td><code><?php echo $protocol; echo esc_attr( $details->domain ) ?></code></td>
    106107                        <?php } else { ?>
    107                         <td><?php echo $protocol; ?><input name="blog[domain]" type="text" id="domain" value="<?php echo esc_attr( $details->domain ) ?>" size="33" /></td>
     108                        <td><input name="blog[protocol]" type="radio" id="protocol" value="http" style="width: 20px;" <?php if ( 'http://' === $protocol ) echo 'checked="checked"'; ?>>http:// <input name="blog[protocol]" type="radio" id="protocol" value="https" style="width: 20px; margin-left: 20px;" <?php if ( 'https://' === $protocol ) echo 'checked="checked"'; ?>>https:// <input name="blog[domain]" type="text" id="domain" value="<?php echo esc_attr( $details->domain ) ?>" size="33" /></td>
    108109                        <?php } ?>
    109110                </tr>
    110111                <tr class="form-field form-required">