This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Склонение слова после числа | |
* | |
* @param int|string $n - число | |
* @param array $after - массив слов в различных падежах, напр. ['товар', 'товара', 'товаров'] | |
* @param bool $showN - показывать число в начале | |
* @param string $wrapper - обернуть слово в контейнер | |
* @return string | |
*/ | |
function pluralForm(int|string $n, array $after, bool $showN = true, string $wrapper = 'span'): string |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function formatPhone($phone) { | |
$phone = trim($phone); | |
return preg_replace( | |
array( | |
'/[+]?([7|8])[-|\s]?\([-|\s]?(\d{3})[-|\s]?\)[-|\s]?(\d{3})[-|\s]?(\d{2})[-|\s]?(\d{2})/', | |
'/[+]?([7|8])[-|\s]?(\d{3})[-|\s]?(\d{3})[-|\s]?(\d{2})[-|\s]?(\d{2})/', | |
'/[+]?([7|8])[-|\s]?\([-|\s]?(\d{4})[-|\s]?\)[-|\s]?(\d{2})[-|\s]?(\d{2})[-|\s]?(\d{2})/', | |
'/[+]?([7|8])[-|\s]?(\d{4})[-|\s]?(\d{2})[-|\s]?(\d{2})[-|\s]?(\d{2})/', | |
'/[+]?([7|8])[-|\s]?\([-|\s]?(\d{4})[-|\s]?\)[-|\s]?(\d{3})[-|\s]?(\d{3})/', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#{"rootDirectory":"","phpVersion":"8.3","varnishCacheSettings":{"cacheLifetime":"604800","controller":"generic","excludes":["^\/bitrix\/admin\/"],"excludedParams":["__SID","noCache"]}} | |
server { | |
listen 80; | |
listen [::]:80; | |
listen 443 ssl http2; | |
listen [::]:443 ssl http2; | |
{{ssl_certificate_key}} | |
{{ssl_certificate}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (!function_exists('getallheaders')) { | |
function getallheaders(): array | |
{ | |
$headers = []; | |
foreach ($_SERVER as $name => $value) { | |
if (str_starts_with($name, 'HTTP_')) { | |
$headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value; | |
} | |
} | |
return $headers; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function send2Telegram($id, $msg, $token = '', $silent = false) { | |
$data = array( | |
'chat_id' => $id, | |
'text' => $msg, | |
'parse_mode' => 'html', | |
'disable_web_page_preview' => true, | |
'disable_notification' => $silent | |
); | |
if($token != '') { | |
$ch = curl_init('https://api.telegram.org/bot'.$token.'/sendMessage'); |