Release of v2.2.5
This commit is contained in:
parent
f9ab1fbfbe
commit
758273455a
@ -15,6 +15,10 @@ defined('_JEXEC') or die('Restricted access');
|
|||||||
use Joomla\CMS\Application\CMSApplication;
|
use Joomla\CMS\Application\CMSApplication;
|
||||||
use Joomla\CMS\Plugin\CMSPlugin;
|
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');
|
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.
|
* Extension - Componentbuilder Headers Compiler plugin.
|
||||||
*
|
*
|
||||||
* @package ComponentbuilderHeadersCompiler
|
* @package ComponentbuilderHeadersCompiler
|
||||||
* @since 2.2.3
|
* @since 2.2.5
|
||||||
*/
|
*/
|
||||||
class PlgExtensionComponentbuilderHeadersCompiler extends CMSPlugin
|
class PlgExtensionComponentbuilderHeadersCompiler extends CMSPlugin
|
||||||
{
|
{
|
||||||
@ -499,7 +503,7 @@ class PlgExtensionComponentbuilderHeadersCompiler extends CMSPlugin
|
|||||||
public function jcb_ce_onAfterGetComponentData(&$context, $compiler)
|
public function jcb_ce_onAfterGetComponentData(&$context, $compiler)
|
||||||
{
|
{
|
||||||
// add the powers to the component
|
// add the powers to the component
|
||||||
if (ComponentbuilderHelper::checkArray($this->linkedPowers, true))
|
if (ArrayHelper::check($this->linkedPowers, true))
|
||||||
{
|
{
|
||||||
$compiler->linkedPowers = $this->linkedPowers;
|
$compiler->linkedPowers = $this->linkedPowers;
|
||||||
}
|
}
|
||||||
@ -515,10 +519,10 @@ class PlgExtensionComponentbuilderHeadersCompiler extends CMSPlugin
|
|||||||
protected function setHeaders(&$params, &$obj, $key)
|
protected function setHeaders(&$params, &$obj, $key)
|
||||||
{
|
{
|
||||||
// add the headers
|
// 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
|
// make sure we have the keys values in the params area
|
||||||
if (ComponentbuilderHelper::checkArray($params) && isset($params[$key])
|
if (ArrayHelper::check($params) && isset($params[$key])
|
||||||
&& ComponentbuilderHelper::checkArray($params[$key]))
|
&& ArrayHelper::check($params[$key]))
|
||||||
{
|
{
|
||||||
foreach ($this->targets[$key] as $target => $event)
|
foreach ($this->targets[$key] as $target => $event)
|
||||||
{
|
{
|
||||||
@ -549,10 +553,10 @@ class PlgExtensionComponentbuilderHeadersCompiler extends CMSPlugin
|
|||||||
protected function setDynamicHeaders($params, $code, $key)
|
protected function setDynamicHeaders($params, $code, $key)
|
||||||
{
|
{
|
||||||
// add the headers
|
// 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
|
// make sure we have the keys values in the params area
|
||||||
if (ComponentbuilderHelper::checkArray($params) && isset($params[$key])
|
if (ArrayHelper::check($params) && isset($params[$key])
|
||||||
&& ComponentbuilderHelper::checkArray($params[$key]))
|
&& ArrayHelper::check($params[$key]))
|
||||||
{
|
{
|
||||||
foreach ($this->targets[$key] as $target => $event)
|
foreach ($this->targets[$key] as $target => $event)
|
||||||
{
|
{
|
||||||
@ -586,8 +590,8 @@ class PlgExtensionComponentbuilderHeadersCompiler extends CMSPlugin
|
|||||||
$headers = [];
|
$headers = [];
|
||||||
|
|
||||||
// load the headers if power
|
// load the headers if power
|
||||||
if (isset($params['power_' . $get['field']]) && ComponentbuilderHelper::checkArray($params['power_' . $get['field']], true)
|
if (isset($params['power_' . $get['field']]) && ArrayHelper::check($params['power_' . $get['field']], true)
|
||||||
&& ($powers = $this->getPowers($params['power_' . $get['field']])) !== false)
|
&& ($powers = $this->getPowers($params['power_' . $get['field']])) !== null)
|
||||||
{
|
{
|
||||||
foreach ($powers as $power)
|
foreach ($powers as $power)
|
||||||
{
|
{
|
||||||
@ -597,9 +601,9 @@ class PlgExtensionComponentbuilderHeadersCompiler extends CMSPlugin
|
|||||||
}
|
}
|
||||||
|
|
||||||
// load the headers if text
|
// 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)
|
foreach ($_headers as $header)
|
||||||
{
|
{
|
||||||
@ -614,7 +618,7 @@ class PlgExtensionComponentbuilderHeadersCompiler extends CMSPlugin
|
|||||||
}
|
}
|
||||||
|
|
||||||
// check if we found some header values
|
// check if we found some header values
|
||||||
if (ComponentbuilderHelper::checkArray($headers, true))
|
if (ArrayHelper::check($headers, true))
|
||||||
{
|
{
|
||||||
// activate the load of the headers
|
// activate the load of the headers
|
||||||
$this->loadHeaders = true;
|
$this->loadHeaders = true;
|
||||||
@ -650,7 +654,7 @@ class PlgExtensionComponentbuilderHeadersCompiler extends CMSPlugin
|
|||||||
}
|
}
|
||||||
elseif (isset($view->{$get}))
|
elseif (isset($view->{$get}))
|
||||||
{
|
{
|
||||||
return ComponentbuilderHelper::safeString(
|
return StringHelper::safe(
|
||||||
$view->{$get}
|
$view->{$get}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -670,12 +674,23 @@ class PlgExtensionComponentbuilderHeadersCompiler extends CMSPlugin
|
|||||||
$powers = array_filter(
|
$powers = array_filter(
|
||||||
// get the power namespace
|
// get the power namespace
|
||||||
array_map(function ($row) {
|
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->build = (int) $row['build'];
|
||||||
$power->as = (string) $row['as'];
|
$power->as = (string) $row['as'];
|
||||||
|
|
||||||
return $power;
|
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;
|
return false;
|
||||||
}, $rows),
|
}, $rows),
|
||||||
// check that we have valid powers
|
// check that we have valid powers
|
||||||
@ -684,7 +699,7 @@ class PlgExtensionComponentbuilderHeadersCompiler extends CMSPlugin
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
// add to active powers
|
// add to active powers
|
||||||
if (ComponentbuilderHelper::checkArray($powers))
|
if (ArrayHelper::check($powers))
|
||||||
{
|
{
|
||||||
// convert the dots to namespace
|
// convert the dots to namespace
|
||||||
return array_map(function ($power) {
|
return array_map(function ($power) {
|
||||||
@ -698,7 +713,7 @@ class PlgExtensionComponentbuilderHeadersCompiler extends CMSPlugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// build the namespace
|
// build the namespace
|
||||||
$namespace = ComponentbuilderHelper::safeNamespace(
|
$namespace = NamespaceHelper::safe(
|
||||||
str_replace(
|
str_replace(
|
||||||
array_keys($this->placeholders),
|
array_keys($this->placeholders),
|
||||||
array_values($this->placeholders),
|
array_values($this->placeholders),
|
||||||
@ -706,7 +721,7 @@ class PlgExtensionComponentbuilderHeadersCompiler extends CMSPlugin
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
// check if it has an AS option
|
// 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 . ';';
|
return 'use ' . $namespace . ' as ' . $power->as . ';';
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<extension type="plugin" version="4" group="extension" method="upgrade">
|
<extension type="plugin" version="4" group="extension" method="upgrade">
|
||||||
<name>PLG_EXTENSION_COMPONENTBUILDERHEADERSCOMPILER</name>
|
<name>PLG_EXTENSION_COMPONENTBUILDERHEADERSCOMPILER</name>
|
||||||
<creationDate>2nd May, 2023</creationDate>
|
<creationDate>18th October, 2023</creationDate>
|
||||||
<author>Llewellyn van der Merwe</author>
|
<author>Llewellyn van der Merwe</author>
|
||||||
<authorEmail>joomla@vdm.io</authorEmail>
|
<authorEmail>joomla@vdm.io</authorEmail>
|
||||||
<authorUrl>https://dev.vdm.io</authorUrl>
|
<authorUrl>https://dev.vdm.io</authorUrl>
|
||||||
<copyright>Copyright (C) 2015 Vast Development Method. All rights reserved.</copyright>
|
<copyright>Copyright (C) 2015 Vast Development Method. All rights reserved.</copyright>
|
||||||
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
|
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
|
||||||
<version>2.2.3</version>
|
<version>2.2.5</version>
|
||||||
<description>PLG_EXTENSION_COMPONENTBUILDERHEADERSCOMPILER_XML_DESCRIPTION</description>
|
<description>PLG_EXTENSION_COMPONENTBUILDERHEADERSCOMPILER_XML_DESCRIPTION</description>
|
||||||
|
|
||||||
<!-- Scripts to run on installation -->
|
<!-- Scripts to run on installation -->
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
PLG_EXTENSION_COMPONENTBUILDERHEADERSCOMPILER="Extension - Componentbuilder Headers Compiler"
|
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_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="<h1>Extension - Componentbuilder Headers Compiler (v.2.2.3)</h1> <div style='clear: both;'></div><p>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.</p><p>Created by <a href='https://dev.vdm.io' target='_blank'>Llewellyn van der Merwe</a><br /><small>Development started 24th May, 2020</small></p>"
|
PLG_EXTENSION_COMPONENTBUILDERHEADERSCOMPILER_XML_DESCRIPTION="<h1>Extension - Componentbuilder Headers Compiler (v.2.2.5)</h1> <div style='clear: both;'></div><p>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.</p><p>Created by <a href='https://dev.vdm.io' target='_blank'>Llewellyn van der Merwe</a><br /><small>Development started 24th May, 2020</small></p>"
|
@ -1,3 +1,3 @@
|
|||||||
PLG_EXTENSION_COMPONENTBUILDERHEADERSCOMPILER="Extension - Componentbuilder Headers Compiler"
|
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_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="<h1>Extension - Componentbuilder Headers Compiler (v.2.2.3)</h1> <div style='clear: both;'></div><p>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.</p><p>Created by <a href='https://dev.vdm.io' target='_blank'>Llewellyn van der Merwe</a><br /><small>Development started 24th May, 2020</small></p>"
|
PLG_EXTENSION_COMPONENTBUILDERHEADERSCOMPILER_XML_DESCRIPTION="<h1>Extension - Componentbuilder Headers Compiler (v.2.2.5)</h1> <div style='clear: both;'></div><p>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.</p><p>Created by <a href='https://dev.vdm.io' target='_blank'>Llewellyn van der Merwe</a><br /><small>Development started 24th May, 2020</small></p>"
|
Loading…
Reference in New Issue
Block a user