This commit is contained in:
2025-08-01 14:29:50 +03:00
parent 2ab819ff30
commit b86b8ff923
54 changed files with 1512 additions and 672 deletions

View File

@@ -125,12 +125,4 @@ 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);
}
}

View File

@@ -23,6 +23,12 @@ class Html
return "<a href='$link' $paramsStr>";
}
public static function link(string $title, string $link, array $params = []): string
{
$paramsStr = self::createParams($params);
return "<a href='$link' $paramsStr>$title</a>";
}
/**
* @param array $data
* @return string

View File

@@ -24,7 +24,7 @@ class SMTP
/**
* @throws Exception
*/
public function send_html(array $params)
public function send_html(array $params): bool
{
if (!isset($params['address'])){
return false;
@@ -35,6 +35,6 @@ class SMTP
$body = $params['body'] ?? 'Нет информации';
$this->mail->msgHTML($body);
$this->mail->send();
return $this->mail->send();
}
}

View File

@@ -1,19 +0,0 @@
<?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, '?&');
}
}