diff --git a/CHANGELOG.md b/CHANGELOG.md index 7958c8278..a66b80a50 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# v3.2.0-beta4 + +- Add Preferred Joomla Version to Components + # v3.2.0-beta3 - Move the old helper compiler files to powers @@ -8,11 +12,11 @@ - Move beta to main repo - Fix #1053 so that the right and left tabs display correctly in Joomla 4&5 -# v3.1.42-beta +# v3.1.42 - Fix #1055 to add the style and scripts to all views. -# v3.1.40-beta +# v3.1.40 - Fix #1052 so that tabs last opened is remembered and opened again on save, refresh or reopening of an item. - Fix #1057 so that the datetime fields will be set correctly in mysql. diff --git a/README.md b/README.md index 7e06feea0..54ed30d2f 100644 --- a/README.md +++ b/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.0-beta3) 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.0-beta4) 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,14 +144,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*: 6th March, 2024 -+ *Version*: 3.2.0-beta3 ++ *Last Build*: 7th March, 2024 ++ *Version*: 3.2.0-beta4 + *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved. + *License*: GNU General Public License version 2 or later; see LICENSE.txt -+ *Line count*: **729192** -+ *Field count*: **2077** -+ *File count*: **5132** -+ *Folder count*: **455** ++ *Line count*: **741812** ++ *Field count*: **2078** ++ *File count*: **5204** ++ *Folder count*: **462** > This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](https://www.joomlacomponentbuilder.com). > Developed by [Llewellyn van der Merwe](mailto:joomla@vdm.io) diff --git a/admin/README.txt b/admin/README.txt index 7e06feea0..54ed30d2f 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -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.0-beta3) 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.0-beta4) 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,14 +144,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*: 6th March, 2024 -+ *Version*: 3.2.0-beta3 ++ *Last Build*: 7th March, 2024 ++ *Version*: 3.2.0-beta4 + *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved. + *License*: GNU General Public License version 2 or later; see LICENSE.txt -+ *Line count*: **729192** -+ *Field count*: **2077** -+ *File count*: **5132** -+ *Folder count*: **455** ++ *Line count*: **741812** ++ *Field count*: **2078** ++ *File count*: **5204** ++ *Folder count*: **462** > This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](https://www.joomlacomponentbuilder.com). > Developed by [Llewellyn van der Merwe](mailto:joomla@vdm.io) diff --git a/admin/controllers/joomla_component.php b/admin/controllers/joomla_component.php index dad4ff0a0..6283588d9 100644 --- a/admin/controllers/joomla_component.php +++ b/admin/controllers/joomla_component.php @@ -371,7 +371,8 @@ class ComponentbuilderControllerJoomla_component extends FormController 'component_dashboard' => 'joomla_component', 'component_files_folders' => 'joomla_component', 'component_placeholders' => 'joomla_component', - 'custom_code' => 'component' + 'custom_code' => 'component', + 'component_router' => 'joomla_component' ); foreach($_tablesArray as $_updateTable => $_key) { diff --git a/admin/language/en-GB/en-GB.com_componentbuilder.ini b/admin/language/en-GB/en-GB.com_componentbuilder.ini index 37407c526..6ac3d0bb9 100644 --- a/admin/language/en-GB/en-GB.com_componentbuilder.ini +++ b/admin/language/en-GB/en-GB.com_componentbuilder.ini @@ -5899,6 +5899,7 @@ COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_PREFLIGHT_UPDATE_DESCRIPTION="PHP scri COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_PREFLIGHT_UPDATE_LABEL="PHP Preflight (update)" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_SITE_EVENT_DESCRIPTION="PHP script for the global helper site event method." COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_SITE_EVENT_LABEL="Global Helper Site Event (method)" +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PREFERRED_JOOMLA_VERSION_LABEL="Preferred Joomla Version" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PUBLISHING="Publishing" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_README="Readme" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_README_LABEL="README.md" @@ -5979,7 +5980,8 @@ COM_COMPONENTBUILDER_JOOMLA_COMPONENT_WHMCS_URL_MESSAGE="Error! Please add websi COM_COMPONENTBUILDER_JOOMLA_COMPONENT_YES="Yes" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ZIP="ZIP" COM_COMPONENTBUILDER_JOOMLA_FIELDS="Joomla fields" -COM_COMPONENTBUILDER_JOOMLA_FOUR_AND_FIVE="Joomla 4 and 5" +COM_COMPONENTBUILDER_JOOMLA_FIVE="Joomla 5" +COM_COMPONENTBUILDER_JOOMLA_FOUR="Joomla 4" COM_COMPONENTBUILDER_JOOMLA_MODULE="Joomla Module" COM_COMPONENTBUILDER_JOOMLA_MODULES="Joomla Modules" COM_COMPONENTBUILDER_JOOMLA_MODULES_ACCESS="Joomla Modules Access" @@ -9184,7 +9186,8 @@ COM_COMPONENTBUILDER_YES="Yes" COM_COMPONENTBUILDER_YES_UPDATE_ALL="Yes! Update ALL" COM_COMPONENTBUILDER_YOUR_ARE_ABOUT_TO_UPDATE_BALLB_VALUES_THAT_CAN_BE_FOUND_IN_THE_DATABASE="Your are about to update ALL values that can be found in the database." COM_COMPONENTBUILDER_YOUR_ARE_ABOUT_TO_UPDATE_ROW="Your are about to update row" -COM_COMPONENTBUILDER_YOUR_COMPONENT_WILL_BE_COMPILED_TO_WORK_IN_JOOMLA_FOUR_AND_JOOMLA_FIVE="Your component will be compiled to work in Joomla 4 and Joomla 5" +COM_COMPONENTBUILDER_YOUR_COMPONENT_WILL_BE_COMPILED_TO_WORK_IN_JOOMLA_FIVE="Your component will be compiled to work in Joomla 5" +COM_COMPONENTBUILDER_YOUR_COMPONENT_WILL_BE_COMPILED_TO_WORK_IN_JOOMLA_FOUR="Your component will be compiled to work in Joomla 4" COM_COMPONENTBUILDER_YOUR_COMPONENT_WILL_BE_COMPILED_TO_WORK_IN_JOOMLA_THREE="Your component will be compiled to work in Joomla 3" COM_COMPONENTBUILDER_YOUR_DATA_IS_ENCRYPTED_WITH_A_AES_TWO_HUNDRED_AND_FIFTY_SIX_BIT_ENCRYPTION_USING_THE_ABOVE_THIRTY_TWO_CHARACTER_KEY="Your data is encrypted with a AES 256 bit encryption using the above 32 character key." COM_COMPONENTBUILDER_YOU_ARE_CURRENTLY_VIEWING_THE_TRASHED_ITEMS="You are currently viewing the trashed items." diff --git a/admin/layouts/joomla_component/details_above.php b/admin/layouts/joomla_component/details_above.php index 1c7e2de74..38514f015 100644 --- a/admin/layouts/joomla_component/details_above.php +++ b/admin/layouts/joomla_component/details_above.php @@ -27,6 +27,7 @@ $fields_tab_layout = 'fields_' . $layout_path_array[1]; // get the fields $fields = $displayData->get($fields_tab_layout) ?: array( 'system_name', + 'preferred_joomla_version', 'add_powers' ); diff --git a/admin/models/ajax.php b/admin/models/ajax.php index 125c69ef2..74d024ac0 100644 --- a/admin/models/ajax.php +++ b/admin/models/ajax.php @@ -108,7 +108,7 @@ class ComponentbuilderModelAjax extends ListModel $query = $db->getQuery(true) ->select($db->quoteName(array( 'id','companyname','component_version','copyright','debug_linenr', - 'description','email','image','license','name', + 'description','email','image','license','name','preferred_joomla_version', 'short_description','website','author','add_placeholders', 'system_name','mvc_versiondate'))) ->from($db->quoteName('#__componentbuilder_joomla_component')) @@ -117,7 +117,9 @@ class ComponentbuilderModelAjax extends ListModel $db->execute(); if ($db->loadRowList()) { - return ['html' => $this->componentDetailsDisplay($db->loadObject())]; + $object = $db->loadObject(); + + return ['html' => $this->componentDetailsDisplay($object), 'preferred_joomla_version' => $object->preferred_joomla_version ?? 0]; } return false; } diff --git a/admin/models/forms/joomla_component.xml b/admin/models/forms/joomla_component.xml index 17c65eed7..ee6042a85 100644 --- a/admin/models/forms/joomla_component.xml +++ b/admin/models/forms/joomla_component.xml @@ -157,36 +157,18 @@ message="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_COMPANYNAME_MESSAGE" hint="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_COMPANYNAME_HINT" /> - + - - - - - - COM_COMPONENTBUILDER_JOOMLA_COMPONENT_CROWDIN - - - - COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NO - - + + - - + + + + @@ -336,8 +305,37 @@ - - + + + + + + + + + + + + - - - - - - + + + + + + + + + + - + + type="list" + name="license_type" + label="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_LICENSE_TYPE_LABEL" + description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_LICENSE_TYPE_DESCRIPTION" + class="list_class" + multiple="false" + filter="int" + required="true" + default="1"> - + COM_COMPONENTBUILDER_JOOMLA_COMPONENT_WHMCS_ENCRYPTION_ONLY_TO_LOCK_DATAFIELDS + + + - - - - - - - - + + - - - - - + - - + + - - + + - + + + + + - + COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NO - + array( 'system_name', + 'preferred_joomla_version', 'add_powers' ), 'under' => array( 'not_required' ) ), - 'libs_helpers' => array( + 'dynamic_build_beta' => array( 'fullwidth' => array( - 'creatuserhelper', - 'adduikit', - 'addfootable', - 'add_email_helper', - 'add_php_helper_both', - 'php_helper_both', - 'add_php_helper_admin', - 'php_helper_admin', - 'add_admin_event', - 'php_admin_event', - 'add_php_helper_site', - 'php_helper_site', - 'add_site_event', - 'php_site_event', - 'add_javascript', - 'javascript', - 'add_css_admin', - 'css_admin', - 'add_css_site', - 'css_site' + 'note_buildcomp_dynamic_mysql', + 'buildcomp', + 'buildcompsql' ) ), 'dynamic_integration' => array( @@ -133,13 +117,6 @@ class ComponentbuilderModelJoomla_component extends AdminModel 'crowdin_account_api_key' ) ), - 'dynamic_build_beta' => array( - 'fullwidth' => array( - 'note_buildcomp_dynamic_mysql', - 'buildcomp', - 'buildcompsql' - ) - ), 'readme' => array( 'left' => array( 'addreadme', @@ -171,6 +148,30 @@ class ComponentbuilderModelJoomla_component extends AdminModel 'php_method_uninstall' ) ), + 'libs_helpers' => array( + 'fullwidth' => array( + 'creatuserhelper', + 'adduikit', + 'addfootable', + 'add_email_helper', + 'add_php_helper_both', + 'php_helper_both', + 'add_php_helper_admin', + 'php_helper_admin', + 'add_admin_event', + 'php_admin_event', + 'add_php_helper_site', + 'php_helper_site', + 'add_site_event', + 'php_site_event', + 'add_javascript', + 'javascript', + 'add_css_admin', + 'css_admin', + 'add_css_site', + 'css_site' + ) + ), 'mysql' => array( 'fullwidth' => array( 'add_sql', @@ -365,36 +366,36 @@ class ComponentbuilderModelJoomla_component extends AdminModel $item->metadata = $registry->toArray(); } - if (!empty($item->php_site_event)) - { - // base64 Decode php_site_event. - $item->php_site_event = base64_decode($item->php_site_event); - } - if (!empty($item->buildcompsql)) { // base64 Decode buildcompsql. $item->buildcompsql = base64_decode($item->buildcompsql); } - if (!empty($item->php_preflight_install)) - { - // base64 Decode php_preflight_install. - $item->php_preflight_install = base64_decode($item->php_preflight_install); - } - if (!empty($item->php_method_uninstall)) { // base64 Decode php_method_uninstall. $item->php_method_uninstall = base64_decode($item->php_method_uninstall); } + if (!empty($item->php_preflight_install)) + { + // base64 Decode php_preflight_install. + $item->php_preflight_install = base64_decode($item->php_preflight_install); + } + if (!empty($item->css_admin)) { // base64 Decode css_admin. $item->css_admin = base64_decode($item->css_admin); } + if (!empty($item->php_site_event)) + { + // base64 Decode php_site_event. + $item->php_site_event = base64_decode($item->php_site_event); + } + if (!empty($item->php_postflight_install)) { // base64 Decode php_postflight_install. @@ -1430,36 +1431,36 @@ class ComponentbuilderModelJoomla_component extends AdminModel $data['addcontributors'] = ''; } - // Set the php_site_event string to base64 string. - if (isset($data['php_site_event'])) - { - $data['php_site_event'] = base64_encode($data['php_site_event']); - } - // Set the buildcompsql string to base64 string. if (isset($data['buildcompsql'])) { $data['buildcompsql'] = base64_encode($data['buildcompsql']); } - // Set the php_preflight_install string to base64 string. - if (isset($data['php_preflight_install'])) - { - $data['php_preflight_install'] = base64_encode($data['php_preflight_install']); - } - // Set the php_method_uninstall string to base64 string. if (isset($data['php_method_uninstall'])) { $data['php_method_uninstall'] = base64_encode($data['php_method_uninstall']); } + // Set the php_preflight_install string to base64 string. + if (isset($data['php_preflight_install'])) + { + $data['php_preflight_install'] = base64_encode($data['php_preflight_install']); + } + // Set the css_admin string to base64 string. if (isset($data['css_admin'])) { $data['css_admin'] = base64_encode($data['css_admin']); } + // Set the php_site_event string to base64 string. + if (isset($data['php_site_event'])) + { + $data['php_site_event'] = base64_encode($data['php_site_event']); + } + // Set the php_postflight_install string to base64 string. if (isset($data['php_postflight_install'])) { diff --git a/admin/models/joomla_components.php b/admin/models/joomla_components.php index 2f52626d8..86c62668c 100644 --- a/admin/models/joomla_components.php +++ b/admin/models/joomla_components.php @@ -2694,16 +2694,16 @@ class ComponentbuilderModelJoomla_components extends ListModel continue; } - // decode php_site_event - $item->php_site_event = base64_decode($item->php_site_event); // decode buildcompsql $item->buildcompsql = base64_decode($item->buildcompsql); - // decode php_preflight_install - $item->php_preflight_install = base64_decode($item->php_preflight_install); // decode php_method_uninstall $item->php_method_uninstall = base64_decode($item->php_method_uninstall); + // decode php_preflight_install + $item->php_preflight_install = base64_decode($item->php_preflight_install); // decode css_admin $item->css_admin = base64_decode($item->css_admin); + // decode php_site_event + $item->php_site_event = base64_decode($item->php_site_event); // decode php_postflight_install $item->php_postflight_install = base64_decode($item->php_postflight_install); // decode sql_uninstall @@ -2721,13 +2721,13 @@ class ComponentbuilderModelJoomla_components extends ListModel $item->php_helper_admin = base64_decode($item->php_helper_admin); // decode php_helper_site $item->php_helper_site = base64_decode($item->php_helper_site); - // decode javascript - $item->javascript = base64_decode($item->javascript); if ($basickey && !is_numeric($item->whmcs_key) && $item->whmcs_key === base64_encode(base64_decode($item->whmcs_key, true))) { // decrypt whmcs_key $item->whmcs_key = $basic->decryptString($item->whmcs_key); } + // decode javascript + $item->javascript = base64_decode($item->javascript); // decode css_site $item->css_site = base64_decode($item->css_site); // decode php_preflight_update diff --git a/admin/sql/install.mysql.utf8.sql b/admin/sql/install.mysql.utf8.sql index dddd4761c..20b0f2a4c 100644 --- a/admin/sql/install.mysql.utf8.sql +++ b/admin/sql/install.mysql.utf8.sql @@ -50,7 +50,7 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_joomla_component` ( `dashboard` VARCHAR(64) NOT NULL DEFAULT '', `dashboard_type` TINYINT(1) NOT NULL DEFAULT 1, `debug_linenr` TINYINT(1) NOT NULL DEFAULT 0, - `description` TEXT NOT NULL, + `description` TEXT NULL, `email` VARCHAR(255) NOT NULL DEFAULT '', `emptycontributors` TINYINT(1) NOT NULL DEFAULT 0, `export_buy_link` VARCHAR(255) NOT NULL DEFAULT '', @@ -79,6 +79,7 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_joomla_component` ( `php_preflight_install` MEDIUMTEXT NOT NULL, `php_preflight_update` MEDIUMTEXT NOT NULL, `php_site_event` MEDIUMTEXT NOT NULL, + `preferred_joomla_version` INT(11) NOT NULL DEFAULT 3, `readme` TEXT NOT NULL, `remove_line_breaks` TINYINT(1) NOT NULL DEFAULT 0, `sales_server` INT(11) NOT NULL DEFAULT 0, @@ -111,12 +112,12 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_joomla_component` ( PRIMARY KEY (`id`), KEY `idx_system_name` (`system_name`), KEY `idx_name_code` (`name_code`), - KEY `idx_debug_linenr` (`debug_linenr`), KEY `idx_translation_tool` (`translation_tool`), KEY `idx_add_sales_server` (`add_sales_server`), KEY `idx_mvc_versiondate` (`mvc_versiondate`), KEY `idx_remove_line_breaks` (`remove_line_breaks`), KEY `idx_add_placeholders` (`add_placeholders`), + KEY `idx_debug_linenr` (`debug_linenr`), KEY `idx_add_license` (`add_license`), KEY `idx_license_type` (`license_type`), KEY `idx_addreadme` (`addreadme`), @@ -179,7 +180,7 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_joomla_module` ( `class_helper_header` TEXT NOT NULL, `custom_get` TEXT NOT NULL, `default` MEDIUMTEXT NOT NULL, - `description` TEXT NOT NULL, + `description` TEXT NULL, `fields` TEXT NOT NULL, `guid` VARCHAR(36) NOT NULL DEFAULT '', `libraries` TEXT NOT NULL, @@ -256,10 +257,10 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_joomla_plugin` ( `add_update_server` TINYINT(1) NOT NULL DEFAULT 0, `addreadme` TINYINT(1) NOT NULL DEFAULT 0, `class_extends` INT(11) NOT NULL DEFAULT 0, - `description` TEXT NOT NULL, + `description` TEXT NULL, `fields` TEXT NOT NULL, `guid` VARCHAR(36) NOT NULL DEFAULT '', - `head` TEXT NOT NULL, + `head` TEXT NULL, `joomla_plugin_group` INT(11) NOT NULL DEFAULT 0, `main_class_code` MEDIUMTEXT NOT NULL, `method_selection` TEXT NOT NULL, @@ -326,25 +327,25 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_power` ( `add_licensing_template` TINYINT(1) NOT NULL DEFAULT 1, `approved` TINYINT(1) NOT NULL DEFAULT 0, `approved_paths` TEXT NOT NULL, - `composer` TEXT NOT NULL, - `description` TEXT NOT NULL, + `composer` TEXT NULL, + `description` TEXT NULL, `extends` VARCHAR(36) NOT NULL DEFAULT '', - `extends_custom` VARCHAR(64) NOT NULL DEFAULT '', + `extends_custom` VARCHAR(64) NULL DEFAULT '', `guid` VARCHAR(36) NOT NULL DEFAULT '', - `head` TEXT NOT NULL, + `head` TEXT NULL, `implements` TEXT NULL, `implements_custom` VARCHAR(1024) NOT NULL DEFAULT '', - `licensing_template` TEXT NOT NULL, - `load_selection` TEXT NOT NULL, + `licensing_template` TEXT NULL, + `load_selection` TEXT NULL, `main_class_code` MEDIUMTEXT NOT NULL, - `method_selection` TEXT NOT NULL, + `method_selection` TEXT NULL, `name` VARCHAR(255) NOT NULL DEFAULT '', `namespace` VARCHAR(255) NOT NULL DEFAULT '', `power_version` CHAR(64) NOT NULL DEFAULT '', - `property_selection` TEXT NOT NULL, + `property_selection` TEXT NULL, `system_name` VARCHAR(255) NOT NULL DEFAULT '', `type` VARCHAR(64) NOT NULL DEFAULT '', - `use_selection` TEXT NOT NULL, + `use_selection` TEXT NULL, `params` text NULL, `published` TINYINT(3) NOT NULL DEFAULT 1, `created_by` INT(10) unsigned NOT NULL DEFAULT 0, @@ -417,7 +418,7 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_admin_view` ( `css_view` TEXT NOT NULL, `css_views` TEXT NOT NULL, `custom_button` TEXT NOT NULL, - `description` TEXT NOT NULL, + `description` TEXT NULL, `guid` VARCHAR(36) NOT NULL DEFAULT '', `html_import_view` MEDIUMTEXT NOT NULL, `icon` CHAR(64) NOT NULL DEFAULT '', @@ -1000,7 +1001,7 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_snippet` ( `contributor_email` VARCHAR(255) NOT NULL DEFAULT '', `contributor_name` VARCHAR(255) NOT NULL DEFAULT '', `contributor_website` VARCHAR(255) NOT NULL DEFAULT '', - `description` TEXT NOT NULL, + `description` TEXT NULL, `guid` VARCHAR(36) NOT NULL DEFAULT '', `heading` VARCHAR(255) NOT NULL DEFAULT '', `library` INT(11) NOT NULL DEFAULT 0, @@ -1133,7 +1134,7 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_fieldtype` ( `datalenght` CHAR(64) NOT NULL DEFAULT '', `datalenght_other` CHAR(64) NOT NULL DEFAULT '', `datatype` CHAR(64) NOT NULL DEFAULT '', - `description` TEXT NOT NULL, + `description` TEXT NULL, `guid` VARCHAR(36) NOT NULL DEFAULT '', `has_defaults` TINYINT(1) NOT NULL DEFAULT 0, `indexes` CHAR(64) NOT NULL DEFAULT '', @@ -1842,7 +1843,7 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_class_extends` ( `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', `comment` TEXT NOT NULL, `extension_type` VARCHAR(64) NOT NULL DEFAULT '', - `head` TEXT NOT NULL, + `head` TEXT NULL, `name` VARCHAR(255) NOT NULL DEFAULT '', `params` text NULL, `published` TINYINT(3) NOT NULL DEFAULT 1, @@ -2221,7 +2222,7 @@ 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`, `on_get_model_field`, `on_save_model_field`, `initiator_on_get_model`, `initiator_on_save_model`, `params`) VALUES (23, '', '', '', '', '', '', '', '', 64, '', 'CHAR', 2, '', '', 'Alias', 'NOT NULL', '', 24, '\"\"', 1, '2015-04-09 13:46:04', '2023-06-27 23:46:54', 3, '', 216, '335866ce-b81b-4329-901d-c20254135c9c', '', '', '', '', ''), -(84, '', '', '', '', '', '', '', '', '', '', 'TEXT', '', '', '', 'Description (full width)', 'NOT NULL', '', 25, '\"\"', 1, '2015-03-19 18:20:49', '2022-09-21 10:17:10', 4, '', 265, '749a9917-90c3-49c4-9e72-aa33b0683a87', '', '', '', '', ''), +(84, '', '', '', '', '', '', '', '', '', '', 'TEXT', '', '', '', 'Description (full width)', 'NULL', '', 25, '\"\"', 1, '2015-03-19 18:20:49', '2024-03-06 15:53:48', 5, '', 265, '749a9917-90c3-49c4-9e72-aa33b0683a87', '', '', '', '', ''), (100, '', '', '', '', '', '', '', '', 255, '', 'VARCHAR', '', '', '', 'Email (required)', 'NOT NULL', '', 24, '\"\"', 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, '\"\"', 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, '\"\"', 1, '2015-04-07 22:12:58', '2016-03-28 14:00:02', 2, '', 7, '65933a19-243a-48b2-aae9-34e2da710051', '', '', '', '', ''), diff --git a/admin/sql/updates/mysql/3.2.01.sql b/admin/sql/updates/mysql/3.2.0-beta1.sql similarity index 100% rename from admin/sql/updates/mysql/3.2.01.sql rename to admin/sql/updates/mysql/3.2.0-beta1.sql diff --git a/admin/sql/updates/mysql/3.2.02.sql b/admin/sql/updates/mysql/3.2.0-beta2.sql similarity index 100% rename from admin/sql/updates/mysql/3.2.02.sql rename to admin/sql/updates/mysql/3.2.0-beta2.sql diff --git a/admin/sql/updates/mysql/3.2.03.sql b/admin/sql/updates/mysql/3.2.0-beta3.sql similarity index 100% rename from admin/sql/updates/mysql/3.2.03.sql rename to admin/sql/updates/mysql/3.2.0-beta3.sql diff --git a/admin/views/compiler/view.html.php b/admin/views/compiler/view.html.php index 864e7f531..058e1692c 100644 --- a/admin/views/compiler/view.html.php +++ b/admin/views/compiler/view.html.php @@ -299,7 +299,8 @@ class ComponentbuilderViewCompiler extends HtmlView // start the joomla versions options $options = [ '3' => 'COM_COMPONENTBUILDER_JOOMLA_THREE', - '4' => 'COM_COMPONENTBUILDER_JOOMLA_FOUR_AND_FIVE' + '4' => 'COM_COMPONENTBUILDER_JOOMLA_FOUR', + '5' => 'COM_COMPONENTBUILDER_JOOMLA_FIVE' ]; // add to form @@ -327,8 +328,8 @@ class ComponentbuilderViewCompiler extends HtmlView // Joomla Version 4 and five attributes $attributes = [ 'type' => 'note', - 'name' => 'joomla_version_note_four_five', - 'description' => 'COM_COMPONENTBUILDER_YOUR_COMPONENT_WILL_BE_COMPILED_TO_WORK_IN_JOOMLA_FOUR_AND_JOOMLA_FIVE', + 'name' => 'joomla_version_note_four', + 'description' => 'COM_COMPONENTBUILDER_YOUR_COMPONENT_WILL_BE_COMPILED_TO_WORK_IN_JOOMLA_FOUR', 'class' => 'alert alert-success', 'showon' => 'joomla_version:4']; @@ -339,6 +340,21 @@ class ComponentbuilderViewCompiler extends HtmlView $form->setField($xml, null, true, 'builder'); } + // Joomla Version 5 and five attributes + $attributes = [ + 'type' => 'note', + 'name' => 'joomla_version_note_five', + 'description' => 'COM_COMPONENTBUILDER_YOUR_COMPONENT_WILL_BE_COMPILED_TO_WORK_IN_JOOMLA_FIVE', + 'class' => 'alert alert-success', + 'showon' => 'joomla_version:5']; + + // add to form + $xml = FormHelper::xml($attributes); + if ($xml instanceof SimpleXMLElement) + { + $form->setField($xml, null, true, 'builder'); + } + // Advanced Options $attributes = [ 'type' => 'radio', @@ -554,8 +570,7 @@ class ComponentbuilderViewCompiler extends HtmlView protected function getSupportMessage(): string { return LayoutHelper::render('jcbsupportmessage', []); - } - + } /** * Prepares the document @@ -661,6 +676,11 @@ class ComponentbuilderViewCompiler extends HtmlView getComponentDetails_server(id).then(function(result) { if (result.html) { document.getElementById('component-details').innerHTML = result.html; + if (result.preferred_joomla_version) { + jQuery('#joomla_version').val(result.preferred_joomla_version); + jQuery('#joomla_version').trigger('liszt:updated'); + jQuery('#joomla_version').trigger('change'); + } } }); } diff --git a/componentbuilder.xml b/componentbuilder.xml index 694a1fc47..6139189f6 100644 --- a/componentbuilder.xml +++ b/componentbuilder.xml @@ -1,15 +1,15 @@ COM_COMPONENTBUILDER - 6th March, 2024 + 7th March, 2024 Llewellyn van der Merwe joomla@vdm.io https://dev.vdm.io Copyright (C) 2015 Vast Development Method. All rights reserved. GNU General Public License version 2 or later; see LICENSE.txt - 3.2.0-beta3 + 3.2.0-beta4 Component Builder (v.3.2.0-beta3) +

Component Builder (v.3.2.0-beta4)

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. @@ -122,6 +122,6 @@ Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/compo - https://git.vdm.dev/joomla/Component-Builder/raw/branch/3.10/componentbuilder_update_server.xml + https://git.vdm.dev/joomla/Component-Builder/raw/branch/3.x/componentbuilder_update_server.xml \ No newline at end of file diff --git a/componentbuilder_update_server.xml b/componentbuilder_update_server.xml index 6c4f2cf8d..3e2fa4896 100644 --- a/componentbuilder_update_server.xml +++ b/componentbuilder_update_server.xml @@ -1529,7 +1529,7 @@ pkg_component_builder package site - 3.2.01 + 3.2.0-beta1 https://dev.vdm.io https://git.vdm.dev/api/v1/repos/joomla/pkg-component-builder/archive/v3.2.0-beta2.zip @@ -1547,13 +1547,13 @@ pkg_component_builder package site - 3.2.02 + 3.2.0-beta2 https://dev.vdm.io https://git.vdm.dev/api/v1/repos/joomla/pkg-component-builder/archive/v3.2.0-beta2.zip - stable + beta Llewellyn van der Merwe https://dev.vdm.io @@ -1565,7 +1565,7 @@ pkg_component_builder package site - 3.2.03 + 3.2.0-beta3 https://dev.vdm.io https://git.vdm.dev/api/v1/repos/joomla/pkg-component-builder/archive/v3.2.0-beta3.zip @@ -1577,4 +1577,22 @@ https://dev.vdm.io + + Component Builder + Builds Complex Joomla Components + pkg_component_builder + package + site + 3.2.0-beta4 + https://dev.vdm.io + + https://git.vdm.dev/api/v1/repos/joomla/pkg-component-builder/archive/v3.2.0-beta4.zip + + + beta + + Llewellyn van der Merwe + https://dev.vdm.io + + \ No newline at end of file diff --git a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Architecture/JoomlaFive/Controller/AllowAdd.php b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Architecture/JoomlaFive/Controller/AllowAdd.php new file mode 100644 index 000000000..2b7fbdbae --- /dev/null +++ b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Architecture/JoomlaFive/Controller/AllowAdd.php @@ -0,0 +1,129 @@ + + * @git 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\Architecture\JoomlaFive\Controller; + + +use VDM\Joomla\Componentbuilder\Compiler\Config; +use VDM\Joomla\Componentbuilder\Compiler\Creator\Permission; +use VDM\Joomla\Componentbuilder\Compiler\Customcode\Dispenser; +use VDM\Joomla\Componentbuilder\Compiler\Utilities\Indent; +use VDM\Joomla\Componentbuilder\Compiler\Utilities\Line; +use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Architecture\Controller\AllowAddInterface; + + +/** + * Controller Allow Add Class for Joomla 5 + * + * @since 3.2.0 + */ +final class AllowAdd implements AllowAddInterface +{ + /** + * The Component code name. + * + * @var String + * @since 3.2.0 + */ + protected String $component; + + /** + * The Permission Class. + * + * @var Permission + * @since 3.2.0 + */ + protected Permission $permission; + + /** + * The Dispenser Class. + * + * @var Dispenser + * @since 3.2.0 + */ + protected Dispenser $dispenser; + + /** + * Constructor. + * + * @param Config $config The Config Class. + * @param Permission $permission The Permission Class. + * @param Dispenser $dispenser The Dispenser Class. + * + * @since 3.2.0 + */ + public function __construct(Config $config, Permission $permission, + Dispenser $dispenser) + { + $this->component = $config->component_code_name; + $this->permission = $permission; + $this->dispenser = $dispenser; + } + + /** + * Get Allow Add Function Code + * + * @param string $nameSingleCode The single code name of the view. + * + * @since 3.2.0 + * @return string The allow add method code + */ + public function get(string $nameSingleCode): string + { + $allow = []; + + // prepare custom permission script + $custom_allow = $this->dispenser->get( + 'php_allowadd', $nameSingleCode, '', null, true + ); + + $allow[] = PHP_EOL . Indent::_(2) . "//" . Line::_(__Line__, __Class__) + . " Get user object."; + $allow[] = Indent::_(2) . "\$user = \$this->app->getIdentity();"; + // check if the item has permissions. + if ($this->permission->globalExist($nameSingleCode, 'core.access')) + { + $allow[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__) + . " Access check."; + $allow[] = Indent::_(2) . "\$access = \$user->authorise('" + . $this->permission->getGlobal($nameSingleCode, 'core.access') + . "', 'com_" . $this->component . "');"; + $allow[] = Indent::_(2) . "if (!\$access)"; + $allow[] = Indent::_(2) . "{"; + $allow[] = Indent::_(3) . "return false;"; + $allow[] = Indent::_(2) . "}"; + } + + // load custom permission script + $allow[] = $custom_allow; + + // check if the item has permissions. + if ($this->permission->globalExist($nameSingleCode, 'core.create')) + { + // setup the default script + $allow[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__) + . " In the absence of better information, revert to the component permissions."; + $allow[] = Indent::_(2) . "return \$user->authorise('" + . $this->permission->getGlobal($nameSingleCode, 'core.create') + . "', \$this->option);"; + } + else + { + // setup the default script + $allow[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__) + . " In the absence of better information, revert to the component permissions."; + $allow[] = Indent::_(2) . "return parent::allowAdd(\$data);"; + } + + return implode(PHP_EOL, $allow); + } +} + diff --git a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Architecture/JoomlaFive/Controller/AllowEdit.php b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Architecture/JoomlaFive/Controller/AllowEdit.php new file mode 100644 index 000000000..39a2d363c --- /dev/null +++ b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Architecture/JoomlaFive/Controller/AllowEdit.php @@ -0,0 +1,300 @@ + + * @git 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\Architecture\JoomlaFive\Controller; + + +use VDM\Joomla\Componentbuilder\Compiler\Config; +use VDM\Joomla\Componentbuilder\Compiler\Creator\Permission; +use VDM\Joomla\Componentbuilder\Compiler\Customcode\Dispenser; +use VDM\Joomla\Componentbuilder\Compiler\Builder\Category; +use VDM\Joomla\Componentbuilder\Compiler\Builder\CategoryOtherName; +use VDM\Joomla\Componentbuilder\Compiler\Utilities\Indent; +use VDM\Joomla\Componentbuilder\Compiler\Utilities\Line; +use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Architecture\Controller\AllowEditInterface; + + +/** + * Controller Allow Edit Class for Joomla 5 + * + * @since 3.2.0 + */ +final class AllowEdit implements AllowEditInterface +{ + /** + * The Component code name. + * + * @var String + * @since 3.2.0 + */ + protected String $component; + + /** + * The Permission Class. + * + * @var Permission + * @since 3.2.0 + */ + protected Permission $permission; + + /** + * The Dispenser Class. + * + * @var Dispenser + * @since 3.2.0 + */ + protected Dispenser $dispenser; + + /** + * The Category Class. + * + * @var Category + * @since 3.2.0 + */ + protected Category $category; + + /** + * The CategoryOtherName Class. + * + * @var CategoryOtherName + * @since 3.2.0 + */ + protected CategoryOtherName $categoryothername; + + /** + * Constructor. + * + * @param Config $config The Config Class. + * @param Permission $permission The Permission Class. + * @param Dispenser $dispenser The Dispenser Class. + * @param Category $category The Category Class. + * @param CategoryOtherName $categoryothername The CategoryOtherName Class. + * + * @since 3.2.0 + */ + public function __construct(Config $config, Permission $permission, + Dispenser $dispenser, Category $category, + CategoryOtherName $categoryothername) + { + $this->component = $config->component_code_name; + $this->permission = $permission; + $this->dispenser = $dispenser; + $this->category = $category; + $this->categoryothername = $categoryothername; + } + + /** + * Get Allow Edit Function Code + * + * @param string $nameSingleCode The single code name of the view. + * @param string $nameListCode The list code name of the view. + * + * @since 3.2.0 + * @return string The allow edit method code + */ + public function get(string $nameSingleCode, string $nameListCode): string + { + $allow = []; + + // prepare custom permission script + $customAllow = $this->dispenser->get( + 'php_allowedit', $nameSingleCode, '', null, true + ); + + if ($this->category->exists("{$nameListCode}")) + { + // check if category has another name + $otherViews = $this->categoryothername-> + get($nameListCode . '.views', $nameListCode); + $otherView = $this->categoryothername-> + get($nameListCode . '.view', $nameSingleCode); + // setup the category script + $allow[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__) + . " get user object."; + $allow[] = Indent::_(2) . "\$user = \$this->app->getIdentity();"; + $allow[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__) + . " get record id."; + $allow[] = Indent::_(2) + . "\$recordId = (int) isset(\$data[\$key]) ? \$data[\$key] : 0;"; + // load custom permission script + $allow[] = $customAllow; + // check if the item has permissions. + if ($this->permission->globalExist($otherView, 'core.access')) + { + $allow[] = PHP_EOL . Indent::_(2) . "//" . Line::_( + __LINE__,__CLASS__ + ) . " Access check."; + $allow[] = Indent::_(2) . "\$access = (\$user->authorise('" + . $this->permission->getGlobal($otherView, 'core.access') + . "', 'com_" . $this->component . "." . $otherView + . ".' . (int) \$recordId) && \$user->authorise('" + . $this->permission->getGlobal($otherView, 'core.access') + . "', 'com_" . $this->component . "'));"; + $allow[] = Indent::_(2) . "if (!\$access)"; + $allow[] = Indent::_(2) . "{"; + $allow[] = Indent::_(3) . "return false;"; + $allow[] = Indent::_(2) . "}"; + } + $allow[] = PHP_EOL . Indent::_(2) . "if (\$recordId)"; + $allow[] = Indent::_(2) . "{"; + $allow[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__) + . " The record has been set. Check the record permissions."; + // check if the item has permissions. + $allow[] = Indent::_(3) . "\$permission = \$user->authorise('" + . $this->permission->getAction($otherView, 'core.edit') . "', 'com_" . $this->component . "." + . $otherView . ".' . (int) \$recordId);"; + $allow[] = Indent::_(3) . "if (!\$permission)"; + $allow[] = Indent::_(3) . "{"; + // check if the item has permissions. + $allow[] = Indent::_(4) . "if (\$user->authorise('" + . $this->permission->getAction($otherView, 'core.edit.own') . "', 'com_" . $this->component . "." + . $otherView . ".' . \$recordId))"; + $allow[] = Indent::_(4) . "{"; + $allow[] = Indent::_(5) . "//" . Line::_(__Line__, __Class__) + . " Fallback on edit.own. Now test the owner is the user."; + $allow[] = Indent::_(5) + . "\$ownerId = (int) isset(\$data['created_by']) ? \$data['created_by'] : 0;"; + $allow[] = Indent::_(5) . "if (empty(\$ownerId))"; + $allow[] = Indent::_(5) . "{"; + $allow[] = Indent::_(6) . "//" . Line::_(__Line__, __Class__) + . " Need to do a lookup from the model."; + $allow[] = Indent::_(6) + . "\$record = \$this->getModel()->getItem(\$recordId);"; + $allow[] = PHP_EOL . Indent::_(6) . "if (empty(\$record))"; + $allow[] = Indent::_(6) . "{"; + $allow[] = Indent::_(7) . "return false;"; + $allow[] = Indent::_(6) . "}"; + $allow[] = Indent::_(6) . "\$ownerId = \$record->created_by;"; + $allow[] = Indent::_(5) . "}"; + $allow[] = PHP_EOL . Indent::_(5) . "//" . Line::_(__Line__, __Class__) + . " If the owner matches 'me' then do the test."; + $allow[] = Indent::_(5) . "if (\$ownerId == \$user->id)"; + $allow[] = Indent::_(5) . "{"; + // check if the item has permissions. + $allow[] = Indent::_(6) . "if (\$user->authorise('" + . $this->permission->getGlobal($otherView, 'core.edit.own') . "', 'com_" . $this->component . "'))"; + $allow[] = Indent::_(6) . "{"; + $allow[] = Indent::_(7) . "return true;"; + $allow[] = Indent::_(6) . "}"; + $allow[] = Indent::_(5) . "}"; + $allow[] = Indent::_(4) . "}"; + $allow[] = Indent::_(4) . "return false;"; + $allow[] = Indent::_(3) . "}"; + $allow[] = Indent::_(2) . "}"; + if ($this->permission->globalExist($otherView, 'core.edit')) + { + $allow[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__) + . " Since there is no permission, revert to the component permissions."; + $allow[] = Indent::_(2) . "return \$user->authorise('" + . $this->permission->getGlobal($otherView, 'core.edit') . "', \$this->option);"; + } + else + { + $allow[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__) + . " Since there is no permission, revert to the component permissions."; + $allow[] = Indent::_(2) + . "return parent::allowEdit(\$data, \$key);"; + } + } + else + { + // setup the category script + $allow[] = PHP_EOL . Indent::_(2) . "//" . Line::_(__Line__, __Class__) + . " get user object."; + $allow[] = Indent::_(2) . "\$user = \$this->app->getIdentity();"; + $allow[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__) + . " get record id."; + $allow[] = Indent::_(2) + . "\$recordId = (int) isset(\$data[\$key]) ? \$data[\$key] : 0;"; + // load custom permission script + $allow[] = $customAllow; + // check if the item has permissions. + if ($this->permission->actionExist($nameSingleCode, 'core.access')) + { + $allow[] = PHP_EOL . Indent::_(2) . "//" . Line::_( + __LINE__,__CLASS__ + ) . " Access check."; + $allow[] = Indent::_(2) . "\$access = (\$user->authorise('" + . $this->permission->getAction($nameSingleCode, 'core.access') . "', 'com_" . $this->component . "." + . $nameSingleCode + . ".' . (int) \$recordId) && \$user->authorise('" + . $this->permission->getAction($nameSingleCode, 'core.access') . "', 'com_" . $this->component . "'));"; + $allow[] = Indent::_(2) . "if (!\$access)"; + $allow[] = Indent::_(2) . "{"; + $allow[] = Indent::_(3) . "return false;"; + $allow[] = Indent::_(2) . "}"; + } + $allow[] = PHP_EOL . Indent::_(2) . "if (\$recordId)"; + $allow[] = Indent::_(2) . "{"; + $allow[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__) + . " The record has been set. Check the record permissions."; + // check if the item has permissions. + $allow[] = Indent::_(3) . "\$permission = \$user->authorise('" + . $this->permission->getAction($nameSingleCode, 'core.edit') . "', 'com_" . $this->component . "." + . $nameSingleCode . ".' . (int) \$recordId);"; + $allow[] = Indent::_(3) . "if (!\$permission)"; + $allow[] = Indent::_(3) . "{"; + // check if the item has permissions. + $allow[] = Indent::_(4) . "if (\$user->authorise('" + . $this->permission->getAction($nameSingleCode, 'core.edit.own') . "', 'com_" . $this->component . "." + . $nameSingleCode . ".' . \$recordId))"; + $allow[] = Indent::_(4) . "{"; + $allow[] = Indent::_(5) . "//" . Line::_(__Line__, __Class__) + . " Now test the owner is the user."; + $allow[] = Indent::_(5) + . "\$ownerId = (int) isset(\$data['created_by']) ? \$data['created_by'] : 0;"; + $allow[] = Indent::_(5) . "if (empty(\$ownerId))"; + $allow[] = Indent::_(5) . "{"; + $allow[] = Indent::_(6) . "//" . Line::_(__Line__, __Class__) + . " Need to do a lookup from the model."; + $allow[] = Indent::_(6) + . "\$record = \$this->getModel()->getItem(\$recordId);"; + $allow[] = PHP_EOL . Indent::_(6) . "if (empty(\$record))"; + $allow[] = Indent::_(6) . "{"; + $allow[] = Indent::_(7) . "return false;"; + $allow[] = Indent::_(6) . "}"; + $allow[] = Indent::_(6) . "\$ownerId = \$record->created_by;"; + $allow[] = Indent::_(5) . "}"; + $allow[] = PHP_EOL . Indent::_(5) . "//" . Line::_(__Line__, __Class__) + . " If the owner matches 'me' then allow."; + $allow[] = Indent::_(5) . "if (\$ownerId == \$user->id)"; + $allow[] = Indent::_(5) . "{"; + // check if the item has permissions. + $allow[] = Indent::_(6) . "if (\$user->authorise('" + . $this->permission->getGlobal($nameSingleCode, 'core.edit.own') . "', 'com_" . $this->component . "'))"; + $allow[] = Indent::_(6) . "{"; + $allow[] = Indent::_(7) . "return true;"; + $allow[] = Indent::_(6) . "}"; + $allow[] = Indent::_(5) . "}"; + $allow[] = Indent::_(4) . "}"; + $allow[] = Indent::_(4) . "return false;"; + $allow[] = Indent::_(3) . "}"; + $allow[] = Indent::_(2) . "}"; + if ($this->permission->globalExist($nameSingleCode, 'core.edit')) + { + $allow[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__) + . " Since there is no permission, revert to the component permissions."; + $allow[] = Indent::_(2) . "return \$user->authorise('" + . $this->permission->getGlobal($nameSingleCode, 'core.edit') . "', \$this->option);"; + } + else + { + $allow[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__) + . " Since there is no permission, revert to the component permissions."; + $allow[] = Indent::_(2) + . "return parent::allowEdit(\$data, \$key);"; + } + } + + return implode(PHP_EOL, $allow); + } +} + diff --git a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Architecture/JoomlaFive/Controller/index.html b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Architecture/JoomlaFive/Controller/index.html new file mode 100644 index 000000000..fa6d84e80 --- /dev/null +++ b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Architecture/JoomlaFive/Controller/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Architecture/JoomlaFive/Model/CanDelete.php b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Architecture/JoomlaFive/Model/CanDelete.php new file mode 100644 index 000000000..b9cf8d994 --- /dev/null +++ b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Architecture/JoomlaFive/Model/CanDelete.php @@ -0,0 +1,87 @@ + + * @git 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\Architecture\JoomlaFive\Model; + + +use VDM\Joomla\Componentbuilder\Compiler\Config; +use VDM\Joomla\Componentbuilder\Compiler\Creator\Permission; +use VDM\Joomla\Componentbuilder\Compiler\Utilities\Indent; +use VDM\Joomla\Componentbuilder\Compiler\Utilities\Line; +use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Architecture\Model\CanDeleteInterface; + + +/** + * Model Can Delete Class for Joomla 5 + * + * @since 3.2.0 + */ +final class CanDelete implements CanDeleteInterface +{ + /** + * The Component code name. + * + * @var String + * @since 3.2.0 + */ + protected String $component; + + /** + * The Permission Class. + * + * @var Permission + * @since 3.2.0 + */ + protected Permission $permission; + + /** + * Constructor. + * + * @param Config $config The Config Class. + * @param Permission $permission The Permission Class. + * + * @since 3.2.0 + */ + public function __construct(Config $config, Permission $permission) + { + $this->component = $config->component_code_name; + $this->permission = $permission; + } + + /** + * Get Can Delete Function Code + * + * @param string $nameSingleCode The single code name of the view. + * + * @since 3.2.0 + * @return string The can delete method code + */ + public function get(string $nameSingleCode): string + { + $allow = []; + + // setup the default script + $allow[] = PHP_EOL . Indent::_(2) . "if (empty(\$record->id) || (\$record->published != -2))"; + $allow[] = Indent::_(2) . "{"; + $allow[] = Indent::_(3) . "return false;"; + $allow[] = Indent::_(2) . "}" . PHP_EOL; + + // check if the item has permissions. + $allow[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__) + . " The record has been set. Check the record permissions."; + $allow[] = Indent::_(2) . "return \$this->getCurrentUser()->authorise('" + . $this->permission->getAction($nameSingleCode, 'core.delete') . "', 'com_" . $this->component . "." + . $nameSingleCode . ".' . (int) \$record->id);"; + + return implode(PHP_EOL, $allow); + } +} + diff --git a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Architecture/JoomlaFive/Model/CanEditState.php b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Architecture/JoomlaFive/Model/CanEditState.php new file mode 100644 index 000000000..318644a3c --- /dev/null +++ b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Architecture/JoomlaFive/Model/CanEditState.php @@ -0,0 +1,108 @@ + + * @git 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\Architecture\JoomlaFive\Model; + + +use VDM\Joomla\Componentbuilder\Compiler\Config; +use VDM\Joomla\Componentbuilder\Compiler\Creator\Permission; +use VDM\Joomla\Componentbuilder\Compiler\Utilities\Indent; +use VDM\Joomla\Componentbuilder\Compiler\Utilities\Line; +use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Architecture\Model\CanEditStateInterface; + + +/** + * Model Can Edit State Class for Joomla 5 + * + * @since 3.2.0 + */ +final class CanEditState implements CanEditStateInterface +{ + /** + * The Component code name. + * + * @var String + * @since 3.2.0 + */ + protected String $component; + + /** + * The Permission Class. + * + * @var Permission + * @since 3.2.0 + */ + protected Permission $permission; + + /** + * Constructor. + * + * @param Config $config The Config Class. + * @param Permission $permission The Permission Class. + * + * @since 3.2.0 + */ + public function __construct(Config $config, Permission $permission) + { + $this->component = $config->component_code_name; + $this->permission = $permission; + } + + /** + * Get Can Edit State Function Code + * + * @param string $nameSingleCode The single code name of the view. + * + * @since 3.2.0 + * @return string The can edit state method code + */ + public function get(string $nameSingleCode): string + { + $allow = []; + + // setup the default script + $allow[] = PHP_EOL . Indent::_(2) . "\$user = \$this->getCurrentUser();"; + $allow[] = Indent::_(2) + . "\$recordId = \$record->id ?? 0;"; + $allow[] = PHP_EOL . Indent::_(2) . "if (\$recordId)"; + $allow[] = Indent::_(2) . "{"; + $allow[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__) + . " The record has been set. Check the record permissions."; + // check if the item has permissions. + $allow[] = Indent::_(3) . "\$permission = \$user->authorise('" + . $this->permission->getAction($nameSingleCode, 'core.edit.state') + . "', 'com_" . $this->component . "." . $nameSingleCode . ".' . (int) \$recordId);"; + $allow[] = Indent::_(3) + . "if (!\$permission && !is_null(\$permission))"; + $allow[] = Indent::_(3) . "{"; + $allow[] = Indent::_(4) . "return false;"; + $allow[] = Indent::_(3) . "}"; + $allow[] = Indent::_(2) . "}"; + if ($this->permission->globalExist($nameSingleCode, 'core.edit.state')) + { + $allow[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__) + . " In the absence of better information, revert to the component permissions."; + $allow[] = Indent::_(2) . "return \$user->authorise('" + . $this->permission->getGlobal($nameSingleCode, 'core.edit.state') . "', 'com_" . $this->component + . "');"; + } + else + { + $allow[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__) + . " In the absence of better information, revert to the component permissions."; + $allow[] = Indent::_(2) + . "return parent::canEditState(\$record);"; + } + + return implode(PHP_EOL, $allow); + } +} + diff --git a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Architecture/JoomlaFive/Model/index.html b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Architecture/JoomlaFive/Model/index.html new file mode 100644 index 000000000..fa6d84e80 --- /dev/null +++ b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Architecture/JoomlaFive/Model/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Component.php b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Component.php index 211abf268..687450ccc 100644 --- a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Component.php +++ b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Component.php @@ -45,7 +45,7 @@ final class Component extends BaseRegistry * * @since 3.2.0 */ - public function __get(string $path) + public function __get($path) { // check if it has been set if (($value = $this->get($path, '__N0T_S3T_Y3T_')) !== '__N0T_S3T_Y3T_') diff --git a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Component/Data.php b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Component/Data.php index 411f13488..541af4c40 100644 --- a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Component/Data.php +++ b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Component/Data.php @@ -400,7 +400,7 @@ final class Data // ensure version naming is correct $this->config->set('component_version', preg_replace( - '/[^0-9.]+/', '', (string) $component->component_version + '/^v/i', '', (string) $component->component_version ) ); diff --git a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Component/JoomlaFive/Settings.php b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Component/JoomlaFive/Settings.php new file mode 100644 index 000000000..1feea907d --- /dev/null +++ b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Component/JoomlaFive/Settings.php @@ -0,0 +1,748 @@ + + * @git 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\Component\JoomlaFive; + + +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\Placeholder; +use VDM\Joomla\Componentbuilder\Compiler\Component; +use VDM\Joomla\Componentbuilder\Compiler\Utilities\Paths; +use VDM\Joomla\Componentbuilder\Compiler\Utilities\Dynamicpath; +use VDM\Joomla\Componentbuilder\Compiler\Utilities\Pathfix; +use VDM\Joomla\Utilities\FileHelper; +use VDM\Joomla\Utilities\JsonHelper; +use VDM\Joomla\Utilities\StringHelper; +use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Component\SettingsInterface; + + +/** + * Compiler Component (Joomla Version) Settings + * + * @since 3.2.0 + */ +final class Settings implements SettingsInterface +{ + /** + * The standard folders + * + * @var array + * @since 3.2.0 + */ + protected array $standardFolders = [ + 'site', + 'admin', + 'media' + ]; + + /** + * The standard root files + * + * @var array + * @since 3.2.0 + */ + protected array $standardRootFiles = [ + 'access.xml', + 'config.xml', + 'controller.php', + 'index.html', + 'README.txt' + ]; + + /** + * Compiler Joomla Version Data + * + * @var object|null + * @since 3.2.0 + */ + protected ?object $data = null; + + /** + * 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 Placeholder + * + * @var Placeholder + * @since 3.2.0 + */ + protected Placeholder $placeholder; + + /** + * Compiler Component + * + * @var Component + * @since 3.2.0 + **/ + protected Component $component; + + /** + * Compiler Utilities Paths + * + * @var Paths + * @since 3.2.0 + */ + protected Paths $paths; + + /** + * Compiler Component Dynamic Path + * + * @var Dynamicpath + * @since 3.2.0 + **/ + protected Dynamicpath $dynamicpath; + + /** + * Compiler Component Pathfix + * + * @var Pathfix + * @since 3.2.0 + **/ + protected Pathfix $pathfix; + + /** + * 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 Placeholder|null $placeholder The compiler placeholder object. + * @param Component|null $component The component class. + * @param Paths|null $paths The compiler paths object. + * @param Dynamicpath|null $dynamicpath The compiler dynamic path object. + * @param Pathfix|null $pathfix The compiler path fixing object. + * + * @since 3.2.0 + */ + public function __construct(?Config $config = null, ?Registry $registry = null, + ?EventInterface $event = null, ?Placeholder $placeholder = null, + ?Component $component = null, ?Paths $paths = null, + ?Dynamicpath $dynamicpath = null, ?Pathfix $pathfix = null) + { + $this->config = $config ?: Compiler::_('Config'); + $this->registry = $registry ?: Compiler::_('Registry'); + $this->event = $event ?: Compiler::_('Event'); + $this->placeholder = $placeholder ?: Compiler::_('Placeholder'); + $this->component = $component ?: Compiler::_('Component'); + $this->paths = $paths ?: Compiler::_('Utilities.Paths'); + $this->dynamicpath = $dynamicpath ?: Compiler::_('Utilities.Dynamicpath'); + $this->pathfix = $pathfix ?: Compiler::_('Utilities.Pathfix'); + + // add component endpoint file to stander list of root files + $this->standardRootFiles[] = $this->component->get('name_code') . '.php'; + } + + /** + * Check if data set is loaded + * + * @return bool + * @since 3.2.0 + */ + public function exists(): bool + { + if (!$this->isSet()) + { + // load the data + $this->data = $this->get(); + + if (!$this->isSet()) + { + return false; + } + } + + return true; + } + + /** + * Get Joomla - Folder Structure to Create + * + * @return object The version related structure + * @since 3.2.0 + */ + public function structure(): object + { + return $this->data->create; + } + + /** + * Get Joomla - Move Multiple Structure + * + * @return object The version related multiple structure + * @since 3.2.0 + */ + public function multiple(): object + { + return $this->data->move->dynamic; + } + + /** + * Get Joomla - Move Single Structure + * + * @return object The version related single structure + * @since 3.2.0 + */ + public function single(): object + { + return $this->data->move->static; + } + + /** + * Check if Folder is a Standard Folder + * + * @param string $folder The folder name + * + * @return bool true if the folder exists + * @since 3.2.0 + */ + public function standardFolder(string $folder): bool + { + return in_array($folder, $this->standardFolders); + } + + /** + * Check if File is a Standard Root File + * + * @param string $file The file name + * + * @return bool true if the file exists + * @since 3.2.0 + */ + public function standardRootFile(string $file): bool + { + return in_array($file, $this->standardRootFiles); + } + + /** + * Check if Data is Set + * + * @return bool + * @since 3.2.0 + */ + private function isSet(): bool + { + return is_object($this->data) && + isset($this->data->create) && + isset($this->data->move) && + isset($this->data->move->static) && + isset($this->data->move->dynamic); + } + + /** + * get the Joomla Version Data + * + * @return object|null The version data + * @since 3.2.0 + */ + private function get(): ?object + { + // override option + $customSettings = $this->paths->template_path . '/settings_' . + $this->config->component_code_name . '.json'; + + // get the data + $version_data = $this->readJsonFile($customSettings); + + if (is_null($version_data) || !$this->isValidData($version_data)) + { + return null; + } + + $this->loadExtraFolders(); + $this->loadExtraFiles(); + + $this->addFolders($version_data); + $this->addFiles($version_data); + + // Trigger Event: jcb_ce_onAfterSetJoomlaVersionData + $this->event->trigger( + 'jcb_ce_onAfterSetJoomlaVersionData', [&$version_data] + ); + + return $version_data; + } + + /** + * Read the Json file data + * + * @param string $filePath + * + * @return object|null The version data + * @since 3.2.0 + */ + private function readJsonFile(string $filePath): ?object + { + if (FileHelper::exists($filePath)) + { + $jsonContent = FileHelper::getContent($filePath); + } + else + { + $jsonContent = FileHelper::getContent($this->paths->template_path . '/settings.json'); + } + + if (JsonHelper::check($jsonContent)) + { + return json_decode((string) $jsonContent); + } + + return null; + } + + /** + * Check if this is valid data + * + * @param object $versionData + * + * @return bool + * @since 3.2.0 + */ + private function isValidData(object $versionData): bool + { + return isset($versionData->create) && + isset($versionData->move) && + isset($versionData->move->static) && + isset($versionData->move->dynamic); + } + + /** + * Add Extra/Dynamic folders + * + * @return void + * @since 3.2.0 + */ + private function loadExtraFolders() + { + if ($this->component->isArray('folders') || + $this->config->get('add_eximport', false) || + $this->config->get('uikit', 0) || + $this->config->get('footable', false)) + { + $this->addImportViewFolder(); + $this->addPhpSpreadsheetFolder(); + $this->addUikitFolder(); + $this->addFooTableFolder(); + } + } + + /** + * Add Import and Export Folder + * + * @return void + * @since 3.2.0 + */ + private function addImportViewFolder() + { + if ($this->config->get('add_eximport', false)) + { + // soon + } + } + + /** + * Add Php Spreadsheet Folder + * + * @return void + * @since 3.2.0 + */ + private function addPhpSpreadsheetFolder() + { + // move the phpspreadsheet Folder (TODO we must move this to a library package) + if ($this->config->get('add_eximport', false)) + { + $this->component->appendArray('folders', [ + 'folderpath' => 'JPATH_LIBRARIES/phpspreadsheet/vendor', + 'path' => '/libraries/phpspreadsheet/', + 'rename' => 0 + ]); + } + } + + /** + * Add Uikit Folders + * + * @return void + * @since 3.2.0 + */ + private function addUikitFolder() + { + $uikit = $this->config->get('uikit', 0); + if (2 == $uikit || 1 == $uikit) + { + // move the UIKIT Folder into place + $this->component->appendArray('folders', [ + 'folder' => 'uikit-v2', + 'path' => 'media', + 'rename' => 0 + ]); + } + if (2 == $uikit || 3 == $uikit) + { + // move the UIKIT-3 Folder into place + $this->component->appendArray('folders', [ + 'folder' => 'uikit-v3', + 'path' => 'media', + 'rename' => 0 + ]); + } + } + + /** + * Add Foo Table Folder + * + * @return void + * @since 3.2.0 + */ + private function addFooTableFolder() + { + if (!$this->config->get('footable', false)) + { + return; + } + + $footable_version = $this->config->get('footable_version', 2); + + if (2 == $footable_version) + { + // move the footable folder into place + $this->component->appendArray('folders', [ + 'folder' => 'footable-v2', + 'path' => 'media', + 'rename' => 0 + ]); + } + elseif (3 == $footable_version) + { + // move the footable folder into place + $this->component->appendArray('folders', [ + 'folder' => 'footable-v3', + 'path' => 'media', + 'rename' => 0 + ]); + } + } + + /** + * Add Extra/Dynamic files + * + * @return void + * @since 3.2.0 + */ + private function loadExtraFiles() + { + if ($this->component->isArray('files') || + $this->config->get('google_chart', false)) + { + $this->addGoogleChartFiles(); + } + } + + /** + * Add Google Chart Files + * + * @return void + * @since 3.2.0 + */ + private function addGoogleChartFiles() + { + if ($this->config->get('google_chart', false)) + { + // move the google chart files + $this->component->appendArray('files', [ + 'file' => 'google.jsapi.js', + 'path' => 'media/js', + 'rename' => 0 + ]); + $this->component->appendArray('files', [ + 'file' => 'chartbuilder.php', + 'path' => 'admin/helpers', + 'rename' => 0 + ]); + } + } + + /** + * Add Folders + * + * @param object $versionData + * + * @return void + * @since 3.2.0 + */ + private function addFolders(object &$versionData) + { + if (!$this->component->isArray('folders')) + { + return; + } + + // pointer tracker + $pointer_tracker = 'h'; + foreach ($this->component->get('folders') as $custom) + { + // check type of target type + $_target_type = 'c0mp0n3nt'; + if (isset($custom['target_type'])) + { + $_target_type = $custom['target_type']; + } + + // for good practice + $this->pathfix->set( + $custom, ['path', 'folder', 'folderpath'] + ); + + // fix custom path + if (isset($custom['path']) + && StringHelper::check($custom['path'])) + { + $custom['path'] = trim((string) $custom['path'], '/'); + } + + // by default custom path is true + $customPath = 'custom'; + + // set full path if this is a full path folder + if (!isset($custom['folder']) && isset($custom['folderpath'])) + { + // update the dynamic path + $custom['folderpath'] = $this->dynamicpath->update( + $custom['folderpath'] + ); + + // set the folder path with / if does not have a drive/windows full path + $custom['folder'] = (preg_match( + '/^[a-z]:/i', $custom['folderpath'] + )) ? trim($custom['folderpath'], '/') + : '/' . trim($custom['folderpath'], '/'); + + // remove the file path + unset($custom['folderpath']); + + // triget fullpath + $customPath = 'full'; + } + + // make sure we use the correct name + $pathArray = (array) explode('/', (string) $custom['path']); + $lastFolder = end($pathArray); + + // only rename folder if last has folder name + if (isset($custom['rename']) && $custom['rename'] == 1) + { + $custom['path'] = str_replace( + '/' . $lastFolder, '', (string) $custom['path'] + ); + $rename = 'new'; + $newname = $lastFolder; + } + elseif ('full' === $customPath) + { + // make sure we use the correct name + $folderArray = (array) explode('/', (string) $custom['folder']); + $lastFolder = end($folderArray); + $rename = 'new'; + $newname = $lastFolder; + } + else + { + $rename = false; + $newname = ''; + } + + // insure we have no duplicates + $key_pointer = StringHelper::safe( + $custom['folder'] + ) . '_f' . $pointer_tracker; + + $pointer_tracker++; + + // fix custom path + $custom['path'] = ltrim((string) $custom['path'], '/'); + + // set new folder to object + $versionData->move->static->{$key_pointer} = new \stdClass(); + $versionData->move->static->{$key_pointer}->naam = str_replace('//', '/', (string) $custom['folder']); + $versionData->move->static->{$key_pointer}->path = $_target_type . '/' . $custom['path']; + $versionData->move->static->{$key_pointer}->rename = $rename; + $versionData->move->static->{$key_pointer}->newName = $newname; + $versionData->move->static->{$key_pointer}->type = 'folder'; + $versionData->move->static->{$key_pointer}->custom = $customPath; + + // set the target if type and id is found + if (isset($custom['target_id']) && isset($custom['target_type'])) + { + $versionData->move->static->{$key_pointer}->_target = [ + 'key' => $custom['target_id'] . '_' . $custom['target_type'], + 'type' => $custom['target_type'] + ]; + } + } + + $this->component->remove('folders'); + } + + /** + * Add Files + * + * @param object $versionData + * + * @return void + * @since 3.2.0 + */ + private function addFiles(object &$versionData) + { + if (!$this->component->isArray('files')) { + return; + } + + // pointer tracker + $pointer_tracker = 'h'; + foreach ($this->component->get('files') as $custom) + { + // check type of target type + $_target_type = 'c0mp0n3nt'; + if (isset($custom['target_type'])) + { + $_target_type = $custom['target_type']; + } + + // for good practice + $this->pathfix->set( + $custom, ['path', 'file', 'filepath'] + ); + + // by default custom path is true + $customPath = 'custom'; + + // set full path if this is a full path file + if (!isset($custom['file']) && isset($custom['filepath'])) + { + // update the dynamic path + $custom['filepath'] = $this->dynamicpath->update( + $custom['filepath'] + ); + + // set the file path with / if does not have a drive/windows full path + $custom['file'] = (preg_match('/^[a-z]:/i', $custom['filepath'])) + ? trim($custom['filepath'], '/') : '/' . trim($custom['filepath'], '/'); + + // remove the file path + unset($custom['filepath']); + + // triget fullpath + $customPath = 'full'; + } + + // make sure we have not duplicates + $key_pointer = StringHelper::safe( + $custom['file'] + ) . '_g' . $pointer_tracker; + + $pointer_tracker++; + + // set new file to object + $versionData->move->static->{$key_pointer} = new \stdClass(); + $versionData->move->static->{$key_pointer}->naam = str_replace('//', '/', (string) $custom['file']); + + // update the dynamic component name placholders in file names + $custom['path'] = $this->placeholder->update_( + $custom['path'] + ); + + // get the path info + $pathInfo = pathinfo((string) $custom['path']); + if (isset($pathInfo['extension']) && $pathInfo['extension']) + { + $pathInfo['dirname'] = trim($pathInfo['dirname'], '/'); + + // set the info + $versionData->move->static->{$key_pointer}->path = $_target_type . '/' . $pathInfo['dirname']; + $versionData->move->static->{$key_pointer}->rename = 'new'; + $versionData->move->static->{$key_pointer}->newName = $pathInfo['basename']; + } + elseif ('full' === $customPath) + { + // fix custom path + $custom['path'] = ltrim((string) $custom['path'], '/'); + + // get file array + $fileArray = (array) explode('/', (string) $custom['file']); + + // set the info + $versionData->move->static->{$key_pointer}->path = $_target_type . '/' . $custom['path']; + $versionData->move->static->{$key_pointer}->rename = 'new'; + $versionData->move->static->{$key_pointer}->newName = end($fileArray); + } + else + { + // fix custom path + $custom['path'] = ltrim((string) $custom['path'], '/'); + + // set the info + $versionData->move->static->{$key_pointer}->path = $_target_type . '/' . $custom['path']; + $versionData->move->static->{$key_pointer}->rename = false; + } + + $versionData->move->static->{$key_pointer}->type = 'file'; + $versionData->move->static->{$key_pointer}->custom = $customPath; + + // set the target if type and id is found + if (isset($custom['target_id']) + && isset($custom['target_type'])) + { + $versionData->move->static->{$key_pointer}->_target = [ + 'key' => $custom['target_id'] . '_' . $custom['target_type'], + 'type' => $custom['target_type'] + ]; + } + + // check if file should be updated + if (!isset($custom['notnew']) || $custom['notnew'] == 0 + || $custom['notnew'] != 1) + { + $this->registry->appendArray('files.not.new', $key_pointer); + } + else + { + // update the file content + $this->registry->set('update.file.content.' . $key_pointer, true); + } + } + + $this->component->remove('files'); + } +} + diff --git a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Component/JoomlaFive/index.html b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Component/JoomlaFive/index.html new file mode 100644 index 000000000..fa6d84e80 --- /dev/null +++ b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Component/JoomlaFive/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Config.php b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Config.php index 3e905eeb3..9868f0ed3 100644 --- a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Config.php +++ b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Config.php @@ -350,7 +350,8 @@ class Config extends BaseConfig { return [ 3 => ['folder_key' => 3, 'xml_version' => '3.10'], - 4 => ['folder_key' => 4, 'xml_version' => '4.0'] + 4 => ['folder_key' => 4, 'xml_version' => '4.0'], + 5 => ['folder_key' => 4, 'xml_version' => '5.0'] // for now we build 4 and 5 from same templates ;) ]; } diff --git a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Creator/CustomFieldTypeFile.php b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Creator/CustomFieldTypeFile.php index e47ff3e13..0226fdfc2 100644 --- a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Creator/CustomFieldTypeFile.php +++ b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Creator/CustomFieldTypeFile.php @@ -542,8 +542,8 @@ final class CustomFieldTypeFile $placeholders[Placefix::_('view')] = $this->getViewName(); $placeholders[Placefix::_('views')] = $this->getViewsName(); - // Gymnastics to help with transition to Joomla 4 - if ($this->config->get('joomla_version', 3) == 4) + // Gymnastics to help with transition to Joomla 4 and above + if ($this->config->get('joomla_version', 3) != 3) { $placeholders['JFactory::getUser()'] = 'Factory::getApplication()->getIdentity()'; $placeholders['Factory::getUser()'] = 'Factory::getApplication()->getIdentity()'; diff --git a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Extension/JoomlaFive/InstallScript.php b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Extension/JoomlaFive/InstallScript.php new file mode 100644 index 000000000..b93f4750d --- /dev/null +++ b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Extension/JoomlaFive/InstallScript.php @@ -0,0 +1,374 @@ + + * @git 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\JoomlaFive; + + +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 + */ +final 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 . 'use Joomla\CMS\Factory;'; + $script .= PHP_EOL . 'use Joomla\CMS\Language\Text;'; + $script .= PHP_EOL . 'use Joomla\CMS\Filesystem\File;'; + $script .= PHP_EOL . 'use Joomla\CMS\Filesystem\Folder;' . PHP_EOL; + $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 = Factory::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; + } +} + diff --git a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Extension/JoomlaFive/index.html b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Extension/JoomlaFive/index.html new file mode 100644 index 000000000..fa6d84e80 --- /dev/null +++ b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Extension/JoomlaFive/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Extension/JoomlaFour/InstallScript.php b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Extension/JoomlaFour/InstallScript.php index e5ce05f1f..ce1d45be7 100644 --- a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Extension/JoomlaFour/InstallScript.php +++ b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Extension/JoomlaFour/InstallScript.php @@ -25,7 +25,7 @@ use VDM\Joomla\Componentbuilder\Compiler\Interfaces\GetScriptInterface; * * @since 3.2.0 */ -class InstallScript implements GetScriptInterface +final class InstallScript implements GetScriptInterface { /** * The extension diff --git a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Extension/JoomlaThree/InstallScript.php b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Extension/JoomlaThree/InstallScript.php index eb3f69e72..04a820576 100644 --- a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Extension/JoomlaThree/InstallScript.php +++ b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Extension/JoomlaThree/InstallScript.php @@ -25,7 +25,7 @@ use VDM\Joomla\Componentbuilder\Compiler\Interfaces\GetScriptInterface; * * @since 3.2.0 */ -class InstallScript implements GetScriptInterface +final class InstallScript implements GetScriptInterface { /** * The extension diff --git a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Field/JoomlaFive/CoreField.php b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Field/JoomlaFive/CoreField.php new file mode 100644 index 000000000..591fd5304 --- /dev/null +++ b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Field/JoomlaFive/CoreField.php @@ -0,0 +1,129 @@ + + * @git 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\JoomlaFive; + + +use Joomla\CMS\Filesystem\Folder; +use VDM\Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Field\CoreFieldInterface; + + +/** + * Core Joomla Fields + * + * @since 3.2.0 + */ +final class CoreField implements CoreFieldInterface +{ + /** + * Local Core Joomla Fields + * + * @var array|null + * @since 3.2.0 + **/ + protected array $fields = []; + + /** + * Local Core Joomla Fields Path + * + * @var array + * @since 3.2.0 + **/ + protected array $paths = []; + + /** + * Constructor + * + * @since 3.2.0 + */ + public function __construct() + { + // set the path to the form validation fields + $this->paths[] = JPATH_LIBRARIES . '/src/Form/Field'; + } + + /** + * Get the Array of Existing Validation Field Names + * + * @param bool $lowercase Switch to set fields lowercase + * + * @return array + * @since 3.2.0 + */ + public function get(bool $lowercase = false): array + { + if ($this->fields === []) + { + // check if the path exist + foreach ($this->paths as $path) + { + $this->set($path); + } + } + + // return fields if found + if ($this->fields !== []) + { + // check if the names should be all lowercase + if ($lowercase) + { + return array_map( + fn($item): string => strtolower((string) $item), + $this->fields + ); + } + + return $this->fields; + } + + // return empty array + return []; + } + + /** + * Set the fields found in a path + * + * @param string $path The path to load fields from + * @return void + * @since 3.2.0 + */ + private function set(string $path): void + { + // Check if the path exists + if (!Folder::exists($path)) + { + return; + } + + // Load all PHP files in this path + $fields = Folder::files($path, '\.php$', true, true); + + // Process the files to extract field names + $processedFields = array_map(function ($name) { + $fileName = basename($name); + + // Remove 'Field.php' if it exists or just '.php' otherwise + if (substr($fileName, -9) === 'Field.php') + { + return str_replace('Field.php', '', $fileName); + } + else + { + return str_replace('.php', '', $fileName); + } + }, $fields); + + // Merge with existing fields and remove duplicates + $this->fields = array_unique(array_merge($processedFields, $this->fields)); + } +} + diff --git a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Field/JoomlaFive/CoreRule.php b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Field/JoomlaFive/CoreRule.php new file mode 100644 index 000000000..9aee380d1 --- /dev/null +++ b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Field/JoomlaFive/CoreRule.php @@ -0,0 +1,125 @@ + + * @git 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\JoomlaFive; + + +use Joomla\CMS\Filesystem\Folder; +use VDM\Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Field\CoreRuleInterface; + + +/** + * Core Joomla Field Rules + * + * @since 3.2.0 + */ +final class CoreRule implements CoreRuleInterface +{ + /** + * Local Core Joomla Rules + * + * @var array + * @since 3.2.0 + **/ + protected array $rules = []; + + /** + * 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 === []) + { + $this->set($this->path); + } + + // return rules if found + if ($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 []; + } + + /** + * Set the rules found in a path + * + * @param string $path The path to load rules from + * @return void + * @since 3.2.0 + */ + private function set(string $path): void + { + // Check if the path exists + if (!Folder::exists($path)) + { + return; + } + + // Load all PHP files in this path + $rules = Folder::files($path, '\.php$', true, true); + + // Process the files to extract rule names + $processedRules = array_map(function ($name) { + $fileName = basename($name); + + // Remove 'Rule.php' if it exists or just '.php' otherwise + if (substr($fileName, -8) === 'Rule.php') + { + return str_replace('Rule.php', '', $fileName); + } + else + { + return str_replace('.php', '', $fileName); + } + }, $rules); + + // Merge with existing rules and remove duplicates + $this->rules = array_unique(array_merge($processedRules, $this->rules)); + } +} + diff --git a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Field/JoomlaFive/InputButton.php b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Field/JoomlaFive/InputButton.php new file mode 100644 index 000000000..54a9b7bd6 --- /dev/null +++ b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Field/JoomlaFive/InputButton.php @@ -0,0 +1,345 @@ + + * @git 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\JoomlaFive; + + +use VDM\Joomla\Componentbuilder\Compiler\Config; +use VDM\Joomla\Componentbuilder\Compiler\Placeholder; +use VDM\Joomla\Componentbuilder\Compiler\Creator\Permission; +use VDM\Joomla\Utilities\StringHelper; +use VDM\Joomla\Componentbuilder\Compiler\Utilities\Placefix; +use VDM\Joomla\Componentbuilder\Compiler\Utilities\Indent; +use VDM\Joomla\Componentbuilder\Compiler\Utilities\Line; +use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Field\InputButtonInterface; + + +/** + * Compiler Field Input Button + * + * @since 3.2.0 + */ +final class InputButton implements InputButtonInterface +{ + /** + * The Config Class. + * + * @var Config + * @since 3.2.0 + */ + protected Config $config; + + /** + * The Placeholder Class. + * + * @var Placeholder + * @since 3.2.0 + */ + protected Placeholder $placeholder; + + /** + * The Permission Class. + * + * @var Permission + * @since 3.2.0 + */ + protected Permission $permission; + + /** + * Constructor. + * + * @param Config $config The Config Class. + * @param Placeholder $placeholder The Placeholder Class. + * @param Permission $permission The Permission Class. + * + * @since 3.2.0 + */ + public function __construct(Config $config, Placeholder $placeholder, + Permission $permission) + { + $this->config = $config; + $this->placeholder = $placeholder; + $this->permission = $permission; + } + + /** + * get Add Button To List Field Input (getInput tweak) + * + * @param array $fieldData The field custom data + * + * @return string of getInput class on success empty string otherwise + * @since 3.2.0 + */ + public function get(array $fieldData): string + { + // make sure hte view values are set + if (isset($fieldData['add_button']) + && ($fieldData['add_button'] === 'true' + || 1 == $fieldData['add_button']) + && isset($fieldData['view']) + && isset($fieldData['views']) + && StringHelper::check($fieldData['view']) + && StringHelper::check($fieldData['views'])) + { + // set local component + $local_component = "com_" . $this->config->component_code_name; + // check that the component value is set + if (!isset($fieldData['component']) + || !StringHelper::check( + $fieldData['component'] + )) + { + $fieldData['component'] = $local_component; + } + // check that the component has the com_ value in it + if (strpos((string) $fieldData['component'], 'com_') === false + || strpos((string) $fieldData['component'], '=') !== false) + { + $fieldData['component'] = "com_" . $fieldData['component']; + } + // make sure the component is update if # # # or [ [ [ component placeholder is used + if (strpos((string) $fieldData['component'], (string) Placefix::h()) !== false + || strpos((string) $fieldData['component'], (string) Placefix::b()) !== false) // should not be needed... but + { + $fieldData['component'] = $this->placeholder->update_( + $fieldData['component'] + ); + } + // get core permissions + $coreLoad = false; + // add ref tags + $refLoad = true; + // fall back on the field component + $component = $fieldData['component']; + // check if we should add ref tags (since it only works well on local views) + if ($local_component !== $component) + { + // do not add ref tags + $refLoad = false; + } + // start building the add buttons/s + $addButton = array(); + $addButton[] = PHP_EOL . PHP_EOL . Indent::_(1) . "/**"; + $addButton[] = Indent::_(1) . " * Override to add new button"; + $addButton[] = Indent::_(1) . " *"; + $addButton[] = Indent::_(1) + . " * @return string The field input markup."; + $addButton[] = Indent::_(1) . " *"; + $addButton[] = Indent::_(1) . " * @since 3.2"; + $addButton[] = Indent::_(1) . " */"; + $addButton[] = Indent::_(1) . "protected function getInput()"; + $addButton[] = Indent::_(1) . "{"; + $addButton[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__) + . " see if we should add buttons"; + $addButton[] = Indent::_(2) + . "\$set_button = \$this->getAttribute('button');"; + $addButton[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__) + . " get html"; + $addButton[] = Indent::_(2) . "\$html = parent::getInput();"; + $addButton[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__) + . " if true set button"; + $addButton[] = Indent::_(2) . "if (\$set_button === 'true')"; + $addButton[] = Indent::_(2) . "{"; + $addButton[] = Indent::_(3) . "\$button = array();"; + $addButton[] = Indent::_(3) . "\$script = array();"; + $addButton[] = Indent::_(3) + . "\$button_code_name = \$this->getAttribute('name');"; + $addButton[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__) + . " get the input from url"; + $addButton[] = Indent::_(3) . "\$app = Factory::getApplication();"; + $addButton[] = Indent::_(3) . "\$jinput = \$app->input;"; + $addButton[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__) + . " get the view name & id"; + $addButton[] = Indent::_(3) + . "\$values = \$jinput->getArray(array("; + $addButton[] = Indent::_(4) . "'id' => 'int',"; + $addButton[] = Indent::_(4) . "'view' => 'word'"; + $addButton[] = Indent::_(3) . "));"; + $addButton[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__) + . " check if new item"; + $addButton[] = Indent::_(3) . "\$ref = '';"; + $addButton[] = Indent::_(3) . "\$refJ = '';"; + if ($refLoad) + { + $addButton[] = Indent::_(3) + . "if (!is_null(\$values['id']) && strlen(\$values['view']))"; + $addButton[] = Indent::_(3) . "{"; + $addButton[] = Indent::_(4) . "//" . Line::_(__Line__, __Class__) + . " only load referral if not new item."; + $addButton[] = Indent::_(4) + . "\$ref = '&ref=' . \$values['view'] . '&refid=' . \$values['id'];"; + $addButton[] = Indent::_(4) + . "\$refJ = '&ref=' . \$values['view'] . '&refid=' . \$values['id'];"; + $addButton[] = Indent::_(4) . "//" . Line::_(__Line__, __Class__) + . " get the return value."; + $addButton[] = Indent::_(4) + . "\$_uri = (string) \Joomla\CMS\Uri\Uri::getInstance();"; + $addButton[] = Indent::_(4) + . "\$_return = urlencode(base64_encode(\$_uri));"; + $addButton[] = Indent::_(4) . "//" . Line::_(__Line__, __Class__) + . " load return value."; + $addButton[] = Indent::_(4) + . "\$ref .= '&return=' . \$_return;"; + $addButton[] = Indent::_(4) + . "\$refJ .= '&return=' . \$_return;"; + $addButton[] = Indent::_(3) . "}"; + } + else + { + $addButton[] = Indent::_(3) + . "if (!is_null(\$values['id']) && strlen(\$values['view']))"; + $addButton[] = Indent::_(3) . "{"; + $addButton[] = Indent::_(4) . "//" . Line::_(__Line__, __Class__) + . " only load field details if not new item."; + $addButton[] = Indent::_(4) + . "\$ref = '&field=' . \$values['view'] . '&field_id=' . \$values['id'];"; + $addButton[] = Indent::_(4) + . "\$refJ = '&field=' . \$values['view'] . '&field_id=' . \$values['id'];"; + $addButton[] = Indent::_(4) . "//" . Line::_(__Line__, __Class__) + . " get the return value."; + $addButton[] = Indent::_(4) + . "\$_uri = (string) \Joomla\CMS\Uri\Uri::getInstance();"; + $addButton[] = Indent::_(4) + . "\$_return = urlencode(base64_encode(\$_uri));"; + $addButton[] = Indent::_(4) . "//" . Line::_(__Line__, __Class__) + . " load return value."; + $addButton[] = Indent::_(4) + . "\$ref = '&return=' . \$_return;"; + $addButton[] = Indent::_(4) + . "\$refJ = '&return=' . \$_return;"; + $addButton[] = Indent::_(3) . "}"; + } + $addButton[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__) + . " get button label"; + $addButton[] = Indent::_(3) + . "\$button_label = trim(\$button_code_name);"; + $addButton[] = Indent::_(3) + . "\$button_label = preg_replace('/_+/', ' ', \$button_label);"; + $addButton[] = Indent::_(3) + . "\$button_label = preg_replace('/\s+/', ' ', \$button_label);"; + $addButton[] = Indent::_(3) + . "\$button_label = preg_replace(\"/[^A-Za-z ]/\", '', \$button_label);"; + $addButton[] = Indent::_(3) + . "\$button_label = ucfirst(strtolower(\$button_label));"; + $addButton[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__) + . " get user object"; + $addButton[] = Indent::_(3) . "\$user = Factory::getApplication()->getIdentity();"; + $addButton[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__) + . " only add if user allowed to create " . $fieldData['view']; + // check if the item has permissions. + $addButton[] = Indent::_(3) . "if (\$user->authorise('" + . $this->permission->getGlobal($fieldData['view'], 'core.create') + . "', '" . $component . "') && \$app->isClient('administrator')) // TODO for now only in admin area."; + $addButton[] = Indent::_(3) . "{"; + $addButton[] = Indent::_(4) . "//" . Line::_(__Line__, __Class__) + . " build Create button"; + $addButton[] = Indent::_(4) + . "\$button[] = 'config->lang_prefix + . "_CREATE_NEW_S', \$button_label).'\" style=\"border-radius: 0px 4px 4px 0px;\""; + $addButton[] = Indent::_(5) . "href=\"index.php?option=" + . $fieldData['component'] . "&view=" . $fieldData['view'] + . "&layout=edit'.\$ref.'\" >"; + $addButton[] = Indent::_(5) + . "';"; + $addButton[] = Indent::_(3) . "}"; + $addButton[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__) + . " only add if user allowed to edit " . $fieldData['view']; + // check if the item has permissions. + $addButton[] = Indent::_(3) . "if (\$user->authorise('" + . $this->permission->getGlobal($fieldData['view'], 'core.edit') + . "', '" . $component . "') && \$app->isClient('administrator')) // TODO for now only in admin area."; + $addButton[] = Indent::_(3) . "{"; + $addButton[] = Indent::_(4) . "//" . Line::_(__Line__, __Class__) + . " build edit button"; + $addButton[] = Indent::_(4) + . "\$button[] = 'config->lang_prefix + . "_EDIT_S', \$button_label).'\" style=\"display: none; border-radius: 0px 4px 4px 0px;\" href=\"#\" >"; + $addButton[] = Indent::_(5) + . "';"; + + $addButton[] = Indent::_(4) . "//" . Line::_(__Line__, __Class__) + . " build script"; +$addButton[] = Indent::_(4) . "\$script[] = \""; + $addButton[] = Indent::_(5) . "document.addEventListener('DOMContentLoaded', function() {"; + $addButton[] = Indent::_(6) + . "document.getElementById('jform_\".\$button_code_name.\"').addEventListener('change', function(e) {"; + $addButton[] = Indent::_(7) . "e.preventDefault();"; + $addButton[] = Indent::_(7) + . "let \".\$button_code_name.\"Value = this.value;"; + $addButton[] = Indent::_(7) + . "\".\$button_code_name.\"Button(\".\$button_code_name.\"Value);"; + $addButton[] = Indent::_(6) . "});"; + $addButton[] = Indent::_(6) + . "let \".\$button_code_name.\"Value = document.getElementById('jform_\".\$button_code_name.\"').value;"; + $addButton[] = Indent::_(6) + . "\".\$button_code_name.\"Button(\".\$button_code_name.\"Value);"; + $addButton[] = Indent::_(5) . "});"; + $addButton[] = Indent::_(5) + . "function \".\$button_code_name.\"Button(value) {"; + $addButton[] = Indent::_(6) + . "var createButton = document.getElementById('\".\$button_code_name.\"Create');"; + $addButton[] = Indent::_(6) + . "var editButton = document.getElementById('\".\$button_code_name.\"Edit');"; + $addButton[] = Indent::_(6) + . "if (value > 0) {"; // TODO not ideal since value may not be an (int) + $addButton[] = Indent::_(7) . "// hide the create button"; + $addButton[] = Indent::_(7) + . "createButton.style.display = 'none';"; + $addButton[] = Indent::_(7) . "// show edit button"; + $addButton[] = Indent::_(7) + . "editButton.style.display = 'block';"; + $addButton[] = Indent::_(7) . "let url = 'index.php?option=" + . $fieldData['component'] . "&view=" . $fieldData['views'] + . "&task=" . $fieldData['view'] + . ".edit&id='+value+'\".\$refJ.\"';"; // TODO this value may not be the ID + $addButton[] = Indent::_(7) + . "editButton.setAttribute('href', url);"; + $addButton[] = Indent::_(6) . "} else {"; + $addButton[] = Indent::_(7) . "// show the create button"; + $addButton[] = Indent::_(7) + . "createButton.style.display = 'block';"; + $addButton[] = Indent::_(7) . "// hide edit button"; + $addButton[] = Indent::_(7) + . "editButton.style.display = 'none';"; + $addButton[] = Indent::_(6) . "}"; + $addButton[] = Indent::_(5) . "}\";"; + + $addButton[] = Indent::_(3) . "}"; + $addButton[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__) + . " check if button was created for " . $fieldData['view'] + . " field."; + $addButton[] = Indent::_(3) + . "if (is_array(\$button) && count(\$button) > 0)"; + $addButton[] = Indent::_(3) . "{"; + $addButton[] = Indent::_(4) . "//" . Line::_(__Line__, __Class__) + . " Load the needed script."; + $addButton[] = Indent::_(4) + . "\$document = Factory::getApplication()->getDocument();"; + $addButton[] = Indent::_(4) + . "\$document->addScriptDeclaration(implode(' ',\$script));"; + $addButton[] = Indent::_(4) . "//" . Line::_(__Line__, __Class__) + . " return the button attached to input field."; + $addButton[] = Indent::_(4) + . "return '

' .\$html . implode('',\$button).'
';"; + $addButton[] = Indent::_(3) . "}"; + $addButton[] = Indent::_(2) . "}"; + $addButton[] = Indent::_(2) . "return \$html;"; + $addButton[] = Indent::_(1) . "}"; + + return implode(PHP_EOL, $addButton); + } + + return ''; + } +} + diff --git a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Field/JoomlaFive/index.html b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Field/JoomlaFive/index.html new file mode 100644 index 000000000..fa6d84e80 --- /dev/null +++ b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Field/JoomlaFive/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Field/JoomlaFour/CoreField.php b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Field/JoomlaFour/CoreField.php index f0b380398..529142d7f 100644 --- a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Field/JoomlaFour/CoreField.php +++ b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Field/JoomlaFour/CoreField.php @@ -22,7 +22,7 @@ use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Field\CoreFieldInterface; * * @since 3.2.0 */ -class CoreField implements CoreFieldInterface +final class CoreField implements CoreFieldInterface { /** * Local Core Joomla Fields diff --git a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Field/JoomlaFour/CoreRule.php b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Field/JoomlaFour/CoreRule.php index 02ed5aadd..0da51e405 100644 --- a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Field/JoomlaFour/CoreRule.php +++ b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Field/JoomlaFour/CoreRule.php @@ -22,7 +22,7 @@ use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Field\CoreRuleInterface; * * @since 3.2.0 */ -class CoreRule implements CoreRuleInterface +final class CoreRule implements CoreRuleInterface { /** * Local Core Joomla Rules diff --git a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Field/JoomlaThree/CoreField.php b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Field/JoomlaThree/CoreField.php index f27af1618..4b3a42fff 100644 --- a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Field/JoomlaThree/CoreField.php +++ b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Field/JoomlaThree/CoreField.php @@ -22,7 +22,7 @@ use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Field\CoreFieldInterface; * * @since 3.2.0 */ -class CoreField implements CoreFieldInterface +final class CoreField implements CoreFieldInterface { /** * Local Core Joomla Fields diff --git a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Field/JoomlaThree/CoreRule.php b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Field/JoomlaThree/CoreRule.php index e8e810065..378f9f926 100644 --- a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Field/JoomlaThree/CoreRule.php +++ b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Field/JoomlaThree/CoreRule.php @@ -22,7 +22,7 @@ use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Field\CoreRuleInterface; * * @since 3.2.0 */ -class CoreRule implements CoreRuleInterface +final class CoreRule implements CoreRuleInterface { /** * Local Core Joomla Rules diff --git a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Helper/Interpretation.php b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Helper/Interpretation.php index 389e64fae..6a9fd36a1 100644 --- a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Helper/Interpretation.php +++ b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Helper/Interpretation.php @@ -1259,7 +1259,7 @@ class Interpretation extends Fields public function setUpdateXMLSQL(&$update, &$updateXML, &$addDynamicSQL) { // ensure version naming is correct - $update['version'] = preg_replace('/[^0-9\.]+/', '', (string) $update['version']); + $update['version'] = preg_replace('/^v/i', '', (string) $update['version']); // setup SQL if (StringHelper::check($update['mysql'])) { diff --git a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/JoomlaFive/Event.php b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/JoomlaFive/Event.php new file mode 100644 index 000000000..245cf05d9 --- /dev/null +++ b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/JoomlaFive/Event.php @@ -0,0 +1,100 @@ + + * @git 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\JoomlaFive; + + +use Joomla\Registry\Registry; +use Joomla\CMS\Plugin\PluginHelper; +use VDM\Joomla\Utilities\Component\Helper; +use VDM\Joomla\Componentbuilder\Compiler\Interfaces\EventInterface; + + +/** + * Compiler Events + * + * @since 3.2.0 + */ +class Event implements EventInterface +{ + /** + * event plugin trigger switch + * + * @var boolean + * @since 3.2.0 + */ + protected $activePlugins = false; + + /** + * Constructor + * + * @param Registry|null $params The component parameters + * + * @since 3.2.0 + */ + public function __construct(?Registry $params = null) + { + // Set the params + $params = $params ?: Helper::getParams('com_componentbuilder'); + // get active plugins + if (($plugins = $params->get('compiler_plugin', false)) + !== false) + { + foreach ($plugins as $plugin) + { + // get possible plugins + if (PluginHelper::isEnabled('extension', $plugin)) + { + // Import the appropriate plugin group. + PluginHelper::importPlugin('extension', $plugin); + // activate events + $this->activePlugins = true; + } + } + } + } + + /** + * Trigger an event + * + * @param string $event The event to trigger + * @param mixed $data The values to pass to the event/plugin + * + * @return void + * @throws \Exception + * @since 3.2.0 + */ + public function trigger(string $event, $data = null) + { + // only execute if plugins were loaded (active) + if ($this->activePlugins) + { + // Get the dispatcher. + $dispatcher = \JEventDispatcher::getInstance(); + + // Trigger this compiler event. + $results = $dispatcher->trigger($event, $data); + + // Check for errors encountered while trigger the event + if (count((array) $results) && in_array(false, $results, true)) + { + // Get the last error. + $error = $dispatcher->getError(); + + if (!($error instanceof \Exception)) + { + throw new \Exception($error); + } + } + } + } +} + diff --git a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/JoomlaFive/Header.php b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/JoomlaFive/Header.php new file mode 100644 index 000000000..cd95b8476 --- /dev/null +++ b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/JoomlaFive/Header.php @@ -0,0 +1,584 @@ + + * @git 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\JoomlaFive; + + +use VDM\Joomla\Componentbuilder\Compiler\Config; +use VDM\Joomla\Componentbuilder\Compiler\Interfaces\EventInterface as Event; +use VDM\Joomla\Componentbuilder\Compiler\Placeholder; +use VDM\Joomla\Componentbuilder\Compiler\Language; +use VDM\Joomla\Componentbuilder\Compiler\Builder\UikitComp; +use VDM\Joomla\Componentbuilder\Compiler\Builder\AdminFilterType; +use VDM\Joomla\Componentbuilder\Compiler\Builder\Category; +use VDM\Joomla\Componentbuilder\Compiler\Builder\AccessSwitchList; +use VDM\Joomla\Componentbuilder\Compiler\Builder\Filter; +use VDM\Joomla\Componentbuilder\Compiler\Builder\Tags; +use VDM\Joomla\Utilities\String\NamespaceHelper; +use VDM\Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Utilities\StringHelper; +use VDM\Joomla\Componentbuilder\Compiler\Interfaces\HeaderInterface; + + +/** + * Build headers for all Joomla 5 files + * + * @since 3.2.0 + */ +final class Header implements HeaderInterface +{ + /** + * The Config Class. + * + * @var Config + * @since 3.2.0 + */ + protected Config $config; + + /** + * The EventInterface Class. + * + * @var Event + * @since 3.2.0 + */ + protected Event $event; + + /** + * The Placeholder Class. + * + * @var Placeholder + * @since 3.2.0 + */ + protected Placeholder $placeholder; + + /** + * The Language Class. + * + * @var Language + * @since 3.2.0 + */ + protected Language $language; + + /** + * The UikitComp Class. + * + * @var UikitComp + * @since 3.2.0 + */ + protected UikitComp $uikitcomp; + + /** + * The AdminFilterType Class. + * + * @var AdminFilterType + * @since 3.2.0 + */ + protected AdminFilterType $adminfiltertype; + + /** + * The Category Class. + * + * @var Category + * @since 3.2.0 + */ + protected Category $category; + + /** + * The AccessSwitchList Class. + * + * @var AccessSwitchList + * @since 3.2.0 + */ + protected AccessSwitchList $accessswitchlist; + + /** + * The Filter Class. + * + * @var Filter + * @since 3.2.0 + */ + protected Filter $filter; + + /** + * The Tags Class. + * + * @var Tags + * @since 3.2.0 + */ + protected Tags $tags; + + /** + * The Header Context array + * + * @var array + * @since 3.2.0 + */ + protected array $headers = []; + + /** + * The Namespace Prefix + * + * @var string + * @since 3.2.0 + */ + protected string $NamespacePrefix; + + /** + * The Component Name (in code) + * + * @var string + * @since 3.2.0 + */ + protected string $ComponentName; + + /** + * The Component Namespace (in code) + * + * @var string + * @since 3.2.0 + */ + protected string $ComponentNameSpace; + + /** + * Constructor. + * + * @param Config $config The Config Class. + * @param Event $event The EventInterface Class. + * @param Placeholder $placeholder The Placeholder Class. + * @param Language $language The Language Class. + * @param UikitComp $uikitcomp The UikitComp Class. + * @param AdminFilterType $adminfiltertype The AdminFilterType Class. + * @param Category $category The Category Class. + * @param AccessSwitchList $accessswitchlist The AccessSwitchList Class. + * @param Filter $filter The Filter Class. + * @param Tags $tags The Tags Class. + * + * @since 3.2.0 + */ + public function __construct(Config $config, Event $event, Placeholder $placeholder, + Language $language, UikitComp $uikitcomp, + AdminFilterType $adminfiltertype, Category $category, + AccessSwitchList $accessswitchlist, Filter $filter, + Tags $tags) + { + $this->config = $config; + $this->event = $event; + $this->placeholder = $placeholder; + $this->language = $language; + $this->uikitcomp = $uikitcomp; + $this->adminfiltertype = $adminfiltertype; + $this->category = $category; + $this->accessswitchlist = $accessswitchlist; + $this->filter = $filter; + $this->tags = $tags; + + // set some global values + $this->NamespacePrefix = $this->config->get('namespace_prefix'); + $this->ComponentName = $this->placeholder->get('Component'); + $this->ComponentNameSpace = NamespaceHelper::safeSegment($this->ComponentName); + } + + /** + * Get the headers for a file + * + * @param string $context The name of the context + * @param string $codeName The view, views, or layout code name + * + * @return string The header string to place in the header of the file + * @since 3.2.0 + */ + public function get(string $context, string $codeName): string + { + // get static headers + $headers = $this->getHeaders($context); + + // add to all except the helper classes + if ('admin.helper' !== $context && 'site.helper' !== $context) + { + $target = 'Administrator'; + if ($this->config->get('build_target', 'admin') === 'site') + { + $target = 'Site'; + } + + $headers[] = "use {$this->NamespacePrefix}\\Component\\{$this->ComponentNameSpace}\\{$target}\\Helper\\{$this->ComponentName}Helper;"; + + // we will add more as needed + switch ($context) + { + case 'site.view.model': + case 'site.views.model': + case 'site.view.html': + case 'site.views.html': + $headers[] = "use {$this->NamespacePrefix}\\Component\\{$this->ComponentNameSpace}\\Site\\Helper\\RouteHelper;"; + break; + + default: + break; + } + } + + // 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': + case 'custom.admin.views.html': + case 'site.admin.view.html': + case 'site.view.html': + case 'site.views.html': + if ((2 == $this->config->uikit || 1 == $this->config->uikit) + && $this->uikitcomp->exists($codeName)) + { + $headers[] = 'use Joomla\CMS\Filesystem\File;'; + } + break; + + case 'admin.view': + case 'custom.admin.view': + case 'custom.admin.views': + case 'site.admin.view': + $headers[] = ''; + $headers[] = '/** @var Joomla\CMS\WebAsset\WebAssetManager $wa */'; + $headers[] = '$wa = $this->getDocument()->getWebAssetManager();'; + $headers[] = '$wa->useScript(\'keepalive\')->useScript(\'form.validate\');'; + $headers[] = 'Html::_(\'bootstrap.tooltip\');'; + break; + + case 'admin.view.model': + case 'site.admin.view.model': + case 'custom.admin.view.model': + case 'site.view.model': + case 'admin.views.model': + case 'site.views.model': + $headers[] = 'use Joomla\CMS\Helper\TagsHelper;'; + break; + + default: + break; + } + + // Trigger Event: jcb_ce_setClassHeader + $this->event->trigger( + 'jcb_ce_setClassHeader', [&$context, &$codeName, &$headers] + ); + + // return the headers + return $this->placeholder->update_(implode(PHP_EOL, $headers)); + } + + /** + * Get the headers for a file + * + * @param string $context The name of the context + * + * @return array The header string to place in the header of the file + * @since 3.2.0 + */ + protected function getHeaders(string $context): array + { + if (isset($this->headers[$context])) + { + return $this->headers[$context]; + } + + // set the defaults + $headers = []; + $headers[] = 'use Joomla\CMS\Factory;'; + $headers[] = 'use Joomla\CMS\Language\Text;'; + + switch ($context) + { + case 'admin.component': + $headers[] = 'use Joomla\CMS\Access\Exception\NotAllowed;'; + $headers[] = 'use Joomla\CMS\HTML\HTMLHelper as Html;'; + $headers[] = 'use Joomla\CMS\MVC\Controller\BaseController;'; + break; + + case 'admin.helper': + case 'site.helper': + $headers[] = 'use Joomla\CMS\Access\Access;'; + $headers[] = 'use Joomla\CMS\Access\Rules as AccessRules;'; + $headers[] = 'use Joomla\CMS\Component\ComponentHelper;'; + $headers[] = 'use Joomla\CMS\Filesystem\File;'; + $headers[] = 'use Joomla\CMS\Language\Language;'; + $headers[] = 'use Joomla\CMS\MVC\Model\BaseDatabaseModel;'; + $headers[] = 'use Joomla\CMS\Object\CMSObject;'; + $headers[] = 'use Joomla\CMS\Session\Session;'; + $headers[] = 'use Joomla\CMS\Table\Table;'; + $headers[] = 'use Joomla\CMS\Uri\Uri;'; + $headers[] = 'use Joomla\CMS\Version;'; + $headers[] = 'use Joomla\Database\DatabaseInterface;'; + $headers[] = 'use Joomla\Registry\Registry;'; + $headers[] = 'use Joomla\String\StringHelper;'; + $headers[] = 'use Joomla\Utilities\ArrayHelper;'; + break; + + case 'admin.layout': + case 'site.layout': + case 'custom.admin.layout': + case 'override.layout': + $headers[] = 'use Joomla\CMS\HTML\HTMLHelper as Html;'; + $headers[] = 'use Joomla\CMS\Layout\LayoutHelper;'; + break; + + case 'admin.view': + case 'custom.admin.view': + case 'custom.admin.views': + case 'site.admin.view': + $headers[] = 'use Joomla\CMS\HTML\HTMLHelper as Html;'; + $headers[] = 'use Joomla\CMS\Layout\LayoutHelper;'; + $headers[] = 'use Joomla\CMS\Router\Route;'; + break; + + case 'admin.view.controller': + $headers[] = 'use Joomla\CMS\Form\FormFactoryInterface;'; + $headers[] = 'use Joomla\CMS\Application\CMSApplication;'; + $headers[] = 'use Joomla\CMS\MVC\Factory\MVCFactoryInterface;'; + $headers[] = 'use Joomla\Input\Input;'; + case 'site.admin.view.controller': + $headers[] = 'use Joomla\CMS\Versioning\VersionableControllerTrait;'; + case 'site.view.controller': + $headers[] = 'use Joomla\CMS\MVC\Controller\FormController;'; + $headers[] = 'use Joomla\CMS\MVC\Model\BaseDatabaseModel;'; + $headers[] = 'use Joomla\Utilities\ArrayHelper;'; + $headers[] = 'use Joomla\CMS\Router\Route;'; + $headers[] = 'use Joomla\CMS\Session\Session;'; + $headers[] = 'use Joomla\CMS\Uri\Uri;'; + break; + + case 'admin.view.html': + case 'admin.views.html': + case 'site.admin.view.html': + $headers[] = 'use Joomla\CMS\Toolbar\Toolbar;'; + $headers[] = 'use Joomla\CMS\Form\FormHelper;'; + $headers[] = 'use Joomla\CMS\Session\Session;'; + $headers[] = 'use Joomla\CMS\Uri\Uri;'; + $headers[] = 'use Joomla\CMS\Component\ComponentHelper;'; + $headers[] = 'use Joomla\CMS\HTML\HTMLHelper as Html;'; + $headers[] = 'use Joomla\CMS\Layout\FileLayout;'; + $headers[] = 'use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;'; + $headers[] = 'use Joomla\CMS\Plugin\PluginHelper;'; + $headers[] = 'use Joomla\CMS\Toolbar\ToolbarHelper;'; + $headers[] = 'use Joomla\CMS\Document\Document;'; + break; + + case 'site.view.html': + case 'site.views.html': + $headers[] = 'use Joomla\CMS\Toolbar\Toolbar;'; + $headers[] = 'use Joomla\CMS\Component\ComponentHelper;'; + $headers[] = 'use Joomla\CMS\HTML\HTMLHelper as Html;'; + $headers[] = 'use Joomla\CMS\Layout\FileLayout;'; + $headers[] = 'use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;'; + $headers[] = 'use Joomla\CMS\Plugin\PluginHelper;'; + $headers[] = 'use Joomla\CMS\Toolbar\ToolbarHelper;'; + $headers[] = 'use Joomla\CMS\Document\Document;'; + $headers[] = "use {$this->NamespacePrefix}\\Component\\{$this->ComponentNameSpace}\\Site\\Helper\\HeaderCheck;"; + break; + + case 'custom.admin.view.html': + case 'custom.admin.views.html': + $target = 'Administrator'; + if ($this->config->get('build_target', 'admin') === 'site') + { + $target = 'Site'; + } + $headers[] = 'use Joomla\CMS\Component\ComponentHelper;'; + $headers[] = 'use Joomla\CMS\HTML\HTMLHelper as Html;'; + $headers[] = 'use Joomla\CMS\Layout\FileLayout;'; + $headers[] = 'use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;'; + $headers[] = 'use Joomla\CMS\Plugin\PluginHelper;'; + $headers[] = 'use Joomla\CMS\Toolbar\ToolbarHelper;'; + $headers[] = 'use Joomla\CMS\Document\Document;'; + $headers[] = "use {$this->NamespacePrefix}\\Component\\{$this->ComponentNameSpace}\\{$target}\\Helper\\HeaderCheck;"; + break; + + case 'admin.view.model': + case 'site.admin.view.model': + $headers[] = 'use Joomla\CMS\Application\CMSApplicationInterface;'; + $headers[] = 'use Joomla\CMS\Component\ComponentHelper;'; + $headers[] = 'use Joomla\CMS\Form\Form;'; + $headers[] = 'use Joomla\CMS\Filter\InputFilter;'; + $headers[] = 'use Joomla\CMS\Filter\OutputFilter;'; + $headers[] = 'use Joomla\CMS\MVC\Model\AdminModel;'; + $headers[] = 'use Joomla\CMS\MVC\Factory\MVCFactoryInterface;'; + $headers[] = 'use Joomla\CMS\Table\Table;'; + $headers[] = 'use Joomla\CMS\UCM\UCMType;'; + $headers[] = 'use Joomla\CMS\Versioning\VersionableModelTrait;'; + $headers[] = 'use Joomla\CMS\User\User;'; + $headers[] = 'use Joomla\Registry\Registry;'; + $headers[] = 'use Joomla\String\StringHelper;'; + $headers[] = 'use Joomla\Utilities\ArrayHelper;'; + $headers[] = 'use Joomla\Input\Input;'; + break; + + case 'admin.views': + $headers[] = 'use Joomla\CMS\HTML\HTMLHelper as Html;'; + $headers[] = 'use Joomla\CMS\Layout\LayoutHelper;'; + $headers[] = 'use Joomla\CMS\Router\Route;'; + break; + + case 'admin.views.controller': + case 'custom.admin.views.controller': + case 'dashboard.controller': + $headers[] = 'use Joomla\CMS\MVC\Controller\AdminController;'; + $headers[] = 'use Joomla\Utilities\ArrayHelper;'; + $headers[] = 'use Joomla\CMS\Router\Route;'; + $headers[] = 'use Joomla\CMS\Session\Session;'; + break; + + case 'ajax.admin.model': + case 'ajax.site.model': + $headers[] = 'use Joomla\CMS\Application\CMSApplicationInterface;'; + $headers[] = 'use Joomla\CMS\Component\ComponentHelper;'; + $headers[] = 'use Joomla\CMS\HTML\HTMLHelper as Html;'; + $headers[] = 'use Joomla\CMS\Layout\LayoutHelper;'; + $headers[] = 'use Joomla\CMS\MVC\Model\ListModel;'; + $headers[] = 'use Joomla\CMS\MVC\Factory\MVCFactoryInterface;'; + $headers[] = 'use Joomla\CMS\Plugin\PluginHelper;'; + $headers[] = 'use Joomla\CMS\User\User;'; + $headers[] = 'use Joomla\Utilities\ArrayHelper;'; + $headers[] = 'use Joomla\Input\Input;'; + $headers[] = 'use Joomla\CMS\Router\Route;'; + $headers[] = 'use Joomla\CMS\Session\Session;'; + $headers[] = 'use Joomla\CMS\Uri\Uri;'; + $headers[] = 'use Joomla\Registry\Registry;'; + break; + + case 'dashboard.model': + $headers[] = 'use Joomla\CMS\HTML\HTMLHelper as Html;'; + $headers[] = 'use Joomla\CMS\Session\Session;'; + $headers[] = 'use Joomla\CMS\Uri\Uri;'; + case 'admin.views.model': + case 'custom.admin.views.model': + case 'site.views.model': + $headers[] = 'use Joomla\CMS\Application\CMSApplicationInterface;'; + $headers[] = 'use Joomla\CMS\Component\ComponentHelper;'; + $headers[] = 'use Joomla\CMS\MVC\Model\ListModel;'; + $headers[] = 'use Joomla\CMS\MVC\Factory\MVCFactoryInterface;'; + $headers[] = 'use Joomla\CMS\Plugin\PluginHelper;'; + $headers[] = 'use Joomla\CMS\Router\Route;'; + $headers[] = 'use Joomla\CMS\User\User;'; + $headers[] = 'use Joomla\Utilities\ArrayHelper;'; + $headers[] = 'use Joomla\Input\Input;'; + break; + + case 'custom.admin.view.controller': + case 'import.controller': + case 'import.custom.controller': + $headers[] = 'use Joomla\CMS\MVC\Controller\BaseController;'; + $headers[] = 'use Joomla\CMS\Router\Route;'; + $headers[] = 'use Joomla\CMS\Session\Session;'; + $headers[] = 'use Joomla\Utilities\ArrayHelper;'; + break; + + case 'custom.admin.view.model': + case 'site.view.model': + $headers[] = 'use Joomla\CMS\Application\CMSApplicationInterface;'; + $headers[] = 'use Joomla\CMS\Component\ComponentHelper;'; + $headers[] = 'use Joomla\CMS\MVC\Model\ItemModel;'; + $headers[] = 'use Joomla\CMS\MVC\Factory\MVCFactoryInterface;'; + $headers[] = 'use Joomla\CMS\Plugin\PluginHelper;'; + $headers[] = 'use Joomla\CMS\Router\Route;'; + $headers[] = 'use Joomla\CMS\Uri\Uri;'; + $headers[] = 'use Joomla\CMS\User\User;'; + $headers[] = 'use Joomla\Input\Input;'; + $headers[] = 'use Joomla\Utilities\ArrayHelper;'; + + break; + case 'import.custom.model': + case 'import.model': + $headers[] = 'use Joomla\CMS\Filesystem\File;'; + $headers[] = 'use Joomla\CMS\Filesystem\Folder;'; + $headers[] = 'use Joomla\CMS\Filesystem\Path;'; + $headers[] = 'use Joomla\CMS\Filter\OutputFilter;'; + $headers[] = 'use Joomla\CMS\Installer\InstallerHelper;'; + $headers[] = 'use Joomla\CMS\MVC\Model\BaseDatabaseModel;'; + $headers[] = 'use Joomla\String\StringHelper;'; + $headers[] = 'use Joomla\Utilities\ArrayHelper;'; + $headers[] = 'use PhpOffice\PhpSpreadsheet\IOFactory;'; + break; + + case 'dashboard.view': + $headers[] = 'use Joomla\CMS\HTML\HTMLHelper as Html;'; + break; + + case 'dashboard.view.html': + $headers[] = 'use Joomla\CMS\HTML\HTMLHelper as Html;'; + $headers[] = 'use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;'; + $headers[] = 'use Joomla\CMS\Toolbar\ToolbarHelper;'; + $headers[] = 'use Joomla\CMS\Document\Document;'; + break; + + case 'site.router': + $headers[] = 'use Joomla\CMS\Application\SiteApplication;'; + $headers[] = 'use Joomla\CMS\Categories\CategoryFactoryInterface;'; + $headers[] = 'use Joomla\CMS\Component\ComponentHelper;'; + $headers[] = 'use Joomla\CMS\Component\Router\RouterView;'; + $headers[] = 'use Joomla\CMS\Component\Router\RouterViewConfiguration;'; + $headers[] = 'use Joomla\CMS\Component\Router\Rules\MenuRules;'; + $headers[] = 'use Joomla\CMS\Component\Router\Rules\NomenuRules;'; + $headers[] = 'use Joomla\CMS\Component\Router\Rules\StandardRules;'; + $headers[] = 'use Joomla\CMS\Menu\AbstractMenu;'; + $headers[] = 'use Joomla\Database\DatabaseInterface;'; + $headers[] = 'use Joomla\Database\ParameterType;'; + $headers[] = 'use Joomla\Registry\Registry;'; + break; + + case 'site.view': + case 'site.views': + $headers[] = 'use Joomla\CMS\Router\Route;'; + $headers[] = 'use Joomla\CMS\Layout\LayoutHelper;'; + $headers[] = 'use Joomla\CMS\HTML\HTMLHelper as Html;'; + break; + + case 'form.custom.field': + $headers[] = 'use Joomla\CMS\HTML\HTMLHelper as Html;'; + $headers[] = 'use Joomla\CMS\Component\ComponentHelper;'; + $headers[] = 'use Joomla\CMS\Form\Field\###FORM_EXTENDS###;'; + break; + + default: + break; + } + + $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;'; + } + } +} + diff --git a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/JoomlaFive/History.php b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/JoomlaFive/History.php new file mode 100644 index 000000000..1a0c2f846 --- /dev/null +++ b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/JoomlaFive/History.php @@ -0,0 +1,211 @@ + + * @git 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\JoomlaFive; + + +use Joomla\CMS\Factory; +use VDM\Joomla\Componentbuilder\Compiler\Factory as Compiler; +use VDM\Joomla\Utilities\JsonHelper; +use VDM\Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Componentbuilder\Compiler\Config; +use VDM\Joomla\Componentbuilder\Compiler\Interfaces\HistoryInterface; + + +/** + * Compiler History + * + * @since 3.2.0 + */ +final class History implements HistoryInterface +{ + /** + * History Item Object + * + * @var object|null + * @since 3.2.0 + */ + protected ?object $tmp; + + /** + * Compiler Config + * + * @var Config + * @since 3.2.0 + */ + protected Config $config; + + /** + * Database object to query local DB + * + * @since 3.2.0 + */ + protected $db; + + /** + * Constructor + * + * @param Config|null $config The compiler config object. + * + * @since 3.2.0 + */ + public function __construct(?Config $config = null) + { + $this->config = $config ?: Compiler::_('Config'); + $this->db = Factory::getDbo(); + } + + /** + * Get Item History object + * + * @param string $type The type of item + * @param int $id The item ID + * + * @return ?object The history + * @since 3.2.0 + */ + public function get(string $type, int $id): ?object + { + // quick class object to store old history object + $this->tmp = null; + // Create a new query object. + $query = $this->db->getQuery(true); + + $query->select('h.*'); + $query->from('#__history AS h'); + $query->where( + $this->db->quoteName('h.item_id') . ' = ' . $this->db->quote('com_componentbuilder.' . $type . '.' . (int) $id) + ); + $query->order('h.save_date DESC'); + $this->db->setQuery($query, 0, 1); + $this->db->execute(); + if ($this->db->getNumRows()) + { + // new version of this item found + // so we need to mark it as the last compiled version + $newActive = $this->db->loadObject(); + // set the new version watch + $this->set($newActive, 1); + } + // Get last compiled verion + $query = $this->db->getQuery(true); + + $query->select('h.*'); + $query->from('#__history AS h'); + $query->where( + $this->db->quoteName('h.item_id') . ' = ' . $this->db->quote('com_componentbuilder.' . $type . '.' . (int) $id) + ); + $query->where('h.keep_forever = 1'); + $query->where('h.version_note LIKE ' . $this->db->quote('%component%')); + // make sure it does not return the active version + if (isset($newActive) && isset($newActive->version_id)) + { + $query->where('h.version_id != ' . (int) $newActive->version_id); + } + $query->order('h.save_date DESC'); + $this->db->setQuery($query); + $this->db->execute(); + if ($this->db->getNumRows()) + { + // the old active version was found + // so we may need to do an SQL update + // and unmark the old compiled version + $oldActives = $this->db->loadObjectList(); + foreach ($oldActives as $oldActive) + { + // remove old version watch + $this->set($oldActive, 0); + } + } + + // return the last used history record or null. + return $this->tmp; + } + + /** + * Set Item History Watch + * + * @param Object $object The history object + * @param int $action The action to take + * 0 = remove watch + * 1 = add watch + * + * @return bool + * @since 3.2.0 + */ + protected function set(object $object, int $action): bool + { + // check the note + if (JsonHelper::check($object->version_note)) + { + $version_note = json_decode((string) $object->version_note, true); + } + else + { + $version_note = array('component' => []); + } + // set watch + switch ($action) + { + case 0: + // remove watch + if (isset($version_note['component']) + && ($key = array_search( + $this->config->component_id, $version_note['component'] + )) !== false) + { + // last version that was used to build/compile + $this->tmp = json_decode((string) $object->version_data); + // remove it from this component + unset($version_note['component'][$key]); + } + else + { + // since it was not found, no need to update anything + return true; + } + break; + case 1: + // add watch + if (!in_array($this->config->component_id, $version_note['component'])) + { + $version_note['component'][] = $this->config->component_id; + } + else + { + // since it is there already, no need to update anything + return true; + } + break; + } + // check if we need to still keep this locked + if (isset($version_note['component']) + && ArrayHelper::check($version_note['component'])) + { + // insure component ids are only added once per item + $version_note['component'] = array_unique( + $version_note['component'] + ); + // we may change this, little risky (but since JCB does not have history notes it should be okay for now) + $object->version_note = json_encode($version_note); + $object->keep_forever = '1'; + } + else + { + $object->version_note = ''; + $object->keep_forever = '0'; + } + + // run the update + return $this->db->updateObject('#__history', $object, 'version_id'); + } +} + diff --git a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/JoomlaFive/index.html b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/JoomlaFive/index.html new file mode 100644 index 000000000..fa6d84e80 --- /dev/null +++ b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/JoomlaFive/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/JoomlaFour/Event.php b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/JoomlaFour/Event.php index 38752f0a6..d15c3292d 100644 --- a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/JoomlaFour/Event.php +++ b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/JoomlaFour/Event.php @@ -23,7 +23,7 @@ use VDM\Joomla\Componentbuilder\Compiler\Interfaces\EventInterface; * * @since 3.2.0 */ -class Event implements EventInterface +final class Event implements EventInterface { /** * event plugin trigger switch @@ -63,7 +63,7 @@ class Event implements EventInterface } /** - * Trigger and event + * Trigger an event * * @param string $event The event to trigger * @param mixed $data The values to pass to the event/plugin diff --git a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/JoomlaFour/History.php b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/JoomlaFour/History.php index 7256866c9..04126729a 100644 --- a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/JoomlaFour/History.php +++ b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/JoomlaFour/History.php @@ -25,7 +25,7 @@ use VDM\Joomla\Componentbuilder\Compiler\Interfaces\HistoryInterface; * * @since 3.2.0 */ -class History implements HistoryInterface +final class History implements HistoryInterface { /** * History Item Object @@ -80,18 +80,9 @@ class History implements HistoryInterface $query = $this->db->getQuery(true); $query->select('h.*'); - $query->from('#__ucm_history AS h'); + $query->from('#__history AS h'); $query->where( - $this->db->quoteName('h.ucm_item_id') . ' = ' . (int) $id - ); - // Join over the content type for the type id - $query->join( - 'LEFT', '#__content_types AS ct ON ct.type_id = h.ucm_type_id' - ); - $query->where( - 'ct.type_alias = ' . $this->db->quote( - 'com_componentbuilder.' . $type - ) + $this->db->quoteName('h.item_id') . ' = ' . $this->db->quote('com_componentbuilder.' . $type . '.' . (int) $id) ); $query->order('h.save_date DESC'); $this->db->setQuery($query, 0, 1); @@ -108,9 +99,9 @@ class History implements HistoryInterface $query = $this->db->getQuery(true); $query->select('h.*'); - $query->from('#__ucm_history AS h'); + $query->from('#__history AS h'); $query->where( - $this->db->quoteName('h.ucm_item_id') . ' = ' . (int) $id + $this->db->quoteName('h.item_id') . ' = ' . $this->db->quote('com_componentbuilder.' . $type . '.' . (int) $id) ); $query->where('h.keep_forever = 1'); $query->where('h.version_note LIKE ' . $this->db->quote('%component%')); @@ -119,15 +110,6 @@ class History implements HistoryInterface { $query->where('h.version_id != ' . (int) $newActive->version_id); } - // Join over the content type for the type id - $query->join( - 'LEFT', '#__content_types AS ct ON ct.type_id = h.ucm_type_id' - ); - $query->where( - 'ct.type_alias = ' . $this->db->quote( - 'com_componentbuilder.' . $type - ) - ); $query->order('h.save_date DESC'); $this->db->setQuery($query); $this->db->execute(); @@ -223,8 +205,7 @@ class History implements HistoryInterface } // run the update - return $this->db->updateObject('#__ucm_history', $object, 'version_id'); - } - + return $this->db->updateObject('#__history', $object, 'version_id'); + } } diff --git a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/JoomlaThree/Event.php b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/JoomlaThree/Event.php index c1583f414..e376c4796 100644 --- a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/JoomlaThree/Event.php +++ b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/JoomlaThree/Event.php @@ -22,7 +22,7 @@ use VDM\Joomla\Componentbuilder\Compiler\Interfaces\EventInterface; * * @since 3.2.0 */ -class Event implements EventInterface +final class Event implements EventInterface { /** * event plugin trigger switch @@ -62,7 +62,7 @@ class Event implements EventInterface } /** - * Trigger and event + * Trigger an event * * @param string $event The event to trigger * @param mixed $data The values to pass to the event/plugin diff --git a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/JoomlaThree/History.php b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/JoomlaThree/History.php index 691297801..c94a42730 100644 --- a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/JoomlaThree/History.php +++ b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/JoomlaThree/History.php @@ -25,7 +25,7 @@ use VDM\Joomla\Componentbuilder\Compiler\Interfaces\HistoryInterface; * * @since 3.2.0 */ -class History implements HistoryInterface +final class History implements HistoryInterface { /** * History Item Object diff --git a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Model/Historycomponent.php b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Model/Historycomponent.php index 4d818fd32..37bdb9a03 100644 --- a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Model/Historycomponent.php +++ b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Model/Historycomponent.php @@ -142,7 +142,7 @@ class Historycomponent if ($old_component && ObjectHelper::check($old_component)) { $old_component_version = preg_replace( - '/[^0-9.]+/', '', (string) $old_component->component_version + '/^v/i', '', (string) $old_component->component_version ); if ($old_component_version != $this->config->component_version) { diff --git a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Model/JoomlaFive/Customtabs.php b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Model/JoomlaFive/Customtabs.php new file mode 100644 index 000000000..3a70beaa6 --- /dev/null +++ b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Model/JoomlaFive/Customtabs.php @@ -0,0 +1,240 @@ + + * @git 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\JoomlaFive; + + +use VDM\Joomla\Componentbuilder\Compiler\Config; +use VDM\Joomla\Componentbuilder\Compiler\Builder\CustomTabs as BuilderCustomTabs; +use VDM\Joomla\Componentbuilder\Compiler\Language; +use VDM\Joomla\Componentbuilder\Compiler\Placeholder; +use VDM\Joomla\Componentbuilder\Compiler\Customcode; +use VDM\Joomla\Utilities\JsonHelper; +use VDM\Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Utilities\StringHelper; +use VDM\Joomla\Componentbuilder\Compiler\Utilities\Indent; +use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Model\CustomtabsInterface; + + +/** + * Model Custom Tabs Class + * + * @since 3.2.0 + */ +final class Customtabs implements CustomtabsInterface +{ + /** + * The Config Class. + * + * @var Config + * @since 3.2.0 + */ + protected Config $config; + + /** + * The CustomTabs Class. + * + * @var BuilderCustomTabs + * @since 3.2.0 + */ + protected BuilderCustomTabs $buildercustomtabs; + + /** + * The Language Class. + * + * @var Language + * @since 3.2.0 + */ + protected Language $language; + + /** + * The Placeholder Class. + * + * @var Placeholder + * @since 3.2.0 + */ + protected Placeholder $placeholder; + + /** + * The Customcode Class. + * + * @var Customcode + * @since 3.2.0 + */ + protected Customcode $customcode; + + /** + * Constructor. + * + * @param Config $config The Config Class. + * @param BuilderCustomTabs $buildercustomtabs The CustomTabs Class. + * @param Language $language The Language Class. + * @param Placeholder $placeholder The Placeholder Class. + * @param Customcode $customcode The Customcode Class. + * + * @since 3.2.0 + */ + public function __construct(Config $config, BuilderCustomTabs $buildercustomtabs, Language $language, Placeholder $placeholder, Customcode $customcode) + { + $this->config = $config; + $this->buildercustomtabs = $buildercustomtabs; + $this->language = $language; + $this->placeholder = $placeholder; + $this->customcode = $customcode; + } + + /** + * Set custom tabs + * + * @param object $item The view data + * + * @return void + * @since 3.2.0 + */ + public function set(object &$item) + { + $item->customtabs = (isset($item->customtabs) + && JsonHelper::check($item->customtabs)) + ? json_decode((string) $item->customtabs, true) : null; + + if (ArrayHelper::check($item->customtabs)) + { + // get the name + $name = $item->name_single_code; + + // setup custom tabs to global data sets + $this->buildercustomtabs->set($name, + array_map( + function ($tab) use (&$name) { + + // set the view name + $tab['view'] = $name; + + // load the dynamic data + $tab['html'] = $this->placeholder->update_( + $this->customcode->update($tab['html']) + ); + + // set the tab name + $tab['name'] = (isset($tab['name']) + && StringHelper::check( + $tab['name'] + )) ? $tab['name'] : 'Tab'; + + // set lang + $tab['lang'] = $this->config->lang_prefix . '_' + . StringHelper::safe( + $tab['view'], 'U' + ) . '_' . StringHelper::safe( + $tab['name'], 'U' + ); + $this->language->set( + 'both', $tab['lang'], $tab['name'] + ); + + // set code name + $tab['code'] = StringHelper::safe( + $tab['name'] + ); + + // check if the permissions for the tab should be added + $_tab = ''; + if (isset($tab['permission']) + && $tab['permission'] == 1) + { + $_tab = Indent::_(1); + } + + // check if the php of the tab is set, if not load it now + if (strpos((string) $tab['html'], 'uitab.addTab') === false + && strpos((string) $tab['html'], 'uitab.endTab') + === false) + { + // add the tab + $tmp = PHP_EOL . $_tab . Indent::_(1) + . ""; + $tmp .= PHP_EOL . $_tab . Indent::_(2) + . '
'; + $tmp .= PHP_EOL . $_tab . Indent::_(3) + . '
'; + $tmp .= PHP_EOL . $_tab . Indent::_(4) . implode( + PHP_EOL . $_tab . Indent::_(4), + (array) explode(PHP_EOL, trim((string) $tab['html'])) + ); + $tmp .= PHP_EOL . $_tab . Indent::_(3) . '
'; + $tmp .= PHP_EOL . $_tab . Indent::_(2) . '
'; + $tmp .= PHP_EOL . $_tab . Indent::_(1) + . ""; + + // update html + $tab['html'] = $tmp; + } + else + { + $tab['html'] = PHP_EOL . $_tab . Indent::_(1) + . implode( + PHP_EOL . $_tab . Indent::_(1), + (array) explode(PHP_EOL, trim((string) $tab['html'])) + ); + } + + // add the permissions if needed + if (isset($tab['permission']) + && $tab['permission'] == 1) + { + $tmp = PHP_EOL . Indent::_(1) + . "canDo->get('" + . $tab['view'] . "." . $tab['code'] + . ".viewtab')) : ?>"; + $tmp .= $tab['html']; + $tmp .= PHP_EOL . Indent::_(1) . ""; + // update html + $tab['html'] = $tmp; + // set lang for permissions + $tab['lang_permission'] = $tab['lang'] + . '_TAB_PERMISSION'; + $tab['lang_permission_desc'] = $tab['lang'] + . '_TAB_PERMISSION_DESC'; + $tab['lang_permission_title'] + = $this->placeholder->get('Views') . ' View ' + . $tab['name'] . ' Tab'; + $this->language->set( + 'both', $tab['lang_permission'], + $tab['lang_permission_title'] + ); + $this->language->set( + 'both', $tab['lang_permission_desc'], + 'Allow the users in this group to view ' + . $tab['name'] . ' Tab of ' + . $this->placeholder->get('views') + ); + // set the sort key + $tab['sortKey'] + = StringHelper::safe( + $tab['lang_permission_title'] + ); + } + + // return tab + return $tab; + + }, array_values($item->customtabs) + ) + ); + } + + unset($item->customtabs); + } +} + diff --git a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Model/JoomlaFive/index.html b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Model/JoomlaFive/index.html new file mode 100644 index 000000000..fa6d84e80 --- /dev/null +++ b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Model/JoomlaFive/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Service/ArchitectureController.php b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Service/ArchitectureController.php index dbe542e52..b6c6820e2 100644 --- a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Service/ArchitectureController.php +++ b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Service/ArchitectureController.php @@ -15,9 +15,11 @@ namespace VDM\Joomla\Componentbuilder\Compiler\Service; use Joomla\DI\Container; use Joomla\DI\ServiceProviderInterface; use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Architecture\Controller\AllowAddInterface; +use VDM\Joomla\Componentbuilder\Compiler\Architecture\JoomlaFive\Controller\AllowAdd as J5ControllerAllowAdd; use VDM\Joomla\Componentbuilder\Compiler\Architecture\JoomlaFour\Controller\AllowAdd as J4ControllerAllowAdd; use VDM\Joomla\Componentbuilder\Compiler\Architecture\JoomlaThree\Controller\AllowAdd as J3ControllerAllowAdd; use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Architecture\Controller\AllowEditInterface; +use VDM\Joomla\Componentbuilder\Compiler\Architecture\JoomlaFive\Controller\AllowEdit as J5ControllerAllowEdit; use VDM\Joomla\Componentbuilder\Compiler\Architecture\JoomlaFour\Controller\AllowEdit as J4ControllerAllowEdit; use VDM\Joomla\Componentbuilder\Compiler\Architecture\JoomlaThree\Controller\AllowEdit as J3ControllerAllowEdit; @@ -50,6 +52,9 @@ class ArchitectureController implements ServiceProviderInterface $container->alias(AllowAddInterface::class, 'Architecture.Controller.AllowAdd') ->share('Architecture.Controller.AllowAdd', [$this, 'getAllowAdd'], true); + $container->alias(J5ControllerAllowAdd::class, 'Architecture.Controller.J5.AllowAdd') + ->share('Architecture.Controller.J5.AllowAdd', [$this, 'getJ5ControllerAllowAdd'], true); + $container->alias(J4ControllerAllowAdd::class, 'Architecture.Controller.J4.AllowAdd') ->share('Architecture.Controller.J4.AllowAdd', [$this, 'getJ4ControllerAllowAdd'], true); @@ -59,6 +64,9 @@ class ArchitectureController implements ServiceProviderInterface $container->alias(AllowEditInterface::class, 'Architecture.Controller.AllowEdit') ->share('Architecture.Controller.AllowEdit', [$this, 'getAllowEdit'], true); + $container->alias(J5ControllerAllowEdit::class, 'Architecture.Controller.J5.AllowEdit') + ->share('Architecture.Controller.J5.AllowEdit', [$this, 'getJ5ControllerAllowEdit'], true); + $container->alias(J4ControllerAllowEdit::class, 'Architecture.Controller.J4.AllowEdit') ->share('Architecture.Controller.J4.AllowEdit', [$this, 'getJ4ControllerAllowEdit'], true); @@ -84,6 +92,23 @@ class ArchitectureController implements ServiceProviderInterface return $container->get('Architecture.Controller.J' . $this->targetVersion . '.AllowAdd'); } + /** + * Get The AllowAdd Class. + * + * @param Container $container The DI container. + * + * @return J5ControllerAllowAdd + * @since 3.2.0 + */ + public function getJ5ControllerAllowAdd(Container $container): J5ControllerAllowAdd + { + return new J5ControllerAllowAdd( + $container->get('Config'), + $container->get('Compiler.Creator.Permission'), + $container->get('Customcode.Dispenser') + ); + } + /** * Get The AllowAdd Class. * @@ -136,6 +161,25 @@ class ArchitectureController implements ServiceProviderInterface return $container->get('Architecture.Controller.J' . $this->targetVersion . '.AllowEdit'); } + /** + * Get The AllowEdit Class. + * + * @param Container $container The DI container. + * + * @return J5ControllerAllowEdit + * @since 3.2.0 + */ + public function getJ5ControllerAllowEdit(Container $container): J5ControllerAllowEdit + { + return new J5ControllerAllowEdit( + $container->get('Config'), + $container->get('Compiler.Creator.Permission'), + $container->get('Customcode.Dispenser'), + $container->get('Compiler.Builder.Category'), + $container->get('Compiler.Builder.Category.Other.Name') + ); + } + /** * Get The AllowEdit Class. * diff --git a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Service/ArchitectureModel.php b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Service/ArchitectureModel.php index 5e87d154d..b3e6b762d 100644 --- a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Service/ArchitectureModel.php +++ b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Service/ArchitectureModel.php @@ -15,9 +15,11 @@ namespace VDM\Joomla\Componentbuilder\Compiler\Service; use Joomla\DI\Container; use Joomla\DI\ServiceProviderInterface; use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Architecture\Model\CanDeleteInterface; +use VDM\Joomla\Componentbuilder\Compiler\Architecture\JoomlaFive\Model\CanDelete as J5ModelCanDelete; use VDM\Joomla\Componentbuilder\Compiler\Architecture\JoomlaFour\Model\CanDelete as J4ModelCanDelete; use VDM\Joomla\Componentbuilder\Compiler\Architecture\JoomlaThree\Model\CanDelete as J3ModelCanDelete; use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Architecture\Model\CanEditStateInterface; +use VDM\Joomla\Componentbuilder\Compiler\Architecture\JoomlaFive\Model\CanEditState as J5ModelCanEditState; use VDM\Joomla\Componentbuilder\Compiler\Architecture\JoomlaFour\Model\CanEditState as J4ModelCanEditState; use VDM\Joomla\Componentbuilder\Compiler\Architecture\JoomlaThree\Model\CanEditState as J3ModelCanEditState; @@ -53,6 +55,9 @@ class ArchitectureModel implements ServiceProviderInterface $container->alias(J4ModelCanDelete::class, 'Architecture.Model.J4.CanDelete') ->share('Architecture.Model.J4.CanDelete', [$this, 'getJ4ModelCanDelete'], true); + $container->alias(J5ModelCanDelete::class, 'Architecture.Model.J5.CanDelete') + ->share('Architecture.Model.J5.CanDelete', [$this, 'getJ5ModelCanDelete'], true); + $container->alias(CanDeleteInterface::class, 'Architecture.Model.CanDelete') ->share('Architecture.Model.CanDelete', [$this, 'getModelCanDelete'], true); @@ -62,6 +67,9 @@ class ArchitectureModel implements ServiceProviderInterface $container->alias(J4ModelCanEditState::class, 'Architecture.Model.J4.CanEditState') ->share('Architecture.Model.J4.CanEditState', [$this, 'getJ4ModelCanEditState'], true); + $container->alias(J5ModelCanEditState::class, 'Architecture.Model.J5.CanEditState') + ->share('Architecture.Model.J5.CanEditState', [$this, 'getJ5ModelCanEditState'], true); + $container->alias(CanEditStateInterface::class, 'Architecture.Model.CanEditState') ->share('Architecture.Model.CanEditState', [$this, 'getModelCanEditState'], true); } @@ -84,6 +92,22 @@ class ArchitectureModel implements ServiceProviderInterface return $container->get('Architecture.Model.J' . $this->targetVersion . '.CanDelete'); } + /** + * Get The Model CanDelete Class. + * + * @param Container $container The DI container. + * + * @return J5ModelCanDelete + * @since 3.2.0 + */ + public function getJ5ModelCanDelete(Container $container): J5ModelCanDelete + { + return new J5ModelCanDelete( + $container->get('Config'), + $container->get('Compiler.Creator.Permission') + ); + } + /** * Get The Model CanDelete Class. * @@ -134,6 +158,22 @@ class ArchitectureModel implements ServiceProviderInterface return $container->get('Architecture.Model.J' . $this->targetVersion . '.CanEditState'); } + /** + * Get The Model Can Edit State Class. + * + * @param Container $container The DI container. + * + * @return J5ModelCanEditState + * @since 3.2.0 + */ + public function getJ5ModelCanEditState(Container $container): J5ModelCanEditState + { + return new J5ModelCanEditState( + $container->get('Config'), + $container->get('Compiler.Creator.Permission') + ); + } + /** * Get The Model Can Edit State Class. * diff --git a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Service/Component.php b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Service/Component.php index 0d8c7fcd8..093d0b655 100644 --- a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Service/Component.php +++ b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Service/Component.php @@ -17,6 +17,7 @@ use Joomla\DI\ServiceProviderInterface; use VDM\Joomla\Componentbuilder\Compiler\Component as CompilerComponent; use VDM\Joomla\Componentbuilder\Compiler\Component\JoomlaThree\Settings as J3Settings; use VDM\Joomla\Componentbuilder\Compiler\Component\JoomlaFour\Settings as J4Settings; +use VDM\Joomla\Componentbuilder\Compiler\Component\JoomlaFive\Settings as J5Settings; use VDM\Joomla\Componentbuilder\Compiler\Component\Dashboard; use VDM\Joomla\Componentbuilder\Compiler\Component\Placeholder; use VDM\Joomla\Componentbuilder\Compiler\Component\Data; @@ -60,6 +61,9 @@ class Component implements ServiceProviderInterface $container->alias(J4Settings::class, 'Component.J4.Settings') ->share('Component.J4.Settings', [$this, 'getJ4Settings'], true); + $container->alias(J5Settings::class, 'Component.J5.Settings') + ->share('Component.J5.Settings', [$this, 'getJ5Settings'], true); + $container->alias(Dashboard::class, 'Component.Dashboard') ->share('Component.Dashboard', [$this, 'getDashboard'], true); @@ -141,6 +145,28 @@ class Component implements ServiceProviderInterface ); } + /** + * Get The Settings Class. + * + * @param Container $container The DI container. + * + * @return J5Settings + * @since 3.2.0 + */ + public function getJ5Settings(Container $container): J5Settings + { + return new J5Settings( + $container->get('Config'), + $container->get('Registry'), + $container->get('Event'), + $container->get('Placeholder'), + $container->get('Component'), + $container->get('Utilities.Paths'), + $container->get('Utilities.Dynamicpath'), + $container->get('Utilities.Pathfix') + ); + } + /** * Get The Dashboard Class. * diff --git a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Service/Event.php b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Service/Event.php index 156a2937f..bc0c7edab 100644 --- a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Service/Event.php +++ b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Service/Event.php @@ -18,6 +18,7 @@ use Joomla\CMS\Version; use VDM\Joomla\Componentbuilder\Compiler\Interfaces\EventInterface; use VDM\Joomla\Componentbuilder\Compiler\JoomlaThree\Event as J3Event; use VDM\Joomla\Componentbuilder\Compiler\JoomlaFour\Event as J4Event; +use VDM\Joomla\Componentbuilder\Compiler\JoomlaFive\Event as J5Event; /** @@ -51,6 +52,9 @@ class Event implements ServiceProviderInterface $container->alias(J4Event::class, 'J4.Event') ->share('J4.Event', [$this, 'getJ4Event'], true); + $container->alias(J5Event::class, 'J5.Event') + ->share('J5.Event', [$this, 'getJ5Event'], true); + $container->alias(EventInterface::class, 'Event') ->share('Event', [$this, 'getEvent'], true); } @@ -97,6 +101,19 @@ class Event implements ServiceProviderInterface public function getJ4Event(Container $container): J4Event { return new J4Event(); + } + + /** + * Get the Joomla 5 Event + * + * @param Container $container The DI container. + * + * @return J5Event + * @since 3.2.0 + */ + public function getJ5Event(Container $container): J5Event + { + return new J5Event(); } } diff --git a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Service/Extension.php b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Service/Extension.php index 4eadc98af..1c2c5e791 100644 --- a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Service/Extension.php +++ b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Service/Extension.php @@ -17,6 +17,7 @@ use Joomla\DI\ServiceProviderInterface; use VDM\Joomla\Componentbuilder\Compiler\Interfaces\GetScriptInterface; use VDM\Joomla\Componentbuilder\Compiler\Extension\JoomlaThree\InstallScript as J3InstallScript; use VDM\Joomla\Componentbuilder\Compiler\Extension\JoomlaFour\InstallScript as J4InstallScript; +use VDM\Joomla\Componentbuilder\Compiler\Extension\JoomlaFive\InstallScript as J5InstallScript; /** @@ -52,6 +53,9 @@ class Extension implements ServiceProviderInterface $container->alias(J4InstallScript::class, 'J4.Extension.InstallScript') ->share('J4.Extension.InstallScript', [$this, 'getJ4ExtensionInstallScript'], true); + + $container->alias(J5InstallScript::class, 'J5.Extension.InstallScript') + ->share('J5.Extension.InstallScript', [$this, 'getJ5ExtensionInstallScript'], true); } /** @@ -80,6 +84,19 @@ class Extension implements ServiceProviderInterface return new J4InstallScript(); } + /** + * Get the Joomla 5 Extension Install Script + * + * @param Container $container The DI container. + * + * @return J5InstallScript + * @since 3.2.0 + */ + public function getJ5ExtensionInstallScript(Container $container): J5InstallScript + { + return new J5InstallScript(); + } + /** * Get the Joomla Extension Install Script * diff --git a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Service/Field.php b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Service/Field.php index b2b8a79c6..01292db60 100644 --- a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Service/Field.php +++ b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Service/Field.php @@ -27,10 +27,13 @@ use VDM\Joomla\Componentbuilder\Compiler\Field\Customcode; use VDM\Joomla\Componentbuilder\Compiler\Field\DatabaseName; use VDM\Joomla\Componentbuilder\Compiler\Field\JoomlaThree\CoreRule as J3CoreRule; use VDM\Joomla\Componentbuilder\Compiler\Field\JoomlaFour\CoreRule as J4CoreRule; +use VDM\Joomla\Componentbuilder\Compiler\Field\JoomlaFive\CoreRule as J5CoreRule; use VDM\Joomla\Componentbuilder\Compiler\Field\JoomlaThree\CoreField as J3CoreField; use VDM\Joomla\Componentbuilder\Compiler\Field\JoomlaFour\CoreField as J4CoreField; +use VDM\Joomla\Componentbuilder\Compiler\Field\JoomlaFive\CoreField as J5CoreField; use VDM\Joomla\Componentbuilder\Compiler\Field\JoomlaThree\InputButton as J3InputButton; use VDM\Joomla\Componentbuilder\Compiler\Field\JoomlaFour\InputButton as J4InputButton; +use VDM\Joomla\Componentbuilder\Compiler\Field\JoomlaFive\InputButton as J5InputButton; use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Field\CoreFieldInterface as CoreField; use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Field\CoreRuleInterface as CoreRule; use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Field\InputButtonInterface as InputButton; @@ -105,18 +108,27 @@ class Field implements ServiceProviderInterface $container->alias(J4CoreRule::class, 'J4.Field.Core.Rule') ->share('J4.Field.Core.Rule', [$this, 'getJ4CoreRule'], true); + $container->alias(J5CoreRule::class, 'J5.Field.Core.Rule') + ->share('J5.Field.Core.Rule', [$this, 'getJ5CoreRule'], true); + $container->alias(J3CoreField::class, 'J3.Field.Core.Field') ->share('J3.Field.Core.Field', [$this, 'getJ3CoreField'], true); $container->alias(J4CoreField::class, 'J4.Field.Core.Field') ->share('J4.Field.Core.Field', [$this, 'getJ4CoreField'], true); + $container->alias(J5CoreField::class, 'J5.Field.Core.Field') + ->share('J5.Field.Core.Field', [$this, 'getJ5CoreField'], true); + $container->alias(J3InputButton::class, 'J3.Field.Input.Button') ->share('J3.Field.Input.Button', [$this, 'getJ3InputButton'], true); $container->alias(J4InputButton::class, 'J4.Field.Input.Button') ->share('J4.Field.Input.Button', [$this, 'getJ4InputButton'], true); + $container->alias(J5InputButton::class, 'J5.Field.Input.Button') + ->share('J5.Field.Input.Button', [$this, 'getJ5InputButton'], true); + $container->alias(CoreField::class, 'Field.Core.Field') ->share('Field.Core.Field', [$this, 'getCoreField'], true); @@ -322,6 +334,19 @@ class Field implements ServiceProviderInterface return new J4CoreRule(); } + /** + * Get The CoreRule Class. + * + * @param Container $container The DI container. + * + * @return J5CoreRule + * @since 3.2.0 + */ + public function getJ5CoreRule(Container $container): J5CoreRule + { + return new J5CoreRule(); + } + /** * Get The CoreField Class. * @@ -348,6 +373,19 @@ class Field implements ServiceProviderInterface return new J4CoreField(); } + /** + * Get The CoreField Class. + * + * @param Container $container The DI container. + * + * @return J5CoreField + * @since 3.2.0 + */ + public function getJ5CoreField(Container $container): J5CoreField + { + return new J5CoreField(); + } + /** * Get The J3InputButton Class. * @@ -382,6 +420,23 @@ class Field implements ServiceProviderInterface ); } + /** + * Get The J5InputButton Class. + * + * @param Container $container The DI container. + * + * @return J5InputButton + * @since 3.2.0 + */ + public function getJ5InputButton(Container $container): J5InputButton + { + return new J5InputButton( + $container->get('Config'), + $container->get('Placeholder'), + $container->get('Compiler.Creator.Permission') + ); + } + /** * Get The CoreFieldInterface Class. * diff --git a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Service/Header.php b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Service/Header.php index d8e3f45dd..6f3ee5c94 100644 --- a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Service/Header.php +++ b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Service/Header.php @@ -17,6 +17,7 @@ use Joomla\DI\ServiceProviderInterface; use VDM\Joomla\Componentbuilder\Compiler\Interfaces\HeaderInterface; use VDM\Joomla\Componentbuilder\Compiler\JoomlaThree\Header as J3Header; use VDM\Joomla\Componentbuilder\Compiler\JoomlaFour\Header as J4Header; +use VDM\Joomla\Componentbuilder\Compiler\JoomlaFive\Header as J5Header; /** @@ -50,6 +51,9 @@ class Header implements ServiceProviderInterface $container->alias(J4Header::class, 'J4.Header') ->share('J4.Header', [$this, 'getJ4Header'], true); + $container->alias(J5Header::class, 'J5.Header') + ->share('J5.Header', [$this, 'getJ5Header'], true); + $container->alias(HeaderInterface::class, 'Header') ->share('Header', [$this, 'getHeader'], true); } @@ -118,6 +122,30 @@ class Header implements ServiceProviderInterface $container->get('Compiler.Builder.Filter'), $container->get('Compiler.Builder.Tags') ); + } + + /** + * Get The Header Class. + * + * @param Container $container The DI container. + * + * @return J5Header + * @since 3.2.0 + */ + public function getJ5Header(Container $container): J5Header + { + return new J5Header( + $container->get('Config'), + $container->get('Event'), + $container->get('Placeholder'), + $container->get('Language'), + $container->get('Compiler.Builder.Uikit.Comp'), + $container->get('Compiler.Builder.Admin.Filter.Type'), + $container->get('Compiler.Builder.Category'), + $container->get('Compiler.Builder.Access.Switch.List'), + $container->get('Compiler.Builder.Filter'), + $container->get('Compiler.Builder.Tags') + ); } } diff --git a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Service/History.php b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Service/History.php index 031d3f730..9beb59d9c 100644 --- a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Service/History.php +++ b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Service/History.php @@ -18,6 +18,7 @@ use Joomla\CMS\Version; use VDM\Joomla\Componentbuilder\Compiler\Interfaces\HistoryInterface; use VDM\Joomla\Componentbuilder\Compiler\JoomlaThree\History as J3History; use VDM\Joomla\Componentbuilder\Compiler\JoomlaFour\History as J4History; +use VDM\Joomla\Componentbuilder\Compiler\JoomlaFive\History as J5History; /** @@ -51,6 +52,9 @@ class History implements ServiceProviderInterface $container->alias(J4History::class, 'J4.History') ->share('J4.History', [$this, 'getJ4History'], true); + $container->alias(J5History::class, 'J5.History') + ->share('J5.History', [$this, 'getJ5History'], true); + $container->alias(HistoryInterface::class, 'History') ->share('History', [$this, 'getHistory'], true); } @@ -101,6 +105,21 @@ class History implements ServiceProviderInterface return new J4History( $container->get('Config') ); + } + + /** + * Get the Joomla 5 History + * + * @param Container $container The DI container. + * + * @return J5History + * @since 3.2.0 + */ + public function getJ5History(Container $container): J5History + { + return new J5History( + $container->get('Config') + ); } } diff --git a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Service/Model.php b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Service/Model.php index 510fd6147..833398249 100644 --- a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Service/Model.php +++ b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Service/Model.php @@ -47,6 +47,7 @@ use VDM\Joomla\Componentbuilder\Compiler\Model\Tabs; use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Model\CustomtabsInterface as Customtabs; use VDM\Joomla\Componentbuilder\Compiler\Model\JoomlaThree\Customtabs as CustomtabsJ3; use VDM\Joomla\Componentbuilder\Compiler\Model\JoomlaFour\Customtabs as CustomtabsJ4; +use VDM\Joomla\Componentbuilder\Compiler\Model\JoomlaFive\Customtabs as CustomtabsJ5; use VDM\Joomla\Componentbuilder\Compiler\Model\Adminviews; use VDM\Joomla\Componentbuilder\Compiler\Model\Sqltweaking; use VDM\Joomla\Componentbuilder\Compiler\Model\Sqldump; @@ -182,6 +183,9 @@ class Model implements ServiceProviderInterface $container->alias(CustomtabsJ4::class, 'Model.J4.Customtabs') ->share('Model.J4.Customtabs', [$this, 'getCustomtabsJ4'], true); + $container->alias(CustomtabsJ5::class, 'Model.J5.Customtabs') + ->share('Model.J5.Customtabs', [$this, 'getCustomtabsJ5'], true); + $container->alias(Adminviews::class, 'Model.Adminviews') ->share('Model.Adminviews', [$this, 'getAdminviews'], true); @@ -758,6 +762,25 @@ class Model implements ServiceProviderInterface ); } + /** + * Get The CustomtabsJ5 Class. + * + * @param Container $container The DI container. + * + * @return CustomtabsJ5 + * @since 3.2.0 + */ + public function getCustomtabsJ5(Container $container): CustomtabsJ5 + { + return new CustomtabsJ5( + $container->get('Config'), + $container->get('Compiler.Builder.Custom.Tabs'), + $container->get('Language'), + $container->get('Placeholder'), + $container->get('Customcode') + ); + } + /** * Get The Adminviews Class. * diff --git a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Table.php b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Table.php index 76dee138b..23626f62e 100644 --- a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Table.php +++ b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Table.php @@ -67,23 +67,14 @@ class Table extends BaseTable implements Tableinterface 'store' => NULL, 'tab_name' => 'Details', ], - 'debug_linenr' => [ - 'name' => 'debug_linenr', - 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_DEBUG_LINENR_LABEL', - 'type' => 'radio', - 'title' => false, - 'list' => 'joomla_components', - 'store' => NULL, - 'tab_name' => 'Details', - ], - 'php_site_event' => [ - 'name' => 'php_site_event', - 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_SITE_EVENT_LABEL', - 'type' => 'editor', + 'buildcompsql' => [ + 'name' => 'buildcompsql', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_BUILDCOMPSQL_LABEL', + 'type' => 'textarea', 'title' => false, 'list' => 'joomla_components', 'store' => 'base64', - 'tab_name' => 'Libs & Helpers', + 'tab_name' => 'Dynamic Build (beta)', ], 'translation_tool' => [ 'name' => 'translation_tool', @@ -94,15 +85,6 @@ class Table extends BaseTable implements Tableinterface 'store' => NULL, 'tab_name' => 'Dynamic Integration', ], - 'buildcompsql' => [ - 'name' => 'buildcompsql', - 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_BUILDCOMPSQL_LABEL', - 'type' => 'textarea', - 'title' => false, - 'list' => 'joomla_components', - 'store' => 'base64', - 'tab_name' => 'Dynamic Build (beta)', - ], 'add_sales_server' => [ 'name' => 'add_sales_server', 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_SALES_SERVER_LABEL', @@ -112,18 +94,18 @@ class Table extends BaseTable implements Tableinterface 'store' => NULL, 'tab_name' => 'Dynamic Integration', ], - 'php_preflight_install' => [ - 'name' => 'php_preflight_install', - 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_PREFLIGHT_INSTALL_LABEL', + 'php_method_uninstall' => [ + 'name' => 'php_method_uninstall', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_METHOD_UNINSTALL_LABEL', 'type' => 'editor', 'title' => false, 'list' => 'joomla_components', 'store' => 'base64', 'tab_name' => 'Dash & Install', ], - 'php_method_uninstall' => [ - 'name' => 'php_method_uninstall', - 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_METHOD_UNINSTALL_LABEL', + 'php_preflight_install' => [ + 'name' => 'php_preflight_install', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_PREFLIGHT_INSTALL_LABEL', 'type' => 'editor', 'title' => false, 'list' => 'joomla_components', @@ -166,6 +148,24 @@ class Table extends BaseTable implements Tableinterface 'store' => NULL, 'tab_name' => 'Details', ], + 'debug_linenr' => [ + 'name' => 'debug_linenr', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_DEBUG_LINENR_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'joomla_components', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'php_site_event' => [ + 'name' => 'php_site_event', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_SITE_EVENT_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'joomla_components', + 'store' => 'base64', + 'tab_name' => 'Libs & Helpers', + ], 'description' => [ 'name' => 'description', 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_DESCRIPTION_LABEL', @@ -175,6 +175,15 @@ class Table extends BaseTable implements Tableinterface 'store' => NULL, 'tab_name' => 'Details', ], + 'author' => [ + 'name' => 'author', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_AUTHOR_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'joomla_components', + 'store' => NULL, + 'tab_name' => 'Details', + ], 'php_postflight_install' => [ 'name' => 'php_postflight_install', 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_POSTFLIGHT_INSTALL_LABEL', @@ -184,9 +193,9 @@ class Table extends BaseTable implements Tableinterface 'store' => 'base64', 'tab_name' => 'Dash & Install', ], - 'author' => [ - 'name' => 'author', - 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_AUTHOR_LABEL', + 'email' => [ + 'name' => 'email', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_EMAIL_LABEL', 'type' => 'text', 'title' => false, 'list' => 'joomla_components', @@ -202,19 +211,19 @@ class Table extends BaseTable implements Tableinterface 'store' => 'base64', 'tab_name' => 'MySQL', ], - 'email' => [ - 'name' => 'email', - 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_EMAIL_LABEL', - 'type' => 'text', + 'website' => [ + 'name' => 'website', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_WEBSITE_LABEL', + 'type' => 'url', 'title' => false, 'list' => 'joomla_components', 'store' => NULL, 'tab_name' => 'Details', ], - 'website' => [ - 'name' => 'website', - 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_WEBSITE_LABEL', - 'type' => 'url', + 'add_license' => [ + 'name' => 'add_license', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_LICENSE_LABEL', + 'type' => 'radio', 'title' => false, 'list' => 'joomla_components', 'store' => NULL, @@ -256,10 +265,10 @@ class Table extends BaseTable implements Tableinterface 'store' => 'base64', 'tab_name' => 'Libs & Helpers', ], - 'add_license' => [ - 'name' => 'add_license', - 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_LICENSE_LABEL', - 'type' => 'radio', + 'license_type' => [ + 'name' => 'license_type', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_LICENSE_TYPE_LABEL', + 'type' => 'list', 'title' => false, 'list' => 'joomla_components', 'store' => NULL, @@ -283,15 +292,6 @@ class Table extends BaseTable implements Tableinterface 'store' => 'base64', 'tab_name' => 'Libs & Helpers', ], - 'license_type' => [ - 'name' => 'license_type', - 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_LICENSE_TYPE_LABEL', - 'type' => 'list', - 'title' => false, - 'list' => 'joomla_components', - 'store' => NULL, - 'tab_name' => 'Details', - ], 'php_helper_site' => [ 'name' => 'php_helper_site', 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_HELPER_SITE_LABEL', @@ -301,15 +301,6 @@ class Table extends BaseTable implements Tableinterface 'store' => 'base64', 'tab_name' => 'Libs & Helpers', ], - 'javascript' => [ - 'name' => 'javascript', - 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_JAVASCRIPT_LABEL', - 'type' => 'editor', - 'title' => false, - 'list' => 'joomla_components', - 'store' => 'base64', - 'tab_name' => 'Libs & Helpers', - ], 'whmcs_key' => [ 'name' => 'whmcs_key', 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_WHMCS_KEY_LABEL', @@ -319,9 +310,9 @@ class Table extends BaseTable implements Tableinterface 'store' => 'basic_encryption', 'tab_name' => 'Details', ], - 'css_site' => [ - 'name' => 'css_site', - 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_CSS_SITE_LABEL', + 'javascript' => [ + 'name' => 'javascript', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_JAVASCRIPT_LABEL', 'type' => 'editor', 'title' => false, 'list' => 'joomla_components', @@ -337,6 +328,15 @@ class Table extends BaseTable implements Tableinterface 'store' => NULL, 'tab_name' => 'Details', ], + 'css_site' => [ + 'name' => 'css_site', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_CSS_SITE_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'joomla_components', + 'store' => 'base64', + 'tab_name' => 'Libs & Helpers', + ], 'whmcs_buy_link' => [ 'name' => 'whmcs_buy_link', 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_WHMCS_BUY_LINK_LABEL', @@ -346,15 +346,6 @@ class Table extends BaseTable implements Tableinterface 'store' => NULL, 'tab_name' => 'Details', ], - 'php_preflight_update' => [ - 'name' => 'php_preflight_update', - 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_PREFLIGHT_UPDATE_LABEL', - 'type' => 'editor', - 'title' => false, - 'list' => 'joomla_components', - 'store' => 'base64', - 'tab_name' => 'Dash & Install', - ], 'license' => [ 'name' => 'license', 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_LICENSE_LABEL', @@ -364,9 +355,9 @@ class Table extends BaseTable implements Tableinterface 'store' => NULL, 'tab_name' => 'Details', ], - 'php_postflight_update' => [ - 'name' => 'php_postflight_update', - 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_POSTFLIGHT_UPDATE_LABEL', + 'php_preflight_update' => [ + 'name' => 'php_preflight_update', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_PREFLIGHT_UPDATE_LABEL', 'type' => 'editor', 'title' => false, 'list' => 'joomla_components', @@ -382,6 +373,24 @@ class Table extends BaseTable implements Tableinterface 'store' => NULL, 'tab_name' => 'Details', ], + 'php_postflight_update' => [ + 'name' => 'php_postflight_update', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_POSTFLIGHT_UPDATE_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'joomla_components', + 'store' => 'base64', + 'tab_name' => 'Dash & Install', + ], + 'image' => [ + 'name' => 'image', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_IMAGE_LABEL', + 'type' => 'media', + 'title' => false, + 'list' => 'joomla_components', + 'store' => NULL, + 'tab_name' => 'Details', + ], 'sql' => [ 'name' => 'sql', 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_SQL_LABEL', @@ -391,10 +400,10 @@ class Table extends BaseTable implements Tableinterface 'store' => 'base64', 'tab_name' => 'MySQL', ], - 'image' => [ - 'name' => 'image', - 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_IMAGE_LABEL', - 'type' => 'media', + 'copyright' => [ + 'name' => 'copyright', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_COPYRIGHT_LABEL', + 'type' => 'textarea', 'title' => false, 'list' => 'joomla_components', 'store' => NULL, @@ -409,10 +418,10 @@ class Table extends BaseTable implements Tableinterface 'store' => NULL, 'tab_name' => 'Readme', ], - 'copyright' => [ - 'name' => 'copyright', - 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_COPYRIGHT_LABEL', - 'type' => 'textarea', + 'preferred_joomla_version' => [ + 'name' => 'preferred_joomla_version', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PREFERRED_JOOMLA_VERSION_LABEL', + 'type' => 'number', 'title' => false, 'list' => 'joomla_components', 'store' => NULL, diff --git a/script.php b/script.php index 4e279585b..1e5f01245 100644 --- a/script.php +++ b/script.php @@ -6266,9 +6266,9 @@ class Com_ComponentbuilderInstallerScript $joomla_component->type_title = 'Componentbuilder Joomla_component'; $joomla_component->type_alias = 'com_componentbuilder.joomla_component'; $joomla_component->table = '{"special": {"dbtable": "#__componentbuilder_joomla_component","key": "id","type": "Joomla_component","prefix": "componentbuilderTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; - $joomla_component->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "system_name","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "php_site_event","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "metadata","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "metakey","core_metadesc": "metadesc","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"system_name":"system_name","name_code":"name_code","short_description":"short_description","companyname":"companyname","debug_linenr":"debug_linenr","php_site_event":"php_site_event","translation_tool":"translation_tool","buildcompsql":"buildcompsql","add_sales_server":"add_sales_server","php_preflight_install":"php_preflight_install","php_method_uninstall":"php_method_uninstall","css_admin":"css_admin","mvc_versiondate":"mvc_versiondate","remove_line_breaks":"remove_line_breaks","add_placeholders":"add_placeholders","description":"description","php_postflight_install":"php_postflight_install","author":"author","sql_uninstall":"sql_uninstall","email":"email","website":"website","backup_folder_path":"backup_folder_path","php_helper_both":"php_helper_both","crowdin_username":"crowdin_username","php_admin_event":"php_admin_event","add_license":"add_license","component_version":"component_version","php_helper_admin":"php_helper_admin","license_type":"license_type","php_helper_site":"php_helper_site","javascript":"javascript","whmcs_key":"whmcs_key","css_site":"css_site","whmcs_url":"whmcs_url","whmcs_buy_link":"whmcs_buy_link","php_preflight_update":"php_preflight_update","license":"license","php_postflight_update":"php_postflight_update","bom":"bom","sql":"sql","image":"image","addreadme":"addreadme","copyright":"copyright","update_server_url":"update_server_url","add_powers":"add_powers","add_backup_folder_path":"add_backup_folder_path","crowdin_project_identifier":"crowdin_project_identifier","add_php_helper_both":"add_php_helper_both","add_php_helper_admin":"add_php_helper_admin","add_admin_event":"add_admin_event","add_php_helper_site":"add_php_helper_site","add_site_event":"add_site_event","add_namespace_prefix":"add_namespace_prefix","add_javascript":"add_javascript","namespace_prefix":"namespace_prefix","add_css_admin":"add_css_admin","add_css_site":"add_css_site","add_menu_prefix":"add_menu_prefix","dashboard_type":"dashboard_type","menu_prefix":"menu_prefix","dashboard":"dashboard","add_php_preflight_install":"add_php_preflight_install","add_php_preflight_update":"add_php_preflight_update","toignore":"toignore","add_php_postflight_install":"add_php_postflight_install","add_php_postflight_update":"add_php_postflight_update","add_php_method_uninstall":"add_php_method_uninstall","export_key":"export_key","add_sql":"add_sql","joomla_source_link":"joomla_source_link","add_sql_uninstall":"add_sql_uninstall","export_buy_link":"export_buy_link","assets_table_fix":"assets_table_fix","readme":"readme","add_update_server":"add_update_server","update_server_target":"update_server_target","emptycontributors":"emptycontributors","number":"number","update_server":"update_server","sales_server":"sales_server","add_git_folder_path":"add_git_folder_path","git_folder_path":"git_folder_path","crowdin_project_api_key":"crowdin_project_api_key","creatuserhelper":"creatuserhelper","crowdin_account_api_key":"crowdin_account_api_key","adduikit":"adduikit","buildcomp":"buildcomp","addfootable":"addfootable","guid":"guid","add_email_helper":"add_email_helper","name":"name"}}'; + $joomla_component->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "system_name","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "php_method_uninstall","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "metadata","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "metakey","core_metadesc": "metadesc","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"system_name":"system_name","name_code":"name_code","short_description":"short_description","companyname":"companyname","buildcompsql":"buildcompsql","translation_tool":"translation_tool","add_sales_server":"add_sales_server","php_method_uninstall":"php_method_uninstall","php_preflight_install":"php_preflight_install","css_admin":"css_admin","mvc_versiondate":"mvc_versiondate","remove_line_breaks":"remove_line_breaks","add_placeholders":"add_placeholders","debug_linenr":"debug_linenr","php_site_event":"php_site_event","description":"description","author":"author","php_postflight_install":"php_postflight_install","email":"email","sql_uninstall":"sql_uninstall","website":"website","add_license":"add_license","backup_folder_path":"backup_folder_path","php_helper_both":"php_helper_both","crowdin_username":"crowdin_username","php_admin_event":"php_admin_event","license_type":"license_type","component_version":"component_version","php_helper_admin":"php_helper_admin","php_helper_site":"php_helper_site","whmcs_key":"whmcs_key","javascript":"javascript","whmcs_url":"whmcs_url","css_site":"css_site","whmcs_buy_link":"whmcs_buy_link","license":"license","php_preflight_update":"php_preflight_update","bom":"bom","php_postflight_update":"php_postflight_update","image":"image","sql":"sql","copyright":"copyright","addreadme":"addreadme","preferred_joomla_version":"preferred_joomla_version","update_server_url":"update_server_url","add_powers":"add_powers","add_backup_folder_path":"add_backup_folder_path","crowdin_project_identifier":"crowdin_project_identifier","add_php_helper_both":"add_php_helper_both","add_php_helper_admin":"add_php_helper_admin","add_admin_event":"add_admin_event","add_php_helper_site":"add_php_helper_site","add_site_event":"add_site_event","add_namespace_prefix":"add_namespace_prefix","add_javascript":"add_javascript","namespace_prefix":"namespace_prefix","add_css_admin":"add_css_admin","add_css_site":"add_css_site","add_menu_prefix":"add_menu_prefix","dashboard_type":"dashboard_type","menu_prefix":"menu_prefix","dashboard":"dashboard","add_php_preflight_install":"add_php_preflight_install","add_php_preflight_update":"add_php_preflight_update","toignore":"toignore","add_php_postflight_install":"add_php_postflight_install","add_php_postflight_update":"add_php_postflight_update","add_php_method_uninstall":"add_php_method_uninstall","export_key":"export_key","add_sql":"add_sql","joomla_source_link":"joomla_source_link","add_sql_uninstall":"add_sql_uninstall","export_buy_link":"export_buy_link","assets_table_fix":"assets_table_fix","readme":"readme","add_update_server":"add_update_server","update_server_target":"update_server_target","emptycontributors":"emptycontributors","number":"number","update_server":"update_server","sales_server":"sales_server","add_git_folder_path":"add_git_folder_path","git_folder_path":"git_folder_path","crowdin_project_api_key":"crowdin_project_api_key","creatuserhelper":"creatuserhelper","crowdin_account_api_key":"crowdin_account_api_key","adduikit":"adduikit","buildcomp":"buildcomp","addfootable":"addfootable","guid":"guid","add_email_helper":"add_email_helper","name":"name"}}'; $joomla_component->router = 'ComponentbuilderHelperRoute::getJoomla_componentRoute'; - $joomla_component->content_history_options = '{"formFile": "administrator/components/com_componentbuilder/models/forms/joomla_component.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","version","hits","debug_linenr","translation_tool","add_sales_server","mvc_versiondate","remove_line_breaks","add_placeholders","add_license","license_type","addreadme","add_powers","add_backup_folder_path","add_php_helper_both","add_php_helper_admin","add_admin_event","add_php_helper_site","add_site_event","add_javascript","add_css_admin","add_css_site","dashboard_type","add_php_preflight_install","add_php_preflight_update","add_php_postflight_install","add_php_postflight_update","add_php_method_uninstall","add_sql","add_sql_uninstall","assets_table_fix","add_update_server","update_server_target","emptycontributors","number","update_server","sales_server","add_git_folder_path","creatuserhelper","adduikit","buildcomp","addfootable","add_email_helper"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "dashboard","targetTable": "#__componentbuilder_custom_admin_view","targetColumn": "","displayColumn": "system_name"},{"sourceColumn": "update_server","targetTable": "#__componentbuilder_server","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "sales_server","targetTable": "#__componentbuilder_server","targetColumn": "id","displayColumn": "name"}]}'; + $joomla_component->content_history_options = '{"formFile": "administrator/components/com_componentbuilder/models/forms/joomla_component.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","version","hits","translation_tool","add_sales_server","mvc_versiondate","remove_line_breaks","add_placeholders","debug_linenr","add_license","license_type","addreadme","preferred_joomla_version","add_powers","add_backup_folder_path","add_php_helper_both","add_php_helper_admin","add_admin_event","add_php_helper_site","add_site_event","add_javascript","add_css_admin","add_css_site","dashboard_type","add_php_preflight_install","add_php_preflight_update","add_php_postflight_install","add_php_postflight_update","add_php_method_uninstall","add_sql","add_sql_uninstall","assets_table_fix","add_update_server","update_server_target","emptycontributors","number","update_server","sales_server","add_git_folder_path","creatuserhelper","adduikit","buildcomp","addfootable","add_email_helper"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "dashboard","targetTable": "#__componentbuilder_custom_admin_view","targetColumn": "","displayColumn": "system_name"},{"sourceColumn": "update_server","targetTable": "#__componentbuilder_server","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "sales_server","targetTable": "#__componentbuilder_server","targetColumn": "id","displayColumn": "name"}]}'; // Set the object into the content types table. $joomla_component_Inserted = $db->insertObject('#__content_types', $joomla_component); @@ -7767,9 +7767,9 @@ class Com_ComponentbuilderInstallerScript $joomla_component->type_title = 'Componentbuilder Joomla_component'; $joomla_component->type_alias = 'com_componentbuilder.joomla_component'; $joomla_component->table = '{"special": {"dbtable": "#__componentbuilder_joomla_component","key": "id","type": "Joomla_component","prefix": "componentbuilderTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; - $joomla_component->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "system_name","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "php_site_event","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "metadata","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "metakey","core_metadesc": "metadesc","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"system_name":"system_name","name_code":"name_code","short_description":"short_description","companyname":"companyname","debug_linenr":"debug_linenr","php_site_event":"php_site_event","translation_tool":"translation_tool","buildcompsql":"buildcompsql","add_sales_server":"add_sales_server","php_preflight_install":"php_preflight_install","php_method_uninstall":"php_method_uninstall","css_admin":"css_admin","mvc_versiondate":"mvc_versiondate","remove_line_breaks":"remove_line_breaks","add_placeholders":"add_placeholders","description":"description","php_postflight_install":"php_postflight_install","author":"author","sql_uninstall":"sql_uninstall","email":"email","website":"website","backup_folder_path":"backup_folder_path","php_helper_both":"php_helper_both","crowdin_username":"crowdin_username","php_admin_event":"php_admin_event","add_license":"add_license","component_version":"component_version","php_helper_admin":"php_helper_admin","license_type":"license_type","php_helper_site":"php_helper_site","javascript":"javascript","whmcs_key":"whmcs_key","css_site":"css_site","whmcs_url":"whmcs_url","whmcs_buy_link":"whmcs_buy_link","php_preflight_update":"php_preflight_update","license":"license","php_postflight_update":"php_postflight_update","bom":"bom","sql":"sql","image":"image","addreadme":"addreadme","copyright":"copyright","update_server_url":"update_server_url","add_powers":"add_powers","add_backup_folder_path":"add_backup_folder_path","crowdin_project_identifier":"crowdin_project_identifier","add_php_helper_both":"add_php_helper_both","add_php_helper_admin":"add_php_helper_admin","add_admin_event":"add_admin_event","add_php_helper_site":"add_php_helper_site","add_site_event":"add_site_event","add_namespace_prefix":"add_namespace_prefix","add_javascript":"add_javascript","namespace_prefix":"namespace_prefix","add_css_admin":"add_css_admin","add_css_site":"add_css_site","add_menu_prefix":"add_menu_prefix","dashboard_type":"dashboard_type","menu_prefix":"menu_prefix","dashboard":"dashboard","add_php_preflight_install":"add_php_preflight_install","add_php_preflight_update":"add_php_preflight_update","toignore":"toignore","add_php_postflight_install":"add_php_postflight_install","add_php_postflight_update":"add_php_postflight_update","add_php_method_uninstall":"add_php_method_uninstall","export_key":"export_key","add_sql":"add_sql","joomla_source_link":"joomla_source_link","add_sql_uninstall":"add_sql_uninstall","export_buy_link":"export_buy_link","assets_table_fix":"assets_table_fix","readme":"readme","add_update_server":"add_update_server","update_server_target":"update_server_target","emptycontributors":"emptycontributors","number":"number","update_server":"update_server","sales_server":"sales_server","add_git_folder_path":"add_git_folder_path","git_folder_path":"git_folder_path","crowdin_project_api_key":"crowdin_project_api_key","creatuserhelper":"creatuserhelper","crowdin_account_api_key":"crowdin_account_api_key","adduikit":"adduikit","buildcomp":"buildcomp","addfootable":"addfootable","guid":"guid","add_email_helper":"add_email_helper","name":"name"}}'; + $joomla_component->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "system_name","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "php_method_uninstall","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "metadata","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "metakey","core_metadesc": "metadesc","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"system_name":"system_name","name_code":"name_code","short_description":"short_description","companyname":"companyname","buildcompsql":"buildcompsql","translation_tool":"translation_tool","add_sales_server":"add_sales_server","php_method_uninstall":"php_method_uninstall","php_preflight_install":"php_preflight_install","css_admin":"css_admin","mvc_versiondate":"mvc_versiondate","remove_line_breaks":"remove_line_breaks","add_placeholders":"add_placeholders","debug_linenr":"debug_linenr","php_site_event":"php_site_event","description":"description","author":"author","php_postflight_install":"php_postflight_install","email":"email","sql_uninstall":"sql_uninstall","website":"website","add_license":"add_license","backup_folder_path":"backup_folder_path","php_helper_both":"php_helper_both","crowdin_username":"crowdin_username","php_admin_event":"php_admin_event","license_type":"license_type","component_version":"component_version","php_helper_admin":"php_helper_admin","php_helper_site":"php_helper_site","whmcs_key":"whmcs_key","javascript":"javascript","whmcs_url":"whmcs_url","css_site":"css_site","whmcs_buy_link":"whmcs_buy_link","license":"license","php_preflight_update":"php_preflight_update","bom":"bom","php_postflight_update":"php_postflight_update","image":"image","sql":"sql","copyright":"copyright","addreadme":"addreadme","preferred_joomla_version":"preferred_joomla_version","update_server_url":"update_server_url","add_powers":"add_powers","add_backup_folder_path":"add_backup_folder_path","crowdin_project_identifier":"crowdin_project_identifier","add_php_helper_both":"add_php_helper_both","add_php_helper_admin":"add_php_helper_admin","add_admin_event":"add_admin_event","add_php_helper_site":"add_php_helper_site","add_site_event":"add_site_event","add_namespace_prefix":"add_namespace_prefix","add_javascript":"add_javascript","namespace_prefix":"namespace_prefix","add_css_admin":"add_css_admin","add_css_site":"add_css_site","add_menu_prefix":"add_menu_prefix","dashboard_type":"dashboard_type","menu_prefix":"menu_prefix","dashboard":"dashboard","add_php_preflight_install":"add_php_preflight_install","add_php_preflight_update":"add_php_preflight_update","toignore":"toignore","add_php_postflight_install":"add_php_postflight_install","add_php_postflight_update":"add_php_postflight_update","add_php_method_uninstall":"add_php_method_uninstall","export_key":"export_key","add_sql":"add_sql","joomla_source_link":"joomla_source_link","add_sql_uninstall":"add_sql_uninstall","export_buy_link":"export_buy_link","assets_table_fix":"assets_table_fix","readme":"readme","add_update_server":"add_update_server","update_server_target":"update_server_target","emptycontributors":"emptycontributors","number":"number","update_server":"update_server","sales_server":"sales_server","add_git_folder_path":"add_git_folder_path","git_folder_path":"git_folder_path","crowdin_project_api_key":"crowdin_project_api_key","creatuserhelper":"creatuserhelper","crowdin_account_api_key":"crowdin_account_api_key","adduikit":"adduikit","buildcomp":"buildcomp","addfootable":"addfootable","guid":"guid","add_email_helper":"add_email_helper","name":"name"}}'; $joomla_component->router = 'ComponentbuilderHelperRoute::getJoomla_componentRoute'; - $joomla_component->content_history_options = '{"formFile": "administrator/components/com_componentbuilder/models/forms/joomla_component.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","version","hits","debug_linenr","translation_tool","add_sales_server","mvc_versiondate","remove_line_breaks","add_placeholders","add_license","license_type","addreadme","add_powers","add_backup_folder_path","add_php_helper_both","add_php_helper_admin","add_admin_event","add_php_helper_site","add_site_event","add_javascript","add_css_admin","add_css_site","dashboard_type","add_php_preflight_install","add_php_preflight_update","add_php_postflight_install","add_php_postflight_update","add_php_method_uninstall","add_sql","add_sql_uninstall","assets_table_fix","add_update_server","update_server_target","emptycontributors","number","update_server","sales_server","add_git_folder_path","creatuserhelper","adduikit","buildcomp","addfootable","add_email_helper"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "dashboard","targetTable": "#__componentbuilder_custom_admin_view","targetColumn": "","displayColumn": "system_name"},{"sourceColumn": "update_server","targetTable": "#__componentbuilder_server","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "sales_server","targetTable": "#__componentbuilder_server","targetColumn": "id","displayColumn": "name"}]}'; + $joomla_component->content_history_options = '{"formFile": "administrator/components/com_componentbuilder/models/forms/joomla_component.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","version","hits","translation_tool","add_sales_server","mvc_versiondate","remove_line_breaks","add_placeholders","debug_linenr","add_license","license_type","addreadme","preferred_joomla_version","add_powers","add_backup_folder_path","add_php_helper_both","add_php_helper_admin","add_admin_event","add_php_helper_site","add_site_event","add_javascript","add_css_admin","add_css_site","dashboard_type","add_php_preflight_install","add_php_preflight_update","add_php_postflight_install","add_php_postflight_update","add_php_method_uninstall","add_sql","add_sql_uninstall","assets_table_fix","add_update_server","update_server_target","emptycontributors","number","update_server","sales_server","add_git_folder_path","creatuserhelper","adduikit","buildcomp","addfootable","add_email_helper"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "dashboard","targetTable": "#__componentbuilder_custom_admin_view","targetColumn": "","displayColumn": "system_name"},{"sourceColumn": "update_server","targetTable": "#__componentbuilder_server","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "sales_server","targetTable": "#__componentbuilder_server","targetColumn": "id","displayColumn": "name"}]}'; // Check if joomla_component type is already in content_type DB. $joomla_component_id = null; @@ -9618,7 +9618,7 @@ class Com_ComponentbuilderInstallerScript echo '
-

Upgrade to Version 3.2.0-beta3 Was Successful! Let us know if anything is not working as expected.

'; +

Upgrade to Version 3.2.0-beta4 Was Successful! Let us know if anything is not working as expected.

'; // Set db if not set already. if (!isset($db))