Skip to content

Commit

Permalink
Drop $useRequestUrl param from App::url() method (#2107)
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek authored Sep 14, 2023
1 parent ae4f761 commit f1277b7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 15 deletions.
16 changes: 3 additions & 13 deletions src/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, string> $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);
Expand Down Expand Up @@ -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<string, string> $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);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}

/**
Expand All @@ -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());
}

/**
Expand Down

0 comments on commit f1277b7

Please sign in to comment.