diff --git a/componentbuilderexportcompiler.php b/componentbuilderexportcompiler.php index f1e740d..f94f99e 100644 --- a/componentbuilderexportcompiler.php +++ b/componentbuilderexportcompiler.php @@ -15,12 +15,16 @@ defined('_JEXEC') or die('Restricted access'); use Joomla\CMS\Application\CMSApplication; use Joomla\CMS\Plugin\CMSPlugin; -JLoader::register('ComponentbuilderHelper', JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/componentbuilder.php'); +JLoader::register('ComponentbuilderHelper', JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/componentbuilder.php'); + +use VDM\Joomla\Componentbuilder\Compiler\Utilities\Indent; +use VDM\Joomla\Componentbuilder\Compiler\Utilities\Line; + /** * Extension - Componentbuilder Export Compiler plugin. * * @package ComponentbuilderExportCompiler - * @since 1.0.2 + * @since 1.1.0 */ class PlgExtensionComponentbuilderExportCompiler extends CMSPlugin { @@ -47,34 +51,6 @@ class PlgExtensionComponentbuilderExportCompiler extends CMSPlugin */ protected $languageArray = array(); - /** - * The hash placeholder - * - * @var string - */ - protected $hhh = '#' . '#' . '#'; - - /** - * The open bracket placeholder - * - * @var string - */ - protected $bbb = '[' . '[' . '['; - - /** - * The close bracket placeholder - * - * @var string - */ - protected $ddd = ']' . ']' . ']'; - - /** - * The line numbers Switch - * - * @var boolean - */ - protected $debugLinenr = false; - /* * The lang prefix * @@ -107,15 +83,9 @@ class PlgExtensionComponentbuilderExportCompiler extends CMSPlugin { if ($this->exportTextOnly && $this->componentActive($context)) { - // sync needed compiler properties with this plugin class - $this->debugLinenr = $compiler->debugLinenr; - $this->hhh = $compiler->hhh; - $this->bbb = $compiler->bbb; - $this->ddd = $compiler->ddd; - $this->langPrefix = $compiler->langPrefix; - // activate export text only $compiler->exportTextOnly = $this->exportTextOnly; + // activate strict_permission_per_field if set in plugin (default true) $compiler->strictFieldExportPermissions = $this->strictFieldExportPermissions; } @@ -181,10 +151,10 @@ class PlgExtensionComponentbuilderExportCompiler extends CMSPlugin // main lang prefix $lang = $this->langPrefix . '_CONFIG'; // start building field set for config - $configFieldSets[] = $this->_t(1) . "_t(2) . 'name="export_text_only_config"'; - $configFieldSets[] = $this->_t(2) . 'label="' . $lang . '_EXPORT_TEXT_ONLY_TAB_LABEL"'; - $configFieldSets[] = $this->_t(2) . 'description="' . $lang . '_EXPORT_TEXT_ONLY_TAB_DESCRIPTION">'; + $configFieldSets[] = Indent::_(1) . "'; // 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."; @@ -202,20 +172,20 @@ class PlgExtensionComponentbuilderExportCompiler extends CMSPlugin $this->languageArray[$lang . '_ACTIVATE'] = "Activate"; $this->languageArray[$lang . '_DEACTIVATE'] = "Deactivate"; - $configFieldSets[] = PHP_EOL . $this->_t(2) . ""; - $configFieldSets[] = $this->_t(2) . "_t(3) . "type=\"radio\""; - $configFieldSets[] = $this->_t(3) . "name=\"export_text_only\""; - $configFieldSets[] = $this->_t(3) . "label=\"" . $lang . "_EXPORT_TEXT_ONLY_LABEL\""; - $configFieldSets[] = $this->_t(3) . "description=\"" . $lang . "_EXPORT_TEXT_ONLY_DESCRIPTION\""; - $configFieldSets[] = $this->_t(3) . "class=\"btn-group btn-group-yesno\""; - $configFieldSets[] = $this->_t(3) . "default=\"0\">"; - $configFieldSets[] = $this->_t(3) . ""; - $configFieldSets[] = $this->_t(3) . ""; - $configFieldSets[] = $this->_t(3) . ""; - $configFieldSets[] = $this->_t(2) . ""; + $configFieldSets[] = PHP_EOL . Indent::_(2) . ""; + $configFieldSets[] = Indent::_(2) . ""; + $configFieldSets[] = Indent::_(3) . ""; + $configFieldSets[] = Indent::_(3) . ""; + $configFieldSets[] = Indent::_(3) . ""; + $configFieldSets[] = Indent::_(2) . ""; // add strict Field Export Permissions field if ($this->strictFieldExportPermissions) @@ -223,57 +193,27 @@ 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 . $this->_t(2) . ""; - $configFieldSets[] = $this->_t(2) . "_t(3) . "type=\"radio\""; - $configFieldSets[] = $this->_t(3) . "name=\"strict_permission_per_field\""; - $configFieldSets[] = $this->_t(3) . "label=\"" . $lang . "_STRICT_PERMISSION_PER_FIELD_LABEL\""; - $configFieldSets[] = $this->_t(3) . "description=\"" . $lang . "_STRICT_PERMISSION_PER_FIELD_DESCRIPTION\""; - $configFieldSets[] = $this->_t(3) . "class=\"btn-group btn-group-yesno\""; - $configFieldSets[] = $this->_t(3) . "default=\"1\">"; - $configFieldSets[] = $this->_t(3) . ""; - $configFieldSets[] = $this->_t(3) . ""; - $configFieldSets[] = $this->_t(3) . ""; - $configFieldSets[] = $this->_t(2) . ""; + $configFieldSets[] = PHP_EOL . Indent::_(2) . ""; + $configFieldSets[] = Indent::_(2) . ""; + $configFieldSets[] = Indent::_(3) . ""; + $configFieldSets[] = Indent::_(3) . ""; + $configFieldSets[] = Indent::_(3) . ""; + $configFieldSets[] = Indent::_(2) . ""; } } // close that fieldset - $configFieldSets[] = $this->_t(1) . ""; + $configFieldSets[] = Indent::_(1) . ""; } } - /** - * Set the line number in comments - * - * @param int $nr The line number - * - * @return void - * - */ - protected function setLine($nr) - { - if ($this->debugLinenr) - { - return ' [Plugin-Privacy-Compiler ' . $nr . ']'; - } - return ''; - } - - /** - * Set the tab/space - * - * @param int $nr The number of tag/space - * - * @return string - * - */ - protected function _t($nr) - { - // use global method for conformity - return ComponentbuilderHelper::_t($nr); - } /** * The array of active components diff --git a/componentbuilderexportcompiler.xml b/componentbuilderexportcompiler.xml index ec07e17..548d8da 100644 --- a/componentbuilderexportcompiler.xml +++ b/componentbuilderexportcompiler.xml @@ -1,13 +1,13 @@ PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER - 13th November, 2022 + 5th February, 2023 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.0.2 + 1.1.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 e4697b5..e9765af 100644 --- a/language/en-GB/en-GB.plg_extension_componentbuilderexportcompiler.ini +++ b/language/en-GB/en-GB.plg_extension_componentbuilderexportcompiler.ini @@ -1,7 +1,7 @@ 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.0.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. +PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_XML_DESCRIPTION="

Extension - Componentbuilder Export Compiler (v.1.1.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" 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 e4697b5..e9765af 100644 --- a/language/en-GB/en-GB.plg_extension_componentbuilderexportcompiler.sys.ini +++ b/language/en-GB/en-GB.plg_extension_componentbuilderexportcompiler.sys.ini @@ -1,7 +1,7 @@ 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.0.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. +PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_XML_DESCRIPTION="

Extension - Componentbuilder Export Compiler (v.1.1.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"