From 758273455acbe242e08c22987366832a76684aa0 Mon Sep 17 00:00:00 2001 From: aB0t Date: Wed, 18 Oct 2023 09:28:04 +0200 Subject: [PATCH] Release of v2.2.5 --- componentbuilderheaderscompiler.php | 59 ++++++++++++------- componentbuilderheaderscompiler.xml | 4 +- ...ension_componentbuilderheaderscompiler.ini | 2 +- ...on_componentbuilderheaderscompiler.sys.ini | 2 +- 4 files changed, 41 insertions(+), 26 deletions(-) diff --git a/componentbuilderheaderscompiler.php b/componentbuilderheaderscompiler.php index e3b2271..ed80cc3 100644 --- a/componentbuilderheaderscompiler.php +++ b/componentbuilderheaderscompiler.php @@ -14,7 +14,11 @@ defined('_JEXEC') or die('Restricted access'); use Joomla\CMS\Application\CMSApplication; use Joomla\CMS\Plugin\CMSPlugin; -use Joomla\Registry\Registry; +use Joomla\Registry\Registry; +use VDM\Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Utilities\JsonHelper; +use VDM\Joomla\Utilities\StringHelper; +use VDM\Joomla\Utilities\String\NamespaceHelper; JLoader::register('ComponentbuilderHelper', JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/componentbuilder.php'); @@ -24,7 +28,7 @@ use VDM\Joomla\Componentbuilder\Compiler\Factory as CFactory; * Extension - Componentbuilder Headers Compiler plugin. * * @package ComponentbuilderHeadersCompiler - * @since 2.2.3 + * @since 2.2.5 */ class PlgExtensionComponentbuilderHeadersCompiler extends CMSPlugin { @@ -499,7 +503,7 @@ class PlgExtensionComponentbuilderHeadersCompiler extends CMSPlugin public function jcb_ce_onAfterGetComponentData(&$context, $compiler) { // add the powers to the component - if (ComponentbuilderHelper::checkArray($this->linkedPowers, true)) + if (ArrayHelper::check($this->linkedPowers, true)) { $compiler->linkedPowers = $this->linkedPowers; } @@ -515,10 +519,10 @@ class PlgExtensionComponentbuilderHeadersCompiler extends CMSPlugin protected function setHeaders(&$params, &$obj, $key) { // add the headers - $params = (ComponentbuilderHelper::checkJson($params)) ? json_decode($params, true) : $params; + $params = (JsonHelper::check($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])) + if (ArrayHelper::check($params) && isset($params[$key]) + && ArrayHelper::check($params[$key])) { foreach ($this->targets[$key] as $target => $event) { @@ -549,10 +553,10 @@ class PlgExtensionComponentbuilderHeadersCompiler extends CMSPlugin protected function setDynamicHeaders($params, $code, $key) { // add the headers - $params = (ComponentbuilderHelper::checkJson($params)) ? json_decode($params, true) : $params; + $params = (JsonHelper::check($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])) + if (ArrayHelper::check($params) && isset($params[$key]) + && ArrayHelper::check($params[$key])) { foreach ($this->targets[$key] as $target => $event) { @@ -586,8 +590,8 @@ class PlgExtensionComponentbuilderHeadersCompiler extends CMSPlugin $headers = []; // load the headers if power - if (isset($params['power_' . $get['field']]) && ComponentbuilderHelper::checkArray($params['power_' . $get['field']], true) - && ($powers = $this->getPowers($params['power_' . $get['field']])) !== false) + if (isset($params['power_' . $get['field']]) && ArrayHelper::check($params['power_' . $get['field']], true) + && ($powers = $this->getPowers($params['power_' . $get['field']])) !== null) { foreach ($powers as $power) { @@ -597,9 +601,9 @@ class PlgExtensionComponentbuilderHeadersCompiler extends CMSPlugin } // load the headers if text - if (isset($params[$get['field']]) && ComponentbuilderHelper::checkString($params[$get['field']])) + if (isset($params[$get['field']]) && StringHelper::check($params[$get['field']])) { - if (($_headers = explode(PHP_EOL, $params[$get['field']])) !== false) + if (($_headers = explode(PHP_EOL, $params[$get['field']]))) { foreach ($_headers as $header) { @@ -614,7 +618,7 @@ class PlgExtensionComponentbuilderHeadersCompiler extends CMSPlugin } // check if we found some header values - if (ComponentbuilderHelper::checkArray($headers, true)) + if (ArrayHelper::check($headers, true)) { // activate the load of the headers $this->loadHeaders = true; @@ -650,7 +654,7 @@ class PlgExtensionComponentbuilderHeadersCompiler extends CMSPlugin } elseif (isset($view->{$get})) { - return ComponentbuilderHelper::safeString( + return StringHelper::safe( $view->{$get} ); } @@ -670,11 +674,22 @@ class PlgExtensionComponentbuilderHeadersCompiler extends CMSPlugin $powers = array_filter( // get the power namespace array_map(function ($row) { - if (($power = ComponentbuilderHelper::getGUID($row['power'], 'power', ['a.guid', 'a.namespace'])) !== false) + if (($power = ComponentbuilderHelper::getGUID($row['power'], 'power', ['a.guid', 'a.namespace'])) !== null) { - $power->build = (int) $row['build']; - $power->as = (string) $row['as']; - return $power; + $power->build = (int) $row['build']; + $power->as = (string) $row['as']; + + return $power; + } + elseif (CFactory::_('Superpower')->load($row['power'], ['remote'])) + { + if (($power = ComponentbuilderHelper::getGUID($row['power'], 'power', ['a.guid', 'a.namespace'])) !== null) + { + $power->build = (int) $row['build']; + $power->as = (string) $row['as']; + + return $power; + } } return false; }, $rows), @@ -684,7 +699,7 @@ class PlgExtensionComponentbuilderHeadersCompiler extends CMSPlugin } ); // add to active powers - if (ComponentbuilderHelper::checkArray($powers)) + if (ArrayHelper::check($powers)) { // convert the dots to namespace return array_map(function ($power) { @@ -698,7 +713,7 @@ class PlgExtensionComponentbuilderHeadersCompiler extends CMSPlugin } } // build the namespace - $namespace = ComponentbuilderHelper::safeNamespace( + $namespace = NamespaceHelper::safe( str_replace( array_keys($this->placeholders), array_values($this->placeholders), @@ -706,7 +721,7 @@ class PlgExtensionComponentbuilderHeadersCompiler extends CMSPlugin ) ); // check if it has an AS option - if (ComponentbuilderHelper::checkString($power->as) && $power->as !== 'default') + if (StringHelper::check($power->as) && $power->as !== 'default') { return 'use ' . $namespace . ' as ' . $power->as . ';'; } diff --git a/componentbuilderheaderscompiler.xml b/componentbuilderheaderscompiler.xml index 59c8dca..826668b 100644 --- a/componentbuilderheaderscompiler.xml +++ b/componentbuilderheaderscompiler.xml @@ -1,13 +1,13 @@ PLG_EXTENSION_COMPONENTBUILDERHEADERSCOMPILER - 2nd May, 2023 + 18th October, 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 - 2.2.3 + 2.2.5 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 7c67376..f3109e2 100644 --- a/language/en-GB/en-GB.plg_extension_componentbuilderheaderscompiler.ini +++ b/language/en-GB/en-GB.plg_extension_componentbuilderheaderscompiler.ini @@ -1,3 +1,3 @@ PLG_EXTENSION_COMPONENTBUILDERHEADERSCOMPILER="Extension - Componentbuilder Headers Compiler" 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.2.2.3)

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 +PLG_EXTENSION_COMPONENTBUILDERHEADERSCOMPILER_XML_DESCRIPTION="

Extension - Componentbuilder Headers Compiler (v.2.2.5)

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 7c67376..f3109e2 100644 --- a/language/en-GB/en-GB.plg_extension_componentbuilderheaderscompiler.sys.ini +++ b/language/en-GB/en-GB.plg_extension_componentbuilderheaderscompiler.sys.ini @@ -1,3 +1,3 @@ PLG_EXTENSION_COMPONENTBUILDERHEADERSCOMPILER="Extension - Componentbuilder Headers Compiler" 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.2.2.3)

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 +PLG_EXTENSION_COMPONENTBUILDERHEADERSCOMPILER_XML_DESCRIPTION="

Extension - Componentbuilder Headers Compiler (v.2.2.5)

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