Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 23fea3e

Browse files
committed
2 parents 632527f + 5461eb8 commit 23fea3e

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

‎src/functions.php‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,23 @@
44

55
use Francerz\Http\Utils\UriHelper;
66

7-
if (!function_exists('\Francerz\Http\Utils\siteUrl')) {
7+
if (!function_exists(__NAMESPACE__ . '\siteUrl')) {
88
function siteUrl(?string $path = null, array $sapiVars = [], bool $cached = true)
99
{
1010
return UriHelper::getSiteUrl($path, $sapiVars, $cached);
1111
}
1212
}
1313

14-
if (!function_exists('\Francerz\Http\Utils\baseUrl')) {
14+
if (!function_exists(__NAMESPACE__ . '\baseUrl')) {
1515
function baseUrl(?string $path = null, array $sapiVars = [], bool $cached = true)
1616
{
1717
return UriHelper::getBaseUrl($path, $sapiVars, $cached);
1818
}
1919
}
20+
21+
if (!function_exists(__NAMESPACE__ . '\currentUrl')) {
22+
function currentUrl(array $sapiVars = [], bool $cached = true)
23+
{
24+
return UriHelper::getCurrentString($sapiVars, $cached);
25+
}
26+
}

‎src/utils/UriHelper.php‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ public static function getBaseUrl(?string $path = null, array $sapiVars = [], bo
224224
return static::getSiteUrl($path, $sapiVars, $cached);
225225
}
226226

227-
private static function getCurrentString(array $sapiVars = [], bool $cached = true)
227+
public static function getCurrentString(array $sapiVars = [], bool $cached = true)
228228
{
229229
static $uri;
230230
if ($cached && isset($uri)) {
@@ -276,8 +276,12 @@ private static function mapReplaceString(string $uri, array $replaces, bool $enc
276276
return $uri;
277277
}
278278

279-
public static function mapReplace(UriFactoryInterface $uriFactory, $uri, array $replaces, bool $encode_values = true): UriInterface
280-
{
279+
public static function mapReplace(
280+
UriFactoryInterface $uriFactory,
281+
$uri,
282+
array $replaces,
283+
bool $encode_values = true
284+
): UriInterface {
281285
$uriStr = $uri;
282286
if ($uri instanceof UriInterface) {
283287
$uriStr = (string) $uri;
@@ -326,7 +330,7 @@ public static function base64Encode(string $data)
326330
public static function base64Decode(string $base64, bool $strict = false)
327331
{
328332
return base64_decode(
329-
strtr($base64, '-_', '+/'),
333+
strtr($base64, '-_', '+/') .
330334
str_repeat('=', - strlen($base64) & 3),
331335
$strict
332336
);

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /