protected function _encodeUrl($url)
    {
        $path = parse_url($url, PHP_URL_PATH);
        $parts = array_map('rawurldecode', explode('/', $path));
        $parts = array_map('rawurlencode', $parts);
        $encoded = implode('/', $parts);

        /** @var string $url */
        $url = h(str_replace($path, $encoded, $url));

        return $url;
    }
protected function _encodeUrl($url)
    {
        $path = parse_url($url, PHP_URL_PATH);
        $parts = array_map('rawurldecode', explode('/', $path));
        $parts = array_map('rawurlencode', $parts);
        $encoded = implode('/', $parts);

        /** @var string $url */
        $url = h(str_replace($path, $encoded, $url));

        return $url;
    }
protected function _encodeUrl ( $ url ) { $ path = parse_url ( $ url , PHP_URL_PATH ) ; $ parts = array_map ( 'rawurldecode' , explode ( '/' , $ path ) ) ; $ parts = array_map ( 'rawurlencode' , $ parts ) ; $ encoded = implode ( '/' , $ parts ) ; /** @var string $url */ $ url = h ( str_replace ( $ path , $ encoded , $ url ) ) ; return $ url ; }
Encodes a URL for use in HTML attributes.

@param string $url The URL to encode.
@return string The URL encoded for both URL & HTML contexts.
Encodes a URL for use in HTML attributes .