mirror of
https://github.com/chylex/Lightning-Tracker.git
synced 2025-08-16 20:31:43 +02:00
.github
.idea
build
dev
res
src
Configuration
Data
Database
Logging
Pages
Routing
Session
Update
Validation
.htaccess
bootstrap.php
index.php
install.php
update.php
utils.php
tests
.gitattributes
.gitignore
LICENSE
README.md
codecept.bat
codeception.yml
composer.json
composer.lock
27 lines
767 B
PHP
27 lines
767 B
PHP
<?php
|
|
declare(strict_types = 1);
|
|
|
|
function protect(string $text): string{
|
|
return htmlspecialchars($text, ENT_HTML5 | ENT_QUOTES | ENT_SUBSTITUTE);
|
|
}
|
|
|
|
function bind(PDOStatement $stmt, string $param, $value, int $type = PDO::PARAM_STR): void{
|
|
if (strpos($stmt->queryString, ':'.$param) !== false){
|
|
$stmt->bindValue($param, $value, $type);
|
|
}
|
|
}
|
|
|
|
function mb_str_starts_with(string $haystack, string $needle): bool{
|
|
return mb_substr($haystack, 0, mb_strlen($needle)) === $needle;
|
|
}
|
|
|
|
function mb_str_ends_with(string $haystack, string $needle): bool{
|
|
return mb_substr($haystack, -mb_strlen($needle)) === $needle;
|
|
}
|
|
|
|
function get_int(array $array, string $key): ?int{
|
|
return isset($array[$key]) && is_numeric($array[$key]) ? (int)$array[$key] : null;
|
|
}
|
|
|
|
?>
|