update 2023-10-24 10:36:32

This commit is contained in:
Robot 2023-10-24 10:36:39 +02:00
parent 1ba2cdbd9d
commit 3e3cd1e212
Signed by: Robot
GPG Key ID: 14DECD44E7E1BB95
38 changed files with 4094 additions and 2434 deletions

View File

@ -109,8 +109,8 @@ class Power implements ServiceProviderInterface
{ {
return new Superpower( return new Superpower(
$container->get('Power.Grep'), $container->get('Power.Grep'),
$container->get('Power.Insert'), $container->get('Power.Database.Insert'),
$container->get('Power.Update') $container->get('Power.Database.Update')
); );
} }

View File

@ -79,8 +79,8 @@
{ {
return new Superpower( return new Superpower(
$container->get('Power.Grep'), $container->get('Power.Grep'),
$container->get('Power.Insert'), $container->get('Power.Database.Insert'),
$container->get('Power.Update') $container->get('Power.Database.Update')
); );
} }

View File

@ -16,36 +16,55 @@ class Structure #Gold {
# Config $config # Config $config
# Registry $registry # Registry $registry
# Dispenser $dispenser # Dispenser $dispenser
# EventInterface $event # Event $event
# Counter $counter # Counter $counter
# Folder $folder # Folder $folder
# File $file # File $file
# Files $files # Files $files
+ __construct(?Module $module = null, ?Component $component = null, ...) # TemplateData $templatedata
+ __construct(Module $module, Component $component, ...)
+ build() : void + build() : void
# getXML(object $module) : string # getXML(object $module) : string
# getCustomScriptField(array $fieldScriptBucket) : string # getCustomScriptField(array $fieldScriptBucket) : string
# modulePath(object $module) : void
# setMainModFile(object $module) : void
# setCustomGet(object $module) : void
# setHelperFile(object $module) : void
# setMainXmlFile(object $module) : void
# setDefaultFile(object $module) : void
# setTemplateFiles(object $module) : void
# setInstallScript(object $module) : void
# setReadme(object $module) : void
# setCssJsForm(object $module) : void
# setCssForm(object $module, string $targetPath, ...) : void
# setJsForm(object $module, string $targetPath, ...) : void
# setForms(object $module) : void
# setSQL(object $module) : void
# setFiles(object $module) : void
# setFolders(object $module) : void
# setUrls(object $module) : void
} }
note right of Structure::__construct note right of Structure::__construct
Constructor Constructor.
since: 3.2.0 since: 3.2.0
arguments: arguments:
?Module $module = null Module $module
?Component $component = null Component $component
?Config $config = null Config $config
?Registry $registry = null Registry $registry
?Dispenser $dispenser = null Dispenser $dispenser
?EventInterface $event = null Event $event
?Counter $counter = null Counter $counter
?Folder $folder = null Folder $folder
?File $file = null File $file
?Files $files = null Files $files
TemplateData $templatedata
end note end note
note right of Structure::build note left of Structure::build
Build the Modules files, folders, url's and config Build the Modules files, folders, url's and config
since: 3.2.0 since: 3.2.0
@ -59,12 +78,141 @@ note right of Structure::getXML
return: string return: string
end note end note
note right of Structure::getCustomScriptField note left of Structure::getCustomScriptField
get the module admin custom script field get the module admin custom script field
since: 3.2.0 since: 3.2.0
return: string return: string
end note end note
note right of Structure::modulePath
Set the module path
since: 3.2.0
return: void
end note
note left of Structure::setMainModFile
Set the main module file
since: 3.2.0
return: void
end note
note right of Structure::setCustomGet
Set the custom get file
since: 3.2.0
return: void
end note
note left of Structure::setHelperFile
Set the helper file
since: 3.2.0
return: void
end note
note right of Structure::setMainXmlFile
Set the main XML file
since: 3.2.0
return: void
end note
note left of Structure::setDefaultFile
Set the main default template file
since: 3.2.0
return: void
end note
note right of Structure::setTemplateFiles
Set the additional template files
since: 3.2.0
return: void
end note
note left of Structure::setInstallScript
Set the install script file
since: 3.2.0
return: void
end note
note right of Structure::setReadme
Set the readme file
since: 3.2.0
return: void
end note
note left of Structure::setCssJsForm
Set the css and javascript in form
since: 3.2.0
return: void
end note
note right of Structure::setCssForm
Set the css in form
since: 3.2.0
return: void
arguments:
object $module
string $targetPath
array $bucket
end note
note left of Structure::setJsForm
Set the javascript in form
since: 3.2.0
return: void
arguments:
object $module
string $targetPath
array $bucket
end note
note right of Structure::setForms
Set the form folders and files as needed
since: 3.2.0
return: void
end note
note left of Structure::setSQL
Set the sql stuff
since: 3.2.0
return: void
end note
note right of Structure::setFiles
Set the files
since: 3.2.0
return: void
end note
note left of Structure::setFolders
Set the folders
since: 3.2.0
return: void
end note
note right of Structure::setUrls
Set the urls
since: 3.2.0
return: void
end note
@enduml @enduml
``` ```

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -11,61 +11,61 @@
"type": "class", "type": "class",
"use_selection": { "use_selection": {
"use_selection0": { "use_selection0": {
"use": "d910d8b8-4c23-4f3e-8cda-438f2d2bd7ac",
"as": "Compiler"
},
"use_selection1": {
"use": "cb11e8d9-69c2-4095-831c-59908ea402e7", "use": "cb11e8d9-69c2-4095-831c-59908ea402e7",
"as": "Module" "as": "Module"
}, },
"use_selection2": { "use_selection1": {
"use": "e2472b22-a329-44d8-b4a2-ae3ba99e17a0", "use": "e2472b22-a329-44d8-b4a2-ae3ba99e17a0",
"as": "default" "as": "default"
}, },
"use_selection3": { "use_selection2": {
"use": "fa4bf18e-301e-42e3-91fb-6e0096c07adc", "use": "fa4bf18e-301e-42e3-91fb-6e0096c07adc",
"as": "default" "as": "default"
}, },
"use_selection4": { "use_selection3": {
"use": "e5d9804f-0eb0-4ee9-b406-ad4e8cdbc1f6", "use": "e5d9804f-0eb0-4ee9-b406-ad4e8cdbc1f6",
"as": "default" "as": "default"
}, },
"use_selection5": { "use_selection4": {
"use": "f1dc6430-fb54-452e-aa53-ce32ae93db88", "use": "f1dc6430-fb54-452e-aa53-ce32ae93db88",
"as": "default" "as": "default"
}, },
"use_selection6": { "use_selection5": {
"use": "20ed72b0-fcac-4344-aee1-8a65e3bf221d", "use": "20ed72b0-fcac-4344-aee1-8a65e3bf221d",
"as": "default" "as": "Event"
}, },
"use_selection7": { "use_selection6": {
"use": "e6d871a6-bbe7-497d-af01-68f6bb9a87f4", "use": "e6d871a6-bbe7-497d-af01-68f6bb9a87f4",
"as": "default" "as": "default"
}, },
"use_selection8": { "use_selection7": {
"use": "6bbb6ffe-3f09-4c21-aa9d-c93159afa1e1", "use": "6bbb6ffe-3f09-4c21-aa9d-c93159afa1e1",
"as": "default" "as": "default"
}, },
"use_selection9": { "use_selection8": {
"use": "5c75b455-3d4c-452a-867e-e90424a64c88", "use": "5c75b455-3d4c-452a-867e-e90424a64c88",
"as": "default" "as": "default"
}, },
"use_selection10": { "use_selection9": {
"use": "1d967151-7c20-4ca7-9400-65233cdcd4db", "use": "1d967151-7c20-4ca7-9400-65233cdcd4db",
"as": "default" "as": "default"
}, },
"use_selection11": { "use_selection10": {
"use": "a68c010b-e92e-47d5-8a44-d23cfddeb6c6", "use": "a68c010b-e92e-47d5-8a44-d23cfddeb6c6",
"as": "default" "as": "default"
}, },
"use_selection12": { "use_selection11": {
"use": "500f3a7f-c16d-4dd4-81b2-2df6776b5388", "use": "500f3a7f-c16d-4dd4-81b2-2df6776b5388",
"as": "default" "as": "default"
}, },
"use_selection13": { "use_selection12": {
"use": "4e6ff11d-bebf-42f5-8fd7-b2f882857222", "use": "4e6ff11d-bebf-42f5-8fd7-b2f882857222",
"as": "default" "as": "default"
}, },
"use_selection13": {
"use": "8591f6db-dd3c-4a63-9b3f-574c0ec74ade",
"as": "default"
},
"use_selection14": { "use_selection14": {
"use": "0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a", "use": "0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a",
"as": "default" "as": "default"

View File

@ -24,14 +24,14 @@ note right of Joomlamodule::register
end note end note
note right of Joomlamodule::getData note right of Joomlamodule::getData
Get the Joomla Module Data Get The Data Class.
since: 3.2.0 since: 3.2.0
return: Data return: Data
end note end note
note right of Joomlamodule::getStructure note right of Joomlamodule::getStructure
Get the Joomla Module Structure Builder Get The Structure Class.
since: 3.2.0 since: 3.2.0
return: Structure return: Structure

View File

@ -43,7 +43,7 @@ class Joomlamodule implements ServiceProviderInterface
} }
/** /**
* Get the Joomla Module Data * Get The Data Class.
* *
* @param Container $container The DI container. * @param Container $container The DI container.
* *
@ -62,12 +62,13 @@ class Joomlamodule implements ServiceProviderInterface
$container->get('Field.Name'), $container->get('Field.Name'),
$container->get('Model.Filesfolders'), $container->get('Model.Filesfolders'),
$container->get('Model.Libraries'), $container->get('Model.Libraries'),
$container->get('Dynamicget.Data') $container->get('Dynamicget.Data'),
$container->get('Templatelayout.Data')
); );
} }
/** /**
* Get the Joomla Module Structure Builder * Get The Structure Class.
* *
* @param Container $container The DI container. * @param Container $container The DI container.
* *
@ -86,9 +87,9 @@ class Joomlamodule implements ServiceProviderInterface
$container->get('Utilities.Counter'), $container->get('Utilities.Counter'),
$container->get('Utilities.Folder'), $container->get('Utilities.Folder'),
$container->get('Utilities.File'), $container->get('Utilities.File'),
$container->get('Utilities.Files') $container->get('Utilities.Files'),
$container->get('Compiler.Builder.Template.Data')
); );
} }
} }

View File

@ -16,7 +16,7 @@
} }
/** /**
* Get the Joomla Module Data * Get The Data Class.
* *
* @param Container $container The DI container. * @param Container $container The DI container.
* *
@ -35,12 +35,13 @@
$container->get('Field.Name'), $container->get('Field.Name'),
$container->get('Model.Filesfolders'), $container->get('Model.Filesfolders'),
$container->get('Model.Libraries'), $container->get('Model.Libraries'),
$container->get('Dynamicget.Data') $container->get('Dynamicget.Data'),
$container->get('Templatelayout.Data')
); );
} }
/** /**
* Get the Joomla Module Structure Builder * Get The Structure Class.
* *
* @param Container $container The DI container. * @param Container $container The DI container.
* *
@ -59,6 +60,7 @@
$container->get('Utilities.Counter'), $container->get('Utilities.Counter'),
$container->get('Utilities.Folder'), $container->get('Utilities.Folder'),
$container->get('Utilities.File'), $container->get('Utilities.File'),
$container->get('Utilities.Files') $container->get('Utilities.Files'),
$container->get('Compiler.Builder.Template.Data')
); );
} }

View File

@ -15,6 +15,8 @@ class Super << (F,LightGreen) >> #RoyalBlue {
# Insert $insert # Insert $insert
# Update $update # Update $update
+ __construct(Grep $grep, Insert $insert, ...) + __construct(Grep $grep, Insert $insert, ...)
+ init() : bool
+ reset(array $powers) : bool
+ load(string $guid, array $order = ['remote', 'local'], ...) : bool + load(string $guid, array $order = ['remote', 'local'], ...) : bool
- insert(object $power) : bool - insert(object $power) : bool
- update(object $power) : bool - update(object $power) : bool
@ -32,6 +34,20 @@ note right of Super::__construct
Update $update Update $update
end note end note
note right of Super::init
Init all power not found in database
since: 3.2.0
return: bool
end note
note right of Super::reset
Reset the powers
since: 3.2.0
return: bool
end note
note right of Super::load note right of Super::load
Load a superpower Load a superpower

View File

@ -65,6 +65,58 @@ final class Super
$this->update = $update; $this->update = $update;
} }
/**
* Init all power not found in database
*
* @return bool
* @since 3.2.0
*/
public function init(): bool
{
if (($powers = $this->grep->getRemotePowersGuid()) !== null)
{
foreach($powers as $guid)
{
if ($this->action($guid) === 'insert' && ($power = $this->grep->get($guid, ['remote'])) !== null)
{
$this->insert($power);
}
}
return true;
}
return false;
}
/**
* Reset the powers
*
* @param array $powers The global unique ids of the powers
*
* @return bool
* @since 3.2.0
*/
public function reset(array $powers): bool
{
if ($powers === [])
{
return false;
}
$success = true;
foreach($powers as $guid)
{
if (!$this->load($guid, ['remote']))
{
$success = false;
}
}
return $success;
}
/** /**
* Load a superpower * Load a superpower
* *

View File

@ -38,6 +38,58 @@
$this->update = $update; $this->update = $update;
} }
/**
* Init all power not found in database
*
* @return bool
* @since 3.2.0
*/
public function init(): bool
{
if (($powers = $this->grep->getRemotePowersGuid()) !== null)
{
foreach($powers as $guid)
{
if ($this->action($guid) === 'insert' && ($power = $this->grep->get($guid, ['remote'])) !== null)
{
$this->insert($power);
}
}
return true;
}
return false;
}
/**
* Reset the powers
*
* @param array $powers The global unique ids of the powers
*
* @return bool
* @since 3.2.0
*/
public function reset(array $powers): bool
{
if ($powers === [])
{
return false;
}
$success = true;
foreach($powers as $guid)
{
if (!$this->load($guid, ['remote']))
{
$success = false;
}
}
return $success;
}
/** /**
* Load a superpower * Load a superpower
* *

View File

@ -10,15 +10,15 @@
"system_name": "JCB.Power.Super", "system_name": "JCB.Power.Super",
"type": "final class", "type": "final class",
"use_selection": { "use_selection": {
"use_selection2": { "use_selection0": {
"use": "6784dd52-0909-451a-a872-9a942a023c68", "use": "6784dd52-0909-451a-a872-9a942a023c68",
"as": "default" "as": "default"
}, },
"use_selection0": { "use_selection1": {
"use": "380bb7a3-cdcc-4336-a699-5070cbf521a5", "use": "380bb7a3-cdcc-4336-a699-5070cbf521a5",
"as": "default" "as": "default"
}, },
"use_selection1": { "use_selection2": {
"use": "e543c123-b1d9-4a0b-83b2-a9d371da5ff3", "use": "e543c123-b1d9-4a0b-83b2-a9d371da5ff3",
"as": "default" "as": "default"
}, },

View File

@ -33,12 +33,18 @@ class Createdate
*/ */
public function get(&$item): string public function get(&$item): string
{ {
if (isset($item['settings']->created) if (is_array($item) && isset($item['settings']) && isset($item['settings']->created)
&& StringHelper::check($item['settings']->created)) && StringHelper::check($item['settings']->created))
{ {
// first set the main date // first set the main date
$date = strtotime((string) $item['settings']->created); $date = strtotime((string) $item['settings']->created);
} }
elseif (is_object($item) && isset($item->created)
&& StringHelper::check($item->created))
{
// first set the main date
$date = strtotime((string) $item->created);
}
else else
{ {
// first set the main date // first set the main date

View File

@ -8,12 +8,18 @@
*/ */
public function get(&$item): string public function get(&$item): string
{ {
if (isset($item['settings']->created) if (is_array($item) && isset($item['settings']) && isset($item['settings']->created)
&& StringHelper::check($item['settings']->created)) && StringHelper::check($item['settings']->created))
{ {
// first set the main date // first set the main date
$date = strtotime((string) $item['settings']->created); $date = strtotime((string) $item['settings']->created);
} }
elseif (is_object($item) && isset($item->created)
&& StringHelper::check($item->created))
{
// first set the main date
$date = strtotime((string) $item->created);
}
else else
{ {
// first set the main date // first set the main date

View File

@ -16,6 +16,7 @@ class Grep << (F,LightGreen) >> #RoyalBlue {
# Contents $contents # Contents $contents
# CMSApplication $app # CMSApplication $app
+ __construct(string $path, array $paths, ...) + __construct(string $path, array $paths, ...)
+ getRemotePowersGuid() : ?array
+ get(string $guid, array $order = ['local', 'remote']) : ?object + get(string $guid, array $order = ['local', 'remote']) : ?object
- searchLocal(string $guid) : ?object - searchLocal(string $guid) : ?object
- searchRemote(string $guid) : ?object - searchRemote(string $guid) : ?object
@ -40,63 +41,70 @@ note right of Grep::__construct
?CMSApplication $app = null ?CMSApplication $app = null
end note end note
note left of Grep::get note left of Grep::getRemotePowersGuid
Get all remote powers GUID's
since: 3.2.0
return: ?array
end note
note right of Grep::get
Get a power Get a power
since: 3.2.0 since: 3.2.0
return: ?object return: ?object
end note end note
note right of Grep::searchLocal note left of Grep::searchLocal
Search for a local power Search for a local power
since: 3.2.0 since: 3.2.0
return: ?object return: ?object
end note end note
note left of Grep::searchRemote note right of Grep::searchRemote
Search for a remote power Search for a remote power
since: 3.2.0 since: 3.2.0
return: ?object return: ?object
end note end note
note right of Grep::getLocal note left of Grep::getLocal
Get a local power Get a local power
since: 3.2.0 since: 3.2.0
return: ?object return: ?object
end note end note
note left of Grep::getRemote note right of Grep::getRemote
Get a remote power Get a remote power
since: 3.2.0 since: 3.2.0
return: ?object return: ?object
end note end note
note right of Grep::init note left of Grep::init
Set path details Set path details
since: 3.2.0 since: 3.2.0
return: void return: void
end note end note
note left of Grep::localIndex note right of Grep::localIndex
Load the local repository index of powers Load the local repository index of powers
since: 3.2.0 since: 3.2.0
return: void return: void
end note end note
note right of Grep::remoteIndex note left of Grep::remoteIndex
Load the remote repository index of powers Load the remote repository index of powers
since: 3.2.0 since: 3.2.0
return: void return: void
end note end note
note left of Grep::loadRemoteFile note right of Grep::loadRemoteFile
Load the remote file Load the remote file
since: 3.2.0 since: 3.2.0
@ -109,7 +117,7 @@ note left of Grep::loadRemoteFile
?string $branch ?string $branch
end note end note
note right of Grep::getFunctionName note left of Grep::getFunctionName
Get function name Get function name
since: 3.2.0 since: 3.2.0

View File

@ -86,6 +86,34 @@ final class Grep
$this->init(); $this->init();
} }
/**
* Get all remote powers GUID's
*
* @return array|null
* @since 3.2.0
*/
public function getRemotePowersGuid(): ?array
{
if (!is_array($this->paths) || $this->paths === [])
{
return null;
}
$powers = [];
foreach ($this->paths as $path)
{
// Get local index
$this->remoteIndex($path);
if (isset($path->index) && is_object($path->index))
{
$powers = array_merge($powers, array_keys((array) $path->index));
}
}
return empty($powers) ? null : array_unique($powers);
}
/** /**
* Get a power * Get a power
* *
@ -316,10 +344,10 @@ final class Grep
{ {
$path->index = $this->contents->get($path->owner, $path->repo, 'super-powers.json', $path->branch); $path->index = $this->contents->get($path->owner, $path->repo, 'super-powers.json', $path->branch);
} }
catch (\DomainException $e) catch (\Exception $e)
{ {
$this->app->enqueueMessage( $this->app->enqueueMessage(
Text::sprintf('COM_COMPONENTBUILDER_PSUPER_POWERB_REPOSITORY_AT_BGITVDMDEVSB_GAVE_THE_FOLLOWING_ERRORBR_SP', $path->path, $e->getMessage()), Text::sprintf('COM_COMPONENTBUILDER_PSUPER_POWERB_REPOSITORY_AT_BSSB_GAVE_THE_FOLLOWING_ERRORBR_SP', $this->contents->api(), $path->path, $e->getMessage()),
'Error' 'Error'
); );
@ -344,10 +372,10 @@ final class Grep
{ {
$data = $this->contents->get($owner, $repo, $path, $branch); $data = $this->contents->get($owner, $repo, $path, $branch);
} }
catch (\DomainException $e) catch (\Exception $e)
{ {
$this->app->enqueueMessage( $this->app->enqueueMessage(
Text::sprintf('COM_COMPONENTBUILDER_PFILE_AT_BGITEAREMOTESB_GAVE_THE_FOLLOWING_ERRORBR_SP', $path, $e->getMessage()), Text::sprintf('COM_COMPONENTBUILDER_PFILE_AT_BSSB_GAVE_THE_FOLLOWING_ERRORBR_SP', $this->contents->api(), $path, $e->getMessage()),
'Error' 'Error'
); );

View File

@ -51,6 +51,34 @@
$this->init(); $this->init();
} }
/**
* Get all remote powers GUID's
*
* @return array|null
* @since 3.2.0
*/
public function getRemotePowersGuid(): ?array
{
if (!is_array($this->paths) || $this->paths === [])
{
return null;
}
$powers = [];
foreach ($this->paths as $path)
{
// Get local index
$this->remoteIndex($path);
if (isset($path->index) && is_object($path->index))
{
$powers = array_merge($powers, array_keys((array) $path->index));
}
}
return empty($powers) ? null : array_unique($powers);
}
/** /**
* Get a power * Get a power
* *
@ -281,10 +309,10 @@
{ {
$path->index = $this->contents->get($path->owner, $path->repo, 'super-powers.json', $path->branch); $path->index = $this->contents->get($path->owner, $path->repo, 'super-powers.json', $path->branch);
} }
catch (\DomainException $e) catch (\Exception $e)
{ {
$this->app->enqueueMessage( $this->app->enqueueMessage(
Text::sprintf('<p>Super Power</b> repository at <b>git.vdm.dev/%s</b> gave the following error!<br />%s</p>', $path->path, $e->getMessage()), Text::sprintf('<p>Super Power</b> repository at <b>%s/%s</b> gave the following error!<br />%s</p>', $this->contents->api(), $path->path, $e->getMessage()),
'Error' 'Error'
); );
@ -309,10 +337,10 @@
{ {
$data = $this->contents->get($owner, $repo, $path, $branch); $data = $this->contents->get($owner, $repo, $path, $branch);
} }
catch (\DomainException $e) catch (\Exception $e)
{ {
$this->app->enqueueMessage( $this->app->enqueueMessage(
Text::sprintf('<p>File at <b>gitea.remote/%s</b> gave the following error!<br />%s</p>', $path, $e->getMessage()), Text::sprintf('<p>File at <b>%s/%s</b> gave the following error!<br />%s</p>', $this->contents->api(), $path, $e->getMessage()),
'Error' 'Error'
); );

View File

@ -12,7 +12,7 @@
@startuml @startuml
interface Cryptinterface #Lavender { interface Cryptinterface #Lavender {
+ encrypt(string $string, string $key) : string + encrypt(string $string, string $key) : string
+ decrypt(string $string, string $key) : string + decrypt(string $string, string $key) : ?string
} }
note right of Cryptinterface::encrypt note right of Cryptinterface::encrypt
@ -26,7 +26,7 @@ note right of Cryptinterface::decrypt
Decrypt a string as needed Decrypt a string as needed
since: 3.2.0 since: 3.2.0
return: string return: ?string
end note end note
@enduml @enduml

View File

@ -34,10 +34,10 @@ interface Cryptinterface
* @param string $string The string to decrypt * @param string $string The string to decrypt
* @param string $key The decryption key * @param string $key The decryption key
* *
* @return string * @return string|null
* @since 3.2.0 * @since 3.2.0
**/ **/
public function decrypt(string $string, string $key): string; public function decrypt(string $string, string $key): ?string;
} }

View File

@ -15,7 +15,7 @@
* @param string $string The string to decrypt * @param string $string The string to decrypt
* @param string $key The decryption key * @param string $key The decryption key
* *
* @return string * @return string|null
* @since 3.2.0 * @since 3.2.0
**/ **/
public function decrypt(string $string, string $key): string; public function decrypt(string $string, string $key): ?string;

View File

@ -13,9 +13,11 @@
class Modifieddate #Gold { class Modifieddate #Gold {
# array $last # array $last
+ get(array $item) : string + get(array $item) : string
# getDate(array $item) : int # getDate(array|object $item) : int
# getModified(array $item) : int # getModified(array|object $item) : int
# getKey(array $item) : string # getKey(array|object $item) : string
# getKeyFromArray(array $item) : string
# getKeyFromObject(object $item) : string
} }
note right of Modifieddate::get note right of Modifieddate::get
@ -45,6 +47,20 @@ note right of Modifieddate::getKey
since: 3.2.0 since: 3.2.0
return: string return: string
end note end note
note right of Modifieddate::getKeyFromArray
Get the key for an item (array)
since: 3.2.0
return: string
end note
note right of Modifieddate::getKeyFromObject
Get the key for an item (object)
since: 3.2.0
return: string
end note
@enduml @enduml
``` ```

View File

@ -60,19 +60,25 @@ class Modifieddate
/** /**
* Get the last modified date of an item * Get the last modified date of an item
* *
* @param array $item The item data * @param array|object $item The item data
* *
* @return int The modified date as int * @return int The modified date as int
* @since 3.2.0 * @since 3.2.0
*/ */
protected function getDate(array $item): int protected function getDate($item): int
{ {
if (isset($item['settings']) && isset($item['settings']->modified) if (is_array($item) && isset($item['settings']) && isset($item['settings']->modified)
&& StringHelper::check($item['settings']->modified) && StringHelper::check($item['settings']->modified)
&& '0000-00-00 00:00:00' !== $item['settings']->modified) && '0000-00-00 00:00:00' !== $item['settings']->modified)
{ {
return strtotime((string) $item['settings']->modified); return strtotime((string) $item['settings']->modified);
} }
elseif (is_object($item) && isset($item->modified)
&& StringHelper::check($item->modified)
&& '0000-00-00 00:00:00' !== $item->modified)
{
return strtotime((string) $item->modified);
}
return strtotime("now"); return strtotime("now");
} }
@ -80,17 +86,17 @@ class Modifieddate
/** /**
* Get the last modified date of an item's sub items * Get the last modified date of an item's sub items
* *
* @param array $item The item data * @param array|object $item The item data
* *
* @return int The modified date as int * @return int The modified date as int
* @since 3.2.0 * @since 3.2.0
*/ */
protected function getModified(array $item): int protected function getModified($item): int
{ {
$date = 0; $date = 0;
// if not settings is found // if not settings is found
if (!isset($item['settings']) || !ObjectHelper::check($item['settings'])) if (!is_array($item) || !isset($item['settings']) || !ObjectHelper::check($item['settings']))
{ {
return $date; return $date;
} }
@ -128,12 +134,34 @@ class Modifieddate
/** /**
* Get the key for an item * Get the key for an item
* *
* @param array|object $item The item data
*
* @return string The key
* @since 3.2.0
*/
protected function getKey($item): string
{
if (is_array($item))
{
return $this->getKeyFromArray($item);
}
elseif (is_object($item))
{
return $this->getKeyFromObject($item);
}
return 'error';
}
/**
* Get the key for an item (array)
*
* @param array $item The item data * @param array $item The item data
* *
* @return string The key * @return string The key
* @since 3.2.0 * @since 3.2.0
*/ */
protected function getKey(array $item): string protected function getKeyFromArray(array $item): string
{ {
if (isset($item['adminview'])) if (isset($item['adminview']))
{ {
@ -150,6 +178,23 @@ class Modifieddate
return 'error'; return 'error';
} }
/**
* Get the key for an item (object)
*
* @param object $item The item data
*
* @return string The key
* @since 3.2.0
*/
protected function getKeyFromObject(object $item): string
{
if (isset($item->key))
{
return $item->key;
}
return 'error';
}
} }

View File

@ -33,19 +33,25 @@
/** /**
* Get the last modified date of an item * Get the last modified date of an item
* *
* @param array $item The item data * @param array|object $item The item data
* *
* @return int The modified date as int * @return int The modified date as int
* @since 3.2.0 * @since 3.2.0
*/ */
protected function getDate(array $item): int protected function getDate($item): int
{ {
if (isset($item['settings']) && isset($item['settings']->modified) if (is_array($item) && isset($item['settings']) && isset($item['settings']->modified)
&& StringHelper::check($item['settings']->modified) && StringHelper::check($item['settings']->modified)
&& '0000-00-00 00:00:00' !== $item['settings']->modified) && '0000-00-00 00:00:00' !== $item['settings']->modified)
{ {
return strtotime((string) $item['settings']->modified); return strtotime((string) $item['settings']->modified);
} }
elseif (is_object($item) && isset($item->modified)
&& StringHelper::check($item->modified)
&& '0000-00-00 00:00:00' !== $item->modified)
{
return strtotime((string) $item->modified);
}
return strtotime("now"); return strtotime("now");
} }
@ -53,17 +59,17 @@
/** /**
* Get the last modified date of an item's sub items * Get the last modified date of an item's sub items
* *
* @param array $item The item data * @param array|object $item The item data
* *
* @return int The modified date as int * @return int The modified date as int
* @since 3.2.0 * @since 3.2.0
*/ */
protected function getModified(array $item): int protected function getModified($item): int
{ {
$date = 0; $date = 0;
// if not settings is found // if not settings is found
if (!isset($item['settings']) || !ObjectHelper::check($item['settings'])) if (!is_array($item) || !isset($item['settings']) || !ObjectHelper::check($item['settings']))
{ {
return $date; return $date;
} }
@ -101,12 +107,34 @@
/** /**
* Get the key for an item * Get the key for an item
* *
* @param array|object $item The item data
*
* @return string The key
* @since 3.2.0
*/
protected function getKey($item): string
{
if (is_array($item))
{
return $this->getKeyFromArray($item);
}
elseif (is_object($item))
{
return $this->getKeyFromObject($item);
}
return 'error';
}
/**
* Get the key for an item (array)
*
* @param array $item The item data * @param array $item The item data
* *
* @return string The key * @return string The key
* @since 3.2.0 * @since 3.2.0
*/ */
protected function getKey(array $item): string protected function getKeyFromArray(array $item): string
{ {
if (isset($item['adminview'])) if (isset($item['adminview']))
{ {
@ -123,3 +151,21 @@
return 'error'; return 'error';
} }
/**
* Get the key for an item (object)
*
* @param object $item The item data
*
* @return string The key
* @since 3.2.0
*/
protected function getKeyFromObject(object $item): string
{
if (isset($item->key))
{
return $item->key;
}
return 'error';
}

View File

@ -16,35 +16,45 @@ class Structure #Gold {
# Config $config # Config $config
# Registry $registry # Registry $registry
# Dispenser $dispenser # Dispenser $dispenser
# EventInterface $event # Event $event
# Counter $counter # Counter $counter
# Folder $folder # Folder $folder
# File $file # File $file
# Files $files # Files $files
+ __construct(?Plugin $plugin = null, ?Component $component = null, ...) + __construct(Plugin $plugin, Component $component, ...)
+ build() : void + build() : void
# getXML($plugin) : string # getXML(object $plugin) : string
# pluginPath(object $plugin) : void
# setMainClassFile(object $plugin) : void
# setMainXmlFile(mixed $plugin) : void
# setInstallScript(object $plugin) : void
# setReadme(object $plugin) : void
# setForms(object $plugin) : void
# setSQL(object $plugin) : void
# setFiles(object $plugin) : void
# setFolders(object $plugin) : void
# setUrls(object $plugin) : void
} }
note right of Structure::__construct note right of Structure::__construct
Constructor Constructor.
since: 3.2.0 since: 3.2.0
arguments: arguments:
?Plugin $plugin = null Plugin $plugin
?Component $component = null Component $component
?Config $config = null Config $config
?Registry $registry = null Registry $registry
?Dispenser $dispenser = null Dispenser $dispenser
?EventInterface $event = null Event $event
?Counter $counter = null Counter $counter
?Folder $folder = null Folder $folder
?File $file = null File $file
?Files $files = null Files $files
end note end note
note right of Structure::build note left of Structure::build
Build the Plugins files, folders, url's and config Build the Plugins files, folders, url's and config
since: 3.2.0 since: 3.2.0
@ -57,6 +67,76 @@ note right of Structure::getXML
since: 3.2.0 since: 3.2.0
return: string return: string
end note end note
note left of Structure::pluginPath
set the plugin path
since: 3.2.0
return: void
end note
note right of Structure::setMainClassFile
set the main class path
since: 3.2.0
return: void
end note
note left of Structure::setMainXmlFile
set the main xml file
since: 3.2.0
return: void
end note
note right of Structure::setInstallScript
set the install script file
since: 3.2.0
return: void
end note
note left of Structure::setReadme
set the readme file
since: 3.2.0
return: void
end note
note right of Structure::setForms
set the form files and folders
since: 3.2.0
return: void
end note
note left of Structure::setSQL
set the sql stuff
since: 3.2.0
return: void
end note
note right of Structure::setFiles
set the files
since: 3.2.0
return: void
end note
note left of Structure::setFolders
set the folders
since: 3.2.0
return: void
end note
note right of Structure::setUrls
set the urls
since: 3.2.0
return: void
end note
@enduml @enduml
``` ```

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -11,74 +11,70 @@
"type": "class", "type": "class",
"use_selection": { "use_selection": {
"use_selection0": { "use_selection0": {
"use": "d910d8b8-4c23-4f3e-8cda-438f2d2bd7ac",
"as": "Compiler"
},
"use_selection1": {
"use": "766a9524-37df-4604-91a7-b98a6150ee26", "use": "766a9524-37df-4604-91a7-b98a6150ee26",
"as": "Plugin" "as": "Plugin"
}, },
"use_selection2": { "use_selection1": {
"use": "e2472b22-a329-44d8-b4a2-ae3ba99e17a0", "use": "e2472b22-a329-44d8-b4a2-ae3ba99e17a0",
"as": "default" "as": "default"
}, },
"use_selection3": { "use_selection2": {
"use": "fa4bf18e-301e-42e3-91fb-6e0096c07adc", "use": "fa4bf18e-301e-42e3-91fb-6e0096c07adc",
"as": "default" "as": "default"
}, },
"use_selection4": { "use_selection3": {
"use": "e5d9804f-0eb0-4ee9-b406-ad4e8cdbc1f6", "use": "e5d9804f-0eb0-4ee9-b406-ad4e8cdbc1f6",
"as": "default" "as": "default"
}, },
"use_selection5": { "use_selection4": {
"use": "f1dc6430-fb54-452e-aa53-ce32ae93db88", "use": "f1dc6430-fb54-452e-aa53-ce32ae93db88",
"as": "default" "as": "default"
}, },
"use_selection6": { "use_selection5": {
"use": "20ed72b0-fcac-4344-aee1-8a65e3bf221d", "use": "20ed72b0-fcac-4344-aee1-8a65e3bf221d",
"as": "default" "as": "Event"
}, },
"use_selection7": { "use_selection6": {
"use": "e6d871a6-bbe7-497d-af01-68f6bb9a87f4", "use": "e6d871a6-bbe7-497d-af01-68f6bb9a87f4",
"as": "default" "as": "default"
}, },
"use_selection8": { "use_selection7": {
"use": "6bbb6ffe-3f09-4c21-aa9d-c93159afa1e1", "use": "6bbb6ffe-3f09-4c21-aa9d-c93159afa1e1",
"as": "default" "as": "default"
}, },
"use_selection9": { "use_selection8": {
"use": "5c75b455-3d4c-452a-867e-e90424a64c88", "use": "5c75b455-3d4c-452a-867e-e90424a64c88",
"as": "default" "as": "default"
}, },
"use_selection10": { "use_selection9": {
"use": "1d967151-7c20-4ca7-9400-65233cdcd4db", "use": "1d967151-7c20-4ca7-9400-65233cdcd4db",
"as": "default" "as": "default"
}, },
"use_selection11": { "use_selection10": {
"use": "a68c010b-e92e-47d5-8a44-d23cfddeb6c6", "use": "a68c010b-e92e-47d5-8a44-d23cfddeb6c6",
"as": "default" "as": "default"
}, },
"use_selection12": { "use_selection11": {
"use": "500f3a7f-c16d-4dd4-81b2-2df6776b5388", "use": "500f3a7f-c16d-4dd4-81b2-2df6776b5388",
"as": "default" "as": "default"
}, },
"use_selection13": { "use_selection12": {
"use": "4e6ff11d-bebf-42f5-8fd7-b2f882857222", "use": "4e6ff11d-bebf-42f5-8fd7-b2f882857222",
"as": "default" "as": "default"
}, },
"use_selection14": { "use_selection13": {
"use": "0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a", "use": "0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a",
"as": "default" "as": "default"
}, },
"use_selection15": { "use_selection14": {
"use": "91004529-94a9-4590-b842-e7c6b624ecf5", "use": "91004529-94a9-4590-b842-e7c6b624ecf5",
"as": "default" "as": "default"
}, },
"use_selection16": { "use_selection15": {
"use": "1f28cb53-60d9-4db1-b517-3c7dc6b429ef", "use": "1f28cb53-60d9-4db1-b517-3c7dc6b429ef",
"as": "default" "as": "default"
}, },
"use_selection17": { "use_selection16": {
"use": "a223b31e-ea1d-4cdf-92ae-5f9becffaff0", "use": "a223b31e-ea1d-4cdf-92ae-5f9becffaff0",
"as": "default" "as": "default"
} }

View File

@ -18,7 +18,11 @@ class Config #Gold {
# getAddcustomgiteaurl() : int # getAddcustomgiteaurl() : int
# getCustomgiteaurl() : ?string # getCustomgiteaurl() : ?string
# getCustomgiteatoken() : ?string # getCustomgiteatoken() : ?string
# getSuperpowerscoreorganisation() : string
# getSuperpowersinitrepos() : array
# getTmppath() : string # getTmppath() : string
# getAddsuperpowers() : bool
# getAddownpowers() : bool
# getLocalpowersrepositorypath() : string # getLocalpowersrepositorypath() : string
# getApprovedpaths() : array # getApprovedpaths() : array
} }
@ -62,6 +66,20 @@ note right of Config::getCustomgiteatoken
return: ?string return: ?string
end note end note
note left of Config::getSuperpowerscoreorganisation
Get super power core organisation
since: 3.2.0
return: string
end note
note right of Config::getSuperpowersinitrepos
Get super power init repos
since: 3.2.0
return: array
end note
note left of Config::getTmppath note left of Config::getTmppath
get temporary path get temporary path
@ -69,6 +87,20 @@ note left of Config::getTmppath
return: string return: string
end note end note
note right of Config::getAddsuperpowers
Get switch to add super powers
since: 3.2.0
return: bool
end note
note left of Config::getAddownpowers
Get switch to add own super powers
since: 3.2.0
return: bool
end note
note right of Config::getLocalpowersrepositorypath note right of Config::getLocalpowersrepositorypath
Get local super powers repository path Get local super powers repository path

View File

@ -111,6 +111,66 @@ class Config extends BaseConfig
return null; return null;
} }
/**
* Get super power core organisation
*
* @return string The super power core organisation
* @since 3.2.0
*/
protected function getSuperpowerscoreorganisation(): string
{
// the VDM default organisation is [joomla]
$organisation = 'joomla';
if ($this->add_custom_gitea_url == 2)
{
return $this->params->get('super_powers_core_organisation', $organisation);
}
return $organisation;
}
/**
* Get super power init repos
*
* @return array The init repositories on Gitea
* @since 3.2.0
*/
protected function getSuperpowersinitrepos(): array
{
// some defaults repos we need by JCB
$repos = [];
// only add custom init with custom gitea
$paths = null;
if ($this->add_custom_gitea_url == 2)
{
$paths = $this->params->get('super_powers_init_repos');
}
if (!empty($paths) && is_array($paths))
{
foreach ($paths as $path)
{
$owner = $path->owner ?? null;
$repo = $path->repo ?? null;
if ($owner !== null && $repo !== null)
{
// we make sure to get only the objects
$repos = ["{$owner}.{$repo}" => $path] + $repos;
}
}
}
else
{
$repos[$this->super_powers_core_organisation . '.super-powers'] = (object) ['owner' => $this->super_powers_core_organisation, 'repo' => 'super-powers', 'branch' => 'master'];
$repos[$this->super_powers_core_organisation . '.gitea'] = (object) ['owner' => $this->super_powers_core_organisation, 'repo' => 'gitea', 'branch' => 'master'];
$repos[$this->super_powers_core_organisation . '.openai'] = (object) ['owner' => $this->super_powers_core_organisation, 'repo' => 'openai', 'branch' => 'master'];
}
return $repos;
}
/** /**
* get temporary path * get temporary path
* *
@ -123,6 +183,33 @@ class Config extends BaseConfig
return $this->config->get('tmp_path'); return $this->config->get('tmp_path');
} }
/**
* Get switch to add super powers
*
* @return bool Switch to add super powers
* @since 3.2.0
*/
protected function getAddsuperpowers(): bool
{
return (bool) $this->params->get('powers_repository', 0);
}
/**
* Get switch to add own super powers
*
* @return bool Switch to add own super powers
* @since 3.2.0
*/
protected function getAddownpowers(): bool
{
if ($this->add_super_powers)
{
return (bool) $this->params->get('super_powers_repositories', 0);
}
return false;
}
/** /**
* Get local super powers repository path * Get local super powers repository path
* *
@ -138,18 +225,7 @@ class Config extends BaseConfig
return $default; return $default;
} }
$global = $this->params->get('local_powers_repository_path', $default); return $this->params->get('local_powers_repository_path', $default);
if (!$this->show_advanced_options)
{
return $global;
}
$value = $this->input->post->get('powers_repository', 2, 'INT');
return $value == 1
? $this->input->post->get('local_powers_repository_path', $global, 'PATH')
: $global;
} }
/** /**
@ -160,29 +236,31 @@ class Config extends BaseConfig
*/ */
protected function getApprovedpaths(): array protected function getApprovedpaths(): array
{ {
$default = (object) ['owner' => 'joomla', 'repo' => 'super-powers', 'branch' => 'master']; // some defaults repos we need by JCB
$approved = $this->super_powers_init_repos;
if (!$this->add_own_powers) if (!$this->add_own_powers)
{ {
return [$default]; return array_values($approved);
} }
$paths = $this->params->get('approved_paths'); $paths = $this->params->get('approved_paths');
$approved = [];
if (!empty($paths)) if (!empty($paths))
{ {
foreach ($paths as $path) foreach ($paths as $path)
{ {
// we make sure to get only the objects $owner = $path->owner ?? null;
$approved[] = $path; $repo = $path->repo ?? null;
if ($owner !== null && $repo !== null)
{
// we make sure to get only the objects
$approved = ["{$owner}.{$repo}" => $path] + $approved;
}
} }
} }
// finally we add the default return array_values($approved);
$approved[] = $default;
return $approved;
} }
} }

View File

@ -77,6 +77,66 @@
return null; return null;
} }
/**
* Get super power core organisation
*
* @return string The super power core organisation
* @since 3.2.0
*/
protected function getSuperpowerscoreorganisation(): string
{
// the VDM default organisation is [joomla]
$organisation = 'joomla';
if ($this->add_custom_gitea_url == 2)
{
return $this->params->get('super_powers_core_organisation', $organisation);
}
return $organisation;
}
/**
* Get super power init repos
*
* @return array The init repositories on Gitea
* @since 3.2.0
*/
protected function getSuperpowersinitrepos(): array
{
// some defaults repos we need by JCB
$repos = [];
// only add custom init with custom gitea
$paths = null;
if ($this->add_custom_gitea_url == 2)
{
$paths = $this->params->get('super_powers_init_repos');
}
if (!empty($paths) && is_array($paths))
{
foreach ($paths as $path)
{
$owner = $path->owner ?? null;
$repo = $path->repo ?? null;
if ($owner !== null && $repo !== null)
{
// we make sure to get only the objects
$repos = ["{$owner}.{$repo}" => $path] + $repos;
}
}
}
else
{
$repos[$this->super_powers_core_organisation . '.super-powers'] = (object) ['owner' => $this->super_powers_core_organisation, 'repo' => 'super-powers', 'branch' => 'master'];
$repos[$this->super_powers_core_organisation . '.gitea'] = (object) ['owner' => $this->super_powers_core_organisation, 'repo' => 'gitea', 'branch' => 'master'];
$repos[$this->super_powers_core_organisation . '.openai'] = (object) ['owner' => $this->super_powers_core_organisation, 'repo' => 'openai', 'branch' => 'master'];
}
return $repos;
}
/** /**
* get temporary path * get temporary path
* *
@ -89,6 +149,33 @@
return $this->config->get('tmp_path'); return $this->config->get('tmp_path');
} }
/**
* Get switch to add super powers
*
* @return bool Switch to add super powers
* @since 3.2.0
*/
protected function getAddsuperpowers(): bool
{
return (bool) $this->params->get('powers_repository', 0);
}
/**
* Get switch to add own super powers
*
* @return bool Switch to add own super powers
* @since 3.2.0
*/
protected function getAddownpowers(): bool
{
if ($this->add_super_powers)
{
return (bool) $this->params->get('super_powers_repositories', 0);
}
return false;
}
/** /**
* Get local super powers repository path * Get local super powers repository path
* *
@ -104,18 +191,7 @@
return $default; return $default;
} }
$global = $this->params->get('local_powers_repository_path', $default); return $this->params->get('local_powers_repository_path', $default);
if (!$this->show_advanced_options)
{
return $global;
}
$value = $this->input->post->get('powers_repository', 2, 'INT');
return $value == 1
? $this->input->post->get('local_powers_repository_path', $global, 'PATH')
: $global;
} }
/** /**
@ -126,27 +202,29 @@
*/ */
protected function getApprovedpaths(): array protected function getApprovedpaths(): array
{ {
$default = (object) ['owner' => 'joomla', 'repo' => 'super-powers', 'branch' => 'master']; // some defaults repos we need by JCB
$approved = $this->super_powers_init_repos;
if (!$this->add_own_powers) if (!$this->add_own_powers)
{ {
return [$default]; return array_values($approved);
} }
$paths = $this->params->get('approved_paths'); $paths = $this->params->get('approved_paths');
$approved = [];
if (!empty($paths)) if (!empty($paths))
{ {
foreach ($paths as $path) foreach ($paths as $path)
{ {
// we make sure to get only the objects $owner = $path->owner ?? null;
$approved[] = $path; $repo = $path->repo ?? null;
if ($owner !== null && $repo !== null)
{
// we make sure to get only the objects
$approved = ["{$owner}.{$repo}" => $path] + $approved;
}
} }
} }
// finally we add the default return array_values($approved);
$approved[] = $default;
return $approved;
} }

View File

@ -18,33 +18,34 @@ class Data #Gold {
# Placeholder $placeholder # Placeholder $placeholder
# Language $language # Language $language
# Field $field # Field $field
# FieldName $fieldName # Fieldname $fieldname
# Filesfolders $filesFolders # Filesfolders $filesfolders
# Libraries $libraries # Libraries $libraries
# Dynamicget $dynamic # Dynamicget $dynamicget
# \JDatabaseDriver $db # Templatelayout $templatelayout
+ __construct(?Config $config = null, ?Customcode $customcode = null, ...) + __construct(Config $config, Customcode $customcode, ...)
+ get(int $id = null) : object|array|null + get(int $id = null) : object|array|null
+ exists(int $id = null) : bool + exists(int $id = null) : bool
+ set(int $id) : bool + set(int $id) : bool
} }
note right of Data::__construct note right of Data::__construct
Constructor Constructor.
since: 3.2.0 since: 3.2.0
arguments: arguments:
?Config $config = null Config $config
?Customcode $customcode = null Customcode $customcode
?Gui $gui = null Gui $gui
?Placeholder $placeholder = null Placeholder $placeholder
?Language $language = null Language $language
?Field $field = null Field $field
?FieldName $fieldName = null Fieldname $fieldname
?Filesfolders $filesFolders = null Filesfolders $filesfolders
?Libraries $libraries = null Libraries $libraries
?Dynamicget $dynamic = null Dynamicget $dynamicget
Templatelayout $templatelayout
?\JDatabaseDriver $db = null ?\JDatabaseDriver $db = null
end note end note

View File

@ -14,17 +14,17 @@ namespace VDM\Joomla\Componentbuilder\Compiler\Joomlamodule;
use Joomla\CMS\Factory; use Joomla\CMS\Factory;
use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\Filter\OutputFilter;
use VDM\Joomla\Componentbuilder\Compiler\Factory as Compiler;
use VDM\Joomla\Componentbuilder\Compiler\Config; use VDM\Joomla\Componentbuilder\Compiler\Config;
use VDM\Joomla\Componentbuilder\Compiler\Customcode; use VDM\Joomla\Componentbuilder\Compiler\Customcode;
use VDM\Joomla\Componentbuilder\Compiler\Customcode\Gui; use VDM\Joomla\Componentbuilder\Compiler\Customcode\Gui;
use VDM\Joomla\Componentbuilder\Compiler\Placeholder; use VDM\Joomla\Componentbuilder\Compiler\Placeholder;
use VDM\Joomla\Componentbuilder\Compiler\Language; use VDM\Joomla\Componentbuilder\Compiler\Language;
use VDM\Joomla\Componentbuilder\Compiler\Field; use VDM\Joomla\Componentbuilder\Compiler\Field;
use VDM\Joomla\Componentbuilder\Compiler\Field\Name as FieldName; use VDM\Joomla\Componentbuilder\Compiler\Field\Name as Fieldname;
use VDM\Joomla\Componentbuilder\Compiler\Model\Filesfolders; use VDM\Joomla\Componentbuilder\Compiler\Model\Filesfolders;
use VDM\Joomla\Componentbuilder\Compiler\Model\Libraries; use VDM\Joomla\Componentbuilder\Compiler\Model\Libraries;
use VDM\Joomla\Componentbuilder\Compiler\Dynamicget\Data as Dynamicget; use VDM\Joomla\Componentbuilder\Compiler\Dynamicget\Data as Dynamicget;
use VDM\Joomla\Componentbuilder\Compiler\Templatelayout\Data as Templatelayout;
use VDM\Joomla\Utilities\ArrayHelper; use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\String\ClassfunctionHelper; use VDM\Joomla\Utilities\String\ClassfunctionHelper;
use VDM\Joomla\Utilities\JsonHelper; use VDM\Joomla\Utilities\JsonHelper;
@ -48,126 +48,129 @@ class Data
protected array $data = []; protected array $data = [];
/** /**
* Compiler Config * The Config Class.
* *
* @var Config * @var Config
* @since 3.2.0 * @since 3.2.0
*/ */
protected Config $config; protected Config $config;
/** /**
* Compiler Customcode * The Customcode Class.
* *
* @var Customcode * @var Customcode
* @since 3.2.0 * @since 3.2.0
*/ */
protected Customcode $customcode; protected Customcode $customcode;
/** /**
* Compiler Customcode in Gui * The Gui Class.
* *
* @var Gui * @var Gui
* @since 3.2.0 * @since 3.2.0
**/ */
protected Gui $gui; protected Gui $gui;
/** /**
* Compiler Placeholder * The Placeholder Class.
* *
* @var Placeholder * @var Placeholder
* @since 3.2.0 * @since 3.2.0
**/ */
protected Placeholder $placeholder; protected Placeholder $placeholder;
/** /**
* Compiler Language * The Language Class.
* *
* @var Language * @var Language
* @since 3.2.0 * @since 3.2.0
**/ */
protected Language $language; protected Language $language;
/** /**
* Compiler Field * The Field Class.
* *
* @var Field * @var Field
* @since 3.2.0 * @since 3.2.0
*/ */
protected Field $field; protected Field $field;
/** /**
* Compiler field name * The Name Class.
* *
* @var FieldName * @var Fieldname
* @since 3.2.0 * @since 3.2.0
*/ */
protected FieldName $fieldName; protected Fieldname $fieldname;
/** /**
* Compiler Files Folders * The Filesfolders Class.
* *
* @var Filesfolders * @var Filesfolders
* @since 3.2.0 * @since 3.2.0
*/ */
protected Filesfolders $filesFolders; protected Filesfolders $filesfolders;
/** /**
* Compiler Libraries Model * The Libraries Class.
* *
* @var Libraries * @var Libraries
* @since 3.2.0 * @since 3.2.0
*/ */
protected Libraries $libraries; protected Libraries $libraries;
/** /**
* Compiler Dynamic Get Data * The Data Class.
* *
* @var Dynamicget * @var Dynamicget
* @since 3.2.0 * @since 3.2.0
*/ */
protected Dynamicget $dynamic; protected Dynamicget $dynamicget;
/** /**
* Database object to query local DB * The Data Class.
* *
* @var \JDatabaseDriver * @var Templatelayout
* @since 3.2.0 * @since 3.2.0
**/ */
protected \JDatabaseDriver $db; protected Templatelayout $templatelayout;
/** /**
* Constructor * Constructor.
* *
* @param Config|null $config The compiler config object. * @param Config $config The Config Class.
* @param Customcode|null $customcode The compiler customcode object. * @param Customcode $customcode The Customcode Class.
* @param Gui|null $gui The compiler customcode gui. * @param Gui $gui The Gui Class.
* @param Placeholder|null $placeholder The compiler placeholder object. * @param Placeholder $placeholder The Placeholder Class.
* @param Language|null $language The compiler Language object. * @param Language $language The Language Class.
* @param Field|null $field The compiler field data object. * @param Field $field The Field Class.
* @param FieldName|null $fieldName The compiler field name object. * @param Fieldname $fieldname The Name Class.
* @param Filesfolders|null $filesFolders The compiler files folders object. * @param Filesfolders $filesfolders The Filesfolders Class.
* @param Libraries|null $libraries The compiler libraries model object. * @param Libraries $libraries The Libraries Class.
* @param Dynamicget|null $dynamic The compiler dynamic get data object. * @param Dynamicget $dynamicget The Data Class.
* @param Templatelayout $templatelayout The Data Class.
* @param \JDatabaseDriver|null $db The database object. * @param \JDatabaseDriver|null $db The database object.
* *
* @since 3.2.0 * @since 3.2.0
*/ */
public function __construct(?Config $config = null, ?Customcode $customcode = null, public function __construct(Config $config, Customcode $customcode, Gui $gui,
?Gui $gui = null, ?Placeholder $placeholder = null, Placeholder $placeholder, Language $language,
?Language $language = null, ?Field $field = null, ?FieldName $fieldName = null, Field $field, Fieldname $fieldname,
?Filesfolders $filesFolders = null, ?Libraries $libraries = null, Filesfolders $filesfolders, Libraries $libraries,
?Dynamicget $dynamic = null, ?\JDatabaseDriver $db = null) Dynamicget $dynamicget, Templatelayout $templatelayout,
?\JDatabaseDriver $db = null)
{ {
$this->config = $config ?: Compiler::_('Config'); $this->config = $config;
$this->customcode = $customcode ?: Compiler::_('Customcode'); $this->customcode = $customcode;
$this->gui = $gui ?: Compiler::_('Customcode.Gui'); $this->gui = $gui;
$this->placeholder = $placeholder ?: Compiler::_('Placeholder'); $this->placeholder = $placeholder;
$this->language = $language ?: Compiler::_('Language'); $this->language = $language;
$this->field = $field ?: Compiler::_('Field'); $this->field = $field;
$this->fieldName = $fieldName ?: Compiler::_('Field.Name'); $this->fieldname = $fieldname;
$this->filesFolders = $filesFolders ?: Compiler::_('Model.Filesfolders'); $this->filesfolders = $filesfolders;
$this->libraries = $libraries ?: Compiler::_('Model.Libraries'); $this->libraries = $libraries;
$this->dynamic = $dynamic ?: Compiler::_('Dynamicget.Data'); $this->dynamicget = $dynamicget;
$this->templatelayout = $templatelayout;
$this->db = $db ?: Factory::getDbo(); $this->db = $db ?: Factory::getDbo();
} }
@ -520,6 +523,11 @@ class Data
), ),
$guiMapper $guiMapper
); );
// check if we have template or layouts to load
$this->templatelayout->set(
$module->mod_code , $module->code_name
);
} }
else else
{ {
@ -570,6 +578,11 @@ class Data
), ),
$guiMapper $guiMapper
); );
// check if we have template or layouts to load
$this->templatelayout->set(
$module->default , $module->code_name
);
} }
else else
{ {
@ -760,7 +773,7 @@ class Data
foreach ($form['fields'] as $field) foreach ($form['fields'] as $field)
{ {
// so first we lock the field name in // so first we lock the field name in
$this->fieldName->get( $this->fieldname->get(
$field, $module->key, $unique $field, $module->key, $unique
); );
// add the fields to the global form file builder // add the fields to the global form file builder
@ -787,7 +800,7 @@ class Data
foreach ($form['fields'] as $field) foreach ($form['fields'] as $field)
{ {
// so first we lock the field name in // so first we lock the field name in
$this->fieldName->get( $this->fieldname->get(
$field, $module->key, $unique $field, $module->key, $unique
); );
// add the fields to the config builder // add the fields to the config builder
@ -807,7 +820,7 @@ class Data
unset($module->fields); unset($module->fields);
// set files and folders // set files and folders
$this->filesFolders->set($module); $this->filesfolders->set($module);
// set libraries // set libraries
$this->libraries->set($module->code_name, $module); $this->libraries->set($module->code_name, $module);
@ -920,7 +933,7 @@ class Data
else else
{ {
$module->{$server} = 0; $module->{$server} = 0;
// only change this for sales server (update server can be added loacaly to the zip file) // only change this for sales server (update server can be added locally to the zip file)
if ('sales_server' === $server) if ('sales_server' === $server)
{ {
$module->{'add_' . $server} = 0; $module->{'add_' . $server} = 0;
@ -951,7 +964,6 @@ class Data
} }
return false; return false;
} }
} }

View File

@ -7,126 +7,129 @@
protected array $data = []; protected array $data = [];
/** /**
* Compiler Config * The Config Class.
* *
* @var Config * @var Config
* @since 3.2.0 * @since 3.2.0
*/ */
protected Config $config; protected Config $config;
/** /**
* Compiler Customcode * The Customcode Class.
* *
* @var Customcode * @var Customcode
* @since 3.2.0 * @since 3.2.0
*/ */
protected Customcode $customcode; protected Customcode $customcode;
/** /**
* Compiler Customcode in Gui * The Gui Class.
* *
* @var Gui * @var Gui
* @since 3.2.0 * @since 3.2.0
**/ */
protected Gui $gui; protected Gui $gui;
/** /**
* Compiler Placeholder * The Placeholder Class.
* *
* @var Placeholder * @var Placeholder
* @since 3.2.0 * @since 3.2.0
**/ */
protected Placeholder $placeholder; protected Placeholder $placeholder;
/** /**
* Compiler Language * The Language Class.
* *
* @var Language * @var Language
* @since 3.2.0 * @since 3.2.0
**/ */
protected Language $language; protected Language $language;
/** /**
* Compiler Field * The Field Class.
* *
* @var Field * @var Field
* @since 3.2.0 * @since 3.2.0
*/ */
protected Field $field; protected Field $field;
/** /**
* Compiler field name * The Name Class.
* *
* @var FieldName * @var Fieldname
* @since 3.2.0 * @since 3.2.0
*/ */
protected FieldName $fieldName; protected Fieldname $fieldname;
/** /**
* Compiler Files Folders * The Filesfolders Class.
* *
* @var Filesfolders * @var Filesfolders
* @since 3.2.0 * @since 3.2.0
*/ */
protected Filesfolders $filesFolders; protected Filesfolders $filesfolders;
/** /**
* Compiler Libraries Model * The Libraries Class.
* *
* @var Libraries * @var Libraries
* @since 3.2.0 * @since 3.2.0
*/ */
protected Libraries $libraries; protected Libraries $libraries;
/** /**
* Compiler Dynamic Get Data * The Data Class.
* *
* @var Dynamicget * @var Dynamicget
* @since 3.2.0 * @since 3.2.0
*/ */
protected Dynamicget $dynamic; protected Dynamicget $dynamicget;
/** /**
* Database object to query local DB * The Data Class.
* *
* @var \JDatabaseDriver * @var Templatelayout
* @since 3.2.0 * @since 3.2.0
**/ */
protected \JDatabaseDriver $db; protected Templatelayout $templatelayout;
/** /**
* Constructor * Constructor.
* *
* @param Config|null $config The compiler config object. * @param Config $config The Config Class.
* @param Customcode|null $customcode The compiler customcode object. * @param Customcode $customcode The Customcode Class.
* @param Gui|null $gui The compiler customcode gui. * @param Gui $gui The Gui Class.
* @param Placeholder|null $placeholder The compiler placeholder object. * @param Placeholder $placeholder The Placeholder Class.
* @param Language|null $language The compiler Language object. * @param Language $language The Language Class.
* @param Field|null $field The compiler field data object. * @param Field $field The Field Class.
* @param FieldName|null $fieldName The compiler field name object. * @param Fieldname $fieldname The Name Class.
* @param Filesfolders|null $filesFolders The compiler files folders object. * @param Filesfolders $filesfolders The Filesfolders Class.
* @param Libraries|null $libraries The compiler libraries model object. * @param Libraries $libraries The Libraries Class.
* @param Dynamicget|null $dynamic The compiler dynamic get data object. * @param Dynamicget $dynamicget The Data Class.
* @param Templatelayout $templatelayout The Data Class.
* @param \JDatabaseDriver|null $db The database object. * @param \JDatabaseDriver|null $db The database object.
* *
* @since 3.2.0 * @since 3.2.0
*/ */
public function __construct(?Config $config = null, ?Customcode $customcode = null, public function __construct(Config $config, Customcode $customcode, Gui $gui,
?Gui $gui = null, ?Placeholder $placeholder = null, Placeholder $placeholder, Language $language,
?Language $language = null, ?Field $field = null, ?FieldName $fieldName = null, Field $field, Fieldname $fieldname,
?Filesfolders $filesFolders = null, ?Libraries $libraries = null, Filesfolders $filesfolders, Libraries $libraries,
?Dynamicget $dynamic = null, ?\JDatabaseDriver $db = null) Dynamicget $dynamicget, Templatelayout $templatelayout,
?\JDatabaseDriver $db = null)
{ {
$this->config = $config ?: Compiler::_('Config'); $this->config = $config;
$this->customcode = $customcode ?: Compiler::_('Customcode'); $this->customcode = $customcode;
$this->gui = $gui ?: Compiler::_('Customcode.Gui'); $this->gui = $gui;
$this->placeholder = $placeholder ?: Compiler::_('Placeholder'); $this->placeholder = $placeholder;
$this->language = $language ?: Compiler::_('Language'); $this->language = $language;
$this->field = $field ?: Compiler::_('Field'); $this->field = $field;
$this->fieldName = $fieldName ?: Compiler::_('Field.Name'); $this->fieldname = $fieldname;
$this->filesFolders = $filesFolders ?: Compiler::_('Model.Filesfolders'); $this->filesfolders = $filesfolders;
$this->libraries = $libraries ?: Compiler::_('Model.Libraries'); $this->libraries = $libraries;
$this->dynamic = $dynamic ?: Compiler::_('Dynamicget.Data'); $this->dynamicget = $dynamicget;
$this->templatelayout = $templatelayout;
$this->db = $db ?: Factory::getDbo(); $this->db = $db ?: Factory::getDbo();
} }
@ -479,6 +482,11 @@
), ),
$guiMapper $guiMapper
); );
// check if we have template or layouts to load
$this->templatelayout->set(
$module->mod_code , $module->code_name
);
} }
else else
{ {
@ -529,6 +537,11 @@
), ),
$guiMapper $guiMapper
); );
// check if we have template or layouts to load
$this->templatelayout->set(
$module->default , $module->code_name
);
} }
else else
{ {
@ -719,7 +732,7 @@
foreach ($form['fields'] as $field) foreach ($form['fields'] as $field)
{ {
// so first we lock the field name in // so first we lock the field name in
$this->fieldName->get( $this->fieldname->get(
$field, $module->key, $unique $field, $module->key, $unique
); );
// add the fields to the global form file builder // add the fields to the global form file builder
@ -746,7 +759,7 @@
foreach ($form['fields'] as $field) foreach ($form['fields'] as $field)
{ {
// so first we lock the field name in // so first we lock the field name in
$this->fieldName->get( $this->fieldname->get(
$field, $module->key, $unique $field, $module->key, $unique
); );
// add the fields to the config builder // add the fields to the config builder
@ -766,7 +779,7 @@
unset($module->fields); unset($module->fields);
// set files and folders // set files and folders
$this->filesFolders->set($module); $this->filesfolders->set($module);
// set libraries // set libraries
$this->libraries->set($module->code_name, $module); $this->libraries->set($module->code_name, $module);
@ -879,7 +892,7 @@
else else
{ {
$module->{$server} = 0; $module->{$server} = 0;
// only change this for sales server (update server can be added loacaly to the zip file) // only change this for sales server (update server can be added locally to the zip file)
if ('sales_server' === $server) if ('sales_server' === $server)
{ {
$module->{'add_' . $server} = 0; $module->{'add_' . $server} = 0;
@ -910,4 +923,4 @@
} }
return false; return false;
} }

View File

@ -11,49 +11,49 @@
"type": "class", "type": "class",
"use_selection": { "use_selection": {
"use_selection0": { "use_selection0": {
"use": "d910d8b8-4c23-4f3e-8cda-438f2d2bd7ac",
"as": "Compiler"
},
"use_selection1": {
"use": "fa4bf18e-301e-42e3-91fb-6e0096c07adc", "use": "fa4bf18e-301e-42e3-91fb-6e0096c07adc",
"as": "default" "as": "default"
}, },
"use_selection2": { "use_selection1": {
"use": "313b43c4-98c3-4f62-9177-2d73ec8eba31", "use": "313b43c4-98c3-4f62-9177-2d73ec8eba31",
"as": "default" "as": "default"
}, },
"use_selection3": { "use_selection2": {
"use": "1bd48df2-4f7e-4581-9fe9-4b54e59105e3", "use": "1bd48df2-4f7e-4581-9fe9-4b54e59105e3",
"as": "default" "as": "default"
}, },
"use_selection4": { "use_selection3": {
"use": "06453ada-e370-49f0-b262-e3f5a8ed0c2c", "use": "06453ada-e370-49f0-b262-e3f5a8ed0c2c",
"as": "default" "as": "default"
}, },
"use_selection5": { "use_selection4": {
"use": "8eee7df5-2775-41a9-9372-c46c5939a252", "use": "8eee7df5-2775-41a9-9372-c46c5939a252",
"as": "default" "as": "default"
}, },
"use_selection6": { "use_selection5": {
"use": "d7ba2d5d-10b6-470d-978d-9f91ea65ee75", "use": "d7ba2d5d-10b6-470d-978d-9f91ea65ee75",
"as": "default" "as": "default"
}, },
"use_selection7": { "use_selection6": {
"use": "9387215f-a965-4421-acf3-5e8f9d11382f", "use": "9387215f-a965-4421-acf3-5e8f9d11382f",
"as": "FieldName" "as": "Fieldname"
}, },
"use_selection8": { "use_selection7": {
"use": "f4578c04-a81e-4218-b80d-b0612196eaf0", "use": "f4578c04-a81e-4218-b80d-b0612196eaf0",
"as": "default" "as": "default"
}, },
"use_selection9": { "use_selection8": {
"use": "59895f37-50c8-4af3-9dad-230e18841953", "use": "59895f37-50c8-4af3-9dad-230e18841953",
"as": "default" "as": "default"
}, },
"use_selection10": { "use_selection9": {
"use": "05c49a1f-ba5b-4be1-b3d0-4a74c42f7a46", "use": "05c49a1f-ba5b-4be1-b3d0-4a74c42f7a46",
"as": "Dynamicget" "as": "Dynamicget"
}, },
"use_selection10": {
"use": "39ea8150-f124-4e47-909d-641bf1c96d5e",
"as": "Templatelayout"
},
"use_selection11": { "use_selection11": {
"use": "0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a", "use": "0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a",
"as": "default" "as": "default"

View File

@ -18,6 +18,8 @@ class Config #Gold {
# getAddcustomgiteaurl() : int # getAddcustomgiteaurl() : int
# getCustomgiteaurl() : ?string # getCustomgiteaurl() : ?string
# getCustomgiteatoken() : ?string # getCustomgiteatoken() : ?string
# getSuperpowerscoreorganisation() : string
# getSuperpowerscorerepos() : array
# getAddcontributors() : bool # getAddcontributors() : bool
# getAddajax() : bool # getAddajax() : bool
# getAddsiteajax() : bool # getAddsiteajax() : bool
@ -118,6 +120,20 @@ note right of Config::getCustomgiteatoken
return: ?string return: ?string
end note end note
note left of Config::getSuperpowerscoreorganisation
Get super power core organisation
since: 3.2.0
return: string
end note
note right of Config::getSuperpowerscorerepos
Get super power core repos
since: 3.2.0
return: array
end note
note left of Config::getAddcontributors note left of Config::getAddcontributors
get add contributors switch get add contributors switch

View File

@ -111,6 +111,73 @@ class Config extends BaseConfig
return null; return null;
} }
/**
* Get super power core organisation
*
* @return string The super power core organisation
* @since 3.2.0
*/
protected function getSuperpowerscoreorganisation(): string
{
// the VDM default organisation is [joomla]
$organisation = 'joomla';
if ($this->add_custom_gitea_url == 2)
{
return $this->params->get('super_powers_core_organisation', $organisation);
}
return $organisation;
}
/**
* Get super power core repos
*
* @return array The core repositories on Gitea
* @since 3.2.0
*/
protected function getSuperpowerscorerepos(): array
{
// some defaults repos we need by JCB
$repos = [];
// only add custom init with custom gitea
$paths = null;
if ($this->add_custom_gitea_url == 2)
{
$paths = $this->params->get('super_powers_core_repos');
}
if (!empty($paths) && is_array($paths))
{
foreach ($paths as $path)
{
$owner = $path->owner ?? null;
$repo = $path->repo ?? null;
if ($owner !== null && $repo !== null)
{
// we make sure to get only the objects
$repos = ["{$owner}.{$repo}" => $path] + $repos;
}
}
}
else
{
$repos[$this->super_powers_core_organisation . '.super-powers'] = (object) ['owner' => $this->super_powers_core_organisation, 'repo' => 'super-powers', 'branch' => 'master'];
$repos[$this->super_powers_core_organisation . '.jcb-compiler'] = (object) ['owner' => $this->super_powers_core_organisation, 'repo' => 'jcb-compiler', 'branch' => 'master'];
$repos[$this->super_powers_core_organisation . '.jcb-packager'] = (object) ['owner' => $this->super_powers_core_organisation, 'repo' => 'jcb-packager', 'branch' => 'master'];
$repos[$this->super_powers_core_organisation . '.phpseclib'] = (object) ['owner' => $this->super_powers_core_organisation, 'repo' => 'phpseclib', 'branch' => 'master'];
$repos[$this->super_powers_core_organisation . '.search'] = (object) ['owner' => $this->super_powers_core_organisation, 'repo' => 'search', 'branch' => 'master'];
$repos[$this->super_powers_core_organisation . '.gitea'] = (object) ['owner' => $this->super_powers_core_organisation, 'repo' => 'gitea', 'branch' => 'master'];
$repos[$this->super_powers_core_organisation . '.openai'] = (object) ['owner' => $this->super_powers_core_organisation, 'repo' => 'openai', 'branch' => 'master'];
$repos[$this->super_powers_core_organisation . '.minify'] = (object) ['owner' => $this->super_powers_core_organisation, 'repo' => 'minify', 'branch' => 'master'];
$repos[$this->super_powers_core_organisation . '.psr'] = (object) ['owner' => $this->super_powers_core_organisation, 'repo' => 'psr', 'branch' => 'master'];
$repos[$this->super_powers_core_organisation . '.fof'] = (object) ['owner' => $this->super_powers_core_organisation, 'repo' => 'fof', 'branch' => 'master'];
}
return $repos;
}
/** /**
* get add contributors switch * get add contributors switch
* *
@ -630,20 +697,11 @@ class Config extends BaseConfig
protected function getApprovedpaths(): array protected function getApprovedpaths(): array
{ {
// some defaults repos we need by JCB // some defaults repos we need by JCB
$approved = []; $approved = $this->super_powers_core_repos;
$approved['joomla.super-powers'] = (object) ['owner' => 'joomla', 'repo' => 'super-powers', 'branch' => 'master'];
$approved['joomla.jcb-compiler'] = (object) ['owner' => 'joomla', 'repo' => 'jcb-compiler', 'branch' => 'master'];
$approved['joomla.phpseclib'] = (object) ['owner' => 'joomla', 'repo' => 'phpseclib', 'branch' => 'master'];
$approved['joomla.search'] = (object) ['owner' => 'joomla', 'repo' => 'search', 'branch' => 'master'];
$approved['joomla.gitea'] = (object) ['owner' => 'joomla', 'repo' => 'gitea', 'branch' => 'master'];
$approved['joomla.openai'] = (object) ['owner' => 'joomla', 'repo' => 'openai', 'branch' => 'master'];
$approved['joomla.minify'] = (object) ['owner' => 'joomla', 'repo' => 'minify', 'branch' => 'master'];
$approved['joomla.psr'] = (object) ['owner' => 'joomla', 'repo' => 'psr', 'branch' => 'master'];
$approved['joomla.fof'] = (object) ['owner' => 'joomla', 'repo' => 'fof', 'branch' => 'master'];
if (!$this->add_own_powers) if (!$this->add_own_powers)
{ {
return $approved; return array_values($approved);
} }
$paths = $this->params->get('approved_paths'); $paths = $this->params->get('approved_paths');
@ -762,6 +820,7 @@ class Config extends BaseConfig
{ {
// get posted value // get posted value
$value = $this->input->post->get('add_placeholders', 2, 'INT'); $value = $this->input->post->get('add_placeholders', 2, 'INT');
// get global value // get global value
if ($value > 1) if ($value > 1)
{ {
@ -780,6 +839,7 @@ class Config extends BaseConfig
{ {
// get posted value // get posted value
$value = $this->input->post->get('powers', 2, 'INT'); $value = $this->input->post->get('powers', 2, 'INT');
// get global value // get global value
if ($value > 1) if ($value > 1)
{ {
@ -945,7 +1005,6 @@ class Config extends BaseConfig
protected function getFootableversion(): int protected function getFootableversion(): int
{ {
return 2; // default is version 2 return 2; // default is version 2
} }
} }

View File

@ -77,6 +77,73 @@
return null; return null;
} }
/**
* Get super power core organisation
*
* @return string The super power core organisation
* @since 3.2.0
*/
protected function getSuperpowerscoreorganisation(): string
{
// the VDM default organisation is [joomla]
$organisation = 'joomla';
if ($this->add_custom_gitea_url == 2)
{
return $this->params->get('super_powers_core_organisation', $organisation);
}
return $organisation;
}
/**
* Get super power core repos
*
* @return array The core repositories on Gitea
* @since 3.2.0
*/
protected function getSuperpowerscorerepos(): array
{
// some defaults repos we need by JCB
$repos = [];
// only add custom init with custom gitea
$paths = null;
if ($this->add_custom_gitea_url == 2)
{
$paths = $this->params->get('super_powers_core_repos');
}
if (!empty($paths) && is_array($paths))
{
foreach ($paths as $path)
{
$owner = $path->owner ?? null;
$repo = $path->repo ?? null;
if ($owner !== null && $repo !== null)
{
// we make sure to get only the objects
$repos = ["{$owner}.{$repo}" => $path] + $repos;
}
}
}
else
{
$repos[$this->super_powers_core_organisation . '.super-powers'] = (object) ['owner' => $this->super_powers_core_organisation, 'repo' => 'super-powers', 'branch' => 'master'];
$repos[$this->super_powers_core_organisation . '.jcb-compiler'] = (object) ['owner' => $this->super_powers_core_organisation, 'repo' => 'jcb-compiler', 'branch' => 'master'];
$repos[$this->super_powers_core_organisation . '.jcb-packager'] = (object) ['owner' => $this->super_powers_core_organisation, 'repo' => 'jcb-packager', 'branch' => 'master'];
$repos[$this->super_powers_core_organisation . '.phpseclib'] = (object) ['owner' => $this->super_powers_core_organisation, 'repo' => 'phpseclib', 'branch' => 'master'];
$repos[$this->super_powers_core_organisation . '.search'] = (object) ['owner' => $this->super_powers_core_organisation, 'repo' => 'search', 'branch' => 'master'];
$repos[$this->super_powers_core_organisation . '.gitea'] = (object) ['owner' => $this->super_powers_core_organisation, 'repo' => 'gitea', 'branch' => 'master'];
$repos[$this->super_powers_core_organisation . '.openai'] = (object) ['owner' => $this->super_powers_core_organisation, 'repo' => 'openai', 'branch' => 'master'];
$repos[$this->super_powers_core_organisation . '.minify'] = (object) ['owner' => $this->super_powers_core_organisation, 'repo' => 'minify', 'branch' => 'master'];
$repos[$this->super_powers_core_organisation . '.psr'] = (object) ['owner' => $this->super_powers_core_organisation, 'repo' => 'psr', 'branch' => 'master'];
$repos[$this->super_powers_core_organisation . '.fof'] = (object) ['owner' => $this->super_powers_core_organisation, 'repo' => 'fof', 'branch' => 'master'];
}
return $repos;
}
/** /**
* get add contributors switch * get add contributors switch
* *
@ -596,20 +663,11 @@
protected function getApprovedpaths(): array protected function getApprovedpaths(): array
{ {
// some defaults repos we need by JCB // some defaults repos we need by JCB
$approved = []; $approved = $this->super_powers_core_repos;
$approved['joomla.super-powers'] = (object) ['owner' => 'joomla', 'repo' => 'super-powers', 'branch' => 'master'];
$approved['joomla.jcb-compiler'] = (object) ['owner' => 'joomla', 'repo' => 'jcb-compiler', 'branch' => 'master'];
$approved['joomla.phpseclib'] = (object) ['owner' => 'joomla', 'repo' => 'phpseclib', 'branch' => 'master'];
$approved['joomla.search'] = (object) ['owner' => 'joomla', 'repo' => 'search', 'branch' => 'master'];
$approved['joomla.gitea'] = (object) ['owner' => 'joomla', 'repo' => 'gitea', 'branch' => 'master'];
$approved['joomla.openai'] = (object) ['owner' => 'joomla', 'repo' => 'openai', 'branch' => 'master'];
$approved['joomla.minify'] = (object) ['owner' => 'joomla', 'repo' => 'minify', 'branch' => 'master'];
$approved['joomla.psr'] = (object) ['owner' => 'joomla', 'repo' => 'psr', 'branch' => 'master'];
$approved['joomla.fof'] = (object) ['owner' => 'joomla', 'repo' => 'fof', 'branch' => 'master'];
if (!$this->add_own_powers) if (!$this->add_own_powers)
{ {
return $approved; return array_values($approved);
} }
$paths = $this->params->get('approved_paths'); $paths = $this->params->get('approved_paths');
@ -728,6 +786,7 @@
{ {
// get posted value // get posted value
$value = $this->input->post->get('add_placeholders', 2, 'INT'); $value = $this->input->post->get('add_placeholders', 2, 'INT');
// get global value // get global value
if ($value > 1) if ($value > 1)
{ {
@ -746,6 +805,7 @@
{ {
// get posted value // get posted value
$value = $this->input->post->get('powers', 2, 'INT'); $value = $this->input->post->get('powers', 2, 'INT');
// get global value // get global value
if ($value > 1) if ($value > 1)
{ {
@ -911,4 +971,4 @@
protected function getFootableversion(): int protected function getFootableversion(): int
{ {
return 2; // default is version 2 return 2; // default is version 2
} }