Release of v3.2.5-beta2

Improve the [VDM Registry] to be Joomla Registry Compatible. Move all registries to the [VDM Registry] class. Fix Checked Out to be null and not 0. (#1194). Fix created_by, modified_by, checked_out fields in the compiler of the SQL. (#1194). Update all core date fields in table class. (#1188). Update created_by, modified_by, checked_out fields in table class. Implementation of the decentralized Super-Power CORE repository network. (#1190).
This commit is contained in:
Robot 2024-12-16 19:08:15 +02:00
parent 00e846f41c
commit 2d1df4ced2
Signed by: Robot
GPG Key ID: 14DECD44E7E1BB95
82 changed files with 2909 additions and 246 deletions

View File

@ -1,4 +1,14 @@
# v3.2.5-beta1
# v3.2.5-beta2
- Improve the [VDM Registry] to be Joomla Registry Compatible
- Move all registries to the [VDM Registry] class
- Fix Checked Out to be null and not 0. (#1194)
- Fix created_by, modified_by, checked_out fields in the compiler of the SQL. (#1194)
- Update all core date fields in table class. (#1188)
- Update created_by, modified_by, checked_out fields in table class.
- Implementation of the decentralized Super-Power CORE repository network. (#1190)
# v3.2.5-beta
- Add first classes for the new import engine.

View File

@ -9,7 +9,7 @@ The Component Builder for [Joomla](https://extensions.joomla.org/extension/compo
Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will save you lots of time and money. A real must have!
You can install it quite easily and with no limitations. On [gitea](https://git.vdm.dev/joomla/Component-Builder/tags) is the latest release (3.2.5-beta1) with **ALL** its features and **ALL** concepts totally open-source and free!
You can install it quite easily and with no limitations. On [gitea](https://git.vdm.dev/joomla/Component-Builder/tags) is the latest release (3.2.5-beta2) with **ALL** its features and **ALL** concepts totally open-source and free!
> Watch Quick Build of a Hello World component in [JCB on Youtube](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45)
@ -144,14 +144,14 @@ TODO
+ *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io)
+ *Name*: [Component Builder](https://git.vdm.dev/joomla/Component-Builder)
+ *First Build*: 30th April, 2015
+ *Last Build*: 7th November, 2024
+ *Version*: 3.2.5-beta1
+ *Last Build*: 16th December, 2024
+ *Version*: 3.2.5-beta2
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **864927**
+ *Line count*: **884672**
+ *Field count*: **2098**
+ *File count*: **5860**
+ *Folder count*: **505**
+ *File count*: **5978**
+ *Folder count*: **507**
> This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](https://www.joomlacomponentbuilder.com).
> Developed by [Llewellyn van der Merwe](mailto:joomla@vdm.io)

View File

@ -9,7 +9,7 @@ The Component Builder for [Joomla](https://extensions.joomla.org/extension/compo
Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will save you lots of time and money. A real must have!
You can install it quite easily and with no limitations. On [gitea](https://git.vdm.dev/joomla/Component-Builder/tags) is the latest release (3.2.5-beta1) with **ALL** its features and **ALL** concepts totally open-source and free!
You can install it quite easily and with no limitations. On [gitea](https://git.vdm.dev/joomla/Component-Builder/tags) is the latest release (3.2.5-beta2) with **ALL** its features and **ALL** concepts totally open-source and free!
> Watch Quick Build of a Hello World component in [JCB on Youtube](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45)
@ -144,14 +144,14 @@ TODO
+ *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io)
+ *Name*: [Component Builder](https://git.vdm.dev/joomla/Component-Builder)
+ *First Build*: 30th April, 2015
+ *Last Build*: 7th November, 2024
+ *Version*: 3.2.5-beta1
+ *Last Build*: 16th December, 2024
+ *Version*: 3.2.5-beta2
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **864927**
+ *Line count*: **884672**
+ *Field count*: **2098**
+ *File count*: **5860**
+ *Folder count*: **505**
+ *File count*: **5978**
+ *Folder count*: **507**
> This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](https://www.joomlacomponentbuilder.com).
> Developed by [Llewellyn van der Merwe](mailto:joomla@vdm.io)

View File

@ -42,7 +42,7 @@ $headers ??= [Text::_('COM_COMPONENTBUILDER_NO'), Text::_('COM_COMPONENTBUILDER_
$items ??= 6;
?>
<div class="<?php echo $$table_container_class; ?>">
<div class="<?php echo $table_container_class; ?>">
<table id="<?php echo $table_id; ?>" class="<?php echo $table_class; ?>">
<thead>
<?php if (is_array($headers)): ?>

View File

@ -15,6 +15,7 @@ defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Uri\Uri;
// import the list field type
jimport('joomla.form.helper');
@ -68,7 +69,7 @@ class JFormFieldClassextends extends JFormFieldList
$ref = '&amp;ref=' . $values['view'] . '&amp;refid=' . $values['id'];
$refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
// get the return value.
$_uri = (string) \Joomla\CMS\Uri\Uri::getInstance();
$_uri = (string) Uri::getInstance();
$_return = urlencode(base64_encode($_uri));
// load return value.
$ref .= '&amp;return=' . $_return;

View File

@ -15,6 +15,7 @@ defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Uri\Uri;
// import the list field type
jimport('joomla.form.helper');
@ -68,7 +69,7 @@ class JFormFieldClasspowers extends JFormFieldList
$ref = '&amp;ref=' . $values['view'] . '&amp;refid=' . $values['id'];
$refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
// get the return value.
$_uri = (string) \Joomla\CMS\Uri\Uri::getInstance();
$_uri = (string) Uri::getInstance();
$_return = urlencode(base64_encode($_uri));
// load return value.
$ref .= '&amp;return=' . $_return;

View File

@ -15,6 +15,7 @@ defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Uri\Uri;
// import the list field type
jimport('joomla.form.helper');
@ -68,7 +69,7 @@ class JFormFieldCron_servers extends JFormFieldList
$ref = '&amp;ref=' . $values['view'] . '&amp;refid=' . $values['id'];
$refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
// get the return value.
$_uri = (string) \Joomla\CMS\Uri\Uri::getInstance();
$_uri = (string) Uri::getInstance();
$_return = urlencode(base64_encode($_uri));
// load return value.
$ref .= '&amp;return=' . $_return;

View File

@ -15,6 +15,7 @@ defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Uri\Uri;
// import the list field type
jimport('joomla.form.helper');
@ -68,7 +69,7 @@ class JFormFieldDynamicget extends JFormFieldList
$ref = '&amp;ref=' . $values['view'] . '&amp;refid=' . $values['id'];
$refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
// get the return value.
$_uri = (string) \Joomla\CMS\Uri\Uri::getInstance();
$_uri = (string) Uri::getInstance();
$_return = urlencode(base64_encode($_uri));
// load return value.
$ref .= '&amp;return=' . $_return;

View File

@ -15,6 +15,7 @@ defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Uri\Uri;
// import the list field type
jimport('joomla.form.helper');
@ -68,7 +69,7 @@ class JFormFieldExcludedlanguages extends JFormFieldList
$ref = '&amp;ref=' . $values['view'] . '&amp;refid=' . $values['id'];
$refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
// get the return value.
$_uri = (string) \Joomla\CMS\Uri\Uri::getInstance();
$_uri = (string) Uri::getInstance();
$_return = urlencode(base64_encode($_uri));
// load return value.
$ref .= '&amp;return=' . $_return;

View File

@ -15,6 +15,7 @@ defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Uri\Uri;
// import the list field type
jimport('joomla.form.helper');
@ -68,7 +69,7 @@ class JFormFieldFieldtypes extends JFormFieldList
$ref = '&amp;ref=' . $values['view'] . '&amp;refid=' . $values['id'];
$refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
// get the return value.
$_uri = (string) \Joomla\CMS\Uri\Uri::getInstance();
$_uri = (string) Uri::getInstance();
$_return = urlencode(base64_encode($_uri));
// load return value.
$ref .= '&amp;return=' . $_return;

View File

@ -15,6 +15,7 @@ defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Uri\Uri;
// import the list field type
jimport('joomla.form.helper');
@ -68,7 +69,7 @@ class JFormFieldInterfacepowers extends JFormFieldList
$ref = '&amp;ref=' . $values['view'] . '&amp;refid=' . $values['id'];
$refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
// get the return value.
$_uri = (string) \Joomla\CMS\Uri\Uri::getInstance();
$_uri = (string) Uri::getInstance();
$_return = urlencode(base64_encode($_uri));
// load return value.
$ref .= '&amp;return=' . $_return;

View File

@ -15,6 +15,7 @@ defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Uri\Uri;
// import the list field type
jimport('joomla.form.helper');
@ -68,7 +69,7 @@ class JFormFieldJoomlacomponent extends JFormFieldList
$ref = '&amp;ref=' . $values['view'] . '&amp;refid=' . $values['id'];
$refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
// get the return value.
$_uri = (string) \Joomla\CMS\Uri\Uri::getInstance();
$_uri = (string) Uri::getInstance();
$_return = urlencode(base64_encode($_uri));
// load return value.
$ref .= '&amp;return=' . $_return;

View File

@ -15,6 +15,7 @@ defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Uri\Uri;
// import the list field type
jimport('joomla.form.helper');
@ -68,7 +69,7 @@ class JFormFieldJoomlaplugingroups extends JFormFieldList
$ref = '&amp;ref=' . $values['view'] . '&amp;refid=' . $values['id'];
$refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
// get the return value.
$_uri = (string) \Joomla\CMS\Uri\Uri::getInstance();
$_uri = (string) Uri::getInstance();
$_return = urlencode(base64_encode($_uri));
// load return value.
$ref .= '&amp;return=' . $_return;

View File

@ -15,6 +15,7 @@ defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Uri\Uri;
// import the list field type
jimport('joomla.form.helper');
@ -68,7 +69,7 @@ class JFormFieldJoomlaplugins extends JFormFieldList
$ref = '&amp;ref=' . $values['view'] . '&amp;refid=' . $values['id'];
$refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
// get the return value.
$_uri = (string) \Joomla\CMS\Uri\Uri::getInstance();
$_uri = (string) Uri::getInstance();
$_return = urlencode(base64_encode($_uri));
// load return value.
$ref .= '&amp;return=' . $_return;

View File

@ -15,6 +15,7 @@ defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Uri\Uri;
// import the list field type
jimport('joomla.form.helper');
@ -68,7 +69,7 @@ class JFormFieldLibraries extends JFormFieldList
$ref = '&amp;ref=' . $values['view'] . '&amp;refid=' . $values['id'];
$refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
// get the return value.
$_uri = (string) \Joomla\CMS\Uri\Uri::getInstance();
$_uri = (string) Uri::getInstance();
$_return = urlencode(base64_encode($_uri));
// load return value.
$ref .= '&amp;return=' . $_return;

View File

@ -15,6 +15,7 @@ defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Uri\Uri;
// import the list field type
jimport('joomla.form.helper');
@ -68,7 +69,7 @@ class JFormFieldLibrariesx extends JFormFieldList
$ref = '&amp;ref=' . $values['view'] . '&amp;refid=' . $values['id'];
$refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
// get the return value.
$_uri = (string) \Joomla\CMS\Uri\Uri::getInstance();
$_uri = (string) Uri::getInstance();
$_return = urlencode(base64_encode($_uri));
// load return value.
$ref .= '&amp;return=' . $_return;

View File

@ -15,6 +15,7 @@ defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Uri\Uri;
// import the list field type
jimport('joomla.form.helper');
@ -68,7 +69,7 @@ class JFormFieldLibrary extends JFormFieldList
$ref = '&amp;ref=' . $values['view'] . '&amp;refid=' . $values['id'];
$refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
// get the return value.
$_uri = (string) \Joomla\CMS\Uri\Uri::getInstance();
$_uri = (string) Uri::getInstance();
$_return = urlencode(base64_encode($_uri));
// load return value.
$ref .= '&amp;return=' . $_return;

View File

@ -15,6 +15,7 @@ defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Uri\Uri;
// import the list field type
jimport('joomla.form.helper');
@ -68,7 +69,7 @@ class JFormFieldMaingets extends JFormFieldList
$ref = '&amp;ref=' . $values['view'] . '&amp;refid=' . $values['id'];
$refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
// get the return value.
$_uri = (string) \Joomla\CMS\Uri\Uri::getInstance();
$_uri = (string) Uri::getInstance();
$_return = urlencode(base64_encode($_uri));
// load return value.
$ref .= '&amp;return=' . $_return;

View File

@ -15,6 +15,7 @@ defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Uri\Uri;
// import the list field type
jimport('joomla.form.helper');
@ -68,7 +69,7 @@ class JFormFieldServers extends JFormFieldList
$ref = '&amp;ref=' . $values['view'] . '&amp;refid=' . $values['id'];
$refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
// get the return value.
$_uri = (string) \Joomla\CMS\Uri\Uri::getInstance();
$_uri = (string) Uri::getInstance();
$_return = urlencode(base64_encode($_uri));
// load return value.
$ref .= '&amp;return=' . $_return;

View File

@ -16,6 +16,7 @@ use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper as Html;
use VDM\Joomla\Utilities\StringHelper;
use Joomla\CMS\Uri\Uri;
// import the list field type
jimport('joomla.form.helper');
@ -69,7 +70,7 @@ class JFormFieldSnippets extends JFormFieldList
$ref = '&amp;ref=' . $values['view'] . '&amp;refid=' . $values['id'];
$refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
// get the return value.
$_uri = (string) \Joomla\CMS\Uri\Uri::getInstance();
$_uri = (string) Uri::getInstance();
$_return = urlencode(base64_encode($_uri));
// load return value.
$ref .= '&amp;return=' . $_return;

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@

View File

@ -1,15 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.10" method="upgrade">
<name>COM_COMPONENTBUILDER</name>
<creationDate>7th November, 2024</creationDate>
<creationDate>16th December, 2024</creationDate>
<author>Llewellyn van der Merwe</author>
<authorEmail>joomla@vdm.io</authorEmail>
<authorUrl>https://dev.vdm.io</authorUrl>
<copyright>Copyright (C) 2015 Vast Development Method. All rights reserved.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<version>3.2.5-beta1</version>
<version>3.2.5-beta2</version>
<description><![CDATA[
<h1>Component Builder (v.3.2.5-beta1)</h1>
<h1>Component Builder (v.3.2.5-beta2)</h1>
<div style="clear: both;"></div>
<p>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.

View File

@ -220,10 +220,28 @@
<element>pkg_component_builder</element>
<type>package</type>
<client>site</client>
<version>3.2.5-beta1</version>
<version>3.2.5-beta</version>
<infourl title="Component Builder!">https://dev.vdm.io</infourl>
<downloads>
<downloadurl type="full" format="zip">https://git.vdm.dev/api/v1/repos/joomla/pkg-component-builder/archive/v3.2.5-beta1.zip</downloadurl>
<downloadurl type="full" format="zip">https://git.vdm.dev/api/v1/repos/joomla/pkg-component-builder/archive/v3.2.5-beta2.zip</downloadurl>
</downloads>
<tags>
<tag>beta</tag>
</tags>
<maintainer>Llewellyn van der Merwe</maintainer>
<maintainerurl>https://dev.vdm.io</maintainerurl>
<targetplatform name="joomla" version="3.*"/>
</update>
<update>
<name>Component Builder</name>
<description>Builds Complex Joomla Components</description>
<element>pkg_component_builder</element>
<type>package</type>
<client>site</client>
<version>3.2.5-beta2</version>
<infourl title="Component Builder!">https://dev.vdm.io</infourl>
<downloads>
<downloadurl type="full" format="zip">https://git.vdm.dev/api/v1/repos/joomla/pkg-component-builder/archive/v3.2.5-beta2.zip</downloadurl>
</downloads>
<tags>
<tag>beta</tag>

View File

@ -28,10 +28,10 @@ final class Http extends JoomlaHttp
/**
* The token
*
* @var string
* @var string|null
* @since 3.2.0
*/
protected string $_token_; // to avoid collisions (but allow swapping)
protected ?string $_token_; // to avoid collisions (but allow swapping)
/**
* Constructor.
@ -41,7 +41,7 @@ final class Http extends JoomlaHttp
* @since 3.2.0
* @throws \InvalidArgumentException
**/
public function __construct(?string $token)
public function __construct(?string $token = null)
{
// setup config
$config = [
@ -52,7 +52,7 @@ final class Http extends JoomlaHttp
];
// add the token if given
if (is_string($token))
if (is_string($token) && !empty($token))
{
$config['headers']['Authorization'] = 'token ' . $token;
$this->_token_ = $token;
@ -79,9 +79,16 @@ final class Http extends JoomlaHttp
]
);
// add the token
$headers['Authorization'] = 'token ' . $token;
$this->_token_ = $token;
if (empty($token))
{
unset($headers['Authorization']);
}
else
{
// add the token
$headers['Authorization'] = 'token ' . $token;
$this->_token_ = $token;
}
$this->setOption('headers', $headers);
}

View File

@ -108,8 +108,7 @@ abstract class BaseTable implements TableInterface
'store' => NULL,
'tab_name' => NULL,
'db' => [
'type' => 'INT(10) unsigned',
'default' => '0',
'type' => 'INT unsigned',
'null_switch' => 'NULL',
'key' => true,
'key_name' => 'modifiedby'
@ -125,7 +124,6 @@ abstract class BaseTable implements TableInterface
'tab_name' => NULL,
'db' => [
'type' => 'DATETIME',
'default' => '0000-00-00 00:00:00',
'null_switch' => 'NULL'
]
],
@ -138,7 +136,7 @@ abstract class BaseTable implements TableInterface
'store' => NULL,
'tab_name' => NULL,
'db' => [
'type' => 'INT(10) unsigned',
'type' => 'INT unsigned',
'default' => '0',
'null_switch' => 'NULL',
'key' => true,
@ -155,7 +153,7 @@ abstract class BaseTable implements TableInterface
'tab_name' => NULL,
'db' => [
'type' => 'DATETIME',
'default' => '0000-00-00 00:00:00',
'default' => 'CURRENT_TIMESTAMP',
'null_switch' => 'NULL'
]
],
@ -168,8 +166,7 @@ abstract class BaseTable implements TableInterface
'store' => NULL,
'tab_name' => NULL,
'db' => [
'type' => 'INT(10) unsigned',
'default' => '0',
'type' => 'INT unsigned',
'null_switch' => 'NULL',
'key' => true,
'key_name' => 'checkout'
@ -185,7 +182,6 @@ abstract class BaseTable implements TableInterface
'tab_name' => NULL,
'db' => [
'type' => 'DATETIME',
'default' => '0000-00-00 00:00:00',
'null_switch' => 'NULL'
]
],

View File

@ -12,41 +12,17 @@
namespace VDM\Joomla\Abstraction;
use Joomla\Registry\Registry as JoomlaRegistry;
use VDM\Joomla\Utilities\String\ClassfunctionHelper;
use VDM\Joomla\Abstraction\Registry;
/**
* Config
* A Dynamic Function Registry
*
* @since 3.2.0
* @since 5.0.4
*/
abstract class BaseConfig extends JoomlaRegistry
abstract class FunctionRegistry extends Registry
{
/**
* Constructor
*
* @since 3.2.0
*/
public function __construct()
{
// Instantiate the internal data object.
$this->data = new \stdClass();
}
/**
* setting any config value
*
* @param string $key The value's key/path name
* @param mixed $value Optional default value, returned if the internal value is null.
*
* @since 3.2.0
*/
public function __set($key, $value)
{
$this->set($key, $value);
}
/**
* getting any valid value
*
@ -76,7 +52,7 @@ abstract class BaseConfig extends JoomlaRegistry
*
* @since 3.2.0
*/
public function get($path, $default = null)
public function get(string $path, $default = null): mixed
{
// function name with no underscores
$method = 'get' . ucfirst((string) ClassfunctionHelper::safe(str_replace('_', '', $path)));
@ -86,7 +62,8 @@ abstract class BaseConfig extends JoomlaRegistry
{
return $value;
}
elseif (method_exists($this, $method))
// Use the method if it's callable and not excluded
elseif ($this->isCallableMethod($method))
{
$value = $this->{$method}($default);
@ -104,19 +81,46 @@ abstract class BaseConfig extends JoomlaRegistry
* @param string $path Parent registry Path (e.g. joomla.content.showauthor)
* @param mixed $value Value of entry
*
* @return mixed The value of the that has been set.
* @return mixed The values of the path that has been set.
*
* @since 3.2.0
*/
public function appendArray(string $path, $value)
{
// check if it does not exist
if (!$this->exists($path))
return $this->add($path, $value, true)->get($path);
}
/**
* Determines if a method is callable on this object, excluding certain methods.
*
* This method checks if a method exists on this object and is callable, but excludes
* certain methods to prevent unintended access or recursion. It helps to safely determine
* if a dynamic getter method can be invoked without interfering with core methods.
*
* @param string $method The method name to check.
*
* @return bool True if the method is callable and not excluded, false otherwise.
* @since 5.0.4
*/
protected function isCallableMethod(string $method): bool
{
// List of methods to exclude from dynamic access
$excludedMethods = [
'getActive',
'get',
'getSeparator',
'getIterator',
'getName',
'getActiveKeys'
];
// Check if the method exists and is not excluded
if (method_exists($this, $method) && !in_array($method, $excludedMethods, true))
{
$this->set($path, []);
return true;
}
return $this->append($path, $value);
return false;
}
}

View File

@ -17,6 +17,8 @@ use Joomla\CMS\Language\Text;
use Joomla\CMS\Filesystem\Folder;
use Joomla\CMS\Application\CMSApplication;
use VDM\Joomla\Gitea\Repository\Contents;
use VDM\Joomla\Interfaces\Git\ApiInterface as Api;
use VDM\Joomla\Componentbuilder\Network\Resolve;
use VDM\Joomla\Utilities\FileHelper;
use VDM\Joomla\Utilities\JsonHelper;
use VDM\Joomla\Interfaces\GrepInterface;
@ -50,6 +52,14 @@ abstract class Grep implements GrepInterface
**/
public ?array $paths;
/**
* The Grep target [network]
*
* @var string
* @since 5.0.4
**/
protected ?string $target = null;
/**
* Order of global search
*
@ -82,6 +92,14 @@ abstract class Grep implements GrepInterface
*/
protected string $index_path = 'index.json';
/**
* The VDM global API base
*
* @var string
* @since 5.0.4
**/
protected string $api_base = '//git.vdm.dev/';
/**
* Gitea Repository Contents
*
@ -90,6 +108,14 @@ abstract class Grep implements GrepInterface
**/
protected Contents $contents;
/**
* The Resolve Class.
*
* @var Resolve
* @since 5.0.4
*/
protected Resolve $resolve;
/**
* Joomla Application object
*
@ -101,17 +127,22 @@ abstract class Grep implements GrepInterface
/**
* Constructor.
*
* @param Contents $contents The Gitea Repository Contents object.
* @param array $paths The approved paths
* @param string|null $path The local path
* @param CMSApplication|null $app The CMS Application object.
* @param Contents $contents The Gitea Repository Contents object.
* @param Resolve $resolve The Resolve Class.
* @param array $paths The approved paths
* @param string|null $path The local path
* @param CMSApplication|null $app The CMS Application object.
*
* @throws \Exception
* @since 3.2.0
*/
public function __construct(Contents $contents, array $paths, ?string $path = null, ?CMSApplication $app = null)
public function __construct(
Contents $contents, Resolve $resolve,
array $paths, ?string $path = null,
?CMSApplication $app = null)
{
$this->contents = $contents;
$this->resolve = $resolve;
$this->paths = $paths;
$this->path = $path;
$this->app = $app ?: Factory::getApplication();
@ -264,6 +295,38 @@ abstract class Grep implements GrepInterface
return null;
}
/**
* Loads API config using the provided base URL and token.
*
* This method checks if the base URL contains 'https://git.vdm.dev/'.
* If it does, it uses the token as is (which may be null).
* If not, it ensures the token is not null by defaulting to an empty string.
*
* @param Api $api The api object with a load_ method.
* @param string|null $base The base URL path.
* @param string|null $token The token for authentication (can be null).
*
* @return void
* @since 5.0.4
*/
public function loadApi(Api $api, ?string $base, ?string $token): void
{
// Determine the token to use based on the base URL
if ($base && strpos($base, $this->api_base) !== false)
{
// If base contains $this->api_base = https://git.vdm.dev/, use the token as is
$tokenToUse = $token;
}
else
{
// Otherwise, ensure the token is not null (use empty string if null)
$tokenToUse = $token ?? '';
}
// Load the content with the determined base and token
$api->load_($base, $tokenToUse);
}
/**
* Set repository messages and errors based on given conditions.
*
@ -584,7 +647,7 @@ abstract class Grep implements GrepInterface
try
{
// load the base and token if set
$this->contents->load_($path->base ?? null, $path->token ?? null);
$this->loadApi($this->contents, $path->base ?? null, $path->token ?? null);
$path->index = $this->contents->get($path->organisation, $path->repository, $this->getIndexPath(), $this->getBranchName($path));
}
catch (\Exception $e)
@ -640,6 +703,12 @@ abstract class Grep implements GrepInterface
if (isset($path->organisation) && strlen($path->organisation) > 1 &&
isset($path->repository) && strlen($path->repository) > 1)
{
// resolve API if needed
if (!empty($path->base))
{
$this->resolve->api($this->target ?? $path->repository, $path->base, $path->organisation, $path->repository);
}
// build the path
$path->path = trim($path->organisation) . '/' . trim($path->repository);

View File

@ -12,6 +12,7 @@
namespace VDM\Joomla\Abstraction;
use Joomla\Registry\Factory as FormatFactory;
use VDM\Joomla\Interfaces\Registryinterface;
use VDM\Joomla\Abstraction\ActiveRegistry;
@ -21,18 +22,238 @@ use VDM\Joomla\Abstraction\ActiveRegistry;
*
* Don't use this beyond 10 dimensional depth for best performance.
*
* @since 3.2.0
* @since 3.2.0
* @since 5.0.4 Joomla Registry Compatible
*/
abstract class Registry extends ActiveRegistry implements Registryinterface
abstract class Registry extends ActiveRegistry implements Registryinterface, \JsonSerializable, \ArrayAccess, \IteratorAggregate, \Countable
{
/**
* Path separator
*
* @var string|null
* @since 3.2.0
* @since 3.2.0
*/
protected ?string $separator = '.';
/**
* The name of the registry.
*
* @var string|null
* @since 5.0.4
*/
protected ?string $name = null;
/**
* Constructor.
*
* Initializes the Registry object with optional data.
*
* @param mixed $data Optional data to load into the registry.
* Can be an array, string, or object.
* @param string|null $separator The path separator, and empty string will flatten the registry.
* @since 5.0.4
*/
public function __construct($data = null, ?string $separator = null)
{
// we don't allow null on initialization (default is a dot)
// so that all class inheritance can override the separator property
// use an empty string if you want to flatten the registry
if ($separator !== null)
{
$this->setSeparator($separator);
}
if ($data !== null)
{
if (is_array($data))
{
$this->loadArray($data);
}
elseif (is_string($data))
{
$this->loadString($data);
}
elseif (is_object($data))
{
$this->loadObject($data);
}
}
}
/**
* Magic method to get a value from the registry.
*
* Allows for accessing registry data using object property syntax.
*
* @param string $name The name of the property to get.
*
* @return mixed The value of the property, or null if not found.
* @since 5.0.4
*/
public function __get($name)
{
return $this->get($name);
}
/**
* Magic method to set a value in the registry.
*
* Allows for setting registry data using object property syntax.
*
* @param string $name The name of the property to set.
* @param mixed $value The value to set.
*
* @return void
* @since 5.0.4
*/
public function __set($name, $value)
{
$this->set($name, $value);
}
/**
* Magic method to check if a property is set in the registry.
*
* Allows for using isset() on registry properties.
*
* @param string $name The name of the property to check.
*
* @return bool True if the property is set, false otherwise.
* @since 5.0.4
*/
public function __isset($name)
{
return $this->exists($name);
}
/**
* Magic method to unset a property in the registry.
*
* Allows for using unset() on registry properties.
*
* @param string $name The name of the property to unset.
*
* @return void
* @since 5.0.4
*/
public function __unset($name)
{
$this->remove($name);
}
/**
* Magic method to clone the registry.
*
* Performs a deep copy of the registry data.
*
* @return void
* @since 5.0.4
*/
public function __clone()
{
$this->active = unserialize(serialize($this->active));
}
/**
* Magic method to convert the registry to a string.
*
* Returns the registry data in JSON format.
*
* @return string The registry data in JSON format.
* @since 5.0.4
*/
public function __toString()
{
return $this->toString();
}
/**
* Loads data into the registry from a string using Joomla's format classes.
*
* @param string $data The data string to load.
* @param string $format The format of the data string. Supported formats: 'json', 'ini', 'xml', 'php'.
* @param array $options Options used by the formatter
*
* @return self
* @throws \InvalidArgumentException If the format is not supported.
* @since 5.0.4
*/
public function loadString(string $data, string $format = 'JSON', array $options = []): self
{
// Load a string into the given namespace [or default namespace if not given]
$object = FormatFactory::getFormat($format, $options)->stringToObject($data, $options);
// Merge the object into the registry
$this->loadObject($object);
return $this;
}
/**
* Loads data into the registry from an object.
*
* @param object $object The data object to load.
*
* @return self
* @since 5.0.4
*/
public function loadObject(object $object): self
{
// Convert the object to an array
$array = $this->objectToArray($object);
// Merge the array into the registry
$this->loadArray($array);
return $this;
}
/**
* Loads data into the registry from an array.
*
* The loaded data will be merged into the registry's existing data.
*
* @param array $array The array of data to load into the registry.
*
* @return self
* @since 5.0.4
*/
public function loadArray(array $array): self
{
$this->active = $this->arrayMergeRecursive($this->active, $array);
return $this;
}
/**
* Loads data into the registry from a file.
*
* @param string $path The path to the file to load.
* @param string $format The format of the file. Supported formats: 'json', 'ini', 'xml', 'php'.
*
* @return self
* @throws \InvalidArgumentException If the file does not exist or is not readable.
* @throws \RuntimeException If the file cannot be read.
* @since 5.0.4
*/
public function loadFile(string $path, string $format = 'json'): self
{
if (!file_exists($path) || !is_readable($path))
{
throw new \InvalidArgumentException("File does not exist or is not readable: {$path}");
}
$data = file_get_contents($path);
if ($data === false)
{
throw new \RuntimeException("Failed to read file: {$path}");
}
$this->loadString($data, $format);
return $this;
}
/**
* Sets a value into the registry using multiple keys.
*
@ -41,7 +262,7 @@ abstract class Registry extends ActiveRegistry implements Registryinterface
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return self
* @since 3.2.0
* @since 3.2.0
*/
public function set(string $path, $value): self
{
@ -67,7 +288,7 @@ abstract class Registry extends ActiveRegistry implements Registryinterface
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return self
* @since 3.2.0
* @since 3.2.0
*/
public function add(string $path, $value, ?bool $asArray = null): self
{
@ -89,9 +310,9 @@ abstract class Registry extends ActiveRegistry implements Registryinterface
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return mixed The value or sub-array from the storage. Null if the location doesn't exist.
* @since 3.2.0
* @since 3.2.0
*/
public function get(string $path, $default = null)
public function get(string $path, $default = null): mixed
{
if (($keys = $this->getActiveKeys($path)) === null)
{
@ -108,7 +329,7 @@ abstract class Registry extends ActiveRegistry implements Registryinterface
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return self
* @since 3.2.0
* @since 3.2.0
*/
public function remove(string $path): self
{
@ -129,7 +350,7 @@ abstract class Registry extends ActiveRegistry implements Registryinterface
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return bool True if the location exists, false otherwise.
* @since 3.2.0
* @since 3.2.0
*/
public function exists(string $path): bool
{
@ -141,13 +362,308 @@ abstract class Registry extends ActiveRegistry implements Registryinterface
return $this->existsActive(...$keys);
}
/**
* Specify data which should be serialized to JSON.
*
* @return mixed Data which can be serialized by json_encode(),
* which is a value of any type other than a resource.
* @since 5.0.4
*/
public function jsonSerialize(): mixed
{
return $this->active;
}
/**
* Count elements of the registry.
*
* @return int The number of elements in the registry.
* @since 5.0.4
*/
public function count(): int
{
return count($this->active);
}
/**
* Whether a given offset exists in the registry.
*
* @param mixed $offset An offset to check for.
*
* @return bool True if the offset exists, false otherwise.
* @since 5.0.4
*/
public function offsetExists(mixed $offset): bool
{
if (!is_string($offset))
{
return false;
}
return $this->exists($offset);
}
/**
* Retrieve the value at a given offset.
*
* @param mixed $offset The offset to retrieve.
*
* @return mixed The value at the specified offset.
* @since 5.0.4
*/
public function offsetGet(mixed $offset): mixed
{
if (!is_string($offset))
{
return null;
}
return $this->get($offset);
}
/**
* Set the value at a given offset.
*
* @param mixed $offset The offset to assign the value to.
* @param mixed $value The value to set.
*
* @return void
* @since 5.0.4
*/
public function offsetSet(mixed $offset, mixed $value): void
{
if (!is_string($offset))
{
return;
}
$this->set($offset, $value);
}
/**
* Unset the value at a given offset.