Added string manipulation back as a field building method, to insure JCB always works well accross shared server invironments. We did not remove the SimpleXMLElement method, but kept both options with a global selection option and internal error handeling. Resolved gh-197

This commit is contained in:
2018-03-18 06:28:54 +02:00
parent e715fa1614
commit 42ae72d97e
42 changed files with 15004 additions and 11887 deletions

View File

@ -1554,16 +1554,19 @@ abstract class ComponentbuilderHelper
}
/**
* get the localkey
* the basic localkey
**/
protected static $localkey = false;
/**
* get the localkey
**/
public static function getLocalKey()
{
if (!self::$localkey)
{
// get the main key
self::$localkey = md5(JComponentHelper::getParams('com_componentbuilder')->get('basic_key', 'localKey34fdWEkl'));
// get the basic key
self::$localkey = md5(self::getCryptKey('basic', 'localKey34fdWEkl'));
}
return self::$localkey;
}
@ -1636,8 +1639,18 @@ abstract class ComponentbuilderHelper
}
return false;
}
public static function getBetween($content,$start,$end)
/**
* get between
*
* @param string $content The content to search
* @param string $start The starting value
* @param string $end The ending value
*
* @return string On success / empty string on failure
*
*/
public static function getBetween($content, $start, $end)
{
$r = explode($start, $content);
if (isset($r[1]))
@ -1647,17 +1660,32 @@ abstract class ComponentbuilderHelper
}
return '';
}
public static function getAllBetween($content,$start,$end)
/**
* get all between
*
* @param string $content The content to search
* @param string $start The starting value
* @param string $end The ending value
*
* @return array On success
*
*/
public static function getAllBetween($content, $start, $end)
{
$buket = array();
// reset bucket
$bucket = array();
for ($i = 0; ; $i++)
{
// search for string
$found = self::getBetween($content,$start,$end);
if (self::checkString($found))
{
$buket[] = $found;
// add to bucket
$bucket[] = $found;
// build removal string
$remove = $start.$found.$end;
// remove from content
$content = str_replace($remove,'',$content);
}
else
@ -1670,9 +1698,10 @@ abstract class ComponentbuilderHelper
break;
}
}
return array_unique($buket);
// only return unique array of values
return array_unique($bucket);
}
public static function typeField($type,$option = 'default')
{
// list of default fields
@ -2494,6 +2523,7 @@ abstract class ComponentbuilderHelper
// return the object
return self::$CRYPT[$TYPE];
}
/**
* Load the Component xml manifest.
**/