diff --git a/README.md b/README.md
index d5dd88264..94d01b472 100644
--- a/README.md
+++ b/README.md
@@ -143,14 +143,14 @@ TODO
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
+ *First Build*: 30th April, 2015
-+ *Last Build*: 9th May, 2022
++ *Last Build*: 16th May, 2022
+ *Version*: 2.12.17
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
-+ *Line count*: **286508**
++ *Line count*: **286766**
+ *Field count*: **1581**
-+ *File count*: **1851**
-+ *Folder count*: **260**
++ *File count*: **1853**
++ *Folder count*: **261**
> This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](http://joomlacomponentbuilder.com).
> Developed by [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
diff --git a/admin/README.txt b/admin/README.txt
index d5dd88264..94d01b472 100644
--- a/admin/README.txt
+++ b/admin/README.txt
@@ -143,14 +143,14 @@ TODO
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
+ *First Build*: 30th April, 2015
-+ *Last Build*: 9th May, 2022
++ *Last Build*: 16th May, 2022
+ *Version*: 2.12.17
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
-+ *Line count*: **286508**
++ *Line count*: **286766**
+ *Field count*: **1581**
-+ *File count*: **1851**
-+ *Folder count*: **260**
++ *File count*: **1853**
++ *Folder count*: **261**
> This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](http://joomlacomponentbuilder.com).
> Developed by [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
diff --git a/admin/compiler/joomla_3/JCB_Helper.php b/admin/compiler/joomla_3/JCB_Helper.php
index 58f2b6458..4f65b36c9 100644
--- a/admin/compiler/joomla_3/JCB_Helper.php
+++ b/admin/compiler/joomla_3/JCB_Helper.php
@@ -25,12 +25,17 @@ defined('_JEXEC') or die('Restricted access');###ADMIN_POWER_HELPER###
abstract class ###Component###Helper
{
/**
- * Adding the utilities trait to this class
- *
- * @deprecated 4.0 - Check the trait methods for details, a legacy implementation
- */
+ * Adding the utilities trait to this class
+ *
+ * @deprecated 4.0 - Check the trait methods for details, a legacy implementation
+ */
use Utilities;
+ /**
+ * get the Component Code Name
+ */
+ public static $ComponentCodeName = '###component###';
+
/**
* Composer Switch
*
diff --git a/admin/compiler/joomla_3/JCB_Helper_site.php b/admin/compiler/joomla_3/JCB_Helper_site.php
index 3190e5b48..c85a72e34 100644
--- a/admin/compiler/joomla_3/JCB_Helper_site.php
+++ b/admin/compiler/joomla_3/JCB_Helper_site.php
@@ -25,12 +25,17 @@ defined('_JEXEC') or die('Restricted access');###SITE_POWER_HELPER###
abstract class ###Component###Helper
{
/**
- * Adding the utilities trait to this class
- *
- * @deprecated 4.0 - Check the trait methods for details, a legacy implementation
- */
+ * Adding the utilities trait to this class
+ *
+ * @deprecated 4.0 - Check the trait methods for details, a legacy implementation
+ */
use Utilities;
+ /**
+ * get the Component Code Name
+ */
+ public static $ComponentCodeName = '###component###';
+
/**
* Composer Switch
*
diff --git a/admin/helpers/compiler/e_Interpretation.php b/admin/helpers/compiler/e_Interpretation.php
index 10efd2f7b..2853aa926 100644
--- a/admin/helpers/compiler/e_Interpretation.php
+++ b/admin/helpers/compiler/e_Interpretation.php
@@ -12090,7 +12090,7 @@ class Interpretation extends Fields
&& isset($item['id_code']))
{
// build GUID link
- if ($item['custom']['id'] !== 'id')
+ if (isset($item['custom']['id']) && $item['custom']['id'] !== 'id')
{
// link to that linked item
return 'index.php?option=' . $item['custom']['component'] . '&view='
@@ -12101,7 +12101,7 @@ class Interpretation extends Fields
// link to that linked item
return 'index.php?option=' . $item['custom']['component'] . '&view='
. $item['custom']['views'] . '&task=' . $item['custom']['view']
- . '.edit&id=' . $item['id_code'] . '_id; ?>'
+ . '.edit&id=' . $item['id_code'] . '; ?>'
. $ref;
}
elseif (isset($item['custom'])
diff --git a/admin/helpers/componentbuilder.php b/admin/helpers/componentbuilder.php
index eee9785e6..c5ac3563a 100644
--- a/admin/helpers/componentbuilder.php
+++ b/admin/helpers/componentbuilder.php
@@ -76,12 +76,17 @@ use VDM\Joomla\Utilities;
abstract class ComponentbuilderHelper
{
/**
- * Adding the utilities trait to this class
- *
- * @deprecated 4.0 - Check the trait methods for details, a legacy implementation
- */
+ * Adding the utilities trait to this class
+ *
+ * @deprecated 4.0 - Check the trait methods for details, a legacy implementation
+ */
use Utilities;
+ /**
+ * get the Component Code Name
+ */
+ public static $ComponentCodeName = 'componentbuilder';
+
/**
* Composer Switch
*
diff --git a/admin/models/ajax.php b/admin/models/ajax.php
index a06b8268c..ec80402fe 100644
--- a/admin/models/ajax.php
+++ b/admin/models/ajax.php
@@ -1532,11 +1532,11 @@ class ComponentbuilderModelAjax extends JModelList
// set the key get value
$key_get_value = $values['a_id'];
// check if we have a GUID
- if (isset($values['a_guid']))
- {
- $ref .= '&guid=' . (string) $values['a_guid'];
- $key_get_value = $values['a_guid'];
- }
+ //if (isset($values['a_guid']))
+ //{
+ // $ref .= '&guid=' . (string) $values['a_guid'];
+ // $key_get_value = $values['a_guid'];
+ //}
// get item id
if (($id = ComponentbuilderHelper::getVar($type, $key_get_value, $values['a_view'], 'id')) !== false && $id > 0)
{
diff --git a/admin/models/import_joomla_components.php b/admin/models/import_joomla_components.php
index 439a768b1..b50f6da07 100644
--- a/admin/models/import_joomla_components.php
+++ b/admin/models/import_joomla_components.php
@@ -77,7 +77,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
public $postfix = false;
public $forceUpdate = 0;
public $hasKey = 0;
- public $sleutle = null;
+ public $sleutle = '';
public $data = false;
public $app;
@@ -241,7 +241,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
// has a key
$this->hasKey = $this->app->input->getInt('haskey', 0);
// die sleutle
- $this->sleutle = $this->app->input->getString('sleutle', NULL);
+ $this->sleutle = $this->app->input->getString('sleutle', '');
// try to store/set data
if (!$this->setData($package))
{
@@ -349,7 +349,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
$db = 'COM_COMPONENTBUILDER_SZDEQZDMVSMHBTRWFIFTYTSQFLVVXJTMTHREEJTWOIXM';
$password = base64_decode(JText::sprintf($db, 'VjR', 'WV0aE9k'));
// unlock the info data
- if (($info = $this->unlock($info, $password, true)) !== false && ComponentbuilderHelper::checkJson($info))
+ if (($info = $this->decrypt($info, $password, true)) !== false && ComponentbuilderHelper::checkJson($info))
{
// we only continue if info could be opened
$session->set('smart_package_info', $info);
@@ -666,7 +666,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
protected function extractData($data)
{
// remove all line breaks
- if (($data = $this->unlock($data, $this->sleutle)) !== false)
+ if (($data = $this->decrypt($data, $this->sleutle)) !== false)
{
// final check if we have success
$data = @unserialize($data);
@@ -1045,7 +1045,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
foreach ($files as $file)
{
// open the file content
- if (($data = $this->unlock(file_get_contents($file), $this->sleutle)) !== false)
+ if (($data = $this->decrypt(file_get_contents($file), $this->sleutle)) !== false)
{
// write the decrypted data back to file
if (!ComponentbuilderHelper::writeFile($file, $data))
@@ -1068,7 +1068,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
}
/**
- * unlock data
+ * decrypt data
*
* @param string $data The data string
* @param string $password The key to unlock
@@ -1078,7 +1078,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
*
* @since 3.0.11
**/
- protected function unlock(string $data, string $password, bool $force = false)
+ protected function decrypt(string $data, string $password, bool $force = false)
{
// remove all line breaks
$data = str_replace("\n", '', $data);
diff --git a/admin/views/custom_admin_views/tmpl/default_body.php b/admin/views/custom_admin_views/tmpl/default_body.php
index 1b300f56c..52e229e9d 100644
--- a/admin/views/custom_admin_views/tmpl/default_body.php
+++ b/admin/views/custom_admin_views/tmpl/default_body.php
@@ -95,7 +95,7 @@ $edit = "index.php?option=com_componentbuilder&view=custom_admin_views&task=cust
user->authorise('dynamic_get.edit', 'com_componentbuilder.dynamic_get.' . (int) $item->main_get)): ?>
- escape($item->main_get_name); ?>
+ escape($item->main_get_name); ?>
escape($item->main_get_name); ?>
diff --git a/admin/views/fields/tmpl/default_body.php b/admin/views/fields/tmpl/default_body.php
index 4faa80c03..0fd902c04 100644
--- a/admin/views/fields/tmpl/default_body.php
+++ b/admin/views/fields/tmpl/default_body.php
@@ -73,7 +73,7 @@ $edit = "index.php?option=com_componentbuilder&view=fields&task=field.edit";
user->authorise('fieldtype.edit', 'com_componentbuilder.fieldtype.' . (int) $item->fieldtype)): ?>
- escape($item->fieldtype_name); ?>
+ escape($item->fieldtype_name); ?>
escape($item->fieldtype_name); ?>
diff --git a/admin/views/joomla_plugin_groups/tmpl/default_body.php b/admin/views/joomla_plugin_groups/tmpl/default_body.php
index fc99cdf5f..0c8783844 100644
--- a/admin/views/joomla_plugin_groups/tmpl/default_body.php
+++ b/admin/views/joomla_plugin_groups/tmpl/default_body.php
@@ -73,7 +73,7 @@ $edit = "index.php?option=com_componentbuilder&view=joomla_plugin_groups&task=jo
user->authorise('class_extends.edit', 'com_componentbuilder.class_extends.' . (int) $item->class_extends)): ?>
- escape($item->class_extends_name); ?>
+ escape($item->class_extends_name); ?>
escape($item->class_extends_name); ?>
diff --git a/admin/views/joomla_plugins/tmpl/default_body.php b/admin/views/joomla_plugins/tmpl/default_body.php
index 2494e993e..38bc08734 100644
--- a/admin/views/joomla_plugins/tmpl/default_body.php
+++ b/admin/views/joomla_plugins/tmpl/default_body.php
@@ -102,7 +102,7 @@ $edit = "index.php?option=com_componentbuilder&view=joomla_plugins&task=joomla_p
user->authorise('class_extends.edit', 'com_componentbuilder.class_extends.' . (int) $item->class_extends)): ?>
- escape($item->class_extends_name); ?>
+ escape($item->class_extends_name); ?>
escape($item->class_extends_name); ?>
@@ -111,7 +111,7 @@ $edit = "index.php?option=com_componentbuilder&view=joomla_plugins&task=joomla_p
user->authorise('core.edit', 'com_componentbuilder.joomla_plugin_group.' . (int) $item->joomla_plugin_group)): ?>
- escape($item->joomla_plugin_group_name); ?>
+ escape($item->joomla_plugin_group_name); ?>
escape($item->joomla_plugin_group_name); ?>
diff --git a/admin/views/layouts/tmpl/default_body.php b/admin/views/layouts/tmpl/default_body.php
index a5b72628a..bee3792e8 100644
--- a/admin/views/layouts/tmpl/default_body.php
+++ b/admin/views/layouts/tmpl/default_body.php
@@ -83,7 +83,7 @@ $edit = "index.php?option=com_componentbuilder&view=layouts&task=layout.edit";
user->authorise('dynamic_get.edit', 'com_componentbuilder.dynamic_get.' . (int) $item->dynamic_get)): ?>
- escape($item->dynamic_get_name); ?>
+ escape($item->dynamic_get_name); ?>
escape($item->dynamic_get_name); ?>
diff --git a/admin/views/site_views/tmpl/default_body.php b/admin/views/site_views/tmpl/default_body.php
index 6ca0775e5..7487e7a14 100644
--- a/admin/views/site_views/tmpl/default_body.php
+++ b/admin/views/site_views/tmpl/default_body.php
@@ -95,7 +95,7 @@ $edit = "index.php?option=com_componentbuilder&view=site_views&task=site_view.ed
user->authorise('dynamic_get.edit', 'com_componentbuilder.dynamic_get.' . (int) $item->main_get)): ?>
- escape($item->main_get_name); ?>
+ escape($item->main_get_name); ?>
escape($item->main_get_name); ?>
diff --git a/admin/views/snippets/tmpl/default_body.php b/admin/views/snippets/tmpl/default_body.php
index d813f0b2c..a09479a52 100644
--- a/admin/views/snippets/tmpl/default_body.php
+++ b/admin/views/snippets/tmpl/default_body.php
@@ -82,7 +82,7 @@ $edit = "index.php?option=com_componentbuilder&view=snippets&task=snippet.edit";
user->authorise('library.edit', 'com_componentbuilder.library.' . (int) $item->library)): ?>
- escape($item->library_name); ?>
+ escape($item->library_name); ?>
escape($item->library_name); ?>
diff --git a/admin/views/templates/tmpl/default_body.php b/admin/views/templates/tmpl/default_body.php
index 4ee1dd520..efdcaec82 100644
--- a/admin/views/templates/tmpl/default_body.php
+++ b/admin/views/templates/tmpl/default_body.php
@@ -83,7 +83,7 @@ $edit = "index.php?option=com_componentbuilder&view=templates&task=template.edit
user->authorise('dynamic_get.edit', 'com_componentbuilder.dynamic_get.' . (int) $item->dynamic_get)): ?>
- escape($item->dynamic_get_name); ?>
+ escape($item->dynamic_get_name); ?>
escape($item->dynamic_get_name); ?>
diff --git a/componentbuilder.xml b/componentbuilder.xml
index 9d3c317d3..41b927581 100644
--- a/componentbuilder.xml
+++ b/componentbuilder.xml
@@ -1,7 +1,7 @@
COM_COMPONENTBUILDER
- 9th May, 2022
+ 16th May, 2022
Llewellyn van der Merwe
llewellyn@joomlacomponentbuilder.com
http://www.joomlacomponentbuilder.com
diff --git a/libraries/jcb_powers/VDM.Joomla/src/Utilities.php b/libraries/jcb_powers/VDM.Joomla/src/Utilities.php
index 7656d7c77..53a87760f 100644
--- a/libraries/jcb_powers/VDM.Joomla/src/Utilities.php
+++ b/libraries/jcb_powers/VDM.Joomla/src/Utilities.php
@@ -26,6 +26,7 @@ use VDM\Joomla\Utilities\String\TypeHelper;
use VDM\Joomla\Utilities\String\ClassfunctionHelper;
use VDM\Joomla\Utilities\String\NamespaceHelper;
use VDM\Joomla\Utilities\String\PluginHelper;
+use VDM\Joomla\Utilities\Component\Helper;
/**
@@ -89,6 +90,9 @@ trait Utilities
*/
public static function safeString($string, $type = 'L', $spacer = '_', $replaceNumbers = true, $keepOnlyCharacters = true)
{
+ // set the local component option
+ self::setComponentOption();
+
return StringHelper::safe($string, $type, $spacer, $replaceNumbers, $keepOnlyCharacters);
}
@@ -123,6 +127,9 @@ trait Utilities
*/
public static function safeFieldName($string, $allcap = false, $spacer = '_')
{
+ // set the local component option
+ self::setComponentOption();
+
return FieldHelper::safe($string, $allcap, $spacer);
}
@@ -139,6 +146,9 @@ trait Utilities
*/
public static function safeTypeName($string)
{
+ // set the local component option
+ self::setComponentOption();
+
return TypeHelper::safe($string);
}
@@ -165,6 +175,9 @@ trait Utilities
*/
public static function transliterate($string)
{
+ // set the local component option
+ self::setComponentOption();
+
return StringHelper::transliterate($string);
}
@@ -175,6 +188,9 @@ trait Utilities
*/
public static function htmlEscape($var, $charset = 'UTF-8', $shorten = false, $length = 40)
{
+ // set the local component option
+ self::setComponentOption();
+
return StringHelper::html($var, $charset, $shorten, $length);
}
@@ -312,8 +328,11 @@ trait Utilities
*
* @deprecated 4.0 - Use GetHelper::var($table, $where, $whereString, $what, $operator, $main);
*/
- public static function getVar($table, $where = null, $whereString = 'user', $what = 'id', $operator = '=', $main = 'componentbuilder')
+ public static function getVar($table, $where = null, $whereString = 'user', $what = 'id', $operator = '=', $main = null)
{
+ // set the local component option
+ self::setComponentOption();
+
return GetHelper::var($table, $where, $whereString, $what, $operator, $main);
}
@@ -334,8 +353,11 @@ trait Utilities
*
* @deprecated 4.0 - Use GetHelper::vars($table, $where, $whereString, $what, $operator, $main, $unique);
*/
- public static function getVars($table, $where = null, $whereString = 'user', $what = 'id', $operator = 'IN', $main = 'componentbuilder', $unique = true)
+ public static function getVars($table, $where = null, $whereString = 'user', $what = 'id', $operator = 'IN', $main = null, $unique = true)
{
+ // set the local component option
+ self::setComponentOption();
+
return GetHelper::vars($table, $where, $whereString, $what, $operator, $main, $unique);
}
@@ -455,37 +477,45 @@ trait Utilities
/**
* Validate the Globally Unique Identifier ( and check if table already has this identifier)
*
- * @param string $guid
- * @param string $table
- * @param int $id
+ * @param string $guid
+ * @param string $table
+ * @param int $id
+ * @param string|null $component
*
* @return bool
*
* @since 3.0.9
*
- * @deprecated 4.0 - Use GuidHelper::valid($guid, $table, $id);
+ * @deprecated 4.0 - Use GuidHelper::valid($guid, $table, $id, $component);
*/
- public static function validGUID($guid, $table = null, $id = 0)
+ public static function validGUID($guid, $table = null, $id = 0, $component = null)
{
- return GuidHelper::valid($guid, $table, $id);
+ // set the local component option
+ self::setComponentOption();
+
+ return GuidHelper::valid($guid, $table, $id, $component);
}
/**
* get the ITEM of a GUID by table
*
- * @param string $guid
- * @param string $table
- * @param string/array $what
+ * @param string $guid
+ * @param string $table
+ * @param string/array $what
+ * @param string|null $component
*
* @return mix
*
* @since 3.0.9
*
- * @deprecated 4.0 - Use GuidHelper::valid($guid, $table, $id);
+ * @deprecated 4.0 - Use GuidHelper::valid($guid, $table, $id, $component);
*/
- public static function getGUID($guid, $table, $what = 'a.id')
+ public static function getGUID($guid, $table, $what = 'a.id', $component = null)
{
- return GuidHelper::item($guid, $table, $what);
+ // set the local component option
+ self::setComponentOption();
+
+ return GuidHelper::item($guid, $table, $what, $component);
}
/**
@@ -591,8 +621,34 @@ trait Utilities
*/
public static function getFilePath($type = 'path', $target = 'filepath', $fileType = null, $key = '', $default = '', $createIfNotSet = true)
{
+ // set the local component option
+ self::setComponentOption();
+
return FileHelper::getPath($type, $target, $fileType, $key, $default, $createIfNotSet);
}
+
+ /**
+ * Set the component option
+ *
+ * @param String|null $option The option for the component.
+ *
+ * @since 3.0.11
+ */
+ public static function setComponentOption($option = null)
+ {
+ // set the local component option
+ if (empty($option))
+ {
+ if (empty(Helper::$option) && property_exists(__CLASS__, 'ComponentCodeName'))
+ {
+ Helper::$option = 'com_' . self::$ComponentCodeName;
+ }
+ }
+ else
+ {
+ Helper::$option = $option;
+ }
+ }
}
diff --git a/libraries/jcb_powers/VDM.Joomla/src/Utilities/Component/Helper.php b/libraries/jcb_powers/VDM.Joomla/src/Utilities/Component/Helper.php
new file mode 100644
index 000000000..e61b02ad0
--- /dev/null
+++ b/libraries/jcb_powers/VDM.Joomla/src/Utilities/Component/Helper.php
@@ -0,0 +1,175 @@
+
+ * @gitea Joomla Component Builder
+ * @github Joomla Component Builder
+ * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
+ * @license GNU General Public License version 2 or later; see LICENSE.txt
+ */
+
+namespace VDM\Joomla\Utilities\Component;
+
+
+use Joomla\Input\Input;
+use Joomla\CMS\Component\ComponentHelper;
+use Joomla\Registry\Registry;
+
+
+/**
+ * Some component helper
+ *
+ * @since 3.0.11
+ */
+abstract class Helper
+{
+ /**
+ * The current option
+ *
+ * @var String
+ * @since 3.0.11
+ */
+ public static $option;
+
+ /**
+ * The component params list cache
+ *
+ * @var Registry[]
+ * @since 3.0.11
+ */
+ protected static $params = array();
+
+ /**
+ * Gets the parameter object for the component
+ *
+ * @param String $option The option for the component.
+ *
+ * @return Registry A Registry object.
+ *
+ * @see Registry
+ * @since 3.0.11
+ */
+ public static function getParams($option = null)
+ {
+ // check that we have an option
+ if (empty($option))
+ {
+ $option = self::getOption();
+ }
+
+ // get global value
+ if (!isset(self::$params[$option]) || !self::$params[$option] instanceof Registry)
+ {
+ self::$params[$option] = ComponentHelper::getParams($option);
+ }
+
+ return self::$params[$option];
+ }
+
+ /**
+ * Gets the component option
+ *
+ * @param String|Bool $default The default return value if none is found
+ *
+ * @return String|Bool A component option
+ *
+ * @since 3.0.11
+ */
+ public static function getOption($default = 'empty')
+ {
+ if (empty(self::$option))
+ {
+ // get the option from the url input
+ self::$option = (new Input)->getString('option', false);
+ }
+
+ if (self::$option)
+ {
+ return self::$option;
+ }
+
+ return $default;
+ }
+
+ /**
+ * Gets the component code name
+ *
+ * @param String $option The option for the component.
+ * @param String|Bool $default The default return value if none is found
+ *
+ * @return String|Mixed A component code name
+ *
+ * @since 3.0.11
+ */
+ public static function getCode($option = null, $default = null)
+ {
+ // check that we have an option
+ if (empty($option))
+ {
+ $option = self::getOption();
+ }
+ // option with com_
+ if (is_string($option) && strpos($option, 'com_') === 0)
+ {
+ return strtolower(trim(substr($option, 4)));
+ }
+
+ return $default;
+ }
+
+ /**
+ * Gets the component abstract helper class
+ *
+ * @param String $option The option for the component.
+ * @param String|Bool $default The default return value if none is found
+ *
+ * @return String|Mixed A component helper name
+ *
+ * @since 3.0.11
+ */
+ public static function get($option = null, $default = null)
+ {
+ // check that we have an option
+ // and get the code name from it
+ if (($code_name = self::getCode($option, false)) !== false)
+ {
+ // we build the helper class name
+ $helper_name = '\\' . \ucfirst($code_name) . 'Helper';
+ // check if class exist
+ if (class_exists($helper_name))
+ {
+ return $helper_name;
+ }
+ }
+
+ return $default;
+ }
+
+ /**
+ * Check if the helper class of this component has a method
+ *
+ * @param String $method The method name to search for
+ * @param String $option The option for the component.
+ *
+ * @return bool true if method exist
+ *
+ * @since 3.0.11
+ */
+ public static function methodExists($method, $option = null)
+ {
+ // get the helper class
+ if (($helper = self::get($option, false)) !== false)
+ {
+ if (method_exists($helper, $method))
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+}
+
diff --git a/libraries/jcb_powers/VDM.Joomla/src/Utilities/Component/index.html b/libraries/jcb_powers/VDM.Joomla/src/Utilities/Component/index.html
new file mode 100644
index 000000000..fa6d84e80
--- /dev/null
+++ b/libraries/jcb_powers/VDM.Joomla/src/Utilities/Component/index.html
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/libraries/jcb_powers/VDM.Joomla/src/Utilities/FileHelper.php b/libraries/jcb_powers/VDM.Joomla/src/Utilities/FileHelper.php
index 345febe17..37f1081f4 100644
--- a/libraries/jcb_powers/VDM.Joomla/src/Utilities/FileHelper.php
+++ b/libraries/jcb_powers/VDM.Joomla/src/Utilities/FileHelper.php
@@ -19,8 +19,8 @@ use Joomla\CMS\Language\Text;
use Joomla\CMS\Filesystem\Path;
use Joomla\CMS\Filesystem\File;
use Joomla\CMS\Filesystem\Folder;
-use Joomla\CMS\Component\ComponentHelper;
use Joomla\Archive\Archive;
+use VDM\Joomla\Utilities\Component\Helper;
/**
@@ -39,15 +39,6 @@ abstract class FileHelper
*/
protected static $curlError = false;
- /**
- * The component params
- *
- * @var object
- *
- * @since 3.0.9
- */
- protected static $params = false;
-
/**
* The zipper method
*
@@ -260,11 +251,7 @@ abstract class FileHelper
}
// get the global settings
- if (!ObjectHelper::check(self::$params))
- {
- self::$params = ComponentHelper::getParams('com_componentbuilder');
- }
- $filePath = self::$params->get($target, $default);
+ $filePath = Helper::getParams()->get($target, $default);
// check the file path (revert to default only of not a hidden file path)
if ('hiddenfilepath' !== $target && strpos($filePath, JPATH_SITE) === false)
@@ -283,9 +270,12 @@ abstract class FileHelper
// Get basic key
$basickey = 'Th!s_iS_n0t_sAfe_buT_b3tter_then_n0thiug';
- if (method_exists('\ComponentbuilderHelper', "getCryptKey"))
+ // get the component helper
+ $helper = Helper::get();
+ // check if method exist in helper class
+ if ($helper && Helper::methodExists('getCryptKey'))
{
- $basickey = \ComponentbuilderHelper::getCryptKey('basic', $basickey);
+ $basickey = $helper::getCryptKey('basic', $basickey);
}
// check the key
@@ -298,17 +288,17 @@ abstract class FileHelper
if (StringHelper::check($fileType))
{
// set the name
- $fileName = trim(md5($type . $target . $basickey . $key) . '.' . trim($fileType, '.'));
+ $fileName = trim( md5($type . $target . $basickey . $key) . '.' . trim($fileType, '.'));
}
else
{
- $fileName = trim(md5($type . $target . $basickey . $key)) . '.txt';
+ $fileName = trim( md5($type . $target . $basickey . $key)) . '.txt';
}
// return the url
if ('url' === $type)
{
- if (strpos($filePath, JPATH_SITE) !== false)
+ if (\strpos($filePath, JPATH_SITE) !== false)
{
$filePath = trim( str_replace( JPATH_SITE, '', $filePath), '/');
diff --git a/libraries/jcb_powers/VDM.Joomla/src/Utilities/GetHelper.php b/libraries/jcb_powers/VDM.Joomla/src/Utilities/GetHelper.php
index 967f39282..2f9048202 100644
--- a/libraries/jcb_powers/VDM.Joomla/src/Utilities/GetHelper.php
+++ b/libraries/jcb_powers/VDM.Joomla/src/Utilities/GetHelper.php
@@ -14,6 +14,7 @@ namespace VDM\Joomla\Utilities;
use Joomla\CMS\Factory;
+use VDM\Joomla\Utilities\Component\Helper;
/**
@@ -37,13 +38,18 @@ abstract class GetHelper
*
* @since 3.0.9
*/
- public static function var($table, $where = null, $whereString = 'user', $what = 'id', $operator = '=', $main = 'componentbuilder')
+ public static function var($table, $where = null, $whereString = 'user', $what = 'id', $operator = '=', $main = null)
{
- if(!$where)
+ if(empty($where))
{
$where = Factory::getUser()->id;
}
+ if(empty($main))
+ {
+ $main = Helper::getCode();
+ }
+
// Get a db connection.
$db = Factory::getDbo();
@@ -98,13 +104,18 @@ abstract class GetHelper
*
* @since 3.0.9
*/
- public static function vars($table, $where = null, $whereString = 'user', $what = 'id', $operator = 'IN', $main = 'componentbuilder', $unique = true)
+ public static function vars($table, $where = null, $whereString = 'user', $what = 'id', $operator = 'IN', $main = null, $unique = true)
{
- if(!$where)
+ if(empty($where))
{
$where = Factory::getUser()->id;
}
+ if(is_null($main))
+ {
+ $main = Helper::getCode();
+ }
+
if (!ArrayHelper::check($where) && $where > 0)
{
$where = array($where);
diff --git a/libraries/jcb_powers/VDM.Joomla/src/Utilities/GuidHelper.php b/libraries/jcb_powers/VDM.Joomla/src/Utilities/GuidHelper.php
index b68431b87..46ee6a25a 100644
--- a/libraries/jcb_powers/VDM.Joomla/src/Utilities/GuidHelper.php
+++ b/libraries/jcb_powers/VDM.Joomla/src/Utilities/GuidHelper.php
@@ -14,6 +14,7 @@ namespace VDM\Joomla\Utilities;
use Joomla\CMS\Factory;
+use VDM\Joomla\Utilities\Component\Helper;
/**
@@ -59,20 +60,20 @@ abstract class GuidHelper
if (function_exists('openssl_random_pseudo_bytes') === true)
{
$data = openssl_random_pseudo_bytes(16);
- $data[6] = chr(ord($data[6]) & 0x0f | 0x40); // set version to 0100
- $data[8] = chr(ord($data[8]) & 0x3f | 0x80); // set bits 6-7 to 10
+ $data[6] = chr( ord($data[6]) & 0x0f | 0x40); // set version to 0100
+ $data[8] = chr( ord($data[8]) & 0x3f | 0x80); // set bits 6-7 to 10
return $lbrace . vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4)) . $lbrace;
}
// Fallback (PHP 4.2+)
- mt_srand((double)microtime() * 10000);
- $charid = strtolower(md5(uniqid(rand(), true)));
+ mt_srand((double) microtime() * 10000);
+ $charid = strtolower( md5( uniqid( rand(), true)));
$hyphen = chr(45); // "-"
$guidv4 = $lbrace.
- substr($charid, 0, 8).$hyphen.
- substr($charid, 8, 4).$hyphen.
- substr($charid, 12, 4).$hyphen.
- substr($charid, 16, 4).$hyphen.
+ substr($charid, 0, 8). $hyphen.
+ substr($charid, 8, 4). $hyphen.
+ substr($charid, 12, 4). $hyphen.
+ substr($charid, 16, 4). $hyphen.
substr($charid, 20, 12).
$rbrace;
return $guidv4;
@@ -81,15 +82,16 @@ abstract class GuidHelper
/**
* Validate the Globally Unique Identifier ( and check if table already has this identifier)
*
- * @param string $guid
- * @param string $table
- * @param int $id
+ * @param string $guid
+ * @param string $table
+ * @param int $id
+ * @param string|null $component
*
* @return bool
*
* @since 3.0.9
*/
- public static function valid($guid, $table = null, $id = 0)
+ public static function valid($guid, $table = null, $id = 0, $component = null)
{
// check if we have a string
if (self::validate($guid))
@@ -97,11 +99,16 @@ abstract class GuidHelper
// check if table already has this identifier
if (StringHelper::check($table))
{
+ // check that we have the component code name
+ if (!is_string($component))
+ {
+ $component = (string) Helper::getCode();
+ }
// Get the database object and a new query object.
$db = Factory::getDbo();
$query = $db->getQuery(true);
$query->select('COUNT(*)')
- ->from('#__componentbuilder_' . (string) $table)
+ ->from('#__' . (string) $component . '_' . (string) $table)
->where($db->quoteName('guid') . ' = ' . $db->quote($guid));
// remove this item from the list
@@ -127,15 +134,16 @@ abstract class GuidHelper
/**
* get the item by guid in a table
*
- * @param string $guid
- * @param string $table
- * @param string/array $what
+ * @param string $guid
+ * @param string $table
+ * @param string/array $what
+ * @param string|null $component
*
* @return mix
*
* @since 3.0.9
*/
- public static function item($guid, $table, $what = 'a.id')
+ public static function item($guid, $table, $what = 'a.id', $component = null)
{
// check if we have a string
if (self::validate($guid))
@@ -143,6 +151,11 @@ abstract class GuidHelper
// check if table already has this identifier
if (StringHelper::check($table))
{
+ // check that we have the component code name
+ if (!is_string($component))
+ {
+ $component = (string) Helper::getCode();
+ }
// Get the database object and a new query object.
$db = Factory::getDbo();
$query = $db->getQuery(true);
@@ -156,7 +169,7 @@ abstract class GuidHelper
$query->select($what);
}
- $query->from($db->quoteName('#__componentbuilder_' . (string) $table, 'a'))
+ $query->from($db->quoteName('#__' . (string) $component . '_' . (string) $table, 'a'))
->where($db->quoteName('a.guid') . ' = ' . $db->quote($guid));
// Set and query the database.
diff --git a/libraries/jcb_powers/VDM.Joomla/src/Utilities/String/FieldHelper.php b/libraries/jcb_powers/VDM.Joomla/src/Utilities/String/FieldHelper.php
index 0893a276c..e8d06d82b 100644
--- a/libraries/jcb_powers/VDM.Joomla/src/Utilities/String/FieldHelper.php
+++ b/libraries/jcb_powers/VDM.Joomla/src/Utilities/String/FieldHelper.php
@@ -15,6 +15,7 @@ namespace VDM\Joomla\Utilities\String;
use Joomla\CMS\Component\ComponentHelper;
use VDM\Joomla\Utilities\StringHelper;
+use VDM\Joomla\Utilities\Component\Helper;
/**
@@ -47,7 +48,7 @@ abstract class FieldHelper
// get global value
if (self::$builder === false)
{
- self::$builder = ComponentHelper::getParams('com_componentbuilder')->get('field_name_builder', 1);
+ self::$builder = Helper::getParams()->get('field_name_builder', 1);
}
// use the new convention
diff --git a/libraries/jcb_powers/VDM.Joomla/src/Utilities/String/NamespaceHelper.php b/libraries/jcb_powers/VDM.Joomla/src/Utilities/String/NamespaceHelper.php
index e9b49f993..3b47442c8 100644
--- a/libraries/jcb_powers/VDM.Joomla/src/Utilities/String/NamespaceHelper.php
+++ b/libraries/jcb_powers/VDM.Joomla/src/Utilities/String/NamespaceHelper.php
@@ -47,10 +47,10 @@ abstract class NamespaceHelper
$string = str_replace('\\', '1', $string);
// remove all and keep only characters and [\] backslashes inside of the string
- $string = trim(preg_replace("/[^A-Za-z1]/", '', $string), '1');
+ $string = trim( preg_replace("/[^A-Za-z1]/", '', $string), '1');
// place the [\] backslashes back
- return trim(preg_replace("/1+/", '\\', $string));
+ return trim( preg_replace("/1+/", '\\', $string));
}
// not a string
return '';
diff --git a/libraries/jcb_powers/VDM.Joomla/src/Utilities/String/TypeHelper.php b/libraries/jcb_powers/VDM.Joomla/src/Utilities/String/TypeHelper.php
index b97b6aaee..9b43f29c3 100644
--- a/libraries/jcb_powers/VDM.Joomla/src/Utilities/String/TypeHelper.php
+++ b/libraries/jcb_powers/VDM.Joomla/src/Utilities/String/TypeHelper.php
@@ -15,6 +15,7 @@ namespace VDM\Joomla\Utilities\String;
use Joomla\CMS\Component\ComponentHelper;
use VDM\Joomla\Utilities\StringHelper;
+use VDM\Joomla\Utilities\Component\Helper;
/**
@@ -34,18 +35,19 @@ abstract class TypeHelper
/**
* Making field type name safe
*
- * @input string The you would like to make safe
+ * @param String $string The you would like to make safe
+ * @param String $option The option for the component.
*
* @returns string on success
*
* @since 3.0.9
*/
- public static function safe($string)
+ public static function safe($string, $option = null)
{
// get global value
if (self::$builder === false)
{
- self::$builder = ComponentHelper::getParams('com_componentbuilder')->get('type_name_builder', 1);
+ self::$builder = Helper::getParams($option)->get('type_name_builder', 1);
}
// use the new convention
diff --git a/libraries/jcb_powers/VDM.Joomla/src/Utilities/StringHelper.php b/libraries/jcb_powers/VDM.Joomla/src/Utilities/StringHelper.php
index a2f0d92aa..489081cf6 100644
--- a/libraries/jcb_powers/VDM.Joomla/src/Utilities/StringHelper.php
+++ b/libraries/jcb_powers/VDM.Joomla/src/Utilities/StringHelper.php
@@ -14,8 +14,8 @@ namespace VDM\Joomla\Utilities;
use Joomla\CMS\Filter\InputFilter;
-use Joomla\CMS\Language\Language;
-use Joomla\CMS\Component\ComponentHelper;
+use Joomla\CMS\Language\Language;
+use VDM\Joomla\Utilities\Component\Helper;
/**
@@ -220,7 +220,7 @@ abstract class StringHelper
if (!self::check(self::$langTag))
{
// get global value
- self::$langTag = ComponentHelper::getParams('com_componentbuilder')->get('language', 'en-GB');
+ self::$langTag = Helper::getParams()->get('language', 'en-GB');
}
// Transliterate on the language requested
diff --git a/site/helpers/componentbuilder.php b/site/helpers/componentbuilder.php
index 780cae1ff..846900cb0 100644
--- a/site/helpers/componentbuilder.php
+++ b/site/helpers/componentbuilder.php
@@ -73,12 +73,17 @@ use VDM\Joomla\Utilities;
abstract class ComponentbuilderHelper
{
/**
- * Adding the utilities trait to this class
- *
- * @deprecated 4.0 - Check the trait methods for details, a legacy implementation
- */
+ * Adding the utilities trait to this class
+ *
+ * @deprecated 4.0 - Check the trait methods for details, a legacy implementation
+ */
use Utilities;
+ /**
+ * get the Component Code Name
+ */
+ public static $ComponentCodeName = 'componentbuilder';
+
/**
* Composer Switch
*
| | | | | | | | |