first commit
This commit is contained in:
commit
ebaeeeb4b3
134
src/01411bb1-fdd6-4cca-84d7-1b62d93c70c1/README.md
Normal file
134
src/01411bb1-fdd6-4cca-84d7-1b62d93c70c1/README.md
Normal file
@ -0,0 +1,134 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# class Extractor (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Compiler\Customcode**
|
||||
```uml
|
||||
@startuml
|
||||
class Extractor #Gold {
|
||||
# array $existing
|
||||
# array $new
|
||||
# array $done
|
||||
# array $counter
|
||||
# array $fileTypes
|
||||
# array $placeholders
|
||||
# string $today
|
||||
# Config $config
|
||||
# Gui $gui
|
||||
# Paths $paths
|
||||
# Reverse $reverse
|
||||
# Placeholder $componentPlaceholder
|
||||
# Pathfix $pathfix
|
||||
# User $user
|
||||
# \JDatabaseDriver $db
|
||||
# CMSApplication $app
|
||||
+ __construct(?Config $config = null, ?Gui $gui = null, ...)
|
||||
+ run() : void
|
||||
# searchFileContent(string $file, $target) : array
|
||||
# insert(int $when = 1) : void
|
||||
# update(int $when = 1) : void
|
||||
# setStartReplace(int $id, int $commentType, ...) : string
|
||||
# addLineChecker(string $replaceKey, int $type, ...) : bool|int
|
||||
# getSystemID(string $lineContent, array $placeholders, ...) : mixed
|
||||
}
|
||||
|
||||
note right of Extractor::__construct
|
||||
Constructor.
|
||||
|
||||
since: 3.2.0
|
||||
|
||||
arguments:
|
||||
?Config $config = null
|
||||
?Gui $gui = null
|
||||
?Paths $paths = null
|
||||
?Reverse $reverse = null
|
||||
?Placeholder $placeholder = null
|
||||
?Pathfix $pathfix = null
|
||||
?User $user = null
|
||||
?\JDatabaseDriver $db = null
|
||||
?CMSApplication $app = null
|
||||
end note
|
||||
|
||||
note left of Extractor::run
|
||||
get the custom code from the local files
|
||||
|
||||
since: 3.2.0
|
||||
return: void
|
||||
end note
|
||||
|
||||
note right of Extractor::searchFileContent
|
||||
search a file for placeholders and store result
|
||||
|
||||
since: 3.2.0
|
||||
return: array
|
||||
end note
|
||||
|
||||
note left of Extractor::insert
|
||||
Insert the code
|
||||
|
||||
since: 3.2.0
|
||||
return: void
|
||||
end note
|
||||
|
||||
note right of Extractor::update
|
||||
Update the code
|
||||
|
||||
since: 3.2.0
|
||||
return: void
|
||||
end note
|
||||
|
||||
note left of Extractor::setStartReplace
|
||||
set the start replace placeholder
|
||||
|
||||
since: 3.2.0
|
||||
return: string
|
||||
|
||||
arguments:
|
||||
int $id
|
||||
int $commentType
|
||||
string $startReplace
|
||||
end note
|
||||
|
||||
note right of Extractor::addLineChecker
|
||||
Check if this line should be added
|
||||
|
||||
since: 3.2.0
|
||||
return: bool|int
|
||||
|
||||
arguments:
|
||||
string $replaceKey
|
||||
int $type
|
||||
string $lineContent
|
||||
end note
|
||||
|
||||
note left of Extractor::getSystemID
|
||||
search for the system id in the line given
|
||||
|
||||
since: 3.2.0
|
||||
return: mixed
|
||||
|
||||
arguments:
|
||||
string $lineContent
|
||||
array $placeholders
|
||||
int $commentType
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
930
src/01411bb1-fdd6-4cca-84d7-1b62d93c70c1/code.php
Normal file
930
src/01411bb1-fdd6-4cca-84d7-1b62d93c70c1/code.php
Normal file
@ -0,0 +1,930 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Compiler\Customcode;
|
||||
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\User\User;
|
||||
use Joomla\CMS\Filesystem\Folder;
|
||||
use Joomla\CMS\Application\CMSApplication;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use VDM\Joomla\Utilities\ArrayHelper;
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Factory as Compiler;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Config;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Customcode\Gui;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Customcode\Extractor\Paths;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Placeholder\Reverse;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Component\Placeholder;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Pathfix;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Placefix;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Customcode\ExtractorInterface;
|
||||
|
||||
|
||||
/**
|
||||
* Compiler Custom Code Extractor
|
||||
*
|
||||
* The custom script placeholders - we use the (xxx) to avoid detection it should be (***)
|
||||
* ##################################---> PHP/JS ---####################################
|
||||
*
|
||||
* New Insert Code = /xxx[INSERT>$$$$]xxx/ /xxx[/INSERT>$$$$]xxx/
|
||||
* New Replace Code = /xxx[REPLACE>$$$$]xxx/ /xxx[/REPLACE>$$$$]xxx/
|
||||
*
|
||||
* //////////////////////////////// when JCB adds it back //////////////////////////////////
|
||||
* JCB Add Inserted Code = /xxx[INSERTED$$$$]xxx//xx23xx/ /xxx[/INSERTED$$$$]xxx/
|
||||
* JCB Add Replaced Code = /xxx[REPLACED$$$$]xxx//xx25xx/ /xxx[/REPLACED$$$$]xxx/
|
||||
*
|
||||
* /////////////////////////////// changeing existing custom code /////////////////////////
|
||||
* Update Inserted Code = /xxx[INSERTED>$$$$]xxx//xx23xx/ /xxx[/INSERTED>$$$$]xxx/
|
||||
* Update Replaced Code = /xxx[REPLACED>$$$$]xxx//xx25xx/ /xxx[/REPLACED>$$$$]xxx/
|
||||
*
|
||||
* The custom script placeholders - we use the (==) to avoid detection it should be (--)
|
||||
* ###################################---> HTML ---#####################################
|
||||
*
|
||||
* New Insert Code = !==[INSERT>$$$$]==> !==[/INSERT>$$$$]==>
|
||||
* New Replace Code = !==[REPLACE>$$$$]==> !==[/REPLACE>$$$$]==>
|
||||
*
|
||||
* ///////////////////////////////// when JCB adds it back ///////////////////////////////
|
||||
* JCB Add Inserted Code =
|
||||
* JCB Add Replaced Code =
|
||||
*
|
||||
* //////////////////////////// changeing existing custom code ///////////////////////////
|
||||
* Update Inserted Code = !==[INSERTED>$$$$]==> !==[/INSERTED>$$$$]==>
|
||||
* Update Replaced Code = !==[REPLACED>$$$$]==> !==[/REPLACED>$$$$]==>
|
||||
*
|
||||
* ////////23 is the ID of the code in the system don't change it!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
*
|
||||
* More info read: https://git.vdm.dev/joomla/Component-Builder/wiki/TIPS:-Custom-Code
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
class Extractor implements ExtractorInterface
|
||||
{
|
||||
/**
|
||||
* The placeholder keys
|
||||
*
|
||||
* @var array
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected array $PKeys
|
||||
= [
|
||||
1 => 'REPLACE<>$$$$]',
|
||||
2 => 'INSERT<>$$$$]',
|
||||
3 => 'REPLACED<>$$$$]',
|
||||
4 => 'INSERTED<>$$$$]'
|
||||
];
|
||||
|
||||
/**
|
||||
* The custom code in local files that already exist in system
|
||||
*
|
||||
* @var array
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected array $existing = [];
|
||||
|
||||
/**
|
||||
* The custom code in local files that are new
|
||||
*
|
||||
* @var array
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected array $new = [];
|
||||
|
||||
/**
|
||||
* The index of code already loaded
|
||||
*
|
||||
* @var array
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected array $done = [];
|
||||
|
||||
/**
|
||||
* The search counter
|
||||
*
|
||||
* @var array
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected array $counter = [1 => 0, 2 => 0];
|
||||
|
||||
/**
|
||||
* The file types to search
|
||||
*
|
||||
* @var array
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected array $fileTypes = ['\.php', '\.js', '\.xml'];
|
||||
|
||||
/**
|
||||
* The local placeholders
|
||||
*
|
||||
* @var array
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected array $placeholders;
|
||||
|
||||
/**
|
||||
* Today's date in SQL format
|
||||
*
|
||||
* @var string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected string $today;
|
||||
|
||||
/**
|
||||
* Compiler Config
|
||||
*
|
||||
* @var Config
|
||||
* @since 3.2.0
|
||||
**/
|
||||
protected Config $config;
|
||||
|
||||
/**
|
||||
* Compiler Customcode Gui
|
||||
*
|
||||
* @var Gui
|
||||
* @since 3.2.0
|
||||
**/
|
||||
protected Gui $gui;
|
||||
|
||||
/**
|
||||
* Compiler Customcode Extractor Paths
|
||||
*
|
||||
* @var Paths
|
||||
* @since 3.2.0
|
||||
**/
|
||||
protected Paths $paths;
|
||||
|
||||
/**
|
||||
* Compiler Placeholder Reverse
|
||||
*
|
||||
* @var Reverse
|
||||
* @since 3.2.0
|
||||
**/
|
||||
protected Reverse $reverse;
|
||||
|
||||
/**
|
||||
* Compiler Component Placeholder
|
||||
*
|
||||
* @var Placeholder
|
||||
* @since 3.2.0
|
||||
**/
|
||||
protected Placeholder $componentPlaceholder;
|
||||
|
||||
/**
|
||||
* Compiler Component Pathfix
|
||||
*
|
||||
* @var Pathfix
|
||||
* @since 3.2.0
|
||||
**/
|
||||
protected Pathfix $pathfix;
|
||||
|
||||
/**
|
||||
* Current User Object
|
||||
*
|
||||
* @var User
|
||||
* @since 3.2.0
|
||||
**/
|
||||
protected User $user;
|
||||
|
||||
/**
|
||||
* Database object to query local DB
|
||||
*
|
||||
* @var \JDatabaseDriver
|
||||
* @since 3.2.0
|
||||
**/
|
||||
protected \JDatabaseDriver $db;
|
||||
|
||||
/**
|
||||
* Database object to query local DB
|
||||
*
|
||||
* @var CMSApplication
|
||||
* @since 3.2.0
|
||||
**/
|
||||
protected CMSApplication $app;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param Config|null $config The compiler config object.
|
||||
* @param Gui|null $gui The compiler customcode gui object.
|
||||
* @param Paths|null $paths The compiler customcode extractor paths object.
|
||||
* @param Reverse|null $reverse The compiler placeholder reverse object.
|
||||
* @param Placeholder|null $placeholder The compiler component placeholder object.
|
||||
* @param Pathfix|null $pathfix The compiler path fixing object.
|
||||
* @param User|null $user The current User object.
|
||||
* @param \JDatabaseDriver|null $db The Database Driver object.
|
||||
* @param CMSApplication|null $app The CMS Application object.
|
||||
*
|
||||
* @throws \Exception
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function __construct(?Config $config = null, ?Gui $gui = null, ?Paths $paths = null,
|
||||
?Reverse $reverse = null, ?Placeholder $placeholder = null, ?Pathfix $pathfix = null,
|
||||
?User $user = null, ?\JDatabaseDriver $db = null, ?CMSApplication $app = null)
|
||||
{
|
||||
$this->config = $config ?: Compiler::_('Config');
|
||||
$this->gui = $gui ?: Compiler::_('Customcode.Gui');
|
||||
$this->paths = $paths ?: Compiler::_('Customcode.Extractor.Paths');
|
||||
$this->reverse = $reverse ?: Compiler::_('Placeholder.Reverse');
|
||||
$this->componentPlaceholder = $placeholder ?: Compiler::_('Component.Placeholder');
|
||||
$this->pathfix = $pathfix ?: Compiler::_('Utilities.Pathfix');
|
||||
$this->user = $user ?: Factory::getUser();
|
||||
$this->db = $db ?: Factory::getDbo();
|
||||
$this->app = $app ?: Factory::getApplication();
|
||||
|
||||
// set today's date
|
||||
$this->today = Factory::getDate()->toSql();
|
||||
|
||||
// set some local placeholders
|
||||
$placeholders = array_flip(
|
||||
$this->componentPlaceholder->get()
|
||||
);
|
||||
|
||||
$placeholders[StringHelper::safe(
|
||||
$this->config->component_code_name, 'F'
|
||||
) . 'Helper::'] = Placefix::_('Component') . 'Helper::';
|
||||
|
||||
$placeholders['COM_' . StringHelper::safe(
|
||||
$this->config->component_code_name, 'U'
|
||||
)] = 'COM_' . Placefix::_('COMPONENT');
|
||||
|
||||
$placeholders['com_' . $this->config->component_code_name] = 'com_' . Placefix::_('component');
|
||||
|
||||
// set the local placeholders
|
||||
$this->placeholders = array_reverse($placeholders, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* get the custom code from the local files
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
// we must first store the current working directory
|
||||
$joomla = getcwd();
|
||||
|
||||
foreach ($this->paths->active as $target => $path)
|
||||
{
|
||||
// we are changing the working directory to the component path
|
||||
chdir($path);
|
||||
foreach ($this->fileTypes as $type)
|
||||
{
|
||||
// get a list of files in the current directory tree (only PHP, JS and XML for now)
|
||||
$files = Folder::files('.', $type, true, true);
|
||||
|
||||
// check if files found
|
||||
if (ArrayHelper::check($files))
|
||||
{
|
||||
foreach ($files as $file)
|
||||
{
|
||||
// search the file
|
||||
$this->searchFileContent($file, $target);
|
||||
|
||||
// insert new code
|
||||
$this->insert(100);
|
||||
|
||||
// update existing custom code
|
||||
$this->update(30);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// change back to Joomla working directory
|
||||
chdir($joomla);
|
||||
|
||||
// make sure all code is stored
|
||||
$this->insert();
|
||||
// update existing custom code
|
||||
$this->update();
|
||||
}
|
||||
|
||||
/**
|
||||
* search a file for placeholders and store result
|
||||
*
|
||||
* @param string $file The file path to search
|
||||
*
|
||||
* @return array on success
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function searchFileContent(&$file, &$target)
|
||||
{
|
||||
// we add a new search for the GUI CODE Blocks
|
||||
$this->gui->search($file, $this->placeholders, $this->today, $target);
|
||||
|
||||
// reset each time per file
|
||||
$loadEndFingerPrint = false;
|
||||
$endFingerPrint = [];
|
||||
$fingerPrint = [];
|
||||
$codeBucket = [];
|
||||
$pointer = [];
|
||||
$reading = [];
|
||||
$reader = 0;
|
||||
|
||||
// reset found Start type
|
||||
$commentType = 0;
|
||||
|
||||
// make sure we have the path correct (the script file is not in admin path for example)
|
||||
// there may be more... will nead to keep our eye on this... since files could be moved during install
|
||||
$file = str_replace('./', '', (string) $file); # TODO (windows path issues)
|
||||
$path = $file !== 'script.php' ? $target . '/' . $file : $file;
|
||||
|
||||
// now we go line by line
|
||||
foreach (new \SplFileObject($file) as $lineNumber => $lineContent)
|
||||
{
|
||||
// we must keep last few lines to dynamic find target entry later
|
||||
$fingerPrint[$lineNumber] = trim($lineContent);
|
||||
|
||||
// load the end fingerprint
|
||||
if ($loadEndFingerPrint)
|
||||
{
|
||||
$endFingerPrint[$lineNumber] = trim($lineContent);
|
||||
}
|
||||
|
||||
foreach ($this->PKeys as $type => $search)
|
||||
{
|
||||
$i = (int) ($type == 3 || $type == 4) ? 2 : 1;
|
||||
$_type = (int) ($type == 1 || $type == 3) ? 1 : 2;
|
||||
|
||||
if ($reader === 0 || $reader === $i)
|
||||
{
|
||||
$targetKey = $type;
|
||||
|
||||
$start = '/***[' . $search . '***/';
|
||||
$end = '/***[/' . $search . '***/';
|
||||
$startHTML = '<!--[' . $search . '-->';
|
||||
$endHTML = '<!--[/' . $search . '-->';
|
||||
|
||||
// check if the ending placeholder was found
|
||||
if (isset($reading[$targetKey]) && $reading[$targetKey]
|
||||
&& ((trim((string) $lineContent) === $end
|
||||
|| strpos((string) $lineContent, $end) !== false)
|
||||
|| (trim((string) $lineContent) === $endHTML
|
||||
|| strpos((string) $lineContent, $endHTML) !== false)))
|
||||
{
|
||||
// trim the placeholder and if there is still data then load it
|
||||
if (isset($endReplace)
|
||||
&& ($_line = $this->addLineChecker($endReplace, 2, $lineContent)) !== false)
|
||||
{
|
||||
$codeBucket[$pointer[$targetKey]][] = $_line;
|
||||
}
|
||||
|
||||
// deactivate the reader
|
||||
$reading[$targetKey] = false;
|
||||
|
||||
if ($_type == 2)
|
||||
{
|
||||
// deactivate search
|
||||
$reader = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
// activate fingerPrint for replacement end target
|
||||
$loadEndFingerPrint = true;
|
||||
$backupTargetKey = $targetKey;
|
||||
$backupI = $i;
|
||||
}
|
||||
|
||||
// all new records we can do a bulk insert
|
||||
if ($i === 1)
|
||||
{
|
||||
// end the bucket info for this code block
|
||||
$this->new[$pointer[$targetKey]][]
|
||||
= $this->db->quote(
|
||||
(int) $lineNumber
|
||||
); // 'toline'
|
||||
|
||||
// first reverse engineer this code block
|
||||
$c0de = $this->reverse->engine(
|
||||
implode('', $codeBucket[$pointer[$targetKey]]),
|
||||
$this->placeholders, $target
|
||||
);
|
||||
|
||||
$this->new[$pointer[$targetKey]][]
|
||||
= $this->db->quote(
|
||||
base64_encode((string) $c0de)
|
||||
); // 'code'
|
||||
|
||||
if ($_type == 2)
|
||||
{
|
||||
// load the last value
|
||||
$this->new[$pointer[$targetKey]][]
|
||||
= $this->db->quote(0); // 'hashendtarget'
|
||||
}
|
||||
}
|
||||
// the record already exist so we must update instead
|
||||
elseif ($i === 2)
|
||||
{
|
||||
// end the bucket info for this code block
|
||||
$this->existing[$pointer[$targetKey]]['fields'][]
|
||||
= $this->db->quoteName('to_line') . ' = '
|
||||
. $this->db->quote($lineNumber);
|
||||
|
||||
// first reverse engineer this code block
|
||||
$c0de = $this->reverse->engine(
|
||||
implode('', $codeBucket[$pointer[$targetKey]]),
|
||||
$this->placeholders, $target,
|
||||
$this->existing[$pointer[$targetKey]]['id']
|
||||
);
|
||||
|
||||
$this->existing[$pointer[$targetKey]]['fields'][]
|
||||
= $this->db->quoteName('code') . ' = '
|
||||
. $this->db->quote(base64_encode((string) $c0de));
|
||||
|
||||
if ($_type == 2)
|
||||
{
|
||||
// load the last value
|
||||
$this->existing[$pointer[$targetKey]]['fields'][]
|
||||
= $this->db->quoteName('hashendtarget')
|
||||
. ' = ' . $this->db->quote(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// check if the endfingerprint is ready to save
|
||||
if (count((array) $endFingerPrint) === 3)
|
||||
{
|
||||
$hashendtarget = '3__' . md5(
|
||||
implode('', $endFingerPrint)
|
||||
);
|
||||
|
||||
// all new records we can do a bulk insert
|
||||
if ($i === 1)
|
||||
{
|
||||
// load the last value
|
||||
$this->new[$pointer[$targetKey]][]
|
||||
= $this->db->quote(
|
||||
$hashendtarget
|
||||
); // 'hashendtarget'
|
||||
}
|
||||
// the record already exist so we must update
|
||||
elseif ($i === 2)
|
||||
{
|
||||
$this->existing[$pointer[$targetKey]]['fields'][]
|
||||
= $this->db->quoteName('hashendtarget') . ' = '
|
||||
. $this->db->quote($hashendtarget);
|
||||
}
|
||||
|
||||
// reset the needed values
|
||||
$endFingerPrint = [];
|
||||
$loadEndFingerPrint = false;
|
||||
|
||||
// deactivate reader (to allow other search)
|
||||
$reader = 0;
|
||||
}
|
||||
|
||||
// then read in the code
|
||||
if (isset($reading[$targetKey]) && $reading[$targetKey])
|
||||
{
|
||||
$codeBucket[$pointer[$targetKey]][] = $lineContent;
|
||||
}
|
||||
|
||||
// see if the custom code line starts now with PHP/JS comment type
|
||||
if ((!isset($reading[$targetKey]) || !$reading[$targetKey])
|
||||
&& (($i === 1 && trim((string) $lineContent) === $start)
|
||||
|| strpos((string) $lineContent, $start) !== false))
|
||||
{
|
||||
$commentType = 1; // PHP/JS type
|
||||
$startReplace = $start;
|
||||
$endReplace = $end;
|
||||
}
|
||||
// see if the custom code line starts now with HTML comment type
|
||||
elseif ((!isset($reading[$targetKey])
|
||||
|| !$reading[$targetKey])
|
||||
&& (($i === 1 && trim((string) $lineContent) === $startHTML)
|
||||
|| strpos((string) $lineContent, $startHTML) !== false))
|
||||
{
|
||||
$commentType = 2; // HTML type
|
||||
$startReplace = $startHTML;
|
||||
$endReplace = $endHTML;
|
||||
}
|
||||
|
||||
// check if the starting place holder was found
|
||||
if ($commentType > 0)
|
||||
{
|
||||
// if we have all on one line we have a problem (don't load it TODO)
|
||||
if (strpos((string) $lineContent, (string) $endReplace) !== false)
|
||||
{
|
||||
// reset found comment type
|
||||
$commentType = 0;
|
||||
$this->app->enqueueMessage(
|
||||
Text::_('COM_COMPONENTBUILDER_HR_HTHREECUSTOM_CODES_WARNINGHTHREE'),
|
||||
'Warning'
|
||||
);
|
||||
$this->app->enqueueMessage(
|
||||
Text::sprintf('COM_COMPONENTBUILDER_WE_FOUND_DYNAMIC_CODE_BALL_IN_ONE_LINEB_AND_IGNORED_IT_PLEASE_REVIEW_S_FOR_MORE_DETAILS',
|
||||
$path
|
||||
), 'Warning'
|
||||
);
|
||||
continue;
|
||||
}
|
||||
|
||||
// do a quick check to insure we have an id
|
||||
$id = false;
|
||||
if ($i === 2)
|
||||
{
|
||||
$id = $this->getSystemID(
|
||||
$lineContent,
|
||||
array(1 => $start, 2 => $startHTML),
|
||||
$commentType
|
||||
);
|
||||
}
|
||||
|
||||
if ($i === 2 && $id > 0)
|
||||
{
|
||||
// make sure we update it only once even if found again.
|
||||
if (isset($this->done[$id]))
|
||||
{
|
||||
// reset found comment type
|
||||
$commentType = 0;
|
||||
continue;
|
||||
}
|
||||
// store the id to avoid duplication
|
||||
$this->done[$id] = (int) $id;
|
||||
}
|
||||
|
||||
// start replace
|
||||
$startReplace = $this->setStartReplace(
|
||||
$id, $commentType, $startReplace
|
||||
);
|
||||
|
||||
// set active reader (to lock out other search)
|
||||
$reader = $i;
|
||||
|
||||
// set pointer
|
||||
$pointer[$targetKey] = $this->counter[$i];
|
||||
|
||||
// activate the reader
|
||||
$reading[$targetKey] = true;
|
||||
|
||||
// start code bucket
|
||||
$codeBucket[$pointer[$targetKey]] = [];
|
||||
|
||||
// trim the placeholder and if there is still data then load it
|
||||
if ($_line = $this->addLineChecker(
|
||||
$startReplace, 1, $lineContent
|
||||
))
|
||||
{
|
||||
$codeBucket[$pointer[$targetKey]][] = $_line;
|
||||
}
|
||||
|
||||
// get the finger print around the custom code
|
||||
$inFinger = count($fingerPrint);
|
||||
$getFinger = $inFinger - 1;
|
||||
$hasharray = array_slice(
|
||||
$fingerPrint, -$inFinger, $getFinger, true
|
||||
);
|
||||
$hasleng = count($hasharray);
|
||||
$hashtarget = $hasleng . '__' . md5(
|
||||
implode('', $hasharray)
|
||||
);
|
||||
|
||||
// for good practice
|
||||
$this->pathfix->set($path);
|
||||
|
||||
// all new records we can do a bulk insert
|
||||
if ($i === 1 || !$id)
|
||||
{
|
||||
// start the bucket for this code
|
||||
$this->new[$pointer[$targetKey]] = [];
|
||||
$this->new[$pointer[$targetKey]][]
|
||||
= $this->db->quote(
|
||||
$path
|
||||
); // 'path'
|
||||
|
||||
$this->new[$pointer[$targetKey]][]
|
||||
= $this->db->quote(
|
||||
(int) $_type
|
||||
); // 'type'
|
||||
|
||||
$this->new[$pointer[$targetKey]][]
|
||||
= $this->db->quote(
|
||||
1
|
||||
); // 'target'
|
||||
|
||||
$this->new[$pointer[$targetKey]][]
|
||||
= $this->db->quote(
|
||||
$commentType
|
||||
); // 'comment_type'
|
||||
|
||||
$this->new[$pointer[$targetKey]][]
|
||||
= $this->db->quote(
|
||||
(int) $this->config->component_id
|
||||
); // 'component'
|
||||
|
||||
$this->new[$pointer[$targetKey]][]
|
||||
= $this->db->quote(
|
||||
1
|
||||
); // 'published'
|
||||
|
||||
$this->new[$pointer[$targetKey]][]
|
||||
= $this->db->quote(
|
||||
$this->today
|
||||
); // 'created'
|
||||
|
||||
$this->new[$pointer[$targetKey]][]
|
||||
= $this->db->quote(
|
||||
(int) $this->user->id
|
||||
); // 'created_by'
|
||||
|
||||
$this->new[$pointer[$targetKey]][]
|
||||
= $this->db->quote(
|
||||
1
|
||||
); // 'version'
|
||||
|
||||
$this->new[$pointer[$targetKey]][]
|
||||
= $this->db->quote(
|
||||
1
|
||||
); // 'access'
|
||||
|
||||
$this->new[$pointer[$targetKey]][]
|
||||
= $this->db->quote(
|
||||
$hashtarget
|
||||
); // 'hashtarget'
|
||||
|
||||
$this->new[$pointer[$targetKey]][]
|
||||
= $this->db->quote(
|
||||
(int) $lineNumber
|
||||
); // 'fromline'
|
||||
|
||||
}
|
||||
// the record already exist so we must update instead
|
||||
elseif ($i === 2 && $id > 0)
|
||||
{
|
||||
// start the bucket for this code
|
||||
$this->existing[$pointer[$targetKey]] = [];
|
||||
$this->existing[$pointer[$targetKey]]['id']
|
||||
= (int) $id;
|
||||
$this->existing[$pointer[$targetKey]]['conditions'] = [];
|
||||
$this->existing[$pointer[$targetKey]]['conditions'][]
|
||||
= $this->db->quoteName('id') . ' = '
|
||||
. $this->db->quote($id);
|
||||
$this->existing[$pointer[$targetKey]]['fields'] = [];
|
||||
$this->existing[$pointer[$targetKey]]['fields'][]
|
||||
= $this->db->quoteName('path') . ' = '
|
||||
. $this->db->quote($path);
|
||||
$this->existing[$pointer[$targetKey]]['fields'][]
|
||||
= $this->db->quoteName('type') . ' = '
|
||||
. $this->db->quote($_type);
|
||||
$this->existing[$pointer[$targetKey]]['fields'][]
|
||||
= $this->db->quoteName('comment_type') . ' = '
|
||||
. $this->db->quote($commentType);
|
||||
$this->existing[$pointer[$targetKey]]['fields'][]
|
||||
= $this->db->quoteName('component') . ' = '
|
||||
. $this->db->quote($this->config->component_id);
|
||||
$this->existing[$pointer[$targetKey]]['fields'][]
|
||||
= $this->db->quoteName('from_line') . ' = '
|
||||
. $this->db->quote($lineNumber);
|
||||
$this->existing[$pointer[$targetKey]]['fields'][]
|
||||
= $this->db->quoteName('modified') . ' = '
|
||||
. $this->db->quote($this->today);
|
||||
$this->existing[$pointer[$targetKey]]['fields'][]
|
||||
= $this->db->quoteName('modified_by') . ' = '
|
||||
. $this->db->quote($this->user->id);
|
||||
$this->existing[$pointer[$targetKey]]['fields'][]
|
||||
= $this->db->quoteName('hashtarget') . ' = '
|
||||
. $this->db->quote($hashtarget);
|
||||
}
|
||||
else // this should actualy never happen
|
||||
{
|
||||
// de activate the reader
|
||||
$reading[$targetKey] = false;
|
||||
$reader = 0;
|
||||
}
|
||||
|
||||
// reset found comment type
|
||||
$commentType = 0;
|
||||
// update the counter
|
||||
$this->counter[$i]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// make sure only a few lines is kept at a time
|
||||
if (count((array) $fingerPrint) > 10)
|
||||
{
|
||||
$fingerPrint = array_slice($fingerPrint, -6, 6, true);
|
||||
}
|
||||
}
|
||||
|
||||
// if the code is at the end of the page and there were not three more lines
|
||||
if (count((array) $endFingerPrint) > 0 || $loadEndFingerPrint)
|
||||
{
|
||||
if (count((array) $endFingerPrint) > 0)
|
||||
{
|
||||
$leng = count($endFingerPrint);
|
||||
$hashendtarget = $leng . '__' . md5(
|
||||
implode('', $endFingerPrint)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$hashendtarget = 0;
|
||||
}
|
||||
|
||||
// all new records we can do a buldk insert
|
||||
if ($backupI === 1)
|
||||
{
|
||||
// load the last value
|
||||
$this->new[$pointer[$backupTargetKey]][]
|
||||
= $this->db->quote($hashendtarget); // 'hashendtarget'
|
||||
}
|
||||
// the record already exist so we must use module to update
|
||||
elseif ($backupI === 2)
|
||||
{
|
||||
$this->existing[$pointer[$backupTargetKey]]['fields'][]
|
||||
= $this->db->quoteName('hashendtarget') . ' = '
|
||||
. $this->db->quote($hashendtarget);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert the code
|
||||
*
|
||||
* @param int $when To set when to update
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function insert(int $when = 1)
|
||||
{
|
||||
if (ArrayHelper::check($this->new) >= $when)
|
||||
{
|
||||
// Create a new query object.
|
||||
$query = $this->db->getQuery(true);
|
||||
$continue = false;
|
||||
// Insert columns.
|
||||
$columns = array('path', 'type', 'target', 'comment_type',
|
||||
'component', 'published', 'created', 'created_by',
|
||||
'version', 'access', 'hashtarget', 'from_line',
|
||||
'to_line', 'code', 'hashendtarget');
|
||||
// Prepare the insert query.
|
||||
$query->insert(
|
||||
$this->db->quoteName('#__componentbuilder_custom_code')
|
||||
);
|
||||
$query->columns($this->db->quoteName($columns));
|
||||
foreach ($this->new as $values)
|
||||
{
|
||||
if (count((array) $values) == 15)
|
||||
{
|
||||
$query->values(implode(',', $values));
|
||||
$continue = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO line mismatch... should not happen
|
||||
}
|
||||
}
|
||||
// clear the values array
|
||||
$this->new = [];
|
||||
if (!$continue)
|
||||
{
|
||||
return; // insure we don't continue if no values were loaded
|
||||
}
|
||||
// Set the query using our newly populated query object and execute it.
|
||||
$this->db->setQuery($query);
|
||||
$this->db->execute();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the code
|
||||
*
|
||||
* @param int $when To set when to update
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function update(int $when = 1)
|
||||
{
|
||||
if (ArrayHelper::check($this->existing) >= $when)
|
||||
{
|
||||
foreach ($this->existing as $code)
|
||||
{
|
||||
// Create a new query object.
|
||||
$query = $this->db->getQuery(true);
|
||||
// Prepare the update query.
|
||||
$query->update(
|
||||
$this->db->quoteName('#__componentbuilder_custom_code')
|
||||
)->set($code['fields'])->where($code['conditions']);
|
||||
// Set the query using our newly populated query object and execute it.
|
||||
$this->db->setQuery($query);
|
||||
$this->db->execute();
|
||||
}
|
||||
// clear the values array
|
||||
$this->existing = [];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* set the start replace placeholder
|
||||
*
|
||||
* @param int $id The comment id
|
||||
* @param int $commentType The comment type
|
||||
* @param string $startReplace The main replace string
|
||||
*
|
||||
* @return string on success
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function setStartReplace(int $id, int $commentType, string $startReplace): string
|
||||
{
|
||||
if ($id > 0)
|
||||
{
|
||||
switch ($commentType)
|
||||
{
|
||||
case 1: // the PHP & JS type
|
||||
$startReplace .= '/*' . $id . '*/';
|
||||
break;
|
||||
case 2: // the HTML type
|
||||
$startReplace .= '<!--' . $id . '-->';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $startReplace;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if this line should be added
|
||||
*
|
||||
* @param string $replaceKey The key to remove from line
|
||||
* @param int $type The line type
|
||||
* @param string $lineContent The line to check
|
||||
*
|
||||
* @return bool|int true on success
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function addLineChecker(string $replaceKey, int $type, string $lineContent)
|
||||
{
|
||||
$check = explode($replaceKey, $lineContent);
|
||||
switch ($type)
|
||||
{
|
||||
case 1:
|
||||
// beginning of code
|
||||
if (isset($check[1]) && StringHelper::check($check[1]))
|
||||
{
|
||||
return trim($check[1]);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
// end of code
|
||||
if (isset($check[0]) && StringHelper::check($check[0]))
|
||||
{
|
||||
return trim($check[0]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* search for the system id in the line given
|
||||
*
|
||||
* @param string $lineContent The file path to search
|
||||
* @param array $placeholders The values to search for
|
||||
* @param int $commentType The comment type
|
||||
*
|
||||
* @return mixed on success
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function getSystemID(string &$lineContent, array $placeholders, int $commentType)
|
||||
{
|
||||
$trim = '/';
|
||||
if ($commentType == 2)
|
||||
{
|
||||
$trim = '<!--';
|
||||
}
|
||||
// remove place holder from content
|
||||
$string = trim(
|
||||
str_replace($placeholders[$commentType] . $trim, '', $lineContent)
|
||||
);
|
||||
// now get all numbers
|
||||
$numbers = [];
|
||||
preg_match_all('!\d+!', $string, $numbers);
|
||||
// return the first number
|
||||
if (isset($numbers[0])
|
||||
&& ArrayHelper::check(
|
||||
$numbers[0]
|
||||
))
|
||||
{
|
||||
return reset($numbers[0]);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
60
src/01411bb1-fdd6-4cca-84d7-1b62d93c70c1/settings.json
Normal file
60
src/01411bb1-fdd6-4cca-84d7-1b62d93c70c1/settings.json
Normal file
@ -0,0 +1,60 @@
|
||||
{
|
||||
"add_head": "1",
|
||||
"extends": "0",
|
||||
"extends_custom": "",
|
||||
"guid": "01411bb1-fdd6-4cca-84d7-1b62d93c70c1",
|
||||
"implements": [
|
||||
"6da2afa5-6087-46dd-80a0-74c6434bcb18"
|
||||
],
|
||||
"implements_custom": "",
|
||||
"load_selection": null,
|
||||
"name": "Extractor",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "JCB.Compiler.Customcode.Extractor",
|
||||
"type": "class",
|
||||
"use_selection": {
|
||||
"use_selection0": {
|
||||
"use": "0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection1": {
|
||||
"use": "1f28cb53-60d9-4db1-b517-3c7dc6b429ef",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection2": {
|
||||
"use": "d910d8b8-4c23-4f3e-8cda-438f2d2bd7ac",
|
||||
"as": "Compiler"
|
||||
},
|
||||
"use_selection3": {
|
||||
"use": "fa4bf18e-301e-42e3-91fb-6e0096c07adc",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection4": {
|
||||
"use": "1bd48df2-4f7e-4581-9fe9-4b54e59105e3",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection5": {
|
||||
"use": "053803e6-1251-4aed-aefe-46a8e84198d2",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection6": {
|
||||
"use": "ca111518-e47c-4049-b1b2-cb010f23866f",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection7": {
|
||||
"use": "aecc17ba-0b0f-4e5c-ae43-71be063a3dcb",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection8": {
|
||||
"use": "cdc9b06d-8333-4fa7-ab4d-b810dd90f95f",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection9": {
|
||||
"use": "500f3a7f-c16d-4dd4-81b2-2df6776b5388",
|
||||
"as": "default"
|
||||
}
|
||||
},
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder.Compiler.Customcode.Extractor",
|
||||
"description": "Compiler Custom Code Extractor\r\n\r\nThe custom script placeholders - we use the (xxx) to avoid detection it should be (***)\r\n##################################---> PHP\/JS ---####################################\r\n\r\nNew Insert Code = \/xxx[INSERT>$$$$]xxx\/ \/xxx[\/INSERT>$$$$]xxx\/\r\nNew Replace Code = \/xxx[REPLACE>$$$$]xxx\/ \/xxx[\/REPLACE>$$$$]xxx\/\r\n\r\n\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ when JCB adds it back \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\r\nJCB Add Inserted Code = \/xxx[INSERTED$$$$]xxx\/\/xx23xx\/ \/xxx[\/INSERTED$$$$]xxx\/\r\nJCB Add Replaced Code = \/xxx[REPLACED$$$$]xxx\/\/xx25xx\/ \/xxx[\/REPLACED$$$$]xxx\/\r\n\r\n\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ changeing existing custom code \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\r\nUpdate Inserted Code = \/xxx[INSERTED>$$$$]xxx\/\/xx23xx\/ \/xxx[\/INSERTED>$$$$]xxx\/\r\nUpdate Replaced Code = \/xxx[REPLACED>$$$$]xxx\/\/xx25xx\/ \/xxx[\/REPLACED>$$$$]xxx\/\r\n\r\nThe custom script placeholders - we use the (==) to avoid detection it should be (--)\r\n###################################---> HTML ---#####################################\r\n\r\nNew Insert Code = !==[INSERT>$$$$]==> !==[\/INSERT>$$$$]==>\r\nNew Replace Code = !==[REPLACE>$$$$]==> !==[\/REPLACE>$$$$]==>\r\n\r\n\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ when JCB adds it back \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\r\nJCB Add Inserted Code = \r\nJCB Add Replaced Code = \r\n\r\n\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ changeing existing custom code \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\r\nUpdate Inserted Code = !==[INSERTED>$$$$]==> !==[\/INSERTED>$$$$]==>\r\nUpdate Replaced Code = !==[REPLACED>$$$$]==> !==[\/REPLACED>$$$$]==>\r\n\r\n\/\/\/\/\/\/\/\/23 is the ID of the code in the system don't change it!!!!!!!!!!!!!!!!!!!!!!!!!!\r\n\r\nMore info read: https:\/\/git.vdm.dev\/joomla\/Component-Builder\/wiki\/TIPS:-Custom-Code\r\n\r\n@since 3.2.0",
|
||||
"head": "use Joomla\\CMS\\Factory;\r\nuse Joomla\\CMS\\User\\User;\r\nuse Joomla\\CMS\\Filesystem\\Folder;\r\nuse Joomla\\CMS\\Application\\CMSApplication;\r\nuse Joomla\\CMS\\Language\\Text;"
|
||||
}
|
47
src/037c7274-fb16-455d-989a-bf1da022620b/README.md
Normal file
47
src/037c7274-fb16-455d-989a-bf1da022620b/README.md
Normal file
@ -0,0 +1,47 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# class Customimportscripts (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Compiler\Model**
|
||||
```uml
|
||||
@startuml
|
||||
class Customimportscripts #Gold {
|
||||
# array $areas
|
||||
# array $guiMapper
|
||||
# Dispenser $dispenser
|
||||
+ __construct(?Dispenser $dispenser = null)
|
||||
+ set(object $item, string $table = 'admin_view') : void
|
||||
}
|
||||
|
||||
note right of Customimportscripts::__construct
|
||||
Constructor
|
||||
|
||||
since: 3.2.0
|
||||
end note
|
||||
|
||||
note right of Customimportscripts::set
|
||||
Set Custom Import Scripts
|
||||
|
||||
since: 3.2.0
|
||||
return: void
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
132
src/037c7274-fb16-455d-989a-bf1da022620b/code.php
Normal file
132
src/037c7274-fb16-455d-989a-bf1da022620b/code.php
Normal file
@ -0,0 +1,132 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Compiler\Model;
|
||||
|
||||
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Factory as Compiler;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Customcode\Dispenser;
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
use VDM\Joomla\Utilities\Component\Helper;
|
||||
|
||||
|
||||
/**
|
||||
* Model Custom Import Scripts Class
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
class Customimportscripts
|
||||
{
|
||||
/**
|
||||
* The areas add array
|
||||
*
|
||||
* @var array
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected array $areas = [
|
||||
'php_import_ext',
|
||||
'php_import_display',
|
||||
'php_import',
|
||||
'php_import_setdata',
|
||||
'php_import_save',
|
||||
'php_import_headers',
|
||||
'html_import_view'
|
||||
];
|
||||
|
||||
/**
|
||||
* The gui mapper array
|
||||
*
|
||||
* @var array
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected array $guiMapper = [
|
||||
'table' => 'admin_view',
|
||||
'id' => null,
|
||||
'field' => null,
|
||||
'type' => 'php'
|
||||
];
|
||||
|
||||
/**
|
||||
* Compiler Customcode Dispenser
|
||||
*
|
||||
* @var Dispenser
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Dispenser $dispenser;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param Dispenser|null $dispenser The compiler customcode dispenser
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function __construct(?Dispenser $dispenser = null)
|
||||
{
|
||||
$this->dispenser = $dispenser ?: Compiler::_('Customcode.Dispenser');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Custom Import Scripts
|
||||
*
|
||||
* @param object $item The item data
|
||||
* @param string $table The table
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function set(object &$item, string $table = 'admin_view')
|
||||
{
|
||||
// set custom import scripts
|
||||
if (isset($item->add_custom_import)
|
||||
&& $item->add_custom_import == 1)
|
||||
{
|
||||
// set some gui mapper values
|
||||
$this->guiMapper['table'] = $table;
|
||||
$this->guiMapper['id'] = (int) $item->id;
|
||||
|
||||
foreach ($this->areas as $area)
|
||||
{
|
||||
if (isset($item->$area)
|
||||
&& StringHelper::check($item->$area))
|
||||
{
|
||||
// update GUI mapper field
|
||||
$this->guiMapper['field'] = $area;
|
||||
$this->guiMapper['type'] = 'php';
|
||||
|
||||
// Make sure html gets HTML comment for placeholder
|
||||
if ('html_import_view' === $area)
|
||||
{
|
||||
$this->guiMapper['type'] = 'html';
|
||||
}
|
||||
|
||||
$this->dispenser->set(
|
||||
$item->$area,
|
||||
$area,
|
||||
'import_' . $item->name_list_code,
|
||||
null,
|
||||
$this->guiMapper
|
||||
);
|
||||
|
||||
unset($item->$area);
|
||||
}
|
||||
else
|
||||
{
|
||||
// load the default TODO: convert getDynamicScripts to a class
|
||||
$this->dispenser->hub[$area]['import_' . $item->name_list_code]
|
||||
= Helper::_('getDynamicScripts', [$area, true]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
33
src/037c7274-fb16-455d-989a-bf1da022620b/settings.json
Normal file
33
src/037c7274-fb16-455d-989a-bf1da022620b/settings.json
Normal file
@ -0,0 +1,33 @@
|
||||
{
|
||||
"add_head": "0",
|
||||
"extends": "0",
|
||||
"extends_custom": "",
|
||||
"guid": "037c7274-fb16-455d-989a-bf1da022620b",
|
||||
"implements": null,
|
||||
"implements_custom": "",
|
||||
"load_selection": null,
|
||||
"name": "Customimportscripts",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "JCB.Compiler.Model.Customimportscripts",
|
||||
"type": "class",
|
||||
"use_selection": {
|
||||
"use_selection0": {
|
||||
"use": "d910d8b8-4c23-4f3e-8cda-438f2d2bd7ac",
|
||||
"as": "Compiler"
|
||||
},
|
||||
"use_selection1": {
|
||||
"use": "f1dc6430-fb54-452e-aa53-ce32ae93db88",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection2": {
|
||||
"use": "1f28cb53-60d9-4db1-b517-3c7dc6b429ef",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection3": {
|
||||
"use": "640b5352-fb09-425f-a26e-cd44eda03f15",
|
||||
"as": "default"
|
||||
}
|
||||
},
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder.Compiler.Model.Customimportscripts",
|
||||
"description": "Model Custom Import Scripts Class\r\n\r\n@since 3.2.0"
|
||||
}
|
113
src/0419081e-4cb3-4c65-8c6a-ffe941fb0f1c/README.md
Normal file
113
src/0419081e-4cb3-4c65-8c6a-ffe941fb0f1c/README.md
Normal file
@ -0,0 +1,113 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# class Infusion (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Compiler\Power**
|
||||
```uml
|
||||
@startuml
|
||||
class Infusion #Gold {
|
||||
# Config $config
|
||||
# Power $power
|
||||
# Content $content
|
||||
# Autoloader $autoloader
|
||||
# Parser $parser
|
||||
# RepoReadme $reporeadme
|
||||
# ReposReadme $reposreadme
|
||||
# Placeholder $placeholder
|
||||
# Event $event
|
||||
# array $linker
|
||||
+ __construct(?Config $config = null, ?Power $power = null, ...)
|
||||
+ set() : void
|
||||
- parsePowers() : void
|
||||
- setSuperPowers() : void
|
||||
- setPowers() : void
|
||||
- index(array $powers) : string
|
||||
- code(object $power) : string
|
||||
- linker(object $power) : string
|
||||
}
|
||||
|
||||
note right of Infusion::__construct
|
||||
Constructor.
|
||||
|
||||
since: 3.2.0
|
||||
|
||||
arguments:
|
||||
?Config $config = null
|
||||
?Power $power = null
|
||||
?Content $content = null
|
||||
?Autoloader $autoloader = null
|
||||
?Parser $parser = null
|
||||
?RepoReadme $reporeadme = null
|
||||
?ReposReadme $reposreadme = null
|
||||
?Placeholder $placeholder = null
|
||||
?Event $event = null
|
||||
end note
|
||||
|
||||
note left of Infusion::set
|
||||
Infuse the powers data with the content
|
||||
|
||||
since: 3.2.0
|
||||
return: void
|
||||
end note
|
||||
|
||||
note right of Infusion::parsePowers
|
||||
We parse the powers to get the class map of all methods
|
||||
|
||||
since: 3.2.0
|
||||
return: void
|
||||
end note
|
||||
|
||||
note left of Infusion::setSuperPowers
|
||||
Set the Super Powers details
|
||||
|
||||
since: 3.2.0
|
||||
return: void
|
||||
end note
|
||||
|
||||
note right of Infusion::setPowers
|
||||
Set the Powers code
|
||||
|
||||
since: 3.2.0
|
||||
return: void
|
||||
end note
|
||||
|
||||
note left of Infusion::index
|
||||
Build the Super Power Index
|
||||
|
||||
since: 3.2.0
|
||||
return: string
|
||||
end note
|
||||
|
||||
note right of Infusion::code
|
||||
Get the Power code
|
||||
|
||||
since: 3.2.0
|
||||
return: string
|
||||
end note
|
||||
|
||||
note left of Infusion::linker
|
||||
Get the Power Linker
|
||||
|
||||
since: 3.2.0
|
||||
return: string
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
393
src/0419081e-4cb3-4c65-8c6a-ffe941fb0f1c/code.php
Normal file
393
src/0419081e-4cb3-4c65-8c6a-ffe941fb0f1c/code.php
Normal file
@ -0,0 +1,393 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Compiler\Power;
|
||||
|
||||
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Factory as Compiler;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Config;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Power;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Content;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Power\Autoloader;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Power\Parser;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Power\Repo\Readme as RepoReadme;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Power\Repos\Readme as ReposReadme;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Placeholder;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Interfaces\EventInterface as Event;
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
use VDM\Joomla\Utilities\ArrayHelper;
|
||||
use VDM\Joomla\Utilities\ObjectHelper;
|
||||
|
||||
|
||||
/**
|
||||
* Compiler Power Infusion
|
||||
* @since 3.2.0
|
||||
*/
|
||||
class Infusion
|
||||
{
|
||||
/**
|
||||
* Compiler Config
|
||||
*
|
||||
* @var Config
|
||||
* @since 3.2.0
|
||||
**/
|
||||
protected Config $config;
|
||||
|
||||
/**
|
||||
* Power Objects
|
||||
*
|
||||
* @var Power
|
||||
* @since 3.2.0
|
||||
**/
|
||||
protected Power $power;
|
||||
|
||||
/**
|
||||
* Compiler Content
|
||||
*
|
||||
* @var Content
|
||||
* @since 3.2.0
|
||||
**/
|
||||
protected Content $content;
|
||||
|
||||
/**
|
||||
* Compiler Powers Autoloader
|
||||
*
|
||||
* @var Autoloader
|
||||
* @since 3.2.0
|
||||
**/
|
||||
protected Autoloader $autoloader;
|
||||
|
||||
/**
|
||||
* Compiler Powers Parser
|
||||
*
|
||||
* @var Parser
|
||||
* @since 3.2.0
|
||||
**/
|
||||
protected Parser $parser;
|
||||
|
||||
/**
|
||||
* Compiler Powers Repo Readme Builder
|
||||
*
|
||||
* @var RepoReadme
|
||||
* @since 3.2.0
|
||||
**/
|
||||
protected RepoReadme $reporeadme;
|
||||
|
||||
/**
|
||||
* Compiler Powers Repos Readme Builder
|
||||
*
|
||||
* @var ReposReadme
|
||||
* @since 3.2.0
|
||||
**/
|
||||
protected ReposReadme $reposreadme;
|
||||
|
||||
/**
|
||||
* Compiler Placeholder
|
||||
*
|
||||
* @var Placeholder
|
||||
* @since 3.2.0
|
||||
**/
|
||||
protected Placeholder $placeholder;
|
||||
|
||||
/**
|
||||
* Compiler Event
|
||||
*
|
||||
* @var Event
|
||||
* @since 3.2.0
|
||||
**/
|
||||
protected Event $event;
|
||||
|
||||
/**
|
||||
* Power linker values
|
||||
*
|
||||
* @var array
|
||||
* @since 3.2.0
|
||||
**/
|
||||
protected array $linker = [
|
||||
'add_head' => 'add_head',
|
||||
'unchanged_composer' => 'composer',
|
||||
'unchanged_description' => 'description',
|
||||
'extends' => 'extends',
|
||||
'extends_custom' => 'extends_custom',
|
||||
'guid' => 'guid',
|
||||
'unchanged_head' => 'head',
|
||||
'use_selection' => 'use_selection',
|
||||
'implements' => 'implements',
|
||||
'implements_custom' => 'implements_custom',
|
||||
'load_selection' => 'load_selection',
|
||||
'name' => 'name',
|
||||
'power_version' => 'power_version',
|
||||
'system_name' => 'system_name',
|
||||
'type' => 'type',
|
||||
'unchanged_namespace' => 'namespace'
|
||||
];
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param Config|null $config The Config object.
|
||||
* @param Power|null $power The power object.
|
||||
* @param Content|null $content The compiler content object.
|
||||
* @param Autoloader|null $autoloader The powers autoloader object.
|
||||
* @param Parser|null $parser The powers parser object.
|
||||
* @param RepoReadme|null $reporeadme The powers repo readme builder object.
|
||||
* @param ReposReadme|null $reposreadme The powers repos readme builder object.
|
||||
* @param Placeholder|null $placeholder The placeholder object.
|
||||
* @param Event|null $event The events object.
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function __construct(?Config $config = null, ?Power $power = null, ?Content $content = null,
|
||||
?Autoloader $autoloader = null, ?Parser $parser = null, ?RepoReadme $reporeadme = null,
|
||||
?ReposReadme $reposreadme = null, ?Placeholder $placeholder = null, ?Event $event = null)
|
||||
{
|
||||
$this->config = $config ?: Compiler::_('Config');
|
||||
$this->power = $power ?: Compiler::_('Power');
|
||||
$this->content = $content ?: Compiler::_('Content');
|
||||
$this->autoloader = $autoloader ?: Compiler::_('Power.Autoloader');
|
||||
$this->parser = $parser ?: Compiler::_('Power.Parser');
|
||||
$this->reporeadme = $reporeadme ?: Compiler::_('Power.Repo.Readme');
|
||||
$this->reposreadme = $reposreadme ?: Compiler::_('Power.Repos.Readme');
|
||||
$this->placeholder = $placeholder ?: Compiler::_('Placeholder');
|
||||
$this->event = $event ?: Compiler::_('Event');
|
||||
}
|
||||
|
||||
/**
|
||||
* Infuse the powers data with the content
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function set()
|
||||
{
|
||||
// parse all powers main code
|
||||
$this->parsePowers();
|
||||
|
||||
// set the powers
|
||||
$this->setSuperPowers();
|
||||
|
||||
// set the powers
|
||||
$this->setPowers();
|
||||
}
|
||||
|
||||
/**
|
||||
* We parse the powers to get the class map of all methods
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
private function parsePowers()
|
||||
{
|
||||
// we only do this if super powers are active
|
||||
if ($this->config->add_super_powers && ArrayHelper::check($this->power->superpowers))
|
||||
{
|
||||
foreach ($this->power->active as $n => &$power)
|
||||
{
|
||||
if (ObjectHelper::check($power) && isset($power->main_class_code) &&
|
||||
StringHelper::check($power->main_class_code))
|
||||
{
|
||||
// only parse those approved
|
||||
if ($power->approved == 1)
|
||||
{
|
||||
$power->main_class_code = $this->placeholder->update($power->main_class_code, $this->content->active);
|
||||
$power->parsed_class_code = $this->parser->code($power->main_class_code);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the Super Powers details
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
private function setSuperPowers()
|
||||
{
|
||||
// infuse super powers details if set
|
||||
if ($this->config->add_super_powers && ArrayHelper::check($this->power->superpowers))
|
||||
{
|
||||
// TODO we need to update the event signatures
|
||||
$context = $this->config->component_context;
|
||||
|
||||
foreach ($this->power->superpowers as $path => $powers)
|
||||
{
|
||||
$key = StringHelper::safe($path);
|
||||
|
||||
// Trigger Event: jcb_ce_onBeforeInfuseSuperPowerDetails
|
||||
$this->event->trigger(
|
||||
'jcb_ce_onBeforeInfuseSuperPowerDetails',
|
||||
array(&$context, &$path, &$key, &$powers)
|
||||
);
|
||||
|
||||
// POWERREADME
|
||||
$this->content->set_($key, 'POWERREADME', $this->reposreadme->get($powers));
|
||||
|
||||
// POWERINDEX
|
||||
$this->content->set_($key, 'POWERINDEX', $this->index($powers));
|
||||
|
||||
// Trigger Event: jcb_ce_onAfterInfuseSuperPowerDetails
|
||||
$this->event->trigger(
|
||||
'jcb_ce_onAfterInfuseSuperPowerDetails',
|
||||
array(&$context, &$path, &$key, &$powers)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the Powers code
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
private function setPowers()
|
||||
{
|
||||
// infuse powers data if set
|
||||
if (ArrayHelper::check($this->power->active))
|
||||
{
|
||||
// TODO we need to update the event signatures
|
||||
$context = $this->config->component_context;
|
||||
|
||||
foreach ($this->power->active as $power)
|
||||
{
|
||||
if (ObjectHelper::check($power))
|
||||
{
|
||||
// Trigger Event: jcb_ce_onBeforeInfusePowerData
|
||||
$this->event->trigger(
|
||||
'jcb_ce_onBeforeInfusePowerData',
|
||||
array(&$context, &$power)
|
||||
);
|
||||
|
||||
// POWERCODE
|
||||
$this->content->set_($power->key, 'POWERCODE', $this->code($power));
|
||||
|
||||
// POWERLINKER
|
||||
$this->content->set_($power->key, 'POWERLINKER', $this->linker($power));
|
||||
|
||||
// POWERLINKER
|
||||
$this->content->set_($power->key, 'POWERREADME', $this->reporeadme->get($power));
|
||||
|
||||
// Trigger Event: jcb_ce_onAfterInfusePowerData
|
||||
$this->event->trigger(
|
||||
'jcb_ce_onAfterInfusePowerData',
|
||||
array(&$context, &$power)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// now set the power autoloader
|
||||
$this->autoloader->set();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the Super Power Index
|
||||
*
|
||||
* @param array $powers All powers of this super power.
|
||||
*
|
||||
* @return string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
private function index(array &$powers): string
|
||||
{
|
||||
return json_encode($powers, JSON_PRETTY_PRINT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Power code
|
||||
*
|
||||
* @param object $power A power object.
|
||||
*
|
||||
* @return string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
private function code(object &$power): string
|
||||
{
|
||||
$code = [];
|
||||
|
||||
// set the name space
|
||||
$code[] = 'namespace ' . $power->_namespace . ';' . PHP_EOL;
|
||||
|
||||
// check if we have header data
|
||||
if (StringHelper::check($power->head))
|
||||
{
|
||||
$code[] = PHP_EOL . $power->head;
|
||||
}
|
||||
|
||||
// add description if set
|
||||
if (StringHelper::check($power->description))
|
||||
{
|
||||
// check if this is escaped
|
||||
if (strpos((string) $power->description, '/*') === false)
|
||||
{
|
||||
// make this description escaped
|
||||
$power->description = '/**' . PHP_EOL . ' * ' . implode(PHP_EOL . ' * ', explode(PHP_EOL, (string) $power->description)) . PHP_EOL . ' */';
|
||||
}
|
||||
$code[] = PHP_EOL . $power->description;
|
||||
}
|
||||
|
||||
// build power declaration
|
||||
$declaration = $power->type . ' ' . $power->class_name;
|
||||
|
||||
// check if we have extends
|
||||
if (StringHelper::check($power->extends_name))
|
||||
{
|
||||
$declaration .= ' extends ' . $power->extends_name;
|
||||
}
|
||||
|
||||
// check if we have implements
|
||||
if (ArrayHelper::check($power->implement_names))
|
||||
{
|
||||
$declaration .= ' implements ' . implode(', ', $power->implement_names);
|
||||
}
|
||||
|
||||
$code[] = $declaration;
|
||||
$code[] = '{';
|
||||
|
||||
// add the main code if set
|
||||
if (StringHelper::check($power->main_class_code))
|
||||
{
|
||||
$code[] = $power->main_class_code;
|
||||
}
|
||||
|
||||
$code[] = '}' . PHP_EOL;
|
||||
|
||||
return $this->placeholder->update(implode(PHP_EOL, $code), $this->content->active);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Power Linker
|
||||
*
|
||||
* @param object $power A power object.
|
||||
*
|
||||
* @return string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
private function linker(object &$power): string
|
||||
{
|
||||
$linker = [];
|
||||
|
||||
// set the linking values
|
||||
foreach ($power as $key => $value)
|
||||
{
|
||||
if (isset($this->linker[$key]))
|
||||
{
|
||||
$linker[$this->linker[$key]] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
return json_encode($linker, JSON_PRETTY_PRINT);
|
||||
}
|
||||
|
||||
}
|
||||
|
69
src/0419081e-4cb3-4c65-8c6a-ffe941fb0f1c/settings.json
Normal file
69
src/0419081e-4cb3-4c65-8c6a-ffe941fb0f1c/settings.json
Normal file
@ -0,0 +1,69 @@
|
||||
{
|
||||
"add_head": "0",
|
||||
"extends": "0",
|
||||
"extends_custom": "",
|
||||
"guid": "0419081e-4cb3-4c65-8c6a-ffe941fb0f1c",
|
||||
"implements": null,
|
||||
"implements_custom": "",
|
||||
"load_selection": null,
|
||||
"name": "Infusion",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "JCB.Compiler.Power.Infusion",
|
||||
"type": "class",
|
||||
"use_selection": {
|
||||
"use_selection0": {
|
||||
"use": "d910d8b8-4c23-4f3e-8cda-438f2d2bd7ac",
|
||||
"as": "Compiler"
|
||||
},
|
||||
"use_selection1": {
|
||||
"use": "fa4bf18e-301e-42e3-91fb-6e0096c07adc",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection2": {
|
||||
"use": "b836c1b1-b6b1-44f7-b8a2-9a763a4185b1",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection3": {
|
||||
"use": "adfbe68a-6d22-43e5-aee8-2787e8c47e75",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection4": {
|
||||
"use": "6e64917c-d687-4ef3-a655-811319f5a81e",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection5": {
|
||||
"use": "95d0e03f-24fd-4412-bc2e-f0899fcc3205",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection12": {
|
||||
"use": "efb1d0f8-2d14-4d2c-8b5f-4fcdd9df45a5",
|
||||
"as": "RepoReadme"
|
||||
},
|
||||
"use_selection6": {
|
||||
"use": "0d08c583-04d5-454e-b756-48ca05e1651a",
|
||||
"as": "ReposReadme"
|
||||
},
|
||||
"use_selection7": {
|
||||
"use": "06453ada-e370-49f0-b262-e3f5a8ed0c2c",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection8": {
|
||||
"use": "20ed72b0-fcac-4344-aee1-8a65e3bf221d",
|
||||
"as": "Event"
|
||||
},
|
||||
"use_selection9": {
|
||||
"use": "1f28cb53-60d9-4db1-b517-3c7dc6b429ef",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection10": {
|
||||
"use": "0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection11": {
|
||||
"use": "91004529-94a9-4590-b842-e7c6b624ecf5",
|
||||
"as": "default"
|
||||
}
|
||||
},
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder.Compiler.Power.Infusion",
|
||||
"description": "Compiler Power Infusion\r\n@since 3.2.0"
|
||||
}
|
90
src/053803e6-1251-4aed-aefe-46a8e84198d2/README.md
Normal file
90
src/053803e6-1251-4aed-aefe-46a8e84198d2/README.md
Normal file
@ -0,0 +1,90 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# class Paths (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Compiler\Customcode\Extractor**
|
||||
```uml
|
||||
@startuml
|
||||
class Paths #Gold {
|
||||
+ array $active
|
||||
# array $componentPlaceholder
|
||||
# Config $config
|
||||
# Placeholder $placeholder
|
||||
# Customcode $customcode
|
||||
# Extractor $extractor
|
||||
# \JDatabaseDriver $db
|
||||
+ __construct(?Config $config = null, ?Placeholder $placeholder = null, ...)
|
||||
# load() : void
|
||||
# getModuleIDs() : mixed
|
||||
# getModulePath($id) : mixed
|
||||
# getPluginIDs() : mixed
|
||||
# getPluginPath($id) : mixed
|
||||
}
|
||||
|
||||
note right of Paths::__construct
|
||||
Constructor.
|
||||
|
||||
since: 3.2.0
|
||||
|
||||
arguments:
|
||||
?Config $config = null
|
||||
?Placeholder $placeholder = null
|
||||
?ComponentPlaceholder $componentPlaceholder = null
|
||||
?Customcode $customcode = null
|
||||
?Extractor $extractor = null
|
||||
?\JDatabaseDriver $db = null
|
||||
end note
|
||||
|
||||
note right of Paths::load
|
||||
get the local installed path of this component
|
||||
|
||||
since: 3.2.0
|
||||
return: void
|
||||
end note
|
||||
|
||||
note right of Paths::getModuleIDs
|
||||
get the Joomla Modules IDs
|
||||
|
||||
since: 3.2.0
|
||||
return: mixed
|
||||
end note
|
||||
|
||||
note right of Paths::getModulePath
|
||||
get the Joomla module path
|
||||
|
||||
since: 3.2.0
|
||||
return: mixed
|
||||
end note
|
||||
|
||||
note right of Paths::getPluginIDs
|
||||
get the Joomla plugins IDs
|
||||
|
||||
since: 3.2.0
|
||||
return: mixed
|
||||
end note
|
||||
|
||||
note right of Paths::getPluginPath
|
||||
get the Joomla plugin path
|
||||
|
||||
return: mixed
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
420
src/053803e6-1251-4aed-aefe-46a8e84198d2/code.php
Normal file
420
src/053803e6-1251-4aed-aefe-46a8e84198d2/code.php
Normal file
@ -0,0 +1,420 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Compiler\Customcode\Extractor;
|
||||
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Filesystem\Folder;
|
||||
use VDM\Joomla\Utilities\ArrayHelper;
|
||||
use VDM\Joomla\Utilities\JsonHelper;
|
||||
use VDM\Joomla\Utilities\GetHelper;
|
||||
use VDM\Joomla\Utilities\String\ClassfunctionHelper;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Factory as Compiler;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Config;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Placeholder;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Component\Placeholder as ComponentPlaceholder;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Customcode;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Language\Extractor;
|
||||
|
||||
|
||||
/**
|
||||
* Compiler Custom Code Paths
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
class Paths
|
||||
{
|
||||
/**
|
||||
* The local paths
|
||||
*
|
||||
* @var array
|
||||
* @since 3.2.0
|
||||
**/
|
||||
public array $active = [];
|
||||
|
||||
/**
|
||||
* Compiler Component Placeholder
|
||||
*
|
||||
* @var array
|
||||
* @since 3.2.0
|
||||
**/
|
||||
protected array $componentPlaceholder;
|
||||
|
||||
/**
|
||||
* Compiler Config
|
||||
*
|
||||
* @var Config
|
||||
* @since 3.2.0
|
||||
**/
|
||||
protected Config $config;
|
||||
|
||||
/**
|
||||
* Compiler Placeholder
|
||||
*
|
||||
* @var Placeholder
|
||||
* @since 3.2.0
|
||||
**/
|
||||
protected Placeholder $placeholder;
|
||||
|
||||
/**
|
||||
* Compiler Customcode
|
||||
*
|
||||
* @var Customcode
|
||||
* @since 3.2.0
|
||||
**/
|
||||
protected Customcode $customcode;
|
||||
|
||||
/**
|
||||
* Compiler Language Extractor
|
||||
*
|
||||
* @var Extractor
|
||||
* @since 3.2.0
|
||||
**/
|
||||
protected Extractor $extractor;
|
||||
|
||||
/**
|
||||
* Database object to query local DB
|
||||
*
|
||||
* @var \JDatabaseDriver
|
||||
* @since 3.2.0
|
||||
**/
|
||||
protected \JDatabaseDriver $db;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param Config|null $config The compiler config object.
|
||||
* @param Placeholder|null $placeholder The compiler placeholder object.
|
||||
* @param ComponentPlaceholder|null $componentPlaceholder The compiler component placeholder object.
|
||||
* @param Customcode|null $customcode The compiler customcode object.
|
||||
* @param Extractor|null $extractor The compiler language extractor object.
|
||||
* @param \JDatabaseDriver|null $db The Database Driver object.
|
||||
*
|
||||
* @throws \Exception
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function __construct(?Config $config = null, ?Placeholder $placeholder = null,
|
||||
?ComponentPlaceholder $componentPlaceholder = null, ?Customcode $customcode = null,
|
||||
?Extractor $extractor = null, ?\JDatabaseDriver $db = null)
|
||||
{
|
||||
$this->config = $config ?: Compiler::_('Config');
|
||||
$this->placeholder = $placeholder ?: Compiler::_('Placeholder');
|
||||
/** @var ComponentPlaceholder $componentPlaceholder */
|
||||
$componentPlaceholder = $componentPlaceholder ?: Compiler::_('Component.Placeholder');
|
||||
$this->customcode = $customcode ?: Compiler::_('Customcode');
|
||||
$this->extractor = $extractor ?: Compiler::_('Language.Extractor');
|
||||
$this->db = $db ?: Factory::getDbo();
|
||||
|
||||
// load the placeholders to local array
|
||||
$this->componentPlaceholder = $componentPlaceholder->get();
|
||||
|
||||
// load the paths on initialization
|
||||
$this->load();
|
||||
}
|
||||
|
||||
/**
|
||||
* get the local installed path of this component
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function load()
|
||||
{
|
||||
// set the local paths to search
|
||||
$local_paths = [];
|
||||
|
||||
// admin path
|
||||
$local_paths['admin'] = JPATH_ADMINISTRATOR . '/components/com_'
|
||||
. $this->config->component_code_name;
|
||||
|
||||
// site path
|
||||
$local_paths['site'] = JPATH_ROOT . '/components/com_'
|
||||
. $this->config->component_code_name;
|
||||
|
||||
// media path
|
||||
$local_paths['media'] = JPATH_ROOT . '/media/com_'
|
||||
. $this->config->component_code_name;
|
||||
|
||||
// power path
|
||||
$local_paths['power'] = JPATH_ROOT . '/' . $this->config->get('jcb_powers_path', 'libraries/jcb_powers');
|
||||
|
||||
// lets also go over the REPOS - TODO
|
||||
|
||||
// Painful but we need to folder paths for the linked modules
|
||||
if (($module_ids = $this->getModuleIDs()) !== false)
|
||||
{
|
||||
foreach ($module_ids as $module_id)
|
||||
{
|
||||
// get the module folder path
|
||||
if (($path = $this->getModulePath($module_id)) !== false)
|
||||
{
|
||||
// set the path
|
||||
$local_paths['module_' . str_replace('/', '_', (string) $path)] = $path;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Painful but we need to folder paths for the linked plugins
|
||||
if (($plugin_ids = $this->getPluginIDs()) !== false)
|
||||
{
|
||||
foreach ($plugin_ids as $plugin_id)
|
||||
{
|
||||
// get the plugin group and folder name
|
||||
if (($path = $this->getPluginPath($plugin_id)) !== false)
|
||||
{
|
||||
// set the path
|
||||
$local_paths['plugin_' . str_replace('/', '_', (string) $path)] = JPATH_ROOT . '/plugins/' . $path;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// check if the local install is found
|
||||
foreach ($local_paths as $key => $localPath)
|
||||
{
|
||||
if (!Folder::exists($localPath))
|
||||
{
|
||||
unset($local_paths[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
if (ArrayHelper::check($local_paths))
|
||||
{
|
||||
$this->active = $local_paths;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* get the Joomla Modules IDs
|
||||
*
|
||||
* @return mixed of IDs on success
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function getModuleIDs()
|
||||
{
|
||||
if (($addjoomla_modules = GetHelper::var(
|
||||
'component_modules', $this->config->component_id, 'joomla_component',
|
||||
'addjoomla_modules'
|
||||
)) !== false)
|
||||
{
|
||||
$addjoomla_modules = (JsonHelper::check(
|
||||
$addjoomla_modules
|
||||
)) ? json_decode((string) $addjoomla_modules, true) : null;
|
||||
|
||||
if (ArrayHelper::check($addjoomla_modules))
|
||||
{
|
||||
$joomla_modules = array_filter(
|
||||
array_values($addjoomla_modules),
|
||||
// only load the modules whose target association call for it
|
||||
fn($array): bool => !isset($array['target']) || $array['target'] != 2
|
||||
);
|
||||
// if we have values we return IDs
|
||||
if (ArrayHelper::check($joomla_modules))
|
||||
{
|
||||
return array_map(
|
||||
fn($array) => (int) $array['module'], $joomla_modules
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* get the Joomla module path
|
||||
*
|
||||
* @return mixed of module path and target site area on success
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function getModulePath($id)
|
||||
{
|
||||
if (is_numeric($id) && $id > 0)
|
||||
{
|
||||
// Create a new query object.
|
||||
$query = $this->db->getQuery(true);
|
||||
|
||||
$query->select('a.*');
|
||||
$query->select(
|
||||
$this->db->quoteName(
|
||||
array(
|
||||
'a.name',
|
||||
'a.target'
|
||||
), array(
|
||||
'name',
|
||||
'target'
|
||||
)
|
||||
)
|
||||
);
|
||||
// from these tables
|
||||
$query->from('#__componentbuilder_joomla_module AS a');
|
||||
$query->where($this->db->quoteName('a.id') . ' = ' . (int) $id);
|
||||
$this->db->setQuery($query);
|
||||
$this->db->execute();
|
||||
if ($this->db->getNumRows())
|
||||
{
|
||||
// get the module data
|
||||
$module = $this->db->loadObject();
|
||||
// update the name if it has dynamic values
|
||||
$module->name = $this->placeholder->update(
|
||||
$this->customcode->update($module->name),
|
||||
$this->componentPlaceholder
|
||||
);
|
||||
|
||||
// set safe class function name
|
||||
$module->code_name
|
||||
= ClassfunctionHelper::safe(
|
||||
$module->name
|
||||
);
|
||||
// set module folder name
|
||||
$module->folder_name = 'mod_' . strtolower((string) $module->code_name);
|
||||
|
||||
// set the lang key
|
||||
$this->extractor->langKeys[strtoupper($module->folder_name)] =
|
||||
$module->id . '_M0dU|3';
|
||||
|
||||
// return the path
|
||||
if ($module->target == 2)
|
||||
{
|
||||
// administrator client area
|
||||
return JPATH_ADMINISTRATOR . '/modules/'
|
||||
. $module->folder_name;
|
||||
}
|
||||
else
|
||||
{
|
||||
// default is the site client area
|
||||
return JPATH_ROOT . '/modules/' . $module->folder_name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* get the Joomla plugins IDs
|
||||
*
|
||||
* @return mixed of IDs on success
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function getPluginIDs()
|
||||
{
|
||||
if (($addjoomla_plugins = GetHelper::var(
|
||||
'component_plugins', $this->config->component_id, 'joomla_component',
|
||||
'addjoomla_plugins'
|
||||
)) !== false)
|
||||
{
|
||||
$addjoomla_plugins = (JsonHelper::check(
|
||||
$addjoomla_plugins
|
||||
)) ? json_decode((string) $addjoomla_plugins, true) : null;
|
||||
|
||||
if (ArrayHelper::check($addjoomla_plugins))
|
||||
{
|
||||
$joomla_plugins = array_filter(
|
||||
array_values($addjoomla_plugins),
|
||||
function ($array) {
|
||||
// only load the plugins whose target association call for it
|
||||
if (!isset($array['target']) || $array['target'] != 2)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
);
|
||||
// if we have values we return IDs
|
||||
if (ArrayHelper::check($joomla_plugins))
|
||||
{
|
||||
return array_map(
|
||||
fn($array) => (int) $array['plugin'], $joomla_plugins
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* get the Joomla plugin path
|
||||
*
|
||||
* @return mixed of plugin path on success
|
||||
* @deprecated 3.3
|
||||
*/
|
||||
protected function getPluginPath($id)
|
||||
{
|
||||
if (is_numeric($id) && $id > 0)
|
||||
{
|
||||
// Create a new query object.
|
||||
$query = $this->db->getQuery(true);
|
||||
|
||||
$query->select('a.*');
|
||||
$query->select(
|
||||
$this->db->quoteName(
|
||||
array(
|
||||
'a.name',
|
||||
'g.name'
|
||||
), array(
|
||||
'name',
|
||||
'group'
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
// from these tables
|
||||
$query->from('#__componentbuilder_joomla_plugin AS a');
|
||||
$query->join(
|
||||
'LEFT', $this->db->quoteName(
|
||||
'#__componentbuilder_joomla_plugin_group', 'g'
|
||||
) . ' ON (' . $this->db->quoteName('a.joomla_plugin_group')
|
||||
. ' = ' . $this->db->quoteName('g.id') . ')'
|
||||
);
|
||||
$query->where($this->db->quoteName('a.id') . ' = ' . (int) $id);
|
||||
$this->db->setQuery($query);
|
||||
$this->db->execute();
|
||||
|
||||
if ($this->db->getNumRows())
|
||||
{
|
||||
// get the plugin data
|
||||
$plugin = $this->db->loadObject();
|
||||
|
||||
// update the name if it has dynamic values
|
||||
$plugin->name = $this->placeholder->update(
|
||||
$this->customcode->update($plugin->name),
|
||||
$this->componentPlaceholder
|
||||
);
|
||||
|
||||
// update the name if it has dynamic values
|
||||
$plugin->code_name
|
||||
= ClassfunctionHelper::safe(
|
||||
$plugin->name
|
||||
);
|
||||
|
||||
// set plugin folder name
|
||||
$plugin->group = strtolower((string) $plugin->group);
|
||||
// set plugin file name
|
||||
$plugin->file_name = strtolower((string) $plugin->code_name);
|
||||
|
||||
// set the lang key
|
||||
$this->extractor->langKeys['PLG_' . strtoupper(
|
||||
$plugin->group . '_' . $plugin->file_name
|
||||
)] = $plugin->id . '_P|uG!n';
|
||||
|
||||
// return the path
|
||||
return $plugin->group . '/' . $plugin->file_name;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
58
src/053803e6-1251-4aed-aefe-46a8e84198d2/settings.json
Normal file
58
src/053803e6-1251-4aed-aefe-46a8e84198d2/settings.json
Normal file
@ -0,0 +1,58 @@
|
||||
{
|
||||
"add_head": "1",
|
||||
"extends": "0",
|
||||
"extends_custom": "",
|
||||
"guid": "053803e6-1251-4aed-aefe-46a8e84198d2",
|
||||
"implements": null,
|
||||
"implements_custom": "",
|
||||
"load_selection": null,
|
||||
"name": "Paths",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "JCB.Compiler.Customcode.Extractor.Paths",
|
||||
"type": "class",
|
||||
"use_selection": {
|
||||
"use_selection0": {
|
||||
"use": "0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection1": {
|
||||
"use": "4b225c51-d293-48e4-b3f6-5136cf5c3f18",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection2": {
|
||||
"use": "db87c339-5bb6-4291-a7ef-2c48ea1b06bc",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection3": {
|
||||
"use": "30c5b4c2-f75f-4d15-869a-f8bfedd87358",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection4": {
|
||||
"use": "d910d8b8-4c23-4f3e-8cda-438f2d2bd7ac",
|
||||
"as": "Compiler"
|
||||
},
|
||||
"use_selection5": {
|
||||
"use": "fa4bf18e-301e-42e3-91fb-6e0096c07adc",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection6": {
|
||||
"use": "06453ada-e370-49f0-b262-e3f5a8ed0c2c",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection7": {
|
||||
"use": "aecc17ba-0b0f-4e5c-ae43-71be063a3dcb",
|
||||
"as": "ComponentPlaceholder"
|
||||
},
|
||||
"use_selection8": {
|
||||
"use": "313b43c4-98c3-4f62-9177-2d73ec8eba31",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection9": {
|
||||
"use": "d33b9278-c409-4aec-a047-b72f56712391",
|
||||
"as": "default"
|
||||
}
|
||||
},
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder.Compiler.Customcode.Extractor.Paths",
|
||||
"description": "Compiler Custom Code Paths\r\n\r\n@since 3.2.0",
|
||||
"head": "use Joomla\\CMS\\Factory;\r\nuse Joomla\\CMS\\Filesystem\\Folder;"
|
||||
}
|
68
src/05c49a1f-ba5b-4be1-b3d0-4a74c42f7a46/README.md
Normal file
68
src/05c49a1f-ba5b-4be1-b3d0-4a74c42f7a46/README.md
Normal file
@ -0,0 +1,68 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# class Data (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Compiler\Dynamicget**
|
||||
```uml
|
||||
@startuml
|
||||
class Data #Gold {
|
||||
# array $guiMapper
|
||||
# Config $config
|
||||
# Registry $registry
|
||||
# EventInterface $event
|
||||
# Customcode $customcode
|
||||
# Dispenser $dispenser
|
||||
# Gui $gui
|
||||
# Dynamicget $dynamic
|
||||
# \JDatabaseDriver $db
|
||||
+ __construct(?Config $config = null, ?Registry $registry = null, ...)
|
||||
+ get(array $ids, string $view_code, ...) : ?array
|
||||
}
|
||||
|
||||
note right of Data::__construct
|
||||
Constructor
|
||||
|
||||
since: 3.2.0
|
||||
|
||||
arguments:
|
||||
?Config $config = null
|
||||
?Registry $registry = null
|
||||
?EventInterface $event = null
|
||||
?Customcode $customcode = null
|
||||
?Dispenser $dispenser = null
|
||||
?Gui $gui = null
|
||||
?Dynamicget $dynamic = null
|
||||
?\JDatabaseDriver $db = null
|
||||
end note
|
||||
|
||||
note right of Data::get
|
||||
Get Dynamic Get Data
|
||||
|
||||
since: 3.2.0
|
||||
return: ?array
|
||||
|
||||
arguments:
|
||||
array $ids
|
||||
string $view_code
|
||||
string $context
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
324
src/05c49a1f-ba5b-4be1-b3d0-4a74c42f7a46/code.php
Normal file
324
src/05c49a1f-ba5b-4be1-b3d0-4a74c42f7a46/code.php
Normal file
@ -0,0 +1,324 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Compiler\Dynamicget;
|
||||
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Factory as Compiler;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Config;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Registry;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Interfaces\EventInterface;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Customcode;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Customcode\Dispenser;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Customcode\Gui;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Model\Dynamicget;
|
||||
use VDM\Joomla\Utilities\JsonHelper;
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
|
||||
|
||||
/**
|
||||
* Dynamic Get Data Class
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
class Data
|
||||
{
|
||||
/**
|
||||
* The gui mapper array
|
||||
*
|
||||
* @var array
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected array $guiMapper = [
|
||||
'table' => 'dynamic_get',
|
||||
'id' => null,
|
||||
'field' => null,
|
||||
'type' => 'php'
|
||||
];
|
||||
|
||||
/**
|
||||
* Compiler Config
|
||||
*
|
||||
* @var Config
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Config $config;
|
||||
|
||||
/**
|
||||
* The compiler registry
|
||||
*
|
||||
* @var Registry
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Registry $registry;
|
||||
|
||||
/**
|
||||
* Compiler Event
|
||||
*
|
||||
* @var EventInterface
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected EventInterface $event;
|
||||
|
||||
/**
|
||||
* Compiler Customcode
|
||||
*
|
||||
* @var Customcode
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Customcode $customcode;
|
||||
|
||||
/**
|
||||
* Compiler Customcode Dispenser
|
||||
*
|
||||
* @var Dispenser
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Dispenser $dispenser;
|
||||
|
||||
/**
|
||||
* Compiler Customcode in Gui
|
||||
*
|
||||
* @var Gui
|
||||
* @since 3.2.0
|
||||
**/
|
||||
protected Gui $gui;
|
||||
|
||||
/**
|
||||
* Compiler Dynamicget Model
|
||||
*
|
||||
* @var Dynamicget
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Dynamicget $dynamic;
|
||||
|
||||
/**
|
||||
* Database object to query local DB
|
||||
*
|
||||
* @var \JDatabaseDriver
|
||||
* @since 3.2.0
|
||||
**/
|
||||
protected \JDatabaseDriver $db;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param Config|null $config The compiler config object.
|
||||
* @param Registry|null $registry The compiler registry object.
|
||||
* @param EventInterface|null $event The compiler event api object.
|
||||
* @param Customcode|null $customcode The compiler customcode object.
|
||||
* @param Dispenser|null $dispenser The compiler customcode dispenser object.
|
||||
* @param Gui|null $gui The compiler customcode gui.
|
||||
* @param Dynamicget|null $dynamic The compiler dynamicget modeller object.
|
||||
* @param \JDatabaseDriver|null $db The database object.
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function __construct(?Config $config = null, ?Registry $registry = null,
|
||||
?EventInterface $event = null, ?Customcode $customcode = null,
|
||||
?Dispenser $dispenser = null, ?Gui $gui = null,
|
||||
?Dynamicget $dynamic = null, ?\JDatabaseDriver $db = null)
|
||||
{
|
||||
$this->config = $config ?: Compiler::_('Config');
|
||||
$this->registry = $registry ?: Compiler::_('Registry');
|
||||
$this->event = $event ?: Compiler::_('Event');
|
||||
$this->customcode = $customcode ?: Compiler::_('Customcode');
|
||||
$this->dispenser = $dispenser ?: Compiler::_('Customcode.Dispenser');
|
||||
$this->gui = $gui ?: Compiler::_('Customcode.Gui');
|
||||
$this->dynamic = $dynamic ?: Compiler::_('Model.Dynamicget');
|
||||
$this->db = $db ?: Factory::getDbo();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Dynamic Get Data
|
||||
*
|
||||
* @param array $ids The ids of the dynamic get
|
||||
* @param string $view_code The view code name
|
||||
* @param string $context The context for events
|
||||
*
|
||||
* @return array|null array of object/s on success
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function get(array $ids, string $view_code, string $context): ?array
|
||||
{
|
||||
if ($ids === [])
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
$ids = implode(',', $ids);
|
||||
|
||||
// for plugin event TODO change event api signatures
|
||||
$component_context = $this->config->component_context;
|
||||
|
||||
// Create a new query object.
|
||||
$query = $this->db->getQuery(true);
|
||||
$query->select('a.*');
|
||||
$query->from('#__componentbuilder_dynamic_get AS a');
|
||||
$query->where('a.id IN (' . $ids . ')');
|
||||
$this->db->setQuery($query);
|
||||
$this->db->execute();
|
||||
|
||||
if ($this->db->getNumRows())
|
||||
{
|
||||
$results = $this->db->loadObjectList();
|
||||
|
||||
foreach ($results as $_nr => &$result)
|
||||
{
|
||||
// Trigger Event: jcb_ce_onBeforeModelDynamicGetData
|
||||
$this->event->trigger(
|
||||
'jcb_ce_onBeforeModelDynamicGetData',
|
||||
array(&$component_context, &$result, &$result->id, &$view_code, &$context)
|
||||
);
|
||||
|
||||
// set GUI mapper id
|
||||
$this->guiMapper['id'] = (int) $result->id;
|
||||
|
||||
// add calculations if set
|
||||
if ($result->addcalculation == 1
|
||||
&& StringHelper::check(
|
||||
$result->php_calculation
|
||||
))
|
||||
{
|
||||
// set GUI mapper field
|
||||
$guiMapper['field'] = 'php_calculation';
|
||||
$result->php_calculation = $this->gui->set(
|
||||
$this->customcode->update(
|
||||
base64_decode((string) $result->php_calculation)
|
||||
),
|
||||
$this->guiMapper
|
||||
);
|
||||
}
|
||||
|
||||
// setup the router parse
|
||||
if (isset($result->add_php_router_parse)
|
||||
&& $result->add_php_router_parse == 1
|
||||
&& isset($result->php_router_parse)
|
||||
&& StringHelper::check(
|
||||
$result->php_router_parse
|
||||
))
|
||||
{
|
||||
// set GUI mapper field
|
||||
$this->guiMapper['field'] = 'php_router_parse';
|
||||
$result->php_router_parse = $this->gui->set(
|
||||
$this->customcode->update(
|
||||
base64_decode((string) $result->php_router_parse)
|
||||
),
|
||||
$this->guiMapper
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$result->add_php_router_parse = 0;
|
||||
}
|
||||
|
||||
// The array of the php scripts that should be added to the script builder
|
||||
$phpSripts = [
|
||||
'php_before_getitem',
|
||||
'php_after_getitem',
|
||||
'php_before_getitems',
|
||||
'php_after_getitems',
|
||||
'php_getlistquery'
|
||||
];
|
||||
|
||||
// load the php scripts
|
||||
foreach ($phpSripts as $script)
|
||||
{
|
||||
// add php script to the script builder
|
||||
if (isset($result->{'add_' . $script})
|
||||
&& $result->{'add_' . $script} == 1
|
||||
&& isset($result->{$script})
|
||||
&& StringHelper::check(
|
||||
$result->{$script}
|
||||
))
|
||||
{
|
||||
// move all main gets out to the custom script builder
|
||||
if ($result->gettype <= 2)
|
||||
{
|
||||
// set GUI mapper field
|
||||
$this->guiMapper['field'] = $script;
|
||||
$this->guiMapper['prefix'] = PHP_EOL . PHP_EOL;
|
||||
$this->dispenser->set(
|
||||
$result->{$script},
|
||||
$this->config->build_target . '_' . $script,
|
||||
$view_code,
|
||||
null,
|
||||
$this->guiMapper,
|
||||
true,
|
||||
true,
|
||||
true
|
||||
);
|
||||
unset($this->guiMapper['prefix']);
|
||||
// remove from local item
|
||||
unset($result->{$script});
|
||||
unset($result->{'add_' . $script});
|
||||
}
|
||||
else
|
||||
{
|
||||
// set GUI mapper field
|
||||
$this->guiMapper['field'] = $script;
|
||||
$this->guiMapper['prefix'] = PHP_EOL;
|
||||
// only for custom gets
|
||||
$result->{$script} = $this->gui->set(
|
||||
$this->customcode->update(
|
||||
base64_decode((string) $result->{$script})
|
||||
),
|
||||
$this->guiMapper
|
||||
);
|
||||
unset($this->guiMapper['prefix']);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// remove from local item
|
||||
unset($result->{$script});
|
||||
unset($result->{'add_' . $script});
|
||||
}
|
||||
}
|
||||
|
||||
// set the getmethod code name
|
||||
$result->key = StringHelper::safe(
|
||||
$view_code . ' ' . $result->name . ' ' . $result->id
|
||||
);
|
||||
|
||||
// set the dynamic get
|
||||
$this->dynamic->set($result, $view_code, $context);
|
||||
|
||||
// load the events if any is set
|
||||
if ($result->gettype == 1
|
||||
&& JsonHelper::check(
|
||||
$result->plugin_events
|
||||
))
|
||||
{
|
||||
$result->plugin_events = json_decode(
|
||||
(string) $result->plugin_events, true
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$result->plugin_events = '';
|
||||
}
|
||||
|
||||
// Trigger Event: jcb_ce_onAfterModelDynamicGetData
|
||||
$this->event->trigger(
|
||||
'jcb_ce_onAfterModelDynamicGetData',
|
||||
array(&$component_context, &$result, &$result->id, &$view_code, &$context)
|
||||
);
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
58
src/05c49a1f-ba5b-4be1-b3d0-4a74c42f7a46/settings.json
Normal file
58
src/05c49a1f-ba5b-4be1-b3d0-4a74c42f7a46/settings.json
Normal file
@ -0,0 +1,58 @@
|
||||
{
|
||||
"add_head": "1",
|
||||
"extends": "0",
|
||||
"extends_custom": "",
|
||||
"guid": "05c49a1f-ba5b-4be1-b3d0-4a74c42f7a46",
|
||||
"implements": null,
|
||||
"implements_custom": "",
|
||||
"load_selection": null,
|
||||
"name": "Data",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "JCB.Compiler.Dynamicget.Data",
|
||||
"type": "class",
|
||||
"use_selection": {
|
||||
"use_selection0": {
|
||||
"use": "d910d8b8-4c23-4f3e-8cda-438f2d2bd7ac",
|
||||
"as": "Compiler"
|
||||
},
|
||||
"use_selection1": {
|
||||
"use": "fa4bf18e-301e-42e3-91fb-6e0096c07adc",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection2": {
|
||||
"use": "e5d9804f-0eb0-4ee9-b406-ad4e8cdbc1f6",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection3": {
|
||||
"use": "20ed72b0-fcac-4344-aee1-8a65e3bf221d",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection4": {
|
||||
"use": "313b43c4-98c3-4f62-9177-2d73ec8eba31",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection5": {
|
||||
"use": "f1dc6430-fb54-452e-aa53-ce32ae93db88",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection6": {
|
||||
"use": "1bd48df2-4f7e-4581-9fe9-4b54e59105e3",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection7": {
|
||||
"use": "79740ee8-4d10-4b51-9ff5-18e1386ec1c6",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection8": {
|
||||
"use": "4b225c51-d293-48e4-b3f6-5136cf5c3f18",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection9": {
|
||||
"use": "1f28cb53-60d9-4db1-b517-3c7dc6b429ef",
|
||||
"as": "default"
|
||||
}
|
||||
},
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder.Compiler.Dynamicget.Data",
|
||||
"description": "Dynamic Get Data Class\r\n\r\n@since 3.2.0",
|
||||
"head": "use Joomla\\CMS\\Factory;"
|
||||
}
|
349
src/0601fee8-d51e-4af0-9ad3-b5f8700c4a45/README.md
Normal file
349
src/0601fee8-d51e-4af0-9ad3-b5f8700c4a45/README.md
Normal file
@ -0,0 +1,349 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# class Model (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Compiler\Service**
|
||||
```uml
|
||||
@startuml
|
||||
class Model #Gold {
|
||||
+ register(Container $container) : void
|
||||
+ getModelJoomlaplugins(Container $container) : Joomlaplugins
|
||||
+ getModelJoomlamodules(Container $container) : Joomlamodules
|
||||
+ getModelHistorycomponent(Container $container) : Historycomponent
|
||||
+ getModelCustomadminviews(Container $container) : Customadminviews
|
||||
+ getModelAjaxcustomview(Container $container) : Ajaxcustomview
|
||||
+ getModelJavascriptcustomview(Container $container) : Javascriptcustomview
|
||||
+ getModelCsscustomview(Container $container) : Csscustomview
|
||||
+ getModelPhpcustomview(Container $container) : Phpcustomview
|
||||
+ getModelDynamicget(Container $container) : Dynamicget
|
||||
+ getModelLibraries(Container $container) : Libraries
|
||||
+ getModelSiteviews(Container $container) : Siteviews
|
||||
+ getModelPermissions(Container $container) : Permissions
|
||||
+ getModelHistoryadminview(Container $container) : Historyadminview
|
||||
+ getModelMysqlsettings(Container $container) : Mysqlsettings
|
||||
+ getModelSql(Container $container) : Sql
|
||||
+ getModelCustomalias(Container $container) : Customalias
|
||||
+ getModelAjaxadmin(Container $container) : Ajaxadmin
|
||||
+ getModelCustomimportscripts(Container $container) : Customimportscripts
|
||||
+ getModelCustombuttons(Container $container) : Custombuttons
|
||||
+ getModelLoader(Container $container) : Loader
|
||||
+ getModelPhpadminview(Container $container) : Phpadminview
|
||||
+ getModelCssadminview(Container $container) : Cssadminview
|
||||
+ getModelJavascriptadminview(Container $container) : Javascriptadminview
|
||||
+ getModelLinkedviews(Container $container) : Linkedviews
|
||||
+ getModelRelations(Container $container) : Relations
|
||||
+ getModelConditions(Container $container) : Conditions
|
||||
+ getModelFields(Container $container) : Fields
|
||||
+ getModelUpdatesql(Container $container) : Updatesql
|
||||
+ getModelTabs(Container $container) : Tabs
|
||||
+ getModelCustomtabs(Container $container) : Customtabs
|
||||
+ getModelAdminviews(Container $container) : Adminviews
|
||||
+ getModelSqltweaking(Container $container) : Sqltweaking
|
||||
+ getModelSqldump(Container $container) : Sqldump
|
||||
+ getModelWhmcs(Container $container) : Whmcs
|
||||
+ getModifieddate(Container $container) : Modifieddate
|
||||
+ getCreatedate(Container $container) : Createdate
|
||||
+ getUpdateserver(Container $container) : Updateserver
|
||||
+ getModelFilesfolders(Container $container) : Filesfolders
|
||||
+ getServerLoad(Container $container) : ServerLoad
|
||||
}
|
||||
|
||||
note right of Model::register
|
||||
Registers the service provider with a DI container.
|
||||
|
||||
since: 3.2.0
|
||||
return: void
|
||||
end note
|
||||
|
||||
note left of Model::getModelJoomlaplugins
|
||||
Get the Joomla plugins Model
|
||||
|
||||
since: 3.2.0
|
||||
return: Joomlaplugins
|
||||
end note
|
||||
|
||||
note right of Model::getModelJoomlamodules
|
||||
Get the Joomla modules Model
|
||||
|
||||
since: 3.2.0
|
||||
return: Joomlamodules
|
||||
end note
|
||||
|
||||
note left of Model::getModelHistorycomponent
|
||||
Get the history component Model
|
||||
|
||||
since: 3.2.0
|
||||
return: Historycomponent
|
||||
end note
|
||||
|
||||
note right of Model::getModelCustomadminviews
|
||||
Get the custom admin views Model
|
||||
|
||||
since: 3.2.0
|
||||
return: Customadminviews
|
||||
end note
|
||||
|
||||
note left of Model::getModelAjaxcustomview
|
||||
Get the ajax custom view Model
|
||||
|
||||
since: 3.2.0
|
||||
return: Ajaxcustomview
|
||||
end note
|
||||
|
||||
note right of Model::getModelJavascriptcustomview
|
||||
Get the javascript custom view Model
|
||||
|
||||
since: 3.2.0
|
||||
return: Javascriptcustomview
|
||||
end note
|
||||
|
||||
note left of Model::getModelCsscustomview
|
||||
Get the css custom view Model
|
||||
|
||||
since: 3.2.0
|
||||
return: Csscustomview
|
||||
end note
|
||||
|
||||
note right of Model::getModelPhpcustomview
|
||||
Get the php custom view Model
|
||||
|
||||
since: 3.2.0
|
||||
return: Phpcustomview
|
||||
end note
|
||||
|
||||
note left of Model::getModelDynamicget
|
||||
Get the dynamic get Model
|
||||
|
||||
since: 3.2.0
|
||||
return: Dynamicget
|
||||
end note
|
||||
|
||||
note right of Model::getModelLibraries
|
||||
Get the libraries Model
|
||||
|
||||
since: 3.2.0
|
||||
return: Libraries
|
||||
end note
|
||||
|
||||
note left of Model::getModelSiteviews
|
||||
Get the site views Model
|
||||
|
||||
since: 3.2.0
|
||||
return: Siteviews
|
||||
end note
|
||||
|
||||
note right of Model::getModelPermissions
|
||||
Get the permissions Model
|
||||
|
||||
since: 3.2.0
|
||||
return: Permissions
|
||||
end note
|
||||
|
||||
note left of Model::getModelHistoryadminview
|
||||
Get the admin view history Model
|
||||
|
||||
since: 3.2.0
|
||||
return: Historyadminview
|
||||
end note
|
||||
|
||||
note right of Model::getModelMysqlsettings
|
||||
Get the MySQL settings Model
|
||||
|
||||
since: 3.2.0
|
||||
return: Mysqlsettings
|
||||
end note
|
||||
|
||||
note left of Model::getModelSql
|
||||
Get the Sql Model
|
||||
|
||||
since: 3.2.0
|
||||
return: Sql
|
||||
end note
|
||||
|
||||
note right of Model::getModelCustomalias
|
||||
Get the custom alias Model
|
||||
|
||||
since: 3.2.0
|
||||
return: Customalias
|
||||
end note
|
||||
|
||||
note left of Model::getModelAjaxadmin
|
||||
Get the Admin Ajax Model
|
||||
|
||||
since: 3.2.0
|
||||
return: Ajaxadmin
|
||||
end note
|
||||
|
||||
note right of Model::getModelCustomimportscripts
|
||||
Get the custom import scripts Model
|
||||
|
||||
since: 3.2.0
|
||||
return: Customimportscripts
|
||||
end note
|
||||
|
||||
note left of Model::getModelCustombuttons
|
||||
Get the custom import scripts Model
|
||||
|
||||
since: 3.2.0
|
||||
return: Custombuttons
|
||||
end note
|
||||
|
||||
note right of Model::getModelLoader
|
||||
Get the Model Auto Loader
|
||||
|
||||
since: 3.2.0
|
||||
return: Loader
|
||||
end note
|
||||
|
||||
note left of Model::getModelPhpadminview
|
||||
Get the php admin view Model
|
||||
|
||||
since: 3.2.0
|
||||
return: Phpadminview
|
||||
end note
|
||||
|
||||
note right of Model::getModelCssadminview
|
||||
Get the Css Adminview Model
|
||||
|
||||
since: 3.2.0
|
||||
return: Cssadminview
|
||||
end note
|
||||
|
||||
note left of Model::getModelJavascriptadminview
|
||||
Get the Javascript Adminview Model
|
||||
|
||||
since: 3.2.0
|
||||
return: Javascriptadminview
|
||||
end note
|
||||
|
||||
note right of Model::getModelLinkedviews
|
||||
Get the linked views Model
|
||||
|
||||
since: 3.2.0
|
||||
return: Linkedviews
|
||||
end note
|
||||
|
||||
note left of Model::getModelRelations
|
||||
Get the relations Model
|
||||
|
||||
since: 3.2.0
|
||||
return: Relations
|
||||
end note
|
||||
|
||||
note right of Model::getModelConditions
|
||||
Get the conditions Model
|
||||
|
||||
since: 3.2.0
|
||||
return: Conditions
|
||||
end note
|
||||
|
||||
note left of Model::getModelFields
|
||||
Get the fields Model
|
||||
|
||||
since: 3.2.0
|
||||
return: Fields
|
||||
end note
|
||||
|
||||
note right of Model::getModelUpdatesql
|
||||
Get the update sql Model
|
||||
|
||||
since: 3.2.0
|
||||
return: Updatesql
|
||||
end note
|
||||
|
||||
note left of Model::getModelTabs
|
||||
Get the tabs Model
|
||||
|
||||
since: 3.2.0
|
||||
return: Tabs
|
||||
end note
|
||||
|
||||
note right of Model::getModelCustomtabs
|
||||
Get the custom tabs Model
|
||||
|
||||
since: 3.2.0
|
||||
return: Customtabs
|
||||
end note
|
||||
|
||||
note left of Model::getModelAdminviews
|
||||
Get the admin views Model
|
||||
|
||||
since: 3.2.0
|
||||
return: Adminviews
|
||||
end note
|
||||
|
||||
note right of Model::getModelSqltweaking
|
||||
Get the SQL tweaking Model
|
||||
|
||||
since: 3.2.0
|
||||
return: Sqltweaking
|
||||
end note
|
||||
|
||||
note left of Model::getModelSqldump
|
||||
Get the SQL dump Model
|
||||
|
||||
since: 3.2.0
|
||||
return: Sqldump
|
||||
end note
|
||||
|
||||
note right of Model::getModelWhmcs
|
||||
Get the whmcs Model
|
||||
|
||||
since: 3.2.0
|
||||
return: Whmcs
|
||||
end note
|
||||
|
||||
note left of Model::getModifieddate
|
||||
Get the modified date Model
|
||||
|
||||
since: 3.2.0
|
||||
return: Modifieddate
|
||||
end note
|
||||
|
||||
note right of Model::getCreatedate
|
||||
Get the create date Model
|
||||
|
||||
since: 3.2.0
|
||||
return: Createdate
|
||||
end note
|
||||
|
||||
note left of Model::getUpdateserver
|
||||
Get the update server Model
|
||||
|
||||
since: 3.2.0
|
||||
return: Updateserver
|
||||
end note
|
||||
|
||||
note right of Model::getModelFilesfolders
|
||||
Get the files folders Model
|
||||
|
||||
since: 3.2.0
|
||||
return: Filesfolders
|
||||
end note
|
||||
|
||||
note left of Model::getServerLoad
|
||||
Get the Server Model Server Loader class
|
||||
|
||||
since: 3.2.0
|
||||
return: ServerLoad
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
808
src/0601fee8-d51e-4af0-9ad3-b5f8700c4a45/code.php
Normal file
808
src/0601fee8-d51e-4af0-9ad3-b5f8700c4a45/code.php
Normal file
@ -0,0 +1,808 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Compiler\Service;
|
||||
|
||||
|
||||
use Joomla\DI\Container;
|
||||
use Joomla\DI\ServiceProviderInterface;
|
||||
use VDM\Joomla\Componentbuilder\Server\Model\Load as ServerLoad;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Model\Joomlaplugins;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Model\Joomlamodules;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Model\Historycomponent;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Model\Customadminviews;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Model\Ajaxcustomview;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Model\Javascriptcustomview;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Model\Csscustomview;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Model\Phpcustomview;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Model\Dynamicget;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Model\Libraries;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Model\Siteviews;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Model\Permissions;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Model\Historyadminview;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Model\Mysqlsettings;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Model\Sql;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Model\Customalias;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Model\Ajaxadmin;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Model\Customimportscripts;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Model\Custombuttons;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Model\Loader;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Model\Phpadminview;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Model\Cssadminview;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Model\Javascriptadminview;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Model\Linkedviews;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Model\Relations;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Model\Conditions;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Model\Fields;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Model\Updatesql;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Model\Tabs;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Model\Customtabs;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Model\Adminviews;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Model\Sqltweaking;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Model\Sqldump;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Model\Whmcs;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Model\Filesfolders;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Model\Modifieddate;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Model\Createdate;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Model\Updateserver;
|
||||
|
||||
|
||||
/**
|
||||
* Model Service Provider
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
class Model implements ServiceProviderInterface
|
||||
{
|
||||
/**
|
||||
* Registers the service provider with a DI container.
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function register(Container $container)
|
||||
{
|
||||
$container->alias(Joomlaplugins::class, 'Model.Joomlaplugins')
|
||||
->share('Model.Joomlaplugins', [$this, 'getModelJoomlaplugins'], true);
|
||||
|
||||
$container->alias(Joomlamodules::class, 'Model.Joomlamodules')
|
||||
->share('Model.Joomlamodules', [$this, 'getModelJoomlamodules'], true);
|
||||
|
||||
$container->alias(Historycomponent::class, 'Model.Historycomponent')
|
||||
->share('Model.Historycomponent', [$this, 'getModelHistorycomponent'], true);
|
||||
|
||||
$container->alias(Customadminviews::class, 'Model.Customadminviews')
|
||||
->share('Model.Customadminviews', [$this, 'getModelCustomadminviews'], true);
|
||||
|
||||
$container->alias(Ajaxcustomview::class, 'Model.Ajaxcustomview')
|
||||
->share('Model.Ajaxcustomview', [$this, 'getModelAjaxcustomview'], true);
|
||||
|
||||
$container->alias(Javascriptcustomview::class, 'Model.Javascriptcustomview')
|
||||
->share('Model.Javascriptcustomview', [$this, 'getModelJavascriptcustomview'], true);
|
||||
|
||||
$container->alias(Csscustomview::class, 'Model.Csscustomview')
|
||||
->share('Model.Csscustomview', [$this, 'getModelCsscustomview'], true);
|
||||
|
||||
$container->alias(Phpcustomview::class, 'Model.Phpcustomview')
|
||||
->share('Model.Phpcustomview', [$this, 'getModelPhpcustomview'], true);
|
||||
|
||||
$container->alias(Dynamicget::class, 'Model.Dynamicget')
|
||||
->share('Model.Dynamicget', [$this, 'getModelDynamicget'], true);
|
||||
|
||||
$container->alias(Libraries::class, 'Model.Libraries')
|
||||
->share('Model.Libraries', [$this, 'getModelLibraries'], true);
|
||||
|
||||
$container->alias(Siteviews::class, 'Model.Siteviews')
|
||||
->share('Model.Siteviews', [$this, 'getModelSiteviews'], true);
|
||||
|
||||
$container->alias(Permissions::class, 'Model.Permissions')
|
||||
->share('Model.Permissions', [$this, 'getModelPermissions'], true);
|
||||
|
||||
$container->alias(Historyadminview::class, 'Model.Historyadminview')
|
||||
->share('Model.Historyadminview', [$this, 'getModelHistoryadminview'], true);
|
||||
|
||||
$container->alias(Mysqlsettings::class, 'Model.Mysqlsettings')
|
||||
->share('Model.Mysqlsettings', [$this, 'getModelMysqlsettings'], true);
|
||||
|
||||
$container->alias(Sql::class, 'Model.Sql')
|
||||
->share('Model.Sql', [$this, 'getModelSql'], true);
|
||||
|
||||
$container->alias(Customalias::class, 'Model.Customalias')
|
||||
->share('Model.Customalias', [$this, 'getModelCustomalias'], true);
|
||||
|
||||
$container->alias(Ajaxadmin::class, 'Model.Ajaxadmin')
|
||||
->share('Model.Ajaxadmin', [$this, 'getModelAjaxadmin'], true);
|
||||
|
||||
$container->alias(Customimportscripts::class, 'Model.Customimportscripts')
|
||||
->share('Model.Customimportscripts', [$this, 'getModelCustomimportscripts'], true);
|
||||
|
||||
$container->alias(Custombuttons::class, 'Model.Custombuttons')
|
||||
->share('Model.Custombuttons', [$this, 'getModelCustombuttons'], true);
|
||||
|
||||
$container->alias(Loader::class, 'Model.Loader')
|
||||
->share('Model.Loader', [$this, 'getModelLoader'], true);
|
||||
|
||||
$container->alias(Phpadminview::class, 'Model.Phpadminview')
|
||||
->share('Model.Phpadminview', [$this, 'getModelPhpadminview'], true);
|
||||
|
||||
$container->alias(Cssadminview::class, 'Model.Cssadminview')
|
||||
->share('Model.Cssadminview', [$this, 'getModelCssadminview'], true);
|
||||
|
||||
$container->alias(Javascriptadminview::class, 'Model.Javascriptadminview')
|
||||
->share('Model.Javascriptadminview', [$this, 'getModelJavascriptadminview'], true);
|
||||
|
||||
$container->alias(Linkedviews::class, 'Model.Linkedviews')
|
||||
->share('Model.Linkedviews', [$this, 'getModelLinkedviews'], true);
|
||||
|
||||
$container->alias(Relations::class, 'Model.Relations')
|
||||
->share('Model.Relations', [$this, 'getModelRelations'], true);
|
||||
|
||||
$container->alias(Conditions::class, 'Model.Conditions')
|
||||
->share('Model.Conditions', [$this, 'getModelConditions'], true);
|
||||
|
||||
$container->alias(Fields::class, 'Model.Fields')
|
||||
->share('Model.Fields', [$this, 'getModelFields'], true);
|
||||
|
||||
$container->alias(Updatesql::class, 'Model.Updatesql')
|
||||
->share('Model.Updatesql', [$this, 'getModelUpdatesql'], true);
|
||||
|
||||
$container->alias(Tabs::class, 'Model.Tabs')
|
||||
->share('Model.Tabs', [$this, 'getModelTabs'], true);
|
||||
|
||||
$container->alias(Customtabs::class, 'Model.Customtabs')
|
||||
->share('Model.Customtabs', [$this, 'getModelCustomtabs'], true);
|
||||
|
||||
$container->alias(Adminviews::class, 'Model.Adminviews')
|
||||
->share('Model.Adminviews', [$this, 'getModelAdminviews'], true);
|
||||
|
||||
$container->alias(Sqltweaking::class, 'Model.Sqltweaking')
|
||||
->share('Model.Sqltweaking', [$this, 'getModelSqltweaking'], true);
|
||||
|
||||
$container->alias(Sqldump::class, 'Model.Sqldump')
|
||||
->share('Model.Sqldump', [$this, 'getModelSqldump'], true);
|
||||
|
||||
$container->alias(Whmcs::class, 'Model.Whmcs')
|
||||
->share('Model.Whmcs', [$this, 'getModelWhmcs'], true);
|
||||
|
||||
$container->alias(Modifieddate::class, 'Model.Modifieddate')
|
||||
->share('Model.Modifieddate', [$this, 'getModifieddate'], true);
|
||||
|
||||
$container->alias(Createdate::class, 'Model.Createdate')
|
||||
->share('Model.Createdate', [$this, 'getCreatedate'], true);
|
||||
|
||||
$container->alias(Updateserver::class, 'Model.Updateserver')
|
||||
->share('Model.Updateserver', [$this, 'getUpdateserver'], true);
|
||||
|
||||
$container->alias(Filesfolders::class, 'Model.Filesfolders')
|
||||
->share('Model.Filesfolders', [$this, 'getModelFilesfolders'], true);
|
||||
|
||||
$container->alias(ServerLoad::class, 'Model.Server.Load')
|
||||
->share('Model.Server.Load', [$this, 'getServerLoad'], true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Joomla plugins Model
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Joomlaplugins
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getModelJoomlaplugins(Container $container): Joomlaplugins
|
||||
{
|
||||
return new Joomlaplugins(
|
||||
$container->get('Joomlaplugin.Data')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Joomla modules Model
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Joomlamodules
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getModelJoomlamodules(Container $container): Joomlamodules
|
||||
{
|
||||
return new Joomlamodules(
|
||||
$container->get('Joomlamodule.Data')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the history component Model
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Historycomponent
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getModelHistorycomponent(Container $container): Historycomponent
|
||||
{
|
||||
return new Historycomponent(
|
||||
$container->get('Config'),
|
||||
$container->get('History'),
|
||||
$container->get('Model.Updatesql')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the custom admin views Model
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Customadminviews
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getModelCustomadminviews(Container $container): Customadminviews
|
||||
{
|
||||
return new Customadminviews(
|
||||
$container->get('Customview.Data'),
|
||||
$container->get('Config')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the ajax custom view Model
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Ajaxcustomview
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getModelAjaxcustomview(Container $container): Ajaxcustomview
|
||||
{
|
||||
return new Ajaxcustomview(
|
||||
$container->get('Config'),
|
||||
$container->get('Customcode.Dispenser')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the javascript custom view Model
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Javascriptcustomview
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getModelJavascriptcustomview(Container $container): Javascriptcustomview
|
||||
{
|
||||
return new Javascriptcustomview(
|
||||
$container->get('Customcode'),
|
||||
$container->get('Customcode.Gui')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the css custom view Model
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Csscustomview
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getModelCsscustomview(Container $container): Csscustomview
|
||||
{
|
||||
return new Csscustomview(
|
||||
$container->get('Customcode')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the php custom view Model
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Phpcustomview
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getModelPhpcustomview(Container $container): Phpcustomview
|
||||
{
|
||||
return new Phpcustomview(
|
||||
$container->get('Customcode'),
|
||||
$container->get('Customcode.Gui'),
|
||||
$container->get('Model.Loader'),
|
||||
$container->get('Templatelayout.Data')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the dynamic get Model
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Dynamicget
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getModelDynamicget(Container $container): Dynamicget
|
||||
{
|
||||
return new Dynamicget(
|
||||
$container->get('Config'),
|
||||
$container->get('Registry'),
|
||||
$container->get('Customcode'),
|
||||
$container->get('Customcode.Gui'),
|
||||
$container->get('Placeholder'),
|
||||
$container->get('Dynamicget.Selection')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the libraries Model
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Libraries
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getModelLibraries(Container $container): Libraries
|
||||
{
|
||||
return new Libraries(
|
||||
$container->get('Config'),
|
||||
$container->get('Registry'),
|
||||
$container->get('Library.Data')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the site views Model
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Siteviews
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getModelSiteviews(Container $container): Siteviews
|
||||
{
|
||||
return new Siteviews(
|
||||
$container->get('Customview.Data'),
|
||||
$container->get('Config')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the permissions Model
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Permissions
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getModelPermissions(Container $container): Permissions
|
||||
{
|
||||
return new Permissions();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the admin view history Model
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Historyadminview
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getModelHistoryadminview(Container $container): Historyadminview
|
||||
{
|
||||
return new Historyadminview(
|
||||
$container->get('Config'),
|
||||
$container->get('History'),
|
||||
$container->get('Model.Updatesql')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the MySQL settings Model
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Mysqlsettings
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getModelMysqlsettings(Container $container): Mysqlsettings
|
||||
{
|
||||
return new Mysqlsettings(
|
||||
$container->get('Config'),
|
||||
$container->get('Registry')
|
||||
);
|
||||
}
|
||||
/**
|
||||
* Get the Sql Model
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Sql
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getModelSql(Container $container): Sql
|
||||
{
|
||||
return new Sql(
|
||||
$container->get('Customcode.Dispenser'),
|
||||
$container->get('Model.Sqldump')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the custom alias Model
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Customalias
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getModelCustomalias(Container $container): Customalias
|
||||
{
|
||||
return new Customalias(
|
||||
$container->get('Registry'),
|
||||
$container->get('Field.Name')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Admin Ajax Model
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Ajaxadmin
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getModelAjaxadmin(Container $container): Ajaxadmin
|
||||
{
|
||||
return new Ajaxadmin(
|
||||
$container->get('Config'),
|
||||
$container->get('Registry'),
|
||||
$container->get('Customcode.Dispenser')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the custom import scripts Model
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Customimportscripts
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getModelCustomimportscripts(Container $container): Customimportscripts
|
||||
{
|
||||
return new Customimportscripts(
|
||||
$container->get('Customcode.Dispenser')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the custom import scripts Model
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Custombuttons
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getModelCustombuttons(Container $container): Custombuttons
|
||||
{
|
||||
return new Custombuttons(
|
||||
$container->get('Customcode'),
|
||||
$container->get('Customcode.Gui'),
|
||||
$container->get('Templatelayout.Data')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Model Auto Loader
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Loader
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getModelLoader(Container $container): Loader
|
||||
{
|
||||
return new Loader(
|
||||
$container->get('Config'),
|
||||
$container->get('Registry')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the php admin view Model
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Phpadminview
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getModelPhpadminview(Container $container): Phpadminview
|
||||
{
|
||||
return new Phpadminview(
|
||||
$container->get('Customcode.Dispenser'),
|
||||
$container->get('Templatelayout.Data')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Css Adminview Model
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Cssadminview
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getModelCssadminview(Container $container): Cssadminview
|
||||
{
|
||||
return new Cssadminview(
|
||||
$container->get('Customcode.Dispenser')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Javascript Adminview Model
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Javascriptadminview
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getModelJavascriptadminview(Container $container): Javascriptadminview
|
||||
{
|
||||
return new Javascriptadminview(
|
||||
$container->get('Customcode.Dispenser')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the linked views Model
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Linkedviews
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getModelLinkedviews(Container $container): Linkedviews
|
||||
{
|
||||
return new Linkedviews(
|
||||
$container->get('Registry')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the relations Model
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Relations
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getModelRelations(Container $container): Relations
|
||||
{
|
||||
return new Relations(
|
||||
$container->get('Config'),
|
||||
$container->get('Registry'),
|
||||
$container->get('Language'),
|
||||
$container->get('Customcode')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the conditions Model
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Conditions
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getModelConditions(Container $container): Conditions
|
||||
{
|
||||
return new Conditions(
|
||||
$container->get('Field.Type.Name'),
|
||||
$container->get('Field.Name')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the fields Model
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Fields
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getModelFields(Container $container): Fields
|
||||
{
|
||||
return new Fields(
|
||||
$container->get('Config'),
|
||||
$container->get('Registry'),
|
||||
$container->get('History'),
|
||||
$container->get('Customcode'),
|
||||
$container->get('Field'),
|
||||
$container->get('Field.Name'),
|
||||
$container->get('Model.Updatesql')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the update sql Model
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Updatesql
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getModelUpdatesql(Container $container): Updatesql
|
||||
{
|
||||
return new Updatesql(
|
||||
$container->get('Registry')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the tabs Model
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Updatesql
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getModelTabs(Container $container): Tabs
|
||||
{
|
||||
return new Tabs();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the custom tabs Model
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Customtabs
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getModelCustomtabs(Container $container): Customtabs
|
||||
{
|
||||
return new Customtabs(
|
||||
$container->get('Config'),
|
||||
$container->get('Registry'),
|
||||
$container->get('Language'),
|
||||
$container->get('Placeholder'),
|
||||
$container->get('Customcode')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the admin views Model
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Adminviews
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getModelAdminviews(Container $container): Adminviews
|
||||
{
|
||||
return new Adminviews(
|
||||
$container->get('Adminview.Data'),
|
||||
$container->get('Registry'),
|
||||
$container->get('Config')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the SQL tweaking Model
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Sqltweaking
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getModelSqltweaking(Container $container): Sqltweaking
|
||||
{
|
||||
return new Sqltweaking(
|
||||
$container->get('Registry')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the SQL dump Model
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Sqldump
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getModelSqldump(Container $container): Sqldump
|
||||
{
|
||||
return new Sqldump(
|
||||
$container->get('Registry')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the whmcs Model
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Whmcs
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getModelWhmcs(Container $container): Whmcs
|
||||
{
|
||||
return new Whmcs();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the modified date Model
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Modifieddate
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getModifieddate(Container $container): Modifieddate
|
||||
{
|
||||
return new Modifieddate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the create date Model
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Createdate
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getCreatedate(Container $container): Createdate
|
||||
{
|
||||
return new Createdate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the update server Model
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Updateserver
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getUpdateserver(Container $container): Updateserver
|
||||
{
|
||||
return new Updateserver();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the files folders Model
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Filesfolders
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getModelFilesfolders(Container $container): Filesfolders
|
||||
{
|
||||
return new Filesfolders();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Server Model Server Loader class
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return ServerLoad
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getServerLoad(Container $container): ServerLoad
|
||||
{
|
||||
return new ServerLoad(
|
||||
$container->get('Crypt'),
|
||||
$container->get('Table')
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
175
src/0601fee8-d51e-4af0-9ad3-b5f8700c4a45/settings.json
Normal file
175
src/0601fee8-d51e-4af0-9ad3-b5f8700c4a45/settings.json
Normal file
@ -0,0 +1,175 @@
|
||||
{
|
||||
"add_head": "1",
|
||||
"extends": "0",
|
||||
"extends_custom": "Registry",
|
||||
"guid": "0601fee8-d51e-4af0-9ad3-b5f8700c4a45",
|
||||
"implements": [
|
||||
"-1"
|
||||
],
|
||||
"load_selection": null,
|
||||
"name": "Model",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "JCB.Compiler.Service.Model",
|
||||
"type": "class",
|
||||
"use_selection": {
|
||||
"use_selection0": {
|
||||
"use": "f37ee8b7-2909-4319-bdf8-769bd7635490",
|
||||
"as": "ServerLoad"
|
||||
},
|
||||
"use_selection1": {
|
||||
"use": "ef97b03e-1018-447a-8d7e-30401b0257bb",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection2": {
|
||||
"use": "bfdc4ce5-cb12-4fc6-9023-51cede25edd0",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection3": {
|
||||
"use": "17a728e9-d6cf-4060-9efb-241b0ff2f981",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection4": {
|
||||
"use": "e0e24173-a808-4dd5-8e26-de971d014f86",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection5": {
|
||||
"use": "592aed4e-2c5f-4fc5-8f7a-409203d1af82",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection6": {
|
||||
"use": "29455d3b-df2b-4e41-8684-1608060e37a4",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection7": {
|
||||
"use": "3283a89c-329a-47fb-a011-0df6c31a5c73",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection8": {
|
||||
"use": "489da602-27c7-418c-bf59-1d45ad42bdcc",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection9": {
|
||||
"use": "79740ee8-4d10-4b51-9ff5-18e1386ec1c6",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection10": {
|
||||
"use": "59895f37-50c8-4af3-9dad-230e18841953",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection11": {
|
||||
"use": "e0075978-315d-4807-8507-ce9c6922a885",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection12": {
|
||||
"use": "0dabc67c-abec-4541-82bf-279abd3c9be1",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection13": {
|
||||
"use": "6dfbf568-f3cd-4ea7-af04-6859447b5462",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection14": {
|
||||
"use": "35191b0c-f7f3-44d6-8ec1-c816b997bd4e",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection15": {
|
||||
"use": "d4b418a7-bf9b-4768-969d-e07c36916fd2",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection16": {
|
||||
"use": "5f8e8fa6-3793-44af-882d-9cfb209434e9",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection17": {
|
||||
"use": "4f575bd6-de97-41f8-80d6-259c8a6dd9ad",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection18": {
|
||||
"use": "037c7274-fb16-455d-989a-bf1da022620b",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection19": {
|
||||
"use": "ebe3287d-bfa0-4519-b663-f442f4dea432",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection20": {
|
||||
"use": "0d71c2d9-2fc0-4c20-82c5-43c46b0fc6f7",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection21": {
|
||||
"use": "c20a63e0-0eeb-4424-9d08-b1bf0f049dfe",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection22": {
|
||||
"use": "e79842d3-51b7-4282-93c7-3487cd8b61ab",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection23": {
|
||||
"use": "dfd3c893-0296-46eb-9ae4-a0348713cd8f",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection24": {
|
||||
"use": "ae1fa148-91be-4f80-89a9-69d91ba9d575",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection25": {
|
||||
"use": "a8eb2fb1-88ed-4af8-842d-898eb915b588",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection26": {
|
||||
"use": "55e61314-ba10-4e2b-92dd-b44adebabce9",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection27": {
|
||||
"use": "e6a64c41-405e-4bbc-9722-27402c22bbea",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection28": {
|
||||
"use": "b80296eb-4718-4ed3-894d-69f3ac293733",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection29": {
|
||||
"use": "143ac6ea-b64f-4331-9a97-31e3fce2bb69",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection30": {
|
||||
"use": "fa8c1125-d370-4cb6-a7ff-eb32193c198c",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection31": {
|
||||
"use": "cebdcccb-24c5-46db-92de-63453852dcb8",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection32": {
|
||||
"use": "e50cbac5-9c9d-4fd4-aa7a-5e830719ed26",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection33": {
|
||||
"use": "a6e1227c-1efe-407d-84ef-03c6989a6a88",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection34": {
|
||||
"use": "af5beb21-214a-44f6-9090-7ea24c22e649",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection35": {
|
||||
"use": "f4578c04-a81e-4218-b80d-b0612196eaf0",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection36": {
|
||||
"use": "9127e428-5dee-46cb-b3a9-ab5b91ea6df3",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection37": {
|
||||
"use": "53cf9828-7ad4-4856-aac1-7c4c67bd3121",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection38": {
|
||||
"use": "1d0fd857-12ec-4f47-ab1c-124d85748e24",
|
||||
"as": "default"
|
||||
}
|
||||
},
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder.Compiler.Service.Model",
|
||||
"description": "Model Service Provider\r\n\r\n@since 3.2.0",
|
||||
"head": "use Joomla\\DI\\Container;\r\nuse Joomla\\DI\\ServiceProviderInterface;"
|
||||
}
|
217
src/06453ada-e370-49f0-b262-e3f5a8ed0c2c/README.md
Normal file
217
src/06453ada-e370-49f0-b262-e3f5a8ed0c2c/README.md
Normal file
@ -0,0 +1,217 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# class Placeholder (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Compiler**
|
||||
```uml
|
||||
@startuml
|
||||
class Placeholder #Gold {
|
||||
+ array $active
|
||||
# Config $config
|
||||
+ __construct(?Config $config = null)
|
||||
+ set(string $key, mixed $value, ...) : void
|
||||
+ get(string $key) : mixed
|
||||
+ exist(string $key) : bool
|
||||
+ add(string $key, mixed $value, ...) : void
|
||||
+ remove(string $key) : void
|
||||
+ set_(string $key, mixed $value) : void
|
||||
+ get_(string $key) : mixed
|
||||
+ exist_(string $key) : bool
|
||||
+ add_(string $key, mixed $value) : void
|
||||
+ remove_(string $key) : void
|
||||
+ set_h(string $key, mixed $value) : void
|
||||
+ get_h(string $key) : mixed
|
||||
+ exist_h(string $key) : bool
|
||||
+ add_h(string $key, mixed $value) : void
|
||||
+ remove_h(string $key) : void
|
||||
+ setType(string $key, array $values) : void
|
||||
+ clearType(string $key) : void
|
||||
+ update(string $data, array $placeholder, ...) : string
|
||||
+ update_(string $data) : string
|
||||
+ keys(int $type, ?int $id = null) : array
|
||||
}
|
||||
|
||||
note right of Placeholder::__construct
|
||||
Constructor.
|
||||
|
||||
since: 3.2.0
|
||||
end note
|
||||
|
||||
note left of Placeholder::set
|
||||
Set content
|
||||
|
||||
since: 3.2.0
|
||||
return: void
|
||||
|
||||
arguments:
|
||||
string $key
|
||||
mixed $value
|
||||
bool $hash = true
|
||||
end note
|
||||
|
||||
note right of Placeholder::get
|
||||
Get content by key
|
||||
|
||||
since: 3.2.0
|
||||
return: mixed
|
||||
end note
|
||||
|
||||
note left of Placeholder::exist
|
||||
Does key exist at all in any variation
|
||||
|
||||
since: 3.2.0
|
||||
return: bool
|
||||
end note
|
||||
|
||||
note right of Placeholder::add
|
||||
Add content
|
||||
|
||||
since: 3.2.0
|
||||
return: void
|
||||
|
||||
arguments:
|
||||
string $key
|
||||
mixed $value
|
||||
bool $hash = true
|
||||
end note
|
||||
|
||||
note left of Placeholder::remove
|
||||
Remove content
|
||||
|
||||
since: 3.2.0
|
||||
return: void
|
||||
end note
|
||||
|
||||
note right of Placeholder::set_
|
||||
Set content with [ [ [ ... ] ] ] hash
|
||||
|
||||
since: 3.2.0
|
||||
return: void
|
||||
end note
|
||||
|
||||
note left of Placeholder::get_
|
||||
Get content with [ [ [ ... ] ] ] hash
|
||||
|
||||
since: 3.2.0
|
||||
return: mixed
|
||||
end note
|
||||
|
||||
note right of Placeholder::exist_
|
||||
Does key exist with [ [ [ ... ] ] ] hash
|
||||
|
||||
since: 3.2.0
|
||||
return: bool
|
||||
end note
|
||||
|
||||
note left of Placeholder::add_
|
||||
Add content with [ [ [ ... ] ] ] hash
|
||||
|
||||
since: 3.2.0
|
||||
return: void
|
||||
end note
|
||||
|
||||
note right of Placeholder::remove_
|
||||
Remove content with [ [ [ ... ] ] ] hash
|
||||
|
||||
since: 3.2.0
|
||||
return: void
|
||||
end note
|
||||
|
||||
note left of Placeholder::set_h
|
||||
Set content with # # # hash
|
||||
|
||||
since: 3.2.0
|
||||
return: void
|
||||
end note
|
||||
|
||||
note right of Placeholder::get_h
|
||||
Get content with # # # hash
|
||||
|
||||
since: 3.2.0
|
||||
return: mixed
|
||||
end note
|
||||
|
||||
note left of Placeholder::exist_h
|
||||
Does key exist with # # # hash
|
||||
|
||||
since: 3.2.0
|
||||
return: bool
|
||||
end note
|
||||
|
||||
note right of Placeholder::add_h
|
||||
Add content with # # # hash
|
||||
|
||||
since: 3.2.0
|
||||
return: void
|
||||
end note
|
||||
|
||||
note left of Placeholder::remove_h
|
||||
Remove content with # # # hash
|
||||
|
||||
since: 3.2.0
|
||||
return: void
|
||||
end note
|
||||
|
||||
note right of Placeholder::setType
|
||||
Set a type of placeholder with set of values
|
||||
|
||||
since: 3.2.0
|
||||
return: void
|
||||
end note
|
||||
|
||||
note left of Placeholder::clearType
|
||||
Remove a type of placeholder by main key
|
||||
|
||||
since: 3.2.0
|
||||
return: void
|
||||
end note
|
||||
|
||||
note right of Placeholder::update
|
||||
Update the data with the placeholders
|
||||
THE ACTION OPTIONS ARE
|
||||
1 -> Just replace (default)
|
||||
2 -> Check if data string has placeholders
|
||||
3 -> Remove placeholders not in data string
|
||||
|
||||
since: 3.2.0
|
||||
return: string
|
||||
|
||||
arguments:
|
||||
string $data
|
||||
array $placeholder
|
||||
int $action = 1
|
||||
end note
|
||||
|
||||
note left of Placeholder::update_
|
||||
Update the data with the active placeholders
|
||||
|
||||
since: 3.2.0
|
||||
return: string
|
||||
end note
|
||||
|
||||
note right of Placeholder::keys
|
||||
return the placeholders for inserted and replaced code
|
||||
|
||||
since: 3.2.0
|
||||
return: array
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
508
src/06453ada-e370-49f0-b262-e3f5a8ed0c2c/code.php
Normal file
508
src/06453ada-e370-49f0-b262-e3f5a8ed0c2c/code.php
Normal file
@ -0,0 +1,508 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Compiler;
|
||||
|
||||
|
||||
use VDM\Joomla\Utilities\ArrayHelper;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Factory as Compiler;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Config;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Placefix;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Interfaces\PlaceholderInterface;
|
||||
|
||||
|
||||
/**
|
||||
* Compiler Placeholder
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
class Placeholder implements PlaceholderInterface
|
||||
{
|
||||
/**
|
||||
* The active placeholders
|
||||
*
|
||||
* @var array
|
||||
* @since 3.2.0
|
||||
**/
|
||||
public array $active = [];
|
||||
|
||||
/**
|
||||
* Compiler Config
|
||||
*
|
||||
* @var Config
|
||||
* @since 3.2.0
|
||||
**/
|
||||
protected Config $config;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param Config|null $config The compiler config object.
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function __construct(?Config $config = null)
|
||||
{
|
||||
$this->config = $config ?: Compiler::_('Config');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set content
|
||||
*
|
||||
* @param string $key The main string key
|
||||
* @param mixed $value The values to set
|
||||
* @param bool $hash Add the hash around the key
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function set(string $key, $value, bool $hash = true)
|
||||
{
|
||||
if ($hash)
|
||||
{
|
||||
$this->set_($key, $value);
|
||||
$this->set_h($key, $value);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->active[$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get content by key
|
||||
*
|
||||
* @param string $key The main string key
|
||||
*
|
||||
* @return mixed
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function get(string $key)
|
||||
{
|
||||
return $this->active[$key] ?? $this->get_($key) ?? $this->get_h($key) ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Does key exist at all in any variation
|
||||
*
|
||||
* @param string $key The main string key
|
||||
*
|
||||
* @return bool
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function exist(string $key): bool
|
||||
{
|
||||
return isset($this->active[$key]) || $this->exist_($key) || $this->exist_h($key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add content
|
||||
*
|
||||
* @param string $key The main string key
|
||||
* @param mixed $value The values to set
|
||||
* @param bool $hash Add the hash around the key
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function add(string $key, $value, bool $hash = true)
|
||||
{
|
||||
if ($hash)
|
||||
{
|
||||
$this->add_($key, $value);
|
||||
$this->add_h($key, $value);
|
||||
}
|
||||
elseif (isset($this->active[$key]))
|
||||
{
|
||||
$this->active[$key] .= $value;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->active[$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove content
|
||||
*
|
||||
* @param string $key The main string key
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function remove(string $key)
|
||||
{
|
||||
if (isset($this->active[$key]))
|
||||
{
|
||||
unset($this->active[$key]);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->remove_($key);
|
||||
$this->remove_h($key);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set content with [ [ [ ... ] ] ] hash
|
||||
*
|
||||
* @param string $key The main string key
|
||||
* @param mixed $value The values to set
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function set_(string $key, $value)
|
||||
{
|
||||
$this->active[Placefix::_($key)] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get content with [ [ [ ... ] ] ] hash
|
||||
*
|
||||
* @param string $key The main string key
|
||||
*
|
||||
* @return mixed
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function get_(string $key)
|
||||
{
|
||||
return $this->active[Placefix::_($key)] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Does key exist with [ [ [ ... ] ] ] hash
|
||||
*
|
||||
* @param string $key The main string key
|
||||
*
|
||||
* @return bool
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function exist_(string $key): bool
|
||||
{
|
||||
return isset($this->active[Placefix::_($key)]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add content with [ [ [ ... ] ] ] hash
|
||||
*
|
||||
* @param string $key The main string key
|
||||
* @param mixed $value The values to set
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function add_(string $key, $value)
|
||||
{
|
||||
if (isset($this->active[Placefix::_($key)]))
|
||||
{
|
||||
$this->active[Placefix::_($key)] .= $value;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->active[Placefix::_($key)] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove content with [ [ [ ... ] ] ] hash
|
||||
*
|
||||
* @param string $key The main string key
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function remove_(string $key)
|
||||
{
|
||||
if ($this->exist_($key))
|
||||
{
|
||||
unset($this->active[Placefix::_($key)]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set content with # # # hash
|
||||
*
|
||||
* @param string $key The main string key
|
||||
* @param mixed $value The values to set
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function set_h(string $key, $value)
|
||||
{
|
||||
$this->active[Placefix::_h($key)] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get content with # # # hash
|
||||
*
|
||||
* @param string $key The main string key
|
||||
*
|
||||
* @return mixed
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function get_h(string $key)
|
||||
{
|
||||
return $this->active[Placefix::_h($key)] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Does key exist with # # # hash
|
||||
*
|
||||
* @param string $key The main string key
|
||||
*
|
||||
* @return bool
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function exist_h(string $key): bool
|
||||
{
|
||||
return isset($this->active[Placefix::_h($key)]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add content with # # # hash
|
||||
*
|
||||
* @param string $key The main string key
|
||||
* @param mixed $value The values to set
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function add_h(string $key, $value)
|
||||
{
|
||||
if ($this->exist_h($key))
|
||||
{
|
||||
$this->active[Placefix::_h($key)] .= $value;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->active[Placefix::_h($key)] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove content with # # # hash
|
||||
*
|
||||
* @param string $key The main string key
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function remove_h(string $key)
|
||||
{
|
||||
if ($this->exist_h($key))
|
||||
{
|
||||
unset($this->active[Placefix::_h($key)]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a type of placeholder with set of values
|
||||
*
|
||||
* @param string $key The main string for placeholder key
|
||||
* @param array $values The values to add
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function setType(string $key, array $values)
|
||||
{
|
||||
// always fist reset the type
|
||||
$this->clearType($key);
|
||||
|
||||
// only add if there are values
|
||||
if (ArrayHelper::check($values))
|
||||
{
|
||||
$number = 0;
|
||||
foreach ($values as $value)
|
||||
{
|
||||
$this->set($key . $number, $value);
|
||||
$number++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a type of placeholder by main key
|
||||
*
|
||||
* @param string $key The main string for placeholder key
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function clearType(string $key)
|
||||
{
|
||||
$keys = [Placefix::_($key), Placefix::_h($key), $key];
|
||||
|
||||
foreach ($keys as $_key)
|
||||
{
|
||||
$this->active = array_filter(
|
||||
$this->active,
|
||||
fn(string $k) => preg_replace('/\d/', '', $k) !== $_key,
|
||||
ARRAY_FILTER_USE_KEY
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the data with the placeholders
|
||||
*
|
||||
* @param string $data The actual data
|
||||
* @param array $placeholder The placeholders
|
||||
* @param int $action The action to use
|
||||
*
|
||||
* THE ACTION OPTIONS ARE
|
||||
* 1 -> Just replace (default)
|
||||
* 2 -> Check if data string has placeholders
|
||||
* 3 -> Remove placeholders not in data string
|
||||
*
|
||||
* @return string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function update(string $data, array $placeholder, int $action = 1): string
|
||||
{
|
||||
// make sure the placeholders is an array
|
||||
if (!ArrayHelper::check($placeholder))
|
||||
{
|
||||
return $data;
|
||||
}
|
||||
|
||||
// continue with the work of replacement
|
||||
if (1 == $action) // <-- just replace (default)
|
||||
{
|
||||
return str_replace(
|
||||
array_keys($placeholder), array_values($placeholder), $data
|
||||
);
|
||||
}
|
||||
elseif (2 == $action) // <-- check if data string has placeholders
|
||||
{
|
||||
$replace = false;
|
||||
foreach (array_keys($placeholder) as $key)
|
||||
{
|
||||
if (strpos($data, $key) !== false)
|
||||
{
|
||||
$replace = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// only replace if the data has these placeholder values
|
||||
if ($replace)
|
||||
{
|
||||
return str_replace(
|
||||
array_keys($placeholder), array_values($placeholder), $data
|
||||
);
|
||||
}
|
||||
}
|
||||
elseif (3 == $action) // <-- remove placeholders not in data string
|
||||
{
|
||||
$replace = $placeholder;
|
||||
foreach (array_keys($replace) as $key)
|
||||
{
|
||||
if (strpos($data, $key) === false)
|
||||
{
|
||||
unset($replace[$key]);
|
||||
}
|
||||
}
|
||||
// only replace if the data has these placeholder values
|
||||
if (ArrayHelper::check($replace))
|
||||
{
|
||||
return str_replace(
|
||||
array_keys($replace), array_values($replace), $data
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the data with the active placeholders
|
||||
*
|
||||
* @param string $data The actual data
|
||||
*
|
||||
* @return string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function update_(string $data): string
|
||||
{
|
||||
// just replace the placeholders in data
|
||||
return str_replace(
|
||||
array_keys($this->active), array_values($this->active), $data
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* return the placeholders for inserted and replaced code
|
||||
*
|
||||
* @param int $type The type of placement
|
||||
* @param int|null $id The code id in the system
|
||||
*
|
||||
* @return array with start and end keys
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function keys(int $type, ?int $id = null): array
|
||||
{
|
||||
switch ($type)
|
||||
{
|
||||
case 11:
|
||||
//***[REPLACED$$$$]***//**1**/
|
||||
if ($this->config->get('add_placeholders', false) === true)
|
||||
{
|
||||
return [
|
||||
'start' => '/***[REPLACED$$$$]***//**' . $id . '**/',
|
||||
'end' => '/***[/REPLACED$$$$]***/'
|
||||
];
|
||||
}
|
||||
break;
|
||||
case 12:
|
||||
//***[INSERTED$$$$]***//**1**/
|
||||
if ($this->config->get('add_placeholders', false) === true)
|
||||
{
|
||||
return [
|
||||
'start' => '/***[INSERTED$$$$]***//**' . $id . '**/',
|
||||
'end' => '/***[/INSERTED$$$$]***/'
|
||||
];
|
||||
}
|
||||
break;
|
||||
case 21:
|
||||
//<!--[REPLACED$$$$]--><!--1-->
|
||||
if ($this->config->get('add_placeholders', false) === true)
|
||||
{
|
||||
return [
|
||||
'start' => '<!--[REPLACED$$$$]--><!--' . $id . '-->',
|
||||
'end' => '<!--[/REPLACED$$$$]-->'
|
||||
];
|
||||
}
|
||||
break;
|
||||
case 22:
|
||||
//<!--[INSERTED$$$$]--><!--1-->
|
||||
if ($this->config->get('add_placeholders', false) === true)
|
||||
{
|
||||
return [
|
||||
'start' => '<!--[INSERTED$$$$]--><!--' . $id . '-->',
|
||||
'end' => '<!--[/INSERTED$$$$]-->'
|
||||
];
|
||||
}
|
||||
break;
|
||||
case 33:
|
||||
return ['start' => Placefix::h(), 'end' => Placefix::h()];
|
||||
break;
|
||||
case 66:
|
||||
return ['start' => Placefix::b(), 'end' => Placefix::d()];
|
||||
break;
|
||||
}
|
||||
|
||||
return [ 'start' => "", 'end' => ""];
|
||||
}
|
||||
|
||||
}
|
||||
|
35
src/06453ada-e370-49f0-b262-e3f5a8ed0c2c/settings.json
Normal file
35
src/06453ada-e370-49f0-b262-e3f5a8ed0c2c/settings.json
Normal file
@ -0,0 +1,35 @@
|
||||
{
|
||||
"add_head": "0",
|
||||
"extends": "0",
|
||||
"extends_custom": "",
|
||||
"guid": "06453ada-e370-49f0-b262-e3f5a8ed0c2c",
|
||||
"implements": [
|
||||
"a6cdd935-c038-4a54-8446-54bed87f003c"
|
||||
],
|
||||
"implements_custom": "",
|
||||
"load_selection": null,
|
||||
"name": "Placeholder",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "JCB.Compiler.Placeholder",
|
||||
"type": "class",
|
||||
"use_selection": {
|
||||
"use_selection0": {
|
||||
"use": "0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection1": {
|
||||
"use": "d910d8b8-4c23-4f3e-8cda-438f2d2bd7ac",
|
||||
"as": "Compiler"
|
||||
},
|
||||
"use_selection2": {
|
||||
"use": "fa4bf18e-301e-42e3-91fb-6e0096c07adc",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection3": {
|
||||
"use": "500f3a7f-c16d-4dd4-81b2-2df6776b5388",
|
||||
"as": "default"
|
||||
}
|
||||
},
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder.Compiler.Placeholder",
|
||||
"description": "Compiler Placeholder\r\n\r\n@since 3.2.0"
|
||||
}
|
82
src/071c7cff-4c88-4b80-bd99-066c572dcb71/README.md
Normal file
82
src/071c7cff-4c88-4b80-bd99-066c572dcb71/README.md
Normal file
@ -0,0 +1,82 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# class Structure (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Compiler\Joomlamodule**
|
||||
```uml
|
||||
@startuml
|
||||
class Structure #Gold {
|
||||
# Module $module
|
||||
# Component $component
|
||||
# Config $config
|
||||
# Registry $registry
|
||||
# Dispenser $dispenser
|
||||
# EventInterface $event
|
||||
# Counter $counter
|
||||
# Folder $folder
|
||||
# File $file
|
||||
# Files $files
|
||||
+ __construct(?Module $module = null, ?Component $component = null, ...)
|
||||
+ build() : void
|
||||
# getXML(object $module) : string
|
||||
# getCustomScriptField(array $fieldScriptBucket) : string
|
||||
}
|
||||
|
||||
note right of Structure::__construct
|
||||
Constructor
|
||||
|
||||
since: 3.2.0
|
||||
|
||||
arguments:
|
||||
?Module $module = null
|
||||
?Component $component = null
|
||||
?Config $config = null
|
||||
?Registry $registry = null
|
||||
?Dispenser $dispenser = null
|
||||
?EventInterface $event = null
|
||||
?Counter $counter = null
|
||||
?Folder $folder = null
|
||||
?File $file = null
|
||||
?Files $files = null
|
||||
end note
|
||||
|
||||
note right of Structure::build
|
||||
Build the Modules files, folders, url's and config
|
||||
|
||||
since: 3.2.0
|
||||
return: void
|
||||
end note
|
||||
|
||||
note right of Structure::getXML
|
||||
get the module xml template
|
||||
|
||||
since: 3.2.0
|
||||
return: string
|
||||
end note
|
||||
|
||||
note right of Structure::getCustomScriptField
|
||||
get the module admin custom script field
|
||||
|
||||
since: 3.2.0
|
||||
return: string
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
884
src/071c7cff-4c88-4b80-bd99-066c572dcb71/code.php
Normal file
884
src/071c7cff-4c88-4b80-bd99-066c572dcb71/code.php
Normal file
@ -0,0 +1,884 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Compiler\Joomlamodule;
|
||||
|
||||
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Factory as Compiler;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Joomlamodule\Data as Module;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Component;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Config;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Registry;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Customcode\Dispenser;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Interfaces\EventInterface;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Counter;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Folder;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\File;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Files;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Indent;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Placefix;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Line;
|
||||
use VDM\Joomla\Utilities\ArrayHelper;
|
||||
use VDM\Joomla\Utilities\ObjectHelper;
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
use VDM\Joomla\Utilities\FileHelper;
|
||||
|
||||
|
||||
/**
|
||||
* Joomla Module Structure Builder Class
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
class Structure
|
||||
{
|
||||
/**
|
||||
* Compiler Joomla Module Data Class
|
||||
*
|
||||
* @var Module
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Module $module;
|
||||
|
||||
/**
|
||||
* Compiler Component
|
||||
*
|
||||
* @var Component
|
||||
* @since 3.2.0
|
||||
**/
|
||||
protected Component $component;
|
||||
|
||||
/**
|
||||
* Compiler Config
|
||||
*
|
||||
* @var Config
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Config $config;
|
||||
|
||||
/**
|
||||
* The compiler registry
|
||||
*
|
||||
* @var Registry
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Registry $registry;
|
||||
|
||||
/**
|
||||
* Compiler Customcode Dispenser
|
||||
*
|
||||
* @var Dispenser
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Dispenser $dispenser;
|
||||
|
||||
/**
|
||||
* Compiler Event
|
||||
*
|
||||
* @var EventInterface
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected EventInterface $event;
|
||||
|
||||
/**
|
||||
* Compiler Counter
|
||||
*
|
||||
* @var Counter
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Counter $counter;
|
||||
|
||||
/**
|
||||
* Compiler Utilities Folder
|
||||
*
|
||||
* @var Folder
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Folder $folder;
|
||||
|
||||
/**
|
||||
* Compiler Utilities File
|
||||
*
|
||||
* @var File
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected File $file;
|
||||
|
||||
/**
|
||||
* Compiler Utilities Files
|
||||
*
|
||||
* @var Files
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Files $files;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param Module|null $module The compiler Joomla module data object.
|
||||
* @param Component|null $component The component class.
|
||||
* @param Config|null $config The compiler config object.
|
||||
* @param Registry|null $registry The compiler registry object.
|
||||
* @param Dispenser|null $dispenser The compiler customcode dispenser object.
|
||||
* @param EventInterface|null $event The compiler event api object.
|
||||
* @param Counter|null $counter The compiler counter object.
|
||||
* @param Folder|null $folder The compiler folder object.
|
||||
* @param File|null $file The compiler file object.
|
||||
* @param Files|null $files The compiler files object.
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function __construct(?Module $module = null, ?Component $component = null,
|
||||
?Config $config = null, ?Registry $registry = null,
|
||||
?Dispenser $dispenser = null, ?EventInterface $event = null,
|
||||
?Counter $counter = null, ?Folder $folder = null,
|
||||
?File $file = null, ?Files $files = null)
|
||||
{
|
||||
$this->module = $module ?: Compiler::_('Joomlamodule.Data');
|
||||
$this->component = $component ?: Compiler::_('Component');
|
||||
$this->config = $config ?: Compiler::_('Config');
|
||||
$this->registry = $registry ?: Compiler::_('Registry');
|
||||
$this->dispenser = $dispenser ?: Compiler::_('Customcode.Dispenser');
|
||||
$this->event = $event ?: Compiler::_('Event');
|
||||
$this->counter = $counter ?: Compiler::_('Utilities.Counter');
|
||||
$this->folder = $folder ?: Compiler::_('Utilities.Folder');
|
||||
$this->file = $file ?: Compiler::_('Utilities.File');
|
||||
$this->files = $files ?: Compiler::_('Utilities.Files');
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the Modules files, folders, url's and config
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function build()
|
||||
{
|
||||
if ($this->module->exists())
|
||||
{
|
||||
// for plugin event TODO change event api signatures
|
||||
$component_context = $this->config->component_context;
|
||||
$modules = $this->module->get();
|
||||
// Trigger Event: jcb_ce_onBeforeSetModules
|
||||
$this->event->trigger(
|
||||
'jcb_ce_onBeforeBuildModules',
|
||||
array(&$component_context, &$modules)
|
||||
);
|
||||
|
||||
foreach ($modules as $module)
|
||||
{
|
||||
if (ObjectHelper::check($module)
|
||||
&& isset($module->folder_name)
|
||||
&& StringHelper::check(
|
||||
$module->folder_name
|
||||
))
|
||||
{
|
||||
// module path
|
||||
$module->folder_path = $this->config->get('compiler_path', JPATH_COMPONENT_ADMINISTRATOR . '/compiler') . '/'
|
||||
. $module->folder_name;
|
||||
|
||||
// set the module paths
|
||||
$this->registry->set('dynamic_paths.' . $module->key, $module->folder_path);
|
||||
|
||||
// make sure there is no old build
|
||||
$this->folder->remove($module->folder_path);
|
||||
|
||||
// creat the main module folder
|
||||
$this->folder->create($module->folder_path);
|
||||
|
||||
// set main mod file
|
||||
$fileDetails = array('path' => $module->folder_path . '/'
|
||||
. $module->file_name . '.php',
|
||||
'name' => $module->file_name . '.php',
|
||||
'zip' => $module->file_name . '.php');
|
||||
$this->file->write(
|
||||
$fileDetails['path'],
|
||||
'<?php' . PHP_EOL . '// main modfile' .
|
||||
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('MODCODE')
|
||||
);
|
||||
$this->files->appendArray($module->key, $fileDetails);
|
||||
|
||||
// count the file created
|
||||
$this->counter->file++;
|
||||
|
||||
// set custom_get
|
||||
if ($module->custom_get)
|
||||
{
|
||||
$fileDetails = array(
|
||||
'path' => $module->folder_path . '/data.php',
|
||||
'name' => 'data.php',
|
||||
'zip' => 'data.php'
|
||||
);
|
||||
$this->file->write(
|
||||
$fileDetails['path'],
|
||||
'<?php' . PHP_EOL . '// get data file' .
|
||||
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 . PHP_EOL .
|
||||
'/**' . PHP_EOL .
|
||||
' * Module ' . $module->official_name . ' Data'
|
||||
. PHP_EOL .
|
||||
' */' . PHP_EOL .
|
||||
"class " . $module->class_data_name
|
||||
. ' extends \JObject' . PHP_EOL .
|
||||
"{" . Placefix::_h('DYNAMICGETS') . "}"
|
||||
. PHP_EOL
|
||||
);
|
||||
$this->files->appendArray($module->key, $fileDetails);
|
||||
|
||||
// count the file created
|
||||
$this->counter->file++;
|
||||
}
|
||||
|
||||
// set helper file
|
||||
if ($module->add_class_helper >= 1)
|
||||
{
|
||||
$fileDetails = array('path' => $module->folder_path
|
||||
. '/helper.php',
|
||||
'name' => 'helper.php',
|
||||
'zip' => 'helper.php');
|
||||
$this->file->write(
|
||||
$fileDetails['path'],
|
||||
'<?php' . PHP_EOL . '// helper file' .
|
||||
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('HELPERCODE')
|
||||
);
|
||||
$this->files->appendArray($module->key, $fileDetails);
|
||||
|
||||
// count the file created
|
||||
$this->counter->file++;
|
||||
}
|
||||
|
||||
// set main xml file
|
||||
$fileDetails = array('path' => $module->folder_path . '/'
|
||||
. $module->file_name . '.xml',
|
||||
'name' => $module->file_name . '.xml',
|
||||
'zip' => $module->file_name . '.xml');
|
||||
$this->file->write(
|
||||
$fileDetails['path'],
|
||||
$this->getXML($module)
|
||||
);
|
||||
$this->files->appendArray($module->key, $fileDetails);
|
||||
|
||||
// count the file created
|
||||
$this->counter->file++;
|
||||
|
||||
// set tmpl folder
|
||||
$this->folder->create($module->folder_path . '/tmpl');
|
||||
|
||||
// set default file
|
||||
$fileDetails = array('path' => $module->folder_path
|
||||
. '/tmpl/default.php',
|
||||
'name' => 'default.php',
|
||||
'zip' => 'tmpl/default.php');
|
||||
$this->file->write(
|
||||
$fileDetails['path'],
|
||||
'<?php' . PHP_EOL . '// default tmpl' .
|
||||
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('MODDEFAULT')
|
||||
);
|
||||
$this->files->appendArray($module->key, $fileDetails);
|
||||
|
||||
// count the file created
|
||||
$this->counter->file++;
|
||||
|
||||
// set install script if needed
|
||||
if ($module->add_install_script)
|
||||
{
|
||||
$fileDetails = [
|
||||
'path' => $module->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($module->key, $fileDetails);
|
||||
|
||||
// count the file created
|
||||
$this->counter->file++;
|
||||
}
|
||||
|
||||
// set readme if found
|
||||
if ($module->addreadme)
|
||||
{
|
||||
$fileDetails = [
|
||||
'path' => $module->folder_path . '/README.md',
|
||||
'name' => 'README.md',
|
||||
'zip' => 'README.md'
|
||||
];
|
||||
$this->file->write($fileDetails['path'], $module->readme);
|
||||
$this->files->appendArray($module->key, $fileDetails);
|
||||
|
||||
// count the file created
|
||||
$this->counter->file++;
|
||||
}
|
||||
|
||||
// set the folders target path
|
||||
$target_path = '';
|
||||
if ($module->target_client === 'administrator')
|
||||
{
|
||||
$target_path = '/administrator';
|
||||
}
|
||||
|
||||
// check if we have custom fields needed for scripts
|
||||
$module->add_scripts_field = false;
|
||||
$field_script_bucket = [];
|
||||
|
||||
// add any css from the fields
|
||||
if (($css = $this->dispenser->get(
|
||||
'css_view', $module->key
|
||||
)) !== null
|
||||
&& StringHelper::check($css))
|
||||
{
|
||||
// make sure this script does not have PHP
|
||||
if (strpos((string) $css, '<?php') === false)
|
||||
{
|
||||
// make sure the field is added
|
||||
$module->add_scripts_field = true;
|
||||
|
||||
// create the css folder
|
||||
$this->folder->create($module->folder_path . '/css');
|
||||
|
||||
// add the CSS file
|
||||
$fileDetails = [
|
||||
'path' => $module->folder_path . '/css/mod_admin.css',
|
||||
'name' => 'mod_admin.css',
|
||||
'zip' => 'mod_admin.css'
|
||||
];
|
||||
$this->file->write(
|
||||
$fileDetails['path'],
|
||||
Placefix::_h('BOM') . PHP_EOL
|
||||
. PHP_EOL . $css
|
||||
);
|
||||
$this->files->appendArray($module->key, $fileDetails);
|
||||
|
||||
// count the file created
|
||||
$this->counter->file++;
|
||||
|
||||
// add the field script
|
||||
$field_script_bucket[] = Indent::_(2) . "//"
|
||||
. Line::_(__Line__, __Class__) . " Custom CSS";
|
||||
$field_script_bucket[] = Indent::_(2)
|
||||
. "\$document->addStyleSheet('" . $target_path
|
||||
. "/modules/" . $module->folder_name
|
||||
. "/css/mod_admin.css', ['version' => 'auto', 'relative' => true]);";
|
||||
}
|
||||
}
|
||||
|
||||
// add any JavaScript from the fields
|
||||
if (($javascript = $this->dispenser->get(
|
||||
'view_footer', $module->key
|
||||
)) !== null
|
||||
&& StringHelper::check($javascript))
|
||||
{
|
||||
// make sure this script does not have PHP
|
||||
if (strpos((string) $javascript, '<?php') === false)
|
||||
{
|
||||
// make sure the field is added
|
||||
$module->add_scripts_field = true;
|
||||
|
||||
// add the JavaScript file
|
||||
$this->folder->create($module->folder_path . '/js');
|
||||
|
||||
// add the CSS file
|
||||
$fileDetails = [
|
||||
'path' => $module->folder_path . '/js/mod_admin.js',
|
||||
'name' => 'mod_admin.js',
|
||||
'zip' => 'mod_admin.js'
|
||||
];
|
||||
$this->file->write(
|
||||
$fileDetails['path'],
|
||||
Placefix::_h('BOM') . PHP_EOL
|
||||
. PHP_EOL . $javascript
|
||||
);
|
||||
$this->files->appendArray($module->key, $fileDetails);
|
||||
|
||||
// count the file created
|
||||
$this->counter->file++;
|
||||
|
||||
// add the field script
|
||||
$field_script_bucket[] = Indent::_(2) . "//"
|
||||
. Line::_(__Line__, __Class__) . " Custom JS";
|
||||
$field_script_bucket[] = Indent::_(2)
|
||||
. "\$document->addScript('" . $target_path
|
||||
. "/modules/" . $module->folder_name
|
||||
. "/js/mod_admin.js', ['version' => 'auto', 'relative' => true]);";
|
||||
}
|
||||
}
|
||||
|
||||
// set fields folders if needed
|
||||
if ($module->add_scripts_field
|
||||
|| (isset($module->fields_rules_paths)
|
||||
&& $module->fields_rules_paths == 2))
|
||||
{
|
||||
// create fields folder
|
||||
$this->folder->create($module->folder_path . '/fields');
|
||||
|
||||
// add the custom script field
|
||||
if ($module->add_scripts_field)
|
||||
{
|
||||
$fileDetails = [
|
||||
'path' => $module->folder_path
|
||||
. '/fields/modadminvvvvvvvdm.php',
|
||||
'name' => 'modadminvvvvvvvdm.php',
|
||||
'zip' => 'modadminvvvvvvvdm.php'
|
||||
];
|
||||
$this->file->write(
|
||||
$fileDetails['path'],
|
||||
$this->getCustomScriptField(
|
||||
$field_script_bucket
|
||||
)
|
||||
);
|
||||
$this->files->appendArray($module->key, $fileDetails);
|
||||
|
||||
// count the file created
|
||||
$this->counter->file++;
|
||||
}
|
||||
}
|
||||
|
||||
// set rules folders if needed
|
||||
if (isset($module->fields_rules_paths)
|
||||
&& $module->fields_rules_paths == 2)
|
||||
{
|
||||
// create rules folder
|
||||
$this->folder->create($module->folder_path . '/rules');
|
||||
}
|
||||
|
||||
// set forms folder if needed
|
||||
if (isset($module->form_files)
|
||||
&& ArrayHelper::check(
|
||||
$module->form_files
|
||||
))
|
||||
{
|
||||
// create forms folder
|
||||
$this->folder->create($module->folder_path . '/forms');
|
||||
|
||||
// set the template files
|
||||
foreach ($module->form_files as $file => $fields)
|
||||
{
|
||||
// set file details
|
||||
$fileDetails = [
|
||||
'path' => $module->folder_path . '/forms/' . $file . '.xml',
|
||||
'name' => $file . '.xml',
|
||||
'zip' => 'forms/' . $file . '.xml'
|
||||
];
|
||||
|
||||
// build basic XML
|
||||
$xml = '<?xml version="1.0" encoding="utf-8"?>';
|
||||
$xml .= PHP_EOL . '<!--' . Line::_(__Line__, __Class__)
|
||||
. ' default paths of ' . $file
|
||||
. ' form points to ' . $this->config->component_code_name
|
||||
. ' -->';
|
||||
|
||||
// search if we must add the component path
|
||||
$add_component_path = false;
|
||||
foreach ($fields as $field_name => $fieldsets)
|
||||
{
|
||||
if (!$add_component_path)
|
||||
{
|
||||
foreach ($fieldsets as $fieldset => $field)
|
||||
{
|
||||
if (!$add_component_path
|
||||
&& isset(
|
||||
$module->fieldsets_paths[$file
|
||||
. $field_name . $fieldset]
|
||||
)
|
||||
&& $module->fieldsets_paths[$file
|
||||
. $field_name . $fieldset] == 1)
|
||||
{
|
||||
$add_component_path = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// only add if part of the component field types path is required
|
||||
if ($add_component_path)
|
||||
{
|
||||
$xml .= PHP_EOL . '<form';
|
||||
$xml .= PHP_EOL . Indent::_(1)
|
||||
. 'addrulepath="/administrator/components/com_'
|
||||
. $this->config->component_code_name
|
||||
. '/models/rules"';
|
||||
$xml .= PHP_EOL . Indent::_(1)
|
||||
. 'addfieldpath="/administrator/components/com_'
|
||||
. $this->config->component_code_name
|
||||
. '/models/fields"';
|
||||
$xml .= PHP_EOL . '>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$xml .= PHP_EOL . '<form>';
|
||||
}
|
||||
|
||||
// add the fields
|
||||
foreach ($fields as $field_name => $fieldsets)
|
||||
{
|
||||
// check if we have an double fields naming set
|
||||
$field_name_inner = '';
|
||||
$field_name_outer = $field_name;
|
||||
if (strpos((string) $field_name, '.') !== false)
|
||||
{
|
||||
$field_names = explode('.', (string) $field_name);
|
||||
if (count((array) $field_names) == 2)
|
||||
{
|
||||
$field_name_outer = $field_names[0];
|
||||
$field_name_inner = $field_names[1];
|
||||
}
|
||||
}
|
||||
$xml .= PHP_EOL . Indent::_(1)
|
||||
. '<fields name="' . $field_name_outer
|
||||
. '">';
|
||||
foreach ($fieldsets as $fieldset => $field)
|
||||
{
|
||||
// default to the field set name
|
||||
$label = $fieldset;
|
||||
if (isset($module->fieldsets_label[$file . $field_name . $fieldset]))
|
||||
{
|
||||
$label = $module->fieldsets_label[$file . $field_name . $fieldset];
|
||||
}
|
||||
|
||||
// add path to module rules and custom fields
|
||||
if (isset($module->fieldsets_paths[$file . $field_name . $fieldset])
|
||||
&& ($module->fieldsets_paths[$file . $field_name . $fieldset] == 2
|
||||
|| $module->fieldsets_paths[$file . $field_name . $fieldset] == 3))
|
||||
{
|
||||
if ($module->target == 2)
|
||||
{
|
||||
if (!isset($module->add_rule_path[$file . $field_name . $fieldset]))
|
||||
{
|
||||
$module->add_rule_path[$file . $field_name . $fieldset] =
|
||||
'/administrator/modules/'
|
||||
. $module->file_name . '/rules';
|
||||
}
|
||||
|
||||
if (!isset($module->add_field_path[$file . $field_name . $fieldset]))
|
||||
{
|
||||
$module->add_field_path[$file . $field_name . $fieldset] =
|
||||
'/administrator/modules/'
|
||||
. $module->file_name . '/fields';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!isset($module->add_rule_path[$file . $field_name . $fieldset]))
|
||||
{
|
||||
$module->add_rule_path[$file . $field_name . $fieldset] =
|
||||
'/modules/' . $module->file_name
|
||||
. '/rules';
|
||||
}
|
||||
|
||||
if (!isset($module->add_field_path[$file . $field_name . $fieldset]))
|
||||
{
|
||||
$module->add_field_path[$file . $field_name . $fieldset] =
|
||||
'/modules/' . $module->file_name
|
||||
. '/fields';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// add path to module rules and custom fields
|
||||
if (isset($module->add_rule_path[$file . $field_name . $fieldset])
|
||||
|| isset($module->add_field_path[$file . $field_name . $fieldset]))
|
||||
{
|
||||
|
||||
$xml .= PHP_EOL . Indent::_(1) . '<!--'
|
||||
. Line::_(__Line__, __Class__) . ' default paths of '
|
||||
. $fieldset . ' fieldset points to the module -->';
|
||||
|
||||
$xml .= PHP_EOL . Indent::_(1) . '<fieldset name="'
|
||||
. $fieldset . '" label="' . $label . '"';
|
||||
|
||||
if (isset($module->add_rule_path[$file . $field_name . $fieldset]))
|
||||
{
|
||||
$xml .= PHP_EOL . Indent::_(2)
|
||||
. 'addrulepath="' . $module->add_rule_path[$file . $field_name . $fieldset] . '"';
|
||||
}
|
||||
|
||||
if (isset($module->add_field_path[$file . $field_name . $fieldset]))
|
||||
{
|
||||
$xml .= PHP_EOL . Indent::_(2)
|
||||
. 'addfieldpath="' . $module->add_field_path[$file . $field_name . $fieldset] . '"';
|
||||
}
|
||||
|
||||
$xml .= PHP_EOL . Indent::_(1) . '>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$xml .= PHP_EOL . Indent::_(1) . '<fieldset name="'
|
||||
. $fieldset . '" label="' . $label . '">';
|
||||
}
|
||||
|
||||
// check if we have an inner field set
|
||||
if (StringHelper::check(
|
||||
$field_name_inner
|
||||
))
|
||||
{
|
||||
$xml .= PHP_EOL . Indent::_(1)
|
||||
. '<fields name="'
|
||||
. $field_name_inner . '">';
|
||||
}
|
||||
|
||||
// add the placeholder of the fields
|
||||
$xml .= Placefix::_h('FIELDSET_' . $file
|
||||
. $field_name . $fieldset );
|
||||
|
||||
// check if we have an inner field set
|
||||
if (StringHelper::check(
|
||||
$field_name_inner
|
||||
))
|
||||
{
|
||||
$xml .= PHP_EOL . Indent::_(1)
|
||||
. '</fields>';
|
||||
}
|
||||
$xml .= PHP_EOL . Indent::_(1)
|
||||
. '</fieldset>';
|
||||
}
|
||||
$xml .= PHP_EOL . Indent::_(1) . '</fields>';
|
||||
}
|
||||
$xml .= PHP_EOL . '</form>';
|
||||
|
||||
// add xml to file
|
||||
$this->file->write($fileDetails['path'], $xml);
|
||||
$this->files->appendArray($module->key, $fileDetails);
|
||||
|
||||
// count the file created
|
||||
$this->counter->file++;
|
||||
}
|
||||
}
|
||||
|
||||
// set SQL stuff if needed
|
||||
if ($module->add_sql || $module->add_sql_uninstall)
|
||||
{
|
||||
// create SQL folder
|
||||
$this->folder->create($module->folder_path . '/sql');
|
||||
|
||||
// create mysql folder
|
||||
$this->folder->create(
|
||||
$module->folder_path . '/sql/mysql'
|
||||
);
|
||||
|
||||
// now set the install file
|
||||
if ($module->add_sql)
|
||||
{
|
||||
$this->file->write(
|
||||
$module->folder_path . '/sql/mysql/install.sql',
|
||||
$module->sql
|
||||
);
|
||||
|
||||
// count the file created
|
||||
$this->counter->file++;
|
||||
}
|
||||
|
||||
// now set the uninstall file
|
||||
if ($module->add_sql_uninstall)
|
||||
{
|
||||
$this->file->write(
|
||||
$module->folder_path
|
||||
. '/sql/mysql/uninstall.sql',
|
||||
$module->sql_uninstall
|
||||
);
|
||||
|
||||
// count the file created
|
||||
$this->counter->file++;
|
||||
}
|
||||
}
|
||||
|
||||
// creat the language folder
|
||||
$this->folder->create($module->folder_path . '/language');
|
||||
// also create the lang tag folder
|
||||
$this->folder->create(
|
||||
$module->folder_path . '/language/' . $this->config->get('lang_tag', 'en-GB')
|
||||
);
|
||||
|
||||
// check if this lib has files
|
||||
if (isset($module->files)
|
||||
&& ArrayHelper::check($module->files))
|
||||
{
|
||||
// add to component files
|
||||
foreach ($module->files as $file)
|
||||
{
|
||||
// set the pathfinder
|
||||
$file['target_type'] = $module->target_type;
|
||||
$file['target_id'] = $module->id;
|
||||
$this->component->appendArray('files', $file);
|
||||
}
|
||||
}
|
||||
|
||||
// check if this lib has folders
|
||||
if (isset($module->folders)
|
||||
&& ArrayHelper::check($module->folders))
|
||||
{
|
||||
// add to component folders
|
||||
foreach ($module->folders as $folder)
|
||||
{
|
||||
// set the pathfinder
|
||||
$folder['target_type'] = $module->target_type;
|
||||
$folder['target_id'] = $module->id;
|
||||
$this->component->appendArray('folders', $folder);
|
||||
}
|
||||
}
|
||||
|
||||
// check if this module has urls
|
||||
if (isset($module->urls)
|
||||
&& ArrayHelper::check($module->urls))
|
||||
{
|
||||
// add to component urls
|
||||
foreach ($module->urls as $n => &$url)
|
||||
{
|
||||
// should we add the local folder
|
||||
if (isset($url['type']) && $url['type'] > 1
|
||||
&& isset($url['url'])
|
||||
&& StringHelper::check(
|
||||
$url['url']
|
||||
))
|
||||
{
|
||||
// set file name
|
||||
$fileName = basename((string) $url['url']);
|
||||
|
||||
// get the file contents
|
||||
$data = FileHelper::getContent(
|
||||
$url['url']
|
||||
);
|
||||
|
||||
// build sub path
|
||||
if (strpos($fileName, '.js') !== false)
|
||||
{
|
||||
$path = '/js';
|
||||
}
|
||||
elseif (strpos($fileName, '.css') !== false)
|
||||
{
|
||||
$path = '/css';
|
||||
}
|
||||
else
|
||||
{
|
||||
$path = '';
|
||||
}
|
||||
|
||||
// create sub media path if not set
|
||||
$this->folder->create(
|
||||
$module->folder_path . $path
|
||||
);
|
||||
|
||||
// set the path to module file
|
||||
$url['path'] = $module->folder_path . $path
|
||||
. '/' . $fileName; // we need this for later
|
||||
|
||||
// write data to path
|
||||
$this->file->write($url['path'], $data);
|
||||
|
||||
// count the file created
|
||||
$this->counter->file++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* get the module xml template
|
||||
*
|
||||
* @param object $module The module object
|
||||
*
|
||||
* @return string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function getXML(object &$module): string
|
||||
{
|
||||
$xml = '<?xml version="1.0" encoding="utf-8"?>';
|
||||
$xml .= PHP_EOL . '<extension type="module" version="'
|
||||
. $this->config->joomla_versions[$this->config->joomla_version]['xml_version'] . '" client="'
|
||||
. $module->target_client . '" method="upgrade">';
|
||||
$xml .= PHP_EOL . Indent::_(1) . '<name>' . $module->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>' . $module->module_version
|
||||
. '</version>';
|
||||
$xml .= PHP_EOL . Indent::_(1) . '<description>' . $module->lang_prefix
|
||||
. '_XML_DESCRIPTION</description>';
|
||||
$xml .= Placefix::_h('MAINXML');
|
||||
$xml .= PHP_EOL . '</extension>';
|
||||
|
||||
return $xml;
|
||||
}
|
||||
|
||||
/**
|
||||
* get the module admin custom script field
|
||||
*
|
||||
* @param array $fieldScriptBucket The field
|
||||
*
|
||||
* @return string
|
||||
* @since 3.2.0
|
||||
*
|
||||
*/
|
||||
protected function getCustomScriptField(array $fieldScriptBucket): string
|
||||
{
|
||||
$form_field_class = [];
|
||||
$form_field_class[] = Placefix::_h('BOM') . PHP_EOL;
|
||||
$form_field_class[] = "//" . Line::_(__Line__, __Class__)
|
||||
. " No direct access to this file";
|
||||
$form_field_class[] = "defined('_JEXEC') or die('Restricted access');";
|
||||
$form_field_class[] = PHP_EOL . "use Joomla\CMS\Form\FormField;";
|
||||
$form_field_class[] = "use Joomla\CMS\Factory;";
|
||||
$form_field_class[] = PHP_EOL
|
||||
. "class JFormFieldModadminvvvvvvvdm extends FormField";
|
||||
$form_field_class[] = "{";
|
||||
$form_field_class[] = Indent::_(1)
|
||||
. "protected \$type = 'modadminvvvvvvvdm';";
|
||||
$form_field_class[] = PHP_EOL . Indent::_(1)
|
||||
. "protected function getLabel()";
|
||||
$form_field_class[] = Indent::_(1) . "{";
|
||||
$form_field_class[] = Indent::_(2) . "return;";
|
||||
$form_field_class[] = Indent::_(1) . "}";
|
||||
$form_field_class[] = PHP_EOL . Indent::_(1)
|
||||
. "protected function getInput()";
|
||||
$form_field_class[] = Indent::_(1) . "{";
|
||||
$form_field_class[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Get the document";
|
||||
$form_field_class[] = Indent::_(2)
|
||||
. "\$document = Factory::getDocument();";
|
||||
$form_field_class[] = implode(PHP_EOL, $fieldScriptBucket);
|
||||
$form_field_class[] = Indent::_(2) . "return; // noting for now :)";
|
||||
$form_field_class[] = Indent::_(1) . "}";
|
||||
$form_field_class[] = "}";
|
||||
|
||||
return implode(PHP_EOL, $form_field_class);
|
||||
}
|
||||
|
||||
}
|
||||
|
89
src/071c7cff-4c88-4b80-bd99-066c572dcb71/settings.json
Normal file
89
src/071c7cff-4c88-4b80-bd99-066c572dcb71/settings.json
Normal file
@ -0,0 +1,89 @@
|
||||
{
|
||||
"add_head": "0",
|
||||
"extends": "0",
|
||||
"extends_custom": "",
|
||||
"guid": "071c7cff-4c88-4b80-bd99-066c572dcb71",
|
||||
"implements": null,
|
||||
"implements_custom": "",
|
||||
"load_selection": null,
|
||||
"name": "Structure",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "JCB.Compiler.Joomlamodule.Structure",
|
||||
"type": "class",
|
||||
"use_selection": {
|
||||
"use_selection0": {
|
||||
"use": "d910d8b8-4c23-4f3e-8cda-438f2d2bd7ac",
|
||||
"as": "Compiler"
|
||||
},
|
||||
"use_selection1": {
|
||||
"use": "cb11e8d9-69c2-4095-831c-59908ea402e7",
|
||||
"as": "Module"
|
||||
},
|
||||
"use_selection2": {
|
||||
"use": "e2472b22-a329-44d8-b4a2-ae3ba99e17a0",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection3": {
|
||||
"use": "fa4bf18e-301e-42e3-91fb-6e0096c07adc",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection4": {
|
||||
"use": "e5d9804f-0eb0-4ee9-b406-ad4e8cdbc1f6",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection5": {
|
||||
"use": "f1dc6430-fb54-452e-aa53-ce32ae93db88",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection6": {
|
||||
"use": "20ed72b0-fcac-4344-aee1-8a65e3bf221d",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection7": {
|
||||
"use": "e6d871a6-bbe7-497d-af01-68f6bb9a87f4",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection8": {
|
||||
"use": "6bbb6ffe-3f09-4c21-aa9d-c93159afa1e1",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection9": {
|
||||
"use": "5c75b455-3d4c-452a-867e-e90424a64c88",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection10": {
|
||||
"use": "1d967151-7c20-4ca7-9400-65233cdcd4db",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection11": {
|
||||
"use": "a68c010b-e92e-47d5-8a44-d23cfddeb6c6",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection12": {
|
||||
"use": "500f3a7f-c16d-4dd4-81b2-2df6776b5388",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection13": {
|
||||
"use": "4e6ff11d-bebf-42f5-8fd7-b2f882857222",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection14": {
|
||||
"use": "0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection15": {
|
||||
"use": "91004529-94a9-4590-b842-e7c6b624ecf5",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection16": {
|
||||
"use": "1f28cb53-60d9-4db1-b517-3c7dc6b429ef",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection17": {
|
||||
"use": "a223b31e-ea1d-4cdf-92ae-5f9becffaff0",
|
||||
"as": "default"
|
||||
}
|
||||
},
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder.Compiler.Joomlamodule.Structure",
|
||||
"description": "Joomla Module Structure Builder Class\r\n\r\n@since 3.2.0"
|
||||
}
|
168
src/0d08c583-04d5-454e-b756-48ca05e1651a/README.md
Normal file
168
src/0d08c583-04d5-454e-b756-48ca05e1651a/README.md
Normal file
@ -0,0 +1,168 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# class Readme (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Compiler\Power\Repos**
|
||||
```uml
|
||||
@startuml
|
||||
class Readme #Gold {
|
||||
# Power $power
|
||||
# Plantuml $plantuml
|
||||
+ __construct(?Power $power = null, ?Plantuml $plantuml = null)
|
||||
+ get(array $powers) : string
|
||||
- readmeBuilder($powers) : string
|
||||
- readmeModel(array $classes) : string
|
||||
- generateIndex(array $classes) : string
|
||||
- generateDiagramBucket(array $classes) : string
|
||||
- defineTypeOrder() : array
|
||||
- sortClasses(array $classes, array $typeOrder) : void
|
||||
- compareNamespace(array $a, array $b) : int
|
||||
- compareType(array $a, array $b, ...) : int
|
||||
- compareName(array $a, array $b) : int
|
||||
- generateNamespaceDiagram(string $current_namespace, string $diagrams) : string
|
||||
- indexLinkPower(string $power) : string
|
||||
- linkPowerRepo(string $power) : string
|
||||
- linkPowerCode(string $power) : string
|
||||
- linkPowerSettings(string $power) : string
|
||||
- linkPowerGuid(string $power) : string
|
||||
}
|
||||
|
||||
note right of Readme::__construct
|
||||
Constructor.
|
||||
|
||||
since: 3.2.0
|
||||
end note
|
||||
|
||||
note left of Readme::get
|
||||
Get Super Power Readme
|
||||
|
||||
since: 3.2.0
|
||||
return: string
|
||||
end note
|
||||
|
||||
note right of Readme::readmeBuilder
|
||||
The readme builder
|
||||
|
||||
since: 3.2.0
|
||||
return: string
|
||||
end note
|
||||
|
||||
note left of Readme::readmeModel
|
||||
Sort and model the readme classes
|
||||
|
||||
since: 3.2.0
|
||||
return: string
|
||||
end note
|
||||
|
||||
note right of Readme::generateIndex
|
||||
Generate the index string for classes
|
||||
|
||||
return: string
|
||||
end note
|
||||
|
||||
note left of Readme::generateDiagramBucket
|
||||
Generate the diagram bucket string for classes
|
||||
|
||||
return: string
|
||||
end note
|
||||
|
||||
note right of Readme::defineTypeOrder
|
||||
Define the order of types for sorting purposes
|
||||
|
||||
since: 3.2.0
|
||||
return: array
|
||||
end note
|
||||
|
||||
note left of Readme::sortClasses
|
||||
Sort the flattened array using a single sorting function
|
||||
|
||||
since: 3.2.0
|
||||
return: void
|
||||
end note
|
||||
|
||||
note right of Readme::compareNamespace
|
||||
Compare the namespace of two classes
|
||||
|
||||
since: 3.2.0
|
||||
return: int
|
||||
end note
|
||||
|
||||
note left of Readme::compareType
|
||||
Compare the type of two classes
|
||||
|
||||
since: 3.2.0
|
||||
return: int
|
||||
|
||||
arguments:
|
||||
array $a
|
||||
array $b
|
||||
array $typeOrder
|
||||
end note
|
||||
|
||||
note right of Readme::compareName
|
||||
Compare the name of two classes
|
||||
|
||||
since: 3.2.0
|
||||
return: int
|
||||
end note
|
||||
|
||||
note left of Readme::generateNamespaceDiagram
|
||||
Generate a namespace diagram string
|
||||
|
||||
return: string
|
||||
end note
|
||||
|
||||
note right of Readme::indexLinkPower
|
||||
Build the Link to the power in this repository
|
||||
|
||||
since: 3.2.0
|
||||
return: string
|
||||
end note
|
||||
|
||||
note left of Readme::linkPowerRepo
|
||||
Build the Link to the power in this repository
|
||||
|
||||
since: 3.2.0
|
||||
return: string
|
||||
end note
|
||||
|
||||
note right of Readme::linkPowerCode
|
||||
Build the Link to the power settings in this repository
|
||||
|
||||
since: 3.2.0
|
||||
return: string
|
||||
end note
|
||||
|
||||
note left of Readme::linkPowerSettings
|
||||
Build the Link to the power settings in this repository
|
||||
|
||||
since: 3.2.0
|
||||
return: string
|
||||
end note
|
||||
|
||||
note right of Readme::linkPowerGuid
|
||||
Build the Link with GUID text to the power in this repository
|
||||
|
||||
since: 3.2.0
|
||||
return: string
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
407
src/0d08c583-04d5-454e-b756-48ca05e1651a/code.php
Normal file
407
src/0d08c583-04d5-454e-b756-48ca05e1651a/code.php
Normal file
@ -0,0 +1,407 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Compiler\Power\Repos;
|
||||
|
||||
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Factory as Compiler;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Power;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Power\Plantuml;
|
||||
|
||||
|
||||
/**
|
||||
* Compiler Power Repos Readme
|
||||
* @since 3.2.0
|
||||
*/
|
||||
class Readme
|
||||
{
|
||||
/**
|
||||
* Power Objects
|
||||
*
|
||||
* @var Power
|
||||
* @since 3.2.0
|
||||
**/
|
||||
protected Power $power;
|
||||
|
||||
/**
|
||||
* Compiler Powers Plantuml Builder
|
||||
*
|
||||
* @var Plantuml
|
||||
* @since 3.2.0
|
||||
**/
|
||||
protected Plantuml $plantuml;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param Power|null $power The power object.
|
||||
* @param Plantuml|null $plantuml The powers plantuml builder object.
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function __construct(?Power $power = null, ?Plantuml $plantuml = null)
|
||||
{
|
||||
$this->power = $power ?: Compiler::_('Power');
|
||||
$this->plantuml = $plantuml ?: Compiler::_('Power.Plantuml');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Super Power Readme
|
||||
*
|
||||
* @param array $powers All powers of this super power.
|
||||
*
|
||||
* @return string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function get(array $powers): string
|
||||
{
|
||||
// build readme
|
||||
$readme = ["```
|
||||
███████╗██╗ ██╗██████╗ ███████╗██████╗
|
||||
██╔════╝██║ ██║██╔══██╗██╔════╝██╔══██╗
|
||||
███████╗██║ ██║██████╔╝█████╗ ██████╔╝
|
||||
╚════██║██║ ██║██╔═══╝ ██╔══╝ ██╔══██╗
|
||||
███████║╚██████╔╝██║ ███████╗██║ ██║
|
||||
╚══════╝ ╚═════╝ ╚═╝ ╚══════╝╚═╝ ╚═╝
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗ ███████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗██╔════╝
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝███████╗
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗╚════██║
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║███████║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝╚══════╝
|
||||
```"];
|
||||
|
||||
// default description of super powers
|
||||
$readme[] = "\n### What is JCB Super Powers?\nThe Joomla Component Builder (JCB) Super Power features are designed to enhance JCB's functionality and streamline the development process. These Super Powers enable developers to efficiently manage and share their custom powers across multiple JCB instances through repositories hosted on [https://git.vdm.dev/[username]/[repository-name]](https://git.vdm.dev). JCB Super Powers are managed using a combination of layers, events, tasks, methods, switches, and algorithms, which work together to provide powerful customization and extensibility options. More details on JCB Super Powers can be found in the [Super Powers Documentation](https://git.vdm.dev/joomla/super-powers/wiki).\n\nIn summary, JCB Super Powers offer a flexible and efficient way to manage and share functionalities between JCB instances. By utilizing a sophisticated system of layers, events, tasks, methods, switches, and algorithms, developers can seamlessly integrate JCB core powers and their custom powers. For more information on how to work with JCB Super Powers, refer to the [Super Powers User Guide](https://git.vdm.dev/joomla/super-powers/wiki).\n\n### What can I find here?\nThis repository contains an index (see below) of all the approved powers within the JCB GUI. During the compilation of a component, these powers are automatically added to the repository, ensuring a well-organized and accessible collection of functionalities.\n";
|
||||
|
||||
// get the readme body
|
||||
$readme[] = $this->readmeBuilder($powers);
|
||||
|
||||
// yes you can remove this, but why?
|
||||
$readme[] = "\n---\n```
|
||||
██╗ ██████╗ ██████╗ ███╗ ███╗██╗ █████╗
|
||||
██║██╔═══██╗██╔═══██╗████╗ ████║██║ ██╔══██╗
|
||||
██║██║ ██║██║ ██║██╔████╔██║██║ ███████║
|
||||
██ ██║██║ ██║██║ ██║██║╚██╔╝██║██║ ██╔══██║
|
||||
╚█████╔╝╚██████╔╝╚██████╔╝██║ ╚═╝ ██║███████╗██║ ██║
|
||||
╚════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
||||
██████╗ ██████╗ ███╗ ███╗██████╗ ██████╗ ███╗ ██╗███████╗███╗ ██╗████████╗
|
||||
██╔════╝██╔═══██╗████╗ ████║██╔══██╗██╔═══██╗████╗ ██║██╔════╝████╗ ██║╚══██╔══╝
|
||||
██║ ██║ ██║██╔████╔██║██████╔╝██║ ██║██╔██╗ ██║█████╗ ██╔██╗ ██║ ██║
|
||||
██║ ██║ ██║██║╚██╔╝██║██╔═══╝ ██║ ██║██║╚██╗██║██╔══╝ ██║╚██╗██║ ██║
|
||||
╚██████╗╚██████╔╝██║ ╚═╝ ██║██║ ╚██████╔╝██║ ╚████║███████╗██║ ╚████║ ██║
|
||||
╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═════╝ ╚═╝ ╚═══╝╚══════╝╚═╝ ╚═══╝ ╚═╝
|
||||
██████╗ ██╗ ██╗██╗██╗ ██████╗ ███████╗██████╗
|
||||
██╔══██╗██║ ██║██║██║ ██╔══██╗██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║██║ ██║ ██║█████╗ ██████╔╝
|
||||
██╔══██╗██║ ██║██║██║ ██║ ██║██╔══╝ ██╔══██╗
|
||||
██████╔╝╚██████╔╝██║███████╗██████╔╝███████╗██║ ██║
|
||||
╚═════╝ ╚═════╝ ╚═╝╚══════╝╚═════╝ ╚══════╝╚═╝ ╚═╝
|
||||
```\n> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)\n\n";
|
||||
|
||||
return implode("\n", $readme);
|
||||
}
|
||||
|
||||
/**
|
||||
* The readme builder
|
||||
*
|
||||
* @param array $classes The powers.
|
||||
*
|
||||
* @return string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
private function readmeBuilder(array &$powers): string
|
||||
{
|
||||
$classes = [];
|
||||
foreach ($powers as $guid => $power)
|
||||
{
|
||||
$power_object = $this->power->get($guid);
|
||||
if (is_array($power_object->parsed_class_code))
|
||||
{
|
||||
// add to the sort bucket
|
||||
$classes[] = [
|
||||
'namespace' => $power['namespace'],
|
||||
'type' => $power['type'],
|
||||
'name' => $power['name'],
|
||||
'link' => $this->indexLinkPower($power),
|
||||
'diagram' => $this->plantuml->classBasicDiagram($power, $power_object->parsed_class_code)
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
return $this->readmeModel($classes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort and model the readme classes
|
||||
*
|
||||
* @param array $classes The powers.
|
||||
*
|
||||
* @return string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
private function readmeModel(array &$classes): string
|
||||
{
|
||||
$this->sortClasses($classes, $this->defineTypeOrder());
|
||||
|
||||
$result = $this->generateIndex($classes);
|
||||
|
||||
$diagram_bucket = $this->generateDiagramBucket($classes);
|
||||
|
||||
return $result . $diagram_bucket;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the index string for classes
|
||||
*
|
||||
* @param array $classes The sorted classes
|
||||
*
|
||||
* @return string The index string
|
||||
*/
|
||||
private function generateIndex(array &$classes): string
|
||||
{
|
||||
$result = "# Index of powers\n";
|
||||
$current_namespace = null;
|
||||
|
||||
foreach ($classes as $class)
|
||||
{
|
||||
if ($class['namespace'] !== $current_namespace)
|
||||
{
|
||||
$current_namespace = $class['namespace'];
|
||||
$result .= "\n- **Namespace**: [{$current_namespace}](#" .
|
||||
strtolower(str_replace('\\', '-', $current_namespace)) . ")\n";
|
||||
}
|
||||
|
||||
// Add the class details
|
||||
$result .= "\n - " . $class['link'];
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the diagram bucket string for classes
|
||||
*
|
||||
* @param array $classes The sorted classes
|
||||
*
|
||||
* @return string The diagram bucket string
|
||||
*/
|
||||
private function generateDiagramBucket(array &$classes): string
|
||||
{
|
||||
$diagram_bucket = "\n\n# Class Diagrams\n";
|
||||
$current_namespace = null;
|
||||
$diagrams = '';
|
||||
|
||||
foreach ($classes as $class)
|
||||
{
|
||||
if ($class['namespace'] !== $current_namespace)
|
||||
{
|
||||
if ($current_namespace !== null)
|
||||
{
|
||||
$diagram_bucket .= $this->generateNamespaceDiagram($current_namespace, $diagrams);
|
||||
}
|
||||
$current_namespace = $class['namespace'];
|
||||
$diagrams = '';
|
||||
}
|
||||
|
||||
$diagrams .= $class['diagram'];
|
||||
}
|
||||
|
||||
// Add the last namespace diagram
|
||||
$diagram_bucket .= $this->generateNamespaceDiagram($current_namespace, $diagrams);
|
||||
|
||||
return $diagram_bucket;
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the order of types for sorting purposes
|
||||
*
|
||||
* @return array The order of types
|
||||
* @since 3.2.0
|
||||
*/
|
||||
private function defineTypeOrder(): array
|
||||
{
|
||||
return [
|
||||
'interface' => 1,
|
||||
'abstract' => 2,
|
||||
'final' => 3,
|
||||
'class' => 4,
|
||||
'trait' => 5
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort the flattened array using a single sorting function
|
||||
*
|
||||
* @param array $classes The classes to sort
|
||||
* @param array $typeOrder The order of types
|
||||
* @since 3.2.0
|
||||
*/
|
||||
private function sortClasses(array &$classes, array $typeOrder): void
|
||||
{
|
||||
usort($classes, function ($a, $b) use ($typeOrder) {
|
||||
$namespaceDiff = $this->compareNamespace($a, $b);
|
||||
|
||||
if ($namespaceDiff !== 0)
|
||||
{
|
||||
return $namespaceDiff;
|
||||
}
|
||||
|
||||
$typeDiff = $this->compareType($a, $b, $typeOrder);
|
||||
|
||||
if ($typeDiff !== 0)
|
||||
{
|
||||
return $typeDiff;
|
||||
}
|
||||
|
||||
return $this->compareName($a, $b);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare the namespace of two classes
|
||||
*
|
||||
* @param array $a First class
|
||||
* @param array $b Second class
|
||||
*
|
||||
* @return int Comparison result
|
||||
* @since 3.2.0
|
||||
*/
|
||||
private function compareNamespace(array $a, array $b): int
|
||||
{
|
||||
$namespaceDepthDiff = substr_count($a['namespace'], '\\') - substr_count($b['namespace'], '\\');
|
||||
|
||||
if ($namespaceDepthDiff === 0)
|
||||
{
|
||||
return strcmp($a['namespace'], $b['namespace']);
|
||||
}
|
||||
|
||||
return $namespaceDepthDiff;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare the type of two classes
|
||||
*
|
||||
* @param array $a First class
|
||||
* @param array $b Second class
|
||||
* @param array $typeOrder The order of types
|
||||
*
|
||||
* @return int Comparison result
|
||||
* @since 3.2.0
|
||||
*/
|
||||
private function compareType(array $a, array $b, array $typeOrder): int
|
||||
{
|
||||
return $typeOrder[$a['type']] - $typeOrder[$b['type']];
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare the name of two classes
|
||||
*
|
||||
* @param array $a First class
|
||||
* @param array $b Second class
|
||||
*
|
||||
* @return int Comparison result
|
||||
* @since 3.2.0
|
||||
*/
|
||||
private function compareName(array $a, array $b): int
|
||||
{
|
||||
return strcmp($a['name'], $b['name']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a namespace diagram string
|
||||
*
|
||||
* @param string $current_namespace The current namespace
|
||||
* @param string $diagrams The diagrams for the namespace
|
||||
*
|
||||
* @return string The namespace diagram string
|
||||
*/
|
||||
private function generateNamespaceDiagram(string $current_namespace, string $diagrams): string
|
||||
{
|
||||
$namespace_title = str_replace('\\', ' ', $current_namespace);
|
||||
$diagram_code = "\n## {$namespace_title}\n> namespace {$current_namespace}\n";
|
||||
$diagram_code .= "```uml\n@startuml\n\n" .
|
||||
$this->plantuml->namespaceDiagram($current_namespace, $diagrams) . "\n\n@enduml\n```\n";
|
||||
|
||||
return $diagram_code;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the Link to the power in this repository
|
||||
*
|
||||
* @param string $power The power details.
|
||||
*
|
||||
* @return string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
private function indexLinkPower(array &$power): string
|
||||
{
|
||||
return '**' . $power['type'] . ' ' . $power['name'] . "** | "
|
||||
. $this->linkPowerRepo($power) . ' | '
|
||||
. $this->linkPowerCode($power) . ' | '
|
||||
. $this->linkPowerSettings($power) . ' | '
|
||||
. $this->linkPowerGuid($power);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the Link to the power in this repository
|
||||
*
|
||||
* @param string $power The power details.
|
||||
*
|
||||
* @return string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
private function linkPowerRepo(array &$power): string
|
||||
{
|
||||
return '[Details](' . $power['path'] . ')';
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the Link to the power settings in this repository
|
||||
*
|
||||
* @param string $power The power details.
|
||||
*
|
||||
* @return string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
private function linkPowerCode(array &$power): string
|
||||
{
|
||||
return '[Code](' . $power['code'] . ')';
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the Link to the power settings in this repository
|
||||
*
|
||||
* @param string $power The power details.
|
||||
*
|
||||
* @return string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
private function linkPowerSettings(array &$power): string
|
||||
{
|
||||
return '[Settings](' . $power['settings'] . ')';
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the Link with GUID text to the power in this repository
|
||||
*
|
||||
* @param string $power The power details.
|
||||
*
|
||||
* @return string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
private function linkPowerGuid(array &$power): string
|
||||
{
|
||||
return '[' . $power['guid'] . '](' . $power['path'] . ')';
|
||||
}
|
||||
|
||||
}
|
||||
|
29
src/0d08c583-04d5-454e-b756-48ca05e1651a/settings.json
Normal file
29
src/0d08c583-04d5-454e-b756-48ca05e1651a/settings.json
Normal file
@ -0,0 +1,29 @@
|
||||
{
|
||||
"add_head": "0",
|
||||
"extends": "0",
|
||||
"extends_custom": "",
|
||||
"guid": "0d08c583-04d5-454e-b756-48ca05e1651a",
|
||||
"implements": null,
|
||||
"implements_custom": "",
|
||||
"load_selection": null,
|
||||
"name": "Readme",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "JCB.Compiler.Power.Repos.Readme",
|
||||
"type": "class",
|
||||
"use_selection": {
|
||||
"use_selection0": {
|
||||
"use": "d910d8b8-4c23-4f3e-8cda-438f2d2bd7ac",
|
||||
"as": "Compiler"
|
||||
},
|
||||
"use_selection1": {
|
||||
"use": "b836c1b1-b6b1-44f7-b8a2-9a763a4185b1",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection2": {
|
||||
"use": "ff5e9e63-86d0-4691-ab59-d4b9d9154096",
|
||||
"as": "default"
|
||||
}
|
||||
},
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder.Compiler.Power.Repos.Readme",
|
||||
"description": "Compiler Power Repos Readme\r\n@since 3.2.0"
|
||||
}
|
83
src/0d71c2d9-2fc0-4c20-82c5-43c46b0fc6f7/README.md
Normal file
83
src/0d71c2d9-2fc0-4c20-82c5-43c46b0fc6f7/README.md
Normal file
@ -0,0 +1,83 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# class Loader (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Compiler\Model**
|
||||
```uml
|
||||
@startuml
|
||||
class Loader #Gold {
|
||||
# Config $config
|
||||
# Registry $registry
|
||||
+ __construct(?Config $config = null, ?Registry $registry = null)
|
||||
+ set(string $key, string $content, ...) : void
|
||||
+ uikit(string $key, string $content) : void
|
||||
# getFootableScripts(string $content) : bool
|
||||
# getGetModule(string $content) : bool
|
||||
# getGoogleChart(string $content) : bool
|
||||
}
|
||||
|
||||
note right of Loader::__construct
|
||||
Constructor
|
||||
|
||||
since: 3.2.0
|
||||
end note
|
||||
|
||||
note right of Loader::set
|
||||
Automatically load some stuff
|
||||
|
||||
since: 3.2.0
|
||||
return: void
|
||||
|
||||
arguments:
|
||||
string $key
|
||||
string $content
|
||||
?string $target = null
|
||||
end note
|
||||
|
||||
note right of Loader::uikit
|
||||
Automatically load uikit version 2 data files
|
||||
|
||||
since: 3.2.0
|
||||
return: void
|
||||
end note
|
||||
|
||||
note right of Loader::getFootableScripts
|
||||
Check for footable scripts
|
||||
|
||||
since: 3.2.0
|
||||
return: bool
|
||||
end note
|
||||
|
||||
note right of Loader::getGetModule
|
||||
Check for getModules script
|
||||
|
||||
since: 3.2.0
|
||||
return: bool
|
||||
end note
|
||||
|
||||
note right of Loader::getGoogleChart
|
||||
Check for get Google Chart script
|
||||
|
||||
since: 3.2.0
|
||||
return: bool
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
185
src/0d71c2d9-2fc0-4c20-82c5-43c46b0fc6f7/code.php
Normal file
185
src/0d71c2d9-2fc0-4c20-82c5-43c46b0fc6f7/code.php
Normal file
@ -0,0 +1,185 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Compiler\Model;
|
||||
|
||||
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Factory as Compiler;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Config;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Registry;
|
||||
use VDM\Joomla\Utilities\Component\Helper;
|
||||
|
||||
|
||||
/**
|
||||
* Model Auto Loader Class
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
class Loader
|
||||
{
|
||||
/**
|
||||
* Compiler Config
|
||||
*
|
||||
* @var Config
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Config $config;
|
||||
|
||||
/**
|
||||
* The compiler registry
|
||||
*
|
||||
* @var Registry
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Registry $registry;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param Config|null $config The compiler config object.
|
||||
* @param Registry|null $registry The compiler registry object.
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function __construct(?Config $config = null, ?Registry $registry = null)
|
||||
{
|
||||
$this->config = $config ?: Compiler::_('Config');
|
||||
$this->registry = $registry ?: Compiler::_('Registry');
|
||||
}
|
||||
|
||||
/**
|
||||
* Automatically load some stuff
|
||||
*
|
||||
* @param string $key The key mapper
|
||||
* @param string $content The content to search through
|
||||
* @param string|null $target The area being targeted
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function set(string $key, string $content, ?string $target = null)
|
||||
{
|
||||
// set the target
|
||||
$target = $target ?: $this->config->build_target;
|
||||
|
||||
// check for footable
|
||||
if (!$this->registry->
|
||||
exists('builder.footable_scripts.' . $target . '.' . $key))
|
||||
{
|
||||
if ($this->getFootableScripts($content))
|
||||
{
|
||||
$this->registry->
|
||||
set('builder.footable_scripts.' . $target . '.' . $key, true);
|
||||
|
||||
$this->config->set('footable', true);
|
||||
}
|
||||
}
|
||||
|
||||
// check for google chart
|
||||
if (!$this->registry->
|
||||
exists('builder.google_chart.' . $target . '.' . $key))
|
||||
{
|
||||
if ($this->getGoogleChart($content))
|
||||
{
|
||||
$this->registry->
|
||||
set('builder.google_chart.' . $target . '.' . $key, true);
|
||||
|
||||
$this->config->set('google_chart', true);
|
||||
}
|
||||
}
|
||||
|
||||
// check for get module
|
||||
if (!$this->registry->
|
||||
exists('builder.get_module.' . $target . '.' . $key))
|
||||
{
|
||||
if ($this->getGetModule($content))
|
||||
{
|
||||
$this->registry->
|
||||
set('builder.get_module.' . $target . '.' . $key, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Automatically load uikit version 2 data files
|
||||
*
|
||||
* @param string $key The key mapper
|
||||
* @param string $content The content to search through
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function uikit(string $key, string $content)
|
||||
{
|
||||
// get/set uikit state
|
||||
$uikit = false;
|
||||
$uikit_ = $this->config->get('uikit', 0);
|
||||
|
||||
// add uikit if required
|
||||
if (2 == $uikit_ || 1 == $uikit_)
|
||||
{
|
||||
$uikit = true;
|
||||
}
|
||||
|
||||
// load uikit
|
||||
if ($uikit)
|
||||
{
|
||||
// set uikit to views TODO: convert this getUikitComp to a class
|
||||
if (($found = Helper::_('getUikitComp',
|
||||
[$content, (array) $this->registry->get('builder.uikit_comp.' . $key, [])]
|
||||
)) !== false)
|
||||
{
|
||||
$this->registry->set('builder.uikit_comp.' . $key, $found);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for footable scripts
|
||||
*
|
||||
* @param string $content The content to check
|
||||
*
|
||||
* @return boolean True if found
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function getFootableScripts(string &$content): bool
|
||||
{
|
||||
return strpos($content, 'footable') !== false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for getModules script
|
||||
*
|
||||
* @param string $content The content to check
|
||||
*
|
||||
* @return boolean True if found
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function getGetModule(string &$content): bool
|
||||
{
|
||||
return strpos($content, 'this->getModules(') !== false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for get Google Chart script
|
||||
*
|
||||
* @param string $content The content to check
|
||||
*
|
||||
* @return boolean True if found
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function getGoogleChart(string &$content): bool
|
||||
{
|
||||
return strpos($content, 'Chartbuilder(') !== false;
|
||||
}
|
||||
|
||||
}
|
||||
|
33
src/0d71c2d9-2fc0-4c20-82c5-43c46b0fc6f7/settings.json
Normal file
33
src/0d71c2d9-2fc0-4c20-82c5-43c46b0fc6f7/settings.json
Normal file
@ -0,0 +1,33 @@
|
||||
{
|
||||
"add_head": "0",
|
||||
"extends": "0",
|
||||
"extends_custom": "",
|
||||
"guid": "0d71c2d9-2fc0-4c20-82c5-43c46b0fc6f7",
|
||||
"implements": null,
|
||||
"implements_custom": "",
|
||||
"load_selection": null,
|
||||
"name": "Loader",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "JCB.Compiler.Model.Loader",
|
||||
"type": "class",
|
||||
"use_selection": {
|
||||
"use_selection0": {
|
||||
"use": "d910d8b8-4c23-4f3e-8cda-438f2d2bd7ac",
|
||||
"as": "Compiler"
|
||||
},
|
||||
"use_selection1": {
|
||||
"use": "fa4bf18e-301e-42e3-91fb-6e0096c07adc",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection2": {
|
||||
"use": "e5d9804f-0eb0-4ee9-b406-ad4e8cdbc1f6",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection3": {
|
||||
"use": "640b5352-fb09-425f-a26e-cd44eda03f15",
|
||||
"as": "default"
|
||||
}
|
||||
},
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder.Compiler.Model.Loader",
|
||||
"description": "Model Auto Loader Class\r\n\r\n@since 3.2.0"
|
||||
}
|
37
src/0dabc67c-abec-4541-82bf-279abd3c9be1/README.md
Normal file
37
src/0dabc67c-abec-4541-82bf-279abd3c9be1/README.md
Normal file
@ -0,0 +1,37 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# class Permissions (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Compiler\Model**
|
||||
```uml
|
||||
@startuml
|
||||
class Permissions #Gold {
|
||||
+ set(object $item) : void
|
||||
}
|
||||
|
||||
note right of Permissions::set
|
||||
Set the local tabs
|
||||
|
||||
since: 3.2.0
|
||||
return: void
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
49
src/0dabc67c-abec-4541-82bf-279abd3c9be1/code.php
Normal file
49
src/0dabc67c-abec-4541-82bf-279abd3c9be1/code.php
Normal file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Compiler\Model;
|
||||
|
||||
|
||||
use VDM\Joomla\Utilities\JsonHelper;
|
||||
use VDM\Joomla\Utilities\ArrayHelper;
|
||||
|
||||
|
||||
/**
|
||||
* Model Permissions Class
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
class Permissions
|
||||
{
|
||||
/**
|
||||
* Set the local tabs
|
||||
*
|
||||
* @param object $item The view data
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function set(object &$item)
|
||||
{
|
||||
$item->addpermissions = (isset($item->addpermissions)
|
||||
&& JsonHelper::check($item->addpermissions))
|
||||
? json_decode((string) $item->addpermissions, true) : null;
|
||||
|
||||
if (ArrayHelper::check($item->addpermissions))
|
||||
{
|
||||
$item->permissions = array_values($item->addpermissions);
|
||||
}
|
||||
|
||||
unset($item->addpermissions);
|
||||
}
|
||||
|
||||
}
|
||||
|
25
src/0dabc67c-abec-4541-82bf-279abd3c9be1/settings.json
Normal file
25
src/0dabc67c-abec-4541-82bf-279abd3c9be1/settings.json
Normal file
@ -0,0 +1,25 @@
|
||||
{
|
||||
"add_head": "0",
|
||||
"extends": "0",
|
||||
"extends_custom": "",
|
||||
"guid": "0dabc67c-abec-4541-82bf-279abd3c9be1",
|
||||
"implements": null,
|
||||
"implements_custom": "",
|
||||
"load_selection": null,
|
||||
"name": "Permissions",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "JCB.Compiler.Model.Permissions",
|
||||
"type": "class",
|
||||
"use_selection": {
|
||||
"use_selection0": {
|
||||
"use": "4b225c51-d293-48e4-b3f6-5136cf5c3f18",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection1": {
|
||||
"use": "0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a",
|
||||
"as": "default"
|
||||
}
|
||||
},
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder.Compiler.Model.Permissions",
|
||||
"description": "Model Permissions Class\r\n\r\n@since 3.2.0"
|
||||
}
|
45
src/1133c2d7-ba7e-4c95-8cde-01f084d04682/README.md
Normal file
45
src/1133c2d7-ba7e-4c95-8cde-01f084d04682/README.md
Normal file
@ -0,0 +1,45 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# interface PowerInterface (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Compiler\Interfaces**
|
||||
```uml
|
||||
@startuml
|
||||
interface PowerInterface #Lavender {
|
||||
+ load(array $guids) : void
|
||||
+ get(string $guid, int $build) : mixed
|
||||
}
|
||||
|
||||
note right of PowerInterface::load
|
||||
load all the powers linked to this component
|
||||
|
||||
since: 3.2.0
|
||||
return: void
|
||||
end note
|
||||
|
||||
note right of PowerInterface::get
|
||||
Get a power
|
||||
|
||||
since: 3.2.0
|
||||
return: mixed
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
43
src/1133c2d7-ba7e-4c95-8cde-01f084d04682/code.php
Normal file
43
src/1133c2d7-ba7e-4c95-8cde-01f084d04682/code.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Compiler\Interfaces;
|
||||
|
||||
|
||||
/**
|
||||
* Compiler Power Interface
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
interface PowerInterface
|
||||
{
|
||||
/**
|
||||
* load all the powers linked to this component
|
||||
*
|
||||
* @param array $guids The global unique ids of the linked powers
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function load(array $guids);
|
||||
|
||||
/**
|
||||
* Get a power
|
||||
*
|
||||
* @param string $guid The global unique id of the power
|
||||
* @param int $build Force build switch (to override global switch)
|
||||
*
|
||||
* @return mixed
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function get(string $guid, int $build = 0);
|
||||
}
|
||||
|
16
src/1133c2d7-ba7e-4c95-8cde-01f084d04682/settings.json
Normal file
16
src/1133c2d7-ba7e-4c95-8cde-01f084d04682/settings.json
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"add_head": "0",
|
||||
"extends": "0",
|
||||
"extends_custom": "Registry",
|
||||
"guid": "1133c2d7-ba7e-4c95-8cde-01f084d04682",
|
||||
"implements": null,
|
||||
"implements_custom": "",
|
||||
"load_selection": null,
|
||||
"name": "PowerInterface",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "JCB.Interfaces.PowerInterface",
|
||||
"type": "interface",
|
||||
"use_selection": null,
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder.Compiler.Interfaces.PowerInterface",
|
||||
"description": "Compiler Power Interface\r\n\r\n@since 3.2.0"
|
||||
}
|
37
src/143ac6ea-b64f-4331-9a97-31e3fce2bb69/README.md
Normal file
37
src/143ac6ea-b64f-4331-9a97-31e3fce2bb69/README.md
Normal file
@ -0,0 +1,37 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# class Tabs (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Compiler\Model**
|
||||
```uml
|
||||
@startuml
|
||||
class Tabs #Gold {
|
||||
+ set(object $item) : void
|
||||
}
|
||||
|
||||
note right of Tabs::set
|
||||
Set the local tabs
|
||||
|
||||
since: 3.2.0
|
||||
return: void
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
71
src/143ac6ea-b64f-4331-9a97-31e3fce2bb69/code.php
Normal file
71
src/143ac6ea-b64f-4331-9a97-31e3fce2bb69/code.php
Normal file
@ -0,0 +1,71 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Compiler\Model;
|
||||
|
||||
|
||||
use VDM\Joomla\Utilities\JsonHelper;
|
||||
use VDM\Joomla\Utilities\ArrayHelper;
|
||||
|
||||
|
||||
/**
|
||||
* Model Tabs Class
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
class Tabs
|
||||
{
|
||||
/**
|
||||
* Set the local tabs
|
||||
*
|
||||
* @param object $item The view data
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function set(object &$item)
|
||||
{
|
||||
$item->addtabs = (isset($item->addtabs)
|
||||
&& JsonHelper::check($item->addtabs))
|
||||
? json_decode((string) $item->addtabs, true) : null;
|
||||
|
||||
if (ArrayHelper::check($item->addtabs))
|
||||
{
|
||||
$nr = 1;
|
||||
foreach ($item->addtabs as $tab)
|
||||
{
|
||||
$item->tabs[$nr] = trim((string) $tab['name']);
|
||||
$nr++;
|
||||
}
|
||||
}
|
||||
|
||||
// if Details tab is not set, then set it here
|
||||
if (!isset($item->tabs[1]))
|
||||
{
|
||||
$item->tabs[1] = 'Details';
|
||||
}
|
||||
|
||||
// always make sure that publishing is lowercase
|
||||
if (($removeKey = array_search(
|
||||
'publishing', array_map('strtolower', $item->tabs)
|
||||
)) !== false)
|
||||
{
|
||||
$item->tabs[$removeKey] = 'publishing';
|
||||
}
|
||||
|
||||
// make sure to set the publishing tab (just in case we need it)
|
||||
$item->tabs[15] = 'publishing';
|
||||
|
||||
unset($item->addtabs);
|
||||
}
|
||||
|
||||
}
|
||||
|
25
src/143ac6ea-b64f-4331-9a97-31e3fce2bb69/settings.json
Normal file
25
src/143ac6ea-b64f-4331-9a97-31e3fce2bb69/settings.json
Normal file
@ -0,0 +1,25 @@
|
||||
{
|
||||
"add_head": "0",
|
||||
"extends": "0",
|
||||
"extends_custom": "",
|
||||
"guid": "143ac6ea-b64f-4331-9a97-31e3fce2bb69",
|
||||
"implements": null,
|
||||
"implements_custom": "",
|
||||
"load_selection": null,
|
||||
"name": "Tabs",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "JCB.Compiler.Model.Tabs",
|
||||
"type": "class",
|
||||
"use_selection": {
|
||||
"use_selection0": {
|
||||
"use": "4b225c51-d293-48e4-b3f6-5136cf5c3f18",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection1": {
|
||||
"use": "0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a",
|
||||
"as": "default"
|
||||
}
|
||||
},
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder.Compiler.Model.Tabs",
|
||||
"description": "Model Tabs Class\r\n\r\n@since 3.2.0"
|
||||
}
|
68
src/17a728e9-d6cf-4060-9efb-241b0ff2f981/README.md
Normal file
68
src/17a728e9-d6cf-4060-9efb-241b0ff2f981/README.md
Normal file
@ -0,0 +1,68 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# class Historycomponent (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Compiler\Model**
|
||||
```uml
|
||||
@startuml
|
||||
class Historycomponent #Gold {
|
||||
# Config $config
|
||||
# HistoryInterface $history
|
||||
# Updatesql $updatesql
|
||||
+ __construct(?Config $config = null, ?HistoryInterface $history = null, ...)
|
||||
+ set(object $item) : void
|
||||
- setAdminView(object $item) : void
|
||||
- setComponent(object $item) : void
|
||||
}
|
||||
|
||||
note right of Historycomponent::__construct
|
||||
Constructor
|
||||
|
||||
since: 3.2.0
|
||||
|
||||
arguments:
|
||||
?Config $config = null
|
||||
?HistoryInterface $history = null
|
||||
?Updatesql $updatesql = null
|
||||
end note
|
||||
|
||||
note right of Historycomponent::set
|
||||
check if an update SQL is needed
|
||||
|
||||
since: 3.2.0
|
||||
return: void
|
||||
end note
|
||||
|
||||
note right of Historycomponent::setAdminView
|
||||
check if an update SQL is needed
|
||||
|
||||
since: 3.2.0
|
||||
return: void
|
||||
end note
|
||||
|
||||
note right of Historycomponent::setComponent
|
||||
Set the component history
|
||||
|
||||
since: 3.2.0
|
||||
return: void
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
150
src/17a728e9-d6cf-4060-9efb-241b0ff2f981/code.php
Normal file
150
src/17a728e9-d6cf-4060-9efb-241b0ff2f981/code.php
Normal file
@ -0,0 +1,150 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Compiler\Model;
|
||||
|
||||
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Factory as Compiler;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Config;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Interfaces\HistoryInterface;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Model\Updatesql;
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
use VDM\Joomla\Utilities\ObjectHelper;
|
||||
use VDM\Joomla\Utilities\JsonHelper;
|
||||
|
||||
|
||||
/**
|
||||
* Model Component History Class
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
class Historycomponent
|
||||
{
|
||||
/**
|
||||
* The compiler Config
|
||||
*
|
||||
* @var Config
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Config $config;
|
||||
|
||||
/**
|
||||
* The compiler history
|
||||
*
|
||||
* @var HistoryInterface
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected HistoryInterface $history;
|
||||
|
||||
/**
|
||||
* The compiler update sql
|
||||
*
|
||||
* @var Updatesql
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Updatesql $updatesql;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param Config|null $config The compiler config object.
|
||||
* @param HistoryInterface|null $history The compiler history object.
|
||||
* @param Updatesql|null $updatesql The compiler updatesql object.
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function __construct(?Config $config = null, ?HistoryInterface $history = null,
|
||||
?Updatesql $updatesql = null)
|
||||
{
|
||||
$this->config = $config ?: Compiler::_('Config');
|
||||
$this->history = $history ?: Compiler::_('History');
|
||||
$this->updatesql = $updatesql ?: Compiler::_('Model.Updatesql');
|
||||
}
|
||||
|
||||
/**
|
||||
* check if an update SQL is needed
|
||||
*
|
||||
* @param object $item The item data
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function set(object &$item)
|
||||
{
|
||||
// update SQL for admin views
|
||||
$this->setAdminView($item);
|
||||
|
||||
// update SQL for component
|
||||
$this->setComponent($item);
|
||||
}
|
||||
|
||||
/**
|
||||
* check if an update SQL is needed
|
||||
*
|
||||
* @param object $item The item data
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
private function setAdminView(object $item)
|
||||
{
|
||||
$old_admin_views = $this->history->get(
|
||||
'component_admin_views', $item->addadmin_views_id
|
||||
);
|
||||
|
||||
// add new views if found
|
||||
if ($old_admin_views && ObjectHelper::check($old_admin_views))
|
||||
{
|
||||
if (isset($old_admin_views->addadmin_views)
|
||||
&& JsonHelper::check(
|
||||
$old_admin_views->addadmin_views
|
||||
))
|
||||
{
|
||||
$this->updatesql->set(
|
||||
json_decode((string) $old_admin_views->addadmin_views, true),
|
||||
$item->addadmin_views, 'adminview'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the component history
|
||||
*
|
||||
* @param object $item The item data
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
private function setComponent(object &$item)
|
||||
{
|
||||
$old_component = $this->history->get(
|
||||
'joomla_component', $this->config->component_id
|
||||
);
|
||||
|
||||
// check if a new version was manually set
|
||||
if ($old_component && ObjectHelper::check($old_component))
|
||||
{
|
||||
$old_component_version = preg_replace(
|
||||
'/[^0-9.]+/', '', (string) $old_component->component_version
|
||||
);
|
||||
if ($old_component_version != $this->config->component_version)
|
||||
{
|
||||
// yes, this is a new version, this mean there may
|
||||
// be manual sql and must be checked and updated
|
||||
$item->old_component_version
|
||||
= $old_component_version;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
49
src/17a728e9-d6cf-4060-9efb-241b0ff2f981/settings.json
Normal file
49
src/17a728e9-d6cf-4060-9efb-241b0ff2f981/settings.json
Normal file
@ -0,0 +1,49 @@
|
||||
{
|
||||
"add_head": "0",
|
||||
"extends": "0",
|
||||
"extends_custom": "",
|
||||
"guid": "17a728e9-d6cf-4060-9efb-241b0ff2f981",
|
||||
"implements": null,
|
||||
"implements_custom": "",
|
||||
"load_selection": null,
|
||||
"name": "Historycomponent",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "JCB.Compiler.Model.Historycomponent",
|
||||
"type": "class",
|
||||
"use_selection": {
|
||||
"use_selection0": {
|
||||
"use": "d910d8b8-4c23-4f3e-8cda-438f2d2bd7ac",
|
||||
"as": "Compiler"
|
||||
},
|
||||
"use_selection1": {
|
||||
"use": "fa4bf18e-301e-42e3-91fb-6e0096c07adc",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection2": {
|
||||
"use": "4325745f-da1f-4d4d-a591-3189fe8c06e5",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection3": {
|
||||
"use": "b80296eb-4718-4ed3-894d-69f3ac293733",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection4": {
|
||||
"use": "1f28cb53-60d9-4db1-b517-3c7dc6b429ef",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection5": {
|
||||
"use": "91004529-94a9-4590-b842-e7c6b624ecf5",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection6": {
|
||||
"use": "4b225c51-d293-48e4-b3f6-5136cf5c3f18",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection7": {
|
||||
"use": "91004529-94a9-4590-b842-e7c6b624ecf5",
|
||||
"as": "default"
|
||||
}
|
||||
},
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder.Compiler.Model.Historycomponent",
|
||||
"description": "Model Component History Class\r\n\r\n@since 3.2.0"
|
||||
}
|
53
src/1aefb8f5-486f-4f00-adf9-696340b3254e/README.md
Normal file
53
src/1aefb8f5-486f-4f00-adf9-696340b3254e/README.md
Normal file
@ -0,0 +1,53 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# interface InstallInterface (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Compiler\Interfaces\Extension**
|
||||
```uml
|
||||
@startuml
|
||||
interface InstallInterface #Lavender {
|
||||
+ getOfficialName() : string
|
||||
+ getClassName() : string
|
||||
+ getInstallerClassName() : string
|
||||
}
|
||||
|
||||
note right of InstallInterface::getOfficialName
|
||||
The extension official name
|
||||
|
||||
since: 3.2.0
|
||||
return: string
|
||||
end note
|
||||
|
||||
note right of InstallInterface::getClassName
|
||||
The extension class name
|
||||
|
||||
since: 3.2.0
|
||||
return: string
|
||||
end note
|
||||
|
||||
note right of InstallInterface::getInstallerClassName
|
||||
The extension installer class name
|
||||
|
||||
since: 3.2.0
|
||||
return: string
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
46
src/1aefb8f5-486f-4f00-adf9-696340b3254e/code.php
Normal file
46
src/1aefb8f5-486f-4f00-adf9-696340b3254e/code.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Compiler\Interfaces\Extension;
|
||||
|
||||
|
||||
/**
|
||||
* The properties an extension should have to be passed to the InstallScript class
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
interface InstallInterface
|
||||
{
|
||||
/**
|
||||
* The extension official name
|
||||
*
|
||||
* @return string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getOfficialName(): string;
|
||||
|
||||
/**
|
||||
* The extension class name
|
||||
*
|
||||
* @return string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getClassName(): string;
|
||||
|
||||
/**
|
||||
* The extension installer class name
|
||||
*
|
||||
* @return string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getInstallerClassName(): string;
|
||||
}
|
||||
|
16
src/1aefb8f5-486f-4f00-adf9-696340b3254e/settings.json
Normal file
16
src/1aefb8f5-486f-4f00-adf9-696340b3254e/settings.json
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"add_head": "0",
|
||||
"extends": "0",
|
||||
"extends_custom": "",
|
||||
"guid": "1aefb8f5-486f-4f00-adf9-696340b3254e",
|
||||
"implements": null,
|
||||
"implements_custom": "",
|
||||
"load_selection": null,
|
||||
"name": "InstallInterface",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "JCB.Interfaces.Extension.InstallInterface",
|
||||
"type": "interface",
|
||||
"use_selection": null,
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder.Compiler.Interfaces.Extension.InstallInterface",
|
||||
"description": "The properties an extension should have to be passed to the InstallScript class\r\n\r\n@since 3.2.0"
|
||||
}
|
77
src/1bd48df2-4f7e-4581-9fe9-4b54e59105e3/README.md
Normal file
77
src/1bd48df2-4f7e-4581-9fe9-4b54e59105e3/README.md
Normal file
@ -0,0 +1,77 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# class Gui (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Compiler\Customcode**
|
||||
```uml
|
||||
@startuml
|
||||
class Gui #Gold {
|
||||
# Config $config
|
||||
# Reverse $reverse
|
||||
# \JDatabaseDriver $db
|
||||
# CMSApplication $app
|
||||
+ __construct(?Config $config = null, ?Reverse $reverse = null, ...)
|
||||
+ set(string $string, array $config) : string
|
||||
+ search(string $file, array $placeholders, ...) : void
|
||||
# check(string $code) : bool
|
||||
}
|
||||
|
||||
note right of Gui::__construct
|
||||
Constructor.
|
||||
|
||||
since: 3.2.0
|
||||
|
||||
arguments:
|
||||
?Config $config = null
|
||||
?Reverse $reverse = null
|
||||
?\JDatabaseDriver $db = null
|
||||
?CMSApplication $app = null
|
||||
end note
|
||||
|
||||
note right of Gui::set
|
||||
Set the JCB GUI code placeholder
|
||||
|
||||
since: 3.2.0
|
||||
return: string
|
||||
end note
|
||||
|
||||
note right of Gui::search
|
||||
search a file for gui code blocks that were updated in the IDE
|
||||
|
||||
since: 3.2.0
|
||||
return: void
|
||||
|
||||
arguments:
|
||||
string $file
|
||||
array $placeholders
|
||||
string $today
|
||||
string $target
|
||||
end note
|
||||
|
||||
note right of Gui::check
|
||||
search a code to see if there is already any custom
|
||||
code or other reasons not to add the GUI code placeholders
|
||||
|
||||
since: 3.2.0
|
||||
return: bool
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
252
src/1bd48df2-4f7e-4581-9fe9-4b54e59105e3/code.php
Normal file
252
src/1bd48df2-4f7e-4581-9fe9-4b54e59105e3/code.php
Normal file
@ -0,0 +1,252 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Compiler\Customcode;
|
||||
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Application\CMSApplication;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use VDM\Joomla\Utilities\ArrayHelper;
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
use VDM\Joomla\Utilities\GetHelper;
|
||||
use VDM\Joomla\Utilities\FileHelper;
|
||||
use VDM\Joomla\Utilities\String\FieldHelper;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Factory as Compiler;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Config;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Placeholder\Reverse;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Customcode\GuiInterface;
|
||||
|
||||
|
||||
/**
|
||||
* Compiler Gui Custom Code
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
class Gui implements GuiInterface
|
||||
{
|
||||
/**
|
||||
* Compiler Config
|
||||
*
|
||||
* @var Config
|
||||
* @since 3.2.0
|
||||
**/
|
||||
protected Config $config;
|
||||
|
||||
/**
|
||||
* Compiler Placeholder Reverse
|
||||
*
|
||||
* @var Reverse
|
||||
* @since 3.2.0
|
||||
**/
|
||||
protected Reverse $reverse;
|
||||
|
||||
/**
|
||||
* Database object to query local DB
|
||||
*
|
||||
* @var \JDatabaseDriver
|
||||
* @since 3.2.0
|
||||
**/
|
||||
protected \JDatabaseDriver $db;
|
||||
|
||||
/**
|
||||
* Database object to query local DB
|
||||
*
|
||||
* @var CMSApplication
|
||||
* @since 3.2.0
|
||||
**/
|
||||
protected CMSApplication $app;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param Config|null $config The compiler config object.
|
||||
* @param Reverse|null $reverse The compiler placeholder reverse object.
|
||||
* @param \JDatabaseDriver|null $db The Database Driver object.
|
||||
* @param CMSApplication|null $app The CMS Application object.
|
||||
*
|
||||
* @throws \Exception
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function __construct(?Config $config = null, ?Reverse $reverse = null,
|
||||
?\JDatabaseDriver $db = null, ?CMSApplication $app = null)
|
||||
{
|
||||
$this->config = $config ?: Compiler::_('Config');
|
||||
$this->reverse = $reverse ?: Compiler::_('Placeholder.Reverse');
|
||||
$this->db = $db ?: Factory::getDbo();
|
||||
$this->app = $app ?: Factory::getApplication();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the JCB GUI code placeholder
|
||||
*
|
||||
* @param string $string The code string
|
||||
* @param array $config The placeholder config values
|
||||
*
|
||||
* @return string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function set(string $string, array $config): string
|
||||
{
|
||||
if (StringHelper::check($string))
|
||||
{
|
||||
if ($this->config->get('add_placeholders', false)
|
||||
&& $this->check($string) && ArrayHelper::check($config)
|
||||
&& isset($config['table']) && StringHelper::check($config['table'])
|
||||
&& isset($config['field']) && StringHelper::check($config['field'])
|
||||
&& isset($config['type']) && StringHelper::check($config['type'])
|
||||
&& isset($config['id']) && is_numeric($config['id']))
|
||||
{
|
||||
// if we have a key we must get the ID
|
||||
if (isset($config['key']) && StringHelper::check($config['key']) && $config['key'] !== 'id')
|
||||
{
|
||||
if (($id = GetHelper::var($config['table'], $config['id'], $config['key'], 'id')) !== false && is_numeric($id))
|
||||
{
|
||||
$config['id'] = $id;
|
||||
}
|
||||
else
|
||||
{
|
||||
// we must give a error message to inform the user of this issue. (should never happen)
|
||||
$this->app->enqueueMessage(
|
||||
Text::sprintf('COM_COMPONENTBUILDER_ID_MISMATCH_WAS_DETECTED_WITH_THE_SSSS_GUI_CODE_FIELD_SO_THE_PLACEHOLDER_WAS_NOT_SET',
|
||||
$config['table'], $config['field'],
|
||||
$config['key'], $config['id']
|
||||
), 'Error'
|
||||
);
|
||||
// check some config
|
||||
if (!isset($config['prefix']))
|
||||
{
|
||||
$config['prefix'] = '';
|
||||
}
|
||||
|
||||
return $config['prefix'] . $string;
|
||||
}
|
||||
}
|
||||
// check some config
|
||||
if (!isset($config['prefix']))
|
||||
{
|
||||
$config['prefix'] = PHP_EOL;
|
||||
}
|
||||
// add placeholder based on type of code
|
||||
switch (strtolower((string) $config['type']))
|
||||
{
|
||||
// adding with html commenting
|
||||
case 'html':
|
||||
$front = $config['prefix'] . '<!--' . '[JCBGUI.';
|
||||
$sufix = '$$$$]-->' . PHP_EOL;
|
||||
$back = '<!--[/JCBGUI' . $sufix;
|
||||
break;
|
||||
// adding with php commenting
|
||||
default:
|
||||
$front = $config['prefix'] . '/***' . '[JCBGUI.';
|
||||
$sufix = '$$$$]***/' . PHP_EOL;
|
||||
$back = '/***[/JCBGUI' . $sufix;
|
||||
break;
|
||||
}
|
||||
|
||||
return $front . $config['table'] . '.' . $config['field'] . '.'
|
||||
. $config['id'] . '.' . $sufix . $string . $back;
|
||||
}
|
||||
// check some config
|
||||
if (!isset($config['prefix']))
|
||||
{
|
||||
$config['prefix'] = '';
|
||||
}
|
||||
|
||||
return $config['prefix'] . $string;
|
||||
}
|
||||
|
||||
return $string;
|
||||
}
|
||||
|
||||
/**
|
||||
* search a file for gui code blocks that were updated in the IDE
|
||||
*
|
||||
* @param string $file The file path to search
|
||||
* @param array $placeholders The values to replace in the code being stored
|
||||
* @param string $today The date for today
|
||||
* @param string $target The target path type
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function search(string &$file, array &$placeholders, string &$today, string &$target)
|
||||
{
|
||||
// get file content
|
||||
$file_conent = FileHelper::getContent($file);
|
||||
|
||||
$guiCode = [];
|
||||
// we add a new search for the GUI CODE Blocks
|
||||
$guiCode[] = GetHelper::allBetween(
|
||||
$file_conent, '/***[JCB' . 'GUI<>', '/***[/JCBGUI' . '$$$$]***/'
|
||||
);
|
||||
$guiCode[] = GetHelper::allBetween(
|
||||
$file_conent, '<!--[JCB' . 'GUI<>', '<!--[/JCBGUI' . '$$$$]-->'
|
||||
);
|
||||
|
||||
if (($guiCode = ArrayHelper::merge($guiCode)) !== false
|
||||
&& ArrayHelper::check($guiCode, true))
|
||||
{
|
||||
foreach ($guiCode as $code)
|
||||
{
|
||||
$first_line = strtok($code, PHP_EOL);
|
||||
// get the GUI target details
|
||||
$query = explode('.', trim($first_line, '.'));
|
||||
// only continue if we have 3 values in the query
|
||||
if (is_array($query) && count($query) >= 3)
|
||||
{
|
||||
// cleanup the newlines around the code
|
||||
$code = trim(str_replace($first_line, '', (string) $code), PHP_EOL)
|
||||
. PHP_EOL;
|
||||
// set the ID
|
||||
$id = (int) $query[2];
|
||||
// make the field name save
|
||||
$field = FieldHelper::safe($query[1]);
|
||||
// make the table name save
|
||||
$table = StringHelper::safe($query[0]);
|
||||
// reverse placeholder as much as we can
|
||||
$code = $this->reverse->engine(
|
||||
$code, $placeholders, $target, $id, $field, $table
|
||||
);
|
||||
// update the GUI/Tables/Database
|
||||
$object = new \stdClass();
|
||||
$object->id = $id;
|
||||
$object->{$field} = base64_encode(
|
||||
(string) $code
|
||||
); // (TODO) this may not always work...
|
||||
// update the value in GUI
|
||||
$this->db->updateObject(
|
||||
'#__componentbuilder_' . (string) $table, $object, 'id'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* search a code to see if there is already any custom
|
||||
* code or other reasons not to add the GUI code placeholders
|
||||
*
|
||||
* @param string $code The code to check
|
||||
*
|
||||
* @return bool true if GUI code placeholders can be added
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function check(string &$code): bool
|
||||
{
|
||||
// check for customcode placeholders
|
||||
// we do not add GUI wrapper placeholder to code
|
||||
// that already has any customcode placeholders
|
||||
return strpos($code, '$$$$') === false;
|
||||
}
|
||||
|
||||
}
|
||||
|
52
src/1bd48df2-4f7e-4581-9fe9-4b54e59105e3/settings.json
Normal file
52
src/1bd48df2-4f7e-4581-9fe9-4b54e59105e3/settings.json
Normal file
@ -0,0 +1,52 @@
|
||||
{
|
||||
"add_head": "1",
|
||||
"extends": "0",
|
||||
"extends_custom": "",
|
||||
"guid": "1bd48df2-4f7e-4581-9fe9-4b54e59105e3",
|
||||
"implements": [
|
||||
"2cc8517d-1105-4697-9743-048b4b7c089c"
|
||||
],
|
||||
"implements_custom": "",
|
||||
"load_selection": null,
|
||||
"name": "Gui",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "JCB.Compiler.Customcode.Gui",
|
||||
"type": "class",
|
||||
"use_selection": {
|
||||
"use_selection0": {
|
||||
"use": "0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection1": {
|
||||
"use": "1f28cb53-60d9-4db1-b517-3c7dc6b429ef",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection2": {
|
||||
"use": "db87c339-5bb6-4291-a7ef-2c48ea1b06bc",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection3": {
|
||||
"use": "a223b31e-ea1d-4cdf-92ae-5f9becffaff0",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection4": {
|
||||
"use": "9ef0eb24-aae4-4f5a-99af-d724db44808f",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection5": {
|
||||
"use": "d910d8b8-4c23-4f3e-8cda-438f2d2bd7ac",
|
||||
"as": "Compiler"
|
||||
},
|
||||
"use_selection6": {
|
||||
"use": "fa4bf18e-301e-42e3-91fb-6e0096c07adc",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection7": {
|
||||
"use": "ca111518-e47c-4049-b1b2-cb010f23866f",
|
||||
"as": "default"
|
||||
}
|
||||
},
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder.Compiler.Customcode.Gui",
|
||||
"description": "Compiler Gui Custom Code\r\n\r\n@since 3.2.0",
|
||||
"head": "use Joomla\\CMS\\Factory;\r\nuse Joomla\\CMS\\Application\\CMSApplication;\r\nuse Joomla\\CMS\\Language\\Text;"
|
||||
}
|
77
src/1cef0266-99e2-40d8-919f-c2ce32226b0a/README.md
Normal file
77
src/1cef0266-99e2-40d8-919f-c2ce32226b0a/README.md
Normal file
@ -0,0 +1,77 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# class External (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Compiler\Customcode**
|
||||
```uml
|
||||
@startuml
|
||||
class External #Gold {
|
||||
# array $code
|
||||
# array $cutter
|
||||
# Placeholder $placeholder
|
||||
# \JDatabaseDriver $db
|
||||
# User $user
|
||||
# CMSApplication $app
|
||||
+ __construct(?Placeholder $placeholder = null, ?\JDatabaseDriver $db = null, ...)
|
||||
+ set(string $string, int $debug) : string
|
||||
# getCode(string $target, array $bucket) : void
|
||||
# cut(string $string, string $sequence, ...) : string
|
||||
}
|
||||
|
||||
note right of External::__construct
|
||||
Constructor.
|
||||
|
||||
since: 3.2.0
|
||||
|
||||
arguments:
|
||||
?Placeholder $placeholder = null
|
||||
?\JDatabaseDriver $db = null
|
||||
?User $user = null
|
||||
?CMSApplication $app = null
|
||||
end note
|
||||
|
||||
note right of External::set
|
||||
Set the external code string & load it in to string
|
||||
|
||||
since: 3.2.0
|
||||
return: string
|
||||
end note
|
||||
|
||||
note right of External::getCode
|
||||
Get the External Code/String
|
||||
|
||||
since: 3.2.0
|
||||
return: void
|
||||
end note
|
||||
|
||||
note right of External::cut
|
||||
Cut the External Code/String
|
||||
|
||||
since: 3.2.0
|
||||
return: string
|
||||
|
||||
arguments:
|
||||
string $string
|
||||
string $sequence
|
||||
string $key
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
399
src/1cef0266-99e2-40d8-919f-c2ce32226b0a/code.php
Normal file
399
src/1cef0266-99e2-40d8-919f-c2ce32226b0a/code.php
Normal file
@ -0,0 +1,399 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Compiler\Customcode;
|
||||
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\User\User;
|
||||
use Joomla\CMS\Application\CMSApplication;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Filesystem\Path;
|
||||
use VDM\Joomla\Utilities\ArrayHelper;
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
use VDM\Joomla\Utilities\GetHelper;
|
||||
use VDM\Joomla\Utilities\FileHelper;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Factory as Compiler;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Placeholder;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Customcode\ExternalInterface;
|
||||
|
||||
|
||||
/**
|
||||
* Compiler External Custom Code
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
class External implements ExternalInterface
|
||||
{
|
||||
/**
|
||||
* The external code/string to be added
|
||||
*
|
||||
* @var array
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected array $code = [];
|
||||
|
||||
/**
|
||||
* The external code/string cutter
|
||||
*
|
||||
* @var array
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected array $cutter = [];
|
||||
|
||||
/**
|
||||
* Compiler Placeholder
|
||||
*
|
||||
* @var Placeholder
|
||||
* @since 3.2.0
|
||||
**/
|
||||
protected Placeholder $placeholder;
|
||||
|
||||
/**
|
||||
* Database object to query local DB
|
||||
*
|
||||
* @var \JDatabaseDriver
|
||||
* @since 3.2.0
|
||||
**/
|
||||
protected \JDatabaseDriver $db;
|
||||
|
||||
/**
|
||||
* User object
|
||||
*
|
||||
* @var User
|
||||
* @since 3.2.0
|
||||
**/
|
||||
protected User $user;
|
||||
|
||||
/**
|
||||
* Database object to query local DB
|
||||
*
|
||||
* @var CMSApplication
|
||||
* @since 3.2.0
|
||||
**/
|
||||
protected CMSApplication $app;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param Placeholder|null $placeholder The compiler placeholder object.
|
||||
* @param \JDatabaseDriver|null $db The Database Driver object.
|
||||
* @param User|null $user The User object.
|
||||
* @param CMSApplication|null $app The CMS Application object.
|
||||
*
|
||||
* @throws \Exception
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function __construct(?Placeholder $placeholder = null,
|
||||
?\JDatabaseDriver $db = null, ?User $user = null, ?CMSApplication $app = null)
|
||||
{
|
||||
$this->placeholder = $placeholder ?: Compiler::_('Placeholder');
|
||||
$this->db = $db ?: Factory::getDbo();
|
||||
$this->user = $user ?: Factory::getUser();
|
||||
$this->app = $app ?: Factory::getApplication();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the external code string & load it in to string
|
||||
*
|
||||
* @param string $string The content to check
|
||||
* @param int $debug The switch to debug the update
|
||||
*
|
||||
* @return string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function set(string $string, int $debug = 0): string
|
||||
{
|
||||
// check if content has custom code placeholder
|
||||
if (strpos($string, '[EXTERNA' . 'LCODE=') !== false)
|
||||
{
|
||||
// if debug
|
||||
if ($debug)
|
||||
{
|
||||
echo 'External Code String:';
|
||||
var_dump($string);
|
||||
}
|
||||
// target content
|
||||
$bucket = [];
|
||||
$found = GetHelper::allBetween(
|
||||
$string, '[EXTERNA' . 'LCODE=', ']'
|
||||
);
|
||||
if (ArrayHelper::check($found))
|
||||
{
|
||||
// build local bucket
|
||||
foreach ($found as $target)
|
||||
{
|
||||
// check for cutting sequence
|
||||
// example: >{3|4
|
||||
// will cut 3 rows at top and 4 rows at bottom
|
||||
// if the external code has 8 or more lines
|
||||
if (($pos = strpos((string) $target, '>{')) !== false)
|
||||
{
|
||||
// the length
|
||||
$target_len = strlen((string) $target);
|
||||
// where to cut
|
||||
$cutting = $target_len - $pos;
|
||||
// get the sequence
|
||||
$sequence = substr((string) $target, "-$cutting");
|
||||
// remove from the URL
|
||||
$target_url = str_replace($sequence, '', (string) $target);
|
||||
// set the cut key for this target if not set
|
||||
$this->cutter[trim((string) $target)] = str_replace('>{', '', $sequence);
|
||||
}
|
||||
else
|
||||
{
|
||||
$target_url = $target;
|
||||
}
|
||||
// check if the target is valid URL or path
|
||||
if ((!filter_var($target_url, FILTER_VALIDATE_URL) === false
|
||||
&& FileHelper::exists($target_url))
|
||||
|| (Path::clean($target_url) === $target_url
|
||||
&& FileHelper::exists($target_url)))
|
||||
{
|
||||
$this->getCode($target, $bucket);
|
||||
}
|
||||
// give notice that target is not a valid url/path
|
||||
else
|
||||
{
|
||||
// set key
|
||||
$key = '[EXTERNA' . 'LCODE=' . $target . ']';
|
||||
// set the notice
|
||||
$this->app->enqueueMessage(
|
||||
Text::_('COM_COMPONENTBUILDER_HR_HTHREEEXTERNAL_CODE_WARNINGHTHREE'
|
||||
), 'Warning'
|
||||
);
|
||||
$this->app->enqueueMessage(
|
||||
Text::sprintf('COM_COMPONENTBUILDER_THE_BSB_IS_NOT_A_VALID_URLPATH',
|
||||
$key
|
||||
), 'Warning'
|
||||
);
|
||||
// remove the placeholder
|
||||
$bucket[$key] = '';
|
||||
}
|
||||
}
|
||||
// now update local string if bucket has values
|
||||
if (ArrayHelper::check($bucket))
|
||||
{
|
||||
$string = $this->placeholder->update($string, $bucket);
|
||||
}
|
||||
}
|
||||
// if debug
|
||||
if ($debug)
|
||||
{
|
||||
echo 'External Code String After Update:';
|
||||
var_dump($string);
|
||||
}
|
||||
}
|
||||
|
||||
return $string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the External Code/String
|
||||
*
|
||||
* @param string $string The content to check
|
||||
* @param array $bucket The Placeholders bucket
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function getCode(string $target, array &$bucket)
|
||||
{
|
||||
// set URL key
|
||||
$target_key = trim($target);
|
||||
// set key
|
||||
$key = '[EXTERNA' . 'LCODE=' . $target . ']';
|
||||
// remove the cut sequence from the url
|
||||
if (isset($this->cutter[$target_key]))
|
||||
{
|
||||
// remove from the URL
|
||||
$target_url = trim(str_replace('>{' . $this->cutter[$target_key], '', $target));
|
||||
}
|
||||
else
|
||||
{
|
||||
$target_url = trim($target);
|
||||
}
|
||||
// check if we already fetched this
|
||||
if (!isset($this->code[$target_key]))
|
||||
{
|
||||
// get the data string (code)
|
||||
$this->code[$target_key]
|
||||
= FileHelper::getContent($target_url);
|
||||
// check if we must cut this
|
||||
if (isset($this->cutter[$target_key]) &&
|
||||
$this->cutter[$target_key])
|
||||
{
|
||||
$this->code[$target_key] = $this->cut(
|
||||
$this->code[$target_key],
|
||||
$this->cutter[$target_key],
|
||||
$key
|
||||
);
|
||||
}
|
||||
// did we get any value
|
||||
if (StringHelper::check(
|
||||
$this->code[$target_key]
|
||||
))
|
||||
{
|
||||
// check for changes
|
||||
$live_hash = md5($this->code[$target_key]);
|
||||
// check if it exists local
|
||||
if ($hash = GetHelper::var(
|
||||
'external_code', $target_key, 'target', 'hash'
|
||||
))
|
||||
{
|
||||
// must be an admin make a change to use EXTERNAL code (we may add a custom access switch - use ADMIN for now)
|
||||
if ($hash !== $live_hash && $this->user->authorise(
|
||||
'core.admin', 'com_componentbuilder'
|
||||
))
|
||||
{
|
||||
// update the hash since it changed
|
||||
$object = new \stdClass();
|
||||
$object->target = $target_key;
|
||||
$object->hash = $live_hash;
|
||||
// update local hash
|
||||
$this->db->updateObject(
|
||||
'#__componentbuilder_external_code', $object,
|
||||
'target'
|
||||
);
|
||||
// give notice of the change
|
||||
$this->app->enqueueMessage(
|
||||
Text::_('COM_COMPONENTBUILDER_HR_HTHREEEXTERNAL_CODE_WARNINGHTHREE'),
|
||||
'Warning'
|
||||
);
|
||||
$this->app->enqueueMessage(
|
||||
Text::sprintf('COM_COMPONENTBUILDER_THE_CODESTRING_FROM_BSB_HAS_BEEN_BCHANGEDB_SINCE_THE_LAST_COMPILATION_PLEASE_INVESTIGATE_TO_ENSURE_THE_CHANGES_ARE_SAFE_BSHOULD_YOU_NOT_EXPECT_THIS_CHANGE_TO_THE_EXTERNAL_CODESTRING_BEING_ADDED_THEN_THIS_IS_A_SERIOUS_ISSUE_AND_REQUIRES_IMMEDIATE_ATTENTIONB_DO_NOT_IGNORE_THIS_WARNING_AS_IT_WILL_ONLY_SHOW_BONCEB',
|
||||
$key
|
||||
), 'Warning'
|
||||
);
|
||||
}
|
||||
elseif ($hash !== $live_hash)
|
||||
{
|
||||
// set the notice
|
||||
$this->app->enqueueMessage(
|
||||
Text::_('COM_COMPONENTBUILDER_HR_HTHREEEXTERNAL_CODE_ERRORHTHREE'),
|
||||
'Error'
|
||||
);
|
||||
$this->app->enqueueMessage(
|
||||
Text::sprintf('COM_COMPONENTBUILDER_S_WE_DETECTED_A_CHANGE_IN_BEXTERNALCODEB_BUT_YOU_DO_NOT_HAVE_PERMISSION_TO_ALLOW_THIS_CHANGE_SO_BSB_WAS_REMOVED_FROM_THE_COMPILATION_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_INFOBR_SMALLADMIN_ACCESS_REQUIREDSMALL',
|
||||
$this->user->get('name'), $key
|
||||
), 'Error'
|
||||
);
|
||||
// remove the code/string
|
||||
$this->code[$target_key] = '';
|
||||
}
|
||||
}
|
||||
// only an admin can add new EXTERNAL code (we may add a custom access switch - use ADMIN for now)
|
||||
elseif ($this->user->authorise(
|
||||
'core.admin', 'com_componentbuilder'
|
||||
))
|
||||
{
|
||||
// add the hash to track changes
|
||||
$object = new \stdClass();
|
||||
$object->target = $target_key;
|
||||
$object->hash = $live_hash;
|
||||
// insert local hash
|
||||
$this->db->insertObject(
|
||||
'#__componentbuilder_external_code', $object
|
||||
);
|
||||
// give notice the first time this is added
|
||||
$this->app->enqueueMessage(
|
||||
Text::_('COM_COMPONENTBUILDER_HR_HTHREEEXTERNAL_CODE_NOTICEHTHREE'),
|
||||
'Warning'
|
||||
);
|
||||
$this->app->enqueueMessage(
|
||||
Text::sprintf('COM_COMPONENTBUILDER_THE_CODESTRING_FROM_BSB_HAS_BEEN_ADDED_FOR_THE_BFIRST_TIMEB_PLEASE_IINVESTIGATEI_TO_ENSURE_THE_CORRECT_CODESTRING_WAS_USED_BSHOULD_YOU_NOT_KNOW_ABOUT_THIS_NEW_EXTERNAL_CODESTRING_BEING_ADDED_THEN_THIS_IS_A_SERIOUS_DANGER_AND_REQUIRES_IMMEDIATE_ATTENTIONB_DO_NOT_IGNORE_THIS_WARNING_AS_IT_WILL_ONLY_SHOW_BONCEB',
|
||||
$key
|
||||
), 'Warning'
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
// set the notice
|
||||
$this->app->enqueueMessage(
|
||||
Text::_('COM_COMPONENTBUILDER_HR_HTHREEEXTERNAL_CODE_ERRORHTHREE'),
|
||||
'Error'
|
||||
);
|
||||
$this->app->enqueueMessage(
|
||||
Text::sprintf('COM_COMPONENTBUILDER_S_WE_DETECTED_BNEW_EXTERNALCODEB_BUT_YOU_DO_NOT_HAVE_PERMISSION_TO_ALLOW_THIS_NEW_CODESTRING_SO_BSB_WAS_REMOVED_FROM_THE_COMPILATION_PLEASE_CONTACT_YOU_SYSTEM_ADMINISTRATOR_FOR_MORE_INFOBR_SMALLADMIN_ACCESS_REQUIREDSMALL',
|
||||
$this->user->get('name'), $key
|
||||
), 'Error'
|
||||
);
|
||||
// remove the code/string
|
||||
$this->code[$target_key] = '';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// set notice that we could not get a valid string from the target
|
||||
$this->app->enqueueMessage(
|
||||
Text::_('COM_COMPONENTBUILDER_HR_HTHREEEXTERNAL_CODE_WARNINGHTHREE'), 'Error'
|
||||
);
|
||||
$this->app->enqueueMessage(
|
||||
Text::sprintf('COM_COMPONENTBUILDER_THE_BSB_RETURNED_AN_INVALID_STRING', $key
|
||||
), 'Error'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// add to local bucket
|
||||
$bucket[$key] = $this->code[$target_key] ?? '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Cut the External Code/String
|
||||
*
|
||||
* @param string $string The content to cut
|
||||
* @param string $sequence The cutting sequence
|
||||
* @param string $key The content key
|
||||
*
|
||||
* @return string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function cut(string $string, string $sequence, string $key): string
|
||||
{
|
||||
// we first break the string up in rows
|
||||
$rows = (array) explode(PHP_EOL, $string);
|
||||
// get the cutting sequence
|
||||
$cutter = (array) explode('|', $sequence);
|
||||
// we only continue if we have more rows than we have to cut
|
||||
if (array_sum($cutter) < ArrayHelper::check($rows))
|
||||
{
|
||||
// remove the rows at the bottom if needed
|
||||
if (isset($cutter[1]) && $cutter[1] > 0)
|
||||
{
|
||||
array_splice($rows, "-$cutter[1]");
|
||||
}
|
||||
// remove the rows at the top if needed
|
||||
if ($cutter[0] > 0)
|
||||
{
|
||||
$rows = array_splice($rows, $cutter[0]);
|
||||
}
|
||||
|
||||
// return the remaining rows
|
||||
return implode(PHP_EOL, $rows);
|
||||
}
|
||||
|
||||
// we set an error message about too few lines to cut
|
||||
$this->app->enqueueMessage(
|
||||
Text::_('COM_COMPONENTBUILDER_HR_HTHREEEXTERNAL_CODE_NOTICEHTHREE'),
|
||||
'Error'
|
||||
);
|
||||
$this->app->enqueueMessage(
|
||||
Text::sprintf('COM_COMPONENTBUILDER_THE_BSB_CUT_SEQUENCE_FAILED_ON_THE_RETURNED_EXTERNAL_CODESTRING_AS_MORE_LINES_HAS_TO_BE_CUT_THEN_WAS_FOUND_IN_THE_CODESTRING_WE_HAVE_COMPLETELY_REMOVED_THE_CODE_PLEASE_CHECK_THIS_CODESTRING',
|
||||
$key
|
||||
), 'Error'
|
||||
);
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
}
|
||||
|
44
src/1cef0266-99e2-40d8-919f-c2ce32226b0a/settings.json
Normal file
44
src/1cef0266-99e2-40d8-919f-c2ce32226b0a/settings.json
Normal file
@ -0,0 +1,44 @@
|
||||
{
|
||||
"add_head": "1",
|
||||
"extends": "0",
|
||||
"extends_custom": "",
|
||||
"guid": "1cef0266-99e2-40d8-919f-c2ce32226b0a",
|
||||
"implements": [
|
||||
"1fcb13a2-f3f0-4fa8-b8c6-ff9dc546777a"
|
||||
],
|
||||
"implements_custom": "",
|
||||
"load_selection": null,
|
||||
"name": "External",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "JCB.Compiler.Customcode.External",
|
||||
"type": "class",
|
||||
"use_selection": {
|
||||
"use_selection0": {
|
||||
"use": "0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection1": {
|
||||
"use": "1f28cb53-60d9-4db1-b517-3c7dc6b429ef",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection2": {
|
||||
"use": "db87c339-5bb6-4291-a7ef-2c48ea1b06bc",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection3": {
|
||||
"use": "a223b31e-ea1d-4cdf-92ae-5f9becffaff0",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection4": {
|
||||
"use": "d910d8b8-4c23-4f3e-8cda-438f2d2bd7ac",
|
||||
"as": "Compiler"
|
||||
},
|
||||
"use_selection5": {
|
||||
"use": "06453ada-e370-49f0-b262-e3f5a8ed0c2c",
|
||||
"as": "default"
|
||||
}
|
||||
},
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder.Compiler.Customcode.External",
|
||||
"description": "Compiler External Custom Code\r\n\r\n@since 3.2.0",
|
||||
"head": "use Joomla\\CMS\\Factory;\r\nuse Joomla\\CMS\\User\\User;\r\nuse Joomla\\CMS\\Application\\CMSApplication;\r\nuse Joomla\\CMS\\Language\\Text;\r\nuse Joomla\\CMS\\Filesystem\\Path;"
|
||||
}
|
45
src/1d0fd857-12ec-4f47-ab1c-124d85748e24/README.md
Normal file
45
src/1d0fd857-12ec-4f47-ab1c-124d85748e24/README.md
Normal file
@ -0,0 +1,45 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# class Updateserver (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Compiler\Model**
|
||||
```uml
|
||||
@startuml
|
||||
class Updateserver #Gold {
|
||||
+ set(object $item) : void
|
||||
# changelog(object $item) : void
|
||||
}
|
||||
|
||||
note right of Updateserver::set
|
||||
Set version updates
|
||||
|
||||
since: 3.2.0
|
||||
return: void
|
||||
end note
|
||||
|
||||
note right of Updateserver::changelog
|
||||
Set changelog values to component changelog
|
||||
|
||||
since: 3.2.0
|
||||
return: void
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
80
src/1d0fd857-12ec-4f47-ab1c-124d85748e24/code.php
Normal file
80
src/1d0fd857-12ec-4f47-ab1c-124d85748e24/code.php
Normal file
@ -0,0 +1,80 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Compiler\Model;
|
||||
|
||||
|
||||
use VDM\Joomla\Utilities\ArrayHelper;
|
||||
use VDM\Joomla\Utilities\JsonHelper;
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
|
||||
|
||||
/**
|
||||
* Model Joomla Update Server Class
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
class Updateserver
|
||||
{
|
||||
/**
|
||||
* Set version updates
|
||||
*
|
||||
* @param object $item The item data
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function set(object &$item)
|
||||
{
|
||||
// set the version updates
|
||||
$item->version_update = (isset($item->version_update)
|
||||
&& JsonHelper::check($item->version_update))
|
||||
? json_decode((string) $item->version_update, true) : null;
|
||||
if (ArrayHelper::check($item->version_update))
|
||||
{
|
||||
$item->version_update = array_values(
|
||||
$item->version_update
|
||||
);
|
||||
|
||||
// set the change log details
|
||||
$this->changelog($item);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set changelog values to component changelog
|
||||
*
|
||||
* @param object $item The item data
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function changelog(object &$item)
|
||||
{
|
||||
// set the version updates
|
||||
$bucket = [];
|
||||
foreach ($item->version_update as $update)
|
||||
{
|
||||
if (isset($update['change_log']) && StringHelper::check($update['change_log'])
|
||||
&& isset($update['version']) && StringHelper::check($update['version']))
|
||||
{
|
||||
$bucket[] = '# v' . $update['version'] . PHP_EOL . PHP_EOL . $update['change_log'];
|
||||
}
|
||||
}
|
||||
|
||||
if (ArrayHelper::check($bucket))
|
||||
{
|
||||
$item->changelog = implode(PHP_EOL . PHP_EOL, $bucket);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
29
src/1d0fd857-12ec-4f47-ab1c-124d85748e24/settings.json
Normal file
29
src/1d0fd857-12ec-4f47-ab1c-124d85748e24/settings.json
Normal file
@ -0,0 +1,29 @@
|
||||
{
|
||||
"add_head": "0",
|
||||
"extends": "0",
|
||||
"extends_custom": "",
|
||||
"guid": "1d0fd857-12ec-4f47-ab1c-124d85748e24",
|
||||
"implements": null,
|
||||
"implements_custom": "",
|
||||
"load_selection": null,
|
||||
"name": "Updateserver",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "JCB.Compiler.Model.Updateserver",
|
||||
"type": "class",
|
||||
"use_selection": {
|
||||
"use_selection0": {
|
||||
"use": "0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection1": {
|
||||
"use": "4b225c51-d293-48e4-b3f6-5136cf5c3f18",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection2": {
|
||||
"use": "1f28cb53-60d9-4db1-b517-3c7dc6b429ef",
|
||||
"as": "default"
|
||||
}
|
||||
},
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder.Compiler.Model.Updateserver",
|
||||
"description": "Model Joomla Update Server Class\r\n\r\n@since 3.2.0"
|
||||
}
|
86
src/1d929017-a5de-4e0f-9b5a-838934857e26/README.md
Normal file
86
src/1d929017-a5de-4e0f-9b5a-838934857e26/README.md
Normal file
@ -0,0 +1,86 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# class InstallScript (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Compiler\Extension\JoomlaThree**
|
||||
```uml
|
||||
@startuml
|
||||
class InstallScript #Gold {
|
||||
# object $extension
|
||||
# array $methods
|
||||
# array $types
|
||||
# array $construct
|
||||
# array $install
|
||||
# array $update
|
||||
# array $uninstall
|
||||
# bool $preflightActive
|
||||
# bool $postflightActive
|
||||
+ get(object $extension) : string
|
||||
# build() : string
|
||||
# head() : string
|
||||
# construct() : string
|
||||
# main(string $name) : string
|
||||
# flight(string $name) : string
|
||||
}
|
||||
|
||||
note right of InstallScript::get
|
||||
get install script
|
||||
|
||||
since: 3.2.0
|
||||
return: string
|
||||
end note
|
||||
|
||||
note right of InstallScript::build
|
||||
build the install class
|
||||
|
||||
since: 3.2.0
|
||||
return: string
|
||||
end note
|
||||
|
||||
note right of InstallScript::head
|
||||
get install script head
|
||||
|
||||
since: 3.2.0
|
||||
return: string
|
||||
end note
|
||||
|
||||
note right of InstallScript::construct
|
||||
get constructor
|
||||
|
||||
since: 3.2.0
|
||||
return: string
|
||||
end note
|
||||
|
||||
note right of InstallScript::main
|
||||
build main methods
|
||||
|
||||
since: 3.2.0
|
||||
return: string
|
||||
end note
|
||||
|
||||
note right of InstallScript::flight
|
||||
build flight methods
|
||||
|
||||
since: 3.2.0
|
||||
return: string
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
371
src/1d929017-a5de-4e0f-9b5a-838934857e26/code.php
Normal file
371
src/1d929017-a5de-4e0f-9b5a-838934857e26/code.php
Normal file
@ -0,0 +1,371 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Compiler\Extension\JoomlaThree;
|
||||
|
||||
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Extension\InstallInterface;
|
||||
use VDM\Joomla\Utilities\ArrayHelper;
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Line;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Indent;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Interfaces\GetScriptInterface;
|
||||
|
||||
|
||||
/**
|
||||
* Loading the Extension Installation Script Class
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
class InstallScript implements GetScriptInterface
|
||||
{
|
||||
/**
|
||||
* The extension
|
||||
*
|
||||
* @var InstallInterface|Object
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected object $extension;
|
||||
|
||||
/**
|
||||
* The methods
|
||||
*
|
||||
* @var array
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected array $methods = ['php_script', 'php_preflight', 'php_postflight', 'php_method'];
|
||||
|
||||
/**
|
||||
* The types
|
||||
*
|
||||
* @var array
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected array $types = ['construct', 'install', 'update', 'uninstall', 'discover_install'];
|
||||
|
||||
/**
|
||||
* The construct bucket
|
||||
*
|
||||
* @var array
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected array $construct = [];
|
||||
|
||||
/**
|
||||
* The install bucket
|
||||
*
|
||||
* @var array
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected array $install = [];
|
||||
|
||||
/**
|
||||
* The update bucket
|
||||
*
|
||||
* @var array
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected array $update = [];
|
||||
|
||||
/**
|
||||
* The uninstall bucket
|
||||
*
|
||||
* @var array
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected array $uninstall = [];
|
||||
|
||||
/**
|
||||
* The preflight switch
|
||||
*
|
||||
* @var bool
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected bool $preflightActive = false;
|
||||
|
||||
/**
|
||||
* The preflight bucket
|
||||
*
|
||||
* @var array
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected array $preflightBucket = ['install' => [], 'uninstall' => [], 'discover_install' => [], 'update' => []];
|
||||
|
||||
/**
|
||||
* The postflight switch
|
||||
*
|
||||
* @var bool
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected bool $postflightActive = false;
|
||||
|
||||
/**
|
||||
* The postflight bucket
|
||||
*
|
||||
* @var array
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected array $postflightBucket = ['install' => [], 'uninstall' => [], 'discover_install' => [], 'update' => []];
|
||||
|
||||
/**
|
||||
* get install script
|
||||
*
|
||||
* @param Object $extension The extension object
|
||||
*
|
||||
* @return string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function get(object $extension): string
|
||||
{
|
||||
// loop over methods and types
|
||||
foreach ($this->methods as $method)
|
||||
{
|
||||
foreach ($this->types as $type)
|
||||
{
|
||||
if (isset($extension->{'add_' . $method . '_' . $type})
|
||||
&& $extension->{'add_' . $method . '_' . $type} == 1
|
||||
&& StringHelper::check(
|
||||
$extension->{$method . '_' . $type}
|
||||
))
|
||||
{
|
||||
// add to the main methods
|
||||
if ('php_method' === $method || 'php_script' === $method)
|
||||
{
|
||||
$this->{$type}[] = $extension->{$method . '_' . $type};
|
||||
}
|
||||
else
|
||||
{
|
||||
// get the flight key
|
||||
$flight = str_replace('php_', '', (string) $method);
|
||||
// load the script to our bucket
|
||||
$this->{$flight . 'Bucket'}[$type][] = $extension->{$method . '_' . $type};
|
||||
// show that the method is active
|
||||
$this->{$flight . 'Active'} = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->extension = $extension;
|
||||
|
||||
// return the class
|
||||
return $this->build();
|
||||
}
|
||||
|
||||
/**
|
||||
* build the install class
|
||||
*
|
||||
* @return string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function build(): string
|
||||
{
|
||||
// start build
|
||||
$script = $this->head();
|
||||
|
||||
// load constructor if set
|
||||
$script .= $this->construct();
|
||||
|
||||
// load install method if set
|
||||
$script .= $this->main('install');
|
||||
|
||||
// load update method if set
|
||||
$script .= $this->main('update');
|
||||
|
||||
// load uninstall method if set
|
||||
$script .= $this->main('uninstall');
|
||||
|
||||
// load preflight method if set
|
||||
$script .= $this->flight('preflight');
|
||||
|
||||
// load postflight method if set
|
||||
$script .= $this->flight('postflight');
|
||||
|
||||
// close the class
|
||||
$script .= PHP_EOL . '}' . PHP_EOL;
|
||||
|
||||
return $script;
|
||||
}
|
||||
|
||||
/**
|
||||
* get install script head
|
||||
*
|
||||
* @return string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function head(): string
|
||||
{
|
||||
// get the extension
|
||||
$extension = $this->extension;
|
||||
|
||||
// start build
|
||||
$script = PHP_EOL . '/**';
|
||||
$script .= PHP_EOL . ' * ' . $extension->official_name
|
||||
. ' script file.';
|
||||
$script .= PHP_EOL . ' *';
|
||||
$script .= PHP_EOL . ' * @package ' . $extension->class_name;
|
||||
$script .= PHP_EOL . ' */';
|
||||
$script .= PHP_EOL . 'class ' . $extension->installer_class_name;
|
||||
$script .= PHP_EOL . '{';
|
||||
|
||||
return $script;
|
||||
}
|
||||
|
||||
/**
|
||||
* get constructor
|
||||
*
|
||||
* @return string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function construct(): string
|
||||
{
|
||||
// return empty string if not set
|
||||
if (!ArrayHelper::check($this->construct))
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
// the __construct script
|
||||
$script = PHP_EOL . PHP_EOL . Indent::_(1) . '/**';
|
||||
$script .= PHP_EOL . Indent::_(1) . ' * Constructor';
|
||||
$script .= PHP_EOL . Indent::_(1) . ' *';
|
||||
$script .= PHP_EOL . Indent::_(1)
|
||||
. ' * @param Joomla\CMS\Installer\InstallerAdapter $adapter The object responsible for running this script';
|
||||
$script .= PHP_EOL . Indent::_(1) . ' */';
|
||||
$script .= PHP_EOL . Indent::_(1)
|
||||
. 'public function __construct($adapter)';
|
||||
$script .= PHP_EOL . Indent::_(1) . '{';
|
||||
$script .= PHP_EOL . implode(PHP_EOL . PHP_EOL, $this->construct);
|
||||
// close the function
|
||||
$script .= PHP_EOL . Indent::_(1) . '}';
|
||||
|
||||
return $script;
|
||||
}
|
||||
|
||||
/**
|
||||
* build main methods
|
||||
*
|
||||
* @param string $name the method being called
|
||||
*
|
||||
* @return string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function main(string $name): string
|
||||
{
|
||||
// return empty string if not set
|
||||
if (!ArrayHelper::check($this->{$name}))
|
||||
{
|
||||
return '';
|
||||
}
|
||||
// load the install method
|
||||
$script = PHP_EOL . PHP_EOL . Indent::_(1) . '/**';
|
||||
$script .= PHP_EOL . Indent::_(1) . " * Called on $name";
|
||||
$script .= PHP_EOL . Indent::_(1) . ' *';
|
||||
$script .= PHP_EOL . Indent::_(1)
|
||||
. ' * @param Joomla\CMS\Installer\InstallerAdapter $adapter The object responsible for running this script';
|
||||
$script .= PHP_EOL . Indent::_(1) . ' *';
|
||||
$script .= PHP_EOL . Indent::_(1)
|
||||
. ' * @return boolean True on success';
|
||||
$script .= PHP_EOL . Indent::_(1) . ' */';
|
||||
$script .= PHP_EOL . Indent::_(1) . 'public function '
|
||||
. $name . '($adapter)';
|
||||
$script .= PHP_EOL . Indent::_(1) . '{';
|
||||
$script .= PHP_EOL . implode(PHP_EOL . PHP_EOL, $this->{$name});
|
||||
// return true
|
||||
if ('uninstall' !== $name)
|
||||
{
|
||||
$script .= PHP_EOL . Indent::_(2) . 'return true;';
|
||||
}
|
||||
// close the function
|
||||
$script .= PHP_EOL . Indent::_(1) . '}';
|
||||
|
||||
return $script;
|
||||
}
|
||||
|
||||
/**
|
||||
* build flight methods
|
||||
*
|
||||
* @param string $name the method being called
|
||||
*
|
||||
* @return string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function flight(string $name): string
|
||||
{
|
||||
// return empty string if not set
|
||||
if (empty($this->{$name . 'Active'}))
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
// the pre/post function types
|
||||
$script = PHP_EOL . PHP_EOL . Indent::_(1) . '/**';
|
||||
$script .= PHP_EOL . Indent::_(1)
|
||||
. ' * Called before any type of action';
|
||||
$script .= PHP_EOL . Indent::_(1) . ' *';
|
||||
$script .= PHP_EOL . Indent::_(1)
|
||||
. ' * @param string $route Which action is happening (install|uninstall|discover_install|update)';
|
||||
$script .= PHP_EOL . Indent::_(1)
|
||||
. ' * @param Joomla\CMS\Installer\InstallerAdapter $adapter The object responsible for running this script';
|
||||
$script .= PHP_EOL . Indent::_(1) . ' *';
|
||||
$script .= PHP_EOL . Indent::_(1)
|
||||
. ' * @return boolean True on success';
|
||||
$script .= PHP_EOL . Indent::_(1) . ' */';
|
||||
$script .= PHP_EOL . Indent::_(1) . 'public function '
|
||||
. $name . '($route, $adapter)';
|
||||
$script .= PHP_EOL . Indent::_(1) . '{';
|
||||
$script .= PHP_EOL . Indent::_(2) . '//' . Line::_(__Line__, __Class__)
|
||||
. ' get application';
|
||||
$script .= PHP_EOL . Indent::_(2)
|
||||
. '$app = JFactory::getApplication();' . PHP_EOL;
|
||||
|
||||
// add the default version check (TODO) must make this dynamic
|
||||
if ('preflight' === $name)
|
||||
{
|
||||
$script .= PHP_EOL . Indent::_(2) . '//' . Line::_(__Line__, __Class__)
|
||||
.' the default for both install and update';
|
||||
$script .= PHP_EOL . Indent::_(2)
|
||||
. '$jversion = new JVersion();';
|
||||
$script .= PHP_EOL . Indent::_(2)
|
||||
. "if (!\$jversion->isCompatible('3.8.0'))";
|
||||
$script .= PHP_EOL . Indent::_(2) . '{';
|
||||
$script .= PHP_EOL . Indent::_(3)
|
||||
. "\$app->enqueueMessage('Please upgrade to at least Joomla! 3.8.0 before continuing!', 'error');";
|
||||
$script .= PHP_EOL . Indent::_(3) . 'return false;';
|
||||
$script .= PHP_EOL . Indent::_(2) . '}' . PHP_EOL;
|
||||
}
|
||||
|
||||
// now add the scripts
|
||||
foreach ($this->{$name . 'Bucket'} as $route => $_script)
|
||||
{
|
||||
if (ArrayHelper::check($_script))
|
||||
{
|
||||
// set the if and script
|
||||
$script .= PHP_EOL . Indent::_(2) . "if ('" . $route
|
||||
. "' === \$route)";
|
||||
$script .= PHP_EOL . Indent::_(2) . '{';
|
||||
$script .= PHP_EOL . implode(
|
||||
PHP_EOL . PHP_EOL, $_script
|
||||
);
|
||||
$script .= PHP_EOL . Indent::_(2) . '}' . PHP_EOL;
|
||||
}
|
||||
}
|
||||
|
||||
// return true
|
||||
$script .= PHP_EOL . Indent::_(2) . 'return true;';
|
||||
// close the function
|
||||
$script .= PHP_EOL . Indent::_(1) . '}';
|
||||
|
||||
return $script;
|
||||
}
|
||||
|
||||
}
|
||||
|
39
src/1d929017-a5de-4e0f-9b5a-838934857e26/settings.json
Normal file
39
src/1d929017-a5de-4e0f-9b5a-838934857e26/settings.json
Normal file
@ -0,0 +1,39 @@
|
||||
{
|
||||
"add_head": "0",
|
||||
"extends": "0",
|
||||
"extends_custom": "",
|
||||
"guid": "1d929017-a5de-4e0f-9b5a-838934857e26",
|
||||
"implements": [
|
||||
"2e6731ba-3a03-4836-b2c2-4e50e38cb890"
|
||||
],
|
||||
"implements_custom": "",
|
||||
"load_selection": null,
|
||||
"name": "InstallScript",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "JCB.Compiler.Extension.JoomlaThree.InstallScript",
|
||||
"type": "class",
|
||||
"use_selection": {
|
||||
"use_selection0": {
|
||||
"use": "1aefb8f5-486f-4f00-adf9-696340b3254e",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection1": {
|
||||
"use": "0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection2": {
|
||||
"use": "1f28cb53-60d9-4db1-b517-3c7dc6b429ef",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection3": {
|
||||
"use": "4e6ff11d-bebf-42f5-8fd7-b2f882857222",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection4": {
|
||||
"use": "a68c010b-e92e-47d5-8a44-d23cfddeb6c6",
|
||||
"as": "default"
|
||||
}
|
||||
},
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder.Compiler.Extension.JoomlaThree.InstallScript",
|
||||
"description": "Loading the Extension Installation Script Class\r\n\r\n@since 3.2.0"
|
||||
}
|
21
src/1d967151-7c20-4ca7-9400-65233cdcd4db/README.md
Normal file
21
src/1d967151-7c20-4ca7-9400-65233cdcd4db/README.md
Normal file
@ -0,0 +1,21 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
> Error adding class diagram
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
26
src/1d967151-7c20-4ca7-9400-65233cdcd4db/code.php
Normal file
26
src/1d967151-7c20-4ca7-9400-65233cdcd4db/code.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Compiler\Utilities;
|
||||
|
||||
|
||||
use VDM\Joomla\Componentbuilder\Abstraction\BaseRegistry;
|
||||
|
||||
|
||||
/**
|
||||
* Compiler Utilities Files Bucket
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
class Files extends BaseRegistry
|
||||
{
|
||||
}
|
||||
|
16
src/1d967151-7c20-4ca7-9400-65233cdcd4db/settings.json
Normal file
16
src/1d967151-7c20-4ca7-9400-65233cdcd4db/settings.json
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"add_head": "0",
|
||||
"extends": "b84e947d-2a13-44f7-ac0f-3902ae55ae0c",
|
||||
"extends_custom": "JoomlaRegistry",
|
||||
"guid": "1d967151-7c20-4ca7-9400-65233cdcd4db",
|
||||
"implements": null,
|
||||
"implements_custom": "",
|
||||
"load_selection": null,
|
||||
"name": "Files",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "JCB.Compiler.Utilities.Files",
|
||||
"type": "class",
|
||||
"use_selection": null,
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder.Compiler.Utilities.Files",
|
||||
"description": "Compiler Utilities Files Bucket\r\n\r\n@since 3.2.0"
|
||||
}
|
106
src/1efdded5-d6c8-452c-8f37-0374483a7b3f/README.md
Normal file
106
src/1efdded5-d6c8-452c-8f37-0374483a7b3f/README.md
Normal file
@ -0,0 +1,106 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# class Structure (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Compiler\Utilities**
|
||||
```uml
|
||||
@startuml
|
||||
class Structure #Gold {
|
||||
# Settings $settings
|
||||
# Paths $paths
|
||||
# Counter $counter
|
||||
# File $file
|
||||
# Files $files
|
||||
# CMSApplication $app
|
||||
+ __construct(?Settings $settings = null, ?Paths $paths = null, ...)
|
||||
+ build(array $target, string $type, ...) : bool
|
||||
- getFileDetails(object $details, string $item, ...) : ?array
|
||||
- getPath(object $details, string $zipPath, ...) : ?string
|
||||
- getNewName(object $details, string $item, ...) : string
|
||||
}
|
||||
|
||||
note right of Structure::__construct
|
||||
Constructor.
|
||||
|
||||
since: 3.2.0
|
||||
|
||||
arguments:
|
||||
?Settings $settings = null
|
||||
?Paths $paths = null
|
||||
?Counter $counter = null
|
||||
?File $file = null
|
||||
?Files $files = null
|
||||
?CMSApplication $app = null
|
||||
end note
|
||||
|
||||
note right of Structure::build
|
||||
Build Structural Needed Files & Folders
|
||||
|
||||
since: 3.2.0
|
||||
return: bool
|
||||
|
||||
arguments:
|
||||
array $target
|
||||
string $type
|
||||
?string $fileName = null
|
||||
?array $config = null
|
||||
end note
|
||||
|
||||
note right of Structure::getFileDetails
|
||||
Get the details
|
||||
|
||||
since: 3.2.0
|
||||
return: ?array
|
||||
|
||||
arguments:
|
||||
object $details
|
||||
string $item
|
||||
string $name
|
||||
?string $fileName = null
|
||||
?array $config = null
|
||||
end note
|
||||
|
||||
note right of Structure::getPath
|
||||
Get the path
|
||||
|
||||
since: 3.2.0
|
||||
return: ?string
|
||||
|
||||
arguments:
|
||||
object $details
|
||||
string $zipPath
|
||||
string $name
|
||||
end note
|
||||
|
||||
note right of Structure::getNewName
|
||||
Get the new name
|
||||
|
||||
since: 3.2.0
|
||||
return: string
|
||||
|
||||
arguments:
|
||||
object $details
|
||||
string $item
|
||||
string $name
|
||||
?string $fileName = null
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
313
src/1efdded5-d6c8-452c-8f37-0374483a7b3f/code.php
Normal file
313
src/1efdded5-d6c8-452c-8f37-0374483a7b3f/code.php
Normal file
@ -0,0 +1,313 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Compiler\Utilities;
|
||||
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Application\CMSApplication;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Filesystem\File as JoomlaFile;
|
||||
use Joomla\CMS\Filesystem\Folder;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Factory as Compiler;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Component\Settings;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Paths;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Counter;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\File;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Files;
|
||||
use VDM\Joomla\Utilities\ArrayHelper;
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
|
||||
|
||||
/**
|
||||
* Compiler Utilities To Build Structure
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
class Structure
|
||||
{
|
||||
/**
|
||||
* Compiler Component Joomla Version Settings
|
||||
*
|
||||
* @var Settings
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Settings $settings;
|
||||
|
||||
/**
|
||||
* Compiler Utilities Paths
|
||||
*
|
||||
* @var Paths
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Paths $paths;
|
||||
|
||||
/**
|
||||
* Compiler Counter
|
||||
*
|
||||
* @var Counter
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Counter $counter;
|
||||
|
||||
/**
|
||||
* Compiler Utilities File
|
||||
*
|
||||
* @var File
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected File $file;
|
||||
|
||||
/**
|
||||
* Compiler Utilities Files
|
||||
*
|
||||
* @var Files
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Files $files;
|
||||
|
||||
/**
|
||||
* Database object to query local DB
|
||||
*
|
||||
* @var CMSApplication
|
||||
* @since 3.2.0
|
||||
**/
|
||||
protected CMSApplication $app;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param Settings|null $settings The compiler component joomla version settings object.
|
||||
* @param Paths|null $paths The compiler paths object.
|
||||
* @param Counter|null $counter The compiler counter object.
|
||||
* @param File|null $file The compiler file object.
|
||||
* @param Files|null $files The compiler files object.
|
||||
* @param CMSApplication|null $app The CMS Application object.
|
||||
*
|
||||
* @since 3.2.0
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function __construct(?Settings $settings = null, ?Paths $paths = null,
|
||||
?Counter $counter = null, ?File $file = null, ?Files $files = null,
|
||||
?CMSApplication $app = null)
|
||||
{
|
||||
$this->settings = $settings ?: Compiler::_('Component.Settings');
|
||||
$this->paths = $paths ?: Compiler::_('Utilities.Paths');
|
||||
$this->counter = $counter ?: Compiler::_('Utilities.Counter');
|
||||
$this->file = $file ?: Compiler::_('Utilities.File');
|
||||
$this->files = $files ?: Compiler::_('Utilities.Files');
|
||||
$this->app = $app ?: Factory::getApplication();
|
||||
}
|
||||
|
||||
/**
|
||||
* Build Structural Needed Files & Folders
|
||||
*
|
||||
* @param array $target The main target and name
|
||||
* @param string $type The type in the target
|
||||
* @param string|null $fileName The custom file name
|
||||
* @param array|null $config To add more data to the files info
|
||||
*
|
||||
* @return bool true on success
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function build(array $target, string $type,
|
||||
?string $fileName = null, ?array $config = null): bool
|
||||
{
|
||||
// did we build the files (any number)
|
||||
$build_status = false;
|
||||
|
||||
// check that we have the target values
|
||||
if (ArrayHelper::check($target))
|
||||
{
|
||||
// search the target
|
||||
foreach ($target as $main => $name)
|
||||
{
|
||||
// make sure it is lower case
|
||||
$name = StringHelper::safe($name);
|
||||
|
||||
// setup the files
|
||||
foreach ($this->settings->multiple()->{$main} as $item => $details)
|
||||
{
|
||||
if ($details->type === $type)
|
||||
{
|
||||
$file_details = $this->getFileDetails(
|
||||
$details,
|
||||
(string) $item,
|
||||
$name,
|
||||
$fileName,
|
||||
$config
|
||||
);
|
||||
|
||||
if (is_array($file_details))
|
||||
{
|
||||
// store the new files
|
||||
$this->files->appendArray('dynamic.' . $file_details['view'],
|
||||
$file_details);
|
||||
|
||||
// we have build at least one
|
||||
$build_status = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $build_status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the details
|
||||
*
|
||||
* @param object $details The item details
|
||||
* @param string $item The item name
|
||||
* @param string $name The given name
|
||||
* @param string|null $fileName The custom file name
|
||||
* @param array|null $config To add more data to the files info
|
||||
*
|
||||
* @return array|null The details
|
||||
* @since 3.2.0
|
||||
*/
|
||||
private function getFileDetails(object $details, string $item,
|
||||
string $name, ?string $fileName = null, ?array $config = null): ?array
|
||||
{
|
||||
$zip_path = '';
|
||||
if (($path = $this->getPath($details, $zip_path, $name)) === null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// setup the folder
|
||||
if (!Folder::exists($path))
|
||||
{
|
||||
Folder::create($path);
|
||||
$this->file->html($zip_path);
|
||||
|
||||
// count the folder created
|
||||
$this->counter->folder++;
|
||||
}
|
||||
|
||||
$new_name = $this->getNewName($details, $item, $name, $fileName);
|
||||
|
||||
if (!JoomlaFile::exists($path . '/' . $new_name))
|
||||
{
|
||||
// move the file to its place
|
||||
JoomlaFile::copy(
|
||||
$this->paths->template_path . '/' . $item,
|
||||
$path . '/' . $new_name
|
||||
);
|
||||
|
||||
// count the file created
|
||||
$this->counter->file++;
|
||||
}
|
||||
|
||||
// we can't have dots in a view name
|
||||
if (strpos($name, '.') !== false)
|
||||
{
|
||||
$name = preg_replace('/[\.]+/', '_', (string) $name);
|
||||
}
|
||||
|
||||
// setup array for new file
|
||||
$file = [
|
||||
'path' => $path . '/' . $new_name,
|
||||
'name' => $new_name,
|
||||
'view' => $name,
|
||||
'zip' => $zip_path . '/' . $new_name
|
||||
];
|
||||
|
||||
if (ArrayHelper::check($config))
|
||||
{
|
||||
$file['config'] = $config;
|
||||
}
|
||||
|
||||
return $file;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the path
|
||||
*
|
||||
* @param object $details The item details
|
||||
* @param string $zipPath The zip path
|
||||
* @param string $name The name
|
||||
*
|
||||
* @return string|null The path
|
||||
* @since 3.2.0
|
||||
*/
|
||||
private function getPath(object $details, string &$zipPath, string $name): ?string
|
||||
{
|
||||
// set destination path
|
||||
if (strpos((string) $details->path, 'VIEW') !== false)
|
||||
{
|
||||
$path = str_replace('VIEW', $name, (string) $details->path);
|
||||
}
|
||||
else
|
||||
{
|
||||
$path = $details->path;
|
||||
}
|
||||
|
||||
// make sure we have component to replace
|
||||
if (strpos((string) $path, 'c0mp0n3nt') !== false)
|
||||
{
|
||||
$zipPath = str_replace('c0mp0n3nt/', '', (string) $path);
|
||||
|
||||
return str_replace(
|
||||
'c0mp0n3nt/', $this->paths->component_path . '/', (string) $path
|
||||
);
|
||||
}
|
||||
|
||||
$this->app->enqueueMessage(
|
||||
Text::sprintf('COM_COMPONENTBUILDER_HR_HTHREECZEROMPZERONTHREENT_ISSUE_FOUNDHTHREEPTHE_PATH_S_COULD_NOT_BE_USEDP',
|
||||
$path
|
||||
), 'Error'
|
||||
);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the new name
|
||||
*
|
||||
* @param object $details The item details
|
||||
* @param string $item The item name
|
||||
* @param string $name The name
|
||||
* @param string|null $fileName The custom file name
|
||||
*
|
||||
* @return string The new name
|
||||
* @since 3.2.0
|
||||
*/
|
||||
private function getNewName(object $details, string $item,
|
||||
string &$name, ?string $fileName = null): string
|
||||
{
|
||||
// do the file need renaming
|
||||
if ($details->rename)
|
||||
{
|
||||
if (!empty($fileName))
|
||||
{
|
||||
$name = $name . '_' . $fileName;
|
||||
|
||||
return str_replace(
|
||||
$details->rename, $fileName, $item
|
||||
);
|
||||
}
|
||||
elseif ($details->rename === 'new')
|
||||
{
|
||||
return $details->newName;
|
||||
}
|
||||
|
||||
return str_replace(
|
||||
$details->rename, $name, $item
|
||||
);
|
||||
}
|
||||
|
||||
return $item;
|
||||
}
|
||||
|
||||
}
|
||||
|
50
src/1efdded5-d6c8-452c-8f37-0374483a7b3f/settings.json
Normal file
50
src/1efdded5-d6c8-452c-8f37-0374483a7b3f/settings.json
Normal file
@ -0,0 +1,50 @@
|
||||
{
|
||||
"add_head": "1",
|
||||
"extends": "0",
|
||||
"extends_custom": "JoomlaRegistry",
|
||||
"guid": "1efdded5-d6c8-452c-8f37-0374483a7b3f",
|
||||
"implements": null,
|
||||
"implements_custom": "",
|
||||
"load_selection": null,
|
||||
"name": "Structure",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "JCB.Compiler.Utilities.Structure",
|
||||
"type": "class",
|
||||
"use_selection": {
|
||||
"use_selection0": {
|
||||
"use": "d910d8b8-4c23-4f3e-8cda-438f2d2bd7ac",
|
||||
"as": "Compiler"
|
||||
},
|
||||
"use_selection1": {
|
||||
"use": "63dabe82-0f4a-4ade-9851-8518ade23de2",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection2": {
|
||||
"use": "6f20369a-8536-4870-a1a3-cda254c939c8",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection3": {
|
||||
"use": "e6d871a6-bbe7-497d-af01-68f6bb9a87f4",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection4": {
|
||||
"use": "5c75b455-3d4c-452a-867e-e90424a64c88",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection5": {
|
||||
"use": "1d967151-7c20-4ca7-9400-65233cdcd4db",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection6": {
|
||||
"use": "0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection7": {
|
||||
"use": "1f28cb53-60d9-4db1-b517-3c7dc6b429ef",
|
||||
"as": "default"
|
||||
}
|
||||
},
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder.Compiler.Utilities.Structure",
|
||||
"description": "Compiler Utilities To Build Structure\r\n\r\n@since 3.2.0",
|
||||
"head": "use Joomla\\CMS\\Factory;\r\nuse Joomla\\CMS\\Application\\CMSApplication;\r\nuse Joomla\\CMS\\Language\\Text;\r\nuse Joomla\\CMS\\Filesystem\\File as JoomlaFile;\r\nuse Joomla\\CMS\\Filesystem\\Folder;"
|
||||
}
|
37
src/1fcb13a2-f3f0-4fa8-b8c6-ff9dc546777a/README.md
Normal file
37
src/1fcb13a2-f3f0-4fa8-b8c6-ff9dc546777a/README.md
Normal file
@ -0,0 +1,37 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# interface ExternalInterface (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Compiler\Interfaces\Customcode**
|
||||
```uml
|
||||
@startuml
|
||||
interface ExternalInterface #Lavender {
|
||||
+ set(string $string, int $debug) : string
|
||||
}
|
||||
|
||||
note right of ExternalInterface::set
|
||||
Set the external code string & load it in to string
|
||||
|
||||
since: 3.2.0
|
||||
return: string
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
33
src/1fcb13a2-f3f0-4fa8-b8c6-ff9dc546777a/code.php
Normal file
33
src/1fcb13a2-f3f0-4fa8-b8c6-ff9dc546777a/code.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Compiler\Interfaces\Customcode;
|
||||
|
||||
|
||||
/**
|
||||
* Customcode External Interface
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
interface ExternalInterface
|
||||
{
|
||||
/**
|
||||
* Set the external code string & load it in to string
|
||||
*
|
||||
* @param string $string The content to check
|
||||
* @param int $debug The switch to debug the update
|
||||
*
|
||||
* @return string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function set(string $string, int $debug = 0): string;
|
||||
}
|
||||
|
16
src/1fcb13a2-f3f0-4fa8-b8c6-ff9dc546777a/settings.json
Normal file
16
src/1fcb13a2-f3f0-4fa8-b8c6-ff9dc546777a/settings.json
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"add_head": "0",
|
||||
"extends": "0",
|
||||
"extends_custom": "",
|
||||
"guid": "1fcb13a2-f3f0-4fa8-b8c6-ff9dc546777a",
|
||||
"implements": null,
|
||||
"implements_custom": "",
|
||||
"load_selection": null,
|
||||
"name": "ExternalInterface",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "JCB.Interfaces.Customcode.ExternalInterface",
|
||||
"type": "interface",
|
||||
"use_selection": null,
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder.Compiler.Interfaces.Customcode.ExternalInterface",
|
||||
"description": "Customcode External Interface\r\n\r\n@since 3.2.0"
|
||||
}
|
37
src/20ed72b0-fcac-4344-aee1-8a65e3bf221d/README.md
Normal file
37
src/20ed72b0-fcac-4344-aee1-8a65e3bf221d/README.md
Normal file
@ -0,0 +1,37 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# interface EventInterface (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Compiler\Interfaces**
|
||||
```uml
|
||||
@startuml
|
||||
interface EventInterface #Lavender {
|
||||
+ trigger(string $event, mixed $data) : void
|
||||
}
|
||||
|
||||
note right of EventInterface::trigger
|
||||
Trigger an event
|
||||
|
||||
since: 3.2.0
|
||||
return: void
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
33
src/20ed72b0-fcac-4344-aee1-8a65e3bf221d/code.php
Normal file
33
src/20ed72b0-fcac-4344-aee1-8a65e3bf221d/code.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Compiler\Interfaces;
|
||||
|
||||
|
||||
/**
|
||||
* Compiler Events Interface
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
interface EventInterface
|
||||
{
|
||||
/**
|
||||
* Trigger an event
|
||||
*
|
||||
* @param string $event The event to trigger
|
||||
* @param mixed $data The values to pass to the event/plugin
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function trigger(string $event, $data);
|
||||
}
|
||||
|
16
src/20ed72b0-fcac-4344-aee1-8a65e3bf221d/settings.json
Normal file
16
src/20ed72b0-fcac-4344-aee1-8a65e3bf221d/settings.json
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"add_head": "0",
|
||||
"extends": "0",
|
||||
"extends_custom": "Registry",
|
||||
"guid": "20ed72b0-fcac-4344-aee1-8a65e3bf221d",
|
||||
"implements": null,
|
||||
"implements_custom": "",
|
||||
"load_selection": null,
|
||||
"name": "EventInterface",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "JCB.Interfaces.EventInterface",
|
||||
"type": "interface",
|
||||
"use_selection": null,
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder.Compiler.Interfaces.EventInterface",
|
||||
"description": "Compiler Events Interface\r\n\r\n@since 3.2.0"
|
||||
}
|
45
src/23f2ca33-440a-4941-8e9a-4bc67522c0cb/README.md
Normal file
45
src/23f2ca33-440a-4941-8e9a-4bc67522c0cb/README.md
Normal file
@ -0,0 +1,45 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# class Mapper (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Compiler\Service**
|
||||
```uml
|
||||
@startuml
|
||||
class Mapper #Gold {
|
||||
+ register(Container $container) : void
|
||||
+ getContent(Container $container) : Content
|
||||
}
|
||||
|
||||
note right of Mapper::register
|
||||
Registers the service provider with a DI container.
|
||||
|
||||
since: 3.2.0
|
||||
return: void
|
||||
end note
|
||||
|
||||
note right of Mapper::getContent
|
||||
Get the Compiler Content
|
||||
|
||||
since: 3.2.0
|
||||
return: Content
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
55
src/23f2ca33-440a-4941-8e9a-4bc67522c0cb/code.php
Normal file
55
src/23f2ca33-440a-4941-8e9a-4bc67522c0cb/code.php
Normal file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Compiler\Service;
|
||||
|
||||
|
||||
use Joomla\DI\Container;
|
||||
use Joomla\DI\ServiceProviderInterface;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Content;
|
||||
|
||||
|
||||
/**
|
||||
* Mapper Service Provider
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
class Mapper implements ServiceProviderInterface
|
||||
{
|
||||
/**
|
||||
* Registers the service provider with a DI container.
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function register(Container $container)
|
||||
{
|
||||
$container->alias(Content::class, 'Content')
|
||||
->share('Content', [$this, 'getContent'], true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Compiler Content
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Content
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getContent(Container $container): Content
|
||||
{
|
||||
return new Content();
|
||||
}
|
||||
|
||||
}
|
||||
|
23
src/23f2ca33-440a-4941-8e9a-4bc67522c0cb/settings.json
Normal file
23
src/23f2ca33-440a-4941-8e9a-4bc67522c0cb/settings.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"add_head": "1",
|
||||
"extends": "0",
|
||||
"extends_custom": "Registry",
|
||||
"guid": "23f2ca33-440a-4941-8e9a-4bc67522c0cb",
|
||||
"implements": [
|
||||
"-1"
|
||||
],
|
||||
"load_selection": null,
|
||||
"name": "Mapper",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "JCB.Compiler.Service.Mapper",
|
||||
"type": "class",
|
||||
"use_selection": {
|
||||
"use_selection0": {
|
||||
"use": "adfbe68a-6d22-43e5-aee8-2787e8c47e75",
|
||||
"as": "default"
|
||||
}
|
||||
},
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder.Compiler.Service.Mapper",
|
||||
"description": "Mapper Service Provider\r\n\r\n@since 3.2.0",
|
||||
"head": "use Joomla\\DI\\Container;\r\nuse Joomla\\DI\\ServiceProviderInterface;"
|
||||
}
|
46
src/24da9672-e47f-4bb1-b6c0-0ebfc17f0957/README.md
Normal file
46
src/24da9672-e47f-4bb1-b6c0-0ebfc17f0957/README.md
Normal file
@ -0,0 +1,46 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# class CoreValidation (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Compiler\Field\JoomlaThree**
|
||||
```uml
|
||||
@startuml
|
||||
class CoreValidation #Gold {
|
||||
# ?array $rules
|
||||
# string $path
|
||||
+ __construct()
|
||||
+ get(bool $lowercase = false) : array
|
||||
}
|
||||
|
||||
note right of CoreValidation::__construct
|
||||
Constructor
|
||||
|
||||
since: 3.2.0
|
||||
end note
|
||||
|
||||
note right of CoreValidation::get
|
||||
Get the Array of Existing Validation Rule Names
|
||||
|
||||
since: 3.2.0
|
||||
return: array
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
116
src/24da9672-e47f-4bb1-b6c0-0ebfc17f0957/code.php
Normal file
116
src/24da9672-e47f-4bb1-b6c0-0ebfc17f0957/code.php
Normal file
@ -0,0 +1,116 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Compiler\Field\JoomlaThree;
|
||||
|
||||
|
||||
use Joomla\CMS\Filesystem\Folder;
|
||||
use VDM\Joomla\Utilities\ArrayHelper;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Field\CoreValidationInterface;
|
||||
|
||||
|
||||
/**
|
||||
* Core Joomla Field Validation Rules
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
class CoreValidation implements CoreValidationInterface
|
||||
{
|
||||
/**
|
||||
* Local Core Joomla Rules
|
||||
*
|
||||
* @var array|null
|
||||
* @since 3.2.0
|
||||
**/
|
||||
protected ?array $rules = null;
|
||||
|
||||
/**
|
||||
* Local Core Joomla Rules Path
|
||||
*
|
||||
* @var string
|
||||
* @since 3.2.0
|
||||
**/
|
||||
protected string $path;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
// set the path to the form validation rules
|
||||
$this->path = JPATH_LIBRARIES . '/src/Form/Rule';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Array of Existing Validation Rule Names
|
||||
*
|
||||
* @param bool $lowercase Switch to set rules lowercase
|
||||
*
|
||||
* @return array
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function get(bool $lowercase = false): array
|
||||
{
|
||||
if (!$this->rules)
|
||||
{
|
||||
// check if the path exist
|
||||
if (!Folder::exists($this->path))
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
// we must first store the current working directory
|
||||
$joomla = getcwd();
|
||||
|
||||
// go to that folder
|
||||
chdir($this->path);
|
||||
|
||||
// load all the files in this path
|
||||
$rules = Folder::files('.', '\.php', true, true);
|
||||
|
||||
// change back to Joomla working directory
|
||||
chdir($joomla);
|
||||
|
||||
// make sure we have an array
|
||||
if (!ArrayHelper::check($rules))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// remove the Rule.php from the name
|
||||
$this->rules = array_map(
|
||||
fn($name): string => str_replace(array('./','Rule.php'), '', (string) $name),
|
||||
$rules
|
||||
);
|
||||
}
|
||||
|
||||
// return rules if found
|
||||
if (is_array($this->rules))
|
||||
{
|
||||
// check if the names should be all lowercase
|
||||
if ($lowercase)
|
||||
{
|
||||
return array_map(
|
||||
fn($item): string => strtolower((string) $item),
|
||||
$this->rules
|
||||
);
|
||||
}
|
||||
return $this->rules;
|
||||
}
|
||||
|
||||
// return empty array
|
||||
return [];
|
||||
}
|
||||
|
||||
}
|
||||
|
24
src/24da9672-e47f-4bb1-b6c0-0ebfc17f0957/settings.json
Normal file
24
src/24da9672-e47f-4bb1-b6c0-0ebfc17f0957/settings.json
Normal file
@ -0,0 +1,24 @@
|
||||
{
|
||||
"add_head": "1",
|
||||
"extends": "0",
|
||||
"extends_custom": "",
|
||||
"guid": "24da9672-e47f-4bb1-b6c0-0ebfc17f0957",
|
||||
"implements": [
|
||||
"b9f05dc4-d23a-499a-a826-9749b81818ed"
|
||||
],
|
||||
"implements_custom": "",
|
||||
"load_selection": null,
|
||||
"name": "CoreValidation",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "JCB.Compiler.Field.JoomlaThree.CoreValidation",
|
||||
"type": "class",
|
||||
"use_selection": {
|
||||
"use_selection0": {
|
||||
"use": "0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a",
|
||||
"as": "default"
|
||||
}
|
||||
},
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder.Compiler.Field.JoomlaThree.CoreValidation",
|
||||
"description": "Core Joomla Field Validation Rules\r\n\r\n@since 3.2.0",
|
||||
"head": "use Joomla\\CMS\\Filesystem\\Folder;"
|
||||
}
|
53
src/253317c7-3c3b-48a0-aec8-8af5e7a86504/README.md
Normal file
53
src/253317c7-3c3b-48a0-aec8-8af5e7a86504/README.md
Normal file
@ -0,0 +1,53 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# class Library (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Compiler\Service**
|
||||
```uml
|
||||
@startuml
|
||||
class Library #Gold {
|
||||
+ register(Container $container) : void
|
||||
+ getData(Container $container) : Data
|
||||
+ getStructure(Container $container) : Structure
|
||||
}
|
||||
|
||||
note right of Library::register
|
||||
Registers the service provider with a DI container.
|
||||
|
||||
since: 3.2.0
|
||||
return: void
|
||||
end note
|
||||
|
||||
note right of Library::getData
|
||||
Get the Compiler Library Data
|
||||
|
||||
since: 3.2.0
|
||||
return: Data
|
||||
end note
|
||||
|
||||
note right of Library::getStructure
|
||||
Get the Compiler Library Structure Builder
|
||||
|
||||
since: 3.2.0
|
||||
return: Structure
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
89
src/253317c7-3c3b-48a0-aec8-8af5e7a86504/code.php
Normal file
89
src/253317c7-3c3b-48a0-aec8-8af5e7a86504/code.php
Normal file
@ -0,0 +1,89 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Compiler\Service;
|
||||
|
||||
|
||||
use Joomla\DI\Container;
|
||||
use Joomla\DI\ServiceProviderInterface;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Library\Data;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Library\Structure;
|
||||
|
||||
|
||||
/**
|
||||
* Compiler Library
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
class Library implements ServiceProviderInterface
|
||||
{
|
||||
/**
|
||||
* Registers the service provider with a DI container.
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function register(Container $container)
|
||||
{
|
||||
$container->alias(Data::class, 'Library.Data')
|
||||
->share('Library.Data', [$this, 'getData'], true);
|
||||
|
||||
$container->alias(Structure::class, 'Library.Structure')
|
||||
->share('Library.Structure', [$this, 'getStructure'], true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Compiler Library Data
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Data
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getData(Container $container): Data
|
||||
{
|
||||
return new Data(
|
||||
$container->get('Config'),
|
||||
$container->get('Registry'),
|
||||
$container->get('Customcode'),
|
||||
$container->get('Customcode.Gui'),
|
||||
$container->get('Field.Data'),
|
||||
$container->get('Model.Filesfolders')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Compiler Library Structure Builder
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Structure
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getStructure(Container $container): Structure
|
||||
{
|
||||
return new Structure(
|
||||
$container->get('Config'),
|
||||
$container->get('Registry'),
|
||||
$container->get('Event'),
|
||||
$container->get('Component'),
|
||||
$container->get('Content'),
|
||||
$container->get('Utilities.Counter'),
|
||||
$container->get('Utilities.Paths'),
|
||||
$container->get('Utilities.Folder'),
|
||||
$container->get('Utilities.File')
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
27
src/253317c7-3c3b-48a0-aec8-8af5e7a86504/settings.json
Normal file
27
src/253317c7-3c3b-48a0-aec8-8af5e7a86504/settings.json
Normal file
@ -0,0 +1,27 @@
|
||||
{
|
||||
"add_head": "1",
|
||||
"extends": "0",
|
||||
"extends_custom": "",
|
||||
"guid": "253317c7-3c3b-48a0-aec8-8af5e7a86504",
|
||||
"implements": [
|
||||
"-1"
|
||||
],
|
||||
"load_selection": null,
|
||||
"name": "Library",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "JCB.Compiler.Service.Library",
|
||||
"type": "class",
|
||||
"use_selection": {
|
||||
"use_selection0": {
|
||||
"use": "7175c1cd-2071-4cd7-b499-23881e168c3f",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection1": {
|
||||
"use": "d3ce5763-4d00-4245-a175-54fc2e80e9b7",
|
||||
"as": "default"
|
||||
}
|
||||
},
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder.Compiler.Service.Library",
|
||||
"description": "Compiler Library\r\n\r\n@since 3.2.0",
|
||||
"head": "use Joomla\\DI\\Container;\r\nuse Joomla\\DI\\ServiceProviderInterface;"
|
||||
}
|
46
src/268b85ef-49f3-4c39-8187-bb12e38d19ee/README.md
Normal file
46
src/268b85ef-49f3-4c39-8187-bb12e38d19ee/README.md
Normal file
@ -0,0 +1,46 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# class Dynamicpath (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Compiler\Utilities**
|
||||
```uml
|
||||
@startuml
|
||||
class Dynamicpath #Gold {
|
||||
# Placeholder $placeholder
|
||||
# array $paths
|
||||
+ __construct(?Placeholder $placeholder = null, ?Constantpaths $paths = null)
|
||||
+ update(string $path) : string
|
||||
}
|
||||
|
||||
note right of Dynamicpath::__construct
|
||||
Constructor.
|
||||
|
||||
since: 3.2.0
|
||||
end note
|
||||
|
||||
note right of Dynamicpath::update
|
||||
Update path with dynamic value
|
||||
|
||||
since: 3.2.0
|
||||
return: string
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
78
src/268b85ef-49f3-4c39-8187-bb12e38d19ee/code.php
Normal file
78
src/268b85ef-49f3-4c39-8187-bb12e38d19ee/code.php
Normal file
@ -0,0 +1,78 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Compiler\Utilities;
|
||||
|
||||
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Factory as Compiler;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Placeholder;
|
||||
use VDM\Joomla\Componentbuilder\Utilities\Constantpaths;
|
||||
|
||||
|
||||
/**
|
||||
* Compiler Utilities Dynamic Path
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
class Dynamicpath
|
||||
{
|
||||
/**
|
||||
* Compiler Placeholder
|
||||
*
|
||||
* @var Placeholder
|
||||
* @since 3.2.0
|
||||
**/
|
||||
protected Placeholder $placeholder;
|
||||
|
||||
/**
|
||||
* Constant Paths
|
||||
*
|
||||
* @var array
|
||||
* @since 3.2.0
|
||||
**/
|
||||
protected array $paths;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param Placeholder|null $placeholder The Compiler Placeholder object.
|
||||
* @param Constantpaths|null $paths The Constant Paths object.
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function __construct(?Placeholder $placeholder = null, ?Constantpaths $paths = null)
|
||||
{
|
||||
$this->placeholder = $placeholder ?: Compiler::_('Placeholder');
|
||||
$paths = $paths ?: Compiler::_('Utilities.Constantpaths');
|
||||
|
||||
// load the constant paths
|
||||
$this->paths = $paths->get();
|
||||
}
|
||||
|
||||
/**
|
||||
* Update path with dynamic value
|
||||
*
|
||||
* @param string $path The path to update
|
||||
*
|
||||
* @return string The updated path
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function update(string $path): string
|
||||
{
|
||||
return $this->placeholder->update_(
|
||||
$this->placeholder->update(
|
||||
$path, $this->paths
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
29
src/268b85ef-49f3-4c39-8187-bb12e38d19ee/settings.json
Normal file
29
src/268b85ef-49f3-4c39-8187-bb12e38d19ee/settings.json
Normal file
@ -0,0 +1,29 @@
|
||||
{
|
||||
"add_head": "0",
|
||||
"extends": "0",
|
||||
"extends_custom": "JoomlaRegistry",
|
||||
"guid": "268b85ef-49f3-4c39-8187-bb12e38d19ee",
|
||||
"implements": null,
|
||||
"implements_custom": "",
|
||||
"load_selection": null,
|
||||
"name": "Dynamicpath",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "JCB.Compiler.Utilities.Dynamicpath",
|
||||
"type": "class",
|
||||
"use_selection": {
|
||||
"use_selection0": {
|
||||
"use": "d910d8b8-4c23-4f3e-8cda-438f2d2bd7ac",
|
||||
"as": "Compiler"
|
||||
},
|
||||
"use_selection1": {
|
||||
"use": "06453ada-e370-49f0-b262-e3f5a8ed0c2c",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection2": {
|
||||
"use": "e0c8c931-52a0-4171-9909-e8769505bb1f",
|
||||
"as": "default"
|
||||
}
|
||||
},
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder.Compiler.Utilities.Dynamicpath",
|
||||
"description": "Compiler Utilities Dynamic Path\r\n\r\n@since 3.2.0"
|
||||
}
|
48
src/29455d3b-df2b-4e41-8684-1608060e37a4/README.md
Normal file
48
src/29455d3b-df2b-4e41-8684-1608060e37a4/README.md
Normal file
@ -0,0 +1,48 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# class Javascriptcustomview (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Compiler\Model**
|
||||
```uml
|
||||
@startuml
|
||||
class Javascriptcustomview #Gold {
|
||||
# array $areas
|
||||
# array $guiMapper
|
||||
# Customcode $customcode
|
||||
# Gui $gui
|
||||
+ __construct(?Customcode $customcode = null, ?Gui $gui = null)
|
||||
+ set(object $item, string $table = 'site_view') : void
|
||||
}
|
||||
|
||||
note right of Javascriptcustomview::__construct
|
||||
Constructor
|
||||
|
||||
since: 3.2.0
|
||||
end note
|
||||
|
||||
note right of Javascriptcustomview::set
|
||||
Set Javascript code
|
||||
|
||||
since: 3.2.0
|
||||
return: void
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
116
src/29455d3b-df2b-4e41-8684-1608060e37a4/code.php
Normal file
116
src/29455d3b-df2b-4e41-8684-1608060e37a4/code.php
Normal file
@ -0,0 +1,116 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Compiler\Model;
|
||||
|
||||
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Factory as Compiler;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Customcode;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Customcode\Gui;
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
|
||||
|
||||
/**
|
||||
* Model Javascript Custom View Class
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
class Javascriptcustomview
|
||||
{
|
||||
/**
|
||||
* The areas add array
|
||||
*
|
||||
* @var array
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected array $areas = [
|
||||
'javascript_file',
|
||||
'js_document'
|
||||
];
|
||||
|
||||
/**
|
||||
* The gui mapper array
|
||||
*
|
||||
* @var array
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected array $guiMapper = [
|
||||
'table' => null,
|
||||
'id' => null,
|
||||
'field' => null,
|
||||
'type' => 'js'
|
||||
];
|
||||
|
||||
/**
|
||||
* Compiler Customcode
|
||||
*
|
||||
* @var Customcode
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Customcode $customcode;
|
||||
|
||||
/**
|
||||
* Compiler Customcode in Gui
|
||||
*
|
||||
* @var Gui
|
||||
* @since 3.2.0
|
||||
**/
|
||||
protected Gui $gui;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param Customcode|null $customcode The compiler customcode object.
|
||||
* @param Gui|null $gui The compiler customcode gui.
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function __construct(?Customcode $customcode = null, ?Gui $gui = null)
|
||||
{
|
||||
$this->customcode = $customcode ?: Compiler::_('Customcode');
|
||||
$this->gui = $gui ?: Compiler::_('Customcode.Gui');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Javascript code
|
||||
*
|
||||
* @param object $item The item data
|
||||
* @param string $table The table
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function set(object &$item, string $table = 'site_view')
|
||||
{
|
||||
// set some gui mapper values
|
||||
$this->guiMapper['table'] = $table;
|
||||
$this->guiMapper['id'] = (int) $item->id;
|
||||
|
||||
foreach ($this->areas as $area)
|
||||
{
|
||||
if (isset($item->{'add_' . $area})
|
||||
&& $item->{'add_' . $area} == 1
|
||||
&& StringHelper::check($item->{$area}))
|
||||
{
|
||||
// update GUI mapper field
|
||||
$this->guiMapper['field'] = $area;
|
||||
$item->{$area} = $this->gui->set(
|
||||
$this->customcode->update(
|
||||
base64_decode((string) $item->{$area})
|
||||
),
|
||||
$this->guiMapper
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
33
src/29455d3b-df2b-4e41-8684-1608060e37a4/settings.json
Normal file
33
src/29455d3b-df2b-4e41-8684-1608060e37a4/settings.json
Normal file
@ -0,0 +1,33 @@
|
||||
{
|
||||
"add_head": "0",
|
||||
"extends": "0",
|
||||
"extends_custom": "",
|
||||
"guid": "29455d3b-df2b-4e41-8684-1608060e37a4",
|
||||
"implements": null,
|
||||
"implements_custom": "",
|
||||
"load_selection": null,
|
||||
"name": "Javascriptcustomview",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "JCB.Compiler.Model.Javascriptcustomview",
|
||||
"type": "class",
|
||||
"use_selection": {
|
||||
"use_selection0": {
|
||||
"use": "d910d8b8-4c23-4f3e-8cda-438f2d2bd7ac",
|
||||
"as": "Compiler"
|
||||
},
|
||||
"use_selection1": {
|
||||
"use": "313b43c4-98c3-4f62-9177-2d73ec8eba31",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection2": {
|
||||
"use": "1bd48df2-4f7e-4581-9fe9-4b54e59105e3",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection3": {
|
||||
"use": "1f28cb53-60d9-4db1-b517-3c7dc6b429ef",
|
||||
"as": "default"
|
||||
}
|
||||
},
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder.Compiler.Model.Javascriptcustomview",
|
||||
"description": "Model Javascript Custom View Class\r\n\r\n@since 3.2.0"
|
||||
}
|
53
src/295186de-5954-4a65-a4c1-2f79ef305743/README.md
Normal file
53
src/295186de-5954-4a65-a4c1-2f79ef305743/README.md
Normal file
@ -0,0 +1,53 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# class Joomlamodule (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Compiler\Service**
|
||||
```uml
|
||||
@startuml
|
||||
class Joomlamodule #Gold {
|
||||
+ register(Container $container) : void
|
||||
+ getData(Container $container) : Data
|
||||
+ getStructure(Container $container) : Structure
|
||||
}
|
||||
|
||||
note right of Joomlamodule::register
|
||||
Registers the service provider with a DI container.
|
||||
|
||||
since: 3.2.0
|
||||
return: void
|
||||
end note
|
||||
|
||||
note right of Joomlamodule::getData
|
||||
Get the Joomla Module Data
|
||||
|
||||
since: 3.2.0
|
||||
return: Data
|
||||
end note
|
||||
|
||||
note right of Joomlamodule::getStructure
|
||||
Get the Joomla Module Structure Builder
|
||||
|
||||
since: 3.2.0
|
||||
return: Structure
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
94
src/295186de-5954-4a65-a4c1-2f79ef305743/code.php
Normal file
94
src/295186de-5954-4a65-a4c1-2f79ef305743/code.php
Normal file
@ -0,0 +1,94 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Compiler\Service;
|
||||
|
||||
|
||||
use Joomla\DI\Container;
|
||||
use Joomla\DI\ServiceProviderInterface;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Joomlamodule\Data;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Joomlamodule\Structure;
|
||||
|
||||
|
||||
/**
|
||||
* Joomla Module Service Provider
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
class Joomlamodule implements ServiceProviderInterface
|
||||
{
|
||||
/**
|
||||
* Registers the service provider with a DI container.
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function register(Container $container)
|
||||
{
|
||||
$container->alias(Data::class, 'Joomlamodule.Data')
|
||||
->share('Joomlamodule.Data', [$this, 'getData'], true);
|
||||
|
||||
$container->alias(Structure::class, 'Joomlamodule.Structure')
|
||||
->share('Joomlamodule.Structure', [$this, 'getStructure'], true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Joomla Module Data
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Data
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getData(Container $container): Data
|
||||
{
|
||||
return new Data(
|
||||
$container->get('Config'),
|
||||
$container->get('Customcode'),
|
||||
$container->get('Customcode.Gui'),
|
||||
$container->get('Placeholder'),
|
||||
$container->get('Language'),
|
||||
$container->get('Field'),
|
||||
$container->get('Field.Name'),
|
||||
$container->get('Model.Filesfolders'),
|
||||
$container->get('Model.Libraries'),
|
||||
$container->get('Dynamicget.Data')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Joomla Module Structure Builder
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Structure
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getStructure(Container $container): Structure
|
||||
{
|
||||
return new Structure(
|
||||
$container->get('Joomlamodule.Data'),
|
||||
$container->get('Component'),
|
||||
$container->get('Config'),
|
||||
$container->get('Registry'),
|
||||
$container->get('Customcode.Dispenser'),
|
||||
$container->get('Event'),
|
||||
$container->get('Utilities.Counter'),
|
||||
$container->get('Utilities.Folder'),
|
||||
$container->get('Utilities.File'),
|
||||
$container->get('Utilities.Files')
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
27
src/295186de-5954-4a65-a4c1-2f79ef305743/settings.json
Normal file
27
src/295186de-5954-4a65-a4c1-2f79ef305743/settings.json
Normal file
@ -0,0 +1,27 @@
|
||||
{
|
||||
"add_head": "1",
|
||||
"extends": "0",
|
||||
"extends_custom": "",
|
||||
"guid": "295186de-5954-4a65-a4c1-2f79ef305743",
|
||||
"implements": [
|
||||
"-1"
|
||||
],
|
||||
"load_selection": null,
|
||||
"name": "Joomlamodule",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "JCB.Compiler.Service.Joomlamodule",
|
||||
"type": "class",
|
||||
"use_selection": {
|
||||
"use_selection0": {
|
||||
"use": "cb11e8d9-69c2-4095-831c-59908ea402e7",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection1": {
|
||||
"use": "071c7cff-4c88-4b80-bd99-066c572dcb71",
|
||||
"as": "default"
|
||||
}
|
||||
},
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder.Compiler.Service.Joomlamodule",
|
||||
"description": "Joomla Module Service Provider\r\n\r\n@since 3.2.0",
|
||||
"head": "use Joomla\\DI\\Container;\r\nuse Joomla\\DI\\ServiceProviderInterface;"
|
||||
}
|
101
src/2ad31f74-f579-499d-b98b-c4f54fd615dd/README.md
Normal file
101
src/2ad31f74-f579-499d-b98b-c4f54fd615dd/README.md
Normal file
@ -0,0 +1,101 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# interface LoadInterface (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Interfaces**
|
||||
```uml
|
||||
@startuml
|
||||
interface LoadInterface #Lavender {
|
||||
+ rows(array $select, array $tables, ...) : ?array
|
||||
+ items(array $select, array $tables, ...) : ?array
|
||||
+ row(array $select, array $tables, ...) : ?array
|
||||
+ item(array $select, array $tables, ...) : ?object
|
||||
+ value(array $select, array $tables, ...) : mixed
|
||||
}
|
||||
|
||||
note right of LoadInterface::rows
|
||||
Load data rows as an array of associated arrays
|
||||
|
||||
since: 3.2.0
|
||||
return: ?array
|
||||
|
||||
arguments:
|
||||
array $select
|
||||
array $tables
|
||||
?array $where = null
|
||||
?array $order = null
|
||||
?int $limit = null
|
||||
end note
|
||||
|
||||
note right of LoadInterface::items
|
||||
Load data rows as an array of objects
|
||||
|
||||
since: 3.2.0
|
||||
return: ?array
|
||||
|
||||
arguments:
|
||||
array $select
|
||||
array $tables
|
||||
?array $where = null
|
||||
?array $order = null
|
||||
?int $limit = null
|
||||
end note
|
||||
|
||||
note right of LoadInterface::row
|
||||
Load data row as an associated array
|
||||
|
||||
since: 3.2.0
|
||||
return: ?array
|
||||
|
||||
arguments:
|
||||
array $select
|
||||
array $tables
|
||||
?array $where = null
|
||||
?array $order = null
|
||||
end note
|
||||
|
||||
note right of LoadInterface::item
|
||||
Load data row as an object
|
||||
|
||||
since: 3.2.0
|
||||
return: ?object
|
||||
|
||||
arguments:
|
||||
array $select
|
||||
array $tables
|
||||
?array $where = null
|
||||
?array $order = null
|
||||
end note
|
||||
|
||||
note right of LoadInterface::value
|
||||
Load one value from a row
|
||||
|
||||
since: 3.2.0
|
||||
return: mixed
|
||||
|
||||
arguments:
|
||||
array $select
|
||||
array $tables
|
||||
?array $where = null
|
||||
?array $order = null
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
92
src/2ad31f74-f579-499d-b98b-c4f54fd615dd/code.php
Normal file
92
src/2ad31f74-f579-499d-b98b-c4f54fd615dd/code.php
Normal file
@ -0,0 +1,92 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Interfaces;
|
||||
|
||||
|
||||
/**
|
||||
* Database Load Interface
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
interface LoadInterface
|
||||
{
|
||||
/**
|
||||
* Load data rows as an array of associated arrays
|
||||
*
|
||||
* @param array $select Array of selection keys
|
||||
* @param array $tables Array of tables to search
|
||||
* @param array|null $where Array of where key=>value match exist
|
||||
* @param array|null $order Array of how to order the data
|
||||
* @param int|null $limit Limit the number of values returned
|
||||
*
|
||||
* @return array|null
|
||||
* @since 3.2.0
|
||||
**/
|
||||
public function rows(array $select, array $tables, ?array $where = null,
|
||||
?array $order = null, ?int $limit = null): ?array;
|
||||
|
||||
/**
|
||||
* Load data rows as an array of objects
|
||||
*
|
||||
* @param array $select Array of selection keys
|
||||
* @param array $tables Array of tables to search
|
||||
* @param array|null $where Array of where key=>value match exist
|
||||
* @param array|null $order Array of how to order the data
|
||||
* @param int|null $limit Limit the number of values returned
|
||||
*
|
||||
* @return array|null
|
||||
* @since 3.2.0
|
||||
**/
|
||||
public function items(array $select, array $tables, ?array $where = null,
|
||||
?array $order = null, ?int $limit = null): ?array;
|
||||
|
||||
/**
|
||||
* Load data row as an associated array
|
||||
*
|
||||
* @param array $select Array of selection keys
|
||||
* @param array $tables Array of tables to search
|
||||
* @param array|null $where Array of where key=>value match exist
|
||||
* @param array|null $order Array of how to order the data
|
||||
*
|
||||
* @return array|null
|
||||
* @since 3.2.0
|
||||
**/
|
||||
public function row(array $select, array $tables, ?array $where = null, ?array $order = null): ?array;
|
||||
|
||||
/**
|
||||
* Load data row as an object
|
||||
*
|
||||
* @param array $select Array of selection keys
|
||||
* @param array $tables Array of tables to search
|
||||
* @param array|null $where Array of where key=>value match exist
|
||||
* @param array|null $order Array of how to order the data
|
||||
*
|
||||
* @return object|null
|
||||
* @since 3.2.0
|
||||
**/
|
||||
public function item(array $select, array $tables, ?array $where = null, ?array $order = null): ?object;
|
||||
|
||||
/**
|
||||
* Load one value from a row
|
||||
*
|
||||
* @param array $select Array of selection keys
|
||||
* @param array $tables Array of tables to search
|
||||
* @param array|null $where Array of where key=>value match exist
|
||||
* @param array|null $order Array of how to order the data
|
||||
*
|
||||
* @return mixed
|
||||
* @since 3.2.0
|
||||
**/
|
||||
public function value(array $select, array $tables, ?array $where = null, ?array $order = null);
|
||||
|
||||
}
|
||||
|
16
src/2ad31f74-f579-499d-b98b-c4f54fd615dd/settings.json
Normal file
16
src/2ad31f74-f579-499d-b98b-c4f54fd615dd/settings.json
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"add_head": "0",
|
||||
"extends": "0",
|
||||
"extends_custom": "",
|
||||
"guid": "2ad31f74-f579-499d-b98b-c4f54fd615dd",
|
||||
"implements": null,
|
||||
"implements_custom": "",
|
||||
"load_selection": null,
|
||||
"name": "LoadInterface",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "JCB.Interfaces.LoadInterface",
|
||||
"type": "interface",
|
||||
"use_selection": null,
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder.Interfaces.LoadInterface",
|
||||
"description": "Database Load Interface\r\n\r\n@since 3.2.0"
|
||||
}
|
37
src/2b5c9989-1d4e-4f59-8b95-5cd2f72f82d9/README.md
Normal file
37
src/2b5c9989-1d4e-4f59-8b95-5cd2f72f82d9/README.md
Normal file
@ -0,0 +1,37 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# class Mysql (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Compiler\Builder\Update**
|
||||
```uml
|
||||
@startuml
|
||||
class Mysql #Gold {
|
||||
# key(string $key) : string
|
||||
}
|
||||
|
||||
note right of Mysql::key
|
||||
Model the key
|
||||
|
||||
since: 3.2.0
|
||||
return: string
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
40
src/2b5c9989-1d4e-4f59-8b95-5cd2f72f82d9/code.php
Normal file
40
src/2b5c9989-1d4e-4f59-8b95-5cd2f72f82d9/code.php
Normal file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Compiler\Builder\Update;
|
||||
|
||||
|
||||
use VDM\Joomla\Componentbuilder\Interfaces\Mappersingleinterface;
|
||||
use VDM\Joomla\Componentbuilder\Abstraction\MapperSingle;
|
||||
|
||||
|
||||
/**
|
||||
* Compiler Builder Update Mysql
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
class Mysql extends MapperSingle implements Mappersingleinterface
|
||||
{
|
||||
/**
|
||||
* Model the key
|
||||
*
|
||||
* @param string $key The key to model
|
||||
*
|
||||
* @return string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function key(string $key): string
|
||||
{
|
||||
return preg_replace('/\s+/', '', $key);
|
||||
}
|
||||
|
||||
}
|
||||
|
18
src/2b5c9989-1d4e-4f59-8b95-5cd2f72f82d9/settings.json
Normal file
18
src/2b5c9989-1d4e-4f59-8b95-5cd2f72f82d9/settings.json
Normal file
@ -0,0 +1,18 @@
|
||||
{
|
||||
"add_head": "0",
|
||||
"extends": "c6bbc3ee-58e7-4463-adba-5c5ae839ee36",
|
||||
"extends_custom": "JoomlaRegistry",
|
||||
"guid": "2b5c9989-1d4e-4f59-8b95-5cd2f72f82d9",
|
||||
"implements": [
|
||||
"78527c29-24ad-4735-ad4c-ec33a4952d9b"
|
||||
],
|
||||
"implements_custom": "",
|
||||
"load_selection": null,
|
||||
"name": "Mysql",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "JCB.Compiler.Builder.Update.Mysql",
|
||||
"type": "class",
|
||||
"use_selection": null,
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder.Compiler.Builder.Update.Mysql",
|
||||
"description": "Compiler Builder Update Mysql\r\n\r\n@since 3.2.0"
|
||||
}
|
45
src/2c76c06e-a371-4b73-9fbe-b4d9b4df55d7/README.md
Normal file
45
src/2c76c06e-a371-4b73-9fbe-b4d9b4df55d7/README.md
Normal file
@ -0,0 +1,45 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# class Builder (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Compiler\Service**
|
||||
```uml
|
||||
@startuml
|
||||
class Builder #Gold {
|
||||
+ register(Container $container) : void
|
||||
+ getMysql(Container $container) : Mysql
|
||||
}
|
||||
|
||||
note right of Builder::register
|
||||
Registers the service provider with a DI container.
|
||||
|
||||
since: 3.2.0
|
||||
return: void
|
||||
end note
|
||||
|
||||
note right of Builder::getMysql
|
||||
Get the Compiler Builder Mysql
|
||||
|
||||
since: 3.2.0
|
||||
return: Mysql
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
55
src/2c76c06e-a371-4b73-9fbe-b4d9b4df55d7/code.php
Normal file
55
src/2c76c06e-a371-4b73-9fbe-b4d9b4df55d7/code.php
Normal file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Compiler\Service;
|
||||
|
||||
|
||||
use Joomla\DI\Container;
|
||||
use Joomla\DI\ServiceProviderInterface;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Builder\Update\Mysql;
|
||||
|
||||
|
||||
/**
|
||||
* Builder Service Provider
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
class Builder implements ServiceProviderInterface
|
||||
{
|
||||
/**
|
||||
* Registers the service provider with a DI container.
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function register(Container $container)
|
||||
{
|
||||
$container->alias(Mysql::class, 'Builder.Update.Mysql')
|
||||
->share('Builder.Update.Mysql', [$this, 'getMysql'], true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Compiler Builder Mysql
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Mysql
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getMysql(Container $container): Mysql
|
||||
{
|
||||
return new Mysql();
|
||||
}
|
||||
|
||||
}
|
||||
|
23
src/2c76c06e-a371-4b73-9fbe-b4d9b4df55d7/settings.json
Normal file
23
src/2c76c06e-a371-4b73-9fbe-b4d9b4df55d7/settings.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"add_head": "1",
|
||||
"extends": "0",
|
||||
"extends_custom": "Registry",
|
||||
"guid": "2c76c06e-a371-4b73-9fbe-b4d9b4df55d7",
|
||||
"implements": [
|
||||
"-1"
|
||||
],
|
||||
"load_selection": null,
|
||||
"name": "Builder",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "JCB.Compiler.Service.Builder",
|
||||
"type": "class",
|
||||
"use_selection": {
|
||||
"use_selection0": {
|
||||
"use": "2b5c9989-1d4e-4f59-8b95-5cd2f72f82d9",
|
||||
"as": "default"
|
||||
}
|
||||
},
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder.Compiler.Service.Builder",
|
||||
"description": "Builder Service Provider\r\n\r\n@since 3.2.0",
|
||||
"head": "use Joomla\\DI\\Container;\r\nuse Joomla\\DI\\ServiceProviderInterface;"
|
||||
}
|
51
src/2cc8517d-1105-4697-9743-048b4b7c089c/README.md
Normal file
51
src/2cc8517d-1105-4697-9743-048b4b7c089c/README.md
Normal file
@ -0,0 +1,51 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# interface GuiInterface (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Compiler\Interfaces\Customcode**
|
||||
```uml
|
||||
@startuml
|
||||
interface GuiInterface #Lavender {
|
||||
+ set(string $string, array $config) : string
|
||||
+ search(string $file, array $placeholders, ...) : void
|
||||
}
|
||||
|
||||
note right of GuiInterface::set
|
||||
Set the JCB GUI code placeholder
|
||||
|
||||
since: 3.2.0
|
||||
return: string
|
||||
end note
|
||||
|
||||
note right of GuiInterface::search
|
||||
search a file for gui code blocks that were updated in the IDE
|
||||
|
||||
since: 3.2.0
|
||||
return: void
|
||||
|
||||
arguments:
|
||||
string $file
|
||||
array $placeholders
|
||||
string $today
|
||||
string $target
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
46
src/2cc8517d-1105-4697-9743-048b4b7c089c/code.php
Normal file
46
src/2cc8517d-1105-4697-9743-048b4b7c089c/code.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Compiler\Interfaces\Customcode;
|
||||
|
||||
|
||||
/**
|
||||
* Customcode Gui Interface
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
interface GuiInterface
|
||||
{
|
||||
/**
|
||||
* Set the JCB GUI code placeholder
|
||||
*
|
||||
* @param string $string The code string
|
||||
* @param array $config The placeholder config values
|
||||
*
|
||||
* @return string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function set(string $string, array $config): string;
|
||||
|
||||
/**
|
||||
* search a file for gui code blocks that were updated in the IDE
|
||||
*
|
||||
* @param string $file The file path to search
|
||||
* @param array $placeholders The values to replace in the code being stored
|
||||
* @param string $today The date for today
|
||||
* @param string $target The target path type
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function search(string &$file, array &$placeholders, string &$today, string &$target);
|
||||
}
|
||||
|
16
src/2cc8517d-1105-4697-9743-048b4b7c089c/settings.json
Normal file
16
src/2cc8517d-1105-4697-9743-048b4b7c089c/settings.json
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"add_head": "0",
|
||||
"extends": "0",
|
||||
"extends_custom": "",
|
||||
"guid": "2cc8517d-1105-4697-9743-048b4b7c089c",
|
||||
"implements": null,
|
||||
"implements_custom": "",
|
||||
"load_selection": null,
|
||||
"name": "GuiInterface",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "JCB.Interfaces.Customcode.GuiInterface",
|
||||
"type": "interface",
|
||||
"use_selection": null,
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder.Compiler.Interfaces.Customcode.GuiInterface",
|
||||
"description": "Customcode Gui Interface\r\n\r\n@since 3.2.0"
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user