set_url_scheme example

$dirname = trailingslashit( $dirname );
    }

    $upload_dir    = wp_get_upload_dir();
    $image_baseurl = trailingslashit( $upload_dir['baseurl'] ) . $dirname;

    /* * If currently on HTTPS, prefer HTTPS URLs when we know they're supported by the domain * (which is to say, when they share the domain name of the current request). */
    if ( is_ssl() && ! str_starts_with( $image_baseurl, 'https' ) && parse_url( $image_baseurl, PHP_URL_HOST ) === $_SERVER['HTTP_HOST'] ) {
        $image_baseurl = set_url_scheme( $image_baseurl, 'https' );
    }

    /* * Images that have been edited in WordPress after being uploaded will * contain a unique hash. Look for that hash and use it later to filter * out images that are leftovers from previous versions. */
    $image_edited = preg_match( '/-e[0-9]{13}/', wp_basename( $image_src )$image_edit_hash );

    /** * Filters the maximum image width to be included in a 'srcset' attribute. * * @since 4.4.0 * * @param int $max_width The maximum image width to be included in the 'srcset'. Default '2048'. * @param int[] $size_array { * An array of requested width and height values. * * @type int $0 The width in pixels. * @type int $1 The height in pixels. * } */


        $output = '<span class="displaying-num">' . sprintf(
            /* translators: %s: Number of items. */
            _n( '%s item', '%s items', $total_items ),
            number_format_i18n( $total_items )
        ) . '</span>';

        $current              = $this->get_pagenum();
        $removable_query_args = wp_removable_query_args();

        $current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );

        $current_url = remove_query_arg( $removable_query_args$current_url );

        $page_links = array();

        $total_pages_before = '<span class="paging-input">';
        $total_pages_after  = '</span></span>';

        $disable_first = false;
        $disable_last  = false;
        $disable_prev  = false;
        
if ( false === $response ) {
        // Include an unmodified $wp_version.         require ABSPATH . WPINC . '/version.php';

        $url     = 'http://api.wordpress.org/core/browse-happy/1.1/';
        $options = array(
            'body'       => array( 'useragent' => $_SERVER['HTTP_USER_AGENT'] ),
            'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url( '/' ),
        );

        if ( wp_http_supports( array( 'ssl' ) ) ) {
            $url = set_url_scheme( $url, 'https' );
        }

        $response = wp_remote_post( $url$options );

        if ( is_wp_error( $response ) || 200 !== wp_remote_retrieve_response_code( $response ) ) {
            return false;
        }

        /** * Response should be an array with: * 'platform' - string - A user-friendly platform name, if it can be determined * 'name' - string - A user-friendly browser name * 'version' - string - The version of the browser the user is using * 'current_version' - string - The most recent version of the browser * 'upgrade' - boolean - Whether the browser needs an upgrade * 'insecure' - boolean - Whether the browser is deemed insecure * 'update_url' - string - The url to visit to upgrade * 'img_src' - string - An image representing the browser * 'img_src_ssl' - string - An image (over SSL) representing the browser */
/* * If any of the above options failed, Fallback on the GUID as used pre-2.7, * not recommended to rely upon this. */
    if ( ! $url ) {
        $url = get_the_guid( $post->ID );
    }

    // On SSL front end, URLs should be HTTPS.     if ( is_ssl() && ! is_admin() && 'wp-login.php' !== $pagenow ) {
        $url = set_url_scheme( $url );
    }

    /** * Filters the attachment URL. * * @since 2.1.0 * * @param string $url URL for the given attachment. * @param int $attachment_id Attachment post ID. */
    $url = apply_filters( 'wp_get_attachment_url', $url$post->ID );

    
$active_parent_item_ids[] = (int) $menu_item->menu_item_parent;

            // If the menu item corresponds to the currently requested URL.         } elseif ( 'custom' === $menu_item->object && isset( $_SERVER['HTTP_HOST'] ) ) {
            $_root_relative_current = untrailingslashit( $_SERVER['REQUEST_URI'] );

            // If it's the customize page then it will strip the query var off the URL before entering the comparison block.             if ( is_customize_preview() ) {
                $_root_relative_current = strtok( untrailingslashit( $_SERVER['REQUEST_URI'] ), '?' );
            }

            $current_url        = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_root_relative_current );
            $raw_item_url       = strpos( $menu_item->url, '#' ) ? substr( $menu_item->url, 0, strpos( $menu_item->url, '#' ) ) : $menu_item->url;
            $item_url           = set_url_scheme( untrailingslashit( $raw_item_url ) );
            $_indexless_current = untrailingslashit( preg_replace( '/' . preg_quote( $wp_rewrite->index, '/' ) . '$/', '', $current_url ) );

            $matches = array(
                $current_url,
                urldecode( $current_url ),
                $_indexless_current,
                urldecode( $_indexless_current ),
                $_root_relative_current,
                urldecode( $_root_relative_current ),
            );
$theme->version     = wp_kses( $theme->version, $themes_allowedtags );
                $theme->description = wp_kses( $theme->description, $themes_allowedtags );
                $theme->stars       = wp_star_rating(
                    array(
                        'rating' => $theme->rating,
                        'type'   => 'percent',
                        'number' => $theme->num_ratings,
                        'echo'   => false,
                    )
                );
                $theme->num_ratings = number_format_i18n( $theme->num_ratings );
                $theme->preview_url = set_url_scheme( $theme->preview_url );

                // Handle themes that are already installed as installed themes.                 if ( in_array( $theme->slug, $installed_themes, true ) ) {
                    $theme->type = 'installed';
                } else {
                    $theme->type = $theme_action;
                }

                // Set active based on customized theme.                 $theme->active = ( isset( $_POST['customized_theme'] ) && $_POST['customized_theme'] === $theme->slug );

                

function url_is_accessable_via_ssl( $url ) {
    _deprecated_function( __FUNCTION__, '4.0.0' );

    $response = wp_remote_get( set_url_scheme( $url, 'https' ) );

    if ( !is_wp_error( $response ) ) {
        $status = wp_remote_retrieve_response_code( $response );
        if ( 200 == $status || 401 == $status ) {
            return true;
        }
    }

    return false;
}


function get_core_checksums( $version$locale ) {
    $http_url = 'http://api.wordpress.org/core/checksums/1.0/?' . http_build_query( compact( 'version', 'locale' ), '', '&' );
    $url      = $http_url;

    $ssl = wp_http_supports( array( 'ssl' ) );

    if ( $ssl ) {
        $url = set_url_scheme( $url, 'https' );
    }

    $options = array(
        'timeout' => wp_doing_cron() ? 30 : 3,
    );

    $response = wp_remote_get( $url$options );

    if ( $ssl && is_wp_error( $response ) ) {
        trigger_error(
            sprintf(
                
populate_options();
    populate_roles();

    // populate_roles() clears previous role definitions so we start over.     $wp_roles = new WP_Roles();

    $siteurl = $home = untrailingslashit( $url );

    if ( ! is_subdomain_install() ) {

        if ( 'https' === parse_url( get_site_option( 'siteurl' ), PHP_URL_SCHEME ) ) {
            $siteurl = set_url_scheme( $siteurl, 'https' );
        }
        if ( 'https' === parse_url( get_home_url( get_network()->site_id ), PHP_URL_SCHEME ) ) {
            $home = set_url_scheme( $home, 'https' );
        }
    }

    update_option( 'siteurl', $siteurl );
    update_option( 'home', $home );

    if ( get_site_option( 'ms_files_rewriting' ) ) {
        update_option( 'upload_path', UPLOADBLOGSDIR . "/$blog_id/files" );
    }


/** Make sure that the WordPress bootstrap has run before continuing. */
require __DIR__ . '/wp-load.php';

// Redirect to HTTPS login if forced to use SSL. if ( force_ssl_admin() && ! is_ssl() ) {
    if ( str_starts_with( $_SERVER['REQUEST_URI'], 'http' ) ) {
        wp_safe_redirect( set_url_scheme( $_SERVER['REQUEST_URI'], 'https' ) );
        exit;
    } else {
        wp_safe_redirect( 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
        exit;
    }
}

/** * Outputs the login page header. * * @since 2.1.0 * * @global string $error Login error message set by deprecated pluggable wp_login() function * or plugins replacing it. * @global bool|string $interim_login Whether interim login modal is being displayed. String 'success' * upon successful login. * @global string $action The action that brought the visitor to the login page. * * @param string $title Optional. WordPress login Page title to display in the `<title>` element. * Default 'Log In'. * @param string $message Optional. Message to display in header. Default empty. * @param WP_Error $wp_error Optional. The error to pass. Default is a WP_Error instance. */
if ( ! $popular_importers ) {
        $url     = add_query_arg(
            array(
                'locale'  => $locale,
                'version' => $wp_version,
            ),
            'http://api.wordpress.org/core/importers/1.1/'
        );
        $options = array( 'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url( '/' ) );

        if ( wp_http_supports( array( 'ssl' ) ) ) {
            $url = set_url_scheme( $url, 'https' );
        }

        $response          = wp_remote_get( $url$options );
        $popular_importers = json_decode( wp_remote_retrieve_body( $response ), true );

        if ( is_array( $popular_importers ) ) {
            set_site_transient( $cache_key$popular_importers, 2 * DAY_IN_SECONDS );
        } else {
            $popular_importers = false;
        }
    }

    
    if ( defined( 'WP_AUTO_UPDATE_CORE' )
        && in_array( WP_AUTO_UPDATE_CORE, array( 'beta', 'rc', 'development', 'branch-development' ), true )
    ) {
        $query['channel'] = WP_AUTO_UPDATE_CORE;
    }

    $url      = 'http://api.wordpress.org/core/version-check/1.7/?' . http_build_query( $query, '', '&' );
    $http_url = $url;
    $ssl      = wp_http_supports( array( 'ssl' ) );

    if ( $ssl ) {
        $url = set_url_scheme( $url, 'https' );
    }

    $doing_cron = wp_doing_cron();

    $options = array(
        'timeout'    => $doing_cron ? 30 : 3,
        'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url( '/' ),
        'headers'    => array(
            'wp_install' => $wp_install,
            'wp_blog'    => home_url( '/' ),
        ),
        
        if ( $this->admin_image_div_callback ) {
            call_user_func( $this->admin_image_div_callback );
        } else {
            $background_styles = '';
            $bgcolor           = get_background_color();
            if ( $bgcolor ) {
                $background_styles .= 'background-color: #' . $bgcolor . ';';
            }

            $background_image_thumb = get_background_image();
            if ( $background_image_thumb ) {
                $background_image_thumb = esc_url( set_url_scheme( get_theme_mod( 'background_image_thumb', str_replace( '%', '%%', $background_image_thumb ) ) ) );
                $background_position_x  = get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'default-position-x' ) );
                $background_position_y  = get_theme_mod( 'background_position_y', get_theme_support( 'custom-background', 'default-position-y' ) );
                $background_size        = get_theme_mod( 'background_size', get_theme_support( 'custom-background', 'default-size' ) );
                $background_repeat      = get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'default-repeat' ) );
                $background_attachment  = get_theme_mod( 'background_attachment', get_theme_support( 'custom-background', 'default-attachment' ) );

                // Background-image URL must be single quote, see below.                 $background_styles .= " background-image: url('$background_image_thumb');"
                . " background-size: $background_size;"
                . " background-position: $background_position_x $background_position_y;"
                . " background-repeat: $background_repeat;"
                .
$url = add_query_arg(
            array(
                'action'  => $action,
                'request' => $args,
            ),
            $url
        );

        $http_url = $url;
        $ssl      = wp_http_supports( array( 'ssl' ) );
        if ( $ssl ) {
            $url = set_url_scheme( $url, 'https' );
        }

        $http_args = array(
            'timeout'    => 15,
            'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url( '/' ),
        );
        $request   = wp_remote_get( $url$http_args );

        if ( $ssl && is_wp_error( $request ) ) {
            if ( ! wp_doing_ajax() ) {
                trigger_error(
                    
$loaded_langs[] = $name;
                                }
                            }
                        }

                        foreach ( $mce_external_plugins as $name => $url ) {
                            if ( in_array( $name$plugins, true ) ) {
                                unset( $mce_external_plugins[ $name ] );
                                continue;
                            }

                            $url                           = set_url_scheme( $url );
                            $mce_external_plugins[ $name ] = $url;
                            $plugurl                       = dirname( $url );
                            $strings                       = '';

                            // Try to load langs/[locale].js and langs/[locale]_dlg.js.                             if ( ! in_array( $name$loaded_langs, true ) ) {
                                $path = str_replace( content_url(), '', $plugurl );
                                $path = realpath( WP_CONTENT_DIR . $path . '/langs/' );

                                if ( ! $path ) {
                                    continue;
                                }
Home | Imprint | This part of the site doesn't use cookies.