Fixed gh-324 that had a typo with the storing of the PHPx values. Improved the safeString helper method
This commit is contained in:
@ -2341,7 +2341,7 @@ class Get
|
||||
if ($this->validationRules[$validationRule] = ComponentbuilderHelper::getVar('validation_rule', $validationRule, 'name', 'php'))
|
||||
{
|
||||
// open and set the validation rule
|
||||
$this->validationRules[$validationRule] = $this->setDynamicValues(base64_decode($this->validationRules[$validationRule]));
|
||||
$this->validationRules[$validationRule] = $this->setPlaceholders($this->setDynamicValues(base64_decode($this->validationRules[$validationRule])), $this->placeholders);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -4957,7 +4957,7 @@ abstract class ComponentbuilderHelper
|
||||
*
|
||||
* @returns string on success
|
||||
**/
|
||||
public static function safeString($string, $type = 'L', $spacer = '_', $replaceNumbers = true)
|
||||
public static function safeString($string, $type = 'L', $spacer = '_', $replaceNumbers = true, $keepOnlyCharacters = true)
|
||||
{
|
||||
if ($replaceNumbers === true)
|
||||
{
|
||||
@ -4986,7 +4986,16 @@ abstract class ComponentbuilderHelper
|
||||
$string = trim($string);
|
||||
$string = preg_replace('/'.$spacer.'+/', ' ', $string);
|
||||
$string = preg_replace('/\s+/', ' ', $string);
|
||||
$string = preg_replace("/[^A-Za-z ]/", '', $string);
|
||||
// remove all and keep only characters
|
||||
if ($keepOnlyCharacters)
|
||||
{
|
||||
$string = preg_replace("/[^A-Za-z ]/", '', $string);
|
||||
}
|
||||
// keep both numbers and characters
|
||||
else
|
||||
{
|
||||
$string = preg_replace("/[^A-Za-z0-9 ]/", '', $string);
|
||||
}
|
||||
// select final adaptations
|
||||
if ($type === 'L' || $type === 'strtolower')
|
||||
{
|
||||
|
Reference in New Issue
Block a user