From c6b1bcbcc06b1a32c0027fda1d9e09b6bcd3d5ed Mon Sep 17 00:00:00 2001 From: aB0t Date: Sat, 2 Mar 2024 22:06:24 +0200 Subject: [PATCH] Release of v1.2.0 --- componentbuilderexportcompiler.php | 38 +++++++++---------- componentbuilderexportcompiler.xml | 6 +-- ...tension_componentbuilderexportcompiler.ini | 2 +- ...ion_componentbuilderexportcompiler.sys.ini | 2 +- script.php | 7 +++- 5 files changed, 29 insertions(+), 26 deletions(-) diff --git a/componentbuilderexportcompiler.php b/componentbuilderexportcompiler.php index 1bab9e7..55e77f6 100644 --- a/componentbuilderexportcompiler.php +++ b/componentbuilderexportcompiler.php @@ -26,7 +26,7 @@ use VDM\Joomla\Componentbuilder\Compiler\Utilities\Line; * Extension - Componentbuilder Export Compiler plugin. * * @package ComponentbuilderExportCompiler - * @since 1.1.2 + * @since 1.2.0 */ class PlgExtensionComponentbuilderExportCompiler extends CMSPlugin { @@ -51,7 +51,7 @@ class PlgExtensionComponentbuilderExportCompiler extends CMSPlugin * * @var array */ - protected $languageArray = array(); + protected $languageArray = []; /* * The Export Text Only switch @@ -63,9 +63,9 @@ class PlgExtensionComponentbuilderExportCompiler extends CMSPlugin /* * The Strict Field Export Permissions switch * - * @var int + * @var bool */ - protected $strictFieldExportPermissions = 0; + protected $strictFieldExportPermissions = false; /** * Event Triggered in the compiler [on Before Get Component Data] @@ -74,15 +74,15 @@ class PlgExtensionComponentbuilderExportCompiler extends CMSPlugin * * @since 1.0 */ - public function jcb_ce_onAfterGetComponentData(&$context, $compiler) + public function jcb_ce_onAfterGetComponentData() { - if ($this->exportTextOnly && $this->componentActive($context)) + if ($this->exportTextOnly && $this->componentActive()) { // activate export text only - $compiler->exportTextOnly = $this->exportTextOnly; + CFactory::_('Config')->set('export_text_only', (int) $this->exportTextOnly); // activate strict_permission_per_field if set in plugin (default true) - $compiler->strictFieldExportPermissions = $this->strictFieldExportPermissions; + CFactory::_('Config')->set('permission_strict_per_field', (bool) $this->strictFieldExportPermissions); } } @@ -93,10 +93,10 @@ class PlgExtensionComponentbuilderExportCompiler extends CMSPlugin * * @since 1.0 */ - public function jcb_ce_onAfterModelComponentData(&$context, &$component) + public function jcb_ce_onAfterModelComponentData(&$component) { // check if we have export for any view - if ($this->componentActive($context)) + if ($this->componentActive()) { // set the export/import option if (isset($component->admin_views) && ArrayHelper::check($component->admin_views)) @@ -106,7 +106,7 @@ class PlgExtensionComponentbuilderExportCompiler extends CMSPlugin if (!$this->exportTextOnly && (isset($view['port']) && $view['port'] || 1 == $view['settings']->add_custom_import)) { $this->exportTextOnly = 1; - $this->strictFieldExportPermissions = $this->params->get('strict_permission_per_field', 1); + $this->strictFieldExportPermissions = (bool) $this->params->get('strict_permission_per_field', 1); } } } @@ -120,9 +120,9 @@ class PlgExtensionComponentbuilderExportCompiler extends CMSPlugin * * @since 1.0 */ - public function jcb_ce_onBeforeSetLangFileData(&$context, $compiler) + public function jcb_ce_onBeforeSetLangFileData() { - if ($this->exportTextOnly && $this->componentActive($context) && ArrayHelper::check($this->languageArray)) + if ($this->exportTextOnly && $this->componentActive() && ArrayHelper::check($this->languageArray)) { foreach($this->languageArray as $key => $string) { @@ -138,10 +138,10 @@ class PlgExtensionComponentbuilderExportCompiler extends CMSPlugin * * @since 1.0 */ - public function jcb_ce_onBeforeSetConfigFieldsets(&$context, &$timer, &$configFieldSets, &$configFieldSetsCustomField, &$componentDataConfig, &$extensionsParams, &$placeholders) + public function jcb_ce_onBeforeSetConfigFieldsets(&$timer) { // only add fields after second time - if ($this->exportTextOnly && $this->componentActive($context) && $timer == 2) + if ($this->exportTextOnly && $this->componentActive() && $timer == 2) { // main lang prefix $lang = CFactory::_('Config')->lang_prefix . '_CONFIG'; @@ -154,7 +154,7 @@ class PlgExtensionComponentbuilderExportCompiler extends CMSPlugin $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."; // add custom Export Options - if (isset($configFieldSetsCustomField['Export Options']) && ComponentbuilderHelper::checkArray($configFieldSetsCustomField['Export Options'])) + if (isset($configFieldSetsCustomField['Export Options']) && ArrayHelper::check($configFieldSetsCustomField['Export Options'])) { $configFieldSets[] = implode("", $configFieldSetsCustomField['Export Options']); unset($configFieldSetsCustomField['Export Options']); @@ -227,12 +227,10 @@ class PlgExtensionComponentbuilderExportCompiler extends CMSPlugin /** * Set the line number in comments * - * @param string $context The context of the current executing component - * * @return bool * */ - protected function componentActive(&$context) + protected function componentActive() { // check the active option if (!$this->activateOption) @@ -252,7 +250,7 @@ class PlgExtensionComponentbuilderExportCompiler extends CMSPlugin // only check if there are active if (ArrayHelper::check($this->componentsActive)) { - return in_array((int) filter_var($context, FILTER_SANITIZE_NUMBER_INT), $this->componentsActive); + return in_array((int) CFactory::_('Config')->component_id, $this->componentsActive); } return false; } diff --git a/componentbuilderexportcompiler.xml b/componentbuilderexportcompiler.xml index bfd4d13..4abca38 100644 --- a/componentbuilderexportcompiler.xml +++ b/componentbuilderexportcompiler.xml @@ -1,13 +1,13 @@ - + PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER - 24th October, 2023 + 2nd 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.1.2 + 1.2.0 PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_XML_DESCRIPTION diff --git a/language/en-GB/en-GB.plg_extension_componentbuilderexportcompiler.ini b/language/en-GB/en-GB.plg_extension_componentbuilderexportcompiler.ini index 8c18a45..541b9c3 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.1.2)

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.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_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 8c18a45..541b9c3 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.1.2)

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.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_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 257fe9c..d83dcbc 100644 --- a/script.php +++ b/script.php @@ -12,6 +12,11 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Filesystem\File; +use Joomla\CMS\Filesystem\Folder; + /** * Extension - Componentbuilder Export Compiler script file. * @@ -31,7 +36,7 @@ class plgExtensionComponentbuilderExportCompilerInstallerScript public function preflight($route, $adapter) { // get application - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // the default for both install and update $jversion = new JVersion();