mirror of
https://github.com/getgrav/grav.git
synced 2025-02-20 19:56:53 +01:00
Improved Utils::url() to support query strings
This commit is contained in:
parent
34fa50fcf0
commit
18d405d798
|
|
@ -4,7 +4,9 @@
|
|||
1. [](#new)
|
||||
* Added `Uri::method()` to get current HTTP method (GET/POST etc)
|
||||
* `FormatterInterface`: Added `getSupportedFileExtensions()` and `getDefaultFileExtension()` methods
|
||||
|
||||
1. [](#improved)
|
||||
* Improved `Utils::url()` to support query strings
|
||||
|
||||
# v1.5.0-rc.1
|
||||
## 07/31/2018
|
||||
|
||||
|
|
|
|||
|
|
@ -45,8 +45,15 @@ abstract class Utils
|
|||
/** @var UniformResourceLocator $locator */
|
||||
$locator = Grav::instance()['locator'];
|
||||
|
||||
// Get relative path to the resource (or false if not found).
|
||||
$resource = $locator->findResource($input, false);
|
||||
$parts = Uri::parseUrl($input);
|
||||
|
||||
$resource = $locator->findResource("{$parts['scheme']}://{$parts['host']}{$parts['path']}", false);
|
||||
|
||||
if (isset($parts['query'])) {
|
||||
$resource = $resource . '?' . $parts['query'];
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
$resource = $input;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user