add common validation/filter library for text input fields

This commit is contained in:
ghost 2023-09-17 16:46:19 +03:00
parent 9407403d5d
commit 62679eb67f
3 changed files with 126 additions and 41 deletions

48
src/library/filter.php Normal file
View file

@ -0,0 +1,48 @@
<?php
class Filter
{
public static function magnetTitle(mixed $value) : string
{
$value = trim(
strip_tags(
html_entity_decode($value)
)
);
return (string) $value;
}
public static function magnetPreview(mixed $value) : string
{
$value = trim(
strip_tags(
html_entity_decode($value)
)
);
return (string) $value;
}
public static function magnetDescription(mixed $value) : string
{
$value = trim(
strip_tags(
html_entity_decode($value)
)
);
return (string) $value;
}
public static function magnetDn(mixed $value) : string
{
$value = trim(
strip_tags(
html_entity_decode($value)
)
);
return (string) $value;
}
}