Skip to content

Commit

Permalink
Release version v3.1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
hungnguyenhp committed Apr 2, 2024
1 parent 3602ce6 commit 11cf133
Show file tree
Hide file tree
Showing 11 changed files with 1,192 additions and 1,194 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Simple, clean and lightweight library escape, security

- [x] V1.x, V2.x support all PHP version `>=5.6`
- [x] V3.x support all PHP version `>=7.0`
- [x] V4.x support all PHP version `>=8.0`

## Contact & Support

Expand All @@ -17,4 +18,4 @@ If any question & request, please contact following information
|-------------|----------------------|------------------|---------------|
| Hung Nguyen | [email protected] | nguyenanhung5891 | @nguyenanhung |

From Vietnam with Love <3
From Vietnam with Love <3
102 changes: 51 additions & 51 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,53 +1,53 @@
{
"name": "nguyenanhung/security",
"type": "library",
"description": "Wrapper for Security, Encrypt, Encode, Purifier",
"keywords": [
"security",
"encrypt",
"encode",
"decode"
],
"homepage": "https://github.com/nguyenanhung/security",
"license": "GPL-3.0",
"authors": [
{
"name": "Nguyen An Hung",
"email": "[email protected]",
"homepage": "https://nguyenanhung.com",
"role": "Developer"
}
],
"require": {
"php": ">=7.0",
"ext-openssl": "*",
"paragonie/sodium_compat": "^1.17",
"ircmaxell/password-compat": "^1.0",
"symfony/security-csrf": "^5.3 || ^4.4 || ^3.4",
"ezyang/htmlpurifier": "^4.13",
"phpseclib/phpseclib": "^3.0",
"phpseclib/mcrypt_compat": "^2.0",
"voku/anti-xss": "^4.0 || ^3.0",
"nguyenanhung/escape-helper": "^2.0",
"nguyenanhung/math-helper": "^2.0",
"nguyenanhung/htmlawed": "^1.2"
},
"require-dev": {
"kint-php/kint": ">=3.0"
},
"suggest": {
"ext-json": "Needed to support JSON",
"ext-mcrypt": "Needed to support mcrypt",
"ext-iconv": "Needed to support iconv",
"ext-openssl": "Needed to support openssl",
"ext-mbstring": "Needed to support mb_string"
},
"autoload": {
"psr-4": {
"nguyenanhung\\MySecurity\\": "src/"
},
"files": [
"helpers/helpers.php"
]
}
"name": "nguyenanhung/security",
"type": "library",
"description": "Wrapper for Security, Encrypt, Encode, Purifier",
"keywords": [
"security",
"encrypt",
"encode",
"decode"
],
"homepage": "https://github.com/nguyenanhung/security",
"license": "GPL-3.0",
"authors": [
{
"name": "Nguyen An Hung",
"email": "[email protected]",
"homepage": "https://nguyenanhung.com",
"role": "Developer"
}
],
"require": {
"php": ">=7.0",
"ext-openssl": "*",
"paragonie/sodium_compat": "^1.17",
"ircmaxell/password-compat": "^1.0",
"symfony/security-csrf": "^5.3 || ^4.4 || ^3.4",
"ezyang/htmlpurifier": "^4.13",
"phpseclib/phpseclib": "^3.0",
"phpseclib/mcrypt_compat": "^2.0",
"voku/anti-xss": "^4.0 || ^3.0",
"nguyenanhung/escape-helper": "^2.0",
"nguyenanhung/math-helper": "^2.0",
"nguyenanhung/htmlawed": "^1.2"
},
"require-dev": {
"kint-php/kint": ">=3.0"
},
"suggest": {
"ext-json": "Needed to support JSON",
"ext-mcrypt": "Needed to support mcrypt",
"ext-iconv": "Needed to support iconv",
"ext-openssl": "Needed to support openssl",
"ext-mbstring": "Needed to support mb_string"
},
"autoload": {
"psr-4": {
"nguyenanhung\\MySecurity\\": "src/"
},
"files": [
"helpers/helpers.php"
]
}
}
176 changes: 88 additions & 88 deletions helpers/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,102 +8,102 @@
* Time: 12:38
*/
if (!function_exists('xssValidation')) {
/**
* Function xssValidation
*
* @param $value
*
* @return bool
* @author : 713uk13m <[email protected]>
* @copyright: 713uk13m <[email protected]>
* @time : 30/07/2022 57:32
*/
function xssValidation($value): bool
{
return \nguyenanhung\MySecurity\Helper\Xss::xssValidation($value);
}
/**
* Function xssValidation
*
* @param $value
*
* @return bool
* @author : 713uk13m <[email protected]>
* @copyright: 713uk13m <[email protected]>
* @time : 30/07/2022 57:32
*/
function xssValidation($value): bool
{
return \nguyenanhung\MySecurity\Helper\Xss::xssValidation($value);
}
}
if (!function_exists('xss_validation')) {
/**
* Function xss_validation
*
* @param $value
*
* @return bool
* @author : 713uk13m <[email protected]>
* @copyright: 713uk13m <[email protected]>
* @time : 12/02/2023 08:05
*/
function xss_validation($value): bool
{
return \nguyenanhung\MySecurity\Helper\Xss::xss_validation($value);
}
/**
* Function xss_validation
*
* @param $value
*
* @return bool
* @author : 713uk13m <[email protected]>
* @copyright: 713uk13m <[email protected]>
* @time : 12/02/2023 08:05
*/
function xss_validation($value): bool
{
return \nguyenanhung\MySecurity\Helper\Xss::xss_validation($value);
}
}
if (!function_exists('_force_xss_clean_')) {
/**
* Function _force_xss_clean_
*
* @param $value
*
* @return mixed|string|string[]
* @author : 713uk13m <[email protected]>
* @copyright: 713uk13m <[email protected]>
* @time : 13/02/2023 11:23
*/
function _force_xss_clean_($value)
{
return (new \voku\helper\AntiXSS())->xss_clean($value);
}
/**
* Function _force_xss_clean_
*
* @param $value
*
* @return mixed|string|string[]
* @author : 713uk13m <[email protected]>
* @copyright: 713uk13m <[email protected]>
* @time : 13/02/2023 11:23
*/
function _force_xss_clean_($value)
{
return (new \voku\helper\AntiXSS())->xss_clean($value);
}
}
if (!function_exists('_forceXssClean_')) {
/**
* Function _forceXssClean_
*
* @param $value
*
* @return mixed|string|string[]
* @author : 713uk13m <[email protected]>
* @copyright: 713uk13m <[email protected]>
* @time : 13/02/2023 12:06
*/
function _forceXssClean_($value)
{
return (new \voku\helper\AntiXSS())->xss_clean($value);
}
/**
* Function _forceXssClean_
*
* @param $value
*
* @return mixed|string|string[]
* @author : 713uk13m <[email protected]>
* @copyright: 713uk13m <[email protected]>
* @time : 13/02/2023 12:06
*/
function _forceXssClean_($value)
{
return (new \voku\helper\AntiXSS())->xss_clean($value);
}
}
if (!function_exists('_xss_clean_')) {
/**
* Function _xss_clean_
*
* @param $value
* @param $is_image
*
* @return array|bool|string
* @throws \Exception
* @author : 713uk13m <[email protected]>
* @copyright: 713uk13m <[email protected]>
* @time : 13/02/2023 15:32
*/
function _xss_clean_($value, $is_image = false)
{
return \nguyenanhung\MySecurity\Helper\Xss::xss_clean($value, $is_image);
}
/**
* Function _xss_clean_
*
* @param $value
* @param $is_image
*
* @return array|bool|string
* @throws \Exception
* @author : 713uk13m <[email protected]>
* @copyright: 713uk13m <[email protected]>
* @time : 13/02/2023 15:32
*/
function _xss_clean_($value, $is_image = false)
{
return \nguyenanhung\MySecurity\Helper\Xss::xss_clean($value, $is_image);
}
}
if (!function_exists('_xssClean_')) {
/**
* Function _xssClean_
*
* @param $value
* @param $is_image
*
* @return array|bool|string
* @throws \Exception
* @author : 713uk13m <[email protected]>
* @copyright: 713uk13m <[email protected]>
* @time : 13/02/2023 15:22
*/
function _xssClean_($value, $is_image = false)
{
return \nguyenanhung\MySecurity\Helper\Xss::xss_clean($value, $is_image);
}
/**
* Function _xssClean_
*
* @param $value
* @param $is_image
*
* @return array|bool|string
* @throws \Exception
* @author : 713uk13m <[email protected]>
* @copyright: 713uk13m <[email protected]>
* @time : 13/02/2023 15:22
*/
function _xssClean_($value, $is_image = false)
{
return \nguyenanhung\MySecurity\Helper\Xss::xss_clean($value, $is_image);
}
}
46 changes: 23 additions & 23 deletions src/Encryption.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,28 +20,28 @@
*/
class Encryption implements ProjectInterface
{
use VersionTrait;
use VersionTrait;

/**
* Function createKey
*
* @param int $length
*
* @return string|bool
* @author : 713uk13m <[email protected]>
* @copyright: 713uk13m <[email protected]>
* @time : 09/24/2021 04:19
*/
public function createKey(int $length = 32)
{
try {
return random_bytes($length);
} catch (Exception $e) {
if (function_exists('log_message')) {
log_message('error', 'Error File: ' . $e->getFile() . ' - Line: ' . $e->getLine() . ' - Message: ' . $e->getMessage());
log_message('error', $e->getTraceAsString());
}
return false;
}
}
/**
* Function createKey
*
* @param int $length
*
* @return string|bool
* @author : 713uk13m <[email protected]>
* @copyright: 713uk13m <[email protected]>
* @time : 09/24/2021 04:19
*/
public function createKey(int $length = 32)
{
try {
return random_bytes($length);
} catch (Exception $e) {
if (function_exists('log_message')) {
log_message('error', 'Error File: ' . $e->getFile() . ' - Line: ' . $e->getLine() . ' - Message: ' . $e->getMessage());
log_message('error', $e->getTraceAsString());
}
return false;
}
}
}
Loading

0 comments on commit 11cf133

Please sign in to comment.