Contao\Input::preserveBasicEntities PHP Method

preserveBasicEntities() public static method

Preserve basic entities by replacing them with square brackets (e.g. & becomes [amp])
public static preserveBasicEntities ( mixed $varValue ) : mixed
$varValue mixed A string or array
return mixed The string or array with the converted entities
    public static function preserveBasicEntities($varValue)
    {
        if ($varValue === null || $varValue == '') {
            return $varValue;
        }
        // Recursively clean arrays
        if (is_array($varValue)) {
            foreach ($varValue as $k => $v) {
                $varValue[$k] = static::preserveBasicEntities($v);
            }
            return $varValue;
        }
        $varValue = str_replace(array('[&]', '&', '[<]', '<', '[>]', '>', '[ ]', ' ', '[­]', '­'), array('[&]', '[&]', '[lt]', '[lt]', '[gt]', '[gt]', '[nbsp]', '[nbsp]', '[-]', '[-]'), $varValue);
        return $varValue;
    }