From 8219d5ed453ca8310190a9f21b0d5b2dc34039a4 Mon Sep 17 00:00:00 2001 From: Llewellyn van der Merwe Date: Fri, 4 Feb 2022 19:21:10 +0200 Subject: [PATCH] Fix option to add field paths or rule paths to both module or plugin external forms. --- README.md | 2 +- admin/README.txt | 2 +- admin/helpers/compiler/a_Get.php | 8 +- admin/helpers/compiler/b_Structure.php | 168 +++++++++++------- admin/helpers/compiler/e_Interpretation.php | 109 ++++++------ .../en-GB/en-GB.com_componentbuilder.ini | 16 +- admin/models/forms/joomla_module.xml | 112 ++++++------ admin/models/forms/joomla_plugin.xml | 112 ++++++------ 8 files changed, 292 insertions(+), 237 deletions(-) diff --git a/README.md b/README.md index 641e5097e..e35a5cde9 100644 --- a/README.md +++ b/README.md @@ -147,7 +147,7 @@ TODO + *Version*: 2.12.15 + *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved. + *License*: GNU General Public License version 2 or later; see LICENSE.txt -+ *Line count*: **286249** ++ *Line count*: **286257** + *Field count*: **1580** + *File count*: **1829** + *Folder count*: **256** diff --git a/admin/README.txt b/admin/README.txt index 641e5097e..e35a5cde9 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -147,7 +147,7 @@ TODO + *Version*: 2.12.15 + *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved. + *License*: GNU General Public License version 2 or later; see LICENSE.txt -+ *Line count*: **286249** ++ *Line count*: **286257** + *Field count*: **1580** + *File count*: **1829** + *Folder count*: **256** diff --git a/admin/helpers/compiler/a_Get.php b/admin/helpers/compiler/a_Get.php index 487f5267b..fb0608da7 100644 --- a/admin/helpers/compiler/a_Get.php +++ b/admin/helpers/compiler/a_Get.php @@ -9473,7 +9473,7 @@ class Get { if (ComponentbuilderHelper::checkString($add_rule_path['path'])) { - $module->add_rule_path[$unique][] = $add_rule_path['path']; + $module->add_rule_path[$unique] = $add_rule_path['path']; } } } @@ -9485,7 +9485,7 @@ class Get { if (ComponentbuilderHelper::checkString($add_field_path['path'])) { - $module->add_field_path[$unique][] = $add_field_path['path']; + $module->add_field_path[$unique] = $add_field_path['path']; } } } @@ -10416,7 +10416,7 @@ class Get { if (ComponentbuilderHelper::checkString($add_rule_path['path'])) { - $plugin->add_rule_path[$unique][] = $add_rule_path['path']; + $plugin->add_rule_path[$unique] = $add_rule_path['path']; } } } @@ -10428,7 +10428,7 @@ class Get { if (ComponentbuilderHelper::checkString($add_field_path['path'])) { - $plugin->add_field_path[$unique][] = $add_field_path['path']; + $plugin->add_field_path[$unique] = $add_field_path['path']; } } } diff --git a/admin/helpers/compiler/b_Structure.php b/admin/helpers/compiler/b_Structure.php index 79532517f..dfde9137c 100644 --- a/admin/helpers/compiler/b_Structure.php +++ b/admin/helpers/compiler/b_Structure.php @@ -946,44 +946,78 @@ class Structure extends Get { // default to the field set name $label = $fieldset; - if (isset( - $module->fieldsets_label[$file - . $field_name . $fieldset] - )) + if (isset($module->fieldsets_label[$file . $field_name . $fieldset])) { - $label = $module->fieldsets_label[$file - . $field_name . $fieldset]; + $label = $module->fieldsets_label[$file . $field_name . $fieldset]; } // add path to module rules and custom fields - if (isset( - $module->fieldsets_paths[$file - . $field_name . $fieldset] - ) - && $module->fieldsets_paths[$file - . $field_name . $fieldset] == 2) + if (isset($module->fieldsets_paths[$file . $field_name . $fieldset]) + && ($module->fieldsets_paths[$file . $field_name . $fieldset] == 2 + || $module->fieldsets_paths[$file . $field_name . $fieldset] == 3)) { + if ($module->target == 2) + { + if (!isset($module->add_rule_path[$file . $field_name . $fieldset])) + { + $module->add_rule_path[$file . $field_name . $fieldset] = + '/administrator/modules/' + . $module->file_name . '/rules'; + } + + if (!isset($module->add_field_path[$file . $field_name . $fieldset])) + { + $module->add_field_path[$file . $field_name . $fieldset] = + '/administrator/modules/' + . $module->file_name . '/fields'; + } + } + else + { + if (!isset($module->add_rule_path[$file . $field_name . $fieldset])) + { + $module->add_rule_path[$file . $field_name . $fieldset] = + '/modules/' . $module->file_name + . '/rules'; + } + + if (!isset($module->add_field_path[$file . $field_name . $fieldset])) + { + $module->add_field_path[$file . $field_name . $fieldset] = + '/modules/' . $module->file_name + . '/fields'; + } + } + } + // add path to module rules and custom fields + if (isset($module->add_rule_path[$file . $field_name . $fieldset]) + || isset($module->add_field_path[$file . $field_name . $fieldset])) + { + $xml .= PHP_EOL . $this->_t(1) . ''; - $xml .= PHP_EOL . $this->_t(1) - . '
_t(2) - . 'addrulepath="/modules/' - . strtolower($module->code_name) - . '/rules"'; - $xml .= PHP_EOL . $this->_t(2) - . 'addfieldpath="/modules/' - . strtolower($module->code_name) - . '/fields"'; + . $this->setLine(__LINE__) . ' default paths of ' + . $fieldset . ' fieldset points to the module -->'; + + $xml .= PHP_EOL . $this->_t(1) . '
add_rule_path[$file . $field_name . $fieldset])) + { + $xml .= PHP_EOL . $this->_t(2) + . 'addrulepath="' . $module->add_rule_path[$file . $field_name . $fieldset] . '"'; + } + + if (isset($module->add_field_path[$file . $field_name . $fieldset])) + { + $xml .= PHP_EOL . $this->_t(2) + . 'addfieldpath="' . $module->add_field_path[$file . $field_name . $fieldset] . '"'; + } + $xml .= PHP_EOL . $this->_t(1) . '>'; } else { - $xml .= PHP_EOL . $this->_t(1) - . '
'; + $xml .= PHP_EOL . $this->_t(1) . '
'; } // check if we have an inner field set if (ComponentbuilderHelper::checkString( @@ -1321,46 +1355,60 @@ class Structure extends Get { // default to the field set name $label = $fieldset; - if (isset( - $plugin->fieldsets_label[$file - . $field_name . $fieldset] - )) + if (isset($plugin->fieldsets_label[$file . $field_name . $fieldset])) { - $label = $plugin->fieldsets_label[$file - . $field_name . $fieldset]; + $label = $plugin->fieldsets_label[$file . $field_name . $fieldset]; } // add path to plugin rules and custom fields - if (isset( - $plugin->fieldsets_paths[$file - . $field_name . $fieldset] - ) - && $plugin->fieldsets_paths[$file - . $field_name . $fieldset] == 2) + if (isset($plugin->fieldsets_paths[$file . $field_name . $fieldset]) + && ($plugin->fieldsets_paths[$file . $field_name . $fieldset] == 2 + || $plugin->fieldsets_paths[$file . $field_name . $fieldset] == 3)) + { + if (!isset($plugin->add_rule_path[$file . $field_name . $fieldset])) + { + $plugin->add_rule_path[$file . $field_name . $fieldset] = + '/plugins/' . strtolower($plugin->group + ) . '/' . strtolower($plugin->code_name) + . '/rules'; + } + + if (!isset($plugin->add_field_path[$file . $field_name . $fieldset])) + { + $plugin->add_field_path[$file . $field_name . $fieldset] = + '/plugins/' . strtolower($plugin->group + ) . '/' . strtolower($plugin->code_name) + . '/fields'; + } + } + // add path to plugin rules and custom fields + if (isset($plugin->add_rule_path[$file . $field_name . $fieldset]) + || isset($plugin->add_field_path[$file . $field_name . $fieldset])) { $xml .= PHP_EOL . $this->_t(1) . ''; - $xml .= PHP_EOL . $this->_t(1) - . '
_t(2) - . 'addrulepath="/plugins/' - . strtolower($plugin->group) . '/' - . strtolower($plugin->code_name) - . '/rules"'; - $xml .= PHP_EOL . $this->_t(2) - . 'addfieldpath="/plugins/' - . strtolower($plugin->group) . '/' - . strtolower($plugin->code_name) - . '/fields"'; + . $this->setLine(__LINE__) . ' default paths of ' + . $fieldset . ' fieldset points to the plugin -->'; + + $xml .= PHP_EOL . $this->_t(1) . '
add_rule_path[$file . $field_name . $fieldset])) + { + $xml .= PHP_EOL . $this->_t(2) + . 'addrulepath="' . $plugin->add_rule_path[$file . $field_name . $fieldset] . '"'; + } + + if (isset($plugin->add_field_path[$file . $field_name . $fieldset])) + { + $xml .= PHP_EOL . $this->_t(2) + . 'addfieldpath="' . $plugin->add_field_path[$file . $field_name . $fieldset] . '"'; + } + $xml .= PHP_EOL . $this->_t(1) . '>'; } else { - $xml .= PHP_EOL . $this->_t(1) - . '
'; + $xml .= PHP_EOL . $this->_t(1) . '
'; } // check if we have an inner field set if (ComponentbuilderHelper::checkString( diff --git a/admin/helpers/compiler/e_Interpretation.php b/admin/helpers/compiler/e_Interpretation.php index 646d2816c..3beeb62c3 100644 --- a/admin/helpers/compiler/e_Interpretation.php +++ b/admin/helpers/compiler/e_Interpretation.php @@ -28560,37 +28560,46 @@ function vdm_dkim() { { // default to the field set name $label = $fieldset; - if (isset( - $module->fieldsets_label[$field_name . $fieldset] - )) + if (isset($module->fieldsets_label[$field_name . $fieldset])) { - $label = $module->fieldsets_label[$field_name - . $fieldset]; + $label = $module->fieldsets_label[$field_name . $fieldset]; } // add path to module rules and custom fields if (isset($module->fieldsets_paths[$field_name . $fieldset]) - && $module->fieldsets_paths[$field_name . $fieldset] - == 2) + && ($module->fieldsets_paths[$field_name . $fieldset] == 2 + || $module->fieldsets_paths[$field_name . $fieldset] == 3)) { if ($module->target == 2) { - $module->add_rule_path[$field_name . $fieldset][] = - '/administrator/modules/' - . $module->file_name . '/rules'; + if (!isset($module->add_rule_path[$field_name . $fieldset])) + { + $module->add_rule_path[$field_name . $fieldset] = + '/administrator/modules/' + . $module->file_name . '/rules'; + } - $module->add_field_path[$field_name . $fieldset][] = - '/administrator/modules/' - . $module->file_name . '/fields'; + if (!isset($module->add_field_path[$field_name . $fieldset])) + { + $module->add_field_path[$field_name . $fieldset] = + '/administrator/modules/' + . $module->file_name . '/fields'; + } } else { - $module->add_rule_path[$field_name . $fieldset][] = - '/modules/' . $module->file_name - . '/rules'; + if (!isset($module->add_rule_path[$field_name . $fieldset])) + { + $module->add_rule_path[$field_name . $fieldset] = + '/modules/' . $module->file_name + . '/rules'; + } - $module->add_field_path[$field_name . $fieldset][] = - '/modules/' . $module->file_name - . '/fields'; + if (!isset($module->add_field_path[$field_name . $fieldset])) + { + $module->add_field_path[$field_name . $fieldset] = + '/modules/' . $module->file_name + . '/fields'; + } } } // add path to module rules and custom fields @@ -28607,20 +28616,14 @@ function vdm_dkim() { if (isset($module->add_rule_path[$field_name . $fieldset])) { - foreach ($module->add_rule_path[$field_name . $fieldset] as $path) - { - $xml .= PHP_EOL . $this->_t(2) - . 'addrulepath="' . $path . '"'; - } + $xml .= PHP_EOL . $this->_t(2) + . 'addrulepath="' . $module->add_rule_path[$field_name . $fieldset] . '"'; } if (isset($module->add_field_path[$field_name . $fieldset])) { - foreach ($module->add_field_path[$field_name . $fieldset] as $path) - { - $xml .= PHP_EOL . $this->_t(2) - . 'addfieldpath="' . $path . '"'; - } + $xml .= PHP_EOL . $this->_t(2) + . 'addfieldpath="' . $module->add_field_path[$field_name . $fieldset] . '"'; } $xml .= PHP_EOL . $this->_t(1) . '>'; @@ -28950,28 +28953,30 @@ function vdm_dkim() { { // default to the field set name $label = $fieldset; - if (isset( - $plugin->fieldsets_label[$field_name . $fieldset] - )) + if (isset($plugin->fieldsets_label[$field_name . $fieldset])) { - $label = $plugin->fieldsets_label[$field_name - . $fieldset]; + $label = $plugin->fieldsets_label[$field_name . $fieldset]; } - // add path to plugin rules and custom fields if (isset($plugin->fieldsets_paths[$field_name . $fieldset]) - && $plugin->fieldsets_paths[$field_name . $fieldset] - == 2) + && ($plugin->fieldsets_paths[$field_name . $fieldset] == 2 + || $plugin->fieldsets_paths[$field_name . $fieldset] == 3)) { - $plugin->add_rule_path[$field_name . $fieldset][] = - '/plugins/' . strtolower($plugin->group - ) . '/' . strtolower($plugin->code_name) - . '/rules'; + if (!isset($plugin->add_rule_path[$field_name . $fieldset])) + { + $plugin->add_rule_path[$field_name . $fieldset] = + '/plugins/' . strtolower($plugin->group + ) . '/' . strtolower($plugin->code_name) + . '/rules'; + } - $plugin->add_field_path[$field_name . $fieldset][] = - '/plugins/' . strtolower($plugin->group - ) . '/' . strtolower($plugin->code_name) - . '/fields'; + if (!isset($plugin->add_field_path[$field_name . $fieldset])) + { + $plugin->add_field_path[$field_name . $fieldset] = + '/plugins/' . strtolower($plugin->group + ) . '/' . strtolower($plugin->code_name) + . '/fields'; + } } // add path to plugin rules and custom fields if (isset($plugin->add_rule_path[$field_name . $fieldset]) @@ -28986,20 +28991,14 @@ function vdm_dkim() { if (isset($plugin->add_rule_path[$field_name . $fieldset])) { - foreach ($plugin->add_rule_path[$field_name . $fieldset] as $path) - { - $xml .= PHP_EOL . $this->_t(2) - . 'addrulepath="' . $path . '"'; - } + $xml .= PHP_EOL . $this->_t(2) + . 'addrulepath="' . $plugin->add_rule_path[$field_name . $fieldset] . '"'; } if (isset($plugin->add_field_path[$field_name . $fieldset])) { - foreach ($plugin->add_field_path[$field_name . $fieldset] as $path) - { - $xml .= PHP_EOL . $this->_t(2) - . 'addfieldpath="' . $path . '"'; - } + $xml .= PHP_EOL . $this->_t(2) + . 'addfieldpath="' . $plugin->add_field_path[$field_name . $fieldset] . '"'; } $xml .= PHP_EOL . $this->_t(1) . '>'; diff --git a/admin/language/en-GB/en-GB.com_componentbuilder.ini b/admin/language/en-GB/en-GB.com_componentbuilder.ini index edf9bec16..eff098d0c 100644 --- a/admin/language/en-GB/en-GB.com_componentbuilder.ini +++ b/admin/language/en-GB/en-GB.com_componentbuilder.ini @@ -6237,11 +6237,11 @@ COM_COMPONENTBUILDER_JOOMLA_MODULES_UPDATES_N_ITEMS_UNFEATURED_1="%s Joomla Modu COM_COMPONENTBUILDER_JOOMLA_MODULES_UPDATES_N_ITEMS_UNPUBLISHED="%s Joomla Modules Updates unpublished." COM_COMPONENTBUILDER_JOOMLA_MODULES_UPDATES_N_ITEMS_UNPUBLISHED_1="%s Joomla Module Updates unpublished." COM_COMPONENTBUILDER_JOOMLA_MODULE_ABSTRACT_CLASS="abstract class" -COM_COMPONENTBUILDER_JOOMLA_MODULE_ADDFIELDPATH_DESCRIPTION="Set extra field paths" -COM_COMPONENTBUILDER_JOOMLA_MODULE_ADDFIELDPATH_LABEL="Extra Field Paths" +COM_COMPONENTBUILDER_JOOMLA_MODULE_ADDFIELDPATH_DESCRIPTION="Set other field path" +COM_COMPONENTBUILDER_JOOMLA_MODULE_ADDFIELDPATH_LABEL="Other Field Path" COM_COMPONENTBUILDER_JOOMLA_MODULE_ADDREADME_LABEL="Add README" -COM_COMPONENTBUILDER_JOOMLA_MODULE_ADDRULEPATH_DESCRIPTION="Set extra rule paths" -COM_COMPONENTBUILDER_JOOMLA_MODULE_ADDRULEPATH_LABEL="Extra Rule Paths" +COM_COMPONENTBUILDER_JOOMLA_MODULE_ADDRULEPATH_DESCRIPTION="Set other rule path" +COM_COMPONENTBUILDER_JOOMLA_MODULE_ADDRULEPATH_LABEL="Other Rule Path" COM_COMPONENTBUILDER_JOOMLA_MODULE_ADD_CLASS_HELPER_DESCRIPTION="You can add a helper class to your module." COM_COMPONENTBUILDER_JOOMLA_MODULE_ADD_CLASS_HELPER_HEADER_DESCRIPTION="You can add your own custom helper header script." COM_COMPONENTBUILDER_JOOMLA_MODULE_ADD_CLASS_HELPER_HEADER_LABEL="Add Class Helper Header" @@ -6686,11 +6686,11 @@ COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_N_ITEMS_UNFEATURED="%s Joomla Plugin COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_N_ITEMS_UNFEATURED_1="%s Joomla Plugin Updates unfeatured." COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_N_ITEMS_UNPUBLISHED="%s Joomla Plugins Updates unpublished." COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_N_ITEMS_UNPUBLISHED_1="%s Joomla Plugin Updates unpublished." -COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADDFIELDPATH_DESCRIPTION="Set extra field paths" -COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADDFIELDPATH_LABEL="Extra Field Paths" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADDFIELDPATH_DESCRIPTION="Set other field path" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADDFIELDPATH_LABEL="Other Field Path" COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADDREADME_LABEL="Add README" -COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADDRULEPATH_DESCRIPTION="Set extra rule paths" -COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADDRULEPATH_LABEL="Extra Rule Paths" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADDRULEPATH_DESCRIPTION="Set other rule path" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADDRULEPATH_LABEL="Other Rule Path" COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADD_HEAD_DESCRIPTION="You can add your own custom header script, combined with the default header script that make the extended class work." COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADD_HEAD_LABEL="Add Custom Class Header" COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADD_PHP_METHOD_UNINSTALL_LABEL="Add PHP Method (uninstall)" diff --git a/admin/models/forms/joomla_module.xml b/admin/models/forms/joomla_module.xml index 012447170..e4e0579a1 100644 --- a/admin/models/forms/joomla_module.xml +++ b/admin/models/forms/joomla_module.xml @@ -647,6 +647,64 @@ COM_COMPONENTBUILDER_JOOMLA_MODULE_COMPONENT + + + + + + + + - - - - - - diff --git a/admin/models/forms/joomla_plugin.xml b/admin/models/forms/joomla_plugin.xml index 43893074e..4b587a0a3 100644 --- a/admin/models/forms/joomla_plugin.xml +++ b/admin/models/forms/joomla_plugin.xml @@ -526,6 +526,64 @@ COM_COMPONENTBUILDER_JOOMLA_PLUGIN_COMPONENT + + + + + + + + - - - - - -