diff --git a/core/includes/common.inc b/core/includes/common.inc index fb370b892348914f2d26b23a3522c2ae7d6119d1..6f866b2593ec935a3a3bcb79b7b2919ca0769c26 100644 --- a/core/includes/common.inc +++ b/core/includes/common.inc @@ -344,44 +344,6 @@ function drupal_get_feeds($delimiter = "\n") { * Functions to properly handle HTTP responses. */ -/** - * Processes a URL query parameter array to remove unwanted elements. - * - * @param $query - * (optional) An array to be processed. Defaults to \Drupal::request()->query - * parameters. - * @param $exclude - * (optional) A list of $query array keys to remove. Use "parent[child]" to - * exclude nested items. - * @param $parent - * Internal use only. Used to build the $query array key for nested items. - * - * @return - * An array containing query parameters, which can be used for url(). - * - * @deprecated in Drupal 8.x-dev, will be removed before Drupal 8.0. - * Use \Drupal\Component\Utility\UrlHelper::filterQueryParameters(). - */ -function drupal_get_query_parameters(array $query = NULL, array $exclude = array(), $parent = '') { - if (!isset($query)) { - $query = \Drupal::request()->query->all(); - } - return UrlHelper::filterQueryParameters($query, $exclude, $parent); -} - -/** - * Parses an array into a valid, rawurlencoded query string. - * - * @see drupal_get_query_parameters() - * @ingroup php_wrappers - * - * @deprecated in Drupal 8.x-dev, will be removed before Drupal 8.0. - * Use \Drupal\Component\Utility\UrlHelper::buildQuery(). - */ -function drupal_http_build_query(array $query, $parent = '') { - return UrlHelper::buildQuery($query, $parent); -} - /** * Prepares a 'destination' URL query parameter for use with url(). * @@ -848,23 +810,6 @@ function url($path = NULL, array $options = array()) { return $url; } -/** - * Returns TRUE if a path is external to Drupal (e.g. http://example.com). - * - * If a path cannot be assessed by Drupal's menu handler, then we must - * treat it as potentially insecure. - * - * @param $path - * The internal path or external URL being linked to, such as "node/34" or - * "http://example.com/foo". - * - * @return - * Boolean TRUE or FALSE, where TRUE indicates an external path. - */ -function url_is_external($path) { - return UrlHelper::isExternal($path); -} - /** * Formats an attribute string for an HTTP header. * diff --git a/core/includes/install.inc b/core/includes/install.inc index f08053329bbbc140177a9354d27da17081edebca..67e41f66225b8d8247f9c00424109b922c5875ce 100644 --- a/core/includes/install.inc +++ b/core/includes/install.inc @@ -907,7 +907,7 @@ function install_goto($path) { */ function drupal_current_script_url($query = array()) { $uri = $_SERVER['SCRIPT_NAME']; - $query = array_merge(drupal_get_query_parameters(), $query); + $query = array_merge(UrlHelper::filterQueryParameters(\Drupal::request()->query->all()), $query); if (!empty($query)) { $uri .= '?' . UrlHelper::buildQuery($query); } diff --git a/core/modules/system/lib/Drupal/system/Tests/Common/UrlTest.php b/core/modules/system/lib/Drupal/system/Tests/Common/UrlTest.php index f3db2461cfebf46007ef5666b072a3bd3aea5653..7cda6a3b11b98a7c8734b0296f73fbac7ff28ac3 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Common/UrlTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Common/UrlTest.php @@ -10,7 +10,6 @@ use Drupal\Component\Utility\UrlHelper; use Drupal\Core\Language\Language; use Drupal\simpletest\WebTestBase; -use Symfony\Component\HttpFoundation\Request; /** * Tests for URL generation functions. @@ -26,7 +25,7 @@ class UrlTest extends WebTestBase { public static function getInfo() { return array( 'name' => 'URL generation tests', - 'description' => 'Confirm that url(), drupal_get_query_parameters(), \Drupal\Component\Utility\UrlHelper::buildQuery(), and l() work correctly with various input.', + 'description' => 'Confirm that url(), \Drupal\Component\Utility\UrlHelper::filterQueryParameters(), \Drupal\Component\Utility\UrlHelper::buildQuery(), and l() work correctly with various input.', 'group' => 'Common', ); } @@ -184,7 +183,7 @@ private function hasAttribute($attribute, $link, $class) { } /** - * Tests drupal_get_query_parameters(). + * Tests UrlHelper::filterQueryParameters(). */ function testDrupalGetQueryParameters() { $original = array( @@ -201,22 +200,22 @@ function testDrupalGetQueryParameters() { // First-level exclusion. $result = $original; unset($result['b']); - $this->assertEqual(drupal_get_query_parameters($original, array('b')), $result, "'b' was removed."); + $this->assertEqual(UrlHelper::filterQueryParameters($original, array('b')), $result, "'b' was removed."); // Second-level exclusion. $result = $original; unset($result['b']['d']); - $this->assertEqual(drupal_get_query_parameters($original, array('b[d]')), $result, "'b[d]' was removed."); + $this->assertEqual(UrlHelper::filterQueryParameters($original, array('b[d]')), $result, "'b[d]' was removed."); // Third-level exclusion. $result = $original; unset($result['b']['e']['f']); - $this->assertEqual(drupal_get_query_parameters($original, array('b[e][f]')), $result, "'b[e][f]' was removed."); + $this->assertEqual(UrlHelper::filterQueryParameters($original, array('b[e][f]')), $result, "'b[e][f]' was removed."); // Multiple exclusions. $result = $original; unset($result['a'], $result['b']['e'], $result['c']); - $this->assertEqual(drupal_get_query_parameters($original, array('a', 'b[e]', 'c')), $result, "'a', 'b[e]', 'c' were removed."); + $this->assertEqual(UrlHelper::filterQueryParameters($original, array('a', 'b[e]', 'c')), $result, "'a', 'b[e]', 'c' were removed."); } /**