From f1277b792690a81478b884df1009a4297172007e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Thu, 14 Sep 2023 23:05:19 +0200 Subject: [PATCH] Drop $useRequestUrl param from App::url() method (#2107) --- src/App.php | 16 +++------------- src/View.php | 4 ++-- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/src/App.php b/src/App.php index a73f5ea08e..f7e2df42d6 100644 --- a/src/App.php +++ b/src/App.php @@ -653,21 +653,12 @@ public function stickyForget(string $name): void * Build a URL that application can use for loading HTML data. * * @param string|array<0|string, string|int|false> $page URL as string or array with page name as first element and other GET arguments - * @param bool $useRequestUrl Simply return $_SERVER['REQUEST_URI'] if needed * @param array $extraRequestUrlArgs additional URL arguments, deleting sticky can delete them */ - public function url($page = [], bool $useRequestUrl = false, array $extraRequestUrlArgs = []): string + public function url($page = [], array $extraRequestUrlArgs = []): string { $request = $this->getRequest(); - if ($useRequestUrl) { - $page = $request->getUri()->getPath(); - $query = $request->getUri()->getQuery(); - if ($query !== '') { - $page .= '?' . $query; - } - } - $pagePath = ''; if (is_string($page)) { $pageExploded = explode('?', $page, 2); @@ -723,15 +714,14 @@ public function url($page = [], bool $useRequestUrl = false, array $extraRequest * mechanism for NON-HTML response. * * @param string|array<0|string, string|int|false> $page URL as string or array with page name as first element and other GET arguments - * @param bool $useRequestUrl Simply return $_SERVER['REQUEST_URI'] if needed * @param array $extraRequestUrlArgs additional URL arguments, deleting sticky can delete them */ - public function jsUrl($page = [], bool $useRequestUrl = false, array $extraRequestUrlArgs = []): string + public function jsUrl($page = [], array $extraRequestUrlArgs = []): string { // append to the end but allow override $extraRequestUrlArgs = array_merge($extraRequestUrlArgs, ['__atk_json' => 1], $extraRequestUrlArgs); - return $this->url($page, $useRequestUrl, $extraRequestUrlArgs); + return $this->url($page, $extraRequestUrlArgs); } /** diff --git a/src/View.php b/src/View.php index b7503a13e6..7dec550373 100644 --- a/src/View.php +++ b/src/View.php @@ -480,7 +480,7 @@ public function removeAttr($name) */ public function url($page = []): string { - return $this->getApp()->url($page, false, $this->_getStickyArgs()); + return $this->getApp()->url($page, $this->_getStickyArgs()); } /** @@ -490,7 +490,7 @@ public function url($page = []): string */ public function jsUrl($page = []): string { - return $this->getApp()->jsUrl($page, false, $this->_getStickyArgs()); + return $this->getApp()->jsUrl($page, $this->_getStickyArgs()); } /**