1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-09 16:26:59 +02:00

Fix issue processwire/processwire-issues#227 update Sanitizer::selectorValue() allow exclamation point "!" at beginning of selector value

This commit is contained in:
Ryan Cramer
2017-04-13 08:54:49 -04:00
parent fd2f14445c
commit b914586f6c

View File

@@ -1523,7 +1523,8 @@ class Sanitizer extends Wire {
} }
$value = trim($value); // trim any kind of whitespace $value = trim($value); // trim any kind of whitespace
$value = trim($value, '+!,'); // chars to remove from begin and end $value = trim($value, '+,'); // chars to remove from begin and end
if(strpos($value, '!') !== false) $needsQuotes = true;
if(!$needsQuotes && $options['useQuotes'] && strlen($value)) { if(!$needsQuotes && $options['useQuotes'] && strlen($value)) {
$a = substr($value, 0, 1); $a = substr($value, 0, 1);
@@ -1726,6 +1727,7 @@ class Sanitizer extends Wire {
* @param int|bool $flags See PHP html_entity_decode function for flags. * @param int|bool $flags See PHP html_entity_decode function for flags.
* @param string $encoding Encoding (default="UTF-8"). * @param string $encoding Encoding (default="UTF-8").
* @return string String with entities removed. * @return string String with entities removed.
* @see Sanitizer::entities()
* *
*/ */
public function unentities($str, $flags = ENT_QUOTES, $encoding = 'UTF-8') { public function unentities($str, $flags = ENT_QUOTES, $encoding = 'UTF-8') {
@@ -1810,6 +1812,8 @@ class Sanitizer extends Wire {
* Returns the same value type that it is given. If given something other than a string or array, it just * Returns the same value type that it is given. If given something other than a string or array, it just
* returns it without modification. * returns it without modification.
* *
* #pw-group-strings
*
* @param string|array $value String or array containing strings * @param string|array $value String or array containing strings
* @return string|array|mixed * @return string|array|mixed
* *