URL related functions got moved to a new UrlHelper component

Public

https://www.drupal.org/node/2079005
Description:
URL related functions like have moved to the UrlHelper component.

Specifically:
drupal_get_query_parameters
drupal_http_build_query
drupal_parse_url
drupal_encode_path
url_is_external
drupal_get_query_array
filter_xss_bad_protocol

</> CopyGet raw version
php
  1. // D7
  2.  
  3. drupal_get_query_parameters('foo=bar&bar=baz');
  4. drupal_http_build_query(array('foo' => 'bar', 'bar' => 'bar'));
  5. drupal_parse_url('http://localhost/test?foo=bar&bar=baz');
  6. drupal_encode_path('drupal');
  7. url_is_external('http://drupal.org');
  8. $query_array = drupal_get_query_array('foo=bar&bar=baz');
  9. filter_xss_bad_protocol('javascript://example.com?foo&bar');
  10.  
  11. // D8
  12.  
  13. use \Drupal\Component\Utility\UrlHelper;
  14.  
  15. UrlHelper::filterQueryParameters('foo=bar&bar=baz');
  16. UrlHelper::parse('http://localhost/test?foo=bar&bar=baz');
  17. UrlHelper::encodePath('drupal');
  18. UrlHelper::isExternal('http://drupal.org');
  19. parse_str('foo=bar&bar=baz', $query_array);
  20. UrlHelper::filterBadProtocol('javascript://example.com?foo&bar');