Fixed issue #957 to load classes namespace. Refactored search classes. Improved the Power compiler class.

This commit is contained in:
Llewellyn van der Merwe 2022-10-06 19:34:44 +02:00
parent dcb4f86ee2
commit 9db33ad449
Signed by: Llewellyn
GPG Key ID: A9201372263741E7
40 changed files with 447 additions and 257 deletions

View File

@ -140,14 +140,14 @@ 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*: 20th September, 2022
+ *Last Build*: 6th October, 2022
+ *Version*: 3.1.8
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **331607**
+ *Line count*: **331795**
+ *Field count*: **2004**
+ *File count*: **2170**
+ *Folder count*: **376**
+ *File count*: **2172**
+ *Folder count*: **378**
> This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](http://joomlacomponentbuilder.com).
> Developed by [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)

View File

@ -140,14 +140,14 @@ 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*: 20th September, 2022
+ *Last Build*: 6th October, 2022
+ *Version*: 3.1.8
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **331607**
+ *Line count*: **331795**
+ *Field count*: **2004**
+ *File count*: **2170**
+ *Folder count*: **376**
+ *File count*: **2172**
+ *Folder count*: **378**
> This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](http://joomlacomponentbuilder.com).
> Developed by [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)

View File

@ -153,6 +153,8 @@
maxlength="150"
description="COM_COMPONENTBUILDER_ADMIN_CUSTOM_TABS_NAME_DESCRIPTION"
class="text_area"
readonly="false"
disabled="false"
required="true"
filter="STRING"
message="COM_COMPONENTBUILDER_ADMIN_CUSTOM_TABS_NAME_MESSAGE"

View File

@ -608,6 +608,8 @@
maxlength="150"
description="COM_COMPONENTBUILDER_ADMIN_VIEW_NAME_DESCRIPTION"
class="text_area"
readonly="false"
disabled="false"
required="true"
filter="STRING"
message="COM_COMPONENTBUILDER_ADMIN_VIEW_NAME_MESSAGE"
@ -1786,6 +1788,8 @@
maxlength="150"
description="COM_COMPONENTBUILDER_ADMIN_VIEW_NAME_DESCRIPTION"
class="text_area"
readonly="false"
disabled="false"
required="true"
filter="STRING"
message="COM_COMPONENTBUILDER_ADMIN_VIEW_NAME_MESSAGE"

View File

@ -102,6 +102,8 @@
maxlength="150"
description="COM_COMPONENTBUILDER_CLASS_EXTENDS_NAME_DESCRIPTION"
class="text_area"
readonly="false"
disabled="false"
required="true"
filter="STRING"
message="COM_COMPONENTBUILDER_CLASS_EXTENDS_NAME_MESSAGE"

View File

@ -102,6 +102,8 @@
maxlength="150"
description="COM_COMPONENTBUILDER_CLASS_METHOD_NAME_DESCRIPTION"
class="text_area"
readonly="false"
disabled="false"
required="true"
filter="STRING"
message="COM_COMPONENTBUILDER_CLASS_METHOD_NAME_MESSAGE"

View File

@ -102,6 +102,8 @@
maxlength="150"
description="COM_COMPONENTBUILDER_CLASS_PROPERTY_NAME_DESCRIPTION"
class="text_area"
readonly="false"
disabled="false"
required="true"
filter="STRING"
message="COM_COMPONENTBUILDER_CLASS_PROPERTY_NAME_MESSAGE"

View File

@ -137,6 +137,8 @@
maxlength="150"
description="COM_COMPONENTBUILDER_COMPONENT_CUSTOM_ADMIN_MENUS_NAME_DESCRIPTION"
class="text_area"
readonly="false"
disabled="false"
required="true"
filter="STRING"
message="COM_COMPONENTBUILDER_COMPONENT_CUSTOM_ADMIN_MENUS_NAME_MESSAGE"

View File

@ -138,6 +138,8 @@
maxlength="150"
description="COM_COMPONENTBUILDER_COMPONENT_DASHBOARD_NAME_DESCRIPTION"
class="text_area"
readonly="false"
disabled="false"
required="true"
filter="STRING"
message="COM_COMPONENTBUILDER_COMPONENT_DASHBOARD_NAME_MESSAGE"

View File

@ -116,6 +116,8 @@
maxlength="150"
description="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_NAME_DESCRIPTION"
class="text_area"
readonly="false"
disabled="false"
required="true"
filter="STRING"
message="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_NAME_MESSAGE"
@ -1118,6 +1120,8 @@
maxlength="150"
description="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_NAME_DESCRIPTION"
class="text_area"
readonly="false"
disabled="false"
required="true"
filter="STRING"
message="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_NAME_MESSAGE"

View File

@ -102,6 +102,8 @@
maxlength="150"
description="COM_COMPONENTBUILDER_DYNAMIC_GET_NAME_DESCRIPTION"
class="text_area"
readonly="false"
disabled="false"
required="true"
filter="STRING"
message="COM_COMPONENTBUILDER_DYNAMIC_GET_NAME_MESSAGE"

View File

@ -102,6 +102,8 @@
maxlength="150"
description="COM_COMPONENTBUILDER_FIELD_NAME_DESCRIPTION"
class="text_area"
readonly="false"
disabled="false"
required="true"
filter="STRING"
message="COM_COMPONENTBUILDER_FIELD_NAME_MESSAGE"

View File

@ -102,6 +102,8 @@
maxlength="150"
description="COM_COMPONENTBUILDER_FIELDTYPE_NAME_DESCRIPTION"
class="text_area"
readonly="false"
disabled="false"
required="true"
filter="STRING"
message="COM_COMPONENTBUILDER_FIELDTYPE_NAME_MESSAGE"
@ -322,6 +324,8 @@
maxlength="150"
description="COM_COMPONENTBUILDER_FIELDTYPE_NAME_DESCRIPTION"
class="text_area"
readonly="false"
disabled="false"
required="true"
filter="STRING"
message="COM_COMPONENTBUILDER_FIELDTYPE_NAME_MESSAGE"

View File

@ -1217,6 +1217,8 @@
maxlength="150"
description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NAME_DESCRIPTION"
class="text_area"
readonly="false"
disabled="false"
required="true"
filter="STRING"
message="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NAME_MESSAGE"

View File

@ -890,6 +890,8 @@
maxlength="150"
description="COM_COMPONENTBUILDER_JOOMLA_MODULE_NAME_DESCRIPTION"
class="text_area"
readonly="false"
disabled="false"
required="true"
filter="STRING"
message="COM_COMPONENTBUILDER_JOOMLA_MODULE_NAME_MESSAGE"

View File

@ -857,6 +857,8 @@
maxlength="150"
description="COM_COMPONENTBUILDER_JOOMLA_PLUGIN_NAME_DESCRIPTION"
class="text_area"
readonly="false"
disabled="false"
required="true"
filter="STRING"
message="COM_COMPONENTBUILDER_JOOMLA_PLUGIN_NAME_MESSAGE"

View File

@ -102,6 +102,8 @@
maxlength="150"
description="COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUP_NAME_DESCRIPTION"
class="text_area"
readonly="false"
disabled="false"
required="true"
filter="STRING"
message="COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUP_NAME_MESSAGE"

View File

@ -102,6 +102,8 @@
maxlength="150"
description="COM_COMPONENTBUILDER_LANGUAGE_NAME_DESCRIPTION"
class="text_area"
readonly="false"
disabled="false"
required="true"
filter="STRING"
message="COM_COMPONENTBUILDER_LANGUAGE_NAME_MESSAGE"

View File

@ -102,6 +102,8 @@
maxlength="150"
description="COM_COMPONENTBUILDER_LAYOUT_NAME_DESCRIPTION"
class="text_area"
readonly="false"
disabled="false"
required="true"
filter="STRING"
message="COM_COMPONENTBUILDER_LAYOUT_NAME_MESSAGE"

View File

@ -102,6 +102,8 @@
maxlength="150"
description="COM_COMPONENTBUILDER_LIBRARY_NAME_DESCRIPTION"
class="text_area"
readonly="false"
disabled="false"
required="true"
filter="STRING"
message="COM_COMPONENTBUILDER_LIBRARY_NAME_MESSAGE"

View File

@ -448,6 +448,8 @@
maxlength="150"
description="COM_COMPONENTBUILDER_POWER_NAME_DESCRIPTION"
class="text_area"
readonly="false"
disabled="false"
required="true"
filter="STRING"
message="COM_COMPONENTBUILDER_POWER_NAME_MESSAGE"

View File

@ -102,6 +102,8 @@
maxlength="150"
description="COM_COMPONENTBUILDER_SERVER_NAME_DESCRIPTION"
class="text_area"
readonly="false"
disabled="false"
required="true"
filter="STRING"
message="COM_COMPONENTBUILDER_SERVER_NAME_MESSAGE"

View File

@ -116,6 +116,8 @@
maxlength="150"
description="COM_COMPONENTBUILDER_SITE_VIEW_NAME_DESCRIPTION"
class="text_area"
readonly="false"
disabled="false"
required="true"
filter="STRING"
message="COM_COMPONENTBUILDER_SITE_VIEW_NAME_MESSAGE"
@ -1137,6 +1139,8 @@
maxlength="150"
description="COM_COMPONENTBUILDER_SITE_VIEW_NAME_DESCRIPTION"
class="text_area"
readonly="false"
disabled="false"
required="true"
filter="STRING"
message="COM_COMPONENTBUILDER_SITE_VIEW_NAME_MESSAGE"

View File

@ -102,6 +102,8 @@
maxlength="150"
description="COM_COMPONENTBUILDER_SNIPPET_NAME_DESCRIPTION"
class="text_area"
readonly="false"
disabled="false"
required="true"
filter="STRING"
message="COM_COMPONENTBUILDER_SNIPPET_NAME_MESSAGE"

View File

@ -102,6 +102,8 @@
maxlength="150"
description="COM_COMPONENTBUILDER_SNIPPET_TYPE_NAME_DESCRIPTION"
class="text_area"
readonly="false"
disabled="false"
required="true"
filter="STRING"
message="COM_COMPONENTBUILDER_SNIPPET_TYPE_NAME_MESSAGE"

View File

@ -102,6 +102,8 @@
maxlength="150"
description="COM_COMPONENTBUILDER_TEMPLATE_NAME_DESCRIPTION"
class="text_area"
readonly="false"
disabled="false"
required="true"
filter="STRING"
message="COM_COMPONENTBUILDER_TEMPLATE_NAME_MESSAGE"

View File

@ -2204,12 +2204,12 @@ INSERT INTO `#__componentbuilder_validation_rule` (`id`, `name`, `php`, `short_d
--
INSERT INTO `#__componentbuilder_field` (`id`, `add_css_view`, `add_css_views`, `add_javascript_view_footer`, `add_javascript_views_footer`, `css_view`, `css_views`, `datadefault`, `datadefault_other`, `datalenght`, `datalenght_other`, `datatype`, `indexes`, `javascript_view_footer`, `javascript_views_footer`, `name`, `null_switch`, `store`, `fieldtype`, `xml`, `published`, `created`, `modified`, `version`, `hits`, `ordering`, `guid`) VALUES
(23, '', '', '', '', '', '', '', '', 64, '', 'CHAR', '', '', '', 'Alias', 'NOT NULL', '', 24, '\"<field type=\\\"text\\\" name=\\\"alias\\\" label=\\\"Alias\\\" filter=\\\"STRING\\\" hint=\\\"Auto-generated from name\\\"\\/>\"', 1, '2015-04-09 13:46:04', '2016-05-05 22:30:18', 2, '', 216, '335866ce-b81b-4329-901d-c20254135c9c'),
(84, '', '', '', '', '', '', '', '', '', '', 'TEXT', '', '', '', 'Description (full width)', 'NOT NULL', '', 25, '\"<field \\r\\n\\ttype=\\\"textarea\\\" \\r\\n\\tname=\\\"description\\\" \\r\\n\\tlabel=\\\"Description\\\" \\r\\n\\trows=\\\"11\\\" \\r\\n\\tcols=\\\"10\\\" \\r\\n\\tdescription=\\\"Add Description Here\\\" \\r\\n\\tclass=\\\"text_area span12\\\" \\r\\n\\tfilter=\\\"HTML\\\" \\r\\n\\thint=\\\"Add Description Here\\\" \\r\\n\\/>\"', 1, '2015-03-19 18:20:49', '2016-10-20 17:01:21', 4, '', 265, '749a9917-90c3-49c4-9e72-aa33b0683a87'),
(23, '', '', '', '', '', '', '', '', 64, '', 'CHAR', '', '', '', 'Alias', 'NOT NULL', '', 24, '\"<field type=\\\"text\\\" name=\\\"alias\\\" label=\\\"Alias\\\" filter=\\\"STRING\\\" hint=\\\"Auto-generated from name\\\"\\/>\"', 1, '2015-04-09 13:46:04', '2022-09-21 10:17:10', 2, '', 216, '335866ce-b81b-4329-901d-c20254135c9c'),
(84, '', '', '', '', '', '', '', '', '', '', 'TEXT', '', '', '', 'Description (full width)', 'NOT NULL', '', 25, '\"<field \\r\\n\\ttype=\\\"textarea\\\" \\r\\n\\tname=\\\"description\\\" \\r\\n\\tlabel=\\\"Description\\\" \\r\\n\\trows=\\\"11\\\" \\r\\n\\tcols=\\\"10\\\" \\r\\n\\tdescription=\\\"Add Description Here\\\" \\r\\n\\tclass=\\\"text_area span12\\\" \\r\\n\\tfilter=\\\"HTML\\\" \\r\\n\\thint=\\\"Add Description Here\\\" \\r\\n\\/>\"', 1, '2015-03-19 18:20:49', '2022-09-21 10:17:10', 4, '', 265, '749a9917-90c3-49c4-9e72-aa33b0683a87'),
(100, '', '', '', '', '', '', '', '', 255, '', 'VARCHAR', '', '', '', 'Email (required)', 'NOT NULL', '', 24, '\"<field \\r\\n\\ttype=\\\"text\\\" \\r\\n\\tname=\\\"email\\\" \\r\\n\\tlabel=\\\"Email\\\" \\r\\n\\tsize=\\\"10\\\" \\r\\n\\tmaxlength=\\\"50\\\" \\r\\n\\tdescription=\\\"Enter Email\\\" \\r\\n\\tclass=\\\"text_area\\\"\\r\\n\\tfilter=\\\"STRING\\\" \\r\\n\\tvalidate=\\\"email\\\" \\r\\n\\trequired=\\\"true\\\"\\r\\n\\tmessage=\\\"Error! Please add email address here.\\\" \\r\\n\\thint=\\\"demo@example.com\\\" \\r\\n\\/>\"', 1, '2015-05-05 23:44:32', '2016-02-07 22:43:18', 4, '', 285, '10c1eccb-b3c3-4325-a056-45a72d116fd8'),
(158, '', '', '', '', '', '', '', '', 255, '', 'VARCHAR', '', '', '', 'Image', 'NOT NULL', '', 12, '\"<field\\n\\ttype=\\\"media\\\"\\n\\tname=\\\"image\\\"\\n\\tlabel=\\\"Image\\\"\\n\\/>\"', 1, '2015-04-29 14:00:56', '2020-06-07 02:17:46', 2, '', 45, '0d6970af-b361-4f65-84f6-0eb0c5f09bad'),
(196, '', '', '', '', '', '', '', '', 64, '', 'VARCHAR', '', '', '', 'Mobile Phone', 'NOT NULL', '', 23, '\"<field type=\\\"text\\\" \\r\\nname=\\\"mobile_phone\\\" \\r\\nlabel=\\\"Mobile Phone\\\" \\r\\nsize=\\\"10\\\" \\r\\nmaxlength=\\\"50\\\" \\r\\ndefault=\\\"\\\" \\r\\ndescription=\\\"Enter Mobile Phone Number\\\" \\r\\nclass=\\\"text_area\\\" \\r\\nfilter=\\\"STRING\\\" \\r\\nvalidated=\\\"tel\\\" \\r\\nrequired=\\\"true\\\" \\r\\nmessage=\\\"Error! Please add mobile phone number here.\\\" \\r\\nhint=\\\"Mobile Phone Here\\\" \\/>\"', 1, '2015-04-07 22:12:58', '2016-03-28 14:00:02', 2, '', 7, '65933a19-243a-48b2-aae9-34e2da710051'),
(199, '', '', '', '', '', '', '', '', 255, '', 'VARCHAR', 2, '', '', 'Name (required)', 'NOT NULL', '', 24, '\"<field\\n\\ttype=\\\"text\\\"\\n\\tname=\\\"name\\\"\\n\\tlabel=\\\"Name\\\"\\n\\tsize=\\\"40\\\"\\n\\tmaxlength=\\\"150\\\"\\n\\tdescription=\\\"Enter Name Here\\\"\\n\\tclass=\\\"text_area\\\"\\n\\trequired=\\\"true\\\"\\n\\tfilter=\\\"STRING\\\"\\n\\tmessage=\\\"Error! Please add name here.\\\"\\n\\thint=\\\"Name Here\\\"\\n\\/>\"', 1, '2015-03-19 17:30:59', '2021-08-05 08:42:17', 10, '', 4, '5d3d34dd-4876-4c6a-86ab-b4e162f22c08'),
(199, '', '', '', '', '', '', '', '', 255, '', 'VARCHAR', 2, '', '', 'Name', 'NOT NULL', '', 24, '\"<field\\r\\n\\ttype=\\\"text\\\" \\r\\n\\tname=\\\"name\\\" \\r\\n\\tlabel=\\\"Name\\\" \\r\\n\\tsize=\\\"40\\\" \\r\\n\\tmaxlength=\\\"150\\\" \\r\\n\\tdescription=\\\"Enter Name Here\\\" \\r\\n\\tclass=\\\"text_area\\\" \\r\\n\\treadonly=\\\"false\\\" \\r\\n\\tdisabled=\\\"false\\\" \\r\\n\\trequired=\\\"true\\\"\\r\\n\\tfilter=\\\"STRING\\\" \\r\\n\\tmessage=\\\"Error! Please add name here.\\\" \\r\\n\\thint=\\\"Name Here\\\" \\r\\n\\/>\"', 1, '2015-03-19 17:30:59', '2022-09-21 10:17:10', 8, '', 4, '5d3d34dd-4876-4c6a-86ab-b4e162f22c08'),
(203, '', '', '', '', '', '', '', '', 1, '', 'INT', '', '', '', 'Not Required', 'NOT NULL', '', 9, '\"<field\\n\\ttype=\\\"hidden\\\"\\n\\tname=\\\"not_required\\\"\\n\\tdefault=\\\"\\u4e00_\\u4e00\\\"\\n\\/>\"', 1, '2015-05-08 16:19:16', '2020-02-27 20:17:33', 13, '', 19, 'da5e6901-6958-40e5-a4f5-6822d6fe57ac'),
(280, '', '', '', '', '', '', '', '', 255, '', 'VARCHAR', '', '', '', 'Website', 'NOT NULL', '', 27, '\"<field\\n\\ttype=\\\"url\\\"\\n\\tname=\\\"website\\\"\\n\\tlabel=\\\"Website\\\"\\n\\tsize=\\\"60\\\"\\n\\tmaxlength=\\\"150\\\"\\n\\tdescription=\\\"Enter website address\\\"\\n\\tclass=\\\"text_area\\\"\\n\\tfilter=\\\"url\\\"\\n\\tvalidated=\\\"url\\\"\\n\\tmessage=\\\"Error! Please add website here.\\\"\\n\\thint=\\\"http:\\/\\/www.example.com\\\"\\n\\tscheme=\\\"http,https\\\"\\n\\/>\"', 1, '2015-04-08 00:36:16', '2018-07-08 00:11:05', 2, '', 105, '6c3a6983-d1bf-4e5e-9e99-deea00b0cefd'),
(682, '', '', '', '', '', '', '', '', 1, '', 'TINYINT', 2, '', '', 'Add More', 'NOT NULL', '', 17, '\"<field \\r\\n\\ttype=\\\"radio\\\" \\r\\n\\tname=\\\"add\\\" \\r\\n\\tlabel=\\\"Add More\\\" \\r\\n\\tdescription=\\\"\\\" \\r\\n\\tclass=\\\"btn-group btn-group-yesno\\\" \\r\\n\\toption=\\\"1|Yes,0|No\\\" \\r\\n\\tdefault=\\\"0\\\" \\r\\n\\trequired=\\\"true\\\" \\r\\n\\/>\"', 1, '2015-08-05 01:18:20', '2018-03-30 09:30:45', 4, '', 196, 'a66389aa-2323-4f44-8c23-ff44969639be'),

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="4" method="upgrade">
<name>COM_COMPONENTBUILDER</name>
<creationDate>20th September, 2022</creationDate>
<creationDate>6th October, 2022</creationDate>
<author>Llewellyn van der Merwe</author>
<authorEmail>joomla@vdm.io</authorEmail>
<authorUrl>https://dev.vdm.io</authorUrl>

View File

@ -9,10 +9,10 @@
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Componentbuilder;
namespace VDM\Joomla\Componentbuilder\Abstraction;
use Joomla\Registry\Registry;
use Joomla\Registry\Registry as JoomlaRegistry;
use Joomla\CMS\Factory;
use Joomla\Input\Input;
use VDM\Joomla\Utilities\Component\Helper;
@ -20,11 +20,11 @@ use VDM\Joomla\Utilities\String\ClassfunctionHelper;
/**
* Configurations
* Registry
*
* @since 3.2.0
*/
abstract class BaseConfig extends Registry
abstract class Registry extends JoomlaRegistry
{
/**
* Hold a JInput object for easier access to the input variables.
@ -37,10 +37,10 @@ abstract class BaseConfig extends Registry
/**
* The Params
*
* @var Registry
* @var JoomlaRegistry
* @since 3.2.0
*/
protected Registry $params;
protected JoomlaRegistry $params;
/**
* Constructor
@ -51,7 +51,7 @@ abstract class BaseConfig extends Registry
* @throws \Exception
* @since 3.2.0
*/
public function __construct(?Input $input = null, ?Registry $params = null)
public function __construct(?Input $input = null, ?JoomlaRegistry $params = null)
{
$this->input = $input ?: Factory::getApplication()->input;
$this->params = $params ?: Helper::getParams('com_componentbuilder');
@ -92,7 +92,7 @@ abstract class BaseConfig extends Registry
return $value;
}
throw new \InvalidArgumentException(sprintf('Argument %s could not be found as function [%s], or path.', $key, $method));
throw new \InvalidArgumentException(sprintf('Argument %s could not be found as function or path.', $key));
}
/**

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -14,7 +14,7 @@ namespace VDM\Joomla\Componentbuilder\Compiler;
use VDM\Joomla\Utilities\GetHelper;
use VDM\Joomla\Utilities\StringHelper;
use VDM\Joomla\Componentbuilder\BaseConfig;
use VDM\Joomla\Componentbuilder\Abstraction\Registry;
/**
@ -22,7 +22,7 @@ use VDM\Joomla\Componentbuilder\BaseConfig;
*
* @since 3.2.0
*/
class Config extends BaseConfig
class Config extends Registry
{
/**
* get posted component id

View File

@ -44,6 +44,14 @@ class Power implements PowerInterface
**/
public array $active = [];
/**
* The url to the power, if there is an error.
*
* @var string
* @since 3.2.0
**/
protected string $fixUrl;
/**
* The state of all loaded powers
*
@ -200,7 +208,7 @@ class Power implements PowerInterface
$tmp_lang_target = $this->config->lang_target;
$this->config->lang_target = 'both';
// we set the fix usr if needed
$fix_url
$this->fixUrl
= '"index.php?option=com_componentbuilder&view=powers&task=power.edit&id='
. $this->active[$guid]->id . '" target="_blank"';
// set some keys
@ -219,217 +227,37 @@ class Power implements PowerInterface
$this->active[$guid]->official_name = StringHelper::safe(
$this->active[$guid]->name, 'W'
);
// set namespace
$this->active[$guid]->namespace = $this->placeholder->update(
$this->active[$guid]->namespace, $this->placeholder->active
);
// validate namespace
if (strpos($this->active[$guid]->namespace, '\\') === false)
// set name space
if (!$this->setNamespace($guid))
{
// we raise an error message
$this->app->enqueueMessage(
Text::sprintf('COM_COMPONENTBUILDER_HTHREES_NAMESPACE_ERROR_SHTHREEPYOU_MUST_ATLEAST_HAVE_TWO_SECTIONS_IN_YOUR_NAMESPACE_YOU_JUST_HAVE_ONE_THIS_IS_AN_UNACCEPTABLE_ACTION_PLEASE_SEE_A_HREFS_PSRFOURA_FOR_MORE_INFOPPTHIS_S_WAS_THEREFORE_REMOVED_A_HREFSCLICK_HEREA_TO_FIX_THIS_ISSUEP',
ucfirst($this->active[$guid]->type), $this->active[$guid]->name, $this->active[$guid]->namespace,
'"https://www.php-fig.org/psr/psr-4/" target="_blank"', $this->active[$guid]->type,
$fix_url),
'Error'
);
$this->state[$guid] = false;
unset($this->active[$guid]);
// reset back to starting value
$this->config->lang_target = $tmp_lang_target;
// we break out here
return false;
}
else
{
// setup the path array
$path_array = (array) explode('\\', $this->active[$guid]->namespace);
// make sure all sub folders in src dir is set and remove all characters that will not work in folders naming
$this->active[$guid]->namespace = NamespaceHelper::safe(str_replace('.', '\\', $this->active[$guid]->namespace));
// make sure it has two or more
if (ArrayHelper::check($path_array) <= 1)
{
// we raise an error message
$this->app->enqueueMessage(
Text::sprintf('COM_COMPONENTBUILDER_HTHREES_NAMESPACE_ERROR_SHTHREEPYOU_MUST_ATLEAST_HAVE_TWO_SECTIONS_IN_YOUR_NAMESPACE_YOU_JUST_HAVE_ONE_S_THIS_IS_AN_UNACCEPTABLE_ACTION_PLEASE_SEE_A_HREFS_PSRFOURA_FOR_MORE_INFOPPTHIS_S_WAS_THEREFORE_REMOVED_A_HREFSCLICK_HEREA_TO_FIX_THIS_ISSUEP',
ucfirst($this->active[$guid]->type), $this->active[$guid]->name, $this->active[$guid]->namespace,
'"https://www.php-fig.org/psr/psr-4/" target="_blank"', $this->active[$guid]->type,
$fix_url),
'Error'
);
$this->state[$guid] = false;
unset($this->active[$guid]);
// reset back to starting value
$this->config->lang_target = $tmp_lang_target;
// we break out here
return false;
}
// get the file and class name (the last value in array)
$file_name = array_pop($path_array);
// src array bucket
$src_array = array();
// do we have src folders
if (strpos($file_name, '.') !== false)
{
// we have src folders in the namespace
$src_array = (array) explode('.', $file_name);
// get the file and class name (the last value in array)
$this->active[$guid]->file_name = array_pop($src_array);
// namespace array
$namespace_array = array_merge($path_array, $src_array);
}
else
{
// set the file name
$this->active[$guid]->file_name = $file_name;
// namespace array
$namespace_array = $path_array;
}
// the last value is the same as the class name
if ($this->active[$guid]->file_name !== $this->active[$guid]->class_name)
{
// we raise an error message
$this->app->enqueueMessage(
Text::sprintf('COM_COMPONENTBUILDER_PS_NAMING_MISMATCH_ERROR_SPPTHE_S_NAME_IS_BSB_AND_THE_ENDING_FILE_NAME_IN_THE_NAMESPACE_IS_BSB_THIS_IS_BAD_CONVENTION_PLEASE_SEE_A_HREFS_PSRFOURA_FOR_MORE_INFOPPA_HREFSCLICK_HEREA_TO_FIX_THIS_ISSUEP',
ucfirst($this->active[$guid]->type), $this->active[$guid]->name, $this->active[$guid]->type, $this->active[$guid]->class_name, $this->active[$guid]->file_name,
'"https://www.php-fig.org/psr/psr-4/" target="_blank"',
$fix_url),
'Error'
);
$this->state[$guid] = false;
unset($this->active[$guid]);
// reset back to starting value
$this->config->lang_target = $tmp_lang_target;
// we break out here
return false;
}
// make sure the arrays are namespace safe
$path_array = array_map(function ($val) {
return NamespaceHelper::safe($val);
}, $path_array);
$namespace_array = array_map(function ($val) {
return NamespaceHelper::safe($val);
}, $namespace_array);
// set the actual class namespace
$this->active[$guid]->_namespace = implode('\\', $namespace_array);
// prefix values
$this->active[$guid]->_namespace_prefix = $path_array;
// get the parent folder (the first value in array)
$prefix_folder = implode('.', $path_array);
// make sub folders if still found
$sub_folder = '';
if (ArrayHelper::check($src_array))
{
// make sure the arrays are namespace safe
$sub_folder = '/' . implode('/', array_map(function ($val) {
return NamespaceHelper::safe($val);
}, $src_array));
}
// now we set the paths
$this->active[$guid]->path_jcb = $this->config->get('jcb_powers_path', 'libraries/jcb_powers');
$this->active[$guid]->path_parent = $this->active[$guid]->path_jcb . '/' . $prefix_folder;
$this->active[$guid]->path = $this->active[$guid]->path_parent . '/src' . $sub_folder;
}
// load use ids
$use = array();
$as = array();
// check if we have use selection
$this->active[$guid]->use_selection = (isset($this->active[$guid]->use_selection)
&& JsonHelper::check(
$this->active[$guid]->use_selection
)) ? json_decode($this->active[$guid]->use_selection, true) : null;
if ($this->active[$guid]->use_selection)
{
$use = array_values(array_map(function ($u) use(&$as) {
// track the AS options
if (empty($u['as']))
{
$as[$u['use']] = 'default';
}
else
{
$as[$u['use']] = (string) $u['as'];
}
// return the guid
return $u['use'];
}, $this->active[$guid]->use_selection));
}
// check if we have load selection
$this->active[$guid]->load_selection = (isset($this->active[$guid]->load_selection)
&& JsonHelper::check(
$this->active[$guid]->load_selection
)) ? json_decode($this->active[$guid]->load_selection, true) : null;
if ($this->active[$guid]->load_selection)
{
// load use ids
array_map(function ($l) {
// just load it directly and be done with it
return $this->set($l['load']);
}, $this->active[$guid]->load_selection);
}
// see if we have implements
$this->active[$guid]->implement_names = array();
// does this implement
$this->active[$guid]->implements = (isset($this->active[$guid]->implements)
&& JsonHelper::check(
$this->active[$guid]->implements
)) ? json_decode($this->active[$guid]->implements, true) : null;
if ($this->active[$guid]->implements)
{
foreach ($this->active[$guid]->implements as $implement)
{
if ($implement == -1
&& StringHelper::check($this->active[$guid]->implements_custom))
{
$this->active[$guid]->implement_names[] = $this->placeholder->update(
$this->customcode->update($this->active[$guid]->implements_custom),
$this->placeholder->active
);
// just add this once
unset($this->active[$guid]->implements_custom);
}
// does this extend existing
elseif (GuidHelper::valid($implement))
{
// check if it was set
if ($this->set($implement))
{
// get the name
$this->active[$guid]->implement_names[] = $this->get($implement, 1)->class_name;
// add to use
$use[] = $implement;
}
}
}
}
// does this extend something
$this->active[$guid]->extends_name = null;
// we first check for custom extending options
if ($this->active[$guid]->extends == -1
&& StringHelper::check($this->active[$guid]->extends_custom))
{
$this->active[$guid]->extends_name = $this->placeholder->update(
$this->customcode->update($this->active[$guid]->extends_custom),
$this->placeholder->active
);
// just add once
unset($this->active[$guid]->extends_custom);
}
// does this extend existing
elseif (GuidHelper::valid($this->active[$guid]->extends))
{
// check if it was set
if ($this->set($this->active[$guid]->extends))
{
// get the name
$this->active[$guid]->extends_name = $this->get($this->active[$guid]->extends, 1)->class_name;
// add to use
$use[] = $this->active[$guid]->extends;
}
}
$use = [];
$as = [];
// set extra classes
$this->setLoadSelection($guid);
// set use classes
$this->setUseSelection($guid, $use, $as);
// set implement interfaces
$this->setImplements($guid, $use);
// set extend class
$this->setExtend($guid, $use);
// set GUI mapper
$guiMapper = array('table' => 'power', 'id' => (int) $this->active[$guid]->id, 'type' => 'php');
// add the licensing template
if ($this->active[$guid]->add_licensing_template == 2 &&
StringHelper::check($this->active[$guid]->licensing_template))
@ -453,6 +281,7 @@ class Power implements PowerInterface
$this->active[$guid]->add_licensing_template = 1;
$this->active[$guid]->licensing_template = '';
}
// add the header script
if ($this->active[$guid]->add_head == 1)
{
@ -470,35 +299,13 @@ class Power implements PowerInterface
$guiMapper
) . PHP_EOL;
}
// now add all the extra use statements
if (ArrayHelper::check($use))
{
foreach (array_unique($use) as $u)
{
if ($this->set($u))
{
$add_use = $this->get($u, 1)->namespace;
// check if it is already added manually, you know how some people are
if (strpos($this->active[$guid]->head, $add_use) === false)
{
// check if it has an AS option
if (isset($as[$u]) && StringHelper::check($as[$u]) && $as[$u] !== 'default')
{
$this->active[$guid]->head .= 'use ' . $add_use . ' as ' . $as[$u] . ';' . PHP_EOL;
}
else
{
$this->active[$guid]->head .= 'use ' . $add_use . ';' . PHP_EOL;
}
}
}
}
}
// now set the description
$this->active[$guid]->description = (StringHelper::check($this->active[$guid]->description)) ? $this->placeholder->update(
$this->customcode->update($this->active[$guid]->description),
$this->placeholder->active
) : '';
// add the main code if set
if (StringHelper::check($this->active[$guid]->main_class_code))
{
@ -516,6 +323,10 @@ class Power implements PowerInterface
$guiMapper
);
}
// load the use classes
$this->setUseAs($guid, $use, $as);
// reset back to starting value
$this->config->lang_target = $tmp_lang_target;
@ -536,6 +347,327 @@ class Power implements PowerInterface
$this->state[$guid] = false;
return false;
}
}
/**
* Set the namespace for this power
*
* @param string $guid The global unique id of the power
*
* @return void
* @since 3.2.0
*/
protected function setNamespace(string $guid)
{
// set namespace
$this->active[$guid]->namespace = $this->placeholder->update(
$this->active[$guid]->namespace, $this->placeholder->active
);
// validate namespace
if (strpos($this->active[$guid]->namespace, '\\') === false)
{
// we raise an error message
$this->app->enqueueMessage(
Text::sprintf('COM_COMPONENTBUILDER_HTHREES_NAMESPACE_ERROR_SHTHREEPYOU_MUST_ATLEAST_HAVE_TWO_SECTIONS_IN_YOUR_NAMESPACE_YOU_JUST_HAVE_ONE_THIS_IS_AN_UNACCEPTABLE_ACTION_PLEASE_SEE_A_HREFS_PSRFOURA_FOR_MORE_INFOPPTHIS_S_WAS_THEREFORE_REMOVED_A_HREFSCLICK_HEREA_TO_FIX_THIS_ISSUEP',
ucfirst($this->active[$guid]->type), $this->active[$guid]->name, $this->active[$guid]->namespace,
'"https://www.php-fig.org/psr/psr-4/" target="_blank"', $this->active[$guid]->type,
$this->fixUrl),
'Error'
);
// we break out here
return false;
}
// setup the path array
$path_array = (array) explode('\\', $this->active[$guid]->namespace);
// make sure all sub folders in src dir is set and remove all characters that will not work in folders naming
$this->active[$guid]->namespace = NamespaceHelper::safe(str_replace('.', '\\', $this->active[$guid]->namespace));
// make sure it has two or more
if (ArrayHelper::check($path_array) <= 1)
{
// we raise an error message
$this->app->enqueueMessage(
Text::sprintf('COM_COMPONENTBUILDER_HTHREES_NAMESPACE_ERROR_SHTHREEPYOU_MUST_ATLEAST_HAVE_TWO_SECTIONS_IN_YOUR_NAMESPACE_YOU_JUST_HAVE_ONE_S_THIS_IS_AN_UNACCEPTABLE_ACTION_PLEASE_SEE_A_HREFS_PSRFOURA_FOR_MORE_INFOPPTHIS_S_WAS_THEREFORE_REMOVED_A_HREFSCLICK_HEREA_TO_FIX_THIS_ISSUEP',
ucfirst($this->active[$guid]->type), $this->active[$guid]->name, $this->active[$guid]->namespace,
'"https://www.php-fig.org/psr/psr-4/" target="_blank"', $this->active[$guid]->type,
$this->fixUrl),
'Error'
);
// we break out here
return false;
}
// get the file and class name (the last value in array)
$file_name = array_pop($path_array);
// src array bucket
$src_array = [];
// do we have src folders
if (strpos($file_name, '.') !== false)
{
// we have src folders in the namespace
$src_array = (array) explode('.', $file_name);
// get the file and class name (the last value in array)
$this->active[$guid]->file_name = array_pop($src_array);
// namespace array
$namespace_array = array_merge($path_array, $src_array);
}
else
{
// set the file name
$this->active[$guid]->file_name = $file_name;
// namespace array
$namespace_array = $path_array;
}
// the last value is the same as the class name
if ($this->active[$guid]->file_name !== $this->active[$guid]->class_name)
{
// we raise an error message
$this->app->enqueueMessage(
Text::sprintf('COM_COMPONENTBUILDER_PS_NAMING_MISMATCH_ERROR_SPPTHE_S_NAME_IS_BSB_AND_THE_ENDING_FILE_NAME_IN_THE_NAMESPACE_IS_BSB_THIS_IS_BAD_CONVENTION_PLEASE_SEE_A_HREFS_PSRFOURA_FOR_MORE_INFOPPA_HREFSCLICK_HEREA_TO_FIX_THIS_ISSUEP',
ucfirst($this->active[$guid]->type), $this->active[$guid]->name, $this->active[$guid]->type, $this->active[$guid]->class_name, $this->active[$guid]->file_name,
'"https://www.php-fig.org/psr/psr-4/" target="_blank"',
$this->fixUrl),
'Error'
);
// we break out here
return false;
}
// make sure the arrays are namespace safe
$path_array = array_map(function ($val) {
return NamespaceHelper::safe($val);
}, $path_array);
$namespace_array = array_map(function ($val) {
return NamespaceHelper::safe($val);
}, $namespace_array);
// set the actual class namespace
$this->active[$guid]->_namespace = implode('\\', $namespace_array);
// prefix values
$this->active[$guid]->_namespace_prefix = $path_array;
// get the parent folder (the first value in array)
$prefix_folder = implode('.', $path_array);
// make sub folders if still found
$sub_folder = '';
if (ArrayHelper::check($src_array))
{
// make sure the arrays are namespace safe
$sub_folder = '/' . implode('/', array_map(function ($val) {
return NamespaceHelper::safe($val);
}, $src_array));
}
// now we set the paths
$this->active[$guid]->path_jcb = $this->config->get('jcb_powers_path', 'libraries/jcb_powers');
$this->active[$guid]->path_parent = $this->active[$guid]->path_jcb . '/' . $prefix_folder;
$this->active[$guid]->path = $this->active[$guid]->path_parent . '/src' . $sub_folder;
return true;
}
/**
* Set Use Classess
*
* @param string $guid The global unique id of the power
* @param array $use The use array
* @param array $as The use as array
*
* @return void
* @since 3.2.0
*/
protected function setUseSelection(string $guid, array &$use, array &$as)
{
// check if we have use selection
$this->active[$guid]->use_selection = (isset($this->active[$guid]->use_selection)
&& JsonHelper::check(
$this->active[$guid]->use_selection
)) ? json_decode($this->active[$guid]->use_selection, true) : null;
if ($this->active[$guid]->use_selection)
{
$use = array_values(array_map(function ($u) use(&$as) {
// track the AS options
if (empty($u['as']))
{
$as[$u['use']] = 'default';
}
else
{
$as[$u['use']] = (string) $u['as'];
}
// return the guid
return $u['use'];
}, $this->active[$guid]->use_selection));
}
}
/**
* Load Extra Classes
*
* @param string $guid The global unique id of the power
*
* @return void
* @since 3.2.0
*/
protected function setLoadSelection(string $guid)
{
// check if we have load selection
$this->active[$guid]->load_selection = (isset($this->active[$guid]->load_selection)
&& JsonHelper::check(
$this->active[$guid]->load_selection
)) ? json_decode($this->active[$guid]->load_selection, true) : null;
if ($this->active[$guid]->load_selection)
{
// load use ids
array_map(function ($power) {
// just load it directly and be done with it
return $this->set($power['load']);
}, $this->active[$guid]->load_selection);
}
}
/**
* Set Implements Interface classes
*
* @param string $guid The global unique id of the power
* @param array $use The use array
*
* @return void
* @since 3.2.0
*/
protected function setImplements(string $guid, array &$use)
{
// see if we have implements
$this->active[$guid]->implement_names = [];
// does this implement
$this->active[$guid]->implements = (isset($this->active[$guid]->implements)
&& JsonHelper::check(
$this->active[$guid]->implements
)) ? json_decode($this->active[$guid]->implements, true) : null;
if ($this->active[$guid]->implements)
{
foreach ($this->active[$guid]->implements as $implement)
{
if ($implement == -1
&& StringHelper::check($this->active[$guid]->implements_custom))
{
$this->active[$guid]->implement_names[] = $this->placeholder->update(
$this->customcode->update($this->active[$guid]->implements_custom),
$this->placeholder->active
);
// just add this once
unset($this->active[$guid]->implements_custom);
}
// does this extend existing
elseif (GuidHelper::valid($implement))
{
// check if it was set
if ($this->set($implement))
{
// get the name
$this->active[$guid]->implement_names[] = $this->get($implement, 1)->class_name;
// add to use
$use[] = $implement;
}
}
}
}
}
/**
* Set Extend Class
*
* @param string $guid The global unique id of the power
* @param array $use The use array
*
* @return void
* @since 3.2.0
*/
protected function setExtend(string $guid, array &$use)
{
// does this extend something
$this->active[$guid]->extends_name = null;
// we first check for custom extending options
if ($this->active[$guid]->extends == -1
&& StringHelper::check($this->active[$guid]->extends_custom))
{
$this->active[$guid]->extends_name = $this->placeholder->update(
$this->customcode->update($this->active[$guid]->extends_custom),
$this->placeholder->active
);
// just add once
unset($this->active[$guid]->extends_custom);
}
// does this extend existing
elseif (GuidHelper::valid($this->active[$guid]->extends))
{
// check if it was set
if ($this->set($this->active[$guid]->extends))
{
// get the name
$this->active[$guid]->extends_name = $this->get($this->active[$guid]->extends, 1)->class_name;
// add to use
$use[] = $this->active[$guid]->extends;
}
}
}
/**
* Set Extra Use Classes
*
* @param string $guid The global unique id of the power
* @param array $use The use array
*
* @return void
* @since 3.2.0
*/
protected function setUseAs($guid, $use, $as)
{
// now add all the extra use statements
if (ArrayHelper::check($use))
{
foreach (array_unique($use) as $u)
{
if ($this->set($u))
{
// get the namespace
$add_use = $this->get($u, 1)->namespace;
// check if it has an AS option
if (isset($as[$u]) && StringHelper::check($as[$u]) && $as[$u] !== 'default')
{
$add_use = 'use ' . $add_use . ' as ' . $as[$u] . ';';
}
else
{
$add_use = 'use ' . $add_use . ';';
}
// check if it is already added manually
if (strpos($this->active[$guid]->head, $add_use) === false)
{
$this->active[$guid]->head .= $add_use . PHP_EOL;
}
}
}
}
}
}

View File

@ -9,7 +9,7 @@
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Componentbuilder\Search;
namespace VDM\Joomla\Componentbuilder\Search\Abstraction;
use VDM\Joomla\Utilities\StringHelper;

View File

@ -9,7 +9,7 @@
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Componentbuilder\Search;
namespace VDM\Joomla\Componentbuilder\Search\Abstraction;
use VDM\Joomla\Componentbuilder\Search\Factory;

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -12,7 +12,7 @@
namespace VDM\Joomla\Componentbuilder\Search;
use VDM\Joomla\Componentbuilder\BaseConfig;
use VDM\Joomla\Componentbuilder\Abstraction\Registry;
/**
@ -20,7 +20,7 @@ use VDM\Joomla\Componentbuilder\BaseConfig;
*
* @since 3.2.0
*/
class Config extends BaseConfig
class Config extends Registry
{
/**
* get posted search value

View File

@ -15,7 +15,7 @@ namespace VDM\Joomla\Componentbuilder\Search\Model;
use VDM\Joomla\Utilities\JsonHelper;
use VDM\Joomla\Utilities\StringHelper;
use VDM\Joomla\Componentbuilder\Search\Interfaces\ModelInterface;
use VDM\Joomla\Componentbuilder\Search\Model;
use VDM\Joomla\Componentbuilder\Search\Abstraction\Model;
/**

View File

@ -13,7 +13,7 @@ namespace VDM\Joomla\Componentbuilder\Search\Model;
use VDM\Joomla\Componentbuilder\Search\Interfaces\ModelInterface;
use VDM\Joomla\Componentbuilder\Search\Model;
use VDM\Joomla\Componentbuilder\Search\Abstraction\Model;
/**

View File

@ -16,7 +16,7 @@ use VDM\Joomla\Componentbuilder\Search\Config;
use VDM\Joomla\Utilities\StringHelper;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Componentbuilder\Search\Interfaces\SearchTypeInterface;
use VDM\Joomla\Componentbuilder\Search\Type;
use VDM\Joomla\Componentbuilder\Search\Abstraction\Type;
/**

View File

@ -16,7 +16,7 @@ use VDM\Joomla\Componentbuilder\Search\Config;
use VDM\Joomla\Utilities\StringHelper;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Componentbuilder\Search\Interfaces\SearchTypeInterface;
use VDM\Joomla\Componentbuilder\Search\Type;
use VDM\Joomla\Componentbuilder\Search\Abstraction\Type;
/**