Skip to content

Commit

Permalink
bug fix and add some package for html encode
Browse files Browse the repository at this point in the history
  • Loading branch information
alishahidi committed Jul 5, 2022
1 parent 1a57ad4 commit 8b6fd78
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"gregwar/captcha": "^1.1",
"morilog/jalali": "^3.3",
"symfony/finder": "^6.0",
"symfony/filesystem": "^6.0"
"symfony/filesystem": "^6.0",
"ezyang/htmlpurifier": "^4.14"
}
}
25 changes: 25 additions & 0 deletions system/Helpers/Helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,15 @@ function oldEqualValue($oldName, $value)
}
}

if (!function_exists("oldOrEqualValue")) {
function oldOrEqualValue($oldName, $value, $mainValue)
{
if(isset($_SESSION["tmp_old"][$oldName]))
return $_SESSION["tmp_old"][$oldName] === $value ? true : false;
return $value === $mainValue ? true : false;
}
}

if (!function_exists("oldOr")) {
function oldOr($name, $value)
{
Expand Down Expand Up @@ -310,6 +319,22 @@ function d($value)
}
}

if (!function_exists("hp")) {
function hp($value)
{
$config = HTMLPurifier_Config::createDefault();
$purifier = new HTMLPurifier($config);
return $purifier->purify($value);
}
}

if (!function_exists("hpd")) {
function hpd($value)
{
d(hp($value));
}
}

if (!function_exists("setOr")) {
function setOr($issetValue, $replaceValue)
{
Expand Down

0 comments on commit 8b6fd78

Please sign in to comment.