Skip to content

Commit

Permalink
Merge pull request #10 from nguyenanhung/v2.x
Browse files Browse the repository at this point in the history
Release version 2.0.8
  • Loading branch information
nguyenanhung committed Sep 26, 2023
2 parents 98e7933 + 51b7a45 commit 4ea7f9d
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 25 deletions.
56 changes: 32 additions & 24 deletions helpers/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -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, '>=');
Expand All @@ -34,12 +34,12 @@ function is_php($version): bool
/**
* Function escapeHtml
*
* @author: 713uk13m <dev@nguyenanhung.com>
* @time : 2018-12-09 14:24
*
* @param mixed $string
*
* @return mixed
* @author: 713uk13m <dev@nguyenanhung.com>
* @time : 2018-12-09 14:24
*
*/
function escapeHtml($string)
{
Expand Down Expand Up @@ -74,12 +74,12 @@ function htmlEscape($string)
/**
* Function escapeHtmlAttr
*
* @author: 713uk13m <dev@nguyenanhung.com>
* @time : 2018-12-09 14:24
*
* @param mixed $string
*
* @return mixed
* @author: 713uk13m <dev@nguyenanhung.com>
* @time : 2018-12-09 14:24
*
*/
function escapeHtmlAttr($string)
{
Expand Down Expand Up @@ -114,12 +114,12 @@ function escapeHtmlAttribute($string)
/**
* Function escapeJs
*
* @author: 713uk13m <dev@nguyenanhung.com>
* @time : 2018-12-09 14:25
*
* @param mixed $string
*
* @return mixed
* @author: 713uk13m <dev@nguyenanhung.com>
* @time : 2018-12-09 14:25
*
*/
function escapeJs($string)
{
Expand Down Expand Up @@ -190,12 +190,12 @@ function escapeCss($string)
/**
* Function escapeUrl
*
* @author: 713uk13m <dev@nguyenanhung.com>
* @time : 2018-12-09 14:25
*
* @param mixed $string
*
* @return mixed
* @author: 713uk13m <dev@nguyenanhung.com>
* @time : 2018-12-09 14:25
*
*/
function escapeUrl($string)
{
Expand All @@ -214,7 +214,7 @@ function escapeUrl($string)
* between ascii characters, like Java\0script.
*
* @param mixed $str
* @param bool $urlEncoded
* @param bool $urlEncoded
*
* @return mixed
*/
Expand Down Expand Up @@ -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
*/
Expand Down Expand Up @@ -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
*/
Expand All @@ -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
{
Expand Down Expand Up @@ -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
*/
Expand All @@ -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
*/
Expand All @@ -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);
}
}

2 changes: 1 addition & 1 deletion src/Escape.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*/
class Escape
{
const VERSION = '2.0.6';
const VERSION = '2.0.8';

/**
* Character set
Expand Down

0 comments on commit 4ea7f9d

Please sign in to comment.