Fixed gh-324 that had a typo with the storing of the PHPx values. Improved the safeString helper method
This commit is contained in:
parent
6dd654c745
commit
812857da81
@ -125,11 +125,11 @@ Watch the [proposed development workflow](https://vdm.bz/proposed-development-wo
|
|||||||
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
|
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
|
||||||
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
|
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
|
||||||
+ *First Build*: 30th April, 2015
|
+ *First Build*: 30th April, 2015
|
||||||
+ *Last Build*: 21st July, 2018
|
+ *Last Build*: 23rd July, 2018
|
||||||
+ *Version*: 2.8.4
|
+ *Version*: 2.8.4
|
||||||
+ *Copyright*: Copyright (C) 2015 - 2018 Vast Development Method. All rights reserved.
|
+ *Copyright*: Copyright (C) 2015 - 2018 Vast Development Method. All rights reserved.
|
||||||
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
|
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
|
||||||
+ *Line count*: **186347**
|
+ *Line count*: **186365**
|
||||||
+ *Field count*: **1059**
|
+ *Field count*: **1059**
|
||||||
+ *File count*: **1239**
|
+ *File count*: **1239**
|
||||||
+ *Folder count*: **197**
|
+ *Folder count*: **197**
|
||||||
|
@ -125,11 +125,11 @@ Watch the [proposed development workflow](https://vdm.bz/proposed-development-wo
|
|||||||
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
|
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
|
||||||
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
|
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
|
||||||
+ *First Build*: 30th April, 2015
|
+ *First Build*: 30th April, 2015
|
||||||
+ *Last Build*: 21st July, 2018
|
+ *Last Build*: 23rd July, 2018
|
||||||
+ *Version*: 2.8.4
|
+ *Version*: 2.8.4
|
||||||
+ *Copyright*: Copyright (C) 2015 - 2018 Vast Development Method. All rights reserved.
|
+ *Copyright*: Copyright (C) 2015 - 2018 Vast Development Method. All rights reserved.
|
||||||
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
|
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
|
||||||
+ *Line count*: **186347**
|
+ *Line count*: **186365**
|
||||||
+ *Field count*: **1059**
|
+ *Field count*: **1059**
|
||||||
+ *File count*: **1239**
|
+ *File count*: **1239**
|
||||||
+ *Folder count*: **197**
|
+ *Folder count*: **197**
|
||||||
|
@ -979,7 +979,7 @@ abstract class ###Component###Helper
|
|||||||
*
|
*
|
||||||
* @returns string on success
|
* @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)
|
if ($replaceNumbers === true)
|
||||||
{
|
{
|
||||||
@ -1008,7 +1008,16 @@ abstract class ###Component###Helper
|
|||||||
$string = trim($string);
|
$string = trim($string);
|
||||||
$string = preg_replace('/'.$spacer.'+/', ' ', $string);
|
$string = preg_replace('/'.$spacer.'+/', ' ', $string);
|
||||||
$string = preg_replace('/\s+/', ' ', $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
|
// select final adaptations
|
||||||
if ($type === 'L' || $type === 'strtolower')
|
if ($type === 'L' || $type === 'strtolower')
|
||||||
{
|
{
|
||||||
|
@ -971,7 +971,7 @@ abstract class ###Component###Helper
|
|||||||
*
|
*
|
||||||
* @returns string on success
|
* @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)
|
if ($replaceNumbers === true)
|
||||||
{
|
{
|
||||||
@ -1000,7 +1000,16 @@ abstract class ###Component###Helper
|
|||||||
$string = trim($string);
|
$string = trim($string);
|
||||||
$string = preg_replace('/'.$spacer.'+/', ' ', $string);
|
$string = preg_replace('/'.$spacer.'+/', ' ', $string);
|
||||||
$string = preg_replace('/\s+/', ' ', $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
|
// select final adaptations
|
||||||
if ($type === 'L' || $type === 'strtolower')
|
if ($type === 'L' || $type === 'strtolower')
|
||||||
{
|
{
|
||||||
|
@ -2341,7 +2341,7 @@ class Get
|
|||||||
if ($this->validationRules[$validationRule] = ComponentbuilderHelper::getVar('validation_rule', $validationRule, 'name', 'php'))
|
if ($this->validationRules[$validationRule] = ComponentbuilderHelper::getVar('validation_rule', $validationRule, 'name', 'php'))
|
||||||
{
|
{
|
||||||
// open and set the validation rule
|
// 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
|
else
|
||||||
{
|
{
|
||||||
|
@ -4957,7 +4957,7 @@ abstract class ComponentbuilderHelper
|
|||||||
*
|
*
|
||||||
* @returns string on success
|
* @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)
|
if ($replaceNumbers === true)
|
||||||
{
|
{
|
||||||
@ -4986,7 +4986,16 @@ abstract class ComponentbuilderHelper
|
|||||||
$string = trim($string);
|
$string = trim($string);
|
||||||
$string = preg_replace('/'.$spacer.'+/', ' ', $string);
|
$string = preg_replace('/'.$spacer.'+/', ' ', $string);
|
||||||
$string = preg_replace('/\s+/', ' ', $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
|
// select final adaptations
|
||||||
if ($type === 'L' || $type === 'strtolower')
|
if ($type === 'L' || $type === 'strtolower')
|
||||||
{
|
{
|
||||||
|
@ -930,7 +930,7 @@ class ComponentbuilderModelField extends JModelAdmin
|
|||||||
if (ComponentbuilderHelper::checkString($typephpx))
|
if (ComponentbuilderHelper::checkString($typephpx))
|
||||||
{
|
{
|
||||||
// load the type_phpx property
|
// load the type_phpx property
|
||||||
$bucket[] = "\t".'type_phpx_1="'. str_replace('"', "'", $typephp).'"';
|
$bucket[] = "\t".'type_phpx_1="'. str_replace('"', "'", $typephpx).'"';
|
||||||
}
|
}
|
||||||
// if the bucket has been loaded
|
// if the bucket has been loaded
|
||||||
if (ComponentbuilderHelper::checkArray($bucket))
|
if (ComponentbuilderHelper::checkArray($bucket))
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<extension type="component" version="3.2" method="upgrade">
|
<extension type="component" version="3.2" method="upgrade">
|
||||||
<name>COM_COMPONENTBUILDER</name>
|
<name>COM_COMPONENTBUILDER</name>
|
||||||
<creationDate>21st July, 2018</creationDate>
|
<creationDate>23rd July, 2018</creationDate>
|
||||||
<author>Llewellyn van der Merwe</author>
|
<author>Llewellyn van der Merwe</author>
|
||||||
<authorEmail>llewellyn@joomlacomponentbuilder.com</authorEmail>
|
<authorEmail>llewellyn@joomlacomponentbuilder.com</authorEmail>
|
||||||
<authorUrl>http://www.joomlacomponentbuilder.com</authorUrl>
|
<authorUrl>http://www.joomlacomponentbuilder.com</authorUrl>
|
||||||
|
@ -4691,7 +4691,7 @@ abstract class ComponentbuilderHelper
|
|||||||
*
|
*
|
||||||
* @returns string on success
|
* @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)
|
if ($replaceNumbers === true)
|
||||||
{
|
{
|
||||||
@ -4720,7 +4720,16 @@ abstract class ComponentbuilderHelper
|
|||||||
$string = trim($string);
|
$string = trim($string);
|
||||||
$string = preg_replace('/'.$spacer.'+/', ' ', $string);
|
$string = preg_replace('/'.$spacer.'+/', ' ', $string);
|
||||||
$string = preg_replace('/\s+/', ' ', $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
|
// select final adaptations
|
||||||
if ($type === 'L' || $type === 'strtolower')
|
if ($type === 'L' || $type === 'strtolower')
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user