Added function for safe html symbols tag
This commit is contained in:
parent
bfaf8a8794
commit
a9a1a7ccb8
|
@ -593,22 +593,25 @@ function io_output_password($password)
|
|||
|
||||
|
||||
/**
|
||||
* Prevents html tags if exists
|
||||
* Clean html tags symbols for prevent use JS
|
||||
*
|
||||
* @param string $string String for safe.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function io_safe_html_tags(string $string)
|
||||
{
|
||||
$init = strpos($string, '<');
|
||||
$output = '';
|
||||
|
||||
if ($init !== false) {
|
||||
// Must have safe output for work properly.
|
||||
$string = io_safe_output($string);
|
||||
if (strpos($string, '<') !== false && strpos($string, '>') !== false) {
|
||||
$output = strstr($string, '<', true);
|
||||
$tmpOutput = strstr($string, '<');
|
||||
$output .= strstr(substr($tmpOutput, 1), '>', true);
|
||||
$tmpOutput = strstr($string, '>');
|
||||
$output .= substr($tmpOutput, 1);
|
||||
$init = strpos($output, '<');
|
||||
if ($init !== false) {
|
||||
$output .= io_safe_html_tags($output);
|
||||
// If the string still contains tags symbols.
|
||||
if (strpos($string, '<') !== false && strpos($string, '>') !== false) {
|
||||
$output = io_safe_html_tags($output);
|
||||
}
|
||||
} else {
|
||||
$output = $string;
|
||||
|
|
Loading…
Reference in New Issue