Component Builder (v.2.9.7)
+ Component Builder (v.2.9.8)
The Component Builder for [Joomla](https://extensions.joomla.org/extension/component-builder/) is highly advanced tool that is truly able to build extremely complex components in a fraction of the time.
diff --git a/componentbuilder_update_server.xml b/componentbuilder_update_server.xml
index 56973fc9b..ada4348cb 100644
--- a/componentbuilder_update_server.xml
+++ b/componentbuilder_update_server.xml
@@ -548,10 +548,10 @@
Builds Complex Joomla Components
com_componentbuilder
component
- 2.9.7
+ 2.9.8
http://www.joomlacomponentbuilder.com
- https://github.com/vdm-io/Joomla-Component-Builder/releases/download/v2.9.7/JCB_v2.9.7.zip
+ https://github.com/vdm-io/Joomla-Component-Builder/releases/download/v2.9.8/JCB_v2.9.8.zip
stable
diff --git a/script.php b/script.php
index 2144f8891..ff6d07d8d 100644
--- a/script.php
+++ b/script.php
@@ -5172,7 +5172,7 @@ class com_componentbuilderInstallerScript
echo '
- Upgrade to Version 2.9.7 Was Successful! Let us know if anything is not working as expected.
';
+ Upgrade to Version 2.9.8 Was Successful! Let us know if anything is not working as expected.
';
}
}
diff --git a/site/helpers/componentbuilder.php b/site/helpers/componentbuilder.php
index 6fa255e0a..32f0b5417 100644
--- a/site/helpers/componentbuilder.php
+++ b/site/helpers/componentbuilder.php
@@ -4057,7 +4057,7 @@ abstract class ComponentbuilderHelper
}
/**
- * Load the Component xml manifest.
+ * Load the Component xml manifest.
**/
public static function manifest()
{
@@ -4066,12 +4066,12 @@ abstract class ComponentbuilderHelper
}
/**
- * Joomla version object
+ * Joomla version object
**/
protected static $JVersion;
/**
- * set/get Joomla version
+ * set/get Joomla version
**/
public static function jVersion()
{
@@ -4084,7 +4084,7 @@ abstract class ComponentbuilderHelper
}
/**
- * Load the Contributors details.
+ * Load the Contributors details.
**/
public static function getContributors()
{
@@ -4194,7 +4194,7 @@ abstract class ComponentbuilderHelper
}
/**
- * Get any component's model
+ * Get any component's model
**/
public static function getModel($name, $path = JPATH_COMPONENT_SITE, $component = 'Componentbuilder', $config = array())
{
@@ -4238,9 +4238,9 @@ abstract class ComponentbuilderHelper
}
/**
- * Add to asset Table
+ * Add to asset Table
*/
- public static function setAsset($id,$table)
+ public static function setAsset($id, $table, $inherit = true)
{
$parent = JTable::getInstance('Asset');
$parent->loadByName('com_componentbuilder');
@@ -4257,8 +4257,6 @@ abstract class ComponentbuilderHelper
if ($error)
{
- $this->setError($error);
-
return false;
}
else
@@ -4274,7 +4272,7 @@ abstract class ComponentbuilderHelper
$asset->name = $name;
$asset->title = $title;
// get the default asset rules
- $rules = self::getDefaultAssetRules('com_componentbuilder',$table);
+ $rules = self::getDefaultAssetRules('com_componentbuilder', $table, $inherit);
if ($rules instanceof JAccessRules)
{
$asset->rules = (string) $rules;
@@ -4302,55 +4300,62 @@ abstract class ComponentbuilderHelper
}
/**
- * Gets the default asset Rules for a component/view.
+ * Gets the default asset Rules for a component/view.
*/
- protected static function getDefaultAssetRules($component,$view)
+ protected static function getDefaultAssetRules($component, $view, $inherit = true)
{
- // Need to find the asset id by the name of the component.
- $db = JFactory::getDbo();
- $query = $db->getQuery(true)
- ->select($db->quoteName('id'))
- ->from($db->quoteName('#__assets'))
- ->where($db->quoteName('name') . ' = ' . $db->quote($component));
- $db->setQuery($query);
- $db->execute();
- if ($db->loadRowList())
+ // if new or inherited
+ $assetId = 0;
+ // Only get the actual item rules if not inheriting
+ if (!$inherit)
{
- // asset alread set so use saved rules
- $assetId = (int) $db->loadResult();
- $result = JAccess::getAssetRules($assetId);
- if ($result instanceof JAccessRules)
+ // Need to find the asset id by the name of the component.
+ $db = JFactory::getDbo();
+ $query = $db->getQuery(true)
+ ->select($db->quoteName('id'))
+ ->from($db->quoteName('#__assets'))
+ ->where($db->quoteName('name') . ' = ' . $db->quote($component));
+ $db->setQuery($query);
+ $db->execute();
+ // check that there is a value
+ if ($db->getNumRows())
{
- $_result = (string) $result;
- $_result = json_decode($_result);
- foreach ($_result as $name => &$rule)
- {
- $v = explode('.', $name);
- if ($view !== $v[0])
- {
- // remove since it is not part of this view
- unset($_result->$name);
- }
- else
- {
- // clear the value since we inherit
- $rule = array();
- }
- }
- // check if there are any view values remaining
- if (count((array)$_result))
- {
- $_result = json_encode($_result);
- $_result = array($_result);
- // Instantiate and return the JAccessRules object for the asset rules.
- $rules = new JAccessRules($_result);
-
- return $rules;
- }
- return $result;
+ // asset already set so use saved rules
+ $assetId = (int) $db->loadResult();
}
}
- return JAccess::getAssetRules(0);
+ // get asset rules
+ $result = JAccess::getAssetRules($assetId);
+ if ($result instanceof JAccessRules)
+ {
+ $_result = (string) $result;
+ $_result = json_decode($_result);
+ foreach ($_result as $name => &$rule)
+ {
+ $v = explode('.', $name);
+ if ($view !== $v[0])
+ {
+ // remove since it is not part of this view
+ unset($_result->$name);
+ }
+ elseif ($inherit)
+ {
+ // clear the value since we inherit
+ $rule = array();
+ }
+ }
+ // check if there are any view values remaining
+ if (count($_result))
+ {
+ $_result = json_encode($_result);
+ $_result = array($_result);
+ // Instantiate and return the JAccessRules object for the asset rules.
+ $rules = new JAccessRules($_result);
+ // return filtered rules
+ return $rules;
+ }
+ }
+ return $result;
}
/**
@@ -4968,11 +4973,11 @@ abstract class ComponentbuilderHelper
}
/**
- * Check if have an json string
+ * Check if have an json string
*
- * @input string The json string to check
+ * @input string The json string to check
*
- * @returns bool true on success
+ * @returns bool true on success
**/
public static function checkJson($string)
{
@@ -4985,11 +4990,11 @@ abstract class ComponentbuilderHelper
}
/**
- * Check if have an object with a length
+ * Check if have an object with a length
*
- * @input object The object to check
+ * @input object The object to check
*
- * @returns bool true on success
+ * @returns bool true on success
**/
public static function checkObject($object)
{
@@ -5001,11 +5006,11 @@ abstract class ComponentbuilderHelper
}
/**
- * Check if have an array with a length
+ * Check if have an array with a length
*
- * @input array The array to check
+ * @input array The array to check
*
- * @returns bool/int number of items in array on success
+ * @returns bool/int number of items in array on success
**/
public static function checkArray($array, $removeEmptyString = false)
{
@@ -5029,11 +5034,11 @@ abstract class ComponentbuilderHelper
}
/**
- * Check if have a string with a length
+ * Check if have a string with a length
*
- * @input string The string to check
+ * @input string The string to check
*
- * @returns bool true on success
+ * @returns bool true on success
**/
public static function checkString($string)
{
@@ -5045,10 +5050,10 @@ abstract class ComponentbuilderHelper
}
/**
- * Check if we are connected
- * Thanks https://stackoverflow.com/a/4860432/1429677
+ * Check if we are connected
+ * Thanks https://stackoverflow.com/a/4860432/1429677
*
- * @returns bool true on success
+ * @returns bool true on success
**/
public static function isConnected()
{
@@ -5070,11 +5075,11 @@ abstract class ComponentbuilderHelper
}
/**
- * Merge an array of array's
+ * Merge an array of array's
*
- * @input array The arrays you would like to merge
+ * @input array The arrays you would like to merge
*
- * @returns array on success
+ * @returns array on success
**/
public static function mergeArrays($arrays)
{
@@ -5100,11 +5105,11 @@ abstract class ComponentbuilderHelper
}
/**
- * Shorten a string
+ * Shorten a string
*
- * @input string The you would like to shorten
+ * @input string The you would like to shorten
*
- * @returns string on success
+ * @returns string on success
**/
public static function shorten($string, $length = 40, $addTip = true)
{
@@ -5141,11 +5146,11 @@ abstract class ComponentbuilderHelper
}
/**
- * Making strings safe (various ways)
+ * Making strings safe (various ways)
*
- * @input string The you would like to make safe
+ * @input string The you would like to make safe
*
- * @returns string on success
+ * @returns string on success
**/
public static function safeString($string, $type = 'L', $spacer = '_', $replaceNumbers = true, $keepOnlyCharacters = true)
{
@@ -5285,11 +5290,11 @@ abstract class ComponentbuilderHelper
}
/**
- * Convert an integer into an English word string
- * Thanks to Tom Nicholson
+ * Convert an integer into an English word string
+ * Thanks to Tom Nicholson
*
- * @input an int
- * @returns a string
+ * @input an int
+ * @returns a string
**/
public static function numberToString($x)
{
@@ -5376,9 +5381,9 @@ abstract class ComponentbuilderHelper
}
/**
- * Random Key
+ * Random Key
*
- * @returns a string
+ * @returns a string
**/
public static function randomkey($size)
{