Made some changes to insure JCB is stable in PHP7, removed the related translations string from joomla_component view to speed up page load.

This commit is contained in:
2018-03-12 00:36:14 +02:00
parent eb56fd3b48
commit e715fa1614
76 changed files with 3297 additions and 3407 deletions

View File

@ -2502,12 +2502,12 @@ abstract class ComponentbuilderHelper
$manifestUrl = JPATH_ADMINISTRATOR."/components/com_componentbuilder/componentbuilder.xml";
return simplexml_load_file($manifestUrl);
}
/**
* Joomla version object
**/
protected static $JVersion;
/**
* set/get Joomla version
**/
@ -3391,7 +3391,7 @@ abstract class ComponentbuilderHelper
}
return $model;
}
/**
* Add to asset Table
*/
@ -3453,7 +3453,7 @@ abstract class ComponentbuilderHelper
}
return false;
}
/**
* Gets the default asset Rules for a component/view.
*/
@ -3529,7 +3529,14 @@ abstract class ComponentbuilderHelper
return $button->input;
}
/**
* Check if have an json string
*
* @input string The json string to check
*
* @returns bool true on success
**/
public static function checkJson($string)
{
if (self::checkString($string))
@ -3540,15 +3547,29 @@ abstract class ComponentbuilderHelper
return false;
}
/**
* Check if have an object with a length
*
* @input object The object to check
*
* @returns bool true on success
**/
public static function checkObject($object)
{
if (isset($object) && is_object($object) && count($object) > 0)
if (isset($object) && is_object($object))
{
return true;
return count((array)$object) > 0;
}
return false;
}
/**
* Check if have an array with a length
*
* @input array The array to check
*
* @returns bool true on success
**/
public static function checkArray($array, $removeEmptyString = false)
{
if (isset($array) && is_array($array) && count($array) > 0)
@ -3570,6 +3591,13 @@ abstract class ComponentbuilderHelper
return false;
}
/**
* Check if have a string with a length
*
* @input string The string to check
*
* @returns bool true on success
**/
public static function checkString($string)
{
if (isset($string) && is_string($string) && strlen($string) > 0)
@ -3578,7 +3606,7 @@ abstract class ComponentbuilderHelper
}
return false;
}
/**
* Check if we are connected
* Thanks https://stackoverflow.com/a/4860432/1429677
@ -3604,6 +3632,13 @@ abstract class ComponentbuilderHelper
return $is_conn;
}
/**
* Merge an array of array's
*
* @input array The arrays you would like to merge
*
* @returns array on success
**/
public static function mergeArrays($arrays)
{
if(self::checkArray($arrays))
@ -3627,6 +3662,13 @@ abstract class ComponentbuilderHelper
return self::shorten($string, $length, $addTip);
}
/**
* Shorten a string
*
* @input string The you would like to shorten
*
* @returns string on success
**/
public static function shorten($string, $length = 40, $addTip = true)
{
if (self::checkString($string))
@ -3661,6 +3703,13 @@ abstract class ComponentbuilderHelper
return $string;
}
/**
* Making strings safe (various ways)
*
* @input string The you would like to make safe
*
* @returns string on success
**/
public static function safeString($string, $type = 'L', $spacer = '_', $replaceNumbers = true)
{
if ($replaceNumbers === true)
@ -3788,7 +3837,7 @@ abstract class ComponentbuilderHelper
// return the string with no numbers remaining.
return $string;
}
/**
* Convert an integer into an English word string
* Thanks to Tom Nicholson <http://php.net/manual/en/function.strval.php#41988>