Use set_url_scheme(). Props johnbillion, MarcusPope. see #19037 #20759

git-svn-id: http://core.svn.wordpress.org/trunk@21664 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Ryan Boren
2012-08-30 13:33:00 +00:00
parent e0835b5fc4
commit c55cf716da
14 changed files with 43 additions and 68 deletions

View File

@@ -358,7 +358,7 @@ function _wp_menu_item_classes_by_context( &$menu_items ) {
// if the menu item corresponds to the currently-requested URL
} elseif ( 'custom' == $menu_item->object ) {
$_root_relative_current = untrailingslashit( $_SERVER['REQUEST_URI'] );
$current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_root_relative_current;
$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 = untrailingslashit( $raw_item_url );
$_indexless_current = untrailingslashit( preg_replace( '/index.php$/', '', $current_url ) );