function twig_urlencode_filter in Translation template extractor 7.3
Same name and namespace in other branches
- 6.3 vendor/Twig/Extension/Core.php \twig_urlencode_filter()
URL encodes (RFC 3986) a string as a path segment or an array as a query string.
Parameters
string|array $url A URL or an array of query parameters:
Return value
string The URL encoded value
1 string reference to 'twig_urlencode_filter'
- Twig_Extension_Core::getFilters in vendor/
Twig/ Extension/ Core.php - Returns a list of filters to add to the existing list.
File
- vendor/
Twig/ Extension/ Core.php, line 611
Code
function twig_urlencode_filter($url) {
if (is_array($url)) {
if (defined('PHP_QUERY_RFC3986')) {
return http_build_query($url, '', '&', PHP_QUERY_RFC3986);
}
return http_build_query($url, '', '&');
}
return rawurlencode($url);
}