From 95c30c14144d08ed1deaf816c79186197f0fdd35 Mon Sep 17 00:00:00 2001 From: Llewellyn van der Merwe Date: Mon, 10 Jan 2022 16:47:57 +0200 Subject: [PATCH] update - v1.0.10 --- componentbuilderheaderscompiler.php | 50 ++++++++++++++++++- componentbuilderheaderscompiler.xml | 2 +- ...ension_componentbuilderheaderscompiler.ini | 2 +- ...on_componentbuilderheaderscompiler.sys.ini | 2 +- 4 files changed, 52 insertions(+), 4 deletions(-) diff --git a/componentbuilderheaderscompiler.php b/componentbuilderheaderscompiler.php index 9aa6142..2da5d69 100644 --- a/componentbuilderheaderscompiler.php +++ b/componentbuilderheaderscompiler.php @@ -22,7 +22,7 @@ JLoader::register('ComponentbuilderHelper', JPATH_ADMINISTRATOR . '/components/c * Extension - Componentbuilder Headers Compiler plugin. * * @package ComponentbuilderHeadersCompiler - * @since 1.0.9 + * @since 1.0.10 */ class PlgExtensionComponentbuilderHeadersCompiler extends CMSPlugin { @@ -391,6 +391,23 @@ class PlgExtensionComponentbuilderHeadersCompiler extends CMSPlugin } } + /** + * Event Triggered in the compiler [on Before Model Dynamic Get Data] + * + * @return void + * + * @since 1.0.10 + */ + public function jcb_ce_onBeforeModelDynamicGetData(&$context, &$dynamicGet, &$id, &$code, &$area) + { + // check that the params are set + if (isset($dynamicGet->params)) + { + // add the headers for the Site Views + $this->setDynamicHeaders($dynamicGet->params, $code, 'dynamic_get_headers'); + } + } + /** * Event Triggered in the compiler [on Before Model Component Data] * @@ -512,6 +529,37 @@ class PlgExtensionComponentbuilderHeadersCompiler extends CMSPlugin } } + /** + * set the dynamic get headers + * + * @return void + * + * @since 1.0.10 + */ + protected function setDynamicHeaders($params, $code, $key) + { + // add the headers + $params = (ComponentbuilderHelper::checkJson($params)) ? json_decode($params, true) : $params; + // make sure we have the keys values in the params area + if (ComponentbuilderHelper::checkArray($params) && isset($params[$key]) + && ComponentbuilderHelper::checkArray($params[$key])) + { + foreach ($this->targets[$key] as $target => $event) + { + if (isset($params[$key][$target]) + && $params[$key][$target] == 1) + { + // get the header string if set + $this->getHeaders( + $params[$key], + $event, + $code + ); + } + } + } + } + /** * get the headers * diff --git a/componentbuilderheaderscompiler.xml b/componentbuilderheaderscompiler.xml index 3481a54..4b0fec2 100644 --- a/componentbuilderheaderscompiler.xml +++ b/componentbuilderheaderscompiler.xml @@ -7,7 +7,7 @@ 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.9 + 1.0.10 PLG_EXTENSION_COMPONENTBUILDERHEADERSCOMPILER_XML_DESCRIPTION diff --git a/language/en-GB/en-GB.plg_extension_componentbuilderheaderscompiler.ini b/language/en-GB/en-GB.plg_extension_componentbuilderheaderscompiler.ini index a0c4450..2c983a3 100644 --- a/language/en-GB/en-GB.plg_extension_componentbuilderheaderscompiler.ini +++ b/language/en-GB/en-GB.plg_extension_componentbuilderheaderscompiler.ini @@ -2,6 +2,6 @@ PLG_EXTENSION_COMPONENTBUILDERHEADERSCOMPILER="Extension - Componentbuilder Head PLG_EXTENSION_COMPONENTBUILDERHEADERSCOMPILER_DESCRIPTION="This plugin is used to set the custom headers for your classes 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 set your code where you would like to set Custom Headers." -PLG_EXTENSION_COMPONENTBUILDERHEADERSCOMPILER_XML_DESCRIPTION="

Extension - Componentbuilder Headers Compiler (v.1.0.9)

This plugin is used to set the custom headers for your classes 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_COMPONENTBUILDERHEADERSCOMPILER_XML_DESCRIPTION="

Extension - Componentbuilder Headers Compiler (v.1.0.10)

This plugin is used to set the custom headers for your classes 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 set your code where you would like to set Custom Headers.

Created by Llewellyn van der Merwe
Development started 24th May, 2020

" \ No newline at end of file diff --git a/language/en-GB/en-GB.plg_extension_componentbuilderheaderscompiler.sys.ini b/language/en-GB/en-GB.plg_extension_componentbuilderheaderscompiler.sys.ini index a0c4450..2c983a3 100644 --- a/language/en-GB/en-GB.plg_extension_componentbuilderheaderscompiler.sys.ini +++ b/language/en-GB/en-GB.plg_extension_componentbuilderheaderscompiler.sys.ini @@ -2,6 +2,6 @@ PLG_EXTENSION_COMPONENTBUILDERHEADERSCOMPILER="Extension - Componentbuilder Head PLG_EXTENSION_COMPONENTBUILDERHEADERSCOMPILER_DESCRIPTION="This plugin is used to set the custom headers for your classes 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 set your code where you would like to set Custom Headers." -PLG_EXTENSION_COMPONENTBUILDERHEADERSCOMPILER_XML_DESCRIPTION="

Extension - Componentbuilder Headers Compiler (v.1.0.9)

This plugin is used to set the custom headers for your classes 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_COMPONENTBUILDERHEADERSCOMPILER_XML_DESCRIPTION="

Extension - Componentbuilder Headers Compiler (v.1.0.10)

This plugin is used to set the custom headers for your classes 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 set your code where you would like to set Custom Headers.

Created by Llewellyn van der Merwe
Development started 24th May, 2020

" \ No newline at end of file