From 1e8f17493386bb9390a1274e6062efbec4efb024 Mon Sep 17 00:00:00 2001 From: aB0t Date: Mon, 11 Mar 2024 18:36:21 +0200 Subject: [PATCH] Release of v2.0.0 --- componentbuilderexportcompiler.php | 94 ++++++------- componentbuilderexportcompiler.xml | 10 +- ...tension_componentbuilderexportcompiler.ini | 2 +- ...ion_componentbuilderexportcompiler.sys.ini | 2 +- script.php | 132 ------------------ 5 files changed, 52 insertions(+), 188 deletions(-) diff --git a/componentbuilderexportcompiler.php b/componentbuilderexportcompiler.php index 55e77f6..27653d6 100644 --- a/componentbuilderexportcompiler.php +++ b/componentbuilderexportcompiler.php @@ -14,19 +14,15 @@ defined('_JEXEC') or die('Restricted access'); use Joomla\CMS\Application\CMSApplication; use Joomla\CMS\Plugin\CMSPlugin; -use VDM\Joomla\Utilities\ArrayHelper; - -JLoader::register('ComponentbuilderHelper', JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/componentbuilder.php'); - -use VDM\Joomla\Componentbuilder\Compiler\Factory as CFactory; -use VDM\Joomla\Componentbuilder\Compiler\Utilities\Indent; -use VDM\Joomla\Componentbuilder\Compiler\Utilities\Line; - +use VDM\Joomla\Componentbuilder\Compiler\Factory; +use VDM\Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Componentbuilder\Compiler\Utilities\Indent; +use VDM\Joomla\Componentbuilder\Compiler\Utilities\Line; /** * Extension - Componentbuilder Export Compiler plugin. * * @package ComponentbuilderExportCompiler - * @since 1.2.0 + * @since 2.0.0 */ class PlgExtensionComponentbuilderExportCompiler extends CMSPlugin { @@ -79,10 +75,10 @@ class PlgExtensionComponentbuilderExportCompiler extends CMSPlugin if ($this->exportTextOnly && $this->componentActive()) { // activate export text only - CFactory::_('Config')->set('export_text_only', (int) $this->exportTextOnly); + Factory::_('Config')->set('export_text_only', (int) $this->exportTextOnly); // activate strict_permission_per_field if set in plugin (default true) - CFactory::_('Config')->set('permission_strict_per_field', (bool) $this->strictFieldExportPermissions); + Factory::_('Config')->set('permission_strict_per_field', (bool) $this->strictFieldExportPermissions); } } @@ -126,7 +122,7 @@ class PlgExtensionComponentbuilderExportCompiler extends CMSPlugin { foreach($this->languageArray as $key => $string) { - CFactory::_('Language')->set('adminsys', $key, $string); + Factory::_('Language')->set('adminsys', $key, $string); } } } @@ -144,19 +140,19 @@ class PlgExtensionComponentbuilderExportCompiler extends CMSPlugin if ($this->exportTextOnly && $this->componentActive() && $timer == 2) { // main lang prefix - $lang = CFactory::_('Config')->lang_prefix . '_CONFIG'; + $lang = Factory::_('Config')->lang_prefix . '_CONFIG'; // start building field set for config - $configFieldSets[] = Indent::_(1) . "'; + Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(1) . "add('component', Indent::_(2) . 'name="export_text_only_config"'); + Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(2) . 'label="' . $lang . '_EXPORT_TEXT_ONLY_TAB_LABEL"'); + Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(2) . 'description="' . $lang . '_EXPORT_TEXT_ONLY_TAB_DESCRIPTION">'); // setup lang $this->languageArray[$lang . '_EXPORT_TEXT_ONLY_TAB_LABEL'] = "Export Options"; - $this->languageArray[$lang . '_EXPORT_TEXT_ONLY_TAB_DESCRIPTION'] = "Here are some extra option to adjust the export behavior of admin views."; + $this->languageArray[$lang . '_EXPORT_TEXT_ONLY_TAB_DESCRIPTION'] = "Here are some extra option to adjust the export behaviour of admin views."; // add custom Export Options if (isset($configFieldSetsCustomField['Export Options']) && ArrayHelper::check($configFieldSetsCustomField['Export Options'])) { - $configFieldSets[] = implode("", $configFieldSetsCustomField['Export Options']); + Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', implode("", $configFieldSetsCustomField['Export Options'])); unset($configFieldSetsCustomField['Export Options']); } else @@ -167,20 +163,20 @@ class PlgExtensionComponentbuilderExportCompiler extends CMSPlugin $this->languageArray[$lang . '_ACTIVATE'] = "Activate"; $this->languageArray[$lang . '_DEACTIVATE'] = "Deactivate"; - $configFieldSets[] = PHP_EOL . Indent::_(2) . ""; - $configFieldSets[] = Indent::_(2) . ""; - $configFieldSets[] = Indent::_(3) . ""; - $configFieldSets[] = Indent::_(3) . ""; - $configFieldSets[] = Indent::_(3) . ""; - $configFieldSets[] = Indent::_(2) . ""; + Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', PHP_EOL . Indent::_(2) . ""); + Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(2) . "add('component', Indent::_(3) . "type=\"radio\""); + Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(3) . "name=\"export_text_only\""); + Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(3) . "label=\"" . $lang . "_EXPORT_TEXT_ONLY_LABEL\""); + Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(3) . "description=\"" . $lang . "_EXPORT_TEXT_ONLY_DESCRIPTION\""); + Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(3) . "class=\"btn-group btn-group-yesno\""); + Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(3) . "default=\"0\">"); + Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(3) . ""); + Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(3) . ""); + Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(3) . ""); + Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(2) . ""); // add strict Field Export Permissions field if ($this->strictFieldExportPermissions) @@ -188,24 +184,24 @@ class PlgExtensionComponentbuilderExportCompiler extends CMSPlugin $this->languageArray[$lang . '_STRICT_PERMISSION_PER_FIELD_LABEL'] = "Use Strict Permission per/field"; $this->languageArray[$lang . '_STRICT_PERMISSION_PER_FIELD_DESCRIPTION'] = "Use strict permissions per/field in the export methods where there are fields permissions in a view."; - $configFieldSets[] = PHP_EOL . Indent::_(2) . ""; - $configFieldSets[] = Indent::_(2) . ""; - $configFieldSets[] = Indent::_(3) . ""; - $configFieldSets[] = Indent::_(3) . ""; - $configFieldSets[] = Indent::_(3) . ""; - $configFieldSets[] = Indent::_(2) . ""; + Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', PHP_EOL . Indent::_(2) . ""); + Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(2) . "add('component', Indent::_(3) . "type=\"radio\""); + Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(3) . "name=\"strict_permission_per_field\""); + Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(3) . "label=\"" . $lang . "_STRICT_PERMISSION_PER_FIELD_LABEL\""); + Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(3) . "description=\"" . $lang . "_STRICT_PERMISSION_PER_FIELD_DESCRIPTION\""); + Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(3) . "class=\"btn-group btn-group-yesno\""); + Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(3) . "default=\"1\">"); + Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(3) . ""); + Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(3) . ""); + Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(3) . ""); + Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(2) . ""); } } // close that fieldset - $configFieldSets[] = Indent::_(1) . ""; + Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(1) . ""); } } @@ -250,7 +246,7 @@ class PlgExtensionComponentbuilderExportCompiler extends CMSPlugin // only check if there are active if (ArrayHelper::check($this->componentsActive)) { - return in_array((int) CFactory::_('Config')->component_id, $this->componentsActive); + return in_array((int) Factory::_('Config')->component_id, $this->componentsActive); } return false; } diff --git a/componentbuilderexportcompiler.xml b/componentbuilderexportcompiler.xml index c5f0423..33e64bc 100644 --- a/componentbuilderexportcompiler.xml +++ b/componentbuilderexportcompiler.xml @@ -1,13 +1,13 @@ - + PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER - 9th March, 2024 + 11th 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 - 1.2.0 + 2.0.0 PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_XML_DESCRIPTION @@ -28,8 +28,8 @@ >
diff --git a/language/en-GB/en-GB.plg_extension_componentbuilderexportcompiler.ini b/language/en-GB/en-GB.plg_extension_componentbuilderexportcompiler.ini index 541b9c3..6988449 100644 --- a/language/en-GB/en-GB.plg_extension_componentbuilderexportcompiler.ini +++ b/language/en-GB/en-GB.plg_extension_componentbuilderexportcompiler.ini @@ -1,6 +1,6 @@ PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER="Extension - Componentbuilder Export Compiler" PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_DESCRIPTION="This plugin is used to tweak the export options for your components during compilation. To activate it you must first enable it here. Then open your JCB component global options, and under the Global tab, select this plugin in the Activate Compiler Plugins field.Also be sure to activate the component/s that should be targeted with this added export feature under the Component Activation tab." -PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_XML_DESCRIPTION="

Extension - Componentbuilder Export Compiler (v.1.2.0)

This plugin is used to tweak the export options for your components during compilation. To activate it you must first enable it here. Then open your JCB component global options, and under the Global tab, select this plugin in the Activate Compiler Plugins field.Also be sure to activate the component/s that should be targeted with this added export feature under the Component Activation tab.

Created by Llewellyn van der Merwe
Development started 21st August, 2019

" +PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_XML_DESCRIPTION="

Extension - Componentbuilder Export Compiler (v.2.0.0)

This plugin is used to tweak the export options for your components during compilation. To activate it you must first enable it here. Then open your JCB component global options, and under the Global tab, select this plugin in the Activate Compiler Plugins field.Also be sure to activate the component/s that should be targeted with this added export feature under the Component Activation tab.

Created by Llewellyn van der Merwe
Development started 10th March, 2024

" PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_SETTINGS="Settings" PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_ACTIVATE_OPTION_LABEL="Activate Options" PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_ACTIVATE_OPTION_DESCRIPTION="You can select the kind of activation control you would like to use. All will target all components, and Selected will let you select only those you want to be active." diff --git a/language/en-GB/en-GB.plg_extension_componentbuilderexportcompiler.sys.ini b/language/en-GB/en-GB.plg_extension_componentbuilderexportcompiler.sys.ini index 541b9c3..6988449 100644 --- a/language/en-GB/en-GB.plg_extension_componentbuilderexportcompiler.sys.ini +++ b/language/en-GB/en-GB.plg_extension_componentbuilderexportcompiler.sys.ini @@ -1,6 +1,6 @@ PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER="Extension - Componentbuilder Export Compiler" PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_DESCRIPTION="This plugin is used to tweak the export options for your components during compilation. To activate it you must first enable it here. Then open your JCB component global options, and under the Global tab, select this plugin in the Activate Compiler Plugins field.Also be sure to activate the component/s that should be targeted with this added export feature under the Component Activation tab." -PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_XML_DESCRIPTION="

Extension - Componentbuilder Export Compiler (v.1.2.0)

This plugin is used to tweak the export options for your components during compilation. To activate it you must first enable it here. Then open your JCB component global options, and under the Global tab, select this plugin in the Activate Compiler Plugins field.Also be sure to activate the component/s that should be targeted with this added export feature under the Component Activation tab.

Created by Llewellyn van der Merwe
Development started 21st August, 2019

" +PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_XML_DESCRIPTION="

Extension - Componentbuilder Export Compiler (v.2.0.0)

This plugin is used to tweak the export options for your components during compilation. To activate it you must first enable it here. Then open your JCB component global options, and under the Global tab, select this plugin in the Activate Compiler Plugins field.Also be sure to activate the component/s that should be targeted with this added export feature under the Component Activation tab.

Created by Llewellyn van der Merwe
Development started 10th March, 2024

" PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_SETTINGS="Settings" PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_ACTIVATE_OPTION_LABEL="Activate Options" PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_ACTIVATE_OPTION_DESCRIPTION="You can select the kind of activation control you would like to use. All will target all components, and Selected will let you select only those you want to be active." diff --git a/script.php b/script.php index d83dcbc..66d8a04 100644 --- a/script.php +++ b/script.php @@ -24,136 +24,4 @@ use Joomla\CMS\Filesystem\Folder; */ class plgExtensionComponentbuilderExportCompilerInstallerScript { - - /** - * Called before any type of action - * - * @param string $route Which action is happening (install|uninstall|discover_install|update) - * @param Joomla\CMS\Installer\InstallerAdapter $adapter The object responsible for running this script - * - * @return boolean True on success - */ - public function preflight($route, $adapter) - { - // get application - $app = Factory::getApplication(); - - // the default for both install and update - $jversion = new JVersion(); - if (!$jversion->isCompatible('3.8.0')) - { - $app->enqueueMessage('Please upgrade to at least Joomla! 3.8.0 before continuing!', 'error'); - return false; - } - - if ('install' === $route) - { -// needs fix - - - // check that componentbuilder is installed - $pathToCore = JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/componentbuilder.php'; - if (!JFile::exists($pathToCore)) - { - $app->enqueueMessage('Joomla Component Builder must first be installed from Joomla Component Builder.', 'error'); - return false; - } - - // load the helper class - JLoader::register('ComponentbuilderHelper', JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/componentbuilder.php'); - - // block install - $blockInstall = true; - - // check the version of JCB - $manifest = ComponentbuilderHelper::manifest(); - if (isset($manifest->version) && strpos($manifest->version, '.') !== false) - { - // get the version - $jcbVersion = explode('.', $manifest->version); - // check that we have JCB 3.0.0 or higher installed - if (count($jcbVersion) == 3 && $jcbVersion[0] >= 3 && - ( - ($jcbVersion[0] == 3 && $jcbVersion[1] == 0 && $jcbVersion[2] >= 0) || - ($jcbVersion[0] == 3 && $jcbVersion[1] > 0) || - $jcbVersion[0] > 3) - ) - { - $blockInstall = false; - } - } - - // allow install if all conditions are met - if ($blockInstall) - { - $app->enqueueMessage('Please upgrade to JCB v3.0.0 or higher before installing this plugin.', 'error'); - return false; - } - - - // check that componentbuilder is installed - $pathToCore = JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/componentbuilder.php'; - if (!JFile::exists($pathToCore)) - { - $app->enqueueMessage('Joomla Component Builder must first be installed from Joomla Component Builder.', 'error'); - return false; - } - // load the helper class - JLoader::register('ComponentbuilderHelper', JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/componentbuilder.php'); - // block install - $blockInstall = true; - // check the version of JCB - $manifest = ComponentbuilderHelper::manifest(); - if (isset($manifest->version) && strpos($manifest->version, '.') !== false) - { - // get the version - $jcbVersion = explode('.', $manifest->version); - // check that we have JCB 2.10.13 or higher installed - if (count($jcbVersion) == 3 && (($jcbVersion[0] == 2 && $jcbVersion[1] >= 10 && (($jcbVersion[1] == 10 && $jcbVersion[2] >= 13) || ($jcbVersion[1] > 10))) || $jcbVersion[0] >= 3)) - { - $blockInstall = false; - } - } - // allow install if all conditions are met - if ($blockInstall) - { - $app->enqueueMessage('Please upgrade to JCB 2.10.13 or higher before installing this plugin.', 'error'); - return false; - } - - // check that componentbuilder is installed - $pathToCore = JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/componentbuilder.php'; - if (!JFile::exists($pathToCore)) - { - $app->enqueueMessage('Joomla Component Builder must first be installed from Joomla Component Builder.', 'error'); - return false; - } - - // check that componentbuilder is installed - $pathToCore = JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/componentbuilder.php'; - if (!JFile::exists($pathToCore)) - { - $app->enqueueMessage('Joomla Component Builder must first be installed from Joomla Component Builder.', 'error'); - return false; - } - - // check that componentbuilder is installed - $pathToCore = JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/componentbuilder.php'; - if (!JFile::exists($pathToCore)) - { - $app->enqueueMessage('Joomla Component Builder must first be installed from Joomla Component Builder.', 'error'); - return false; - } - - // check that componentbuilder is installed - $pathToCore = JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/componentbuilder.php'; - if (!JFile::exists($pathToCore)) - { - $app->enqueueMessage('Joomla Component Builder must first be installed from Joomla Component Builder.', 'error'); - return false; - } - } - - return true; - } }