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. - 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! 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) > 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) + *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io)
+ *Name*: [Component Builder](https://git.vdm.dev/joomla/Component-Builder) + *Name*: [Component Builder](https://git.vdm.dev/joomla/Component-Builder)
+ *First Build*: 30th April, 2015 + *First Build*: 30th April, 2015
+ *Last Build*: 7th November, 2024 + *Last Build*: 16th December, 2024
+ *Version*: 3.2.5-beta1 + *Version*: 3.2.5-beta2
+ *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*: **864927** + *Line count*: **884672**
+ *Field count*: **2098** + *Field count*: **2098**
+ *File count*: **5860** + *File count*: **5978**
+ *Folder count*: **505** + *Folder count*: **507**
> This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](https://www.joomlacomponentbuilder.com). > 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) > 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! 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) > 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) + *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io)
+ *Name*: [Component Builder](https://git.vdm.dev/joomla/Component-Builder) + *Name*: [Component Builder](https://git.vdm.dev/joomla/Component-Builder)
+ *First Build*: 30th April, 2015 + *First Build*: 30th April, 2015
+ *Last Build*: 7th November, 2024 + *Last Build*: 16th December, 2024
+ *Version*: 3.2.5-beta1 + *Version*: 3.2.5-beta2
+ *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*: **864927** + *Line count*: **884672**
+ *Field count*: **2098** + *Field count*: **2098**
+ *File count*: **5860** + *File count*: **5978**
+ *Folder count*: **505** + *Folder count*: **507**
> This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](https://www.joomlacomponentbuilder.com). > 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) > 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; $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; ?>"> <table id="<?php echo $table_id; ?>" class="<?php echo $table_class; ?>">
<thead> <thead>
<?php if (is_array($headers)): ?> <?php if (is_array($headers)): ?>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -16,6 +16,7 @@ use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text; use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper as Html; use Joomla\CMS\HTML\HTMLHelper as Html;
use VDM\Joomla\Utilities\StringHelper; use VDM\Joomla\Utilities\StringHelper;
use Joomla\CMS\Uri\Uri;
// import the list field type // import the list field type
jimport('joomla.form.helper'); jimport('joomla.form.helper');
@ -69,7 +70,7 @@ class JFormFieldSnippets extends JFormFieldList
$ref = '&amp;ref=' . $values['view'] . '&amp;refid=' . $values['id']; $ref = '&amp;ref=' . $values['view'] . '&amp;refid=' . $values['id'];
$refJ = '&ref=' . $values['view'] . '&refid=' . $values['id']; $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
// get the return value. // get the return value.
$_uri = (string) \Joomla\CMS\Uri\Uri::getInstance(); $_uri = (string) Uri::getInstance();
$_return = urlencode(base64_encode($_uri)); $_return = urlencode(base64_encode($_uri));
// load return value. // load return value.
$ref .= '&amp;return=' . $_return; $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"?> <?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.10" method="upgrade"> <extension type="component" version="3.10" method="upgrade">
<name>COM_COMPONENTBUILDER</name> <name>COM_COMPONENTBUILDER</name>
<creationDate>7th November, 2024</creationDate> <creationDate>16th December, 2024</creationDate>
<author>Llewellyn van der Merwe</author> <author>Llewellyn van der Merwe</author>
<authorEmail>joomla@vdm.io</authorEmail> <authorEmail>joomla@vdm.io</authorEmail>
<authorUrl>https://dev.vdm.io</authorUrl> <authorUrl>https://dev.vdm.io</authorUrl>
<copyright>Copyright (C) 2015 Vast Development Method. All rights reserved.</copyright> <copyright>Copyright (C) 2015 Vast Development Method. All rights reserved.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license> <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[ <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> <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. <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> <element>pkg_component_builder</element>
<type>package</type> <type>package</type>
<client>site</client> <client>site</client>
<version>3.2.5-beta1</version> <version>3.2.5-beta</version>
<infourl title="Component Builder!">https://dev.vdm.io</infourl> <infourl title="Component Builder!">https://dev.vdm.io</infourl>
<downloads> <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> </downloads>
<tags> <tags>
<tag>beta</tag> <tag>beta</tag>

View File

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

View File

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

View File

@ -12,41 +12,17 @@
namespace VDM\Joomla\Abstraction; namespace VDM\Joomla\Abstraction;
use Joomla\Registry\Registry as JoomlaRegistry;
use VDM\Joomla\Utilities\String\ClassfunctionHelper; 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 * getting any valid value
* *
@ -76,7 +52,7 @@ abstract class BaseConfig extends JoomlaRegistry
* *
* @since 3.2.0 * @since 3.2.0
*/ */
public function get($path, $default = null) public function get(string $path, $default = null): mixed
{ {
// function name with no underscores // function name with no underscores
$method = 'get' . ucfirst((string) ClassfunctionHelper::safe(str_replace('_', '', $path))); $method = 'get' . ucfirst((string) ClassfunctionHelper::safe(str_replace('_', '', $path)));
@ -86,7 +62,8 @@ abstract class BaseConfig extends JoomlaRegistry
{ {
return $value; 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); $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 string $path Parent registry Path (e.g. joomla.content.showauthor)
* @param mixed $value Value of entry * @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 * @since 3.2.0
*/ */
public function appendArray(string $path, $value) public function appendArray(string $path, $value)
{ {
// check if it does not exist return $this->add($path, $value, true)->get($path);
if (!$this->exists($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\Filesystem\Folder;
use Joomla\CMS\Application\CMSApplication; use Joomla\CMS\Application\CMSApplication;
use VDM\Joomla\Gitea\Repository\Contents; 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\FileHelper;
use VDM\Joomla\Utilities\JsonHelper; use VDM\Joomla\Utilities\JsonHelper;
use VDM\Joomla\Interfaces\GrepInterface; use VDM\Joomla\Interfaces\GrepInterface;
@ -50,6 +52,14 @@ abstract class Grep implements GrepInterface
**/ **/
public ?array $paths; public ?array $paths;
/**
* The Grep target [network]
*
* @var string
* @since 5.0.4
**/
protected ?string $target = null;
/** /**
* Order of global search * Order of global search
* *
@ -82,6 +92,14 @@ abstract class Grep implements GrepInterface
*/ */
protected string $index_path = 'index.json'; 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 * Gitea Repository Contents
* *
@ -90,6 +108,14 @@ abstract class Grep implements GrepInterface
**/ **/
protected Contents $contents; protected Contents $contents;
/**
* The Resolve Class.
*
* @var Resolve
* @since 5.0.4
*/
protected Resolve $resolve;
/** /**
* Joomla Application object * Joomla Application object
* *
@ -101,17 +127,22 @@ abstract class Grep implements GrepInterface
/** /**
* Constructor. * Constructor.
* *
* @param Contents $contents The Gitea Repository Contents object. * @param Contents $contents The Gitea Repository Contents object.
* @param array $paths The approved paths * @param Resolve $resolve The Resolve Class.
* @param string|null $path The local path * @param array $paths The approved paths
* @param CMSApplication|null $app The CMS Application object. * @param string|null $path The local path
* @param CMSApplication|null $app The CMS Application object.
* *
* @throws \Exception * @throws \Exception
* @since 3.2.0 * @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->contents = $contents;
$this->resolve = $resolve;
$this->paths = $paths; $this->paths = $paths;
$this->path = $path; $this->path = $path;
$this->app = $app ?: Factory::getApplication(); $this->app = $app ?: Factory::getApplication();
@ -264,6 +295,38 @@ abstract class Grep implements GrepInterface
return null; 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. * Set repository messages and errors based on given conditions.
* *
@ -584,7 +647,7 @@ abstract class Grep implements GrepInterface
try try
{ {
// load the base and token if set // 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)); $path->index = $this->contents->get($path->organisation, $path->repository, $this->getIndexPath(), $this->getBranchName($path));
} }
catch (\Exception $e) catch (\Exception $e)
@ -640,6 +703,12 @@ abstract class Grep implements GrepInterface
if (isset($path->organisation) && strlen($path->organisation) > 1 && if (isset($path->organisation) && strlen($path->organisation) > 1 &&
isset($path->repository) && strlen($path->repository) > 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 // build the path
$path->path = trim($path->organisation) . '/' . trim($path->repository); $path->path = trim($path->organisation) . '/' . trim($path->repository);

View File

@ -12,6 +12,7 @@
namespace VDM\Joomla\Abstraction; namespace VDM\Joomla\Abstraction;
use Joomla\Registry\Factory as FormatFactory;
use VDM\Joomla\Interfaces\Registryinterface; use VDM\Joomla\Interfaces\Registryinterface;
use VDM\Joomla\Abstraction\ActiveRegistry; 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. * 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 * Path separator
* *
* @var string|null * @var string|null
* @since 3.2.0 * @since 3.2.0
*/ */
protected ?string $separator = '.'; 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. * 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. * @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return self * @return self
* @since 3.2.0 * @since 3.2.0
*/ */
public function set(string $path, $value): self 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. * @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return self * @return self
* @since 3.2.0 * @since 3.2.0
*/ */
public function add(string $path, $value, ?bool $asArray = null): self 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. * @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. * @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) 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. * @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return self * @return self
* @since 3.2.0 * @since 3.2.0
*/ */
public function remove(string $path): self 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. * @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return bool True if the location exists, false otherwise. * @return bool True if the location exists, false otherwise.
* @since 3.2.0 * @since 3.2.0
*/ */
public function exists(string $path): bool public function exists(string $path): bool
{ {
@ -141,13 +362,308 @@ abstract class Registry extends ActiveRegistry implements Registryinterface
return $this->existsActive(...$keys); 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.
*
* @param mixed $offset The offset to unset.
*
* @return void
* @since 5.0.4
*/
public function offsetUnset(mixed $offset): void
{
if (!is_string($offset))
{
return;
}
$this->remove($offset);
}
/**
* Retrieve an external iterator for the registry.
*
* @return \Traversable An instance of an object implementing Iterator or Traversable.
* @since 5.0.4
*/
public function getIterator(): \Traversable
{
return new \ArrayIterator($this->active);
}
/**
* Get the registry data as an associative array.
*
* @return array The registry data.
* @since 5.0.4
*/
public function toArray(): array
{
return $this->active;
}
/**
* Get the registry data as an object.
*
* @return object The registry data converted to an object.
* @since 5.0.4
*/
public function toObject()
{
return $this->arrayToObject($this->active);
}
/**
* Converts the registry data to a string in the specified format.
*
* @param string $format The format to output the string in. Supported formats: 'json', 'ini', 'xml', 'php'.
* @param array $options Options used by the formatter.
*
* @return string The registry data in the specified format.
*
* @throws \InvalidArgumentException If the format is not supported.
* @since 5.0.4
*/
public function toString(string $format = 'JSON', array $options = []): string
{
// Convert the internal array to an object
$object = $this->arrayToObject($this->active);
return FormatFactory::getFormat($format, $options)->objectToString($object, $options);
}
/**
* Flattens the registry data into a one-dimensional array.
*
* @param string|null $separator The separator for the key names.
* @param bool $full True to include the full path as keys.
*
* @return array The flattened data array.
* @since 5.0.4
*/
public function flatten(?string $separator = null, bool $full = false): array
{
// we use default separator
if ($separator === null)
{
$separator = $this->separator;
}
return $this->flattenArray($this->active, $separator, $full);
}
/**
* Sets a default value if not already set.
*
* @param string $path The registry path (e.g., 'vdm.content.builder').
* @param mixed $default The default value to set if the path does not exist.
*
* @return mixed The value of the path after the method call.
* @since 5.0.4
*/
public function def(string $path, $default)
{
if (!$this->exists($path))
{
$this->set($path, $default);
return $default;
}
return $this->get($path);
}
/**
* Merges another registry into this one.
*
* The data from the source registry will be merged into this registry,
* overwriting any existing values with the same keys.
*
* @param Registryinterface $source The registry to merge with this one.
*
* @return self
* @since 5.0.4
*/
public function merge(Registryinterface $source): self
{
$this->active = $this->arrayMergeRecursive($this->active, $source->toArray());
return $this;
}
/**
* Clears all data from the registry.
*
* @return self
* @since 5.0.4
*/
public function clear(): self
{
$this->active = [];
return $this;
}
/**
* Extracts a subset of the registry data based on a given path.
*
* @param string $path The registry path to extract.
* @param mixed $default Optional default value, returned if the path does not exist.
* @param string|null $separator The path separator.
*
* @return self A new Registry instance with the extracted data.
* @since 5.0.4
*/
public function extract(string $path, $default = null, ?string $separator = null): self
{
$originalSeparator = $this->getSeparator();
if ($separator !== null)
{
$this->setSeparator($separator);
}
$data = $this->get($path, $default);
if ($separator !== null)
{
$this->setSeparator($originalSeparator);
}
$newRegistry = new static();
if ($data !== $default)
{
if (is_array($data))
{
$newRegistry->loadArray($data);
}
else
{
$newRegistry->set('value', $data);
}
}
return $newRegistry;
}
/**
* Appends content into the registry.
*
* If a key exists, the value will be appended to the existing value.
*
* @param string $path The registry path (e.g., 'vdm.content.builder').
* @param mixed $value The value to append.
*
* @return self
* @since 5.0.4
*/
public function append(string $path, $value): self
{
return $this->add($path, $value, false);
}
/**
* Gets the name of the registry.
*
* @return string|null The name of the registry.
* @since 5.0.4
*/
public function getName(): ?string
{
return $this->name;
}
/**
* Sets the name of the registry.
*
* @param string|null $name The name to set.
*
* @return self
* @since 5.0.4
*/
public function setName(?string $name): self
{
$this->name = $name;
return $this;
}
/** /**
* Sets a separator value * Sets a separator value
* *
* @param string|null $value The value to set. * @param string|null $value The value to set.
* *
* @return self * @return self
* @since 3.2.0 * @since 3.2.0
*/ */
public function setSeparator(?string $value): self public function setSeparator(?string $value): self
{ {
@ -156,13 +672,140 @@ abstract class Registry extends ActiveRegistry implements Registryinterface
return $this; return $this;
} }
/**
* Gets the current path separator used in registry paths.
*
* @return string|null The path separator.
* @since 5.0.4
*/
public function getSeparator(): ?string
{
return $this->separator;
}
/**
* Recursively converts an array to an object.
*
* This method is used to convert the internal array data into an object
* structure suitable for serialization or other operations that require objects.
*
* @param mixed $data The data to convert.
*
* @return mixed The converted object, or the original data if not an array.
* @since 5.0.4
*/
protected function arrayToObject($data)
{
if (is_array($data))
{
$object = new \stdClass();
foreach ($data as $key => $value)
{
// Handle numeric keys for object properties
if (is_numeric($key))
{
$key = 'item' . $key;
}
$object->{$key} = $this->arrayToObject($value);
}
return $object;
}
else
{
return $data;
}
}
/**
* Recursively converts an object to an array.
*
* This method is used to convert data loaded from formats that produce objects
* (e.g., JSON, XML) into an array structure for internal storage.
*
* @param mixed $data The data to convert.
*
* @return mixed The converted array, or the original data if not an object.
* @since 5.0.4
*/
protected function objectToArray($data)
{
return json_decode(json_encode($data), true);
}
/**
* Recursively merges two arrays.
*
* This method merges the elements of two arrays together so that the values of one
* are appended to the end of the previous one. It preserves numeric keys.
*
* @param array $array1 The array to merge into.
* @param array $array2 The array to merge from.
*
* @return array The merged array.
* @since 5.0.4
*/
protected function arrayMergeRecursive(array $array1, array $array2): array
{
foreach ($array2 as $key => $value)
{
// If the value is an array and the key exists in both arrays, merge recursively
if (is_array($value) && isset($array1[$key]) && is_array($array1[$key]))
{
$array1[$key] = $this->arrayMergeRecursive($array1[$key], $value);
}
else
{
// Otherwise, replace or set the value
$array1[$key] = $value;
}
}
return $array1;
}
/**
* Helper function to recursively flatten the array.
*
* @param array $array The array to flatten.
* @param string $separator The separator for the key names.
* @param bool $full True to include the full path as keys.
* @param array $flattened The flattened array (used internally for recursion).
* @param string $path The current path (used internally for recursion).
*
* @return array The flattened array.
* @since 5.0.4
*/
protected function flattenArray(array $array, string $separator, bool $full, array $flattened = [], string $path = ''): array
{
foreach ($array as $key => $value)
{
if ($full)
{
$newPath = $path === '' ? $key : $path . $separator . $key;
}
else
{
$newPath = $key;
}
if (is_array($value))
{
$flattened = $this->flattenArray($value, $separator, $full, $flattened, $newPath);
}
else
{
$flattened[$newPath] = $value;
}
}
return $flattened;
}
/** /**
* Get that the active keys from a path * Get that the active keys from a path
* *
* @param string $path The path to determine the location registry. * @param string $path The path to determine the location registry.
* *
* @return array|null The valid array of keys * @return array|null The valid array of keys
* @since 3.2.0 * @since 3.2.0
*/ */
protected function getActiveKeys(string $path): ?array protected function getActiveKeys(string $path): ?array
{ {

View File

@ -13,11 +13,12 @@ namespace VDM\Joomla\Abstraction\Registry\Traits;
/** /**
* Count Values * Count Values in a Path
* *
* @since 3.2.0 * @since 3.2.0
* @since 5.0.2 name changed to PathCount to avoid collusion in core registry class
*/ */
trait Count trait PathCount
{ {
/** /**
* Retrieves number of values (or sub-array) from the storage using multiple keys. * Retrieves number of values (or sub-array) from the storage using multiple keys.
@ -28,7 +29,7 @@ trait Count
* @return int The number of values * @return int The number of values
* @since 3.2.0 * @since 3.2.0
*/ */
public function count(string $path): int public function pathCount(string $path): int
{ {
if (($values = $this->get($path)) === null) if (($values = $this->get($path)) === null)
{ {

View File

@ -13,11 +13,12 @@ namespace VDM\Joomla\Abstraction\Registry\Traits;
/** /**
* To String Values * Path To String Values
* *
* @since 3.2.0 * @since 3.2.0
* @since 5.0.2 name changed to PathToString to avoid collusion in core registry class
*/ */
trait ToString trait PathToString
{ {
/** /**
* Convert an array of values to a string (or return string) * Convert an array of values to a string (or return string)
@ -26,9 +27,9 @@ trait ToString
* @param string $seperator Return string separator * @param string $seperator Return string separator
* *
* @return string * @return string
* @since 3.2.0 * @since 3.2.0
*/ */
public function toString(string $path, string $separator = ''): string public function pathToString(string $path, string $separator = ''): string
{ {
// Return default value if path is empty // Return default value if path is empty
if (empty($path)) if (empty($path))

View File

@ -416,6 +416,8 @@ abstract class Set implements SetInterface
$settings = $this->mergeIndexSettings($repoGuid, $settings); $settings = $this->mergeIndexSettings($repoGuid, $settings);
$this->grep->loadApi($this->git, $repo->base ?? null, $repo->token ?? null);
$this->updateIndexMainFile( $this->updateIndexMainFile(
$repo, $repo,
$this->getIndexSettingsPath(), $this->getIndexSettingsPath(),
@ -429,6 +431,8 @@ abstract class Set implements SetInterface
$this->mainReadme->get($settings), $this->mainReadme->get($settings),
'Update main readme file' 'Update main readme file'
); );
$this->git->reset_();
} }
/** /**
@ -580,7 +584,7 @@ abstract class Set implements SetInterface
$this->setRepoPlaceholders($repo); $this->setRepoPlaceholders($repo);
$this->git->load_($repo->base ?? null, $repo->token ?? null); $this->grep->loadApi($this->git, $repo->base ?? null, $repo->token ?? null);
if (($existing = $this->grep->get($item->guid, ['remote'], $repo)) !== null) if (($existing = $this->grep->get($item->guid, ['remote'], $repo)) !== null)
{ {

View File

@ -0,0 +1,67 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/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\Componentbuilder\Abstraction;
use VDM\Joomla\Componentbuilder\Utilities\Http;
use VDM\Joomla\Componentbuilder\Utilities\Uri;
use VDM\Joomla\Componentbuilder\Utilities\Response;
/**
* The Joomla Component Builder Api
*
* @since 5.0.4
*/
abstract class Api
{
/**
* The Http Class.
*
* @var Http
* @since 5.0.4
*/
protected Http $http;
/**
* The Uri Class.
*
* @var Uri
* @since 5.0.4
*/
protected Uri $uri;
/**
* The Response Class.
*
* @var Response
* @since 5.0.4
*/
protected Response $response;
/**
* Constructor.
*
* @param Http $http The Http Class.
* @param Uri $uri The Uri Class.
* @param Response $response The Response Class.
*
* @since 5.0.4
*/
public function __construct(Http $http, Uri $uri, Response $response)
{
$this->http = $http;
$this->uri = $uri;
$this->response = $response;
}
}

View File

@ -17,18 +17,18 @@ use Joomla\CMS\Factory;
use Joomla\Input\Input; use Joomla\Input\Input;
use VDM\Joomla\Utilities\Component\Helper; use VDM\Joomla\Utilities\Component\Helper;
use VDM\Joomla\Utilities\String\ClassfunctionHelper; use VDM\Joomla\Utilities\String\ClassfunctionHelper;
use VDM\Joomla\Abstraction\BaseConfig as ExtendingBaseConfig; use VDM\Joomla\Abstraction\FunctionRegistry;
/** /**
* Config * Component Configurations
* *
* @since 3.2.0 * @since 3.2.0
*/ */
abstract class BaseConfig extends ExtendingBaseConfig abstract class ComponentConfig extends FunctionRegistry
{ {
/** /**
* Hold a JInput object for easier access to the input variables. * Hold a Input object for easier access to the input variables.
* *
* @var Input * @var Input
* @since 3.2.0 * @since 3.2.0
@ -56,9 +56,6 @@ abstract class BaseConfig extends ExtendingBaseConfig
{ {
$this->input = $input ?: Factory::getApplication()->input; $this->input = $input ?: Factory::getApplication()->input;
$this->params = $params ?: Helper::getParams('com_componentbuilder'); $this->params = $params ?: Helper::getParams('com_componentbuilder');
// run parent constructor
parent::__construct();
} }
} }

View File

@ -0,0 +1,59 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/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\Componentbuilder\Api;
use VDM\Joomla\Componentbuilder\Abstraction\Api;
/**
* The Joomla Component Builder Network Api
*
* @since 5.0.4
*/
final class Network extends Api
{
/**
* Get the network repository statuses
*
* @param string|null $target The target repositories.
* @param int|null $status The repository status.
* @param string $project The network project. (default: jcb)
* @param string $system The network system. (default: community)
*
* @return object|null The set of status values
* @since 5.0.4
**/
public function get(?string $target = null, ?int $status = null, string $project = 'jcb', string $system = 'community'): ?object
{
// Build the request path.
$path = "/network/{$system}/{$project}";
if (!empty($target))
{
$path .= "/{$target}";
}
if (!empty($status))
{
$path .= "/{$status}";
}
// Send the get request.
return $this->response->get(
$this->http->get(
$this->uri->get($path)
)
);
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -47,6 +47,14 @@ use VDM\Joomla\Utilities\ArrayHelper;
*/ */
class Data class Data
{ {
/**
* The cache
*
* @var array
* @since 3.2.0
*/
protected array $data;
/** /**
* The Config Class. * The Config Class.
* *

View File

@ -12,7 +12,7 @@
namespace VDM\Joomla\Componentbuilder\Compiler\Builder; namespace VDM\Joomla\Componentbuilder\Compiler\Builder;
use VDM\Joomla\Abstraction\Registry\Traits\ToString; use VDM\Joomla\Abstraction\Registry\Traits\PathToString;
use VDM\Joomla\Interfaces\Registryinterface; use VDM\Joomla\Interfaces\Registryinterface;
use VDM\Joomla\Abstraction\Registry; use VDM\Joomla\Abstraction\Registry;
@ -25,10 +25,10 @@ use VDM\Joomla\Abstraction\Registry;
final class CustomFieldLinks extends Registry implements Registryinterface final class CustomFieldLinks extends Registry implements Registryinterface
{ {
/** /**
* To String Values * Path To String Values
* *
* @since 3.2.0 * @since 3.2.0
*/ */
use ToString; use PathToString;
} }

View File

@ -12,7 +12,7 @@
namespace VDM\Joomla\Componentbuilder\Compiler\Builder; namespace VDM\Joomla\Componentbuilder\Compiler\Builder;
use VDM\Joomla\Abstraction\Registry\Traits\ToString; use VDM\Joomla\Abstraction\Registry\Traits\PathToString;
use VDM\Joomla\Interfaces\Registryinterface; use VDM\Joomla\Interfaces\Registryinterface;
use VDM\Joomla\Abstraction\Registry; use VDM\Joomla\Abstraction\Registry;
@ -25,10 +25,10 @@ use VDM\Joomla\Abstraction\Registry;
final class DynamicFields extends Registry implements Registryinterface final class DynamicFields extends Registry implements Registryinterface
{ {
/** /**
* To String Values * Path To String Values
* *
* @since 3.2.0 * @since 3.2.0
*/ */
use ToString; use PathToString;
} }

View File

@ -12,7 +12,7 @@
namespace VDM\Joomla\Componentbuilder\Compiler\Builder; namespace VDM\Joomla\Componentbuilder\Compiler\Builder;
use VDM\Joomla\Abstraction\Registry\Traits\ToString; use VDM\Joomla\Abstraction\Registry\Traits\PathToString;
use VDM\Joomla\Interfaces\Registryinterface; use VDM\Joomla\Interfaces\Registryinterface;
use VDM\Joomla\Abstraction\Registry; use VDM\Joomla\Abstraction\Registry;
@ -25,10 +25,10 @@ use VDM\Joomla\Abstraction\Registry;
final class HiddenFields extends Registry implements Registryinterface final class HiddenFields extends Registry implements Registryinterface
{ {
/** /**
* To String Values * Path To String Values
* *
* @since 3.2.0 * @since 3.2.0
*/ */
use ToString; use PathToString;
} }

View File

@ -12,7 +12,7 @@
namespace VDM\Joomla\Componentbuilder\Compiler\Builder; namespace VDM\Joomla\Componentbuilder\Compiler\Builder;
use VDM\Joomla\Abstraction\Registry\Traits\ToString; use VDM\Joomla\Abstraction\Registry\Traits\PathToString;
use VDM\Joomla\Interfaces\Registryinterface; use VDM\Joomla\Interfaces\Registryinterface;
use VDM\Joomla\Abstraction\Registry; use VDM\Joomla\Abstraction\Registry;
@ -25,10 +25,10 @@ use VDM\Joomla\Abstraction\Registry;
final class IntegerFields extends Registry implements Registryinterface final class IntegerFields extends Registry implements Registryinterface
{ {
/** /**
* To String Values * Path To String Values
* *
* @since 3.2.0 * @since 3.2.0
*/ */
use ToString; use PathToString;
} }

View File

@ -12,7 +12,7 @@
namespace VDM\Joomla\Componentbuilder\Compiler\Builder; namespace VDM\Joomla\Componentbuilder\Compiler\Builder;
use VDM\Joomla\Abstraction\Registry\Traits\Count; use VDM\Joomla\Abstraction\Registry\Traits\PathCount;
use VDM\Joomla\Interfaces\Registryinterface; use VDM\Joomla\Interfaces\Registryinterface;
use VDM\Joomla\Abstraction\Registry; use VDM\Joomla\Abstraction\Registry;
@ -25,10 +25,10 @@ use VDM\Joomla\Abstraction\Registry;
final class Layout extends Registry implements Registryinterface final class Layout extends Registry implements Registryinterface
{ {
/** /**
* Count Values * Path Count Values
* *
* @since 3.2.0 * @since 3.2.0
*/ */
use Count; use PathCount;
} }

View File

@ -12,7 +12,7 @@
namespace VDM\Joomla\Componentbuilder\Compiler\Builder; namespace VDM\Joomla\Componentbuilder\Compiler\Builder;
use VDM\Joomla\Abstraction\Registry\Traits\Count; use VDM\Joomla\Abstraction\Registry\Traits\PathCount;
use VDM\Joomla\Interfaces\Registryinterface; use VDM\Joomla\Interfaces\Registryinterface;
use VDM\Joomla\Abstraction\Registry; use VDM\Joomla\Abstraction\Registry;
@ -25,10 +25,10 @@ use VDM\Joomla\Abstraction\Registry;
final class NewPublishingFields extends Registry implements Registryinterface final class NewPublishingFields extends Registry implements Registryinterface
{ {
/** /**
* Count Values * Path Count Values
* *
* @since 3.2.0 * @since 3.2.0
*/ */
use Count; use PathCount;
} }

View File

@ -18,7 +18,7 @@ use Joomla\Input\Input;
use VDM\Joomla\Utilities\GetHelper; use VDM\Joomla\Utilities\GetHelper;
use VDM\Joomla\Utilities\StringHelper; use VDM\Joomla\Utilities\StringHelper;
use VDM\Joomla\Componentbuilder\Utilities\RepoHelper; use VDM\Joomla\Componentbuilder\Utilities\RepoHelper;
use VDM\Joomla\Componentbuilder\Abstraction\BaseConfig; use VDM\Joomla\Componentbuilder\Abstraction\ComponentConfig;
/** /**
@ -32,7 +32,7 @@ use VDM\Joomla\Componentbuilder\Abstraction\BaseConfig;
* *
* @since 3.2.0 * @since 3.2.0
*/ */
class Config extends BaseConfig class Config extends ComponentConfig
{ {
/** /**
* The Global Joomla Configuration * The Global Joomla Configuration

View File

@ -139,7 +139,7 @@ final class Layout
if ($this->layout->exists($nameSingleCode . '.' . $tabName . '.' if ($this->layout->exists($nameSingleCode . '.' . $tabName . '.'
. $field['alignment'] . '.' . $field['order_edit'])) . $field['alignment'] . '.' . $field['order_edit']))
{ {
$size = $this->layout->count($nameSingleCode . '.' . $tabName . '.' $size = $this->layout->pathCount($nameSingleCode . '.' . $tabName . '.'
. $field['alignment']) + 1; . $field['alignment']) + 1;
while ($this->layout->exists($nameSingleCode . '.' . $tabName . '.' while ($this->layout->exists($nameSingleCode . '.' . $tabName . '.'
. $field['alignment'] . '.' . $size)) . $field['alignment'] . '.' . $size))
@ -168,7 +168,7 @@ final class Layout
if ($this->newpublishingfields->exists($nameSingleCode . '.' . if ($this->newpublishingfields->exists($nameSingleCode . '.' .
$field['alignment'] . '.' . $field['order_edit'])) $field['alignment'] . '.' . $field['order_edit']))
{ {
$size = $this->newpublishingfields->count($nameSingleCode . '.' . $size = $this->newpublishingfields->pathCount($nameSingleCode . '.' .
$field['alignment']) + 1; $field['alignment']) + 1;
while ($this->newpublishingfields->exists($nameSingleCode . '.' . while ($this->newpublishingfields->exists($nameSingleCode . '.' .
$field['alignment'] . '.' . $size)) $field['alignment'] . '.' . $size))
@ -191,7 +191,7 @@ final class Layout
if ($this->layout->exists($nameSingleCode . '.Details.' if ($this->layout->exists($nameSingleCode . '.Details.'
. $field['alignment'] . '.' . $field['order_edit'])) . $field['alignment'] . '.' . $field['order_edit']))
{ {
$size = $this->layout->count($nameSingleCode . '.Details.' $size = $this->layout->pathCount($nameSingleCode . '.Details.'
. $field['alignment']) + 1; . $field['alignment']) + 1;
while ($this->layout->exists($nameSingleCode . '.Details.' while ($this->layout->exists($nameSingleCode . '.Details.'
. $field['alignment'] . '.' . $size)) . $field['alignment'] . '.' . $size))

View File

@ -15,6 +15,8 @@ namespace VDM\Joomla\Componentbuilder\Compiler;
use Joomla\DI\Container; use Joomla\DI\Container;
use VDM\Joomla\Componentbuilder\Service\Crypt; use VDM\Joomla\Componentbuilder\Service\Crypt;
use VDM\Joomla\Componentbuilder\Service\Server; use VDM\Joomla\Componentbuilder\Service\Server;
use VDM\Joomla\Componentbuilder\Service\Api;
use VDM\Joomla\Componentbuilder\Service\Network;
use VDM\Joomla\Service\Database; use VDM\Joomla\Service\Database;
use VDM\Joomla\Service\Model as BaseModel; use VDM\Joomla\Service\Model as BaseModel;
use VDM\Joomla\Service\Data; use VDM\Joomla\Service\Data;
@ -124,6 +126,8 @@ abstract class Factory extends ExtendingFactory implements FactoryInterface
return (new Container()) return (new Container())
->registerServiceProvider(new Crypt()) ->registerServiceProvider(new Crypt())
->registerServiceProvider(new Server()) ->registerServiceProvider(new Server())
->registerServiceProvider(new Api())
->registerServiceProvider(new Network())
->registerServiceProvider(new Database()) ->registerServiceProvider(new Database())
->registerServiceProvider(new BaseModel()) ->registerServiceProvider(new BaseModel())
->registerServiceProvider(new Data()) ->registerServiceProvider(new Data())

View File

@ -181,7 +181,7 @@ final class InputButton implements InputButtonInterface
$addButton[] = Indent::_(4) . "//" . Line::_(__Line__, __Class__) $addButton[] = Indent::_(4) . "//" . Line::_(__Line__, __Class__)
. " get the return value."; . " get the return value.";
$addButton[] = Indent::_(4) $addButton[] = Indent::_(4)
. "\$_uri = (string) \Joomla\CMS\Uri\Uri::getInstance();"; . "\$_uri = (string) Joomla__"."_eecc143e_b5cf_4c33_ba4d_97da1df61422___Power::getInstance();";
$addButton[] = Indent::_(4) $addButton[] = Indent::_(4)
. "\$_return = urlencode(base64_encode(\$_uri));"; . "\$_return = urlencode(base64_encode(\$_uri));";
$addButton[] = Indent::_(4) . "//" . Line::_(__Line__, __Class__) $addButton[] = Indent::_(4) . "//" . Line::_(__Line__, __Class__)
@ -206,7 +206,7 @@ final class InputButton implements InputButtonInterface
$addButton[] = Indent::_(4) . "//" . Line::_(__Line__, __Class__) $addButton[] = Indent::_(4) . "//" . Line::_(__Line__, __Class__)
. " get the return value."; . " get the return value.";
$addButton[] = Indent::_(4) $addButton[] = Indent::_(4)
. "\$_uri = (string) \Joomla\CMS\Uri\Uri::getInstance();"; . "\$_uri = (string) Joomla__"."_eecc143e_b5cf_4c33_ba4d_97da1df61422___Power::getInstance();";
$addButton[] = Indent::_(4) $addButton[] = Indent::_(4)
. "\$_return = urlencode(base64_encode(\$_uri));"; . "\$_return = urlencode(base64_encode(\$_uri));";
$addButton[] = Indent::_(4) . "//" . Line::_(__Line__, __Class__) $addButton[] = Indent::_(4) . "//" . Line::_(__Line__, __Class__)

View File

@ -1510,7 +1510,7 @@ class Interpretation extends Fields
. "protected static function loadArticleLink(\$id)"; . "protected static function loadArticleLink(\$id)";
$help[] = Indent::_(1) . "{"; $help[] = Indent::_(1) . "{";
$help[] = Indent::_(2) $help[] = Indent::_(2)
. "return Uri::root() . 'index.php?option=com_content&view=article&id='.\$id.'&tmpl=component&layout=modal';"; . "return Joomla__"."_eecc143e_b5cf_4c33_ba4d_97da1df61422___Power::root() . 'index.php?option=com_content&view=article&id='.\$id.'&tmpl=component&layout=modal';";
$help[] = Indent::_(1) . "}"; $help[] = Indent::_(1) . "}";
$help[] = PHP_EOL . Indent::_(1) . "/**"; $help[] = PHP_EOL . Indent::_(1) . "/**";
$help[] = Indent::_(1) . " * Get the Help Text Link."; $help[] = Indent::_(1) . " * Get the Help Text Link.";
@ -1518,7 +1518,7 @@ class Interpretation extends Fields
$help[] = Indent::_(1) $help[] = Indent::_(1)
. "protected static function loadHelpTextLink(\$id)"; . "protected static function loadHelpTextLink(\$id)";
$help[] = Indent::_(1) . "{"; $help[] = Indent::_(1) . "{";
$help[] = Indent::_(2) . "\$token = Session::getFormToken();"; $help[] = Indent::_(2) . "\$token = Joomla__"."_5ba38513_5c4f_4b0d_935e_49e986a6bce8___Power::getFormToken();";
$help[] = Indent::_(2) . "return 'index.php?option=com_" $help[] = Indent::_(2) . "return 'index.php?option=com_"
. CFactory::_('Config')->component_code_name . CFactory::_('Config')->component_code_name
. "&task=help.getText&id=' . (int) \$id . '&' . \$token . '=1';"; . "&task=help.getText&id=' . (int) \$id . '&' . \$token . '=1';";
@ -3216,7 +3216,7 @@ class Interpretation extends Fields
$redirectMessage = Indent::_(3) . "//" . Line::_( $redirectMessage = Indent::_(3) . "//" . Line::_(
__LINE__,__CLASS__ __LINE__,__CLASS__
) . " redirect away to the home page if no access allowed."; ) . " redirect away to the home page if no access allowed.";
$redirectString = 'Uri::root()'; $redirectString = 'Joomla__'.'_eecc143e_b5cf_4c33_ba4d_97da1df61422___Power::root()';
} }
$accessCheck[] = PHP_EOL . Indent::_(2) . "//" . Line::_( $accessCheck[] = PHP_EOL . Indent::_(2) . "//" . Line::_(
__LINE__,__CLASS__ __LINE__,__CLASS__
@ -3398,7 +3398,7 @@ class Interpretation extends Fields
} }
else else
{ {
$redirectString = 'Uri::root()'; $redirectString = 'Joomla__'.'_eecc143e_b5cf_4c33_ba4d_97da1df61422___Power::root()';
} }
$getItem .= PHP_EOL . Indent::_(1) . $tab . Indent::_(2) $getItem .= PHP_EOL . Indent::_(1) . $tab . Indent::_(2)
. "\$app->redirect(" . $redirectString . ");"; . "\$app->redirect(" . $redirectString . ");";
@ -8549,10 +8549,10 @@ class Interpretation extends Fields
); );
$View = StringHelper::safe($view, 'F'); $View = StringHelper::safe($view, 'F');
$maintext = CFactory::_('Compiler.Builder.Main.Text.Field')->get($view, 'null'); $maintext = CFactory::_('Compiler.Builder.Main.Text.Field')->get($view, 'null');
$hiddenFields = CFactory::_('Compiler.Builder.Hidden.Fields')->toString($view, ''); $hiddenFields = CFactory::_('Compiler.Builder.Hidden.Fields')->pathToString($view, '');
$dynamicfields = CFactory::_('Compiler.Builder.Dynamic.Fields')->toString($view, ','); $dynamicfields = CFactory::_('Compiler.Builder.Dynamic.Fields')->pathToString($view, ',');
$intFields = CFactory::_('Compiler.Builder.Integer.Fields')->toString($view, ''); $intFields = CFactory::_('Compiler.Builder.Integer.Fields')->pathToString($view, '');
$customfieldlinks = CFactory::_('Compiler.Builder.Custom.Field.Links')->toString($view, ''); $customfieldlinks = CFactory::_('Compiler.Builder.Custom.Field.Links')->pathToString($view, '');
// build uninstall script for content types // build uninstall script for content types
$this->uninstallScriptBuilder[$View] = 'com_' . $component . '.' . $view; $this->uninstallScriptBuilder[$View] = 'com_' . $component . '.' . $view;
$this->uninstallScriptContent[$view] = $view; $this->uninstallScriptContent[$view] = $view;
@ -10037,14 +10037,30 @@ class Interpretation extends Fields
// check if default field was overwritten // check if default field was overwritten
if (!CFactory::_('Compiler.Builder.Field.Names')->isString($view . '.created_by')) if (!CFactory::_('Compiler.Builder.Field.Names')->isString($view . '.created_by'))
{ {
$db_ .= PHP_EOL . Indent::_(1) if (CFactory::_('Config')->get('joomla_version', 3) == 3)
. "`created_by` INT(10) unsigned NULL DEFAULT 0,"; {
$db_ .= PHP_EOL . Indent::_(1)
. "`created_by` INT(10) unsigned NULL DEFAULT 0,";
}
else
{
$db_ .= PHP_EOL . Indent::_(1)
. "`created_by` INT unsigned NULL,";
}
} }
// check if default field was overwritten // check if default field was overwritten
if (!CFactory::_('Compiler.Builder.Field.Names')->isString($view . '.modified_by')) if (!CFactory::_('Compiler.Builder.Field.Names')->isString($view . '.modified_by'))
{ {
$db_ .= PHP_EOL . Indent::_(1) if (CFactory::_('Config')->get('joomla_version', 3) == 3)
. "`modified_by` INT(10) unsigned NULL DEFAULT 0,"; {
$db_ .= PHP_EOL . Indent::_(1)
. "`modified_by` INT(10) unsigned NULL DEFAULT 0,";
}
else
{
$db_ .= PHP_EOL . Indent::_(1)
. "`modified_by` INT unsigned,";
}
} }
// check if default field was overwritten // check if default field was overwritten
if (!CFactory::_('Compiler.Builder.Field.Names')->isString($view . '.created')) if (!CFactory::_('Compiler.Builder.Field.Names')->isString($view . '.created'))
@ -10071,14 +10087,22 @@ class Interpretation extends Fields
else else
{ {
$db_ .= PHP_EOL . Indent::_(1) $db_ .= PHP_EOL . Indent::_(1)
. "`modified` DATETIME DEFAULT NULL,"; . "`modified` DATETIME,";
} }
} }
// check if default field was overwritten // check if default field was overwritten
if (!CFactory::_('Compiler.Builder.Field.Names')->isString($view . '.checked_out')) if (!CFactory::_('Compiler.Builder.Field.Names')->isString($view . '.checked_out'))
{ {
$db_ .= PHP_EOL . Indent::_(1) if (CFactory::_('Config')->get('joomla_version', 3) == 3)
. "`checked_out` int(11) unsigned NULL DEFAULT 0,"; {
$db_ .= PHP_EOL . Indent::_(1)
. "`checked_out` int(11) unsigned NULL DEFAULT 0,";
}
else
{
$db_ .= PHP_EOL . Indent::_(1)
. "`checked_out` int unsigned,";
}
} }
// check if default field was overwritten // check if default field was overwritten
if (!CFactory::_('Compiler.Builder.Field.Names')->isString($view . '.checked_out_time')) if (!CFactory::_('Compiler.Builder.Field.Names')->isString($view . '.checked_out_time'))
@ -10091,7 +10115,7 @@ class Interpretation extends Fields
else else
{ {
$db_ .= PHP_EOL . Indent::_(1) $db_ .= PHP_EOL . Indent::_(1)
. "`checked_out_time` DATETIME DEFAULT NULL,"; . "`checked_out_time` DATETIME,";
} }
} }
// check if default field was overwritten // check if default field was overwritten
@ -11077,9 +11101,9 @@ class Interpretation extends Fields
$body .= PHP_EOL . Indent::_(2) $body .= PHP_EOL . Indent::_(2)
. "\$userChkOut = Factory::getContainer()->"; . "\$userChkOut = Factory::getContainer()->";
$body .= PHP_EOL . Indent::_(3) $body .= PHP_EOL . Indent::_(3)
. "get(\Joomla\CMS\User\UserFactoryInterface::class)->"; . "get(Joomla__"."_c2980d12_c3ef_4e23_b4a2_e6af1f5900a9___Power::class)->";
$body .= PHP_EOL . Indent::_(4) $body .= PHP_EOL . Indent::_(4)
. "loadUserById(\$item->checked_out);"; . "loadUserById(\$item->checked_out ?? 0);";
} }
$body .= PHP_EOL . Indent::_(2) . "\$canDo = " . $Helper $body .= PHP_EOL . Indent::_(2) . "\$canDo = " . $Helper
. "::getActions('" . $nameSingleCode . "',\$item,'" . "::getActions('" . $nameSingleCode . "',\$item,'"
@ -11560,8 +11584,8 @@ class Interpretation extends Fields
else else
{ {
return 'Factory::getContainer()->' return 'Factory::getContainer()->'
. 'get(\Joomla\CMS\User\UserFactoryInterface::class)->' . 'get(Joomla__'.'_c2980d12_c3ef_4e23_b4a2_e6af1f5900a9___Power::class)->'
. 'loadUserById((int) $item->' . $item['code'] . ')->name'; . 'loadUserById((int) $item->' . $item['code'] . ' ?? 0)->name';
} }
} }
// check if custom user // check if custom user
@ -11577,8 +11601,8 @@ class Interpretation extends Fields
else else
{ {
return 'Factory::getContainer()->' return 'Factory::getContainer()->'
. 'get(\Joomla\CMS\User\UserFactoryInterface::class)->' . 'get(Joomla__'.'_c2980d12_c3ef_4e23_b4a2_e6af1f5900a9___Power::class)->'
. 'loadUserById((int) $item->' . $item['id_code'] . ')->name'; . 'loadUserById((int) $item->' . $item['id_code'] . ' ?? 0)->name';
} }
} }
// check if translated value is used // check if translated value is used
@ -11598,8 +11622,8 @@ class Interpretation extends Fields
else else
{ {
return 'Factory::getContainer()->' return 'Factory::getContainer()->'
. 'get(\Joomla\CMS\User\UserFactoryInterface::class)->' . 'get(Joomla__'.'_c2980d12_c3ef_4e23_b4a2_e6af1f5900a9___Power::class)->'
. 'loadUserById((int) $item->' . $item['code'] . ')->name'; . 'loadUserById((int) $item->' . $item['code'] . ' ?? 0)->name';
} }
} }
elseif ($doNotEscape) elseif ($doNotEscape)
@ -13708,9 +13732,9 @@ class Interpretation extends Fields
$body .= PHP_EOL . Indent::_(2) $body .= PHP_EOL . Indent::_(2)
. "\$userChkOut = Factory::getContainer()->"; . "\$userChkOut = Factory::getContainer()->";
$body .= PHP_EOL . Indent::_(3) $body .= PHP_EOL . Indent::_(3)
. "get(\Joomla\CMS\User\UserFactoryInterface::class)->"; . "get(Joomla__"."_c2980d12_c3ef_4e23_b4a2_e6af1f5900a9___Power::class)->";
$body .= PHP_EOL . Indent::_(4) $body .= PHP_EOL . Indent::_(4)
. "loadUserById(\$item->checked_out);"; . "loadUserById(\$item->checked_out ?? 0);";
} }
$body .= PHP_EOL . Indent::_(2) . "\$canDo = " . $Helper $body .= PHP_EOL . Indent::_(2) . "\$canDo = " . $Helper
. "::getActions('" . $nameSingleCode . "',\$item,'" . "::getActions('" . $nameSingleCode . "',\$item,'"
@ -14636,7 +14660,7 @@ class Interpretation extends Fields
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__) $method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
. " Check for request forgeries"; . " Check for request forgeries";
$method[] = Indent::_(2) $method[] = Indent::_(2)
. "Session::checkToken() or die(Text:" . "Joomla__"."_5ba38513_5c4f_4b0d_935e_49e986a6bce8___Power::checkToken() or die(Text:"
. ":_('JINVALID_TOKEN'));"; . ":_('JINVALID_TOKEN'));";
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__) $method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
. " check if export is allowed for this user."; . " check if export is allowed for this user.";
@ -14990,7 +15014,7 @@ class Interpretation extends Fields
$method[] = Indent::_(1) . "{"; $method[] = Indent::_(1) . "{";
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__) $method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
. " Check for request forgeries"; . " Check for request forgeries";
$method[] = Indent::_(2) . "Session::checkToken() or die(Text:" $method[] = Indent::_(2) . "Joomla__"."_5ba38513_5c4f_4b0d_935e_49e986a6bce8___Power::checkToken() or die(Text:"
. ":_('JINVALID_TOKEN'));"; . ":_('JINVALID_TOKEN'));";
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__) $method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
. " check if export is allowed for this user."; . " check if export is allowed for this user.";
@ -15058,7 +15082,7 @@ class Interpretation extends Fields
$method[] = Indent::_(1) . "{"; $method[] = Indent::_(1) . "{";
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__) $method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
. " Check for request forgeries"; . " Check for request forgeries";
$method[] = Indent::_(2) . "Session::checkToken() or die(Text:" $method[] = Indent::_(2) . "Joomla__"."_5ba38513_5c4f_4b0d_935e_49e986a6bce8___Power::checkToken() or die(Text:"
. ":_('JINVALID_TOKEN'));"; . ":_('JINVALID_TOKEN'));";
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__) $method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
. " check if import is allowed for this user."; . " check if import is allowed for this user.";
@ -17321,7 +17345,7 @@ class Interpretation extends Fields
$fix .= PHP_EOL . Indent::_(2) . "//" . Line::_(__Line__, __Class__) $fix .= PHP_EOL . Indent::_(2) . "//" . Line::_(__Line__, __Class__)
. " Add Ajax Token"; . " Add Ajax Token";
$fix .= PHP_EOL . Indent::_(2) $fix .= PHP_EOL . Indent::_(2)
. "\$this->getDocument()->addScriptDeclaration(\"var token = '\" . Session::getFormToken() . \"';\");"; . "\$this->getDocument()->addScriptDeclaration(\"var token = '\" . Joomla__"."_5ba38513_5c4f_4b0d_935e_49e986a6bce8___Power::getFormToken() . \"';\");";
} }
return $fix; return $fix;
@ -17880,12 +17904,10 @@ class Interpretation extends Fields
$function[] = Indent::_(5) $function[] = Indent::_(5)
. "Factory::getContainer()->"; . "Factory::getContainer()->";
$function[] = Indent::_(5) $function[] = Indent::_(5)
. "get(\Joomla\CMS\User\UserFactoryInterface::class)->"; . "get(Joomla__"."_c2980d12_c3ef_4e23_b4a2_e6af1f5900a9___Power::class)->";
$function[] = Indent::_(5) $function[] = Indent::_(5)
. "loadUserById(\$" . "loadUserById(\$" . $filter['code'] . " ?? 0)->name";
. $filter['code'] . ")->name"; $function[] = Indent::_(5) . ");";
$function[] = Indent::_(5)
. ");";
} }
} }
else else

View File

@ -32,6 +32,11 @@ class Whmcs
*/ */
public function set(object &$item) public function set(object &$item)
{ {
if (!isset($item->add_license))
{
return;
}
if (1 == $item->add_license if (1 == $item->add_license
&& (!isset($item->whmcs_buy_link) && (!isset($item->whmcs_buy_link)
|| !StringHelper::check( || !StringHelper::check(

View File

@ -101,6 +101,7 @@ class JoomlaPower implements ServiceProviderInterface
{ {
return new Grep( return new Grep(
$container->get('Gitea.Repository.Contents'), $container->get('Gitea.Repository.Contents'),
$container->get('Network.Resolve'),
$container->get('Config')->approved_joomla_paths $container->get('Config')->approved_joomla_paths
); );
} }

View File

@ -129,6 +129,7 @@ class Power implements ServiceProviderInterface
{ {
return new Grep( return new Grep(
$container->get('Gitea.Repository.Contents'), $container->get('Gitea.Repository.Contents'),
$container->get('Network.Resolve'),
$container->get('Config')->approved_paths, $container->get('Config')->approved_paths,
$container->get('Config')->local_powers_repository_path $container->get('Config')->local_powers_repository_path
); );

View File

@ -21,11 +21,14 @@ use VDM\Joomla\Componentbuilder\Compiler\Utilities\FileInjector;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Paths; use VDM\Joomla\Componentbuilder\Compiler\Utilities\Paths;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Counter; use VDM\Joomla\Componentbuilder\Compiler\Utilities\Counter;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Files; use VDM\Joomla\Componentbuilder\Compiler\Utilities\Files;
use VDM\Joomla\Componentbuilder\Utilities\Constantpaths;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Dynamicpath; use VDM\Joomla\Componentbuilder\Compiler\Utilities\Dynamicpath;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Pathfix; use VDM\Joomla\Componentbuilder\Compiler\Utilities\Pathfix;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Structure; use VDM\Joomla\Componentbuilder\Compiler\Utilities\Structure;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Xml; use VDM\Joomla\Componentbuilder\Compiler\Utilities\Xml;
use VDM\Joomla\Componentbuilder\Utilities\Constantpaths;
use VDM\Joomla\Componentbuilder\Utilities\Uri;
use VDM\Joomla\Componentbuilder\Utilities\Http;
use VDM\Joomla\Componentbuilder\Utilities\Response;
/** /**
@ -41,7 +44,7 @@ class Utilities implements ServiceProviderInterface
* @param Container $container The DI container. * @param Container $container The DI container.
* *
* @return void * @return void
* @since 3.2.0 * @since 3.2.0
*/ */
public function register(Container $container) public function register(Container $container)
{ {
@ -63,9 +66,6 @@ class Utilities implements ServiceProviderInterface
$container->alias(Files::class, 'Utilities.Files') $container->alias(Files::class, 'Utilities.Files')
->share('Utilities.Files', [$this, 'getFiles'], true); ->share('Utilities.Files', [$this, 'getFiles'], true);
$container->alias(Constantpaths::class, 'Utilities.Constantpaths')
->share('Utilities.Constantpaths', [$this, 'getConstantpaths'], true);
$container->alias(Dynamicpath::class, 'Utilities.Dynamicpath') $container->alias(Dynamicpath::class, 'Utilities.Dynamicpath')
->share('Utilities.Dynamicpath', [$this, 'getDynamicpath'], true); ->share('Utilities.Dynamicpath', [$this, 'getDynamicpath'], true);
@ -77,6 +77,18 @@ class Utilities implements ServiceProviderInterface
$container->alias(Xml::class, 'Utilities.Xml') $container->alias(Xml::class, 'Utilities.Xml')
->share('Utilities.Xml', [$this, 'getXml'], true); ->share('Utilities.Xml', [$this, 'getXml'], true);
$container->alias(Constantpaths::class, 'Utilities.Constantpaths')
->share('Utilities.Constantpaths', [$this, 'getConstantpaths'], true);
$container->alias(Uri::class, 'Utilities.Uri')
->share('Utilities.Uri', [$this, 'getUri'], true);
$container->alias(Http::class, 'Utilities.Http')
->share('Utilities.Http', [$this, 'getHttp'], true);
$container->alias(Response::class, 'Utilities.Response')
->share('Utilities.Response', [$this, 'getResponse'], true);
} }
/** /**
@ -85,7 +97,7 @@ class Utilities implements ServiceProviderInterface
* @param Container $container The DI container. * @param Container $container The DI container.
* *
* @return Folder * @return Folder
* @since 3.2.0 * @since 3.2.0
*/ */
public function getFolder(Container $container): Folder public function getFolder(Container $container): Folder
{ {
@ -101,7 +113,7 @@ class Utilities implements ServiceProviderInterface
* @param Container $container The DI container. * @param Container $container The DI container.
* *
* @return File * @return File
* @since 3.2.0 * @since 3.2.0
*/ */
public function getFile(Container $container): File public function getFile(Container $container): File
{ {
@ -116,7 +128,7 @@ class Utilities implements ServiceProviderInterface
* @param Container $container The DI container. * @param Container $container The DI container.
* *
* @return FileInjector * @return FileInjector
* @since 3.2.0 * @since 3.2.0
*/ */
public function getFileInjector(Container $container): FileInjector public function getFileInjector(Container $container): FileInjector
{ {
@ -132,7 +144,7 @@ class Utilities implements ServiceProviderInterface
* @param Container $container The DI container. * @param Container $container The DI container.
* *
* @return Counter * @return Counter
* @since 3.2.0 * @since 3.2.0
*/ */
public function getCounter(Container $container): Counter public function getCounter(Container $container): Counter
{ {
@ -147,7 +159,7 @@ class Utilities implements ServiceProviderInterface
* @param Container $container The DI container. * @param Container $container The DI container.
* *
* @return Paths * @return Paths
* @since 3.2.0 * @since 3.2.0
*/ */
public function getPaths(Container $container): Paths public function getPaths(Container $container): Paths
{ {
@ -163,33 +175,20 @@ class Utilities implements ServiceProviderInterface
* @param Container $container The DI container. * @param Container $container The DI container.
* *
* @return Files * @return Files
* @since 3.2.0 * @since 3.2.0
*/ */
public function getFiles(Container $container): Files public function getFiles(Container $container): Files
{ {
return new Files(); return new Files();
} }
/**
* Get the Constant Paths
*
* @param Container $container The DI container.
*
* @return Constantpaths
* @since 3.2.0
*/
public function getConstantpaths(Container $container): Constantpaths
{
return new Constantpaths();
}
/** /**
* Get the Compiler Dynamic Path * Get the Compiler Dynamic Path
* *
* @param Container $container The DI container. * @param Container $container The DI container.
* *
* @return Dynamicpath * @return Dynamicpath
* @since 3.2.0 * @since 3.2.0
*/ */
public function getDynamicpath(Container $container): Dynamicpath public function getDynamicpath(Container $container): Dynamicpath
{ {
@ -205,7 +204,7 @@ class Utilities implements ServiceProviderInterface
* @param Container $container The DI container. * @param Container $container The DI container.
* *
* @return Pathfix * @return Pathfix
* @since 3.2.0 * @since 3.2.0
*/ */
public function getPathfix(Container $container): Pathfix public function getPathfix(Container $container): Pathfix
{ {
@ -218,7 +217,7 @@ class Utilities implements ServiceProviderInterface
* @param Container $container The DI container. * @param Container $container The DI container.
* *
* @return Structure * @return Structure
* @since 3.2.0 * @since 3.2.0
*/ */
public function getStructure(Container $container): Structure public function getStructure(Container $container): Structure
{ {
@ -238,13 +237,65 @@ class Utilities implements ServiceProviderInterface
* @param Container $container The DI container. * @param Container $container The DI container.
* *
* @return Xml * @return Xml
* @since 3.2.0 * @since 3.2.0
*/ */
public function getXml(Container $container): Xml public function getXml(Container $container): Xml
{ {
return new Xml( return new Xml(
$container->get('Config') $container->get('Config')
); );
}
/**
* Get the Constant Paths
*
* @param Container $container The DI container.
*
* @return Constantpaths
* @since 3.2.0
*/
public function getConstantpaths(Container $container): Constantpaths
{
return new Constantpaths();
}
/**
* Get The Uri Class.
*
* @param Container $container The DI container.
*
* @return Uri
* @since 5.0.4
*/
public function getUri(Container $container): Uri
{
return new Uri();
}
/**
* Get The Http Class.
*
* @param Container $container The DI container.
*
* @return Http
* @since 5.0.4
*/
public function getHttp(Container $container): Http
{
return new Http();
}
/**
* Get The Response Class.
*
* @param Container $container The DI container.
*
* @return Response
* @since 5.0.4
*/
public function getResponse(Container $container): Response
{
return new Response();
} }
} }

View File

@ -75,13 +75,13 @@ class Paths extends Registry
/** /**
* getting any valid paths * getting any valid paths
* *
* @param string $key The value's key/path name * @param string $key The value's key/path name
* *
* @return string The path found as a string * @return string The path found as a string
* @since 3.2.0 * @since 3.2.0
* @throws \InvalidArgumentException If $key is not a valid function name. * @throws \InvalidArgumentException If $key is not a valid function name.
*/ */
public function __get(string $key): string public function __get($key)
{ {
// check if it has been set // check if it has been set
if ($this->exists($key)) if ($this->exists($key))

View File

@ -17,7 +17,7 @@ use Joomla\CMS\Factory as JoomlaFactory;
use VDM\Joomla\Utilities\GetHelper; use VDM\Joomla\Utilities\GetHelper;
use VDM\Joomla\Utilities\StringHelper; use VDM\Joomla\Utilities\StringHelper;
use VDM\Joomla\Componentbuilder\Utilities\RepoHelper; use VDM\Joomla\Componentbuilder\Utilities\RepoHelper;
use VDM\Joomla\Componentbuilder\Abstraction\BaseConfig; use VDM\Joomla\Componentbuilder\Abstraction\ComponentConfig;
/** /**
@ -31,7 +31,7 @@ use VDM\Joomla\Componentbuilder\Abstraction\BaseConfig;
* *
* @since 5.0.3 * @since 5.0.3
*/ */
class Config extends BaseConfig class Config extends ComponentConfig
{ {
/** /**
* The Global Joomla Configuration * The Global Joomla Configuration

View File

@ -20,6 +20,9 @@ use VDM\Joomla\Service\Data;
use VDM\Joomla\Componentbuilder\Service\Gitea; use VDM\Joomla\Componentbuilder\Service\Gitea;
use VDM\Joomla\Componentbuilder\Power\Service\Gitea as GiteaPower; use VDM\Joomla\Componentbuilder\Power\Service\Gitea as GiteaPower;
use VDM\Joomla\Gitea\Service\Utilities as GiteaUtilities; use VDM\Joomla\Gitea\Service\Utilities as GiteaUtilities;
use VDM\Joomla\Componentbuilder\Service\Api;
use VDM\Joomla\Componentbuilder\Service\Network;
use VDM\Joomla\Componentbuilder\Service\Utilities;
use VDM\Joomla\Interfaces\FactoryInterface; use VDM\Joomla\Interfaces\FactoryInterface;
use VDM\Joomla\Abstraction\Factory as ExtendingFactory; use VDM\Joomla\Abstraction\Factory as ExtendingFactory;
@ -54,7 +57,10 @@ abstract class Factory extends ExtendingFactory implements FactoryInterface
->registerServiceProvider(new Data()) ->registerServiceProvider(new Data())
->registerServiceProvider(new Gitea()) ->registerServiceProvider(new Gitea())
->registerServiceProvider(new GiteaPower()) ->registerServiceProvider(new GiteaPower())
->registerServiceProvider(new GiteaUtilities()); ->registerServiceProvider(new GiteaUtilities())
->registerServiceProvider(new Api())
->registerServiceProvider(new Network())
->registerServiceProvider(new Utilities());
} }
} }

View File

@ -29,6 +29,14 @@ use VDM\Joomla\Abstraction\Grep as ExtendingGrep;
*/ */
final class Grep extends ExtendingGrep implements GrepInterface final class Grep extends ExtendingGrep implements GrepInterface
{ {
/**
* The Grep target [network]
*
* @var string
* @since 5.0.4
**/
protected ?string $target = 'joomla-fieldtypes';
/** /**
* Order of global search * Order of global search
* *
@ -77,7 +85,7 @@ final class Grep extends ExtendingGrep implements GrepInterface
$branch = $this->getBranchName($path); $branch = $this->getBranchName($path);
// load the base and token if set // 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);
// get the settings // get the settings
if (($power = $this->loadRemoteFile($path->organisation, $path->repository, $path->index->{$guid}->path . '/item.json', $branch)) !== null && if (($power = $this->loadRemoteFile($path->organisation, $path->repository, $path->index->{$guid}->path . '/item.json', $branch)) !== null &&

View File

@ -100,6 +100,7 @@ class Fieldtype implements ServiceProviderInterface
{ {
return new Grep( return new Grep(
$container->get('Gitea.Repository.Contents'), $container->get('Gitea.Repository.Contents'),
$container->get('Network.Resolve'),
$container->get('Config')->approved_joomla_paths $container->get('Config')->approved_joomla_paths
); );
} }

View File

@ -17,7 +17,7 @@ use Joomla\CMS\Factory as JoomlaFactory;
use VDM\Joomla\Utilities\GetHelper; use VDM\Joomla\Utilities\GetHelper;
use VDM\Joomla\Utilities\StringHelper; use VDM\Joomla\Utilities\StringHelper;
use VDM\Joomla\Componentbuilder\Utilities\RepoHelper; use VDM\Joomla\Componentbuilder\Utilities\RepoHelper;
use VDM\Joomla\Componentbuilder\Abstraction\BaseConfig; use VDM\Joomla\Componentbuilder\Abstraction\ComponentConfig;
/** /**
@ -31,7 +31,7 @@ use VDM\Joomla\Componentbuilder\Abstraction\BaseConfig;
* *
* @since 3.2.0 * @since 3.2.0
*/ */
class Config extends BaseConfig class Config extends ComponentConfig
{ {
/** /**
* The Global Joomla Configuration * The Global Joomla Configuration

View File

@ -20,6 +20,9 @@ use VDM\Joomla\Service\Data;
use VDM\Joomla\Componentbuilder\Service\Gitea; use VDM\Joomla\Componentbuilder\Service\Gitea;
use VDM\Joomla\Componentbuilder\Power\Service\Gitea as GiteaPower; use VDM\Joomla\Componentbuilder\Power\Service\Gitea as GiteaPower;
use VDM\Joomla\Gitea\Service\Utilities as GiteaUtilities; use VDM\Joomla\Gitea\Service\Utilities as GiteaUtilities;
use VDM\Joomla\Componentbuilder\Service\Network;
use VDM\Joomla\Componentbuilder\Service\Api;
use VDM\Joomla\Componentbuilder\Service\Utilities;
use VDM\Joomla\Interfaces\FactoryInterface; use VDM\Joomla\Interfaces\FactoryInterface;
use VDM\Joomla\Abstraction\Factory as ExtendingFactory; use VDM\Joomla\Abstraction\Factory as ExtendingFactory;
@ -54,7 +57,10 @@ abstract class Factory extends ExtendingFactory implements FactoryInterface
->registerServiceProvider(new Data()) ->registerServiceProvider(new Data())
->registerServiceProvider(new Gitea()) ->registerServiceProvider(new Gitea())
->registerServiceProvider(new GiteaPower()) ->registerServiceProvider(new GiteaPower())
->registerServiceProvider(new GiteaUtilities()); ->registerServiceProvider(new GiteaUtilities())
->registerServiceProvider(new Network())
->registerServiceProvider(new Api())
->registerServiceProvider(new Utilities());
} }
} }

View File

@ -29,6 +29,14 @@ use VDM\Joomla\Abstraction\Grep as ExtendingGrep;
*/ */
final class Grep extends ExtendingGrep implements GrepInterface final class Grep extends ExtendingGrep implements GrepInterface
{ {
/**
* The Grep target [network]
*
* @var string
* @since 5.0.4
**/
protected ?string $target = 'joomla-powers';
/** /**
* Order of global search * Order of global search
* *
@ -77,7 +85,7 @@ final class Grep extends ExtendingGrep implements GrepInterface
$branch = $this->getBranchName($path); $branch = $this->getBranchName($path);
// load the base and token if set // 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);
// get the settings // get the settings
if (($power = $this->loadRemoteFile($path->organisation, $path->repository, $path->index->{$guid}->path . '/item.json', $branch)) !== null && if (($power = $this->loadRemoteFile($path->organisation, $path->repository, $path->index->{$guid}->path . '/item.json', $branch)) !== null &&

View File

@ -100,6 +100,7 @@ class JoomlaPower implements ServiceProviderInterface
{ {
return new Grep( return new Grep(
$container->get('Gitea.Repository.Contents'), $container->get('Gitea.Repository.Contents'),
$container->get('Network.Resolve'),
$container->get('Config')->approved_joomla_paths $container->get('Config')->approved_joomla_paths
); );
} }

View File

@ -0,0 +1,33 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/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\Componentbuilder\Network;
use VDM\Joomla\Abstraction\Registry;
/**
* The Network Core
*
* @since 5.0.4
*/
final class Core extends Registry
{
/**
* Path separator
*
* @var string|null
* @since 3.2.0
*/
protected ?string $separator = '|';
}

View File

@ -0,0 +1,33 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/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\Componentbuilder\Network;
use VDM\Joomla\Abstraction\Registry;
/**
* The Network Parsed Urls
*
* @since 5.0.4
*/
final class ParsedUrls extends Registry
{
/**
* Path separator
*
* @var string|null
* @since 3.2.0
*/
protected ?string $separator = '|';
}

View File

@ -0,0 +1,178 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/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\Componentbuilder\Network;
use Joomla\CMS\Log\Log;
use VDM\Joomla\Componentbuilder\Network\Url;
use VDM\Joomla\Componentbuilder\Network\Status;
/**
* The Network Resolver
*
* @since 5.0.4
*/
final class Resolve
{
/**
* The Url Class.
*
* @var Url
* @since 5.0.4
*/
protected Url $url;
/**
* The Status Class.
*
* @var Status
* @since 5.0.4
*/
protected Status $status;
/**
* Constructor.
*
* @param Url $url The Url Class.
* @param Status $status The Status Class.
*
* @since 5.0.4
*/
public function __construct(Url $url, Status $status)
{
$this->url = $url;
$this->status = $status;
}
/**
* Resolves the API for a repository if it is part of the core network.
*
* This method attempts to verify the status of the API and resolve an active URL if the current one is inactive.
*
* @param string $target The target network.
* @param string &$domain The API base domain (passed by reference).
* @param string &$organisation The repository organisation (passed by reference).
* @param string &$repository The repository name (passed by reference).
*
* @return void
* @since 5.0.4
*/
public function api(string $target, string &$domain, string &$organisation, string &$repository): void
{
try {
// Check the status of the current API
$status = $this->status->get($target, $domain, $repository, $organisation);
// If the API is inactive, attempt to find another active URL
if ($status == 0)
{
$this->resolve($target, $domain, $organisation, $repository);
}
} catch (\Exception $e) {
// ignore any none [in]active urls
$this->logError($e, 'Failed to resolve API status.');
}
}
/**
* Resolves an active API URL if the current API is inactive.
*
* Updates the `$domain`, `$organisation`, and `$repository` parameters to point to an active API URL.
*
* @param string $target The target network.
* @param string &$domain The API base domain (passed by reference).
* @param string &$organisation The repository organisation (passed by reference).
* @param string &$repository The repository name (passed by reference).
*
* @return void
* @since 5.0.4
*/
private function resolve(string $target, string &$domain, string &$organisation, string &$repository): void
{
$activeRepo = $this->active($target);
if ($activeRepo === null) {
// No active API found, log or handle this case as needed
throw new \Exception('No active API found for the target: ' . $target);
}
try {
// Parse the active repository's URL and update the references
$parsedUrl = $this->url->parse($activeRepo->url);
$noneActiveDomain = "{$domain}/{$organisation}/{$repository}";
$activeDomain = "{$parsedUrl->scheme}://{$parsedUrl->domain}/{$parsedUrl->organisation}/{$parsedUrl->repository}";
// update the values passed by reference
$domain = $parsedUrl->scheme . '://' . $parsedUrl->domain;
$organisation = $parsedUrl->organisation ?? $organisation;
$repository = $parsedUrl->repository ?? $repository;
// add info
$this->logInfo("Resolved [{$noneActiveDomain}] to [{$activeDomain}]");
} catch (\Exception $e) {
// ignore any none [in]active urls
$this->logError($e, 'Failed to parse active repository URL.');
}
}
/**
* Retrieves a random active repository target, excluding the specified domain.
*
* @param string $target The target network.
*
* @return object|null The randomly selected active repository, or null if none found.
* @since 5.0.4
*/
private function active(string $target): ?object
{
try {
$activeRepo = $this->status->active($target);
} catch (\Exception $e) {
// ignore any none [in]active urls
$this->logError($e, "Failed to get an [{$target}] active repository.");
}
return $activeRepo;
}
/**
* Logs an info custom message.
*
* @param string $message A custom message to include with the log entry.
*
* @return void
* @since 5.0.4
*/
private function logInfo(string $message): void
{
Log::add($message, Log::INFO, 'jcb-network-resolve');
}
/**
* Logs an error with a custom message.
*
* This method is a placeholder for your actual logging mechanism.
*
* @param \Exception $exception The exception to log.
* @param string $message A custom message to include with the log entry.
*
* @return void
* @since 5.0.4
*/
private function logError(\Exception $exception, string $message): void
{
Log::add($message . ' Exception: ' . $exception->getMessage(), Log::ERROR, 'jcb-network-resolve');
}
}

View File

@ -0,0 +1,258 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/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\Componentbuilder\Network;
use VDM\Joomla\Componentbuilder\Api\Network;
use VDM\Joomla\Componentbuilder\Network\Core;
use VDM\Joomla\Componentbuilder\Network\Url;
/**
* The Network Status
*
* @since 5.0.4
*/
final class Status
{
/**
* The Network Class.
*
* @var Network
* @since 5.0.4
*/
protected Network $network;
/**
* The Core Class.
*
* @var Core
* @since 5.0.4
*/
protected Core $core;
/**
* The Url Class.
*
* @var Url
* @since 5.0.4
*/
protected Url $url;
/**
* Constructor.
*
* @param Network $network The Network Class.
* @param Core $core The Core Class.
* @param Url $url The Url Class.
*
* @since 5.0.4
*/
public function __construct(Network $network, Core $core, Url $url)
{
$this->network = $network;
$this->core = $core;
$this->url = $url;
}
/**
* Retrieves the status for the given network target, utilizing caching via the Core registry.
*
* @param string $target The target network.
* @param string $domain The domain to retrieve [example: codeberg.org].
* @param string $repository The repository name.
* @param string $organization The target repository organization. (default: joomla)
*
* @return int Will return 1 if active, 0 if not, and -1 if not part of the core.
*
* @since 5.0.4
*/
public function get(string $target, string $domain, string $repository, string $organization = 'joomla'): int
{
try {
$repo = $this->network($target, $domain, $organization, $repository);
if ($repo === null)
{
// Domain not found in the network data
return -1;
}
// Check if the repository is active
if (isset($repo->status) && is_numeric($repo->status))
{
return (int) $repo->status;
}
else
{
// 'status' property not found or not numeric
return -1;
}
}
catch (\Exception $e)
{
// In case of any exception, return -1
return -1;
}
}
/**
* Retrieves a random active repository target, excluding the specified domain.
*
* @param string $target The target network name.
* @param array|null $excludeDomains The domain to exclude [default: ['git.vdm.dev']].
*
* @return object|null The randomly selected active repository, or null if none found.
* @since 5.0.4
*/
public function active(string $target, ?array $excludeDomains = ['git.vdm.dev']): ?object
{
try {
// Get the network data for the target
$data = $this->network($target);
// Filter active repositories excluding the specified domain
$activeRepos = array_filter($data->network, function ($repo) use ($excludeDomains) {
$parsed = $this->url->parse($repo->url);
return isset($repo->status) &&
$repo->status == 1 &&
!in_array($parsed->domain, $excludeDomains);
});
// Reindex the array to ensure array_rand works correctly
$activeRepos = array_values($activeRepos);
// If there are active repositories, select one at random
if (!empty($activeRepos))
{
return $activeRepos[array_rand($activeRepos)];
}
else
{
// No active repositories found excluding the specified domain
return null;
}
}
catch (\Exception $e)
{
// In case of any exception, return null
return null;
}
}
/**
* Retrieves the data for the given network target, utilizing caching via the Core registry.
*
* If the data for the target is already cached in the Core registry, it returns that data.
* Otherwise, it fetches the data from the Network, caches it, and returns it.
*
* @param string $target The target network name.
* @param string|null $domain The domain to retrieve [example: codeberg.org].
* @param string|null $organization The target repository organization.
* @param string|null $repository The repository name.
*
* @return object|null The data retrieved for the target.
* @throws \Exception If an error occurs during the network call or if the result contains an 'error' key.
* @since 5.0.4
*/
public function network(string $target, ?string $domain = null, ?string $organization = null, ?string $repository = null): ?object
{
$networkData = $this->fetchNetworkData($target);
if ($domain !== null)
{
return $this->getDomainData($networkData->network, $domain, $organization, $repository);
}
return $networkData;
}
/**
* Retrieves the data filtered by domain, organization, and optionally repository.
*
* @param array $network The network data array.
* @param string $domain The domain to filter by.
* @param string|null $organization The organization to filter by.
* @param string|null $repository The repository to filter by.
*
* @return object|null The filtered data, or null if no match is found.
* @since 5.0.4
*/
private function getDomainData(array $network, string $domain, ?string $organization = null, ?string $repository = null): ?object
{
$domainBase = $this->url->base($domain);
foreach ($network as $repo)
{
$parsedUrl = $this->url->parse($repo->url);
if ($parsedUrl->domain === $domainBase)
{
if ($organization !== null && $parsedUrl->organization !== $organization)
{
continue;
}
if ($repository !== null && $parsedUrl->repository !== $repository)
{
continue;
}
return $repo;
}
}
return null;
}
/**
* Fetches and caches the network data for a given target.
*
* @param string $target The target network name.
*
* @return object The cached or freshly fetched network data.
* @throws \Exception If an error occurs during the network call.
* @since 5.0.4
*/
private function fetchNetworkData(string $target): object
{
// Check if data is cached
if (($cachedData = $this->core->get($target)) !== null)
{
return $cachedData;
}
try {
// Fetch data from the network
$networkData = $this->network->get($target);
} catch (\Exception $e) {
throw new \Exception('Network error: ' . $e->getMessage(), 0, $e);
}
// Validate the fetched data
if (!is_object($networkData) || !property_exists($networkData, 'network'))
{
throw new \Exception('Invalid network data: Missing "network" property.');
}
if (property_exists($networkData, 'error'))
{
throw new \Exception('Network error: ' . $networkData->error);
}
// Cache the result
$this->core->set($target, $networkData);
return $networkData;
}
}

View File

@ -0,0 +1,237 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/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\Componentbuilder\Network;
use VDM\Joomla\Componentbuilder\Network\ParsedUrls;
/**
* The Network Url
*
* @since 5.0.4
*/
final class Url
{
/**
* The ParsedUrls Class.
*
* @var ParsedUrls
* @since 5.0.4
*/
protected ParsedUrls $parsedurls;
/**
* Constructor.
*
* @param ParsedUrls $parsedurls The ParsedUrls Class.
*
* @since 5.0.4
*/
public function __construct(ParsedUrls $parsedurls)
{
$this->parsedurls = $parsedurls;
}
/**
* Parses a URL and extracts the domain, organization, and repository.
*
* This method takes a URL of the format 'https://[domain]/[organization]/[repository]'
* and returns an associative array with keys 'domain', 'organization', and 'repository'.
*
* @param string $url The URL to parse.
*
* @return object An object with keys 'domain', 'organization', and 'repository'.
* @throws \InvalidArgumentException If the URL is invalid or lacks required components.
* @since 5.0.4
*/
public function parse(string $url): object
{
// Check if the URL has already been parsed and is present in the cache
if (($parsed = $this->parsedurls->get($url)) !== null)
{
return (object) $parsed;
}
// Validate the URL format
if (!filter_var($url, FILTER_VALIDATE_URL))
{
throw new \InvalidArgumentException("Invalid URL format: $url");
}
// Parse the URL and extract its components
$parsedUrl = parse_url($url);
if ($parsedUrl === false)
{
throw new \InvalidArgumentException("Invalid URL provided: $url");
}
// Ensure the URL contains a host (domain)
if (empty($parsedUrl['host']))
{
throw new \InvalidArgumentException("The URL does not contain a valid domain: $url");
}
$domain = $parsedUrl['host'];
// Set the scheme
$scheme = $parsedUrl['scheme'] ?? 'https';
// Ensure the URL contains a path
if (empty($parsedUrl['path']))
{
throw new \InvalidArgumentException("The URL does not contain a valid path: $url");
}
// Remove leading and trailing slashes from the path
$path = trim($parsedUrl['path'], '/');
// Split the path into components
$pathParts = explode('/', $path);
// Ensure the path contains at least two components: organization and repository
if (count($pathParts) < 2)
{
throw new \InvalidArgumentException("The URL must contain both an organization and a repository: $url");
}
$organization = $pathParts[0];
$repository = $pathParts[1];
// Create a new Parsed Url array
$parsed = [
'scheme' => $scheme,
'domain' => $domain,
'organization' => $organization,
'repository' => $repository
];
// Store the parsed URL in the cache
$this->parsedurls->set($url, $parsed);
// Return the parsed URL object
return (object) $parsed;
}
/**
* Extract the base domain from a given URL or domain string.
*
* @param string $url The input URL or domain string.
*
* @return string The core domain (e.g., domain.com).
* @since 5.0.4
*/
public function base(string $url): string
{
// Parse the URL to extract host
$parsedUrl = parse_url($url, PHP_URL_HOST);
// If no host is found, check if the input itself is a domain without protocol
if (!$parsedUrl)
{
$parsedUrl = $url;
}
// Remove any trailing slashes or unnecessary characters
$parsedUrl = rtrim($parsedUrl, '/');
return $parsedUrl;
}
/**
* Compares two URLs and checks if their domain and repository are the same.
*
* This method returns true if both the domain and repository are identical in both URLs.
*
* @param string $url1 The first URL to compare.
* @param string $url2 The second URL to compare.
*
* @return bool Returns true if the domain and repository are the same; false otherwise.
* @throws InvalidArgumentException If any of the URLs are invalid or lack required components.
* @since 5.0.4
*/
public function equal(string $url1, string $url2): bool
{
return $this->compare($url1, $url2, ['domain', 'repository']);
}
/**
* Compares two URLs strictly and checks if their domain, organization, and repository are the same.
*
* This method returns true if the domain, organization, and repository are identical in both URLs.
*
* @param string $url1 The first URL to compare.
* @param string $url2 The second URL to compare.
*
* @return bool Returns true if the domain, organization, and repository are the same; false otherwise.
* @throws \InvalidArgumentException If any of the URLs are invalid or lack required components.
* @since 5.0.4
*/
public function equalStrict(string $url1, string $url2): bool
{
return $this->compare($url1, $url2, ['domain', 'organization', 'repository']);
}
/**
* Compares two URLs and checks if their repositories are the same.
*
* This method returns true if the repository names are identical in both URLs, regardless of domain and organization.
*
* @param string $url1 The first URL to compare.
* @param string $url2 The second URL to compare.
*
* @return bool Returns true if the repositories are the same; false otherwise.
* @throws \InvalidArgumentException If any of the URLs are invalid or lack required components.
* @since 5.0.4
*/
public function equalRepo(string $url1, string $url2): bool
{
return $this->compare($url1, $url2, ['repository']);
}
/**
* Compares two URLs based on specified fields.
*
* This method allows you to compare specific components of two URLs, such as 'domain',
* 'organization', and 'repository'. It returns true if all specified fields are equal.
*
* @param string $url1 The first URL to compare.
* @param string $url2 The second URL to compare.
* @param string[] $fields The fields to compare ('domain', 'organization', 'repository').
*
* @return bool Returns true if all specified fields are equal; false otherwise.
* @throws \InvalidArgumentException If any of the URLs are invalid or lack required components,
* or if an invalid field is specified.
* @since 5.0.4
*/
private function compare(string $url1, string $url2, array $fields): bool
{
$parsedUrl1 = $this->parse($url1);
$parsedUrl2 = $this->parse($url2);
foreach ($fields as $field)
{
if (!property_exists($parsedUrl1, $field) || !property_exists($parsedUrl2, $field))
{
throw new \InvalidArgumentException("Invalid field specified for comparison: $field");
}
if ($parsedUrl1->$field !== $parsedUrl2->$field)
{
return false;
}
}
return true;
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -18,7 +18,7 @@ use Joomla\Input\Input;
use VDM\Joomla\Utilities\GetHelper; use VDM\Joomla\Utilities\GetHelper;
use VDM\Joomla\Utilities\StringHelper; use VDM\Joomla\Utilities\StringHelper;
use VDM\Joomla\Componentbuilder\Utilities\RepoHelper; use VDM\Joomla\Componentbuilder\Utilities\RepoHelper;
use VDM\Joomla\Componentbuilder\Abstraction\BaseConfig; use VDM\Joomla\Componentbuilder\Abstraction\ComponentConfig;
/** /**
@ -32,7 +32,7 @@ use VDM\Joomla\Componentbuilder\Abstraction\BaseConfig;
* *
* @since 3.2.0 * @since 3.2.0
*/ */
class Config extends BaseConfig class Config extends ComponentConfig
{ {
/** /**
* The Global Joomla Configuration * The Global Joomla Configuration

View File

@ -21,6 +21,9 @@ use VDM\Joomla\Componentbuilder\Power\Service\Generator;
use VDM\Joomla\Componentbuilder\Service\Gitea; use VDM\Joomla\Componentbuilder\Service\Gitea;
use VDM\Joomla\Componentbuilder\Power\Service\Gitea as GiteaPower; use VDM\Joomla\Componentbuilder\Power\Service\Gitea as GiteaPower;
use VDM\Joomla\Gitea\Service\Utilities as GiteaUtilities; use VDM\Joomla\Gitea\Service\Utilities as GiteaUtilities;
use VDM\Joomla\Componentbuilder\Service\Network;
use VDM\Joomla\Componentbuilder\Service\Api;
use VDM\Joomla\Componentbuilder\Service\Utilities;
use VDM\Joomla\Interfaces\FactoryInterface; use VDM\Joomla\Interfaces\FactoryInterface;
use VDM\Joomla\Abstraction\Factory as ExtendingFactory; use VDM\Joomla\Abstraction\Factory as ExtendingFactory;
@ -56,7 +59,10 @@ abstract class Factory extends ExtendingFactory implements FactoryInterface
->registerServiceProvider(new Generator()) ->registerServiceProvider(new Generator())
->registerServiceProvider(new Gitea()) ->registerServiceProvider(new Gitea())
->registerServiceProvider(new GiteaPower()) ->registerServiceProvider(new GiteaPower())
->registerServiceProvider(new GiteaUtilities()); ->registerServiceProvider(new GiteaUtilities())
->registerServiceProvider(new Api())
->registerServiceProvider(new Network())
->registerServiceProvider(new Utilities());
} }
} }

View File

@ -131,7 +131,7 @@ final class Grep extends ExtendingGrep implements GrepInterface
$branch = $this->getBranchName($path); $branch = $this->getBranchName($path);
// load the base and token if set // 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);
// get the settings // get the settings
if (($power = $this->loadRemoteFile($path->organisation, $path->repository, $path->index->{$guid}->settings, $branch)) !== null && if (($power = $this->loadRemoteFile($path->organisation, $path->repository, $path->index->{$guid}->settings, $branch)) !== null &&

View File

@ -108,6 +108,7 @@ class Power implements ServiceProviderInterface
{ {
return new Grep( return new Grep(
$container->get('Gitea.Repository.Contents'), $container->get('Gitea.Repository.Contents'),
$container->get('Network.Resolve'),
$container->get('Config')->approved_paths, $container->get('Config')->approved_paths,
$container->get('Config')->local_powers_repository_path $container->get('Config')->local_powers_repository_path
); );

View File

@ -14,7 +14,7 @@ namespace VDM\Joomla\Componentbuilder\Search;
use Joomla\CMS\Factory; use Joomla\CMS\Factory;
use Joomla\Input\Input; use Joomla\Input\Input;
use VDM\Joomla\Abstraction\BaseConfig; use VDM\Joomla\Abstraction\FunctionRegistry;
/** /**
@ -22,7 +22,7 @@ use VDM\Joomla\Abstraction\BaseConfig;
* *
* @since 3.2.0 * @since 3.2.0
*/ */
class Config extends BaseConfig class Config extends FunctionRegistry
{ {
/** /**
* Hold a JInput object for easier access to the input variables. * Hold a JInput object for easier access to the input variables.
@ -43,9 +43,6 @@ class Config extends BaseConfig
public function __construct(?Input $input = null) public function __construct(?Input $input = null)
{ {
$this->input = $input ?: Factory::getApplication()->input; $this->input = $input ?: Factory::getApplication()->input;
// run parent constructor
parent::__construct();
} }
/** /**
@ -200,7 +197,6 @@ class Config extends BaseConfig
protected function getMarkerend(): string protected function getMarkerend(): string
{ {
return ']=' . '|' . '+}'; return ']=' . '|' . '+}';
} }
} }

View File

@ -0,0 +1,58 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/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\Componentbuilder\Service;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use VDM\Joomla\Componentbuilder\Api\Network;
/**
* The Joomla Component Builder Api Service
*
* @since 5.0.4
*/
class Api implements ServiceProviderInterface
{
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
* @since 5.0.4
*/
public function register(Container $container)
{
$container->alias(Network::class, 'Api.Network')
->share('Api.Network', [$this, 'getNetwork'], true);
}
/**
* Get The Network Class.
*
* @param Container $container The DI container.
*
* @return Network
* @since 5.0.4
*/
public function getNetwork(Container $container): Network
{
return new Network(
$container->get('Utilities.Http'),
$container->get('Utilities.Uri'),
$container->get('Utilities.Response')
);
}
}

View File

@ -0,0 +1,131 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/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\Componentbuilder\Service;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use VDM\Joomla\Componentbuilder\Network\Resolve;
use VDM\Joomla\Componentbuilder\Network\Status;
use VDM\Joomla\Componentbuilder\Network\Url;
use VDM\Joomla\Componentbuilder\Network\Core;
use VDM\Joomla\Componentbuilder\Network\ParsedUrls;
/**
* The Joomla Component Builder Network Service
*
* @since 5.0.4
*/
class Network implements ServiceProviderInterface
{
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
* @since 5.0.4
*/
public function register(Container $container)
{
$container->alias(Resolve::class, 'Network.Resolve')
->share('Network.Resolve', [$this, 'getResolve'], true);
$container->alias(Status::class, 'Network.Status')
->share('Network.Status', [$this, 'getStatus'], true);
$container->alias(Url::class, 'Network.Url')
->share('Network.Url', [$this, 'getUrl'], true);
$container->alias(Core::class, 'Network.Core')
->share('Network.Core', [$this, 'getCore'], true);
$container->alias(ParsedUrls::class, 'Network.Parsed.Urls')
->share('Network.Parsed.Urls', [$this, 'getParsedUrls'], true);
}
/**
* Get The Resolve Class.
*
* @param Container $container The DI container.
*
* @return Resolve
* @since 5.0.4
*/
public function getResolve(Container $container): Resolve
{
return new Resolve(
$container->get('Network.Url'),
$container->get('Network.Status')
);
}
/**
* Get The Status Class.
*
* @param Container $container The DI container.
*
* @return Status
* @since 5.0.4
*/
public function getStatus(Container $container): Status
{
return new Status(
$container->get('Api.Network'),
$container->get('Network.Core'),
$container->get('Network.Url')
);
}
/**
* Get The Url Class.
*
* @param Container $container The DI container.
*
* @return Url
* @since 5.0.4
*/
public function getUrl(Container $container): Url
{
return new Url(
$container->get('Network.Parsed.Urls')
);
}
/**
* Get The Core Class.
*
* @param Container $container The DI container.
*
* @return Core
* @since 5.0.4
*/
public function getCore(Container $container): Core
{
return new Core();
}
/**
* Get The ParsedUrls Class.
*
* @param Container $container The DI container.
*
* @return ParsedUrls
* @since 5.0.4
*/
public function getParsedUrls(Container $container): ParsedUrls
{
return new ParsedUrls();
}
}

View File

@ -0,0 +1,88 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/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\Componentbuilder\Service;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use VDM\Joomla\Componentbuilder\Utilities\Uri;
use VDM\Joomla\Componentbuilder\Utilities\Http;
use VDM\Joomla\Componentbuilder\Utilities\Response;
/**
* The Joomla Component Builder Utilities Service
*
* @since 5.0.4
*/
class Utilities implements ServiceProviderInterface
{
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
* @since 5.0.4
*/
public function register(Container $container)
{
$container->alias(Uri::class, 'Utilities.Uri')
->share('Utilities.Uri', [$this, 'getUri'], true);
$container->alias(Http::class, 'Utilities.Http')
->share('Utilities.Http', [$this, 'getHttp'], true);
$container->alias(Response::class, 'Utilities.Response')
->share('Utilities.Response', [$this, 'getResponse'], true);
}
/**
* Get The Uri Class.
*
* @param Container $container The DI container.
*
* @return Uri
* @since 5.0.4
*/
public function getUri(Container $container): Uri
{
return new Uri();
}
/**
* Get The Http Class.
*
* @param Container $container The DI container.
*
* @return Http
* @since 5.0.4
*/
public function getHttp(Container $container): Http
{
return new Http();
}
/**
* Get The Response Class.
*
* @param Container $container The DI container.
*
* @return Response
* @since 5.0.4
*/
public function getResponse(Container $container): Response
{
return new Response();
}
}

View File

@ -109,8 +109,8 @@ final class Table extends BaseTable implements TableInterface
'tab_name' => 'publishing', 'tab_name' => 'publishing',
'db' => [ 'db' => [
'type' => 'DATETIME', 'type' => 'DATETIME',
'default' => '0000-00-00 00:00:00', 'default' => 'CURRENT_TIMESTAMP',
'null_switch' => 'NOT NULL', 'null_switch' => 'NULL',
'unique_key' => false, 'unique_key' => false,
'key' => false, 'key' => false,
], ],
@ -1626,8 +1626,8 @@ final class Table extends BaseTable implements TableInterface
'tab_name' => 'publishing', 'tab_name' => 'publishing',
'db' => [ 'db' => [
'type' => 'DATETIME', 'type' => 'DATETIME',
'default' => '0000-00-00 00:00:00', 'default' => 'EMPTY',
'null_switch' => 'NOT NULL', 'null_switch' => 'NULL',
'unique_key' => false, 'unique_key' => false,
'key' => false, 'key' => false,
], ],

View File

@ -0,0 +1,49 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/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\Componentbuilder\Utilities;
use Joomla\CMS\Http\Http as JoomlaHttp;
use Joomla\Registry\Registry;
/**
* The Joomla Component Builder Http
*
* @since 5.0.4
*/
final class Http extends JoomlaHttp
{
/**
* Constructor.
*
* @since 5.0.4
* @throws \InvalidArgumentException
**/
public function __construct()
{
// setup config
$config = [
'userAgent' => 'JCB/5.0',
'headers' => [
'Content-Type' => 'application/json'
]
];
$options = new Registry($config);
// run parent constructor
parent::__construct($options);
}
}

View File

@ -0,0 +1,125 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/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\Componentbuilder\Utilities;
use Joomla\CMS\Http\Response as JoomlaResponse;
use VDM\Joomla\Utilities\JsonHelper;
use VDM\Joomla\Utilities\StringHelper;
/**
* The Response
*
* @since 2.0.1
*/
final class Response
{
/**
* Process the response and decode it.
*
* @param JoomlaResponse $response The response.
* @param integer $expectedCode The expected "good" code.
* @param mixed $default The default if body not have length
*
* @return mixed
*
* @since 2.0.1
* @throws \DomainException
**/
public function get($response, int $expectedCode = 200, $default = null)
{
// Validate the response code.
if ($response->code != $expectedCode)
{
// Decode the error response and throw an exception.
$message = $this->error($response);
// Throw an exception with the error message and code.
throw new \DomainException($message, $response->code);
}
return $this->getBody($response, $default);
}
/**
* Return the body from the response
*
* @param JoomlaResponse $response The response.
* @param mixed $default The default if body not have length
*
* @return mixed
* @since 2.0.1
**/
protected function getBody($response, $default = null)
{
$body = $response->body ?? null;
// check that we have a body
if (StringHelper::check($body))
{
// if it's JSON, decode it
if (JsonHelper::check($body))
{
return json_decode((string) $body);
}
// if it's XML, convert it to an object
libxml_use_internal_errors(true);
$xml = simplexml_load_string($body);
if ($xml !== false)
{
return $xml;
}
// if it's neither JSON nor XML, return as is
return $body;
}
return $default;
}
/**
* Get the error message from the System API response
*
* @param JoomlaResponse $response The response.
*
* @return string
* @since 2.0.1
**/
protected function error($response): string
{
$body = $response->body ?? null;
// do we have a json string
if (JsonHelper::check($body))
{
$error = json_decode($body);
}
else
{
return 'Invalid or empty response body.';
}
// check if system returned an error object
if (isset($error->Error))
{
// error object found, extract message and code
$errorMessage = isset($error->Error->Message) ? $error->Error->Message : 'Unknown error.';
$errorCode = isset($error->Error->Code) ? $error->Error->Code : 'Unknown error code.';
// return formatted error message
return 'Error: ' . $errorMessage . ' Code: ' . $errorCode;
}
return 'No error information found in response.';
}
}

View File

@ -0,0 +1,127 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/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\Componentbuilder\Utilities;
use Joomla\Uri\Uri as JoomlaUri;
/**
* The Joomla Component Builder Uri
*
* @since 5.0.4
*/
final class Uri
{
/**
* The api version
*
* @var string
* @since 3.2.0
*/
private string $version;
/**
* The api URL
*
* @var string
* @since 3.2.0
*/
private string $url;
/**
* Constructor
*
* @param string $url URL to the api system
* example: https://api.joomlacomponentbuilder.com
* @param string $endpoint Endpoint to the gitea system
* @param string $version Version to the gitea system
*
* @since 3.2.0
**/
public function __construct(
string $url = 'https://api.joomlacomponentbuilder.com',
string $version = 'v1')
{
// set the API details
$this->setUrl($url);
$this->setVersion($version);
}
/**
* Method to build and return a full request URL for the request. This method will
* add appropriate pagination details if necessary and also prepend the API url
* to have a complete URL for the request.
*
* @param string $path URL to inflect
*
* @return JoomlaUri
* @since 3.2.0
**/
public function get(string $path): JoomlaUri
{
// Get a new Uri object focusing the api url and given path.
$uri = new JoomlaUri($this->api() . $path);
return $uri;
}
/**
* Get the full API URL
*
* @return string
* @since 3.2.0
**/
public function api(): string
{
return $this->url . '/' . $this->version;
}
/**
* Set the URL of the API
*
* @param string $url URL to your gitea system
* example: https://api.joomlacomponentbuilder.com
*
* @return void
* @since 3.2.0
**/
public function setUrl(string $url)
{
$this->url = $url;
}
/**
* Get the URL of the API
*
* @return string|null
* @since 3.2.0
**/
public function getUrl(): ?string
{
return $this->url ?? null;
}
/**
* Set the version of the API
*
* @param string $version version to your gitea API
*
* @return void
* @since 3.2.0
**/
private function setVersion($version)
{
$this->version = $version;
}
}

View File

@ -12,6 +12,9 @@
namespace VDM\Joomla\Interfaces; namespace VDM\Joomla\Interfaces;
use VDM\Joomla\Interfaces\Git\ApiInterface as Api;
/** /**
* Global Resource Empowerment Platform * Global Resource Empowerment Platform
* *
@ -77,6 +80,22 @@ interface GrepInterface
* @return object|null * @return object|null
* @since 3.2.2 * @since 3.2.2
*/ */
public function getRemoteIndex(string $guid): ?object; public function getRemoteIndex(string $guid): ?object;
/**
* 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;
} }

View File

@ -18,10 +18,128 @@ use VDM\Joomla\Interfaces\Activeregistryinterface;
/** /**
* The Registry Interface * The Registry Interface
* *
* @since 3.2.0 * @since 3.2.0
* @since 5.0.4 Joomla Registry Compatible
*/ */
interface Registryinterface extends Activeregistryinterface interface Registryinterface extends Activeregistryinterface
{ {
/**
* 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);
/**
* 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);
/**
* 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);
/**
* 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);
/**
* Magic method to clone the registry.
*
* Performs a deep copy of the registry data.
*
* @return void
* @since 5.0.4
*/
public function __clone();
/**
* 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();
/**
* 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;
/**
* 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;
/**
* 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;
/**
* 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;
/** /**
* Sets a value into the registry using multiple keys. * Sets a value into the registry using multiple keys.
* *
@ -30,7 +148,7 @@ interface Registryinterface extends Activeregistryinterface
* *
* @throws \InvalidArgumentException If any of the path values are not a number or string. * @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return self * @return self
* @since 3.2.0 * @since 3.2.0
*/ */
public function set(string $path, $value): self; public function set(string $path, $value): self;
@ -46,7 +164,7 @@ interface Registryinterface extends Activeregistryinterface
* *
* @throws \InvalidArgumentException If any of the path values are not a number or string. * @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return self * @return self
* @since 3.2.0 * @since 3.2.0
*/ */
public function add(string $path, $value, ?bool $asArray = null): self; public function add(string $path, $value, ?bool $asArray = null): self;
@ -58,9 +176,9 @@ interface Registryinterface extends Activeregistryinterface
* *
* @throws \InvalidArgumentException If any of the path values are not a number or string. * @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. * @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;
/** /**
* Removes a value (or sub-array) from the registry using multiple keys. * Removes a value (or sub-array) from the registry using multiple keys.
@ -69,7 +187,7 @@ interface Registryinterface extends Activeregistryinterface
* *
* @throws \InvalidArgumentException If any of the path values are not a number or string. * @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return self * @return self
* @since 3.2.0 * @since 3.2.0
*/ */
public function remove(string $path): self; public function remove(string $path): self;
@ -80,18 +198,207 @@ interface Registryinterface extends Activeregistryinterface
* *
* @throws \InvalidArgumentException If any of the path values are not a number or string. * @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return bool True if the location exists, false otherwise. * @return bool True if the location exists, false otherwise.
* @since 3.2.0 * @since 3.2.0
*/ */
public function exists(string $path): bool; public function exists(string $path): bool;
/**
* 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;
/**
* Count elements of the registry.
*
* @return int The number of elements in the registry.
* @since 5.0.4
*/
public function count(): int;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* Unset the value at a given offset.
*
* @param mixed $offset The offset to unset.
*
* @return void
* @since 5.0.4
*/
public function offsetUnset(mixed $offset): void;
/**
* Retrieve an external iterator for the registry.
*
* @return \Traversable An instance of an object implementing Iterator or Traversable.
* @since 5.0.4
*/
public function getIterator(): \Traversable;
/**
* Get the registry data as an associative array.
*
* @return array The registry data.
* @since 5.0.4
*/
public function toArray(): array;
/**
* Get the registry data as an object.
*
* @return object The registry data converted to an object.
* @since 5.0.4
*/
public function toObject();
/**
* Converts the registry data to a string in the specified format.
*
* @param string $format The format to output the string in. Supported formats: 'json', 'ini', 'xml', 'php'.
* @param array $options Options used by the formatter.
*
* @return string The registry data in the specified format.
*
* @throws \InvalidArgumentException If the format is not supported.
* @since 5.0.4
*/
public function toString(string $format = 'JSON', array $options = []): string;
/**
* Flattens the registry data into a one-dimensional array.
*
* @param string|null $separator The separator for the key names.
* @param bool $full True to include the full path as keys.
*
* @return array The flattened data array.
* @since 5.0.4
*/
public function flatten(?string $separator = null, bool $full = false): array;
/**
* Sets a default value if not already set.
*
* @param string $path The registry path (e.g., 'vdm.content.builder').
* @param mixed $default The default value to set if the path does not exist.
*
* @return mixed The value of the path after the method call.
* @since 5.0.4
*/
public function def(string $path, $default);
/**
* Merges another registry into this one.
*
* The data from the source registry will be merged into this registry,
* overwriting any existing values with the same keys.
*
* @param Registryinterface $source The registry to merge with this one.
*
* @return self
* @since 5.0.4
*/
public function merge(Registryinterface $source): self;
/**
* Clears all data from the registry.
*
* @return self
* @since 5.0.4
*/
public function clear(): self;
/**
* Extracts a subset of the registry data based on a given path.
*
* @param string $path The registry path to extract.
* @param mixed $default Optional default value, returned if the path does not exist.
* @param string|null $separator The path separator.
*
* @return self A new Registry instance with the extracted data.
* @since 5.0.4
*/
public function extract(string $path, $default = null, ?string $separator = null): self;
/**
* Appends content into the registry.
*
* If a key exists, the value will be appended to the existing value.
*
* @param string $path The registry path (e.g., 'vdm.content.builder').
* @param mixed $value The value to append.
*
* @return self
* @since 5.0.4
*/
public function append(string $path, $value): self;
/**
* Gets the name of the registry.
*
* @return string|null The name of the registry.
* @since 5.0.4
*/
public function getName(): ?string;
/**
* Sets the name of the registry.
*
* @param string|null $name The name to set.
*
* @return self
* @since 5.0.4
*/
public function setName(?string $name): self;
/** /**
* Sets a separator value * Sets a separator value
* *
* @param string|null $value The value to set. * @param string|null $value The value to set.
* *
* @return self * @return self
* @since 3.2.0 * @since 3.2.0
*/ */
public function setSeparator(?string $value): self; public function setSeparator(?string $value): self;
/**
* Gets the current path separator used in registry paths.
*
* @return string|null The path separator.
* @since 5.0.4
*/
public function getSeparator(): ?string;
} }

View File

@ -10001,7 +10001,7 @@ class Com_ComponentbuilderInstallerScript
echo '<div style="background-color: #fff;" class="alert alert-info"><a target="_blank" href="https://dev.vdm.io" title="Component Builder"> echo '<div style="background-color: #fff;" class="alert alert-info"><a target="_blank" href="https://dev.vdm.io" title="Component Builder">
<img src="components/com_componentbuilder/assets/images/vdm-component.jpg"/> <img src="components/com_componentbuilder/assets/images/vdm-component.jpg"/>
</a> </a>
<h3>Upgrade to Version 3.2.5-beta1 Was Successful! Let us know if anything is not working as expected.</h3></div>'; <h3>Upgrade to Version 3.2.5-beta2 Was Successful! Let us know if anything is not working as expected.</h3></div>';
// Set db if not set already. // Set db if not set already.
if (!isset($db)) if (!isset($db))