Component Builder (v.5.0.4-beta1)
+ Component Builder (v.5.0.4-beta2)
The Component Builder for [Joomla](https://extensions.joomla.org/extension/component-builder/) is highly advanced tool that is truly able to build extremely complex components in a fraction of the time.
diff --git a/componentbuilder_update_server.xml b/componentbuilder_update_server.xml
index 9af821fba..c4075d95d 100644
--- a/componentbuilder_update_server.xml
+++ b/componentbuilder_update_server.xml
@@ -131,10 +131,28 @@
pkg_component_builder
package
site
- 5.0.4-beta1
+ 5.0.4-beta
https://dev.vdm.io
- https://git.vdm.dev/api/v1/repos/joomla/pkg-component-builder/archive/v5.0.4-beta1.zip
+ https://git.vdm.dev/api/v1/repos/joomla/pkg-component-builder/archive/v5.0.4-beta2.zip
+
+
+ beta
+
+ Llewellyn van der Merwe
+ https://dev.vdm.io
+
+
+
+ Component Builder
+ Builds Complex Joomla Components
+ pkg_component_builder
+ package
+ site
+ 5.0.4-beta2
+ https://dev.vdm.io
+
+ https://git.vdm.dev/api/v1/repos/joomla/pkg-component-builder/archive/v5.0.4-beta2.zip
beta
diff --git a/libraries/vendor_jcb/VDM.Joomla.Gitea/src/Utilities/Http.php b/libraries/vendor_jcb/VDM.Joomla.Gitea/src/Utilities/Http.php
index c58ea2c93..902538bb7 100644
--- a/libraries/vendor_jcb/VDM.Joomla.Gitea/src/Utilities/Http.php
+++ b/libraries/vendor_jcb/VDM.Joomla.Gitea/src/Utilities/Http.php
@@ -28,10 +28,10 @@ final class Http extends JoomlaHttp
/**
* The token
*
- * @var string
+ * @var string|null
* @since 3.2.0
*/
- protected string $_token_; // to avoid collisions (but allow swapping)
+ protected ?string $_token_; // to avoid collisions (but allow swapping)
/**
* Constructor.
@@ -41,7 +41,7 @@ final class Http extends JoomlaHttp
* @since 3.2.0
* @throws \InvalidArgumentException
**/
- public function __construct(?string $token)
+ public function __construct(?string $token = null)
{
// setup config
$config = [
@@ -52,7 +52,7 @@ final class Http extends JoomlaHttp
];
// add the token if given
- if (is_string($token))
+ if (is_string($token) && !empty($token))
{
$config['headers']['Authorization'] = 'token ' . $token;
$this->_token_ = $token;
@@ -79,9 +79,16 @@ final class Http extends JoomlaHttp
]
);
- // add the token
- $headers['Authorization'] = 'token ' . $token;
- $this->_token_ = $token;
+ if (empty($token))
+ {
+ unset($headers['Authorization']);
+ }
+ else
+ {
+ // add the token
+ $headers['Authorization'] = 'token ' . $token;
+ $this->_token_ = $token;
+ }
$this->setOption('headers', $headers);
}
diff --git a/libraries/vendor_jcb/VDM.Joomla/src/Abstraction/BaseTable.php b/libraries/vendor_jcb/VDM.Joomla/src/Abstraction/BaseTable.php
index 7f48355ad..7a0919d15 100644
--- a/libraries/vendor_jcb/VDM.Joomla/src/Abstraction/BaseTable.php
+++ b/libraries/vendor_jcb/VDM.Joomla/src/Abstraction/BaseTable.php
@@ -108,8 +108,7 @@ abstract class BaseTable implements TableInterface
'store' => NULL,
'tab_name' => NULL,
'db' => [
- 'type' => 'INT(10) unsigned',
- 'default' => '0',
+ 'type' => 'INT unsigned',
'null_switch' => 'NULL',
'key' => true,
'key_name' => 'modifiedby'
@@ -125,7 +124,6 @@ abstract class BaseTable implements TableInterface
'tab_name' => NULL,
'db' => [
'type' => 'DATETIME',
- 'default' => '0000-00-00 00:00:00',
'null_switch' => 'NULL'
]
],
@@ -138,7 +136,7 @@ abstract class BaseTable implements TableInterface
'store' => NULL,
'tab_name' => NULL,
'db' => [
- 'type' => 'INT(10) unsigned',
+ 'type' => 'INT unsigned',
'default' => '0',
'null_switch' => 'NULL',
'key' => true,
@@ -155,7 +153,7 @@ abstract class BaseTable implements TableInterface
'tab_name' => NULL,
'db' => [
'type' => 'DATETIME',
- 'default' => '0000-00-00 00:00:00',
+ 'default' => 'CURRENT_TIMESTAMP',
'null_switch' => 'NULL'
]
],
@@ -168,8 +166,7 @@ abstract class BaseTable implements TableInterface
'store' => NULL,
'tab_name' => NULL,
'db' => [
- 'type' => 'INT(10) unsigned',
- 'default' => '0',
+ 'type' => 'INT unsigned',
'null_switch' => 'NULL',
'key' => true,
'key_name' => 'checkout'
@@ -185,7 +182,6 @@ abstract class BaseTable implements TableInterface
'tab_name' => NULL,
'db' => [
'type' => 'DATETIME',
- 'default' => '0000-00-00 00:00:00',
'null_switch' => 'NULL'
]
],
diff --git a/libraries/vendor_jcb/VDM.Joomla/src/Abstraction/BaseConfig.php b/libraries/vendor_jcb/VDM.Joomla/src/Abstraction/FunctionRegistry.php
similarity index 58%
rename from libraries/vendor_jcb/VDM.Joomla/src/Abstraction/BaseConfig.php
rename to libraries/vendor_jcb/VDM.Joomla/src/Abstraction/FunctionRegistry.php
index c4debc288..708a0b33d 100644
--- a/libraries/vendor_jcb/VDM.Joomla/src/Abstraction/BaseConfig.php
+++ b/libraries/vendor_jcb/VDM.Joomla/src/Abstraction/FunctionRegistry.php
@@ -12,41 +12,17 @@
namespace VDM\Joomla\Abstraction;
-use Joomla\Registry\Registry as JoomlaRegistry;
use VDM\Joomla\Utilities\String\ClassfunctionHelper;
+use VDM\Joomla\Abstraction\Registry;
/**
- * Config
+ * A Dynamic Function Registry
*
- * @since 3.2.0
+ * @since 5.0.4
*/
-abstract class BaseConfig extends JoomlaRegistry
+abstract class FunctionRegistry extends Registry
{
- /**
- * Constructor
- *
- * @since 3.2.0
- */
- public function __construct()
- {
- // Instantiate the internal data object.
- $this->data = new \stdClass();
- }
-
- /**
- * setting any config value
- *
- * @param string $key The value's key/path name
- * @param mixed $value Optional default value, returned if the internal value is null.
- *
- * @since 3.2.0
- */
- public function __set($key, $value)
- {
- $this->set($key, $value);
- }
-
/**
* getting any valid value
*
@@ -76,7 +52,7 @@ abstract class BaseConfig extends JoomlaRegistry
*
* @since 3.2.0
*/
- public function get($path, $default = null)
+ public function get(string $path, $default = null): mixed
{
// function name with no underscores
$method = 'get' . ucfirst((string) ClassfunctionHelper::safe(str_replace('_', '', $path)));
@@ -86,7 +62,8 @@ abstract class BaseConfig extends JoomlaRegistry
{
return $value;
}
- elseif (method_exists($this, $method))
+ // Use the method if it's callable and not excluded
+ elseif ($this->isCallableMethod($method))
{
$value = $this->{$method}($default);
@@ -104,19 +81,46 @@ abstract class BaseConfig extends JoomlaRegistry
* @param string $path Parent registry Path (e.g. joomla.content.showauthor)
* @param mixed $value Value of entry
*
- * @return mixed The value of the that has been set.
+ * @return mixed The values of the path that has been set.
*
* @since 3.2.0
*/
public function appendArray(string $path, $value)
{
- // check if it does not exist
- if (!$this->exists($path))
+ return $this->add($path, $value, true)->get($path);
+ }
+
+ /**
+ * Determines if a method is callable on this object, excluding certain methods.
+ *
+ * This method checks if a method exists on this object and is callable, but excludes
+ * certain methods to prevent unintended access or recursion. It helps to safely determine
+ * if a dynamic getter method can be invoked without interfering with core methods.
+ *
+ * @param string $method The method name to check.
+ *
+ * @return bool True if the method is callable and not excluded, false otherwise.
+ * @since 5.0.4
+ */
+ protected function isCallableMethod(string $method): bool
+ {
+ // List of methods to exclude from dynamic access
+ $excludedMethods = [
+ 'getActive',
+ 'get',
+ 'getSeparator',
+ 'getIterator',
+ 'getName',
+ 'getActiveKeys'
+ ];
+
+ // Check if the method exists and is not excluded
+ if (method_exists($this, $method) && !in_array($method, $excludedMethods, true))
{
- $this->set($path, []);
+ return true;
}
- return $this->append($path, $value);
+ return false;
}
}
diff --git a/libraries/vendor_jcb/VDM.Joomla/src/Abstraction/Grep.php b/libraries/vendor_jcb/VDM.Joomla/src/Abstraction/Grep.php
index 8cac2a316..373087334 100644
--- a/libraries/vendor_jcb/VDM.Joomla/src/Abstraction/Grep.php
+++ b/libraries/vendor_jcb/VDM.Joomla/src/Abstraction/Grep.php
@@ -17,6 +17,8 @@ use Joomla\CMS\Language\Text;
use Joomla\CMS\Filesystem\Folder;
use Joomla\CMS\Application\CMSApplication;
use VDM\Joomla\Gitea\Repository\Contents;
+use VDM\Joomla\Interfaces\Git\ApiInterface as Api;
+use VDM\Joomla\Componentbuilder\Network\Resolve;
use VDM\Joomla\Utilities\FileHelper;
use VDM\Joomla\Utilities\JsonHelper;
use VDM\Joomla\Interfaces\GrepInterface;
@@ -50,6 +52,14 @@ abstract class Grep implements GrepInterface
**/
public ?array $paths;
+ /**
+ * The Grep target [network]
+ *
+ * @var string
+ * @since 5.0.4
+ **/
+ protected ?string $target = null;
+
/**
* Order of global search
*
@@ -82,6 +92,14 @@ abstract class Grep implements GrepInterface
*/
protected string $index_path = 'index.json';
+ /**
+ * The VDM global API base
+ *
+ * @var string
+ * @since 5.0.4
+ **/
+ protected string $api_base = '//git.vdm.dev/';
+
/**
* Gitea Repository Contents
*
@@ -90,6 +108,14 @@ abstract class Grep implements GrepInterface
**/
protected Contents $contents;
+ /**
+ * The Resolve Class.
+ *
+ * @var Resolve
+ * @since 5.0.4
+ */
+ protected Resolve $resolve;
+
/**
* Joomla Application object
*
@@ -101,17 +127,22 @@ abstract class Grep implements GrepInterface
/**
* Constructor.
*
- * @param Contents $contents The Gitea Repository Contents object.
- * @param array $paths The approved paths
- * @param string|null $path The local path
- * @param CMSApplication|null $app The CMS Application object.
+ * @param Contents $contents The Gitea Repository Contents object.
+ * @param Resolve $resolve The Resolve Class.
+ * @param array $paths The approved paths
+ * @param string|null $path The local path
+ * @param CMSApplication|null $app The CMS Application object.
*
* @throws \Exception
* @since 3.2.0
*/
- public function __construct(Contents $contents, array $paths, ?string $path = null, ?CMSApplication $app = null)
+ public function __construct(
+ Contents $contents, Resolve $resolve,
+ array $paths, ?string $path = null,
+ ?CMSApplication $app = null)
{
$this->contents = $contents;
+ $this->resolve = $resolve;
$this->paths = $paths;
$this->path = $path;
$this->app = $app ?: Factory::getApplication();
@@ -264,6 +295,38 @@ abstract class Grep implements GrepInterface
return null;
}
+ /**
+ * Loads API config using the provided base URL and token.
+ *
+ * This method checks if the base URL contains 'https://git.vdm.dev/'.
+ * If it does, it uses the token as is (which may be null).
+ * If not, it ensures the token is not null by defaulting to an empty string.
+ *
+ * @param Api $api The api object with a load_ method.
+ * @param string|null $base The base URL path.
+ * @param string|null $token The token for authentication (can be null).
+ *
+ * @return void
+ * @since 5.0.4
+ */
+ public function loadApi(Api $api, ?string $base, ?string $token): void
+ {
+ // Determine the token to use based on the base URL
+ if ($base && strpos($base, $this->api_base) !== false)
+ {
+ // If base contains $this->api_base = https://git.vdm.dev/, use the token as is
+ $tokenToUse = $token;
+ }
+ else
+ {
+ // Otherwise, ensure the token is not null (use empty string if null)
+ $tokenToUse = $token ?? '';
+ }
+
+ // Load the content with the determined base and token
+ $api->load_($base, $tokenToUse);
+ }
+
/**
* Set repository messages and errors based on given conditions.
*
@@ -584,7 +647,7 @@ abstract class Grep implements GrepInterface
try
{
// load the base and token if set
- $this->contents->load_($path->base ?? null, $path->token ?? null);
+ $this->loadApi($this->contents, $path->base ?? null, $path->token ?? null);
$path->index = $this->contents->get($path->organisation, $path->repository, $this->getIndexPath(), $this->getBranchName($path));
}
catch (\Exception $e)
@@ -640,6 +703,12 @@ abstract class Grep implements GrepInterface
if (isset($path->organisation) && strlen($path->organisation) > 1 &&
isset($path->repository) && strlen($path->repository) > 1)
{
+ // resolve API if needed
+ if (!empty($path->base))
+ {
+ $this->resolve->api($this->target ?? $path->repository, $path->base, $path->organisation, $path->repository);
+ }
+
// build the path
$path->path = trim($path->organisation) . '/' . trim($path->repository);
diff --git a/libraries/vendor_jcb/VDM.Joomla/src/Abstraction/Registry.php b/libraries/vendor_jcb/VDM.Joomla/src/Abstraction/Registry.php
index 903fd911c..a9456c601 100644
--- a/libraries/vendor_jcb/VDM.Joomla/src/Abstraction/Registry.php
+++ b/libraries/vendor_jcb/VDM.Joomla/src/Abstraction/Registry.php
@@ -12,6 +12,7 @@
namespace VDM\Joomla\Abstraction;
+use Joomla\Registry\Factory as FormatFactory;
use VDM\Joomla\Interfaces\Registryinterface;
use VDM\Joomla\Abstraction\ActiveRegistry;
@@ -21,18 +22,238 @@ use VDM\Joomla\Abstraction\ActiveRegistry;
*
* Don't use this beyond 10 dimensional depth for best performance.
*
- * @since 3.2.0
+ * @since 3.2.0
+ * @since 5.0.4 Joomla Registry Compatible
*/
-abstract class Registry extends ActiveRegistry implements Registryinterface
+abstract class Registry extends ActiveRegistry implements Registryinterface, \JsonSerializable, \ArrayAccess, \IteratorAggregate, \Countable
{
/**
* Path separator
*
* @var string|null
- * @since 3.2.0
+ * @since 3.2.0
*/
protected ?string $separator = '.';
+ /**
+ * The name of the registry.
+ *
+ * @var string|null
+ * @since 5.0.4
+ */
+ protected ?string $name = null;
+
+ /**
+ * Constructor.
+ *
+ * Initializes the Registry object with optional data.
+ *
+ * @param mixed $data Optional data to load into the registry.
+ * Can be an array, string, or object.
+ * @param string|null $separator The path separator, and empty string will flatten the registry.
+ * @since 5.0.4
+ */
+ public function __construct($data = null, ?string $separator = null)
+ {
+ // we don't allow null on initialization (default is a dot)
+ // so that all class inheritance can override the separator property
+ // use an empty string if you want to flatten the registry
+ if ($separator !== null)
+ {
+ $this->setSeparator($separator);
+ }
+
+ if ($data !== null)
+ {
+ if (is_array($data))
+ {
+ $this->loadArray($data);
+ }
+ elseif (is_string($data))
+ {
+ $this->loadString($data);
+ }
+ elseif (is_object($data))
+ {
+ $this->loadObject($data);
+ }
+ }
+ }
+
+ /**
+ * Magic method to get a value from the registry.
+ *
+ * Allows for accessing registry data using object property syntax.
+ *
+ * @param string $name The name of the property to get.
+ *
+ * @return mixed The value of the property, or null if not found.
+ * @since 5.0.4
+ */
+ public function __get($name)
+ {
+ return $this->get($name);
+ }
+
+ /**
+ * Magic method to set a value in the registry.
+ *
+ * Allows for setting registry data using object property syntax.
+ *
+ * @param string $name The name of the property to set.
+ * @param mixed $value The value to set.
+ *
+ * @return void
+ * @since 5.0.4
+ */
+ public function __set($name, $value)
+ {
+ $this->set($name, $value);
+ }
+
+ /**
+ * Magic method to check if a property is set in the registry.
+ *
+ * Allows for using isset() on registry properties.
+ *
+ * @param string $name The name of the property to check.
+ *
+ * @return bool True if the property is set, false otherwise.
+ * @since 5.0.4
+ */
+ public function __isset($name)
+ {
+ return $this->exists($name);
+ }
+
+ /**
+ * Magic method to unset a property in the registry.
+ *
+ * Allows for using unset() on registry properties.
+ *
+ * @param string $name The name of the property to unset.
+ *
+ * @return void
+ * @since 5.0.4
+ */
+ public function __unset($name)
+ {
+ $this->remove($name);
+ }
+
+ /**
+ * Magic method to clone the registry.
+ *
+ * Performs a deep copy of the registry data.
+ *
+ * @return void
+ * @since 5.0.4
+ */
+ public function __clone()
+ {
+ $this->active = unserialize(serialize($this->active));
+ }
+
+ /**
+ * Magic method to convert the registry to a string.
+ *
+ * Returns the registry data in JSON format.
+ *
+ * @return string The registry data in JSON format.
+ * @since 5.0.4
+ */
+ public function __toString()
+ {
+ return $this->toString();
+ }
+
+ /**
+ * Loads data into the registry from a string using Joomla's format classes.
+ *
+ * @param string $data The data string to load.
+ * @param string $format The format of the data string. Supported formats: 'json', 'ini', 'xml', 'php'.
+ * @param array $options Options used by the formatter
+ *
+ * @return self
+ * @throws \InvalidArgumentException If the format is not supported.
+ * @since 5.0.4
+ */
+ public function loadString(string $data, string $format = 'JSON', array $options = []): self
+ {
+ // Load a string into the given namespace [or default namespace if not given]
+ $object = FormatFactory::getFormat($format, $options)->stringToObject($data, $options);
+
+ // Merge the object into the registry
+ $this->loadObject($object);
+
+ return $this;
+ }
+
+ /**
+ * Loads data into the registry from an object.
+ *
+ * @param object $object The data object to load.
+ *
+ * @return self
+ * @since 5.0.4
+ */
+ public function loadObject(object $object): self
+ {
+ // Convert the object to an array
+ $array = $this->objectToArray($object);
+
+ // Merge the array into the registry
+ $this->loadArray($array);
+
+ return $this;
+ }
+
+ /**
+ * Loads data into the registry from an array.
+ *
+ * The loaded data will be merged into the registry's existing data.
+ *
+ * @param array $array The array of data to load into the registry.
+ *
+ * @return self
+ * @since 5.0.4
+ */
+ public function loadArray(array $array): self
+ {
+ $this->active = $this->arrayMergeRecursive($this->active, $array);
+ return $this;
+ }
+
+ /**
+ * Loads data into the registry from a file.
+ *
+ * @param string $path The path to the file to load.
+ * @param string $format The format of the file. Supported formats: 'json', 'ini', 'xml', 'php'.
+ *
+ * @return self
+ * @throws \InvalidArgumentException If the file does not exist or is not readable.
+ * @throws \RuntimeException If the file cannot be read.
+ * @since 5.0.4
+ */
+ public function loadFile(string $path, string $format = 'json'): self
+ {
+ if (!file_exists($path) || !is_readable($path))
+ {
+ throw new \InvalidArgumentException("File does not exist or is not readable: {$path}");
+ }
+
+ $data = file_get_contents($path);
+
+ if ($data === false)
+ {
+ throw new \RuntimeException("Failed to read file: {$path}");
+ }
+
+ $this->loadString($data, $format);
+
+ return $this;
+ }
+
/**
* Sets a value into the registry using multiple keys.
*
@@ -41,7 +262,7 @@ abstract class Registry extends ActiveRegistry implements Registryinterface
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return self
- * @since 3.2.0
+ * @since 3.2.0
*/
public function set(string $path, $value): self
{
@@ -67,7 +288,7 @@ abstract class Registry extends ActiveRegistry implements Registryinterface
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return self
- * @since 3.2.0
+ * @since 3.2.0
*/
public function add(string $path, $value, ?bool $asArray = null): self
{
@@ -89,9 +310,9 @@ abstract class Registry extends ActiveRegistry implements Registryinterface
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return mixed The value or sub-array from the storage. Null if the location doesn't exist.
- * @since 3.2.0
+ * @since 3.2.0
*/
- public function get(string $path, $default = null)
+ public function get(string $path, $default = null): mixed
{
if (($keys = $this->getActiveKeys($path)) === null)
{
@@ -108,7 +329,7 @@ abstract class Registry extends ActiveRegistry implements Registryinterface
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return self
- * @since 3.2.0
+ * @since 3.2.0
*/
public function remove(string $path): self
{
@@ -129,7 +350,7 @@ abstract class Registry extends ActiveRegistry implements Registryinterface
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return bool True if the location exists, false otherwise.
- * @since 3.2.0
+ * @since 3.2.0
*/
public function exists(string $path): bool
{
@@ -141,13 +362,308 @@ abstract class Registry extends ActiveRegistry implements Registryinterface
return $this->existsActive(...$keys);
}
+ /**
+ * Specify data which should be serialized to JSON.
+ *
+ * @return mixed Data which can be serialized by json_encode(),
+ * which is a value of any type other than a resource.
+ * @since 5.0.4
+ */
+ public function jsonSerialize(): mixed
+ {
+ return $this->active;
+ }
+
+ /**
+ * Count elements of the registry.
+ *
+ * @return int The number of elements in the registry.
+ * @since 5.0.4
+ */
+ public function count(): int
+ {
+ return count($this->active);
+ }
+
+ /**
+ * Whether a given offset exists in the registry.
+ *
+ * @param mixed $offset An offset to check for.
+ *
+ * @return bool True if the offset exists, false otherwise.
+ * @since 5.0.4
+ */
+ public function offsetExists(mixed $offset): bool
+ {
+ if (!is_string($offset))
+ {
+ return false;
+ }
+ return $this->exists($offset);
+ }
+
+ /**
+ * Retrieve the value at a given offset.
+ *
+ * @param mixed $offset The offset to retrieve.
+ *
+ * @return mixed The value at the specified offset.
+ * @since 5.0.4
+ */
+ public function offsetGet(mixed $offset): mixed
+ {
+ if (!is_string($offset))
+ {
+ return null;
+ }
+ return $this->get($offset);
+ }
+
+ /**
+ * Set the value at a given offset.
+ *
+ * @param mixed $offset The offset to assign the value to.
+ * @param mixed $value The value to set.
+ *
+ * @return void
+ * @since 5.0.4
+ */
+ public function offsetSet(mixed $offset, mixed $value): void
+ {
+ if (!is_string($offset))
+ {
+ return;
+ }
+ $this->set($offset, $value);
+ }
+
+ /**
+ * Unset the value at a given offset.
+ *
+ * @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
*
* @param string|null $value The value to set.
*
* @return self
- * @since 3.2.0
+ * @since 3.2.0
*/
public function setSeparator(?string $value): self
{
@@ -156,13 +672,140 @@ abstract class Registry extends ActiveRegistry implements Registryinterface
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
*
* @param string $path The path to determine the location registry.
*
* @return array|null The valid array of keys
- * @since 3.2.0
+ * @since 3.2.0
*/
protected function getActiveKeys(string $path): ?array
{
diff --git a/libraries/vendor_jcb/VDM.Joomla/src/Abstraction/Registry/Traits/Count.php b/libraries/vendor_jcb/VDM.Joomla/src/Abstraction/Registry/Traits/PathCount.php
similarity index 82%
rename from libraries/vendor_jcb/VDM.Joomla/src/Abstraction/Registry/Traits/Count.php
rename to libraries/vendor_jcb/VDM.Joomla/src/Abstraction/Registry/Traits/PathCount.php
index 5584a9ffe..9d659547d 100644
--- a/libraries/vendor_jcb/VDM.Joomla/src/Abstraction/Registry/Traits/Count.php
+++ b/libraries/vendor_jcb/VDM.Joomla/src/Abstraction/Registry/Traits/PathCount.php
@@ -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.
@@ -28,7 +29,7 @@ trait Count
* @return int The number of values
* @since 3.2.0
*/
- public function count(string $path): int
+ public function pathCount(string $path): int
{
if (($values = $this->get($path)) === null)
{
diff --git a/libraries/vendor_jcb/VDM.Joomla/src/Abstraction/Registry/Traits/ToString.php b/libraries/vendor_jcb/VDM.Joomla/src/Abstraction/Registry/Traits/PathToString.php
similarity index 79%
rename from libraries/vendor_jcb/VDM.Joomla/src/Abstraction/Registry/Traits/ToString.php
rename to libraries/vendor_jcb/VDM.Joomla/src/Abstraction/Registry/Traits/PathToString.php
index 285f7099d..de81af055 100644
--- a/libraries/vendor_jcb/VDM.Joomla/src/Abstraction/Registry/Traits/ToString.php
+++ b/libraries/vendor_jcb/VDM.Joomla/src/Abstraction/Registry/Traits/PathToString.php
@@ -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)
@@ -26,9 +27,9 @@ trait ToString
* @param string $seperator Return string separator
*
* @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
if (empty($path))
diff --git a/libraries/vendor_jcb/VDM.Joomla/src/Abstraction/Remote/Set.php b/libraries/vendor_jcb/VDM.Joomla/src/Abstraction/Remote/Set.php
index 039a8d82f..5c9612221 100644
--- a/libraries/vendor_jcb/VDM.Joomla/src/Abstraction/Remote/Set.php
+++ b/libraries/vendor_jcb/VDM.Joomla/src/Abstraction/Remote/Set.php
@@ -416,6 +416,8 @@ abstract class Set implements SetInterface
$settings = $this->mergeIndexSettings($repoGuid, $settings);
+ $this->grep->loadApi($this->git, $repo->base ?? null, $repo->token ?? null);
+
$this->updateIndexMainFile(
$repo,
$this->getIndexSettingsPath(),
@@ -429,6 +431,8 @@ abstract class Set implements SetInterface
$this->mainReadme->get($settings),
'Update main readme file'
);
+
+ $this->git->reset_();
}
/**
@@ -580,7 +584,7 @@ abstract class Set implements SetInterface
$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)
{
diff --git a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Abstraction/Api.php b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Abstraction/Api.php
new file mode 100644
index 000000000..9db072c2f
--- /dev/null
+++ b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Abstraction/Api.php
@@ -0,0 +1,67 @@
+
+ * @git 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;
+ }
+}
+
diff --git a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Abstraction/BaseConfig.php b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Abstraction/ComponentConfig.php
similarity index 81%
rename from libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Abstraction/BaseConfig.php
rename to libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Abstraction/ComponentConfig.php
index 0d4de7df8..d60509e2a 100644
--- a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Abstraction/BaseConfig.php
+++ b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Abstraction/ComponentConfig.php
@@ -17,18 +17,18 @@ use Joomla\CMS\Factory;
use Joomla\Input\Input;
use VDM\Joomla\Utilities\Component\Helper;
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
*/
-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
* @since 3.2.0
@@ -56,9 +56,6 @@ abstract class BaseConfig extends ExtendingBaseConfig
{
$this->input = $input ?: Factory::getApplication()->input;
$this->params = $params ?: Helper::getParams('com_componentbuilder');
-
- // run parent constructor
- parent::__construct();
}
}
diff --git a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Api/Network.php b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Api/Network.php
new file mode 100644
index 000000000..995b81a39
--- /dev/null
+++ b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Api/Network.php
@@ -0,0 +1,59 @@
+
+ * @git 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)
+ )
+ );
+ }
+}
+
diff --git a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Api/index.html b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Api/index.html
new file mode 100644
index 000000000..fa6d84e80
--- /dev/null
+++ b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Api/index.html
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Adminview/Data.php b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Adminview/Data.php
index 501266958..a390dd4a2 100644
--- a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Adminview/Data.php
+++ b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Adminview/Data.php
@@ -47,6 +47,14 @@ use VDM\Joomla\Utilities\ArrayHelper;
*/
class Data
{
+ /**
+ * The cache
+ *
+ * @var array
+ * @since 3.2.0
+ */
+ protected array $data;
+
/**
* The Config Class.
*
diff --git a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Builder/CustomFieldLinks.php b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Builder/CustomFieldLinks.php
index df81be489..a2bf2234d 100644
--- a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Builder/CustomFieldLinks.php
+++ b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Builder/CustomFieldLinks.php
@@ -12,7 +12,7 @@
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\Abstraction\Registry;
@@ -25,10 +25,10 @@ use VDM\Joomla\Abstraction\Registry;
final class CustomFieldLinks extends Registry implements Registryinterface
{
/**
- * To String Values
+ * Path To String Values
*
* @since 3.2.0
*/
- use ToString;
+ use PathToString;
}
diff --git a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Builder/DynamicFields.php b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Builder/DynamicFields.php
index df3982eb7..c3feed016 100644
--- a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Builder/DynamicFields.php
+++ b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Builder/DynamicFields.php
@@ -12,7 +12,7 @@
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\Abstraction\Registry;
@@ -25,10 +25,10 @@ use VDM\Joomla\Abstraction\Registry;
final class DynamicFields extends Registry implements Registryinterface
{
/**
- * To String Values
+ * Path To String Values
*
* @since 3.2.0
*/
- use ToString;
+ use PathToString;
}
diff --git a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Builder/HiddenFields.php b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Builder/HiddenFields.php
index bfef415f6..4f67dd7f6 100644
--- a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Builder/HiddenFields.php
+++ b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Builder/HiddenFields.php
@@ -12,7 +12,7 @@
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\Abstraction\Registry;
@@ -25,10 +25,10 @@ use VDM\Joomla\Abstraction\Registry;
final class HiddenFields extends Registry implements Registryinterface
{
/**
- * To String Values
+ * Path To String Values
*
* @since 3.2.0
*/
- use ToString;
+ use PathToString;
}
diff --git a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Builder/IntegerFields.php b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Builder/IntegerFields.php
index 37135aca4..4a6f20d0e 100644
--- a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Builder/IntegerFields.php
+++ b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Builder/IntegerFields.php
@@ -12,7 +12,7 @@
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\Abstraction\Registry;
@@ -25,10 +25,10 @@ use VDM\Joomla\Abstraction\Registry;
final class IntegerFields extends Registry implements Registryinterface
{
/**
- * To String Values
+ * Path To String Values
*
* @since 3.2.0
*/
- use ToString;
+ use PathToString;
}
diff --git a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Builder/Layout.php b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Builder/Layout.php
index cd5074bfe..cb3749492 100644
--- a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Builder/Layout.php
+++ b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Builder/Layout.php
@@ -12,7 +12,7 @@
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\Abstraction\Registry;
@@ -25,10 +25,10 @@ use VDM\Joomla\Abstraction\Registry;
final class Layout extends Registry implements Registryinterface
{
/**
- * Count Values
+ * Path Count Values
*
* @since 3.2.0
*/
- use Count;
+ use PathCount;
}
diff --git a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Builder/NewPublishingFields.php b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Builder/NewPublishingFields.php
index c32d4dbd7..1ef80383c 100644
--- a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Builder/NewPublishingFields.php
+++ b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Builder/NewPublishingFields.php
@@ -12,7 +12,7 @@
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\Abstraction\Registry;
@@ -25,10 +25,10 @@ use VDM\Joomla\Abstraction\Registry;
final class NewPublishingFields extends Registry implements Registryinterface
{
/**
- * Count Values
+ * Path Count Values
*
* @since 3.2.0
*/
- use Count;
+ use PathCount;
}
diff --git a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Config.php b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Config.php
index 1c23e07f4..62cb53e62 100644
--- a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Config.php
+++ b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Config.php
@@ -18,7 +18,7 @@ use Joomla\Input\Input;
use VDM\Joomla\Utilities\GetHelper;
use VDM\Joomla\Utilities\StringHelper;
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
*/
-class Config extends BaseConfig
+class Config extends ComponentConfig
{
/**
* The Global Joomla Configuration
diff --git a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Creator/Layout.php b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Creator/Layout.php
index 77047ed28..2eccc9673 100644
--- a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Creator/Layout.php
+++ b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Creator/Layout.php
@@ -139,7 +139,7 @@ final class Layout
if ($this->layout->exists($nameSingleCode . '.' . $tabName . '.'
. $field['alignment'] . '.' . $field['order_edit']))
{
- $size = $this->layout->count($nameSingleCode . '.' . $tabName . '.'
+ $size = $this->layout->pathCount($nameSingleCode . '.' . $tabName . '.'
. $field['alignment']) + 1;
while ($this->layout->exists($nameSingleCode . '.' . $tabName . '.'
. $field['alignment'] . '.' . $size))
@@ -168,7 +168,7 @@ final class Layout
if ($this->newpublishingfields->exists($nameSingleCode . '.' .
$field['alignment'] . '.' . $field['order_edit']))
{
- $size = $this->newpublishingfields->count($nameSingleCode . '.' .
+ $size = $this->newpublishingfields->pathCount($nameSingleCode . '.' .
$field['alignment']) + 1;
while ($this->newpublishingfields->exists($nameSingleCode . '.' .
$field['alignment'] . '.' . $size))
@@ -191,7 +191,7 @@ final class Layout
if ($this->layout->exists($nameSingleCode . '.Details.'
. $field['alignment'] . '.' . $field['order_edit']))
{
- $size = $this->layout->count($nameSingleCode . '.Details.'
+ $size = $this->layout->pathCount($nameSingleCode . '.Details.'
. $field['alignment']) + 1;
while ($this->layout->exists($nameSingleCode . '.Details.'
. $field['alignment'] . '.' . $size))
diff --git a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Factory.php b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Factory.php
index 9184813d4..d3c799a6c 100644
--- a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Factory.php
+++ b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Factory.php
@@ -15,6 +15,8 @@ namespace VDM\Joomla\Componentbuilder\Compiler;
use Joomla\DI\Container;
use VDM\Joomla\Componentbuilder\Service\Crypt;
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\Model as BaseModel;
use VDM\Joomla\Service\Data;
@@ -124,6 +126,8 @@ abstract class Factory extends ExtendingFactory implements FactoryInterface
return (new Container())
->registerServiceProvider(new Crypt())
->registerServiceProvider(new Server())
+ ->registerServiceProvider(new Api())
+ ->registerServiceProvider(new Network())
->registerServiceProvider(new Database())
->registerServiceProvider(new BaseModel())
->registerServiceProvider(new Data())
diff --git a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Field/JoomlaThree/InputButton.php b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Field/JoomlaThree/InputButton.php
index 4d02833fc..2e2762dec 100644
--- a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Field/JoomlaThree/InputButton.php
+++ b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Field/JoomlaThree/InputButton.php
@@ -181,7 +181,7 @@ final class InputButton implements InputButtonInterface
$addButton[] = Indent::_(4) . "//" . Line::_(__Line__, __Class__)
. " get the return value.";
$addButton[] = Indent::_(4)
- . "\$_uri = (string) \Joomla\CMS\Uri\Uri::getInstance();";
+ . "\$_uri = (string) Joomla__"."_eecc143e_b5cf_4c33_ba4d_97da1df61422___Power::getInstance();";
$addButton[] = Indent::_(4)
. "\$_return = urlencode(base64_encode(\$_uri));";
$addButton[] = Indent::_(4) . "//" . Line::_(__Line__, __Class__)
@@ -206,7 +206,7 @@ final class InputButton implements InputButtonInterface
$addButton[] = Indent::_(4) . "//" . Line::_(__Line__, __Class__)
. " get the return value.";
$addButton[] = Indent::_(4)
- . "\$_uri = (string) \Joomla\CMS\Uri\Uri::getInstance();";
+ . "\$_uri = (string) Joomla__"."_eecc143e_b5cf_4c33_ba4d_97da1df61422___Power::getInstance();";
$addButton[] = Indent::_(4)
. "\$_return = urlencode(base64_encode(\$_uri));";
$addButton[] = Indent::_(4) . "//" . Line::_(__Line__, __Class__)
diff --git a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Helper/Interpretation.php b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Helper/Interpretation.php
index 4285ac524..e5e191d52 100644
--- a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Helper/Interpretation.php
+++ b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Helper/Interpretation.php
@@ -1510,7 +1510,7 @@ class Interpretation extends Fields
. "protected static function loadArticleLink(\$id)";
$help[] = Indent::_(1) . "{";
$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[] = PHP_EOL . Indent::_(1) . "/**";
$help[] = Indent::_(1) . " * Get the Help Text Link.";
@@ -1518,7 +1518,7 @@ class Interpretation extends Fields
$help[] = Indent::_(1)
. "protected static function loadHelpTextLink(\$id)";
$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_"
. CFactory::_('Config')->component_code_name
. "&task=help.getText&id=' . (int) \$id . '&' . \$token . '=1';";
@@ -3216,7 +3216,7 @@ class Interpretation extends Fields
$redirectMessage = Indent::_(3) . "//" . Line::_(
__LINE__,__CLASS__
) . " 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::_(
__LINE__,__CLASS__
@@ -3398,7 +3398,7 @@ class Interpretation extends Fields
}
else
{
- $redirectString = 'Uri::root()';
+ $redirectString = 'Joomla__'.'_eecc143e_b5cf_4c33_ba4d_97da1df61422___Power::root()';
}
$getItem .= PHP_EOL . Indent::_(1) . $tab . Indent::_(2)
. "\$app->redirect(" . $redirectString . ");";
@@ -8549,10 +8549,10 @@ class Interpretation extends Fields
);
$View = StringHelper::safe($view, 'F');
$maintext = CFactory::_('Compiler.Builder.Main.Text.Field')->get($view, 'null');
- $hiddenFields = CFactory::_('Compiler.Builder.Hidden.Fields')->toString($view, '');
- $dynamicfields = CFactory::_('Compiler.Builder.Dynamic.Fields')->toString($view, ',');
- $intFields = CFactory::_('Compiler.Builder.Integer.Fields')->toString($view, '');
- $customfieldlinks = CFactory::_('Compiler.Builder.Custom.Field.Links')->toString($view, '');
+ $hiddenFields = CFactory::_('Compiler.Builder.Hidden.Fields')->pathToString($view, '');
+ $dynamicfields = CFactory::_('Compiler.Builder.Dynamic.Fields')->pathToString($view, ',');
+ $intFields = CFactory::_('Compiler.Builder.Integer.Fields')->pathToString($view, '');
+ $customfieldlinks = CFactory::_('Compiler.Builder.Custom.Field.Links')->pathToString($view, '');
// build uninstall script for content types
$this->uninstallScriptBuilder[$View] = 'com_' . $component . '.' . $view;
$this->uninstallScriptContent[$view] = $view;
@@ -10037,14 +10037,30 @@ class Interpretation extends Fields
// check if default field was overwritten
if (!CFactory::_('Compiler.Builder.Field.Names')->isString($view . '.created_by'))
{
- $db_ .= PHP_EOL . Indent::_(1)
- . "`created_by` INT(10) unsigned NULL DEFAULT 0,";
+ if (CFactory::_('Config')->get('joomla_version', 3) == 3)
+ {
+ $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
if (!CFactory::_('Compiler.Builder.Field.Names')->isString($view . '.modified_by'))
{
- $db_ .= PHP_EOL . Indent::_(1)
- . "`modified_by` INT(10) unsigned NULL DEFAULT 0,";
+ if (CFactory::_('Config')->get('joomla_version', 3) == 3)
+ {
+ $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
if (!CFactory::_('Compiler.Builder.Field.Names')->isString($view . '.created'))
@@ -10071,14 +10087,22 @@ class Interpretation extends Fields
else
{
$db_ .= PHP_EOL . Indent::_(1)
- . "`modified` DATETIME DEFAULT NULL,";
+ . "`modified` DATETIME,";
}
}
// check if default field was overwritten
if (!CFactory::_('Compiler.Builder.Field.Names')->isString($view . '.checked_out'))
{
- $db_ .= PHP_EOL . Indent::_(1)
- . "`checked_out` int(11) unsigned NULL DEFAULT 0,";
+ if (CFactory::_('Config')->get('joomla_version', 3) == 3)
+ {
+ $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
if (!CFactory::_('Compiler.Builder.Field.Names')->isString($view . '.checked_out_time'))
@@ -10091,7 +10115,7 @@ class Interpretation extends Fields
else
{
$db_ .= PHP_EOL . Indent::_(1)
- . "`checked_out_time` DATETIME DEFAULT NULL,";
+ . "`checked_out_time` DATETIME,";
}
}
// check if default field was overwritten
@@ -11077,9 +11101,9 @@ class Interpretation extends Fields
$body .= PHP_EOL . Indent::_(2)
. "\$userChkOut = Factory::getContainer()->";
$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)
- . "loadUserById(\$item->checked_out);";
+ . "loadUserById(\$item->checked_out ?? 0);";
}
$body .= PHP_EOL . Indent::_(2) . "\$canDo = " . $Helper
. "::getActions('" . $nameSingleCode . "',\$item,'"
@@ -11560,8 +11584,8 @@ class Interpretation extends Fields
else
{
return 'Factory::getContainer()->'
- . 'get(\Joomla\CMS\User\UserFactoryInterface::class)->'
- . 'loadUserById((int) $item->' . $item['code'] . ')->name';
+ . 'get(Joomla__'.'_c2980d12_c3ef_4e23_b4a2_e6af1f5900a9___Power::class)->'
+ . 'loadUserById((int) $item->' . $item['code'] . ' ?? 0)->name';
}
}
// check if custom user
@@ -11577,8 +11601,8 @@ class Interpretation extends Fields
else
{
return 'Factory::getContainer()->'
- . 'get(\Joomla\CMS\User\UserFactoryInterface::class)->'
- . 'loadUserById((int) $item->' . $item['id_code'] . ')->name';
+ . 'get(Joomla__'.'_c2980d12_c3ef_4e23_b4a2_e6af1f5900a9___Power::class)->'
+ . 'loadUserById((int) $item->' . $item['id_code'] . ' ?? 0)->name';
}
}
// check if translated value is used
@@ -11598,8 +11622,8 @@ class Interpretation extends Fields
else
{
return 'Factory::getContainer()->'
- . 'get(\Joomla\CMS\User\UserFactoryInterface::class)->'
- . 'loadUserById((int) $item->' . $item['code'] . ')->name';
+ . 'get(Joomla__'.'_c2980d12_c3ef_4e23_b4a2_e6af1f5900a9___Power::class)->'
+ . 'loadUserById((int) $item->' . $item['code'] . ' ?? 0)->name';
}
}
elseif ($doNotEscape)
@@ -13708,9 +13732,9 @@ class Interpretation extends Fields
$body .= PHP_EOL . Indent::_(2)
. "\$userChkOut = Factory::getContainer()->";
$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)
- . "loadUserById(\$item->checked_out);";
+ . "loadUserById(\$item->checked_out ?? 0);";
}
$body .= PHP_EOL . Indent::_(2) . "\$canDo = " . $Helper
. "::getActions('" . $nameSingleCode . "',\$item,'"
@@ -14636,7 +14660,7 @@ class Interpretation extends Fields
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
. " Check for request forgeries";
$method[] = Indent::_(2)
- . "Session::checkToken() or die(Text:"
+ . "Joomla__"."_5ba38513_5c4f_4b0d_935e_49e986a6bce8___Power::checkToken() or die(Text:"
. ":_('JINVALID_TOKEN'));";
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
. " check if export is allowed for this user.";
@@ -14990,7 +15014,7 @@ class Interpretation extends Fields
$method[] = Indent::_(1) . "{";
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
. " 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'));";
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
. " check if export is allowed for this user.";
@@ -15058,7 +15082,7 @@ class Interpretation extends Fields
$method[] = Indent::_(1) . "{";
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
. " 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'));";
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
. " check if import is allowed for this user.";
@@ -17321,7 +17345,7 @@ class Interpretation extends Fields
$fix .= PHP_EOL . Indent::_(2) . "//" . Line::_(__Line__, __Class__)
. " Add Ajax Token";
$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;
@@ -17880,12 +17904,10 @@ class Interpretation extends Fields
$function[] = Indent::_(5)
. "Factory::getContainer()->";
$function[] = Indent::_(5)
- . "get(\Joomla\CMS\User\UserFactoryInterface::class)->";
+ . "get(Joomla__"."_c2980d12_c3ef_4e23_b4a2_e6af1f5900a9___Power::class)->";
$function[] = Indent::_(5)
- . "loadUserById(\$"
- . $filter['code'] . ")->name";
- $function[] = Indent::_(5)
- . ");";
+ . "loadUserById(\$" . $filter['code'] . " ?? 0)->name";
+ $function[] = Indent::_(5) . ");";
}
}
else
diff --git a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Model/Whmcs.php b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Model/Whmcs.php
index 378ca8739..2569d4cff 100644
--- a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Model/Whmcs.php
+++ b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Model/Whmcs.php
@@ -32,6 +32,11 @@ class Whmcs
*/
public function set(object &$item)
{
+ if (!isset($item->add_license))
+ {
+ return;
+ }
+
if (1 == $item->add_license
&& (!isset($item->whmcs_buy_link)
|| !StringHelper::check(
diff --git a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Service/JoomlaPower.php b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Service/JoomlaPower.php
index d6c59643f..e8cac510a 100644
--- a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Service/JoomlaPower.php
+++ b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Service/JoomlaPower.php
@@ -101,6 +101,7 @@ class JoomlaPower implements ServiceProviderInterface
{
return new Grep(
$container->get('Gitea.Repository.Contents'),
+ $container->get('Network.Resolve'),
$container->get('Config')->approved_joomla_paths
);
}
diff --git a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Service/Power.php b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Service/Power.php
index 48e58c91d..1aeedc294 100644
--- a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Service/Power.php
+++ b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Service/Power.php
@@ -129,6 +129,7 @@ class Power implements ServiceProviderInterface
{
return new Grep(
$container->get('Gitea.Repository.Contents'),
+ $container->get('Network.Resolve'),
$container->get('Config')->approved_paths,
$container->get('Config')->local_powers_repository_path
);
diff --git a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Service/Utilities.php b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Service/Utilities.php
index bf14861fc..5d1641ff7 100644
--- a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Service/Utilities.php
+++ b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Service/Utilities.php
@@ -21,11 +21,14 @@ use VDM\Joomla\Componentbuilder\Compiler\Utilities\FileInjector;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Paths;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Counter;
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\Pathfix;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Structure;
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.
*
* @return void
- * @since 3.2.0
+ * @since 3.2.0
*/
public function register(Container $container)
{
@@ -63,9 +66,6 @@ class Utilities implements ServiceProviderInterface
$container->alias(Files::class, 'Utilities.Files')
->share('Utilities.Files', [$this, 'getFiles'], true);
- $container->alias(Constantpaths::class, 'Utilities.Constantpaths')
- ->share('Utilities.Constantpaths', [$this, 'getConstantpaths'], true);
-
$container->alias(Dynamicpath::class, 'Utilities.Dynamicpath')
->share('Utilities.Dynamicpath', [$this, 'getDynamicpath'], true);
@@ -77,6 +77,18 @@ class Utilities implements ServiceProviderInterface
$container->alias(Xml::class, 'Utilities.Xml')
->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.
*
* @return Folder
- * @since 3.2.0
+ * @since 3.2.0
*/
public function getFolder(Container $container): Folder
{
@@ -101,7 +113,7 @@ class Utilities implements ServiceProviderInterface
* @param Container $container The DI container.
*
* @return File
- * @since 3.2.0
+ * @since 3.2.0
*/
public function getFile(Container $container): File
{
@@ -116,7 +128,7 @@ class Utilities implements ServiceProviderInterface
* @param Container $container The DI container.
*
* @return FileInjector
- * @since 3.2.0
+ * @since 3.2.0
*/
public function getFileInjector(Container $container): FileInjector
{
@@ -132,7 +144,7 @@ class Utilities implements ServiceProviderInterface
* @param Container $container The DI container.
*
* @return Counter
- * @since 3.2.0
+ * @since 3.2.0
*/
public function getCounter(Container $container): Counter
{
@@ -147,7 +159,7 @@ class Utilities implements ServiceProviderInterface
* @param Container $container The DI container.
*
* @return Paths
- * @since 3.2.0
+ * @since 3.2.0
*/
public function getPaths(Container $container): Paths
{
@@ -163,33 +175,20 @@ class Utilities implements ServiceProviderInterface
* @param Container $container The DI container.
*
* @return Files
- * @since 3.2.0
+ * @since 3.2.0
*/
public function getFiles(Container $container): 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
*
* @param Container $container The DI container.
*
* @return Dynamicpath
- * @since 3.2.0
+ * @since 3.2.0
*/
public function getDynamicpath(Container $container): Dynamicpath
{
@@ -205,7 +204,7 @@ class Utilities implements ServiceProviderInterface
* @param Container $container The DI container.
*
* @return Pathfix
- * @since 3.2.0
+ * @since 3.2.0
*/
public function getPathfix(Container $container): Pathfix
{
@@ -218,7 +217,7 @@ class Utilities implements ServiceProviderInterface
* @param Container $container The DI container.
*
* @return Structure
- * @since 3.2.0
+ * @since 3.2.0
*/
public function getStructure(Container $container): Structure
{
@@ -238,13 +237,65 @@ class Utilities implements ServiceProviderInterface
* @param Container $container The DI container.
*
* @return Xml
- * @since 3.2.0
+ * @since 3.2.0
*/
public function getXml(Container $container): Xml
{
return new Xml(
$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();
}
}
diff --git a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Utilities/Paths.php b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Utilities/Paths.php
index f4a710478..f92aa5cb9 100644
--- a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Utilities/Paths.php
+++ b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Utilities/Paths.php
@@ -75,13 +75,13 @@ class Paths extends Registry
/**
* 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
* @since 3.2.0
* @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
if ($this->exists($key))
diff --git a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Fieldtype/Config.php b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Fieldtype/Config.php
index d5a163fae..893c16265 100644
--- a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Fieldtype/Config.php
+++ b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Fieldtype/Config.php
@@ -17,7 +17,7 @@ use Joomla\CMS\Factory as JoomlaFactory;
use VDM\Joomla\Utilities\GetHelper;
use VDM\Joomla\Utilities\StringHelper;
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
*/
-class Config extends BaseConfig
+class Config extends ComponentConfig
{
/**
* The Global Joomla Configuration
diff --git a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Fieldtype/Factory.php b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Fieldtype/Factory.php
index 7d5a35e53..120423a9a 100644
--- a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Fieldtype/Factory.php
+++ b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Fieldtype/Factory.php
@@ -20,6 +20,9 @@ use VDM\Joomla\Service\Data;
use VDM\Joomla\Componentbuilder\Service\Gitea;
use VDM\Joomla\Componentbuilder\Power\Service\Gitea as GiteaPower;
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\Abstraction\Factory as ExtendingFactory;
@@ -54,7 +57,10 @@ abstract class Factory extends ExtendingFactory implements FactoryInterface
->registerServiceProvider(new Data())
->registerServiceProvider(new Gitea())
->registerServiceProvider(new GiteaPower())
- ->registerServiceProvider(new GiteaUtilities());
+ ->registerServiceProvider(new GiteaUtilities())
+ ->registerServiceProvider(new Api())
+ ->registerServiceProvider(new Network())
+ ->registerServiceProvider(new Utilities());
}
}
diff --git a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Fieldtype/Grep.php b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Fieldtype/Grep.php
index b0e1ac190..526e7d495 100644
--- a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Fieldtype/Grep.php
+++ b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Fieldtype/Grep.php
@@ -29,6 +29,14 @@ use VDM\Joomla\Abstraction\Grep as ExtendingGrep;
*/
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
*
@@ -77,7 +85,7 @@ final class Grep extends ExtendingGrep implements GrepInterface
$branch = $this->getBranchName($path);
// 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
if (($power = $this->loadRemoteFile($path->organisation, $path->repository, $path->index->{$guid}->path . '/item.json', $branch)) !== null &&
diff --git a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Fieldtype/Service/Fieldtype.php b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Fieldtype/Service/Fieldtype.php
index 669f522c6..19873bbc4 100644
--- a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Fieldtype/Service/Fieldtype.php
+++ b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Fieldtype/Service/Fieldtype.php
@@ -100,6 +100,7 @@ class Fieldtype implements ServiceProviderInterface
{
return new Grep(
$container->get('Gitea.Repository.Contents'),
+ $container->get('Network.Resolve'),
$container->get('Config')->approved_joomla_paths
);
}
diff --git a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/JoomlaPower/Config.php b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/JoomlaPower/Config.php
index a1d52bc50..64cd840ce 100644
--- a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/JoomlaPower/Config.php
+++ b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/JoomlaPower/Config.php
@@ -17,7 +17,7 @@ use Joomla\CMS\Factory as JoomlaFactory;
use VDM\Joomla\Utilities\GetHelper;
use VDM\Joomla\Utilities\StringHelper;
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
*/
-class Config extends BaseConfig
+class Config extends ComponentConfig
{
/**
* The Global Joomla Configuration
diff --git a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/JoomlaPower/Factory.php b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/JoomlaPower/Factory.php
index 0ced36851..3b12dcaf3 100644
--- a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/JoomlaPower/Factory.php
+++ b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/JoomlaPower/Factory.php
@@ -20,6 +20,9 @@ use VDM\Joomla\Service\Data;
use VDM\Joomla\Componentbuilder\Service\Gitea;
use VDM\Joomla\Componentbuilder\Power\Service\Gitea as GiteaPower;
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\Abstraction\Factory as ExtendingFactory;
@@ -54,7 +57,10 @@ abstract class Factory extends ExtendingFactory implements FactoryInterface
->registerServiceProvider(new Data())
->registerServiceProvider(new Gitea())
->registerServiceProvider(new GiteaPower())
- ->registerServiceProvider(new GiteaUtilities());
+ ->registerServiceProvider(new GiteaUtilities())
+ ->registerServiceProvider(new Network())
+ ->registerServiceProvider(new Api())
+ ->registerServiceProvider(new Utilities());
}
}
diff --git a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/JoomlaPower/Grep.php b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/JoomlaPower/Grep.php
index ec51d2d63..9256b9451 100644
--- a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/JoomlaPower/Grep.php
+++ b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/JoomlaPower/Grep.php
@@ -29,6 +29,14 @@ use VDM\Joomla\Abstraction\Grep as ExtendingGrep;
*/
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
*
@@ -77,7 +85,7 @@ final class Grep extends ExtendingGrep implements GrepInterface
$branch = $this->getBranchName($path);
// 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
if (($power = $this->loadRemoteFile($path->organisation, $path->repository, $path->index->{$guid}->path . '/item.json', $branch)) !== null &&
diff --git a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/JoomlaPower/Service/JoomlaPower.php b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/JoomlaPower/Service/JoomlaPower.php
index aadc6da79..f048c0970 100644
--- a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/JoomlaPower/Service/JoomlaPower.php
+++ b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/JoomlaPower/Service/JoomlaPower.php
@@ -100,6 +100,7 @@ class JoomlaPower implements ServiceProviderInterface
{
return new Grep(
$container->get('Gitea.Repository.Contents'),
+ $container->get('Network.Resolve'),
$container->get('Config')->approved_joomla_paths
);
}
diff --git a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Network/Core.php b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Network/Core.php
new file mode 100644
index 000000000..e6d58ac1e
--- /dev/null
+++ b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Network/Core.php
@@ -0,0 +1,33 @@
+
+ * @git 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 = '|';
+}
+
diff --git a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Network/ParsedUrls.php b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Network/ParsedUrls.php
new file mode 100644
index 000000000..92915a4fa
--- /dev/null
+++ b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Network/ParsedUrls.php
@@ -0,0 +1,33 @@
+
+ * @git 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 = '|';
+}
+
diff --git a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Network/Resolve.php b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Network/Resolve.php
new file mode 100644
index 000000000..fec698935
--- /dev/null
+++ b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Network/Resolve.php
@@ -0,0 +1,178 @@
+
+ * @git 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');
+ }
+}
+
diff --git a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Network/Status.php b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Network/Status.php
new file mode 100644
index 000000000..e95c0d947
--- /dev/null
+++ b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Network/Status.php
@@ -0,0 +1,258 @@
+
+ * @git 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;
+ }
+}
+
diff --git a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Network/Url.php b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Network/Url.php
new file mode 100644
index 000000000..c40ea7a4a
--- /dev/null
+++ b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Network/Url.php
@@ -0,0 +1,237 @@
+
+ * @git 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;
+ }
+}
+
diff --git a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Network/index.html b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Network/index.html
new file mode 100644
index 000000000..fa6d84e80
--- /dev/null
+++ b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Network/index.html
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Power/Config.php b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Power/Config.php
index d5e624373..75a4ef9e5 100644
--- a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Power/Config.php
+++ b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Power/Config.php
@@ -18,7 +18,7 @@ use Joomla\Input\Input;
use VDM\Joomla\Utilities\GetHelper;
use VDM\Joomla\Utilities\StringHelper;
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
*/
-class Config extends BaseConfig
+class Config extends ComponentConfig
{
/**
* The Global Joomla Configuration
diff --git a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Power/Factory.php b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Power/Factory.php
index cea2a0533..ad63834dc 100644
--- a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Power/Factory.php
+++ b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Power/Factory.php
@@ -21,6 +21,9 @@ use VDM\Joomla\Componentbuilder\Power\Service\Generator;
use VDM\Joomla\Componentbuilder\Service\Gitea;
use VDM\Joomla\Componentbuilder\Power\Service\Gitea as GiteaPower;
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\Abstraction\Factory as ExtendingFactory;
@@ -56,7 +59,10 @@ abstract class Factory extends ExtendingFactory implements FactoryInterface
->registerServiceProvider(new Generator())
->registerServiceProvider(new Gitea())
->registerServiceProvider(new GiteaPower())
- ->registerServiceProvider(new GiteaUtilities());
+ ->registerServiceProvider(new GiteaUtilities())
+ ->registerServiceProvider(new Api())
+ ->registerServiceProvider(new Network())
+ ->registerServiceProvider(new Utilities());
}
}
diff --git a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Power/Grep.php b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Power/Grep.php
index 2b93cdd96..53ad47581 100644
--- a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Power/Grep.php
+++ b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Power/Grep.php
@@ -131,7 +131,7 @@ final class Grep extends ExtendingGrep implements GrepInterface
$branch = $this->getBranchName($path);
// 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
if (($power = $this->loadRemoteFile($path->organisation, $path->repository, $path->index->{$guid}->settings, $branch)) !== null &&
diff --git a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Power/Service/Power.php b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Power/Service/Power.php
index 2763c2ff3..e58446ff1 100644
--- a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Power/Service/Power.php
+++ b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Power/Service/Power.php
@@ -108,6 +108,7 @@ class Power implements ServiceProviderInterface
{
return new Grep(
$container->get('Gitea.Repository.Contents'),
+ $container->get('Network.Resolve'),
$container->get('Config')->approved_paths,
$container->get('Config')->local_powers_repository_path
);
diff --git a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Search/Config.php b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Search/Config.php
index ecb35d9d0..c4c0dcc54 100644
--- a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Search/Config.php
+++ b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Search/Config.php
@@ -14,7 +14,7 @@ namespace VDM\Joomla\Componentbuilder\Search;
use Joomla\CMS\Factory;
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
*/
-class Config extends BaseConfig
+class Config extends FunctionRegistry
{
/**
* 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)
{
$this->input = $input ?: Factory::getApplication()->input;
-
- // run parent constructor
- parent::__construct();
}
/**
@@ -200,7 +197,6 @@ class Config extends BaseConfig
protected function getMarkerend(): string
{
return ']=' . '|' . '+}';
- }
-
+ }
}
diff --git a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Service/Api.php b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Service/Api.php
new file mode 100644
index 000000000..116557531
--- /dev/null
+++ b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Service/Api.php
@@ -0,0 +1,58 @@
+
+ * @git 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')
+ );
+ }
+}
+
diff --git a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Service/Network.php b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Service/Network.php
new file mode 100644
index 000000000..815fa06d9
--- /dev/null
+++ b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Service/Network.php
@@ -0,0 +1,131 @@
+
+ * @git 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();
+ }
+}
+
diff --git a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Service/Utilities.php b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Service/Utilities.php
new file mode 100644
index 000000000..40842c24d
--- /dev/null
+++ b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Service/Utilities.php
@@ -0,0 +1,88 @@
+
+ * @git 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();
+ }
+}
+
diff --git a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Table.php b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Table.php
index 6e4222d2c..12b96ae5e 100644
--- a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Table.php
+++ b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Table.php
@@ -109,8 +109,8 @@ final class Table extends BaseTable implements TableInterface
'tab_name' => 'publishing',
'db' => [
'type' => 'DATETIME',
- 'default' => '0000-00-00 00:00:00',
- 'null_switch' => 'NOT NULL',
+ 'default' => 'CURRENT_TIMESTAMP',
+ 'null_switch' => 'NULL',
'unique_key' => false,
'key' => false,
],
@@ -1626,8 +1626,8 @@ final class Table extends BaseTable implements TableInterface
'tab_name' => 'publishing',
'db' => [
'type' => 'DATETIME',
- 'default' => '0000-00-00 00:00:00',
- 'null_switch' => 'NOT NULL',
+ 'default' => 'EMPTY',
+ 'null_switch' => 'NULL',
'unique_key' => false,
'key' => false,
],
diff --git a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Utilities/Http.php b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Utilities/Http.php
new file mode 100644
index 000000000..4c84ccabd
--- /dev/null
+++ b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Utilities/Http.php
@@ -0,0 +1,49 @@
+
+ * @git 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);
+ }
+}
+
diff --git a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Utilities/Response.php b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Utilities/Response.php
new file mode 100644
index 000000000..b44ec9e9d
--- /dev/null
+++ b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Utilities/Response.php
@@ -0,0 +1,125 @@
+
+ * @git 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.';
+ }
+}
+
diff --git a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Utilities/Uri.php b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Utilities/Uri.php
new file mode 100644
index 000000000..4837402bc
--- /dev/null
+++ b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Utilities/Uri.php
@@ -0,0 +1,127 @@
+
+ * @git 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;
+ }
+}
+
diff --git a/libraries/vendor_jcb/VDM.Joomla/src/Interfaces/GrepInterface.php b/libraries/vendor_jcb/VDM.Joomla/src/Interfaces/GrepInterface.php
index d3199d52e..013f7f01a 100644
--- a/libraries/vendor_jcb/VDM.Joomla/src/Interfaces/GrepInterface.php
+++ b/libraries/vendor_jcb/VDM.Joomla/src/Interfaces/GrepInterface.php
@@ -12,6 +12,9 @@
namespace VDM\Joomla\Interfaces;
+use VDM\Joomla\Interfaces\Git\ApiInterface as Api;
+
+
/**
* Global Resource Empowerment Platform
*
@@ -77,6 +80,22 @@ interface GrepInterface
* @return object|null
* @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;
}
diff --git a/libraries/vendor_jcb/VDM.Joomla/src/Interfaces/Registryinterface.php b/libraries/vendor_jcb/VDM.Joomla/src/Interfaces/Registryinterface.php
index 58aae26a2..272dedfb3 100644
--- a/libraries/vendor_jcb/VDM.Joomla/src/Interfaces/Registryinterface.php
+++ b/libraries/vendor_jcb/VDM.Joomla/src/Interfaces/Registryinterface.php
@@ -18,10 +18,128 @@ use VDM\Joomla\Interfaces\Activeregistryinterface;
/**
* The Registry Interface
*
- * @since 3.2.0
+ * @since 3.2.0
+ * @since 5.0.4 Joomla Registry Compatible
*/
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.
*
@@ -30,7 +148,7 @@ interface Registryinterface extends Activeregistryinterface
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return self
- * @since 3.2.0
+ * @since 3.2.0
*/
public function set(string $path, $value): self;
@@ -46,7 +164,7 @@ interface Registryinterface extends Activeregistryinterface
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return self
- * @since 3.2.0
+ * @since 3.2.0
*/
public function add(string $path, $value, ?bool $asArray = null): self;
@@ -58,9 +176,9 @@ interface Registryinterface extends Activeregistryinterface
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return mixed The value or sub-array from the storage. Null if the location doesn't exist.
- * @since 3.2.0
+ * @since 3.2.0
*/
- public function get(string $path, $default = null);
+ public function get(string $path, $default = null): mixed;
/**
* 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.
* @return self
- * @since 3.2.0
+ * @since 3.2.0
*/
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.
* @return bool True if the location exists, false otherwise.
- * @since 3.2.0
+ * @since 3.2.0
*/
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
*
* @param string|null $value The value to set.
*
* @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;
}