normalize_url_protocol_agnostic() public static method

Normalizes a url by doing three things: - Strips protocol - Strips www - Adds a trailing slash
Since: 4.4.0
public static normalize_url_protocol_agnostic ( string $url ) : WP_Error | string
$url string
return WP_Error | string
コード例 #1
0
    function get_start_fresh_action_explanation()
    {
        $html = wp_kses(sprintf(__('No. <a href="%1$s">%2$s</a> is a new and different website that\'s separate from 
					<a href="%3$s">%4$s</a>. It requires  a new connection to WordPress.com for new stats and subscribers.', 'jetpack'), esc_url(get_home_url()), self::prepare_url_for_display(get_home_url()), esc_url(self::$wpcom_home_url), untrailingslashit(Jetpack::normalize_url_protocol_agnostic(esc_url_raw(self::$wpcom_home_url)))), array('a' => array('href' => array())));
        /**
         * Allows overriding of the default text for explaining the start fresh action.
         *
         * @since 4.4.0
         *
         * @param string $html The HTML to be displayed
         */
        return apply_filters('jetpack_idc_start_fresh_explanation', $html);
    }
コード例 #2
0
 function test_normalize_url_protocol_agnostic_strips_protocol_for_ip()
 {
     $url = 'http://123.456.789.0';
     $url_normalized = Jetpack::normalize_url_protocol_agnostic($url);
     $this->assertTrue('123.456.789.0/' === $url_normalized);
     $url = '123.456.789.0';
     $url_normalized = Jetpack::normalize_url_protocol_agnostic($url);
     $this->assertTrue('123.456.789.0/' === $url_normalized);
 }