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,13 +78,142 @@ 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
@ -46,6 +48,20 @@ note right of Modifieddate::getKey
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']))
{ {
@ -151,5 +179,22 @@ 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
@ -58,6 +68,76 @@ note right of Structure::getXML
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
``` ```

View File

@ -12,13 +12,12 @@
namespace VDM\Joomla\Componentbuilder\Compiler\Joomlaplugin; namespace VDM\Joomla\Componentbuilder\Compiler\Joomlaplugin;
use VDM\Joomla\Componentbuilder\Compiler\Factory as Compiler;
use VDM\Joomla\Componentbuilder\Compiler\Joomlaplugin\Data as Plugin; use VDM\Joomla\Componentbuilder\Compiler\Joomlaplugin\Data as Plugin;
use VDM\Joomla\Componentbuilder\Compiler\Component; use VDM\Joomla\Componentbuilder\Compiler\Component;
use VDM\Joomla\Componentbuilder\Compiler\Config; use VDM\Joomla\Componentbuilder\Compiler\Config;
use VDM\Joomla\Componentbuilder\Compiler\Registry; use VDM\Joomla\Componentbuilder\Compiler\Registry;
use VDM\Joomla\Componentbuilder\Compiler\Customcode\Dispenser; use VDM\Joomla\Componentbuilder\Compiler\Customcode\Dispenser;
use VDM\Joomla\Componentbuilder\Compiler\Interfaces\EventInterface; use VDM\Joomla\Componentbuilder\Compiler\Interfaces\EventInterface as Event;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Counter; use VDM\Joomla\Componentbuilder\Compiler\Utilities\Counter;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Folder; use VDM\Joomla\Componentbuilder\Compiler\Utilities\Folder;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\File; use VDM\Joomla\Componentbuilder\Compiler\Utilities\File;
@ -40,7 +39,7 @@ use VDM\Joomla\Utilities\FileHelper;
class Structure class Structure
{ {
/** /**
* Compiler Joomla Plugin Data Class * The Data Class.
* *
* @var Plugin * @var Plugin
* @since 3.2.0 * @since 3.2.0
@ -48,15 +47,15 @@ class Structure
protected Plugin $plugin; protected Plugin $plugin;
/** /**
* Compiler Component * The Component Class.
* *
* @var Component * @var Component
* @since 3.2.0 * @since 3.2.0
**/ */
protected Component $component; protected Component $component;
/** /**
* Compiler Config * The Config Class.
* *
* @var Config * @var Config
* @since 3.2.0 * @since 3.2.0
@ -64,7 +63,7 @@ class Structure
protected Config $config; protected Config $config;
/** /**
* The compiler registry * The Registry Class.
* *
* @var Registry * @var Registry
* @since 3.2.0 * @since 3.2.0
@ -72,7 +71,7 @@ class Structure
protected Registry $registry; protected Registry $registry;
/** /**
* Compiler Customcode Dispenser * The Dispenser Class.
* *
* @var Dispenser * @var Dispenser
* @since 3.2.0 * @since 3.2.0
@ -80,15 +79,15 @@ class Structure
protected Dispenser $dispenser; protected Dispenser $dispenser;
/** /**
* Compiler Event * The EventInterface Class.
* *
* @var EventInterface * @var Event
* @since 3.2.0 * @since 3.2.0
*/ */
protected EventInterface $event; protected Event $event;
/** /**
* Compiler Counter * The Counter Class.
* *
* @var Counter * @var Counter
* @since 3.2.0 * @since 3.2.0
@ -96,7 +95,7 @@ class Structure
protected Counter $counter; protected Counter $counter;
/** /**
* Compiler Utilities Folder * The Folder Class.
* *
* @var Folder * @var Folder
* @since 3.2.0 * @since 3.2.0
@ -104,7 +103,7 @@ class Structure
protected Folder $folder; protected Folder $folder;
/** /**
* Compiler Utilities File * The File Class.
* *
* @var File * @var File
* @since 3.2.0 * @since 3.2.0
@ -112,7 +111,7 @@ class Structure
protected File $file; protected File $file;
/** /**
* Compiler Utilities Files * The Files Class.
* *
* @var Files * @var Files
* @since 3.2.0 * @since 3.2.0
@ -120,37 +119,36 @@ class Structure
protected Files $files; protected Files $files;
/** /**
* Constructor * Constructor.
* *
* @param Plugin|null $plugin The compiler Joomla plugin data object. * @param Plugin $plugin The Data Class.
* @param Component|null $component The component class. * @param Component $component The Component Class.
* @param Config|null $config The compiler config object. * @param Config $config The Config Class.
* @param Registry|null $registry The compiler registry object. * @param Registry $registry The Registry Class.
* @param Dispenser|null $dispenser The compiler customcode dispenser object. * @param Dispenser $dispenser The Dispenser Class.
* @param EventInterface|null $event The compiler event api object. * @param Event $event The EventInterface Class.
* @param Counter|null $counter The compiler counter object. * @param Counter $counter The Counter Class.
* @param Folder|null $folder The compiler folder object. * @param Folder $folder The Folder Class.
* @param File|null $file The compiler file object. * @param File $file The File Class.
* @param Files|null $files The compiler files object. * @param Files $files The Files Class.
* *
* @since 3.2.0 * @since 3.2.0
*/ */
public function __construct(?Plugin $plugin = null, ?Component $component = null, public function __construct(Plugin $plugin, Component $component, Config $config,
?Config $config = null, ?Registry $registry = null, Registry $registry, Dispenser $dispenser, Event $event,
?Dispenser $dispenser = null, ?EventInterface $event = null, Counter $counter, Folder $folder, File $file,
?Counter $counter = null, ?Folder $folder = null, Files $files)
?File $file = null, ?Files $files = null)
{ {
$this->plugin = $plugin ?: Compiler::_('Joomlaplugin.Data'); $this->plugin = $plugin;
$this->component = $component ?: Compiler::_('Component'); $this->component = $component;
$this->config = $config ?: Compiler::_('Config'); $this->config = $config;
$this->registry = $registry ?: Compiler::_('Registry'); $this->registry = $registry;
$this->dispenser = $dispenser ?: Compiler::_('Customcode.Dispenser'); $this->dispenser = $dispenser;
$this->event = $event ?: Compiler::_('Event'); $this->event = $event;
$this->counter = $counter ?: Compiler::_('Utilities.Counter'); $this->counter = $counter;
$this->folder = $folder ?: Compiler::_('Utilities.Folder'); $this->folder = $folder;
$this->file = $file ?: Compiler::_('Utilities.File'); $this->file = $file;
$this->files = $files ?: Compiler::_('Utilities.Files'); $this->files = $files;
} }
/** /**
@ -166,22 +164,21 @@ class Structure
// for plugin event TODO change event api signatures // for plugin event TODO change event api signatures
$component_context = $this->config->component_context; $component_context = $this->config->component_context;
$plugins = $this->plugin->get(); $plugins = $this->plugin->get();
// Trigger Event: jcb_ce_onBeforeSetPlugins // Trigger Event: jcb_ce_onBeforeSetPlugins
$this->event->trigger( $this->event->trigger(
'jcb_ce_onBeforeBuildPlugins', 'jcb_ce_onBeforeBuildPlugins',
array(&$component_context, &$plugins) array(&$component_context, &$plugins)
); );
foreach ($plugins as $plugin) foreach ($plugins as $plugin)
{ {
if (ObjectHelper::check($plugin) if (ObjectHelper::check($plugin)
&& isset($plugin->folder_name) && isset($plugin->folder_name)
&& StringHelper::check( && StringHelper::check($plugin->folder_name))
$plugin->folder_name
))
{ {
// plugin path // plugin path
$plugin->folder_path = $this->config->get('compiler_path', JPATH_COMPONENT_ADMINISTRATOR . '/compiler') . '/' $this->pluginPath($plugin);
. $plugin->folder_name;
// set the plugin paths // set the plugin paths
$this->registry->set('dynamic_paths.' . $plugin->key, $plugin->folder_path); $this->registry->set('dynamic_paths.' . $plugin->key, $plugin->folder_path);
@ -193,74 +190,16 @@ class Structure
$this->folder->create($plugin->folder_path); $this->folder->create($plugin->folder_path);
// set main class file // set main class file
$fileDetails = array('path' => $plugin->folder_path . '/' $this->setMainClassFile($plugin);
. $plugin->file_name . '.php',
'name' => $plugin->file_name . '.php',
'zip' => $plugin->file_name . '.php');
$this->file->write(
$fileDetails['path'],
'<?php' . PHP_EOL . '// Plugin main class template' .
PHP_EOL . Placefix::_h('BOM') . PHP_EOL .
PHP_EOL . '// No direct access to this file' . PHP_EOL .
"defined('_JEXEC') or die('Restricted access');"
. PHP_EOL .
Placefix::_h('MAINCLASS')
);
$this->files->appendArray($plugin->key, $fileDetails);
// count the file created
$this->counter->file++;
// set main xml file // set main xml file
$fileDetails = array('path' => $plugin->folder_path . '/' $this->setMainXmlFile($plugin);
. $plugin->file_name . '.xml',
'name' => $plugin->file_name . '.xml',
'zip' => $plugin->file_name . '.xml');
$this->file->write(
$fileDetails['path'],
$this->getXML($plugin)
);
$this->files->appendArray($plugin->key, $fileDetails);
// count the file created
$this->counter->file++;
// set install script if needed // set install script if needed
if ($plugin->add_install_script) $this->setInstallScript($plugin);
{
$fileDetails = [
'path' => $plugin->folder_path . '/script.php',
'name' => 'script.php',
'zip' => 'script.php'
];
$this->file->write(
$fileDetails['path'],
'<?php' . PHP_EOL . '// Script template' .
PHP_EOL . Placefix::_h('BOM') . PHP_EOL .
PHP_EOL . '// No direct access to this file' . PHP_EOL .
"defined('_JEXEC') or die('Restricted access');" . PHP_EOL .
Placefix::_h('INSTALLCLASS')
);
$this->files->appendArray($plugin->key, $fileDetails);
// count the file created
$this->counter->file++;
}
// set readme if found // set readme if found
if ($plugin->addreadme) $this->setReadme($plugin);
{
$fileDetails = [
'path' => $plugin->folder_path . '/README.md',
'name' => 'README.md',
'zip' => 'README.md'
];
$this->file->write($fileDetails['path'], $plugin->readme);
$this->files->appendArray($plugin->key, $fileDetails);
// count the file created
$this->counter->file++;
}
// set fields & rules folders if needed // set fields & rules folders if needed
if (isset($plugin->fields_rules_paths) if (isset($plugin->fields_rules_paths)
@ -274,10 +213,209 @@ class Structure
} }
// set forms folder if needed // set forms folder if needed
$this->setForms($plugin);
// set SQL stuff if needed
$this->setSQL($plugin);
// creat the language folder path
$this->folder->create($plugin->folder_path . '/language');
// also creat the lang tag folder path
$this->folder->create(
$plugin->folder_path . '/language/' . $this->config->get('lang_tag', 'en-GB')
);
// check if this plugin has files
$this->setFiles($plugin);
// check if this plugin has folders
$this->setFolders($plugin);
// check if this plugin has urls
$this->setUrls($plugin);
}
}
}
}
/**
* get the plugin xml template
*
* @param object $plugin The plugin object
*
* @return string
* @since 3.2.0
*/
protected function getXML(object $plugin): string
{
$xml = '<?xml version="1.0" encoding="utf-8"?>';
$xml .= PHP_EOL . '<extension type="plugin" version="'
. $this->config->joomla_versions[$this->config->joomla_version]['xml_version'] . '" group="'
. strtolower((string) $plugin->group) . '" method="upgrade">';
$xml .= PHP_EOL . Indent::_(1) . '<name>' . $plugin->lang_prefix
. '</name>';
$xml .= PHP_EOL . Indent::_(1) . '<creationDate>' . Placefix::_h('BUILDDATE') . '</creationDate>';
$xml .= PHP_EOL . Indent::_(1) . '<author>' . Placefix::_h('AUTHOR') . '</author>';
$xml .= PHP_EOL . Indent::_(1) . '<authorEmail>' . Placefix::_h('AUTHOREMAIL') . '</authorEmail>';
$xml .= PHP_EOL . Indent::_(1) . '<authorUrl>' . Placefix::_h('AUTHORWEBSITE') . '</authorUrl>';
$xml .= PHP_EOL . Indent::_(1) . '<copyright>' . Placefix::_h('COPYRIGHT') . '</copyright>';
$xml .= PHP_EOL . Indent::_(1) . '<license>' . Placefix::_h('LICENSE') . '</license>';
$xml .= PHP_EOL . Indent::_(1) . '<version>' . $plugin->plugin_version
. '</version>';
$xml .= PHP_EOL . Indent::_(1) . '<description>' . $plugin->lang_prefix
. '_XML_DESCRIPTION</description>';
$xml .= Placefix::_h('MAINXML');
$xml .= PHP_EOL . '</extension>';
return $xml;
}
/**
* set the plugin path
*
* @param object $plugin The plugin object
*
* @return void
* @since 3.2.0
*/
protected function pluginPath(object &$plugin): void
{
$plugin->folder_path = $this->config->get('compiler_path', JPATH_COMPONENT_ADMINISTRATOR . '/compiler') . '/'
. $plugin->folder_name;
}
/**
* set the main class path
*
* @param object $plugin The plugin object
*
* @return void
* @since 3.2.0
*/
protected function setMainClassFile(object $plugin): void
{
$file_details = [
'path' => $plugin->folder_path . '/' . $plugin->file_name . '.php',
'name' => $plugin->file_name . '.php',
'zip' => $plugin->file_name . '.php'
];
$this->file->write(
$file_details['path'],
'<?php' . PHP_EOL . '// Plugin main class template' .
PHP_EOL . Placefix::_h('BOM') . PHP_EOL .
PHP_EOL . '// No direct access to this file' . PHP_EOL .
"defined('_JEXEC') or die('Restricted access');"
. PHP_EOL .
Placefix::_h('MAINCLASS')
);
$this->files->appendArray($plugin->key, $file_details);
// count the file created
$this->counter->file++;
}
/**
* set the main xml file
*
* @param object $plugin The plugin object
*
* @return void
* @since 3.2.0
*/
protected function setMainXmlFile(mixed $plugin): void
{
$file_details = [
'path' => $plugin->folder_path . '/' . $plugin->file_name . '.xml',
'name' => $plugin->file_name . '.xml',
'zip' => $plugin->file_name . '.xml'
];
$this->file->write(
$file_details['path'],
$this->getXML($plugin)
);
$this->files->appendArray($plugin->key, $file_details);
// count the file created
$this->counter->file++;
}
/**
* set the install script file
*
* @param object $plugin The plugin object
*
* @return void
* @since 3.2.0
*/
protected function setInstallScript(object $plugin): void
{
if ($plugin->add_install_script)
{
$file_details = [
'path' => $plugin->folder_path . '/script.php',
'name' => 'script.php',
'zip' => 'script.php'
];
$this->file->write(
$file_details['path'],
'<?php' . PHP_EOL . '// Script template' .
PHP_EOL . Placefix::_h('BOM') . PHP_EOL .
PHP_EOL . '// No direct access to this file' . PHP_EOL .
"defined('_JEXEC') or die('Restricted access');" . PHP_EOL .
Placefix::_h('INSTALLCLASS')
);
$this->files->appendArray($plugin->key, $file_details);
// count the file created
$this->counter->file++;
}
}
/**
* set the readme file
*
* @param object $plugin The plugin object
*
* @return void
* @since 3.2.0
*/
protected function setReadme(object $plugin): void
{
if ($plugin->addreadme)
{
$file_details = [
'path' => $plugin->folder_path . '/README.md',
'name' => 'README.md',
'zip' => 'README.md'
];
$this->file->write($file_details['path'], $plugin->readme);
$this->files->appendArray($plugin->key, $file_details);
// count the file created
$this->counter->file++;
}
}
/**
* set the form files and folders
*
* @param object $plugin The plugin object
*
* @return void
* @since 3.2.0
*/
protected function setForms(object $plugin): void
{
if (isset($plugin->form_files) if (isset($plugin->form_files)
&& ArrayHelper::check( && ArrayHelper::check($plugin->form_files))
$plugin->form_files
))
{ {
// create forms folder // create forms folder
$this->folder->create($plugin->folder_path . '/forms'); $this->folder->create($plugin->folder_path . '/forms');
@ -286,7 +424,7 @@ class Structure
foreach ($plugin->form_files as $file => $fields) foreach ($plugin->form_files as $file => $fields)
{ {
// set file details // set file details
$fileDetails = [ $file_details = [
'path' => $plugin->folder_path . '/forms/' . $file . '.xml', 'path' => $plugin->folder_path . '/forms/' . $file . '.xml',
'name' => $file . '.xml', 'name' => $file . '.xml',
'zip' => 'forms/' . $file . '.xml' 'zip' => 'forms/' . $file . '.xml'
@ -308,12 +446,8 @@ class Structure
foreach ($fieldsets as $fieldset => $field) foreach ($fieldsets as $fieldset => $field)
{ {
if (!$add_component_path if (!$add_component_path
&& isset( && isset($plugin->fieldsets_paths[$file . $field_name . $fieldset])
$plugin->fieldsets_paths[$file && $plugin->fieldsets_paths[$file. $field_name . $fieldset] == 1)
. $field_name . $fieldset]
)
&& $plugin->fieldsets_paths[$file
. $field_name . $fieldset] == 1)
{ {
$add_component_path = true; $add_component_path = true;
} }
@ -375,9 +509,8 @@ class Structure
if (!isset($plugin->add_rule_path[$file . $field_name . $fieldset])) if (!isset($plugin->add_rule_path[$file . $field_name . $fieldset]))
{ {
$plugin->add_rule_path[$file . $field_name . $fieldset] = $plugin->add_rule_path[$file . $field_name . $fieldset] =
'/plugins/' . strtolower((string) $plugin->group '/plugins/' . strtolower((string)$plugin->group) . '/'
) . '/' . strtolower((string) $plugin->code_name) . strtolower((string)$plugin->code_name) . '/rules';
. '/rules';
} }
if (!isset($plugin->add_field_path[$file . $field_name . $fieldset])) if (!isset($plugin->add_field_path[$file . $field_name . $fieldset]))
@ -421,9 +554,7 @@ class Structure
} }
// check if we have an inner field set // check if we have an inner field set
if (StringHelper::check( if (StringHelper::check($field_name_inner))
$field_name_inner
))
{ {
$xml .= PHP_EOL . Indent::_(1) $xml .= PHP_EOL . Indent::_(1)
. '<fields name="' . '<fields name="'
@ -435,9 +566,7 @@ class Structure
. $field_name . $fieldset); . $field_name . $fieldset);
// check if we have an inner field set // check if we have an inner field set
if (StringHelper::check( if (StringHelper::check($field_name_inner))
$field_name_inner
))
{ {
$xml .= PHP_EOL . Indent::_(1) $xml .= PHP_EOL . Indent::_(1)
. '</fields>'; . '</fields>';
@ -450,15 +579,25 @@ class Structure
$xml .= PHP_EOL . '</form>'; $xml .= PHP_EOL . '</form>';
// add xml to file // add xml to file
$this->file->write($fileDetails['path'], $xml); $this->file->write($file_details['path'], $xml);
$this->files->appendArray($plugin->key, $fileDetails); $this->files->appendArray($plugin->key, $file_details);
// count the file created // count the file created
$this->counter->file++; $this->counter->file++;
} }
} }
}
// set SQL stuff if needed /**
* set the sql stuff
*
* @param object $plugin The plugin object
*
* @return void
* @since 3.2.0
*/
protected function setSQL(object $plugin): void
{
if ($plugin->add_sql || $plugin->add_sql_uninstall) if ($plugin->add_sql || $plugin->add_sql_uninstall)
{ {
// create SQL folder // create SQL folder
@ -494,18 +633,19 @@ class Structure
$this->counter->file++; $this->counter->file++;
} }
} }
}
// creat the language folder path /**
$this->folder->create($plugin->folder_path . '/language'); * set the files
*
// also creat the lang tag folder path * @param object $plugin The plugin object
$this->folder->create( *
$plugin->folder_path . '/language/' . $this->config->get('lang_tag', 'en-GB') * @return void
); * @since 3.2.0
*/
// check if this lib has files protected function setFiles(object $plugin): void
if (isset($plugin->files) {
&& ArrayHelper::check($plugin->files)) if (isset($plugin->files) && ArrayHelper::check($plugin->files))
{ {
// add to component files // add to component files
foreach ($plugin->files as $file) foreach ($plugin->files as $file)
@ -513,13 +653,23 @@ class Structure
// set the path finder // set the path finder
$file['target_type'] = $plugin->target_type; $file['target_type'] = $plugin->target_type;
$file['target_id'] = $plugin->id; $file['target_id'] = $plugin->id;
$this->component->appendArray('files', $file); $this->component->appendArray('files', $file);
} }
} }
}
// check if this lib has folders /**
if (isset($plugin->folders) * set the folders
&& ArrayHelper::check($plugin->folders)) *
* @param object $plugin The plugin object
*
* @return void
* @since 3.2.0
*/
protected function setFolders(object $plugin): void
{
if (isset($plugin->folders) && ArrayHelper::check($plugin->folders))
{ {
// add to component folders // add to component folders
foreach ($plugin->folders as $folder) foreach ($plugin->folders as $folder)
@ -527,23 +677,31 @@ class Structure
// set the path finder // set the path finder
$folder['target_type'] = $plugin->target_type; $folder['target_type'] = $plugin->target_type;
$folder['target_id'] = $plugin->id; $folder['target_id'] = $plugin->id;
$this->component->appendArray('folders', $folder); $this->component->appendArray('folders', $folder);
} }
} }
}
// check if this plugin has urls /**
if (isset($plugin->urls) * set the urls
&& ArrayHelper::check($plugin->urls)) *
* @param object $plugin The plugin object
*
* @return void
* @since 3.2.0
*/
protected function setUrls(object &$plugin): void
{
if (isset($plugin->urls) && ArrayHelper::check($plugin->urls))
{ {
// add to component urls // add to component urls
foreach ($plugin->urls as $n => &$url) foreach ($plugin->urls as &$url)
{ {
// should we add the local folder // should we add the local folder
if (isset($url['type']) && $url['type'] > 1 if (isset($url['type']) && $url['type'] > 1
&& isset($url['url']) && isset($url['url'])
&& StringHelper::check( && StringHelper::check($url['url']))
$url['url']
))
{ {
// set file name // set file name
$fileName = basename((string)$url['url']); $fileName = basename((string)$url['url']);
@ -567,7 +725,7 @@ class Structure
$path = ''; $path = '';
} }
// create sub media media folder path if not set // create sub media folder path if not set
$this->folder->create( $this->folder->create(
$plugin->folder_path . $path $plugin->folder_path . $path
); );
@ -586,40 +744,4 @@ class Structure
} }
} }
} }
}
}
/**
* get the plugin xml template
*
* @param object $module The plugin object
*
* @return string
* @since 3.2.0
*/
protected function getXML(object &$plugin): string
{
$xml = '<?xml version="1.0" encoding="utf-8"?>';
$xml .= PHP_EOL . '<extension type="plugin" version="'
. $this->config->joomla_versions[$this->config->joomla_version]['xml_version'] . '" group="'
. strtolower((string) $plugin->group) . '" method="upgrade">';
$xml .= PHP_EOL . Indent::_(1) . '<name>' . $plugin->lang_prefix
. '</name>';
$xml .= PHP_EOL . Indent::_(1) . '<creationDate>' . Placefix::_h('BUILDDATE') . '</creationDate>';
$xml .= PHP_EOL . Indent::_(1) . '<author>' . Placefix::_h('AUTHOR') . '</author>';
$xml .= PHP_EOL . Indent::_(1) . '<authorEmail>' . Placefix::_h('AUTHOREMAIL') . '</authorEmail>';
$xml .= PHP_EOL . Indent::_(1) . '<authorUrl>' . Placefix::_h('AUTHORWEBSITE') . '</authorUrl>';
$xml .= PHP_EOL . Indent::_(1) . '<copyright>' . Placefix::_h('COPYRIGHT') . '</copyright>';
$xml .= PHP_EOL . Indent::_(1) . '<license>' . Placefix::_h('LICENSE') . '</license>';
$xml .= PHP_EOL . Indent::_(1) . '<version>' . $plugin->plugin_version
. '</version>';
$xml .= PHP_EOL . Indent::_(1) . '<description>' . $plugin->lang_prefix
. '_XML_DESCRIPTION</description>';
$xml .= Placefix::_h('MAINXML');
$xml .= PHP_EOL . '</extension>';
return $xml;
}
}

View File

@ -1,5 +1,5 @@
/** /**
* Compiler Joomla Plugin Data Class * The Data Class.
* *
* @var Plugin * @var Plugin
* @since 3.2.0 * @since 3.2.0
@ -7,15 +7,15 @@
protected Plugin $plugin; protected Plugin $plugin;
/** /**
* Compiler Component * The Component Class.
* *
* @var Component * @var Component
* @since 3.2.0 * @since 3.2.0
**/ */
protected Component $component; protected Component $component;
/** /**
* Compiler Config * The Config Class.
* *
* @var Config * @var Config
* @since 3.2.0 * @since 3.2.0
@ -23,7 +23,7 @@
protected Config $config; protected Config $config;
/** /**
* The compiler registry * The Registry Class.
* *
* @var Registry * @var Registry
* @since 3.2.0 * @since 3.2.0
@ -31,7 +31,7 @@
protected Registry $registry; protected Registry $registry;
/** /**
* Compiler Customcode Dispenser * The Dispenser Class.
* *
* @var Dispenser * @var Dispenser
* @since 3.2.0 * @since 3.2.0
@ -39,15 +39,15 @@
protected Dispenser $dispenser; protected Dispenser $dispenser;
/** /**
* Compiler Event * The EventInterface Class.
* *
* @var EventInterface * @var Event
* @since 3.2.0 * @since 3.2.0
*/ */
protected EventInterface $event; protected Event $event;
/** /**
* Compiler Counter * The Counter Class.
* *
* @var Counter * @var Counter
* @since 3.2.0 * @since 3.2.0
@ -55,7 +55,7 @@
protected Counter $counter; protected Counter $counter;
/** /**
* Compiler Utilities Folder * The Folder Class.
* *
* @var Folder * @var Folder
* @since 3.2.0 * @since 3.2.0
@ -63,7 +63,7 @@
protected Folder $folder; protected Folder $folder;
/** /**
* Compiler Utilities File * The File Class.
* *
* @var File * @var File
* @since 3.2.0 * @since 3.2.0
@ -71,7 +71,7 @@
protected File $file; protected File $file;
/** /**
* Compiler Utilities Files * The Files Class.
* *
* @var Files * @var Files
* @since 3.2.0 * @since 3.2.0
@ -79,37 +79,36 @@
protected Files $files; protected Files $files;
/** /**
* Constructor * Constructor.
* *
* @param Plugin|null $plugin The compiler Joomla plugin data object. * @param Plugin $plugin The Data Class.
* @param Component|null $component The component class. * @param Component $component The Component Class.
* @param Config|null $config The compiler config object. * @param Config $config The Config Class.
* @param Registry|null $registry The compiler registry object. * @param Registry $registry The Registry Class.
* @param Dispenser|null $dispenser The compiler customcode dispenser object. * @param Dispenser $dispenser The Dispenser Class.
* @param EventInterface|null $event The compiler event api object. * @param Event $event The EventInterface Class.
* @param Counter|null $counter The compiler counter object. * @param Counter $counter The Counter Class.
* @param Folder|null $folder The compiler folder object. * @param Folder $folder The Folder Class.
* @param File|null $file The compiler file object. * @param File $file The File Class.
* @param Files|null $files The compiler files object. * @param Files $files The Files Class.
* *
* @since 3.2.0 * @since 3.2.0
*/ */
public function __construct(?Plugin $plugin = null, ?Component $component = null, public function __construct(Plugin $plugin, Component $component, Config $config,
?Config $config = null, ?Registry $registry = null, Registry $registry, Dispenser $dispenser, Event $event,
?Dispenser $dispenser = null, ?EventInterface $event = null, Counter $counter, Folder $folder, File $file,
?Counter $counter = null, ?Folder $folder = null, Files $files)
?File $file = null, ?Files $files = null)
{ {
$this->plugin = $plugin ?: Compiler::_('Joomlaplugin.Data'); $this->plugin = $plugin;
$this->component = $component ?: Compiler::_('Component'); $this->component = $component;
$this->config = $config ?: Compiler::_('Config'); $this->config = $config;
$this->registry = $registry ?: Compiler::_('Registry'); $this->registry = $registry;
$this->dispenser = $dispenser ?: Compiler::_('Customcode.Dispenser'); $this->dispenser = $dispenser;
$this->event = $event ?: Compiler::_('Event'); $this->event = $event;
$this->counter = $counter ?: Compiler::_('Utilities.Counter'); $this->counter = $counter;
$this->folder = $folder ?: Compiler::_('Utilities.Folder'); $this->folder = $folder;
$this->file = $file ?: Compiler::_('Utilities.File'); $this->file = $file;
$this->files = $files ?: Compiler::_('Utilities.Files'); $this->files = $files;
} }
/** /**
@ -125,22 +124,21 @@
// for plugin event TODO change event api signatures // for plugin event TODO change event api signatures
$component_context = $this->config->component_context; $component_context = $this->config->component_context;
$plugins = $this->plugin->get(); $plugins = $this->plugin->get();
// Trigger Event: jcb_ce_onBeforeSetPlugins // Trigger Event: jcb_ce_onBeforeSetPlugins
$this->event->trigger( $this->event->trigger(
'jcb_ce_onBeforeBuildPlugins', 'jcb_ce_onBeforeBuildPlugins',
array(&$component_context, &$plugins) array(&$component_context, &$plugins)
); );
foreach ($plugins as $plugin) foreach ($plugins as $plugin)
{ {
if (ObjectHelper::check($plugin) if (ObjectHelper::check($plugin)
&& isset($plugin->folder_name) && isset($plugin->folder_name)
&& StringHelper::check( && StringHelper::check($plugin->folder_name))
$plugin->folder_name
))
{ {
// plugin path // plugin path
$plugin->folder_path = $this->config->get('compiler_path', JPATH_COMPONENT_ADMINISTRATOR . '/compiler') . '/' $this->pluginPath($plugin);
. $plugin->folder_name;
// set the plugin paths // set the plugin paths
$this->registry->set('dynamic_paths.' . $plugin->key, $plugin->folder_path); $this->registry->set('dynamic_paths.' . $plugin->key, $plugin->folder_path);
@ -152,74 +150,16 @@
$this->folder->create($plugin->folder_path); $this->folder->create($plugin->folder_path);
// set main class file // set main class file
$fileDetails = array('path' => $plugin->folder_path . '/' $this->setMainClassFile($plugin);
. $plugin->file_name . '.php',
'name' => $plugin->file_name . '.php',
'zip' => $plugin->file_name . '.php');
$this->file->write(
$fileDetails['path'],
'<?php' . PHP_EOL . '// Plugin main class template' .
PHP_EOL . Placefix::_h('BOM') . PHP_EOL .
PHP_EOL . '// No direct access to this file' . PHP_EOL .
"defined('_JEXEC') or die('Restricted access');"
. PHP_EOL .
Placefix::_h('MAINCLASS')
);
$this->files->appendArray($plugin->key, $fileDetails);
// count the file created
$this->counter->file++;
// set main xml file // set main xml file
$fileDetails = array('path' => $plugin->folder_path . '/' $this->setMainXmlFile($plugin);
. $plugin->file_name . '.xml',
'name' => $plugin->file_name . '.xml',
'zip' => $plugin->file_name . '.xml');
$this->file->write(
$fileDetails['path'],
$this->getXML($plugin)
);
$this->files->appendArray($plugin->key, $fileDetails);
// count the file created
$this->counter->file++;
// set install script if needed // set install script if needed
if ($plugin->add_install_script) $this->setInstallScript($plugin);
{
$fileDetails = [
'path' => $plugin->folder_path . '/script.php',
'name' => 'script.php',
'zip' => 'script.php'
];
$this->file->write(
$fileDetails['path'],
'<?php' . PHP_EOL . '// Script template' .
PHP_EOL . Placefix::_h('BOM') . PHP_EOL .
PHP_EOL . '// No direct access to this file' . PHP_EOL .
"defined('_JEXEC') or die('Restricted access');" . PHP_EOL .
Placefix::_h('INSTALLCLASS')
);
$this->files->appendArray($plugin->key, $fileDetails);
// count the file created
$this->counter->file++;
}
// set readme if found // set readme if found
if ($plugin->addreadme) $this->setReadme($plugin);
{
$fileDetails = [
'path' => $plugin->folder_path . '/README.md',
'name' => 'README.md',
'zip' => 'README.md'
];
$this->file->write($fileDetails['path'], $plugin->readme);
$this->files->appendArray($plugin->key, $fileDetails);
// count the file created
$this->counter->file++;
}
// set fields & rules folders if needed // set fields & rules folders if needed
if (isset($plugin->fields_rules_paths) if (isset($plugin->fields_rules_paths)
@ -233,10 +173,209 @@
} }
// set forms folder if needed // set forms folder if needed
$this->setForms($plugin);
// set SQL stuff if needed
$this->setSQL($plugin);
// creat the language folder path
$this->folder->create($plugin->folder_path . '/language');
// also creat the lang tag folder path
$this->folder->create(
$plugin->folder_path . '/language/' . $this->config->get('lang_tag', 'en-GB')
);
// check if this plugin has files
$this->setFiles($plugin);
// check if this plugin has folders
$this->setFolders($plugin);
// check if this plugin has urls
$this->setUrls($plugin);
}
}
}
}
/**
* get the plugin xml template
*
* @param object $plugin The plugin object
*
* @return string
* @since 3.2.0
*/
protected function getXML(object $plugin): string
{
$xml = '<?xml version="1.0" encoding="utf-8"?>';
$xml .= PHP_EOL . '<extension type="plugin" version="'
. $this->config->joomla_versions[$this->config->joomla_version]['xml_version'] . '" group="'
. strtolower((string) $plugin->group) . '" method="upgrade">';
$xml .= PHP_EOL . Indent::_(1) . '<name>' . $plugin->lang_prefix
. '</name>';
$xml .= PHP_EOL . Indent::_(1) . '<creationDate>' . Placefix::_h('BUILDDATE') . '</creationDate>';
$xml .= PHP_EOL . Indent::_(1) . '<author>' . Placefix::_h('AUTHOR') . '</author>';
$xml .= PHP_EOL . Indent::_(1) . '<authorEmail>' . Placefix::_h('AUTHOREMAIL') . '</authorEmail>';
$xml .= PHP_EOL . Indent::_(1) . '<authorUrl>' . Placefix::_h('AUTHORWEBSITE') . '</authorUrl>';
$xml .= PHP_EOL . Indent::_(1) . '<copyright>' . Placefix::_h('COPYRIGHT') . '</copyright>';
$xml .= PHP_EOL . Indent::_(1) . '<license>' . Placefix::_h('LICENSE') . '</license>';
$xml .= PHP_EOL . Indent::_(1) . '<version>' . $plugin->plugin_version
. '</version>';
$xml .= PHP_EOL . Indent::_(1) . '<description>' . $plugin->lang_prefix
. '_XML_DESCRIPTION</description>';
$xml .= Placefix::_h('MAINXML');
$xml .= PHP_EOL . '</extension>';
return $xml;
}
/**
* set the plugin path
*
* @param object $plugin The plugin object
*
* @return void
* @since 3.2.0
*/
protected function pluginPath(object &$plugin): void
{
$plugin->folder_path = $this->config->get('compiler_path', JPATH_COMPONENT_ADMINISTRATOR . '/compiler') . '/'
. $plugin->folder_name;
}
/**
* set the main class path
*
* @param object $plugin The plugin object
*
* @return void
* @since 3.2.0
*/
protected function setMainClassFile(object $plugin): void
{
$file_details = [
'path' => $plugin->folder_path . '/' . $plugin->file_name . '.php',
'name' => $plugin->file_name . '.php',
'zip' => $plugin->file_name . '.php'
];
$this->file->write(
$file_details['path'],
'<?php' . PHP_EOL . '// Plugin main class template' .
PHP_EOL . Placefix::_h('BOM') . PHP_EOL .
PHP_EOL . '// No direct access to this file' . PHP_EOL .
"defined('_JEXEC') or die('Restricted access');"
. PHP_EOL .
Placefix::_h('MAINCLASS')
);
$this->files->appendArray($plugin->key, $file_details);
// count the file created
$this->counter->file++;
}
/**
* set the main xml file
*
* @param object $plugin The plugin object
*
* @return void
* @since 3.2.0
*/
protected function setMainXmlFile(mixed $plugin): void
{
$file_details = [
'path' => $plugin->folder_path . '/' . $plugin->file_name . '.xml',
'name' => $plugin->file_name . '.xml',
'zip' => $plugin->file_name . '.xml'
];
$this->file->write(
$file_details['path'],
$this->getXML($plugin)
);
$this->files->appendArray($plugin->key, $file_details);
// count the file created
$this->counter->file++;
}
/**
* set the install script file
*
* @param object $plugin The plugin object
*
* @return void
* @since 3.2.0
*/
protected function setInstallScript(object $plugin): void
{
if ($plugin->add_install_script)
{
$file_details = [
'path' => $plugin->folder_path . '/script.php',
'name' => 'script.php',
'zip' => 'script.php'
];
$this->file->write(
$file_details['path'],
'<?php' . PHP_EOL . '// Script template' .
PHP_EOL . Placefix::_h('BOM') . PHP_EOL .
PHP_EOL . '// No direct access to this file' . PHP_EOL .
"defined('_JEXEC') or die('Restricted access');" . PHP_EOL .
Placefix::_h('INSTALLCLASS')
);
$this->files->appendArray($plugin->key, $file_details);
// count the file created
$this->counter->file++;
}
}
/**
* set the readme file
*
* @param object $plugin The plugin object
*
* @return void
* @since 3.2.0
*/
protected function setReadme(object $plugin): void
{
if ($plugin->addreadme)
{
$file_details = [
'path' => $plugin->folder_path . '/README.md',
'name' => 'README.md',
'zip' => 'README.md'
];
$this->file->write($file_details['path'], $plugin->readme);
$this->files->appendArray($plugin->key, $file_details);
// count the file created
$this->counter->file++;
}
}
/**
* set the form files and folders
*
* @param object $plugin The plugin object
*
* @return void
* @since 3.2.0
*/
protected function setForms(object $plugin): void
{
if (isset($plugin->form_files) if (isset($plugin->form_files)
&& ArrayHelper::check( && ArrayHelper::check($plugin->form_files))
$plugin->form_files
))
{ {
// create forms folder // create forms folder
$this->folder->create($plugin->folder_path . '/forms'); $this->folder->create($plugin->folder_path . '/forms');
@ -245,7 +384,7 @@
foreach ($plugin->form_files as $file => $fields) foreach ($plugin->form_files as $file => $fields)
{ {
// set file details // set file details
$fileDetails = [ $file_details = [
'path' => $plugin->folder_path . '/forms/' . $file . '.xml', 'path' => $plugin->folder_path . '/forms/' . $file . '.xml',
'name' => $file . '.xml', 'name' => $file . '.xml',
'zip' => 'forms/' . $file . '.xml' 'zip' => 'forms/' . $file . '.xml'
@ -267,12 +406,8 @@
foreach ($fieldsets as $fieldset => $field) foreach ($fieldsets as $fieldset => $field)
{ {
if (!$add_component_path if (!$add_component_path
&& isset( && isset($plugin->fieldsets_paths[$file . $field_name . $fieldset])
$plugin->fieldsets_paths[$file && $plugin->fieldsets_paths[$file. $field_name . $fieldset] == 1)
. $field_name . $fieldset]
)
&& $plugin->fieldsets_paths[$file
. $field_name . $fieldset] == 1)
{ {
$add_component_path = true; $add_component_path = true;
} }
@ -334,9 +469,8 @@
if (!isset($plugin->add_rule_path[$file . $field_name . $fieldset])) if (!isset($plugin->add_rule_path[$file . $field_name . $fieldset]))
{ {
$plugin->add_rule_path[$file . $field_name . $fieldset] = $plugin->add_rule_path[$file . $field_name . $fieldset] =
'/plugins/' . strtolower((string) $plugin->group '/plugins/' . strtolower((string)$plugin->group) . '/'
) . '/' . strtolower((string) $plugin->code_name) . strtolower((string)$plugin->code_name) . '/rules';
. '/rules';
} }
if (!isset($plugin->add_field_path[$file . $field_name . $fieldset])) if (!isset($plugin->add_field_path[$file . $field_name . $fieldset]))
@ -380,9 +514,7 @@
} }
// check if we have an inner field set // check if we have an inner field set
if (StringHelper::check( if (StringHelper::check($field_name_inner))
$field_name_inner
))
{ {
$xml .= PHP_EOL . Indent::_(1) $xml .= PHP_EOL . Indent::_(1)
. '<fields name="' . '<fields name="'
@ -394,9 +526,7 @@
. $field_name . $fieldset); . $field_name . $fieldset);
// check if we have an inner field set // check if we have an inner field set
if (StringHelper::check( if (StringHelper::check($field_name_inner))
$field_name_inner
))
{ {
$xml .= PHP_EOL . Indent::_(1) $xml .= PHP_EOL . Indent::_(1)
. '</fields>'; . '</fields>';
@ -409,15 +539,25 @@
$xml .= PHP_EOL . '</form>'; $xml .= PHP_EOL . '</form>';
// add xml to file // add xml to file
$this->file->write($fileDetails['path'], $xml); $this->file->write($file_details['path'], $xml);
$this->files->appendArray($plugin->key, $fileDetails); $this->files->appendArray($plugin->key, $file_details);
// count the file created // count the file created
$this->counter->file++; $this->counter->file++;
} }
} }
}
// set SQL stuff if needed /**
* set the sql stuff
*
* @param object $plugin The plugin object
*
* @return void
* @since 3.2.0
*/
protected function setSQL(object $plugin): void
{
if ($plugin->add_sql || $plugin->add_sql_uninstall) if ($plugin->add_sql || $plugin->add_sql_uninstall)
{ {
// create SQL folder // create SQL folder
@ -453,18 +593,19 @@
$this->counter->file++; $this->counter->file++;
} }
} }
}
// creat the language folder path /**
$this->folder->create($plugin->folder_path . '/language'); * set the files
*
// also creat the lang tag folder path * @param object $plugin The plugin object
$this->folder->create( *
$plugin->folder_path . '/language/' . $this->config->get('lang_tag', 'en-GB') * @return void
); * @since 3.2.0
*/
// check if this lib has files protected function setFiles(object $plugin): void
if (isset($plugin->files) {
&& ArrayHelper::check($plugin->files)) if (isset($plugin->files) && ArrayHelper::check($plugin->files))
{ {
// add to component files // add to component files
foreach ($plugin->files as $file) foreach ($plugin->files as $file)
@ -472,13 +613,23 @@
// set the path finder // set the path finder
$file['target_type'] = $plugin->target_type; $file['target_type'] = $plugin->target_type;
$file['target_id'] = $plugin->id; $file['target_id'] = $plugin->id;
$this->component->appendArray('files', $file); $this->component->appendArray('files', $file);
} }
} }
}
// check if this lib has folders /**
if (isset($plugin->folders) * set the folders
&& ArrayHelper::check($plugin->folders)) *
* @param object $plugin The plugin object
*
* @return void
* @since 3.2.0
*/
protected function setFolders(object $plugin): void
{
if (isset($plugin->folders) && ArrayHelper::check($plugin->folders))
{ {
// add to component folders // add to component folders
foreach ($plugin->folders as $folder) foreach ($plugin->folders as $folder)
@ -486,23 +637,31 @@
// set the path finder // set the path finder
$folder['target_type'] = $plugin->target_type; $folder['target_type'] = $plugin->target_type;
$folder['target_id'] = $plugin->id; $folder['target_id'] = $plugin->id;
$this->component->appendArray('folders', $folder); $this->component->appendArray('folders', $folder);
} }
} }
}
// check if this plugin has urls /**
if (isset($plugin->urls) * set the urls
&& ArrayHelper::check($plugin->urls)) *
* @param object $plugin The plugin object
*
* @return void
* @since 3.2.0
*/
protected function setUrls(object &$plugin): void
{
if (isset($plugin->urls) && ArrayHelper::check($plugin->urls))
{ {
// add to component urls // add to component urls
foreach ($plugin->urls as $n => &$url) foreach ($plugin->urls as &$url)
{ {
// should we add the local folder // should we add the local folder
if (isset($url['type']) && $url['type'] > 1 if (isset($url['type']) && $url['type'] > 1
&& isset($url['url']) && isset($url['url'])
&& StringHelper::check( && StringHelper::check($url['url']))
$url['url']
))
{ {
// set file name // set file name
$fileName = basename((string)$url['url']); $fileName = basename((string)$url['url']);
@ -526,7 +685,7 @@
$path = ''; $path = '';
} }
// create sub media media folder path if not set // create sub media folder path if not set
$this->folder->create( $this->folder->create(
$plugin->folder_path . $path $plugin->folder_path . $path
); );
@ -544,38 +703,3 @@
} }
} }
} }
}
}
}
/**
* get the plugin xml template
*
* @param object $module The plugin object
*
* @return string
* @since 3.2.0
*/
protected function getXML(object &$plugin): string
{
$xml = '<?xml version="1.0" encoding="utf-8"?>';
$xml .= PHP_EOL . '<extension type="plugin" version="'
. $this->config->joomla_versions[$this->config->joomla_version]['xml_version'] . '" group="'
. strtolower((string) $plugin->group) . '" method="upgrade">';
$xml .= PHP_EOL . Indent::_(1) . '<name>' . $plugin->lang_prefix
. '</name>';
$xml .= PHP_EOL . Indent::_(1) . '<creationDate>' . Placefix::_h('BUILDDATE') . '</creationDate>';
$xml .= PHP_EOL . Indent::_(1) . '<author>' . Placefix::_h('AUTHOR') . '</author>';
$xml .= PHP_EOL . Indent::_(1) . '<authorEmail>' . Placefix::_h('AUTHOREMAIL') . '</authorEmail>';
$xml .= PHP_EOL . Indent::_(1) . '<authorUrl>' . Placefix::_h('AUTHORWEBSITE') . '</authorUrl>';
$xml .= PHP_EOL . Indent::_(1) . '<copyright>' . Placefix::_h('COPYRIGHT') . '</copyright>';
$xml .= PHP_EOL . Indent::_(1) . '<license>' . Placefix::_h('LICENSE') . '</license>';
$xml .= PHP_EOL . Indent::_(1) . '<version>' . $plugin->plugin_version
. '</version>';
$xml .= PHP_EOL . Indent::_(1) . '<description>' . $plugin->lang_prefix
. '_XML_DESCRIPTION</description>';
$xml .= Placefix::_h('MAINXML');
$xml .= PHP_EOL . '</extension>';
return $xml;
}

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)
{
$owner = $path->owner ?? null;
$repo = $path->repo ?? null;
if ($owner !== null && $repo !== null)
{ {
// we make sure to get only the objects // we make sure to get only the objects
$approved[] = $path; $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)
{
$owner = $path->owner ?? null;
$repo = $path->repo ?? null;
if ($owner !== null && $repo !== null)
{ {
// we make sure to get only the objects // we make sure to get only the objects
$approved[] = $path; $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,7 +48,7 @@ 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
@ -56,7 +56,7 @@ class Data
protected Config $config; protected Config $config;
/** /**
* Compiler Customcode * The Customcode Class.
* *
* @var Customcode * @var Customcode
* @since 3.2.0 * @since 3.2.0
@ -64,31 +64,31 @@ class Data
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
@ -96,23 +96,23 @@ class Data
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
@ -120,54 +120,57 @@ class Data
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;
@ -952,6 +965,5 @@ class Data
return false; return false;
} }
} }

View File

@ -7,7 +7,7 @@
protected array $data = []; protected array $data = [];
/** /**
* Compiler Config * The Config Class.
* *
* @var Config * @var Config
* @since 3.2.0 * @since 3.2.0
@ -15,7 +15,7 @@
protected Config $config; protected Config $config;
/** /**
* Compiler Customcode * The Customcode Class.
* *
* @var Customcode * @var Customcode
* @since 3.2.0 * @since 3.2.0
@ -23,31 +23,31 @@
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
@ -55,23 +55,23 @@
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
@ -79,54 +79,57 @@
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;

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)
{ {
@ -946,6 +1006,5 @@ class Config extends BaseConfig
{ {
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)
{ {