first
This commit is contained in:
@ -125,4 +125,12 @@ class Files
|
||||
}
|
||||
}
|
||||
|
||||
public static function isImageByExtension($filename): bool
|
||||
{
|
||||
$allowedExtensions = ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp'];
|
||||
$extension = strtolower(pathinfo($filename, PATHINFO_EXTENSION));
|
||||
|
||||
return in_array($extension, $allowedExtensions);
|
||||
}
|
||||
|
||||
}
|
19
kernel/helpers/Url.php
Normal file
19
kernel/helpers/Url.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace kernel\helpers;
|
||||
|
||||
class Url
|
||||
{
|
||||
|
||||
public static function get_base_url()
|
||||
{
|
||||
// Удаляем параметр page если он есть
|
||||
$currentUrl = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http")
|
||||
. "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
|
||||
// Удаляем параметр page если он есть
|
||||
$currentUrl = preg_replace('/([?&])page=[^&]*(&|$)/', '$1', $currentUrl);
|
||||
|
||||
return rtrim($currentUrl, '?&');
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user