From 5548431c8874bc1887f40a3dbe186fd416ef4084 Mon Sep 17 00:00:00 2001 From: Nathaniel Catchpole <catch@35733.no-reply.drupal.org> Date: Wed, 23 Apr 2014 12:52:13 +0100 Subject: [PATCH] Issue #2204157 by pjonckiere, sun, Alumei: Remove deprecated URL helper functions from common.inc. --- core/includes/common.inc | 108 ----------------------- core/tests/Drupal/Tests/Core/UrlTest.php | 1 - 2 files changed, 109 deletions(-) diff --git a/core/includes/common.inc b/core/includes/common.inc index 107e51592b12..ace37c830f01 100644 --- a/core/includes/common.inc +++ b/core/includes/common.inc @@ -420,91 +420,6 @@ function drupal_get_destination() { return $destination; } -/** - * Parses a system URL string into an associative array suitable for url(). - * - * This function should only be used for URLs that have been generated by the - * system, such as via url(). It should not be used for URLs that come from - * external sources, or URLs that link to external resources. - * - * The returned array contains a 'path' that may be passed separately to url(). - * For example: - * @code - * $options = drupal_parse_url(\Drupal::request()->query->get('destination')); - * $my_url = url($options['path'], $options); - * $my_link = l('Example link', $options['path'], $options); - * @endcode - * - * This is required, because url() does not support relative URLs containing a - * query string or fragment in its $path argument. Instead, any query string - * needs to be parsed into an associative query parameter array in - * $options['query'] and the fragment into $options['fragment']. - * - * @param $url - * The URL string to parse. - * - * @return - * An associative array containing the keys: - * - 'path': The path of the URL. If the given $url is external, this includes - * the scheme and host. - * - 'query': An array of query parameters of $url, if existent. - * - 'fragment': The fragment of $url, if existent. - * - * @see url() - * @ingroup php_wrappers - * - * @deprecated in Drupal 8.x-dev, will be removed before Drupal 8.0. - * Use \Drupal\Component\Utility\UrlHelper::parse(). - */ -function drupal_parse_url($url) { - return UrlHelper::parse($url); -} - -/** - * Encodes a Drupal path for use in a URL. - * - * For aesthetic reasons slashes are not escaped. - * - * Note that url() takes care of calling this function, so a path passed to that - * function should not be encoded in advance. - * - * @param $path - * The Drupal path to encode. - * - * @deprecated in Drupal 8.x-dev, will be removed before Drupal 8.0. - * Use \Drupal\Component\Utility\UrlHelper::encodePath(). - */ -function drupal_encode_path($path) { - return UrlHelper::encodePath($path); -} - -/** - * Determines if an external URL points to this Drupal installation. - * - * @param $url - * A string containing an external URL, such as "http://example.com/foo". - * - * @return - * TRUE if the URL has the same domain and base path. - * - * @deprecated in Drupal 8.x-dev, will be removed before Drupal 8.0. - * Use \Drupal\Component\Utility\UrlHelper::externalIsLocal(). - */ -function _external_url_is_local($url) { - return UrlHelper::externalIsLocal($url, base_path()); -} - -/** - * Helper function for determining hosts excluded from needing a proxy. - * - * @return - * TRUE if a proxy should be used for this host. - */ -function _drupal_http_use_proxy($host) { - $proxy_exceptions = Settings::get('proxy_exceptions', array('localhost', '127.0.0.1')); - return !in_array(strtolower($host), $proxy_exceptions, TRUE); -} - /** * @} End of "defgroup http_handling". */ @@ -531,29 +446,6 @@ function valid_email_address($mail) { return (bool)filter_var($mail, FILTER_VALIDATE_EMAIL); } -/** - * Verifies the syntax of the given URL. - * - * This function should only be used on actual URLs. It should not be used for - * Drupal menu paths, which can contain arbitrary characters. - * Valid values per RFC 3986. - * @param $url - * The URL to verify. - * @param $absolute - * Whether the URL is absolute (beginning with a scheme such as "http:"). - * - * @return - * TRUE if the URL is in a valid format. - * - * @see \Drupal\Component\Utility\UrlHelper::isValid() - * - * @deprecated in Drupal 8.x-dev, will be removed before Drupal 8.0. - * Use \Drupal\Component\Utility\UrlHelper::isValid(). - */ -function valid_url($url, $absolute = FALSE) { - return UrlHelper::isValid($url, $absolute); -} - /** * @} End of "defgroup validation". */ diff --git a/core/tests/Drupal/Tests/Core/UrlTest.php b/core/tests/Drupal/Tests/Core/UrlTest.php index 29d97219c6b7..83e4c740a95e 100644 --- a/core/tests/Drupal/Tests/Core/UrlTest.php +++ b/core/tests/Drupal/Tests/Core/UrlTest.php @@ -7,7 +7,6 @@ namespace Drupal\Tests\Core; -use Drupal\Component\Utility\UrlHelper; use Drupal\Core\DependencyInjection\ContainerBuilder; use Drupal\Core\Url; use Drupal\Tests\UnitTestCase; -- GitLab