diff --git a/helpers/helpers.php b/helpers/helpers.php index 2822323..afc2ceb 100644 --- a/helpers/helpers.php +++ b/helpers/helpers.php @@ -21,7 +21,7 @@ function is_php($version): bool { static $_is_php; - $version = (string) $version; + $version = (string)$version; if (!isset($_is_php[$version])) { $_is_php[$version] = version_compare(PHP_VERSION, $version, '>='); @@ -34,12 +34,12 @@ function is_php($version): bool /** * Function escapeHtml * - * @author: 713uk13m - * @time : 2018-12-09 14:24 - * * @param mixed $string * * @return mixed + * @author: 713uk13m + * @time : 2018-12-09 14:24 + * */ function escapeHtml($string) { @@ -74,12 +74,12 @@ function htmlEscape($string) /** * Function escapeHtmlAttr * - * @author: 713uk13m - * @time : 2018-12-09 14:24 - * * @param mixed $string * * @return mixed + * @author: 713uk13m + * @time : 2018-12-09 14:24 + * */ function escapeHtmlAttr($string) { @@ -114,12 +114,12 @@ function escapeHtmlAttribute($string) /** * Function escapeJs * - * @author: 713uk13m - * @time : 2018-12-09 14:25 - * * @param mixed $string * * @return mixed + * @author: 713uk13m + * @time : 2018-12-09 14:25 + * */ function escapeJs($string) { @@ -190,12 +190,12 @@ function escapeCss($string) /** * Function escapeUrl * - * @author: 713uk13m - * @time : 2018-12-09 14:25 - * * @param mixed $string * * @return mixed + * @author: 713uk13m + * @time : 2018-12-09 14:25 + * */ function escapeUrl($string) { @@ -214,7 +214,7 @@ function escapeUrl($string) * between ascii characters, like Java\0script. * * @param mixed $str - * @param bool $urlEncoded + * @param bool $urlEncoded * * @return mixed */ @@ -327,7 +327,7 @@ function escape_url($string) * between ascii characters, like Java\0script. * * @param mixed $str - * @param bool $urlEncoded + * @param bool $urlEncoded * * @return string */ @@ -359,8 +359,8 @@ function remove_invisible_characters($str, bool $urlEncoded = true): string * vulnerabilities along with a few other hacks I've * harvested from examining vulnerabilities in other programs. * - * @param string|string[] $str Input data - * @param bool $isImage Whether the input is an image + * @param string|string[] $str Input data + * @param bool $isImage Whether the input is an image * * @return array|bool|string|string[]|null */ @@ -373,13 +373,13 @@ function _xss_clean_($str, bool $isImage = false) /** * Hash encode a string * - * @todo Remove in version 3.1+. - * @deprecated 3.0.0 Use PHP's native hash() instead. - * * @param string $str * @param string $type = 'sha1' * * @return string + * @deprecated 3.0.0 Use PHP's native hash() instead. + * + * @todo Remove in version 3.1+. */ function do_hash(string $str, string $type = 'sha1'): string { @@ -442,8 +442,8 @@ function stripImageTags($str): string /** * Sanitize Filename * - * @param mixed $str Input file name - * @param bool $relative_path Whether to preserve paths + * @param mixed $str Input file name + * @param bool $relative_path Whether to preserve paths * * @return string */ @@ -456,8 +456,8 @@ function sanitize_filename($str, bool $relative_path = false): string /** * Sanitize Filename * - * @param mixed $str Input file name - * @param bool $relative_path Whether to preserve paths + * @param mixed $str Input file name + * @param bool $relative_path Whether to preserve paths * * @return string */ @@ -476,3 +476,11 @@ function bear_framework_basic_clean_str($str = ''): string return trim($str); } } +if (!function_exists('bear_framework_entity_decode')) { + function bear_framework_entity_decode($str = '', $charset = null): string + { + $es = new nguyenanhung\Libraries\Escape\Escape(); + return $es->entityDecode($str, $charset); + } +} + diff --git a/src/Escape.php b/src/Escape.php index c438dca..d060d96 100644 --- a/src/Escape.php +++ b/src/Escape.php @@ -22,7 +22,7 @@ */ class Escape { - const VERSION = '2.0.6'; + const VERSION = '2.0.8'; /** * Character set