52
0

Release of v2.0.0

This commit is contained in:
Robot 2024-03-11 18:39:21 +02:00
parent 3acbea0725
commit fcfea05579
Signed by: Robot
GPG Key ID: 14DECD44E7E1BB95
5 changed files with 44 additions and 154 deletions

View File

@ -19,20 +19,16 @@ use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\Registry\Registry; use Joomla\Registry\Registry;
use VDM\Joomla\Utilities\JsonHelper; use VDM\Joomla\Utilities\JsonHelper;
use VDM\Joomla\Utilities\ArrayHelper; use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\StringHelper; use VDM\Joomla\Componentbuilder\Compiler\Factory as CompilerFactory;
use VDM\Joomla\Utilities\StringHelper;
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;
use VDM\Joomla\Componentbuilder\Compiler\Factory as CFactory; use VDM\Joomla\Componentbuilder\Compiler\Utilities\Placefix;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Placefix;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Indent;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Line;
/** /**
* Extension - Componentbuilder Privacy Compiler plugin. * Extension - Componentbuilder Privacy Compiler plugin.
* *
* @package ComponentbuilderPrivacyCompiler * @package ComponentbuilderPrivacyCompiler
* @since 1.2.2 * @since 2.0.0
*/ */
class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
{ {
@ -99,15 +95,25 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
{ {
$view->addpermissions = array_values($view->addpermissions); $view->addpermissions = array_values($view->addpermissions);
// add the new permissions // add the new permissions
$view->addpermissions[] = array('action' => 'view.privacy.delete', 'implementation' => 3, 'title' => $view->name_list . ' Privacy Delete', 'description' => ' Allows the users in this group to remove their personal data in ' . $view->name_list . ' via the Joomla privacy suite.'); $view->addpermissions[] = [
$view->addpermissions[] = array('action' => 'view.privacy.access', 'implementation' => 3, 'title' => $view->name_list . ' Privacy Access', 'description' => ' Allows the users in this group to access their personal data in ' . $view->name_list . ' via the Joomla privacy suite.'); 'action' => 'view.privacy.delete',
'implementation' => 3,
'title' => $view->name_list . ' Privacy Delete',
'description' => ' Allows the users in this group to remove their personal data in ' . $view->name_list . ' via the Joomla privacy suite.'
];
$view->addpermissions[] = [
'action' => 'view.privacy.access',
'implementation' => 3,
'title' => $view->name_list . ' Privacy Access',
'description' => ' Allows the users in this group to access their personal data in ' . $view->name_list . ' via the Joomla privacy suite.'
];
// convert back to json // convert back to json
$view->addpermissions = json_encode($view->addpermissions, JSON_FORCE_OBJECT); $view->addpermissions = json_encode($view->addpermissions, JSON_FORCE_OBJECT);
} }
// add placeholders to view if not already set // add placeholders to view if not already set
if (!isset($this->activeViews[$view->id]->placeholders)) if (!isset($this->activeViews[$view->id]->placeholders))
{ {
$this->activeViews[$view->id]->placeholders = CFactory::_('Placeholder')->active; $this->activeViews[$view->id]->placeholders = CompilerFactory::_('Placeholder')->active;
} }
} }
} }
@ -124,7 +130,7 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
// check if this component needs a privacy plugin loaded // check if this component needs a privacy plugin loaded
if ($this->loadPrivacy) if ($this->loadPrivacy)
{ {
$plugin = JPluginHelper::getPlugin('content', 'componentbuilderprivacytabs'); $plugin = \JPluginHelper::getPlugin('content', 'componentbuilderprivacytabs');
// check if this is json // check if this is json
if (isset($plugin->params) && JsonHelper::check($plugin->params)) if (isset($plugin->params) && JsonHelper::check($plugin->params))
{ {
@ -137,7 +143,7 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
if (isset($plugin->params['plugin']) && $plugin->params['plugin'] > 0) if (isset($plugin->params['plugin']) && $plugin->params['plugin'] > 0)
{ {
// if linked it will only load it once // if linked it will only load it once
CFactory::_('Joomlaplugin.Data')->set($plugin->params['plugin']); CompilerFactory::_('Joomlaplugin.Data')->set($plugin->params['plugin']);
} }
else else
{ {
@ -160,8 +166,8 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
if ($this->loadPrivacy && ArrayHelper::check($this->activeViews)) if ($this->loadPrivacy && ArrayHelper::check($this->activeViews))
{ {
// get compiler defaults // get compiler defaults
$strictFieldExportPermissions = CFactory::_('Config')->get('permission_strict_per_field', false); $strictFieldExportPermissions = CompilerFactory::_('Config')->get('permission_strict_per_field', false);
$exportTextOnly = CFactory::_('Config')->get('export_text_only', 1); $exportTextOnly = CompilerFactory::_('Config')->get('export_text_only', 1);
// load the getPrivacyExport functions // load the getPrivacyExport functions
foreach ($this->activeViews as $id => &$view) foreach ($this->activeViews as $id => &$view)
@ -169,18 +175,18 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
// set permissions based on view // set permissions based on view
if (isset($view->params['privacy']['permissions'])) if (isset($view->params['privacy']['permissions']))
{ {
CFactory::_('Config')->set('permission_strict_per_field', (bool) $view->params['privacy']['permissions']); CompilerFactory::_('Config')->set('permission_strict_per_field', (bool) $view->params['privacy']['permissions']);
} }
// allow text only export // allow text only export
CFactory::_('Config')->set('export_text_only', 1); CompilerFactory::_('Config')->set('export_text_only', 1);
// set view list name // set view list name
$viewName_list = StringHelper::safe($view->name_list); $viewName_list = StringHelper::safe($view->name_list);
// set view single name // set view single name
$viewName_single = StringHelper::safe($view->name_single); $viewName_single = StringHelper::safe($view->name_single);
// load the function // load the function
CFactory::_('Compiler.Builder.Content.Multi')->add($viewName_list . '|MODELEXPORTMETHOD', CompilerFactory::_('Compiler.Builder.Content.Multi')->add($viewName_list . '|MODELEXPORTMETHOD',
$compiler->setGetItemsModelMethod( $compiler->setGetItemsModelMethod(
$viewName_single, $viewName_single,
$viewName_list, $viewName_list,
@ -192,7 +198,7 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
) )
); );
// get the permissions building values for later if needed // get the permissions building values for later if needed
if (CFactory::_('Config')->get('permission_strict_per_field', false) && if (CompilerFactory::_('Config')->get('permission_strict_per_field', false) &&
isset($compiler->permissionFields[$viewName_single]) && isset($compiler->permissionFields[$viewName_single]) &&
ArrayHelper::check($compiler->permissionFields[$viewName_single])) ArrayHelper::check($compiler->permissionFields[$viewName_single]))
{ {
@ -201,8 +207,8 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
} }
// set compiler defaults // set compiler defaults
CFactory::_('Config')->set('permission_strict_per_field', $strictFieldExportPermissions); CompilerFactory::_('Config')->set('permission_strict_per_field', $strictFieldExportPermissions);
CFactory::_('Config')->set('export_text_only', $exportTextOnly); CompilerFactory::_('Config')->set('export_text_only', $exportTextOnly);
// add helper classes // add helper classes
$helper_strings = ['CUSTOM_HELPER_SCRIPT', 'SITE_CUSTOM_HELPER_SCRIPT', 'BOTH_CUSTOM_HELPER_SCRIPT']; $helper_strings = ['CUSTOM_HELPER_SCRIPT', 'SITE_CUSTOM_HELPER_SCRIPT', 'BOTH_CUSTOM_HELPER_SCRIPT'];
@ -214,7 +220,7 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
foreach ($helper_strings as $helper) foreach ($helper_strings as $helper)
{ {
if (($helper_content = CFactory::_('Compiler.Builder.Content.One')->get($helper)) !== null && if (($helper_content = CompilerFactory::_('Compiler.Builder.Content.One')->get($helper)) !== null &&
StringHelper::check($helper_content)) StringHelper::check($helper_content))
{ {
foreach ($privacy_events as $privacy_event => &$add) foreach ($privacy_events as $privacy_event => &$add)
@ -229,8 +235,8 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
} }
// add the events still needed // add the events still needed
CFactory::_('Compiler.Builder.Content.One')->add('BOTH_CUSTOM_HELPER_SCRIPT', CompilerFactory::_('Compiler.Builder.Content.One')->add('BOTH_CUSTOM_HELPER_SCRIPT',
CFactory::_('Placeholder')->update_($this->getHelperMethod($privacy_events)) CompilerFactory::_('Placeholder')->update_($this->getHelperMethod($privacy_events))
); );
} }
} }
@ -248,7 +254,7 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
{ {
foreach($this->languageArray as $key => $string) foreach($this->languageArray as $key => $string)
{ {
CFactory::_('Language')->set('site', $key, $string); CompilerFactory::_('Language')->set('site', $key, $string);
} }
} }
} }
@ -316,9 +322,9 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
$methods .= PHP_EOL . Indent::_(2) . "//" . Line::_(__Line__, __Class__) . " Check if user has permission to delete " . $view->name_list; $methods .= PHP_EOL . Indent::_(2) . "//" . Line::_(__Line__, __Class__) . " Check if user has permission to delete " . $view->name_list;
// set the if statement based on the permission builder // set the if statement based on the permission builder
$methods .= PHP_EOL . Indent::_(2) . "if (!\$user->authorise('" $methods .= PHP_EOL . Indent::_(2) . "if (!\$user->authorise('"
. CFactory::_('Compiler.Creator.Permission')->getAction($viewName_single, 'core.delete') . CompilerFactory::_('Compiler.Creator.Permission')->getAction($viewName_single, 'core.delete')
. "', 'com_" . Placefix::_("component") . "') && !\$user->authorise('" . "', 'com_" . Placefix::_("component") . "') && !\$user->authorise('"
. CFactory::_('Compiler.Creator.Permission')->getAction($viewName_single, 'core.privacy.delete') . CompilerFactory::_('Compiler.Creator.Permission')->getAction($viewName_single, 'core.privacy.delete')
. "', 'com_" . Placefix::_("component") . "'))"; . "', 'com_" . Placefix::_("component") . "'))";
$methods .= PHP_EOL . Indent::_(2) . "{"; $methods .= PHP_EOL . Indent::_(2) . "{";
// set language key // set language key
@ -374,9 +380,9 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
$methods .= PHP_EOL . Indent::_(2) . "//" . Line::_(__Line__, __Class__) . " Check if user has permission to access " . $view->name_list; $methods .= PHP_EOL . Indent::_(2) . "//" . Line::_(__Line__, __Class__) . " Check if user has permission to access " . $view->name_list;
// set the if statement based on the permission builder // set the if statement based on the permission builder
$methods .= PHP_EOL . Indent::_(2) . "if (\$user->authorise('" $methods .= PHP_EOL . Indent::_(2) . "if (\$user->authorise('"
. CFactory::_('Compiler.Creator.Permission')->getGlobal($viewName_single, 'core.access') . CompilerFactory::_('Compiler.Creator.Permission')->getGlobal($viewName_single, 'core.access')
. "', 'com_" . Placefix::_("component") . "') || \$user->authorise('" . "', 'com_" . Placefix::_("component") . "') || \$user->authorise('"
. CFactory::_('Compiler.Creator.Permission')->getGlobal($viewName_single, 'core.privacy.access') . CompilerFactory::_('Compiler.Creator.Permission')->getGlobal($viewName_single, 'core.privacy.access')
. "', 'com_" . Placefix::_("component") . "'))"; . "', 'com_" . Placefix::_("component") . "'))";
$methods .= PHP_EOL . Indent::_(2) . "{"; $methods .= PHP_EOL . Indent::_(2) . "{";
$methods .= PHP_EOL . Indent::_(3) . "//" . Line::_(__Line__, __Class__) . " Get " . $view->name_single . " domain"; $methods .= PHP_EOL . Indent::_(3) . "//" . Line::_(__Line__, __Class__) . " Get " . $view->name_single . " domain";
@ -576,9 +582,9 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
$methods .= PHP_EOL . Indent::_(2) . "//" . Line::_(__Line__, __Class__) . " Check if user has permission to delet " . $view->name_list; $methods .= PHP_EOL . Indent::_(2) . "//" . Line::_(__Line__, __Class__) . " Check if user has permission to delet " . $view->name_list;
// set the if statement based on the permission builder // set the if statement based on the permission builder
$methods .= PHP_EOL . Indent::_(2) . "if (\$user->authorise('" $methods .= PHP_EOL . Indent::_(2) . "if (\$user->authorise('"
. CFactory::_('Compiler.Creator.Permission')->getAction($viewName_single, 'core.delete') . CompilerFactory::_('Compiler.Creator.Permission')->getAction($viewName_single, 'core.delete')
. "', 'com_" . Placefix::_("component") . "') || \$user->authorise('" . "', 'com_" . Placefix::_("component") . "') || \$user->authorise('"
. CFactory::_('Compiler.Creator.Permission')->getAction($viewName_single, 'core.privacy.delete') . CompilerFactory::_('Compiler.Creator.Permission')->getAction($viewName_single, 'core.privacy.delete')
. "', 'com_" . Placefix::_("component") . "'))"; . "', 'com_" . Placefix::_("component") . "'))";
$methods .= PHP_EOL . Indent::_(2) . "{"; $methods .= PHP_EOL . Indent::_(2) . "{";
// check if this is a plain delete, or it is a Anonymize // check if this is a plain delete, or it is a Anonymize

View File

@ -1,13 +1,13 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<extension type="plugin" version="3.10" group="extension" method="upgrade"> <extension type="plugin" version="5.0" group="extension" method="upgrade">
<name>PLG_EXTENSION_COMPONENTBUILDERPRIVACYCOMPILER</name> <name>PLG_EXTENSION_COMPONENTBUILDERPRIVACYCOMPILER</name>
<creationDate>9th March, 2024</creationDate> <creationDate>11th March, 2024</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>1.2.2</version> <version>2.0.0</version>
<description>PLG_EXTENSION_COMPONENTBUILDERPRIVACYCOMPILER_XML_DESCRIPTION</description> <description>PLG_EXTENSION_COMPONENTBUILDERPRIVACYCOMPILER_XML_DESCRIPTION</description>
<!-- Scripts to run on installation --> <!-- Scripts to run on installation -->

View File

@ -1,4 +1,4 @@
PLG_EXTENSION_COMPONENTBUILDERPRIVACYCOMPILER="Extension - Componentbuilder Privacy Compiler" PLG_EXTENSION_COMPONENTBUILDERPRIVACYCOMPILER="Extension - Componentbuilder Privacy Compiler"
PLG_EXTENSION_COMPONENTBUILDERPRIVACYCOMPILER_DESCRIPTION="This plugin is used to build the privacy plugin for your component 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 link your admin views to the privacy suite of Joomla via our other Content - Componentbuilder Privacy Tabs plugin." PLG_EXTENSION_COMPONENTBUILDERPRIVACYCOMPILER_DESCRIPTION="This plugin is used to build the privacy plugin for your component 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 link your admin views to the privacy suite of Joomla via our other Content - Componentbuilder Privacy Tabs plugin."
PLG_EXTENSION_COMPONENTBUILDERPRIVACYCOMPILER_XML_DESCRIPTION="<h1>Extension - Componentbuilder Privacy Compiler (v.1.2.2)</h1> <div style='clear: both;'></div><p>This plugin is used to build the privacy plugin for your component 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 link your admin views to the privacy suite of Joomla via our other Content - Componentbuilder Privacy Tabs plugin.</p><p>Created by <a href='https://dev.vdm.io' target='_blank'>Llewellyn van der Merwe</a><br /><small>Development started 17th August, 2019</small></p>" PLG_EXTENSION_COMPONENTBUILDERPRIVACYCOMPILER_XML_DESCRIPTION="<h1>Extension - Componentbuilder Privacy Compiler (v.2.0.0)</h1> <div style='clear: both;'></div><p>This plugin is used to build the privacy plugin for your component 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 link your admin views to the privacy suite of Joomla via our other Content - Componentbuilder Privacy Tabs plugin.</p><p>Created by <a href='https://dev.vdm.io' target='_blank'>Llewellyn van der Merwe</a><br /><small>Development started 10th March, 2024</small></p>"
PLG_EXTENSION_COMPONENTBUILDERPRIVACYCOMPILER_YOU_DO_NOT_HAVE_A_GLOBAL_PRIVACY_PLUGIN_SETUP_SO_THE_INTEGRATION_WITH_JOOMLA_PRIVACY_SUITE_COULD_NOT_BE_BUILD="You do not have a global privacy plugin setup, so the integration with Joomla privacy suite could not be build." PLG_EXTENSION_COMPONENTBUILDERPRIVACYCOMPILER_YOU_DO_NOT_HAVE_A_GLOBAL_PRIVACY_PLUGIN_SETUP_SO_THE_INTEGRATION_WITH_JOOMLA_PRIVACY_SUITE_COULD_NOT_BE_BUILD="You do not have a global privacy plugin setup, so the integration with Joomla privacy suite could not be build."

View File

@ -1,4 +1,4 @@
PLG_EXTENSION_COMPONENTBUILDERPRIVACYCOMPILER="Extension - Componentbuilder Privacy Compiler" PLG_EXTENSION_COMPONENTBUILDERPRIVACYCOMPILER="Extension - Componentbuilder Privacy Compiler"
PLG_EXTENSION_COMPONENTBUILDERPRIVACYCOMPILER_DESCRIPTION="This plugin is used to build the privacy plugin for your component 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 link your admin views to the privacy suite of Joomla via our other Content - Componentbuilder Privacy Tabs plugin." PLG_EXTENSION_COMPONENTBUILDERPRIVACYCOMPILER_DESCRIPTION="This plugin is used to build the privacy plugin for your component 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 link your admin views to the privacy suite of Joomla via our other Content - Componentbuilder Privacy Tabs plugin."
PLG_EXTENSION_COMPONENTBUILDERPRIVACYCOMPILER_XML_DESCRIPTION="<h1>Extension - Componentbuilder Privacy Compiler (v.1.2.2)</h1> <div style='clear: both;'></div><p>This plugin is used to build the privacy plugin for your component 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 link your admin views to the privacy suite of Joomla via our other Content - Componentbuilder Privacy Tabs plugin.</p><p>Created by <a href='https://dev.vdm.io' target='_blank'>Llewellyn van der Merwe</a><br /><small>Development started 17th August, 2019</small></p>" PLG_EXTENSION_COMPONENTBUILDERPRIVACYCOMPILER_XML_DESCRIPTION="<h1>Extension - Componentbuilder Privacy Compiler (v.2.0.0)</h1> <div style='clear: both;'></div><p>This plugin is used to build the privacy plugin for your component 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 link your admin views to the privacy suite of Joomla via our other Content - Componentbuilder Privacy Tabs plugin.</p><p>Created by <a href='https://dev.vdm.io' target='_blank'>Llewellyn van der Merwe</a><br /><small>Development started 10th March, 2024</small></p>"
PLG_EXTENSION_COMPONENTBUILDERPRIVACYCOMPILER_YOU_DO_NOT_HAVE_A_GLOBAL_PRIVACY_PLUGIN_SETUP_SO_THE_INTEGRATION_WITH_JOOMLA_PRIVACY_SUITE_COULD_NOT_BE_BUILD="You do not have a global privacy plugin setup, so the integration with Joomla privacy suite could not be build." PLG_EXTENSION_COMPONENTBUILDERPRIVACYCOMPILER_YOU_DO_NOT_HAVE_A_GLOBAL_PRIVACY_PLUGIN_SETUP_SO_THE_INTEGRATION_WITH_JOOMLA_PRIVACY_SUITE_COULD_NOT_BE_BUILD="You do not have a global privacy plugin setup, so the integration with Joomla privacy suite could not be build."

View File

@ -24,120 +24,4 @@ use Joomla\CMS\Filesystem\Folder;
*/ */
class plgExtensionComponentbuilderPrivacyCompilerInstallerScript class plgExtensionComponentbuilderPrivacyCompilerInstallerScript
{ {
/**
* Called before any type of action
*
* @param string $route Which action is happening (install|uninstall|discover_install|update)
* @param Joomla\CMS\Installer\InstallerAdapter $adapter The object responsible for running this script
*
* @return boolean True on success
*/
public function preflight($route, $adapter)
{
// get application
$app = Factory::getApplication();
// the default for both install and update
$jversion = new JVersion();
if (!$jversion->isCompatible('3.8.0'))
{
$app->enqueueMessage('Please upgrade to at least Joomla! 3.8.0 before continuing!', 'error');
return false;
}
if ('install' === $route)
{
// needs fix
// check that componentbuilder is installed
$pathToCore = JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/componentbuilder.php';
if (!JFile::exists($pathToCore))
{
$app->enqueueMessage('Joomla Component Builder must first be installed from <a href="https://www.joomlacomponentbuilder.com/ " target="_blank">Joomla Component Builder</a>.', 'error');
return false;
}
// load the helper class
JLoader::register('ComponentbuilderHelper', JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/componentbuilder.php');
// block install
$blockInstall = true;
// check the version of JCB
$manifest = ComponentbuilderHelper::manifest();
if (isset($manifest->version) && strpos($manifest->version, '.') !== false)
{
// get the version
$jcbVersion = explode('.', $manifest->version);
// check that we have JCB 3.0.0 or higher installed
if (count($jcbVersion) == 3 && $jcbVersion[0] >= 3 &&
(
($jcbVersion[0] == 3 && $jcbVersion[1] == 0 && $jcbVersion[2] >= 0) ||
($jcbVersion[0] == 3 && $jcbVersion[1] > 0) ||
$jcbVersion[0] > 3)
)
{
$blockInstall = false;
}
}
// allow install if all conditions are met
if ($blockInstall)
{
$app->enqueueMessage('Please upgrade to JCB v3.0.0 or higher before installing this plugin.', 'error');
return false;
}
// check that componentbuilder is installed
$pathToCore = JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/componentbuilder.php';
if (!JFile::exists($pathToCore))
{
$app->enqueueMessage('Joomla Component Builder must first be installed from <a href="https://www.joomlacomponentbuilder.com/ " target="_blank">Joomla Component Builder</a>.', 'error');
return false;
}
// load the helper class
JLoader::register('ComponentbuilderHelper', JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/componentbuilder.php');
// block install
$blockInstall = true;
// check the version of JCB
$manifest = ComponentbuilderHelper::manifest();
if (isset($manifest->version) && strpos($manifest->version, '.') !== false)
{
// get the version
$jcbVersion = explode('.', $manifest->version);
// check that we have JCB 2.10.13 or higher installed
if (count($jcbVersion) == 3 && (($jcbVersion[0] == 2 && $jcbVersion[1] >= 10 && (($jcbVersion[1] == 10 && $jcbVersion[2] >= 13) || ($jcbVersion[1] > 10))) || $jcbVersion[0] >= 3))
{
$blockInstall = false;
}
}
// allow install if all conditions are met
if ($blockInstall)
{
$app->enqueueMessage('Please upgrade to JCB 2.10.13 or higher before installing this plugin.', 'error');
return false;
}
// check that componentbuilder is installed
$pathToCore = JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/componentbuilder.php';
if (!JFile::exists($pathToCore))
{
$app->enqueueMessage('Joomla Component Builder must first be installed from <a href="https://www.joomlacomponentbuilder.com/ " target="_blank">Joomla Component Builder</a>.', 'error');
return false;
}
// check that componentbuilder is installed
$pathToCore = JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/componentbuilder.php';
if (!JFile::exists($pathToCore))
{
$app->enqueueMessage('Joomla Component Builder must first be installed from <a href="https://www.joomlacomponentbuilder.com/ " target="_blank">Joomla Component Builder</a>.', 'error');
return false;
}
}
return true;
}
} }