Release of v3.2.3-alpha3
Fix database mySql update in J4+. Remove phpspreadsheet completely from Joomla 4+. Add option to use powers in preflight event in the installer class.
This commit is contained in:
parent
c55fc67db4
commit
51e786a197
15
CHANGELOG.md
15
CHANGELOG.md
@ -1,9 +1,8 @@
|
||||
# v3.2.3-alpha2
|
||||
# v3.2.3-alpha3
|
||||
|
||||
- Fix missing scripts and styles fields and methods in the site admin view model
|
||||
- Update subform field layout across JCB for cleaner look
|
||||
- Remove expansion feature
|
||||
- Fix helper area
|
||||
- Fix database mySql update in J4+
|
||||
- Remove phpspreadsheet completely from Joomla 4+
|
||||
- Add option to use powers in preflight event in the installer class
|
||||
|
||||
# v3.2.3-alpha
|
||||
|
||||
@ -11,7 +10,11 @@
|
||||
- Fix permissions tab in items in J4+
|
||||
- Fix site display controller checkEditId function in J4+
|
||||
- Add class methods to the HtmlView classes in J4+
|
||||
- Fix broken toolbar call in HtmlView in J4+
|
||||
- Fix broken toolbar call in HtmlView in J4+
|
||||
- Fix missing scripts and styles fields and methods in the site admin view model
|
||||
- Update subform field layout across JCB for cleaner look
|
||||
- Remove expansion feature
|
||||
- Fix helper area
|
||||
|
||||
# v3.2.2
|
||||
|
||||
|
10
README.md
10
README.md
@ -9,7 +9,7 @@ The Component Builder for [Joomla](https://extensions.joomla.org/extension/compo
|
||||
|
||||
Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will save you lots of time and money. A real must have!
|
||||
|
||||
You can install it quite easily and with no limitations. On [gitea](https://git.vdm.dev/joomla/Component-Builder/tags) is the latest release (3.2.3-alpha2) with **ALL** its features and **ALL** concepts totally open-source and free!
|
||||
You can install it quite easily and with no limitations. On [gitea](https://git.vdm.dev/joomla/Component-Builder/tags) is the latest release (3.2.3-alpha3) with **ALL** its features and **ALL** concepts totally open-source and free!
|
||||
|
||||
> Watch Quick Build of a Hello World component in [JCB on Youtube](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45)
|
||||
|
||||
@ -144,13 +144,13 @@ TODO
|
||||
+ *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io)
|
||||
+ *Name*: [Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
+ *First Build*: 30th April, 2015
|
||||
+ *Last Build*: 26th July, 2024
|
||||
+ *Version*: 3.2.3-alpha2
|
||||
+ *Last Build*: 27th July, 2024
|
||||
+ *Version*: 3.2.3-alpha3
|
||||
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
|
||||
+ *Line count*: **798183**
|
||||
+ *Line count*: **799922**
|
||||
+ *Field count*: **2093**
|
||||
+ *File count*: **5491**
|
||||
+ *File count*: **5507**
|
||||
+ *Folder count*: **482**
|
||||
|
||||
> This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](https://www.joomlacomponentbuilder.com).
|
||||
|
@ -9,7 +9,7 @@ The Component Builder for [Joomla](https://extensions.joomla.org/extension/compo
|
||||
|
||||
Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will save you lots of time and money. A real must have!
|
||||
|
||||
You can install it quite easily and with no limitations. On [gitea](https://git.vdm.dev/joomla/Component-Builder/tags) is the latest release (3.2.3-alpha2) with **ALL** its features and **ALL** concepts totally open-source and free!
|
||||
You can install it quite easily and with no limitations. On [gitea](https://git.vdm.dev/joomla/Component-Builder/tags) is the latest release (3.2.3-alpha3) with **ALL** its features and **ALL** concepts totally open-source and free!
|
||||
|
||||
> Watch Quick Build of a Hello World component in [JCB on Youtube](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45)
|
||||
|
||||
@ -144,13 +144,13 @@ TODO
|
||||
+ *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io)
|
||||
+ *Name*: [Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
+ *First Build*: 30th April, 2015
|
||||
+ *Last Build*: 26th July, 2024
|
||||
+ *Version*: 3.2.3-alpha2
|
||||
+ *Last Build*: 27th July, 2024
|
||||
+ *Version*: 3.2.3-alpha3
|
||||
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
|
||||
+ *Line count*: **798183**
|
||||
+ *Line count*: **799922**
|
||||
+ *Field count*: **2093**
|
||||
+ *File count*: **5491**
|
||||
+ *File count*: **5507**
|
||||
+ *Folder count*: **482**
|
||||
|
||||
> This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](https://www.joomlacomponentbuilder.com).
|
||||
|
@ -28,6 +28,8 @@ HTML::_('bootstrap.renderModal');
|
||||
|
||||
/**
|
||||
* Script File of ###Component### Component
|
||||
*
|
||||
* @since 1.5.0
|
||||
*/
|
||||
class Com_###Component###InstallerScript
|
||||
{
|
||||
@ -35,6 +37,7 @@ class Com_###Component###InstallerScript
|
||||
* Constructor
|
||||
*
|
||||
* @param ComponentAdapter $parent The object responsible for running this script
|
||||
* @since 1.5.0
|
||||
*/
|
||||
public function __construct(ComponentAdapter $parent) {}
|
||||
|
||||
@ -44,6 +47,7 @@ class Com_###Component###InstallerScript
|
||||
* @param ComponentAdapter $parent The object responsible for running this script
|
||||
*
|
||||
* @return boolean True on success
|
||||
* @since 1.5.0
|
||||
*/
|
||||
public function install(ComponentAdapter $parent) {}
|
||||
|
||||
@ -51,6 +55,8 @@ class Com_###Component###InstallerScript
|
||||
* Called on uninstallation
|
||||
*
|
||||
* @param ComponentAdapter $parent The object responsible for running this script
|
||||
*
|
||||
* @since 1.5.0
|
||||
*/
|
||||
public function uninstall(ComponentAdapter $parent)
|
||||
{###UNINSTALLSCRIPT###
|
||||
@ -68,6 +74,7 @@ class Com_###Component###InstallerScript
|
||||
* @param ComponentAdapter $parent The object responsible for running this script
|
||||
*
|
||||
* @return boolean True on success
|
||||
* @since 1.5.0
|
||||
*/
|
||||
public function update(ComponentAdapter $parent){}
|
||||
|
||||
@ -78,6 +85,7 @@ class Com_###Component###InstallerScript
|
||||
* @param ComponentAdapter $parent The object responsible for running this script
|
||||
*
|
||||
* @return boolean True on success
|
||||
* @since 1.5.0
|
||||
*/
|
||||
public function preflight($type, ComponentAdapter $parent)
|
||||
{
|
||||
@ -121,6 +129,7 @@ class Com_###Component###InstallerScript
|
||||
* @param ComponentAdapter $parent The object responsible for running this script
|
||||
*
|
||||
* @return boolean True on success
|
||||
* @since 1.5.0
|
||||
*/
|
||||
public function postflight($type, ComponentAdapter $parent)
|
||||
{
|
||||
@ -144,7 +153,7 @@ class Com_###Component###InstallerScript
|
||||
* @param array|null $ignore The folders and files to ignore and not remove.
|
||||
*
|
||||
* @return bool True if all specified files/folders are removed, false otherwise.
|
||||
* @since 3.2.2
|
||||
* @since 3.2.2
|
||||
*/
|
||||
protected function removeFolder(string $dir, ?array $ignore = null): bool
|
||||
{
|
||||
@ -195,7 +204,7 @@ class Com_###Component###InstallerScript
|
||||
* @param array $ignore The folders and files to ignore.
|
||||
*
|
||||
* @return bool True if the directory is empty or contains only ignored items, false otherwise.
|
||||
* @since 3.2.1
|
||||
* @since 3.2.1
|
||||
*/
|
||||
protected function isDirEmpty(string $dir, array $ignore): bool
|
||||
{
|
||||
@ -217,7 +226,7 @@ class Com_###Component###InstallerScript
|
||||
* @input array The array to check
|
||||
*
|
||||
* @returns bool/int number of items in array on success
|
||||
* @since 3.2.2
|
||||
* @since 3.2.2
|
||||
*/
|
||||
protected function checkArray($array, $removeEmptyString = false)
|
||||
{
|
||||
@ -247,20 +256,31 @@ class Com_###Component###InstallerScript
|
||||
* @param string $className The fully qualified name of the class to check.
|
||||
*
|
||||
* @return bool True if the class exists or was successfully loaded, false otherwise.
|
||||
* @since 3.2.2
|
||||
* @since 3.2.2
|
||||
*/
|
||||
protected function classExists(string $className): bool
|
||||
{
|
||||
if (!class_exists($className, true))
|
||||
if (class_exists($className, true))
|
||||
{
|
||||
###THREE_POWER_AUTOLOADER###
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check again if the class now exists after requiring the autoloader
|
||||
if (!class_exists($className, true))
|
||||
// Autoloaders to check
|
||||
$autoloaders = [###INSTALLER_POWER_AUTOLOADER_ARRAY###];
|
||||
|
||||
foreach ($autoloaders as $autoloader)
|
||||
{
|
||||
if (file_exists($autoloader))
|
||||
{
|
||||
return false;
|
||||
require_once $autoloader;
|
||||
|
||||
if (class_exists($className, true))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}###INSTALLERMETHODS###
|
||||
}
|
||||
|
18
admin/compiler/joomla_3/script_powerloader.php
Normal file
18
admin/compiler/joomla_3/script_powerloader.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @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
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
?>
|
||||
###BOM###
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die;###INSTALLER_POWER_HELPER###
|
@ -184,6 +184,12 @@
|
||||
"rename": false,
|
||||
"type": "file"
|
||||
},
|
||||
"script_powerloader.php": {
|
||||
"naam": "script_powerloader.php",
|
||||
"path": "c0mp0n3nt/",
|
||||
"rename": false,
|
||||
"type": "file"
|
||||
},
|
||||
"install.mysql.utf8.sql": {
|
||||
"naam": "install.mysql.utf8.sql",
|
||||
"path": "c0mp0n3nt/admin/sql",
|
||||
|
18
admin/compiler/joomla_4/INSTALLER_AUTOLOADER_CLASS.php
Normal file
18
admin/compiler/joomla_4/INSTALLER_AUTOLOADER_CLASS.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?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
|
||||
*/
|
||||
|
||||
// No direct access to this JCB template file (EVER)
|
||||
defined('_JCB_TEMPLATE') or die;
|
||||
?>
|
||||
###BOM###
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die;###INSTALLER_POWER_HELPER###
|
@ -52,7 +52,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
|
||||
/**
|
||||
* The version number of the extension.
|
||||
*
|
||||
* @var string
|
||||
* @var string
|
||||
* @since 3.6
|
||||
*/
|
||||
protected $release;
|
||||
@ -60,7 +60,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
|
||||
/**
|
||||
* The table the parameters are stored in.
|
||||
*
|
||||
* @var string
|
||||
* @var string
|
||||
* @since 3.6
|
||||
*/
|
||||
protected $paramTable;
|
||||
@ -68,7 +68,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
|
||||
/**
|
||||
* The extension name. This should be set in the installer script.
|
||||
*
|
||||
* @var string
|
||||
* @var string
|
||||
* @since 3.6
|
||||
*/
|
||||
protected $extension;
|
||||
@ -76,7 +76,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
|
||||
/**
|
||||
* A list of files to be deleted
|
||||
*
|
||||
* @var array
|
||||
* @var array
|
||||
* @since 3.6
|
||||
*/
|
||||
protected $deleteFiles = [];
|
||||
@ -84,7 +84,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
|
||||
/**
|
||||
* A list of folders to be deleted
|
||||
*
|
||||
* @var array
|
||||
* @var array
|
||||
* @since 3.6
|
||||
*/
|
||||
protected $deleteFolders = [];
|
||||
@ -92,7 +92,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
|
||||
/**
|
||||
* A list of CLI script files to be copied to the cli directory
|
||||
*
|
||||
* @var array
|
||||
* @var array
|
||||
* @since 3.6
|
||||
*/
|
||||
protected $cliScriptFiles = [];
|
||||
@ -100,7 +100,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
|
||||
/**
|
||||
* Minimum PHP version required to install the extension
|
||||
*
|
||||
* @var string
|
||||
* @var string
|
||||
* @since 3.6
|
||||
*/
|
||||
protected $minimumPhp;
|
||||
@ -108,7 +108,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
|
||||
/**
|
||||
* Minimum Joomla! version required to install the extension
|
||||
*
|
||||
* @var string
|
||||
* @var string
|
||||
* @since 3.6
|
||||
*/
|
||||
protected $minimumJoomla;
|
||||
@ -162,7 +162,6 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
|
||||
* @param InstallerAdapter $adapter The adapter calling this method
|
||||
*
|
||||
* @return boolean True on success
|
||||
*
|
||||
* @since 4.2.0
|
||||
*/
|
||||
public function install(InstallerAdapter $adapter): bool {return true;}
|
||||
@ -184,7 +183,6 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
|
||||
* @param InstallerAdapter $adapter The adapter calling this method
|
||||
*
|
||||
* @return boolean True on success
|
||||
*
|
||||
* @since 4.2.0
|
||||
*/
|
||||
public function uninstall(InstallerAdapter $adapter): bool
|
||||
@ -207,7 +205,6 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
|
||||
* @param InstallerAdapter $adapter The adapter calling this method
|
||||
*
|
||||
* @return boolean True on success
|
||||
*
|
||||
* @since 4.2.0
|
||||
*/
|
||||
public function preflight(string $type, InstallerAdapter $adapter): bool
|
||||
@ -252,7 +249,6 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
|
||||
* @param InstallerAdapter $adapter The adapter calling this method
|
||||
*
|
||||
* @return boolean True on success
|
||||
*
|
||||
* @since 4.2.0
|
||||
*/
|
||||
public function postflight(string $type, InstallerAdapter $adapter): bool
|
||||
@ -284,7 +280,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
|
||||
* @param array|null $ignore The folders and files to ignore and not remove.
|
||||
*
|
||||
* @return bool True if all specified files/folders are removed, false otherwise.
|
||||
* @since 3.2.2
|
||||
* @since 3.2.2
|
||||
*/
|
||||
protected function removeFolder(string $dir, ?array $ignore = null): bool
|
||||
{
|
||||
@ -335,7 +331,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
|
||||
* @param array $ignore The folders and files to ignore.
|
||||
*
|
||||
* @return bool True if the directory is empty or contains only ignored items, false otherwise.
|
||||
* @since 3.2.1
|
||||
* @since 3.2.1
|
||||
*/
|
||||
protected function isDirEmpty(string $dir, array $ignore): bool
|
||||
{
|
||||
@ -355,7 +351,6 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
|
||||
* Remove the files and folders in the given array from
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 3.6
|
||||
*/
|
||||
protected function removeFiles()
|
||||
@ -387,7 +382,6 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
|
||||
* Moves the CLI scripts into the CLI folder in the CMS
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 3.6
|
||||
*/
|
||||
protected function moveCliFiles()
|
||||
@ -418,7 +412,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
|
||||
* @param string $contentHistoryOptions
|
||||
*
|
||||
* @return void
|
||||
* @since 4.4.2
|
||||
* @since 4.4.2
|
||||
*/
|
||||
protected function setContentType(
|
||||
string $typeTitle,
|
||||
@ -480,7 +474,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
|
||||
* @param string $textPrefix
|
||||
*
|
||||
* @return void
|
||||
* @since 4.4.2
|
||||
* @since 4.4.2
|
||||
*/
|
||||
protected function setActionLogConfig(
|
||||
string $typeTitle,
|
||||
@ -533,7 +527,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
|
||||
* Set action logs extensions integration
|
||||
*
|
||||
* @return void
|
||||
* @since 4.4.2
|
||||
* @since 4.4.2
|
||||
*/
|
||||
protected function setActionLogsExtensions(): void
|
||||
{
|
||||
@ -574,7 +568,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
|
||||
* @param string $rules The component rules
|
||||
*
|
||||
* @return void
|
||||
* @since 4.4.2
|
||||
* @since 4.4.2
|
||||
*/
|
||||
protected function setAssetsRules(string $rules): void
|
||||
{
|
||||
@ -612,7 +606,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
|
||||
* @param string $params The component rules
|
||||
*
|
||||
* @return void
|
||||
* @since 4.4.2
|
||||
* @since 4.4.2
|
||||
*/
|
||||
protected function setExtensionsParams(string $params): void
|
||||
{
|
||||
@ -655,7 +649,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
|
||||
* @param string $dataType This datatype we will change the rules column to if it to small.
|
||||
*
|
||||
* @return void
|
||||
* @since 4.4.2
|
||||
* @since 4.4.2
|
||||
*/
|
||||
protected function setDatabaseAssetsRulesFix(int $accessWorseCase, string $dataType): void
|
||||
{
|
||||
@ -690,7 +684,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
|
||||
* @param bool $fields The switch to also remove related field data
|
||||
*
|
||||
* @return void
|
||||
* @since 4.4.2
|
||||
* @since 4.4.2
|
||||
*/
|
||||
protected function removeViewData(string $context, bool $fields = false): void
|
||||
{
|
||||
@ -713,7 +707,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
|
||||
* @param string $context The view context
|
||||
*
|
||||
* @return void
|
||||
* @since 4.4.2
|
||||
* @since 4.4.2
|
||||
*/
|
||||
protected function removeContentTypes(string $context): void
|
||||
{
|
||||
@ -770,7 +764,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
|
||||
* @param string $context The view context
|
||||
*
|
||||
* @return void
|
||||
* @since 4.4.2
|
||||
* @since 4.4.2
|
||||
*/
|
||||
protected function removeFields(string $context): void
|
||||
{
|
||||
@ -832,7 +826,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
|
||||
* @param array $ids The view context
|
||||
*
|
||||
* @return void
|
||||
* @since 4.4.2
|
||||
* @since 4.4.2
|
||||
*/
|
||||
protected function removeFieldsValues(string $context, array $ids): void
|
||||
{
|
||||
@ -863,7 +857,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
|
||||
* @param string $context The view context
|
||||
*
|
||||
* @return void
|
||||
* @since 4.4.2
|
||||
* @since 4.4.2
|
||||
*/
|
||||
protected function removeFieldsGroups(string $context): void
|
||||
{
|
||||
@ -918,7 +912,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
|
||||
* @param string $context The view context
|
||||
*
|
||||
* @return void
|
||||
* @since 4.4.2
|
||||
* @since 4.4.2
|
||||
*/
|
||||
protected function removeViewHistory(string $context): void
|
||||
{
|
||||
@ -950,7 +944,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
|
||||
* @param array $ids The type ids
|
||||
*
|
||||
* @return void
|
||||
* @since 4.4.2
|
||||
* @since 4.4.2
|
||||
*/
|
||||
protected function removeUcmBase(array $ids): void
|
||||
{
|
||||
@ -983,7 +977,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
|
||||
* @param string $context The view context
|
||||
*
|
||||
* @return void
|
||||
* @since 4.4.2
|
||||
* @since 4.4.2
|
||||
*/
|
||||
protected function removeUcmContent(string $context): void
|
||||
{
|
||||
@ -1015,7 +1009,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
|
||||
* @param string $context The view context
|
||||
*
|
||||
* @return void
|
||||
* @since 4.4.2
|
||||
* @since 4.4.2
|
||||
*/
|
||||
protected function removeContentItemTagMap(string $context): void
|
||||
{
|
||||
@ -1050,7 +1044,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
|
||||
* @param string $context The view context
|
||||
*
|
||||
* @return void
|
||||
* @since 4.4.2
|
||||
* @since 4.4.2
|
||||
*/
|
||||
protected function removeActionLogConfig(string $context): void
|
||||
{
|
||||
@ -1080,7 +1074,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
|
||||
* Remove Asset Table Integrated
|
||||
*
|
||||
* @return void
|
||||
* @since 4.4.2
|
||||
* @since 4.4.2
|
||||
*/
|
||||
protected function removeAssetData(): void
|
||||
{
|
||||
@ -1108,7 +1102,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
|
||||
* Remove action logs extensions integrated
|
||||
*
|
||||
* @return void
|
||||
* @since 4.4.2
|
||||
* @since 4.4.2
|
||||
*/
|
||||
protected function removeActionLogsExtensions(): void
|
||||
{
|
||||
@ -1138,7 +1132,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
|
||||
* Remove remove database fix (if possible)
|
||||
*
|
||||
* @return void
|
||||
* @since 4.4.2
|
||||
* @since 4.4.2
|
||||
*/
|
||||
protected function removeDatabaseAssetsRulesFix(): void
|
||||
{
|
||||
@ -1176,20 +1170,31 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
|
||||
* @param string $className The fully qualified name of the class to check.
|
||||
*
|
||||
* @return bool True if the class exists or was successfully loaded, false otherwise.
|
||||
* @since 4.0.1
|
||||
* @since 4.0.1
|
||||
*/
|
||||
protected function classExists(string $className): bool
|
||||
{
|
||||
if (!class_exists($className, true))
|
||||
if (class_exists($className, true))
|
||||
{
|
||||
###THREE_POWER_AUTOLOADER###
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check again if the class now exists after requiring the autoloader
|
||||
if (!class_exists($className, true))
|
||||
// Autoloaders to check
|
||||
$autoloaders = [###INSTALLER_POWER_AUTOLOADER_ARRAY###];
|
||||
|
||||
foreach ($autoloaders as $autoloader)
|
||||
{
|
||||
if (file_exists($autoloader))
|
||||
{
|
||||
return false;
|
||||
require_once $autoloader;
|
||||
|
||||
if (class_exists($className, true))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}###INSTALLERMETHODS###
|
||||
}
|
||||
|
@ -182,6 +182,13 @@
|
||||
"newName": "[[[Component]]]InstallerScript.php",
|
||||
"type": "file"
|
||||
},
|
||||
"INSTALLER_AUTOLOADER_CLASS.php": {
|
||||
"naam": "INSTALLER_AUTOLOADER_CLASS.php",
|
||||
"path": "c0mp0n3nt/",
|
||||
"rename": "new",
|
||||
"newName": "[[[Component]]]InstallerPowerloader.php",
|
||||
"type": "file"
|
||||
},
|
||||
"SITE_DISPATCHER.php": {
|
||||
"naam": "SITE_DISPATCHER.php",
|
||||
"path": "c0mp0n3nt/site/src/Dispatcher",
|
||||
|
File diff suppressed because one or more lines are too long
@ -1,15 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension type="component" version="3.10" method="upgrade">
|
||||
<name>COM_COMPONENTBUILDER</name>
|
||||
<creationDate>26th July, 2024</creationDate>
|
||||
<creationDate>27th July, 2024</creationDate>
|
||||
<author>Llewellyn van der Merwe</author>
|
||||
<authorEmail>joomla@vdm.io</authorEmail>
|
||||
<authorUrl>https://dev.vdm.io</authorUrl>
|
||||
<copyright>Copyright (C) 2015 Vast Development Method. All rights reserved.</copyright>
|
||||
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
|
||||
<version>3.2.3-alpha2</version>
|
||||
<version>3.2.3-alpha3</version>
|
||||
<description><![CDATA[
|
||||
<h1>Component Builder (v.3.2.3-alpha2)</h1>
|
||||
<h1>Component Builder (v.3.2.3-alpha3)</h1>
|
||||
<div style="clear: both;"></div>
|
||||
<p>The Component Builder for [Joomla](https://extensions.joomla.org/extension/component-builder/) is highly advanced tool that is truly able to build extremely complex components in a fraction of the time.
|
||||
|
||||
|
@ -169,7 +169,7 @@
|
||||
<version>3.2.3-alpha</version>
|
||||
<infourl title="Component Builder!">https://dev.vdm.io</infourl>
|
||||
<downloads>
|
||||
<downloadurl type="full" format="zip">https://git.vdm.dev/api/v1/repos/joomla/pkg-component-builder/archive/v3.2.3-alpha2.zip</downloadurl>
|
||||
<downloadurl type="full" format="zip">https://git.vdm.dev/api/v1/repos/joomla/pkg-component-builder/archive/v3.2.3-alpha3.zip</downloadurl>
|
||||
</downloads>
|
||||
<tags>
|
||||
<tag>alpha</tag>
|
||||
@ -184,10 +184,10 @@
|
||||
<element>pkg_component_builder</element>
|
||||
<type>package</type>
|
||||
<client>site</client>
|
||||
<version>3.2.3-alpha2</version>
|
||||
<version>3.2.3-alpha3</version>
|
||||
<infourl title="Component Builder!">https://dev.vdm.io</infourl>
|
||||
<downloads>
|
||||
<downloadurl type="full" format="zip">https://git.vdm.dev/api/v1/repos/joomla/pkg-component-builder/archive/v3.2.3-alpha2.zip</downloadurl>
|
||||
<downloadurl type="full" format="zip">https://git.vdm.dev/api/v1/repos/joomla/pkg-component-builder/archive/v3.2.3-alpha3.zip</downloadurl>
|
||||
</downloads>
|
||||
<tags>
|
||||
<tag>alpha</tag>
|
||||
|
@ -0,0 +1,214 @@
|
||||
<?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\Abstraction;
|
||||
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use VDM\Joomla\Interfaces\PHPConfigurationCheckerInterface;
|
||||
use VDM\Joomla\Abstraction\Registry;
|
||||
|
||||
|
||||
/**
|
||||
* PHP Configuration Checker
|
||||
*
|
||||
* @since 5.0.2
|
||||
*/
|
||||
abstract class PHPConfigurationChecker extends Registry implements PHPConfigurationCheckerInterface
|
||||
{
|
||||
/**
|
||||
* The upload max filesize value
|
||||
*
|
||||
* @var string
|
||||
* @since 5.0.2
|
||||
**/
|
||||
protected string $upload_max_filesize;
|
||||
|
||||
/**
|
||||
* The post max size value
|
||||
*
|
||||
* @var string
|
||||
* @since 5.0.2
|
||||
**/
|
||||
protected string $post_max_size;
|
||||
|
||||
/**
|
||||
* The max execution time value
|
||||
*
|
||||
* @var int
|
||||
* @since 5.0.2
|
||||
**/
|
||||
protected int $max_execution_time;
|
||||
|
||||
/**
|
||||
* The max input vars value
|
||||
*
|
||||
* @var int
|
||||
* @since 5.0.2
|
||||
**/
|
||||
protected int $max_input_vars;
|
||||
|
||||
/**
|
||||
* The max input time value
|
||||
*
|
||||
* @var int
|
||||
* @since 5.0.2
|
||||
**/
|
||||
protected int $max_input_time;
|
||||
|
||||
/**
|
||||
* The memory limit value
|
||||
*
|
||||
* @var string
|
||||
* @since 5.0.2
|
||||
**/
|
||||
protected string $memory_limit;
|
||||
|
||||
/**
|
||||
* The registry array.
|
||||
*
|
||||
* @var array
|
||||
* @since 5.0.2
|
||||
**/
|
||||
protected array $active = [
|
||||
'php' => [
|
||||
'upload_max_filesize' => [
|
||||
'success' => 'The upload_max_filesize is appropriately set to handle large files, which is essential for uploading substantial components and media.',
|
||||
'warning' => 'The current upload_max_filesize may not support large file uploads effectively, potentially causing failures during component installation.'
|
||||
],
|
||||
'post_max_size' => [
|
||||
'success' => 'The post_max_size setting is sufficient to manage large data submissions, ensuring smooth data processing within forms and uploads.',
|
||||
'warning' => 'An insufficient post_max_size can lead to truncated data submissions, affecting form functionality and data integrity.'
|
||||
],
|
||||
'max_execution_time' => [
|
||||
'success' => 'Max execution time is set high enough to execute complex operations without premature termination, which is crucial for lengthy operations.',
|
||||
'warning' => 'A low max execution time could lead to script timeouts, especially during intensive operations, which might interrupt execution and cause failures during the compiling of a large extension.'
|
||||
],
|
||||
'max_input_vars' => [
|
||||
'success' => 'The max_input_vars setting supports a high number of input variables, facilitating complex forms and detailed component configurations.',
|
||||
'warning' => 'Too few max_input_vars may result in lost data during processing complex forms, which can lead to incomplete configurations and operational issues.'
|
||||
],
|
||||
'max_input_time' => [
|
||||
'success' => 'Max input time is adequate for processing inputs efficiently during high-load operations, ensuring no premature timeouts.',
|
||||
'warning' => 'An insufficient max input time could result in incomplete data processing during input-heavy operations, potentially leading to errors and data loss.'
|
||||
],
|
||||
'memory_limit' => [
|
||||
'success' => 'The memory limit is set high to accommodate extensive operations and data processing, which enhances overall performance and stability.',
|
||||
'warning' => 'A low memory limit can lead to frequent crashes and performance issues, particularly when processing large amounts of data or complex calculations.'
|
||||
]
|
||||
],
|
||||
'environment' => [
|
||||
'name' => 'extension environment',
|
||||
'objective' => 'These settings are crucial for ensuring the successful installation and stable functionality of the extension.',
|
||||
'wiki_name' => 'PHP Settings Wiki',
|
||||
'wiki_url' => '#'
|
||||
]
|
||||
];
|
||||
|
||||
/**
|
||||
* Application object.
|
||||
*
|
||||
* @since 5.0.2
|
||||
**/
|
||||
protected $app;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param $app The app object.
|
||||
*
|
||||
* @since 5.0.2
|
||||
*/
|
||||
public function __construct($app = null)
|
||||
{
|
||||
$this->app = $app ?: Factory::getApplication();
|
||||
|
||||
// set the required PHP Configures
|
||||
$this->set('php.upload_max_filesize.value', $this->upload_max_filesize);
|
||||
$this->set('php.post_max_size.value', $this->post_max_size);
|
||||
$this->set('php.max_execution_time.value', $this->max_execution_time);
|
||||
$this->set('php.max_input_vars.value', $this->max_input_vars);
|
||||
$this->set('php.max_input_time.value', $this->max_input_time);
|
||||
$this->set('php.memory_limit.value', $this->memory_limit);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check that the required configurations are set for PHP
|
||||
*
|
||||
* @return void
|
||||
* @since 5.0.2
|
||||
**/
|
||||
public function run(): void
|
||||
{
|
||||
$showHelp = false;
|
||||
|
||||
// Check each configuration and provide detailed feedback
|
||||
$configurations = $this->active['php'] ?? [];
|
||||
foreach ($configurations as $configName => $configDetails)
|
||||
{
|
||||
$currentValue = ini_get($configName);
|
||||
if ($currentValue === false)
|
||||
{
|
||||
$this->app->enqueueMessage("Error: Unable to retrieve current setting for '{$configName}'.", 'error');
|
||||
continue;
|
||||
}
|
||||
|
||||
$requiredValue = $configDetails['value'] ?? 0;
|
||||
$isMemoryValue = strpbrk($requiredValue, 'KMG') !== false;
|
||||
|
||||
$requiredValueBytes = $isMemoryValue ? $this->convertToBytes($requiredValue) : (int) $requiredValue;
|
||||
$currentValueBytes = $isMemoryValue ? $this->convertToBytes($currentValue) : (int) $currentValue;
|
||||
$conditionMet = $currentValueBytes >= $requiredValueBytes;
|
||||
|
||||
$messageType = $conditionMet ? 'message' : 'warning';
|
||||
$messageText = $conditionMet ?
|
||||
"Success: {$configName} is set to {$currentValue}. " . $configDetails['success'] ?? '':
|
||||
"Warning: {$configName} configuration should be at least {$requiredValue} but is currently {$currentValue}. " . $configDetails['warning'] ?? '';
|
||||
|
||||
$showHelp = ($showHelp || $messageType === 'warning') ? true : false;
|
||||
|
||||
$this->app->enqueueMessage($messageText, $messageType);
|
||||
}
|
||||
|
||||
if ($showHelp)
|
||||
{
|
||||
$this->app->enqueueMessage("To optimize your {$this->get('environment.name', 'extension')}, specific PHP settings must be enhanced.<br>{$this->get('environment.objective', '')}<br>We've identified that certain configurations currently do not meet the recommended standards.<br>To adjust these settings and prevent potential issues, please consult our detailed guide available at <a href=\"https://{$this->get('environment.wiki_url', '#')}\" target=\"_blank\">{$this->get('environment.wiki_name', 'PHP Settings Wiki')}</a>.", 'notice');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function to convert PHP INI memory values to bytes
|
||||
*
|
||||
* @param string $value The value to convert
|
||||
*
|
||||
* @return int The bytes value
|
||||
* @since 5.0.2
|
||||
*/
|
||||
protected function convertToBytes(string $value): int
|
||||
{
|
||||
$value = trim($value);
|
||||
$lastChar = strtolower($value[strlen($value) - 1]);
|
||||
$numValue = substr($value, 0, -1);
|
||||
|
||||
switch ($lastChar)
|
||||
{
|
||||
case 'g':
|
||||
return $numValue * 1024 * 1024 * 1024;
|
||||
case 'm':
|
||||
return $numValue * 1024 * 1024;
|
||||
case 'k':
|
||||
return $numValue * 1024;
|
||||
default:
|
||||
return (int) $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -351,7 +351,7 @@ final class Settings implements SettingsInterface
|
||||
$this->config->get('footable', false))
|
||||
{
|
||||
$this->addImportViewFolder();
|
||||
$this->addPhpSpreadsheetFolder();
|
||||
// $this->addPhpSpreadsheetFolder(); // soon
|
||||
$this->addUikitFolder();
|
||||
$this->addFooTableFolder();
|
||||
}
|
||||
|
@ -351,7 +351,7 @@ final class Settings implements SettingsInterface
|
||||
$this->config->get('footable', false))
|
||||
{
|
||||
$this->addImportViewFolder();
|
||||
$this->addPhpSpreadsheetFolder();
|
||||
// $this->addPhpSpreadsheetFolder(); // soon
|
||||
$this->addUikitFolder();
|
||||
$this->addFooTableFolder();
|
||||
}
|
||||
|
@ -303,6 +303,24 @@ class Config extends BaseConfig
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* get component installer autoloader path
|
||||
*
|
||||
* @return string The component installer autoloader path
|
||||
* @since 5.0.2
|
||||
*/
|
||||
protected function getComponentinstallerautoloaderpath(): string
|
||||
{
|
||||
if ($this->joomla_version == 3)
|
||||
{
|
||||
return 'script_powerloader.php';
|
||||
}
|
||||
else
|
||||
{
|
||||
return ucfirst($this->component_codename) . 'InstallerPowerloader.php';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* get add namespace prefix
|
||||
*
|
||||
|
@ -1160,8 +1160,7 @@ class Interpretation extends Fields
|
||||
$newJ['component_version']
|
||||
= CFactory::_('Component')->get('component_version');
|
||||
// update the component with the new dynamic SQL
|
||||
$modelJ = \ComponentbuilderHelper::getModel('joomla_component');
|
||||
$modelJ->save($newJ); // <-- to insure the history is also updated
|
||||
CFactory::_('Data.Item')->table('joomla_component')->set((object) $newJ, 'id'); // <-- to insure the history is also updated
|
||||
// reset the watch here
|
||||
CFactory::_('History')->get('joomla_component', CFactory::_('Config')->component_id);
|
||||
|
||||
@ -1175,10 +1174,9 @@ class Interpretation extends Fields
|
||||
{
|
||||
$newU['joomla_component'] = (int) CFactory::_('Config')->component_id;
|
||||
}
|
||||
$newU['version_update'] = json_encode($buket);
|
||||
$newU['version_update'] = $buket;
|
||||
// update the component with the new dynamic SQL
|
||||
$modelU = \ComponentbuilderHelper::getModel('component_updates');
|
||||
$modelU->save($newU); // <-- to insure the history is also updated
|
||||
CFactory::_('Data.Item')->table('component_updates')->set((object) $newU, 'id'); // <-- to insure the history is also updated
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -228,11 +228,6 @@ final class Header implements HeaderInterface
|
||||
// get dynamic headers
|
||||
switch ($context)
|
||||
{
|
||||
case 'admin.helper':
|
||||
case 'site.helper':
|
||||
$this->setHelperClassHeader($headers, $codeName);
|
||||
break;
|
||||
|
||||
case 'admin.view.html':
|
||||
case 'admin.views.html':
|
||||
case 'custom.admin.view.html':
|
||||
@ -560,26 +555,6 @@ final class Header implements HeaderInterface
|
||||
$this->headers[$context] = $headers;
|
||||
|
||||
return $headers;
|
||||
}
|
||||
|
||||
/**
|
||||
* set Helper Dynamic Headers
|
||||
*
|
||||
* @param array $headers The headers array
|
||||
* @param string $target_client
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function setHelperClassHeader(&$headers, $target_client)
|
||||
{
|
||||
// add only to admin client
|
||||
if ('admin' === $target_client && $this->config->get('add_eximport', false))
|
||||
{
|
||||
$headers[] = 'use PhpOffice\PhpSpreadsheet\IOFactory;';
|
||||
$headers[] = 'use PhpOffice\PhpSpreadsheet\Spreadsheet;';
|
||||
$headers[] = 'use PhpOffice\PhpSpreadsheet\Writer\Xlsx;';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -228,11 +228,6 @@ final class Header implements HeaderInterface
|
||||
// get dynamic headers
|
||||
switch ($context)
|
||||
{
|
||||
case 'admin.helper':
|
||||
case 'site.helper':
|
||||
$this->setHelperClassHeader($headers, $codeName);
|
||||
break;
|
||||
|
||||
case 'admin.view.html':
|
||||
case 'admin.views.html':
|
||||
case 'custom.admin.view.html':
|
||||
@ -560,26 +555,6 @@ final class Header implements HeaderInterface
|
||||
$this->headers[$context] = $headers;
|
||||
|
||||
return $headers;
|
||||
}
|
||||
|
||||
/**
|
||||
* set Helper Dynamic Headers
|
||||
*
|
||||
* @param array $headers The headers array
|
||||
* @param string $target_client
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function setHelperClassHeader(&$headers, $target_client)
|
||||
{
|
||||
// add only to admin client
|
||||
if ('admin' === $target_client && $this->config->get('add_eximport', false))
|
||||
{
|
||||
$headers[] = 'use PhpOffice\PhpSpreadsheet\IOFactory;';
|
||||
$headers[] = 'use PhpOffice\PhpSpreadsheet\Spreadsheet;';
|
||||
$headers[] = 'use PhpOffice\PhpSpreadsheet\Writer\Xlsx;';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -51,6 +51,14 @@ class Autoloader
|
||||
*/
|
||||
protected Content $content;
|
||||
|
||||
/**
|
||||
* Installer Class Autoloader
|
||||
*
|
||||
* @var string
|
||||
* @since 5.0.2
|
||||
**/
|
||||
protected string $installerhelper = '';
|
||||
|
||||
/**
|
||||
* Helper Class Autoloader
|
||||
*
|
||||
@ -77,6 +85,7 @@ class Autoloader
|
||||
// reset all autoloaders power placeholders
|
||||
$this->content->set('ADMIN_POWER_HELPER', '');
|
||||
$this->content->set('SITE_POWER_HELPER', '');
|
||||
$this->content->set('INSTALLER_POWER_HELPER', '');
|
||||
$this->content->set('PLUGIN_POWER_AUTOLOADER', '');
|
||||
$this->content->set('SITE_PLUGIN_POWER_AUTOLOADER', '');
|
||||
$this->content->set('POWER_AUTOLOADER', '');
|
||||
@ -89,6 +98,7 @@ class Autoloader
|
||||
$this->content->set('SITE_TWO_POWER_AUTOLOADER', '');
|
||||
$this->content->set('SITE_THREE_POWER_AUTOLOADER', '');
|
||||
$this->content->set('SITE_FOUR_POWER_AUTOLOADER', '');
|
||||
$this->content->set('INSTALLER_POWER_AUTOLOADER_ARRAY', '');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -118,6 +128,9 @@ class Autoloader
|
||||
// to add to custom files
|
||||
$this->content->add('POWER_AUTOLOADER', $this->getAutoloaderFile(0));
|
||||
$this->content->add('SITE_POWER_AUTOLOADER', $this->getAutoloaderFile(0, 'JPATH_SITE'));
|
||||
|
||||
// to add to install file
|
||||
$this->content->add('INSTALLER_POWER_AUTOLOADER_ARRAY', $this->getAutoloaderInstallArray());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -147,20 +160,23 @@ class Autoloader
|
||||
uksort($this->power->namespace, fn($a, $b) => strlen((string) $b) - strlen((string) $a));
|
||||
|
||||
// load to admin helper class
|
||||
$this->content->add('ADMIN_POWER_HELPER', $this->getHelperAutoloader());
|
||||
$this->content->add('ADMIN_POWER_HELPER', $this->getAutoloaderCode());
|
||||
|
||||
// load to site helper class if needed
|
||||
$this->content->add('SITE_POWER_HELPER', $this->getHelperAutoloader());
|
||||
$this->content->add('SITE_POWER_HELPER', $this->getAutoloaderCode());
|
||||
|
||||
// load to installer helper class if needed
|
||||
$this->content->add('INSTALLER_POWER_HELPER', $this->getAutoloaderInstallerCode());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get helper autoloader code
|
||||
* Get autoloader code
|
||||
*
|
||||
* @return string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
private function getHelperAutoloader(): string
|
||||
private function getAutoloaderCode(): string
|
||||
{
|
||||
// check if it was already build
|
||||
if (!empty($this->helper))
|
||||
@ -172,13 +188,13 @@ class Autoloader
|
||||
$code = [];
|
||||
|
||||
// add the composer stuff here
|
||||
if (($script = $this->getComposer(0)) !== null)
|
||||
if (($script = $this->getComposer()) !== null)
|
||||
{
|
||||
$code[] = $script;
|
||||
}
|
||||
|
||||
// get the helper autoloader
|
||||
if (($script = $this->getAutoloader(0)) !== null)
|
||||
if (($script = $this->getAutoloader()) !== null)
|
||||
{
|
||||
$code[] = $script;
|
||||
}
|
||||
@ -203,7 +219,7 @@ class Autoloader
|
||||
*/
|
||||
private function getAutoloaderFile(int $tabSpace, string $area = 'JPATH_ADMINISTRATOR'): ?string
|
||||
{
|
||||
// we start building the autoloaded file loader
|
||||
// we start building the autoloader file loader
|
||||
$autoload_file = [];
|
||||
$autoload_file[] = Indent::_($tabSpace) . '//'
|
||||
. Line::_(__Line__, __Class__) . " The power autoloader for this project ($area) area.";
|
||||
@ -221,23 +237,21 @@ class Autoloader
|
||||
/**
|
||||
* Get autoloader code
|
||||
*
|
||||
* @param int $tabSpace The dynamic tab spacer
|
||||
*
|
||||
* @return string|null
|
||||
* @since 3.2.0
|
||||
*/
|
||||
private function getAutoloader(int $tabSpace): ?string
|
||||
private function getAutoloader(): ?string
|
||||
{
|
||||
if (($size = ArrayHelper::check($this->power->namespace)) > 0)
|
||||
{
|
||||
// we start building the spl_autoload_register function call
|
||||
$autoload_method = [];
|
||||
$autoload_method[] = Indent::_($tabSpace) . '//'
|
||||
$autoload_method[] = '//'
|
||||
. Line::_(__Line__, __Class__) . ' register additional namespace';
|
||||
$autoload_method[] = Indent::_($tabSpace) . 'spl_autoload_register(function ($class) {';
|
||||
$autoload_method[] = Indent::_($tabSpace) . Indent::_(1) . '//'
|
||||
$autoload_method[] = 'spl_autoload_register(function ($class) {';
|
||||
$autoload_method[] = Indent::_(1) . '//'
|
||||
. Line::_(__Line__, __Class__) . ' project-specific base directories and namespace prefix';
|
||||
$autoload_method[] = Indent::_($tabSpace) . Indent::_(1) . '$search = [';
|
||||
$autoload_method[] = Indent::_(1) . '$search = [';
|
||||
|
||||
// counter to manage the comma in the actual array
|
||||
$counter = 1;
|
||||
@ -246,63 +260,63 @@ class Autoloader
|
||||
// don't add the ending comma on last value
|
||||
if ($size == $counter)
|
||||
{
|
||||
$autoload_method[] = Indent::_($tabSpace) . Indent::_(2) . "'" . $this->config->get('jcb_powers_path', 'libraries/jcb_powers') . "/$base_dir' => '" . implode('\\\\', $prefix) . "'";
|
||||
$autoload_method[] = Indent::_(2) . "'" . $this->config->get('jcb_powers_path', 'libraries/jcb_powers') . "/$base_dir' => '" . implode('\\\\', $prefix) . "'";
|
||||
}
|
||||
else
|
||||
{
|
||||
$autoload_method[] = Indent::_($tabSpace) . Indent::_(2) . "'" . $this->config->get('jcb_powers_path', 'libraries/jcb_powers') . "/$base_dir' => '" . implode('\\\\', $prefix) . "',";
|
||||
$autoload_method[] = Indent::_(2) . "'" . $this->config->get('jcb_powers_path', 'libraries/jcb_powers') . "/$base_dir' => '" . implode('\\\\', $prefix) . "',";
|
||||
}
|
||||
$counter++;
|
||||
}
|
||||
$autoload_method[] = Indent::_($tabSpace) . Indent::_(1) . '];';
|
||||
$autoload_method[] = Indent::_($tabSpace) . Indent::_(1) . '// Start the search and load if found';
|
||||
$autoload_method[] = Indent::_($tabSpace) . Indent::_(1) . '$found = false;';
|
||||
$autoload_method[] = Indent::_($tabSpace) . Indent::_(1) . '$found_base_dir = "";';
|
||||
$autoload_method[] = Indent::_($tabSpace) . Indent::_(1) . '$found_len = 0;';
|
||||
$autoload_method[] = Indent::_($tabSpace) . Indent::_(1) . 'foreach ($search as $base_dir => $prefix)';
|
||||
$autoload_method[] = Indent::_($tabSpace) . Indent::_(1) . '{';
|
||||
$autoload_method[] = Indent::_($tabSpace) . Indent::_(2) . '//'
|
||||
$autoload_method[] = Indent::_(1) . '];';
|
||||
$autoload_method[] = Indent::_(1) . '// Start the search and load if found';
|
||||
$autoload_method[] = Indent::_(1) . '$found = false;';
|
||||
$autoload_method[] = Indent::_(1) . '$found_base_dir = "";';
|
||||
$autoload_method[] = Indent::_(1) . '$found_len = 0;';
|
||||
$autoload_method[] = Indent::_(1) . 'foreach ($search as $base_dir => $prefix)';
|
||||
$autoload_method[] = Indent::_(1) . '{';
|
||||
$autoload_method[] = Indent::_(2) . '//'
|
||||
. Line::_(__Line__, __Class__) . ' does the class use the namespace prefix?';
|
||||
$autoload_method[] = Indent::_($tabSpace) . Indent::_(2) . '$len = strlen($prefix);';
|
||||
$autoload_method[] = Indent::_($tabSpace) . Indent::_(2) . 'if (strncmp($prefix, $class, $len) === 0)';
|
||||
$autoload_method[] = Indent::_($tabSpace) . Indent::_(2) . '{';
|
||||
$autoload_method[] = Indent::_($tabSpace) . Indent::_(3) . '//'
|
||||
$autoload_method[] = Indent::_(2) . '$len = strlen($prefix);';
|
||||
$autoload_method[] = Indent::_(2) . 'if (strncmp($prefix, $class, $len) === 0)';
|
||||
$autoload_method[] = Indent::_(2) . '{';
|
||||
$autoload_method[] = Indent::_(3) . '//'
|
||||
. Line::_(__Line__, __Class__) . ' we have a match so load the values';
|
||||
$autoload_method[] = Indent::_($tabSpace) . Indent::_(3) . '$found = true;';
|
||||
$autoload_method[] = Indent::_($tabSpace) . Indent::_(3) . '$found_base_dir = $base_dir;';
|
||||
$autoload_method[] = Indent::_($tabSpace) . Indent::_(3) . '$found_len = $len;';
|
||||
$autoload_method[] = Indent::_($tabSpace) . Indent::_(3) . '//'
|
||||
$autoload_method[] = Indent::_(3) . '$found = true;';
|
||||
$autoload_method[] = Indent::_(3) . '$found_base_dir = $base_dir;';
|
||||
$autoload_method[] = Indent::_(3) . '$found_len = $len;';
|
||||
$autoload_method[] = Indent::_(3) . '//'
|
||||
. Line::_(__Line__, __Class__) . ' done here';
|
||||
$autoload_method[] = Indent::_($tabSpace) . Indent::_(3) . 'break;';
|
||||
$autoload_method[] = Indent::_($tabSpace) . Indent::_(2) . '}';
|
||||
$autoload_method[] = Indent::_($tabSpace) . Indent::_(1) . '}';
|
||||
$autoload_method[] = Indent::_(3) . 'break;';
|
||||
$autoload_method[] = Indent::_(2) . '}';
|
||||
$autoload_method[] = Indent::_(1) . '}';
|
||||
|
||||
$autoload_method[] = Indent::_($tabSpace) . Indent::_(1) . '//'
|
||||
$autoload_method[] = Indent::_(1) . '//'
|
||||
. Line::_(__Line__, __Class__) . ' check if we found a match';
|
||||
$autoload_method[] = Indent::_($tabSpace) . Indent::_(1) . 'if (!$found)';
|
||||
$autoload_method[] = Indent::_($tabSpace) . Indent::_(1) . '{';
|
||||
$autoload_method[] = Indent::_(1) . 'if (!$found)';
|
||||
$autoload_method[] = Indent::_(1) . '{';
|
||||
|
||||
$autoload_method[] = Indent::_($tabSpace) . Indent::_(2) . '//'
|
||||
$autoload_method[] = Indent::_(2) . '//'
|
||||
. Line::_(__Line__, __Class__) . ' not found so move to the next registered autoloader';
|
||||
$autoload_method[] = Indent::_($tabSpace) . Indent::_(2) . 'return;';
|
||||
$autoload_method[] = Indent::_(2) . 'return;';
|
||||
|
||||
$autoload_method[] = Indent::_($tabSpace) . Indent::_(1) . '}';
|
||||
$autoload_method[] = Indent::_(1) . '}';
|
||||
|
||||