Skip to content

Commit

Permalink
[UPD] rename addslaches to addSlashes
Browse files Browse the repository at this point in the history
  • Loading branch information
bim-g committed Sep 2, 2024
1 parent 31868cc commit 040d8ed
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
9 changes: 2 additions & 7 deletions src/Core/Escape.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,9 @@ public static function randomString(int $length = 8): string
* @param string $link
* @return string
*/
public static function addSlaches(string $link): string
public static function addSlashes(string $link): string
{
$sub_string = substr($link, 0, 1);
$new_link = substr($link, 1);
if ($sub_string == '/') {
$link = substr(self::addSlaches($new_link), 1);
}
return $link == '' ? $link : '/' . $link;
return "/" . trim($link,"/");
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Core/Http/Redirect.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ static function to($location = null)
exit();
} else {
$webroot = substr(WEB_ROOT, 0, -1);
$link = Escape::addSlaches($location);
$link = Escape::addSlashes($location);
$location = $link == '' ? WEB_ROOT : $webroot . $link;
header('Location:' . $location);
exit();
Expand Down

0 comments on commit 040d8ed

Please sign in to comment.