forked from joomla/Component-Builder
Fixed linking issue, improved the new helpers to not hard code the component name to them.
This commit is contained in:
parent
1e0533ffa5
commit
c99cb17c5b
@ -143,14 +143,14 @@ TODO
|
|||||||
+ *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*: 9th May, 2022
|
+ *Last Build*: 16th May, 2022
|
||||||
+ *Version*: 2.12.17
|
+ *Version*: 2.12.17
|
||||||
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
|
+ *Copyright*: Copyright (C) 2015 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*: **286508**
|
+ *Line count*: **286766**
|
||||||
+ *Field count*: **1581**
|
+ *Field count*: **1581**
|
||||||
+ *File count*: **1851**
|
+ *File count*: **1853**
|
||||||
+ *Folder count*: **260**
|
+ *Folder count*: **261**
|
||||||
|
|
||||||
> This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](http://joomlacomponentbuilder.com).
|
> 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)
|
> Developed by [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
|
||||||
|
@ -143,14 +143,14 @@ TODO
|
|||||||
+ *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*: 9th May, 2022
|
+ *Last Build*: 16th May, 2022
|
||||||
+ *Version*: 2.12.17
|
+ *Version*: 2.12.17
|
||||||
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
|
+ *Copyright*: Copyright (C) 2015 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*: **286508**
|
+ *Line count*: **286766**
|
||||||
+ *Field count*: **1581**
|
+ *Field count*: **1581**
|
||||||
+ *File count*: **1851**
|
+ *File count*: **1853**
|
||||||
+ *Folder count*: **260**
|
+ *Folder count*: **261**
|
||||||
|
|
||||||
> This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](http://joomlacomponentbuilder.com).
|
> 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)
|
> Developed by [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
|
||||||
|
@ -31,6 +31,11 @@ abstract class ###Component###Helper
|
|||||||
*/
|
*/
|
||||||
use Utilities;
|
use Utilities;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get the Component Code Name
|
||||||
|
*/
|
||||||
|
public static $ComponentCodeName = '###component###';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Composer Switch
|
* Composer Switch
|
||||||
*
|
*
|
||||||
|
@ -31,6 +31,11 @@ abstract class ###Component###Helper
|
|||||||
*/
|
*/
|
||||||
use Utilities;
|
use Utilities;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get the Component Code Name
|
||||||
|
*/
|
||||||
|
public static $ComponentCodeName = '###component###';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Composer Switch
|
* Composer Switch
|
||||||
*
|
*
|
||||||
|
@ -12090,7 +12090,7 @@ class Interpretation extends Fields
|
|||||||
&& isset($item['id_code']))
|
&& isset($item['id_code']))
|
||||||
{
|
{
|
||||||
// build GUID link
|
// build GUID link
|
||||||
if ($item['custom']['id'] !== 'id')
|
if (isset($item['custom']['id']) && $item['custom']['id'] !== 'id')
|
||||||
{
|
{
|
||||||
// link to that linked item
|
// link to that linked item
|
||||||
return 'index.php?option=' . $item['custom']['component'] . '&view='
|
return 'index.php?option=' . $item['custom']['component'] . '&view='
|
||||||
@ -12101,7 +12101,7 @@ class Interpretation extends Fields
|
|||||||
// link to that linked item
|
// link to that linked item
|
||||||
return 'index.php?option=' . $item['custom']['component'] . '&view='
|
return 'index.php?option=' . $item['custom']['component'] . '&view='
|
||||||
. $item['custom']['views'] . '&task=' . $item['custom']['view']
|
. $item['custom']['views'] . '&task=' . $item['custom']['view']
|
||||||
. '.edit&id=<?php echo $item->' . $item['id_code'] . '_id; ?>'
|
. '.edit&id=<?php echo $item->' . $item['id_code'] . '; ?>'
|
||||||
. $ref;
|
. $ref;
|
||||||
}
|
}
|
||||||
elseif (isset($item['custom'])
|
elseif (isset($item['custom'])
|
||||||
|
@ -82,6 +82,11 @@ abstract class ComponentbuilderHelper
|
|||||||
*/
|
*/
|
||||||
use Utilities;
|
use Utilities;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get the Component Code Name
|
||||||
|
*/
|
||||||
|
public static $ComponentCodeName = 'componentbuilder';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Composer Switch
|
* Composer Switch
|
||||||
*
|
*
|
||||||
|
@ -1532,11 +1532,11 @@ class ComponentbuilderModelAjax extends JModelList
|
|||||||
// set the key get value
|
// set the key get value
|
||||||
$key_get_value = $values['a_id'];
|
$key_get_value = $values['a_id'];
|
||||||
// check if we have a GUID
|
// check if we have a GUID
|
||||||
if (isset($values['a_guid']))
|
//if (isset($values['a_guid']))
|
||||||
{
|
//{
|
||||||
$ref .= '&guid=' . (string) $values['a_guid'];
|
// $ref .= '&guid=' . (string) $values['a_guid'];
|
||||||
$key_get_value = $values['a_guid'];
|
// $key_get_value = $values['a_guid'];
|
||||||
}
|
//}
|
||||||
// get item id
|
// get item id
|
||||||
if (($id = ComponentbuilderHelper::getVar($type, $key_get_value, $values['a_view'], 'id')) !== false && $id > 0)
|
if (($id = ComponentbuilderHelper::getVar($type, $key_get_value, $values['a_view'], 'id')) !== false && $id > 0)
|
||||||
{
|
{
|
||||||
|
@ -77,7 +77,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
|
|||||||
public $postfix = false;
|
public $postfix = false;
|
||||||
public $forceUpdate = 0;
|
public $forceUpdate = 0;
|
||||||
public $hasKey = 0;
|
public $hasKey = 0;
|
||||||
public $sleutle = null;
|
public $sleutle = '';
|
||||||
public $data = false;
|
public $data = false;
|
||||||
public $app;
|
public $app;
|
||||||
|
|
||||||
@ -241,7 +241,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
|
|||||||
// has a key
|
// has a key
|
||||||
$this->hasKey = $this->app->input->getInt('haskey', 0);
|
$this->hasKey = $this->app->input->getInt('haskey', 0);
|
||||||
// die sleutle
|
// die sleutle
|
||||||
$this->sleutle = $this->app->input->getString('sleutle', NULL);
|
$this->sleutle = $this->app->input->getString('sleutle', '');
|
||||||
// try to store/set data
|
// try to store/set data
|
||||||
if (!$this->setData($package))
|
if (!$this->setData($package))
|
||||||
{
|
{
|
||||||
@ -349,7 +349,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
|
|||||||
$db = 'COM_COMPONENTBUILDER_SZDEQZDMVSMHBTRWFIFTYTSQFLVVXJTMTHREEJTWOIXM';
|
$db = 'COM_COMPONENTBUILDER_SZDEQZDMVSMHBTRWFIFTYTSQFLVVXJTMTHREEJTWOIXM';
|
||||||
$password = base64_decode(JText::sprintf($db, 'VjR', 'WV0aE9k'));
|
$password = base64_decode(JText::sprintf($db, 'VjR', 'WV0aE9k'));
|
||||||
// unlock the info data
|
// 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
|
// we only continue if info could be opened
|
||||||
$session->set('smart_package_info', $info);
|
$session->set('smart_package_info', $info);
|
||||||
@ -666,7 +666,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
|
|||||||
protected function extractData($data)
|
protected function extractData($data)
|
||||||
{
|
{
|
||||||
// remove all line breaks
|
// 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
|
// final check if we have success
|
||||||
$data = @unserialize($data);
|
$data = @unserialize($data);
|
||||||
@ -1045,7 +1045,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
|
|||||||
foreach ($files as $file)
|
foreach ($files as $file)
|
||||||
{
|
{
|
||||||
// open the file content
|
// 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
|
// write the decrypted data back to file
|
||||||
if (!ComponentbuilderHelper::writeFile($file, $data))
|
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 $data The data string
|
||||||
* @param string $password The key to unlock
|
* @param string $password The key to unlock
|
||||||
@ -1078,7 +1078,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
|
|||||||
*
|
*
|
||||||
* @since 3.0.11
|
* @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
|
// remove all line breaks
|
||||||
$data = str_replace("\n", '', $data);
|
$data = str_replace("\n", '', $data);
|
||||||
|
@ -95,7 +95,7 @@ $edit = "index.php?option=com_componentbuilder&view=custom_admin_views&task=cust
|
|||||||
<td class="nowrap">
|
<td class="nowrap">
|
||||||
<div class="name">
|
<div class="name">
|
||||||
<?php if ($this->user->authorise('dynamic_get.edit', 'com_componentbuilder.dynamic_get.' . (int) $item->main_get)): ?>
|
<?php if ($this->user->authorise('dynamic_get.edit', 'com_componentbuilder.dynamic_get.' . (int) $item->main_get)): ?>
|
||||||
<a href="index.php?option=com_componentbuilder&view=dynamic_gets&task=dynamic_get.edit&id=<?php echo $item->main_get_id; ?>&return=<?php echo $this->return_here; ?>"><?php echo $this->escape($item->main_get_name); ?></a>
|
<a href="index.php?option=com_componentbuilder&view=dynamic_gets&task=dynamic_get.edit&id=<?php echo $item->main_get; ?>&return=<?php echo $this->return_here; ?>"><?php echo $this->escape($item->main_get_name); ?></a>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<?php echo $this->escape($item->main_get_name); ?>
|
<?php echo $this->escape($item->main_get_name); ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
@ -73,7 +73,7 @@ $edit = "index.php?option=com_componentbuilder&view=fields&task=field.edit";
|
|||||||
<td class="nowrap">
|
<td class="nowrap">
|
||||||
<div class="name">
|
<div class="name">
|
||||||
<?php if ($this->user->authorise('fieldtype.edit', 'com_componentbuilder.fieldtype.' . (int) $item->fieldtype)): ?>
|
<?php if ($this->user->authorise('fieldtype.edit', 'com_componentbuilder.fieldtype.' . (int) $item->fieldtype)): ?>
|
||||||
<a href="index.php?option=com_componentbuilder&view=fieldtypes&task=fieldtype.edit&id=<?php echo $item->fieldtype_id; ?>&return=<?php echo $this->return_here; ?>"><?php echo $this->escape($item->fieldtype_name); ?></a>
|
<a href="index.php?option=com_componentbuilder&view=fieldtypes&task=fieldtype.edit&id=<?php echo $item->fieldtype; ?>&return=<?php echo $this->return_here; ?>"><?php echo $this->escape($item->fieldtype_name); ?></a>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<?php echo $this->escape($item->fieldtype_name); ?>
|
<?php echo $this->escape($item->fieldtype_name); ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
@ -73,7 +73,7 @@ $edit = "index.php?option=com_componentbuilder&view=joomla_plugin_groups&task=jo
|
|||||||
<td class="nowrap">
|
<td class="nowrap">
|
||||||
<div class="name">
|
<div class="name">
|
||||||
<?php if ($this->user->authorise('class_extends.edit', 'com_componentbuilder.class_extends.' . (int) $item->class_extends)): ?>
|
<?php if ($this->user->authorise('class_extends.edit', 'com_componentbuilder.class_extends.' . (int) $item->class_extends)): ?>
|
||||||
<a href="index.php?option=com_componentbuilder&view=class_extendings&task=class_extends.edit&id=<?php echo $item->class_extends_id; ?>&return=<?php echo $this->return_here; ?>"><?php echo $this->escape($item->class_extends_name); ?></a>
|
<a href="index.php?option=com_componentbuilder&view=class_extendings&task=class_extends.edit&id=<?php echo $item->class_extends; ?>&return=<?php echo $this->return_here; ?>"><?php echo $this->escape($item->class_extends_name); ?></a>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<?php echo $this->escape($item->class_extends_name); ?>
|
<?php echo $this->escape($item->class_extends_name); ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
@ -102,7 +102,7 @@ $edit = "index.php?option=com_componentbuilder&view=joomla_plugins&task=joomla_p
|
|||||||
<td class="nowrap">
|
<td class="nowrap">
|
||||||
<div class="name">
|
<div class="name">
|
||||||
<?php if ($this->user->authorise('class_extends.edit', 'com_componentbuilder.class_extends.' . (int) $item->class_extends)): ?>
|
<?php if ($this->user->authorise('class_extends.edit', 'com_componentbuilder.class_extends.' . (int) $item->class_extends)): ?>
|
||||||
<a href="index.php?option=com_componentbuilder&view=class_extendings&task=class_extends.edit&id=<?php echo $item->class_extends_id; ?>&return=<?php echo $this->return_here; ?>"><?php echo $this->escape($item->class_extends_name); ?></a>
|
<a href="index.php?option=com_componentbuilder&view=class_extendings&task=class_extends.edit&id=<?php echo $item->class_extends; ?>&return=<?php echo $this->return_here; ?>"><?php echo $this->escape($item->class_extends_name); ?></a>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<?php echo $this->escape($item->class_extends_name); ?>
|
<?php echo $this->escape($item->class_extends_name); ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
@ -111,7 +111,7 @@ $edit = "index.php?option=com_componentbuilder&view=joomla_plugins&task=joomla_p
|
|||||||
<td class="nowrap">
|
<td class="nowrap">
|
||||||
<div class="name">
|
<div class="name">
|
||||||
<?php if ($this->user->authorise('core.edit', 'com_componentbuilder.joomla_plugin_group.' . (int) $item->joomla_plugin_group)): ?>
|
<?php if ($this->user->authorise('core.edit', 'com_componentbuilder.joomla_plugin_group.' . (int) $item->joomla_plugin_group)): ?>
|
||||||
<a href="index.php?option=com_componentbuilder&view=joomla_plugin_groups&task=joomla_plugin_group.edit&id=<?php echo $item->joomla_plugin_group_id; ?>&return=<?php echo $this->return_here; ?>"><?php echo $this->escape($item->joomla_plugin_group_name); ?></a>
|
<a href="index.php?option=com_componentbuilder&view=joomla_plugin_groups&task=joomla_plugin_group.edit&id=<?php echo $item->joomla_plugin_group; ?>&return=<?php echo $this->return_here; ?>"><?php echo $this->escape($item->joomla_plugin_group_name); ?></a>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<?php echo $this->escape($item->joomla_plugin_group_name); ?>
|
<?php echo $this->escape($item->joomla_plugin_group_name); ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
@ -83,7 +83,7 @@ $edit = "index.php?option=com_componentbuilder&view=layouts&task=layout.edit";
|
|||||||
<td class="nowrap">
|
<td class="nowrap">
|
||||||
<div class="name">
|
<div class="name">
|
||||||
<?php if ($this->user->authorise('dynamic_get.edit', 'com_componentbuilder.dynamic_get.' . (int) $item->dynamic_get)): ?>
|
<?php if ($this->user->authorise('dynamic_get.edit', 'com_componentbuilder.dynamic_get.' . (int) $item->dynamic_get)): ?>
|
||||||
<a href="index.php?option=com_componentbuilder&view=dynamic_gets&task=dynamic_get.edit&id=<?php echo $item->dynamic_get_id; ?>&return=<?php echo $this->return_here; ?>"><?php echo $this->escape($item->dynamic_get_name); ?></a>
|
<a href="index.php?option=com_componentbuilder&view=dynamic_gets&task=dynamic_get.edit&id=<?php echo $item->dynamic_get; ?>&return=<?php echo $this->return_here; ?>"><?php echo $this->escape($item->dynamic_get_name); ?></a>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<?php echo $this->escape($item->dynamic_get_name); ?>
|
<?php echo $this->escape($item->dynamic_get_name); ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
@ -95,7 +95,7 @@ $edit = "index.php?option=com_componentbuilder&view=site_views&task=site_view.ed
|
|||||||
<td class="nowrap">
|
<td class="nowrap">
|
||||||
<div class="name">
|
<div class="name">
|
||||||
<?php if ($this->user->authorise('dynamic_get.edit', 'com_componentbuilder.dynamic_get.' . (int) $item->main_get)): ?>
|
<?php if ($this->user->authorise('dynamic_get.edit', 'com_componentbuilder.dynamic_get.' . (int) $item->main_get)): ?>
|
||||||
<a href="index.php?option=com_componentbuilder&view=dynamic_gets&task=dynamic_get.edit&id=<?php echo $item->main_get_id; ?>&return=<?php echo $this->return_here; ?>"><?php echo $this->escape($item->main_get_name); ?></a>
|
<a href="index.php?option=com_componentbuilder&view=dynamic_gets&task=dynamic_get.edit&id=<?php echo $item->main_get; ?>&return=<?php echo $this->return_here; ?>"><?php echo $this->escape($item->main_get_name); ?></a>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<?php echo $this->escape($item->main_get_name); ?>
|
<?php echo $this->escape($item->main_get_name); ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
@ -82,7 +82,7 @@ $edit = "index.php?option=com_componentbuilder&view=snippets&task=snippet.edit";
|
|||||||
<td class="nowrap">
|
<td class="nowrap">
|
||||||
<div class="name">
|
<div class="name">
|
||||||
<?php if ($this->user->authorise('library.edit', 'com_componentbuilder.library.' . (int) $item->library)): ?>
|
<?php if ($this->user->authorise('library.edit', 'com_componentbuilder.library.' . (int) $item->library)): ?>
|
||||||
<a href="index.php?option=com_componentbuilder&view=libraries&task=library.edit&id=<?php echo $item->library_id; ?>&return=<?php echo $this->return_here; ?>"><?php echo $this->escape($item->library_name); ?></a>
|
<a href="index.php?option=com_componentbuilder&view=libraries&task=library.edit&id=<?php echo $item->library; ?>&return=<?php echo $this->return_here; ?>"><?php echo $this->escape($item->library_name); ?></a>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<?php echo $this->escape($item->library_name); ?>
|
<?php echo $this->escape($item->library_name); ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
@ -83,7 +83,7 @@ $edit = "index.php?option=com_componentbuilder&view=templates&task=template.edit
|
|||||||
<td class="nowrap">
|
<td class="nowrap">
|
||||||
<div class="name">
|
<div class="name">
|
||||||
<?php if ($this->user->authorise('dynamic_get.edit', 'com_componentbuilder.dynamic_get.' . (int) $item->dynamic_get)): ?>
|
<?php if ($this->user->authorise('dynamic_get.edit', 'com_componentbuilder.dynamic_get.' . (int) $item->dynamic_get)): ?>
|
||||||
<a href="index.php?option=com_componentbuilder&view=dynamic_gets&task=dynamic_get.edit&id=<?php echo $item->dynamic_get_id; ?>&return=<?php echo $this->return_here; ?>"><?php echo $this->escape($item->dynamic_get_name); ?></a>
|
<a href="index.php?option=com_componentbuilder&view=dynamic_gets&task=dynamic_get.edit&id=<?php echo $item->dynamic_get; ?>&return=<?php echo $this->return_here; ?>"><?php echo $this->escape($item->dynamic_get_name); ?></a>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<?php echo $this->escape($item->dynamic_get_name); ?>
|
<?php echo $this->escape($item->dynamic_get_name); ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<extension type="component" version="4" method="upgrade">
|
<extension type="component" version="4" method="upgrade">
|
||||||
<name>COM_COMPONENTBUILDER</name>
|
<name>COM_COMPONENTBUILDER</name>
|
||||||
<creationDate>9th May, 2022</creationDate>
|
<creationDate>16th May, 2022</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>
|
||||||
|
@ -26,6 +26,7 @@ use VDM\Joomla\Utilities\String\TypeHelper;
|
|||||||
use VDM\Joomla\Utilities\String\ClassfunctionHelper;
|
use VDM\Joomla\Utilities\String\ClassfunctionHelper;
|
||||||
use VDM\Joomla\Utilities\String\NamespaceHelper;
|
use VDM\Joomla\Utilities\String\NamespaceHelper;
|
||||||
use VDM\Joomla\Utilities\String\PluginHelper;
|
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)
|
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);
|
return StringHelper::safe($string, $type, $spacer, $replaceNumbers, $keepOnlyCharacters);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,6 +127,9 @@ trait Utilities
|
|||||||
*/
|
*/
|
||||||
public static function safeFieldName($string, $allcap = false, $spacer = '_')
|
public static function safeFieldName($string, $allcap = false, $spacer = '_')
|
||||||
{
|
{
|
||||||
|
// set the local component option
|
||||||
|
self::setComponentOption();
|
||||||
|
|
||||||
return FieldHelper::safe($string, $allcap, $spacer);
|
return FieldHelper::safe($string, $allcap, $spacer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,6 +146,9 @@ trait Utilities
|
|||||||
*/
|
*/
|
||||||
public static function safeTypeName($string)
|
public static function safeTypeName($string)
|
||||||
{
|
{
|
||||||
|
// set the local component option
|
||||||
|
self::setComponentOption();
|
||||||
|
|
||||||
return TypeHelper::safe($string);
|
return TypeHelper::safe($string);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -165,6 +175,9 @@ trait Utilities
|
|||||||
*/
|
*/
|
||||||
public static function transliterate($string)
|
public static function transliterate($string)
|
||||||
{
|
{
|
||||||
|
// set the local component option
|
||||||
|
self::setComponentOption();
|
||||||
|
|
||||||
return StringHelper::transliterate($string);
|
return StringHelper::transliterate($string);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -175,6 +188,9 @@ trait Utilities
|
|||||||
*/
|
*/
|
||||||
public static function htmlEscape($var, $charset = 'UTF-8', $shorten = false, $length = 40)
|
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);
|
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);
|
* @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);
|
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);
|
* @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);
|
return GetHelper::vars($table, $where, $whereString, $what, $operator, $main, $unique);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -458,16 +480,20 @@ trait Utilities
|
|||||||
* @param string $guid
|
* @param string $guid
|
||||||
* @param string $table
|
* @param string $table
|
||||||
* @param int $id
|
* @param int $id
|
||||||
|
* @param string|null $component
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*
|
*
|
||||||
* @since 3.0.9
|
* @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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -476,16 +502,20 @@ trait Utilities
|
|||||||
* @param string $guid
|
* @param string $guid
|
||||||
* @param string $table
|
* @param string $table
|
||||||
* @param string/array $what
|
* @param string/array $what
|
||||||
|
* @param string|null $component
|
||||||
*
|
*
|
||||||
* @return mix
|
* @return mix
|
||||||
*
|
*
|
||||||
* @since 3.0.9
|
* @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)
|
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);
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,175 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package Joomla.Component.Builder
|
||||||
|
*
|
||||||
|
* @created 30th April, 2015
|
||||||
|
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
||||||
|
* @gitea Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||||
|
* @github Joomla Component Builder <https://github.com/vdm-io/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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
@ -19,8 +19,8 @@ use Joomla\CMS\Language\Text;
|
|||||||
use Joomla\CMS\Filesystem\Path;
|
use Joomla\CMS\Filesystem\Path;
|
||||||
use Joomla\CMS\Filesystem\File;
|
use Joomla\CMS\Filesystem\File;
|
||||||
use Joomla\CMS\Filesystem\Folder;
|
use Joomla\CMS\Filesystem\Folder;
|
||||||
use Joomla\CMS\Component\ComponentHelper;
|
|
||||||
use Joomla\Archive\Archive;
|
use Joomla\Archive\Archive;
|
||||||
|
use VDM\Joomla\Utilities\Component\Helper;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -39,15 +39,6 @@ abstract class FileHelper
|
|||||||
*/
|
*/
|
||||||
protected static $curlError = false;
|
protected static $curlError = false;
|
||||||
|
|
||||||
/**
|
|
||||||
* The component params
|
|
||||||
*
|
|
||||||
* @var object
|
|
||||||
*
|
|
||||||
* @since 3.0.9
|
|
||||||
*/
|
|
||||||
protected static $params = false;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The zipper method
|
* The zipper method
|
||||||
*
|
*
|
||||||
@ -260,11 +251,7 @@ abstract class FileHelper
|
|||||||
}
|
}
|
||||||
|
|
||||||
// get the global settings
|
// get the global settings
|
||||||
if (!ObjectHelper::check(self::$params))
|
$filePath = Helper::getParams()->get($target, $default);
|
||||||
{
|
|
||||||
self::$params = ComponentHelper::getParams('com_componentbuilder');
|
|
||||||
}
|
|
||||||
$filePath = self::$params->get($target, $default);
|
|
||||||
|
|
||||||
// check the file path (revert to default only of not a hidden file path)
|
// check the file path (revert to default only of not a hidden file path)
|
||||||
if ('hiddenfilepath' !== $target && strpos($filePath, JPATH_SITE) === false)
|
if ('hiddenfilepath' !== $target && strpos($filePath, JPATH_SITE) === false)
|
||||||
@ -283,9 +270,12 @@ abstract class FileHelper
|
|||||||
|
|
||||||
// Get basic key
|
// Get basic key
|
||||||
$basickey = 'Th!s_iS_n0t_sAfe_buT_b3tter_then_n0thiug';
|
$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
|
// check the key
|
||||||
@ -298,17 +288,17 @@ abstract class FileHelper
|
|||||||
if (StringHelper::check($fileType))
|
if (StringHelper::check($fileType))
|
||||||
{
|
{
|
||||||
// set the name
|
// set the name
|
||||||
$fileName = trim(md5($type . $target . $basickey . $key) . '.' . trim($fileType, '.'));
|
$fileName = trim( md5($type . $target . $basickey . $key) . '.' . trim($fileType, '.'));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$fileName = trim(md5($type . $target . $basickey . $key)) . '.txt';
|
$fileName = trim( md5($type . $target . $basickey . $key)) . '.txt';
|
||||||
}
|
}
|
||||||
|
|
||||||
// return the url
|
// return the url
|
||||||
if ('url' === $type)
|
if ('url' === $type)
|
||||||
{
|
{
|
||||||
if (strpos($filePath, JPATH_SITE) !== false)
|
if (\strpos($filePath, JPATH_SITE) !== false)
|
||||||
{
|
{
|
||||||
$filePath = trim( str_replace( JPATH_SITE, '', $filePath), '/');
|
$filePath = trim( str_replace( JPATH_SITE, '', $filePath), '/');
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@ namespace VDM\Joomla\Utilities;
|
|||||||
|
|
||||||
|
|
||||||
use Joomla\CMS\Factory;
|
use Joomla\CMS\Factory;
|
||||||
|
use VDM\Joomla\Utilities\Component\Helper;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -37,13 +38,18 @@ abstract class GetHelper
|
|||||||
*
|
*
|
||||||
* @since 3.0.9
|
* @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;
|
$where = Factory::getUser()->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(empty($main))
|
||||||
|
{
|
||||||
|
$main = Helper::getCode();
|
||||||
|
}
|
||||||
|
|
||||||
// Get a db connection.
|
// Get a db connection.
|
||||||
$db = Factory::getDbo();
|
$db = Factory::getDbo();
|
||||||
|
|
||||||
@ -98,13 +104,18 @@ abstract class GetHelper
|
|||||||
*
|
*
|
||||||
* @since 3.0.9
|
* @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;
|
$where = Factory::getUser()->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(is_null($main))
|
||||||
|
{
|
||||||
|
$main = Helper::getCode();
|
||||||
|
}
|
||||||
|
|
||||||
if (!ArrayHelper::check($where) && $where > 0)
|
if (!ArrayHelper::check($where) && $where > 0)
|
||||||
{
|
{
|
||||||
$where = array($where);
|
$where = array($where);
|
||||||
|
@ -14,6 +14,7 @@ namespace VDM\Joomla\Utilities;
|
|||||||
|
|
||||||
|
|
||||||
use Joomla\CMS\Factory;
|
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)
|
if (function_exists('openssl_random_pseudo_bytes') === true)
|
||||||
{
|
{
|
||||||
$data = openssl_random_pseudo_bytes(16);
|
$data = openssl_random_pseudo_bytes(16);
|
||||||
$data[6] = chr(ord($data[6]) & 0x0f | 0x40); // set version to 0100
|
$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[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;
|
return $lbrace . vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4)) . $lbrace;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fallback (PHP 4.2+)
|
// Fallback (PHP 4.2+)
|
||||||
mt_srand((double)microtime() * 10000);
|
mt_srand((double) microtime() * 10000);
|
||||||
$charid = strtolower(md5(uniqid(rand(), true)));
|
$charid = strtolower( md5( uniqid( rand(), true)));
|
||||||
$hyphen = chr(45); // "-"
|
$hyphen = chr(45); // "-"
|
||||||
$guidv4 = $lbrace.
|
$guidv4 = $lbrace.
|
||||||
substr($charid, 0, 8).$hyphen.
|
substr($charid, 0, 8). $hyphen.
|
||||||
substr($charid, 8, 4).$hyphen.
|
substr($charid, 8, 4). $hyphen.
|
||||||
substr($charid, 12, 4).$hyphen.
|
substr($charid, 12, 4). $hyphen.
|
||||||
substr($charid, 16, 4).$hyphen.
|
substr($charid, 16, 4). $hyphen.
|
||||||
substr($charid, 20, 12).
|
substr($charid, 20, 12).
|
||||||
$rbrace;
|
$rbrace;
|
||||||
return $guidv4;
|
return $guidv4;
|
||||||
@ -84,12 +85,13 @@ abstract class GuidHelper
|
|||||||
* @param string $guid
|
* @param string $guid
|
||||||
* @param string $table
|
* @param string $table
|
||||||
* @param int $id
|
* @param int $id
|
||||||
|
* @param string|null $component
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*
|
*
|
||||||
* @since 3.0.9
|
* @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
|
// check if we have a string
|
||||||
if (self::validate($guid))
|
if (self::validate($guid))
|
||||||
@ -97,11 +99,16 @@ abstract class GuidHelper
|
|||||||
// check if table already has this identifier
|
// check if table already has this identifier
|
||||||
if (StringHelper::check($table))
|
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.
|
// Get the database object and a new query object.
|
||||||
$db = Factory::getDbo();
|
$db = Factory::getDbo();
|
||||||
$query = $db->getQuery(true);
|
$query = $db->getQuery(true);
|
||||||
$query->select('COUNT(*)')
|
$query->select('COUNT(*)')
|
||||||
->from('#__componentbuilder_' . (string) $table)
|
->from('#__' . (string) $component . '_' . (string) $table)
|
||||||
->where($db->quoteName('guid') . ' = ' . $db->quote($guid));
|
->where($db->quoteName('guid') . ' = ' . $db->quote($guid));
|
||||||
|
|
||||||
// remove this item from the list
|
// remove this item from the list
|
||||||
@ -130,12 +137,13 @@ abstract class GuidHelper
|
|||||||
* @param string $guid
|
* @param string $guid
|
||||||
* @param string $table
|
* @param string $table
|
||||||
* @param string/array $what
|
* @param string/array $what
|
||||||
|
* @param string|null $component
|
||||||
*
|
*
|
||||||
* @return mix
|
* @return mix
|
||||||
*
|
*
|
||||||
* @since 3.0.9
|
* @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
|
// check if we have a string
|
||||||
if (self::validate($guid))
|
if (self::validate($guid))
|
||||||
@ -143,6 +151,11 @@ abstract class GuidHelper
|
|||||||
// check if table already has this identifier
|
// check if table already has this identifier
|
||||||
if (StringHelper::check($table))
|
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.
|
// Get the database object and a new query object.
|
||||||
$db = Factory::getDbo();
|
$db = Factory::getDbo();
|
||||||
$query = $db->getQuery(true);
|
$query = $db->getQuery(true);
|
||||||
@ -156,7 +169,7 @@ abstract class GuidHelper
|
|||||||
$query->select($what);
|
$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));
|
->where($db->quoteName('a.guid') . ' = ' . $db->quote($guid));
|
||||||
|
|
||||||
// Set and query the database.
|
// Set and query the database.
|
||||||
|
@ -15,6 +15,7 @@ namespace VDM\Joomla\Utilities\String;
|
|||||||
|
|
||||||
use Joomla\CMS\Component\ComponentHelper;
|
use Joomla\CMS\Component\ComponentHelper;
|
||||||
use VDM\Joomla\Utilities\StringHelper;
|
use VDM\Joomla\Utilities\StringHelper;
|
||||||
|
use VDM\Joomla\Utilities\Component\Helper;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -47,7 +48,7 @@ abstract class FieldHelper
|
|||||||
// get global value
|
// get global value
|
||||||
if (self::$builder === false)
|
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
|
// use the new convention
|
||||||
|
@ -47,10 +47,10 @@ abstract class NamespaceHelper
|
|||||||
$string = str_replace('\\', '1', $string);
|
$string = str_replace('\\', '1', $string);
|
||||||
|
|
||||||
// remove all and keep only characters and [\] backslashes inside of the 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
|
// place the [\] backslashes back
|
||||||
return trim(preg_replace("/1+/", '\\', $string));
|
return trim( preg_replace("/1+/", '\\', $string));
|
||||||
}
|
}
|
||||||
// not a string
|
// not a string
|
||||||
return '';
|
return '';
|
||||||
|
@ -15,6 +15,7 @@ namespace VDM\Joomla\Utilities\String;
|
|||||||
|
|
||||||
use Joomla\CMS\Component\ComponentHelper;
|
use Joomla\CMS\Component\ComponentHelper;
|
||||||
use VDM\Joomla\Utilities\StringHelper;
|
use VDM\Joomla\Utilities\StringHelper;
|
||||||
|
use VDM\Joomla\Utilities\Component\Helper;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -34,18 +35,19 @@ abstract class TypeHelper
|
|||||||
/**
|
/**
|
||||||
* Making field type name safe
|
* 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
|
* @returns string on success
|
||||||
*
|
*
|
||||||
* @since 3.0.9
|
* @since 3.0.9
|
||||||
*/
|
*/
|
||||||
public static function safe($string)
|
public static function safe($string, $option = null)
|
||||||
{
|
{
|
||||||
// get global value
|
// get global value
|
||||||
if (self::$builder === false)
|
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
|
// use the new convention
|
||||||
|
@ -15,7 +15,7 @@ namespace VDM\Joomla\Utilities;
|
|||||||
|
|
||||||
use Joomla\CMS\Filter\InputFilter;
|
use Joomla\CMS\Filter\InputFilter;
|
||||||
use Joomla\CMS\Language\Language;
|
use Joomla\CMS\Language\Language;
|
||||||
use Joomla\CMS\Component\ComponentHelper;
|
use VDM\Joomla\Utilities\Component\Helper;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -220,7 +220,7 @@ abstract class StringHelper
|
|||||||
if (!self::check(self::$langTag))
|
if (!self::check(self::$langTag))
|
||||||
{
|
{
|
||||||
// get global value
|
// 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
|
// Transliterate on the language requested
|
||||||
|
@ -79,6 +79,11 @@ abstract class ComponentbuilderHelper
|
|||||||
*/
|
*/
|
||||||
use Utilities;
|
use Utilities;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get the Component Code Name
|
||||||
|
*/
|
||||||
|
public static $ComponentCodeName = 'componentbuilder';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Composer Switch
|
* Composer Switch
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user