mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2026-01-06 11:43:50 +00:00
Add function escape_textarea
This commit is contained in:
@@ -2029,20 +2029,37 @@
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//escape user data
|
/**
|
||||||
function escape($string) {
|
* Escape the user data
|
||||||
if (is_string($string)) {
|
* <p>Escapes all characters which have HTML character entity
|
||||||
return htmlentities($string, ENT_QUOTES | ENT_HTML5, 'UTF-8');
|
* @param string $string the value to escape
|
||||||
} elseif (is_numeric($string)) {
|
* @return string
|
||||||
return $string;
|
* @link https://www.php.net/htmlentities
|
||||||
} else {
|
*/
|
||||||
$string = (array) $string;
|
function escape($string) {
|
||||||
if (isset($string[0])) {
|
if (is_string($string)) {
|
||||||
return htmlentities($string[0], ENT_QUOTES | ENT_HTML5, 'UTF-8');
|
return htmlentities($string, ENT_QUOTES | ENT_HTML5, 'UTF-8');
|
||||||
}
|
} elseif (is_numeric($string)) {
|
||||||
|
return $string;
|
||||||
|
} else {
|
||||||
|
$string = (array) $string;
|
||||||
|
if (isset($string[0])) {
|
||||||
|
return htmlentities($string[0], ENT_QUOTES | ENT_HTML5, 'UTF-8');
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Escape the user data for a textarea
|
||||||
|
* <p>Escapes & " ' < and > characters</p>
|
||||||
|
* @param string $string the value to escape
|
||||||
|
* @return string
|
||||||
|
* @link https://www.php.net/htmlspecialchars
|
||||||
|
*/
|
||||||
|
function escape_textarea($string) {
|
||||||
|
return htmlspecialchars($string, ENT_QUOTES, 'UTF-8');
|
||||||
|
}
|
||||||
|
|
||||||
//output pre-formatted array keys and values
|
//output pre-formatted array keys and values
|
||||||
if (!function_exists('view_array')) {
|
if (!function_exists('view_array')) {
|
||||||
|
|||||||
Reference in New Issue
Block a user