diff --git a/componentbuilderpowersautoloadercompiler.php b/componentbuilderpowersautoloadercompiler.php index 07bae52..2f911f1 100644 --- a/componentbuilderpowersautoloadercompiler.php +++ b/componentbuilderpowersautoloadercompiler.php @@ -14,20 +14,14 @@ defined('_JEXEC') or die('Restricted access'); use Joomla\CMS\Factory; use Joomla\CMS\Language\Text; -use Joomla\CMS\Application\CMSApplication; -use Joomla\CMS\Plugin\CMSPlugin; -use Joomla\Registry\Registry; -use VDM\Joomla\Utilities\ArrayHelper; - -JLoader::register('ComponentbuilderHelper', JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/componentbuilder.php'); - -use VDM\Joomla\Componentbuilder\Compiler\Factory as CFactory; - +use Joomla\CMS\Plugin\CMSPlugin; +use VDM\Joomla\Componentbuilder\Compiler\Factory as CompilerFactory; +use VDM\Joomla\Utilities\ArrayHelper; /** * Extension - Componentbuilder Powers Autoloader Compiler plugin. * * @package ComponentbuilderPowersAutoloaderCompiler - * @since 1.2.0 + * @since 2.0.0 */ class PlgExtensionComponentbuilderPowersAutoloaderCompiler extends CMSPlugin { @@ -49,15 +43,15 @@ class PlgExtensionComponentbuilderPowersAutoloaderCompiler extends CMSPlugin public function jcb_ce_onAfterGet() { // check if this component needs a power autoloader plugin loaded - if (CFactory::_('Config')->add_power && $this->componentActive()) + if (CompilerFactory::_('Config')->add_power && $this->componentActive()) { // now get the plugin ID if set if (($id = (int) $this->params->get('plugin', 0)) !== 0) { // load the power autoloader plugin - CFactory::_('Joomlaplugin.Data')->set($id); + CompilerFactory::_('Joomlaplugin.Data')->set($id); // now set the plugin powers placeholder - CFactory::_('Compiler.Builder.Content.One')->set('PLUGIN_POWER_AUTOLOADER', ''); + CompilerFactory::_('Compiler.Builder.Content.One')->set('PLUGIN_POWER_AUTOLOADER', ''); } else { @@ -106,7 +100,7 @@ class PlgExtensionComponentbuilderPowersAutoloaderCompiler extends CMSPlugin // only check if there are active if (ArrayHelper::check($this->componentsActive)) { - return in_array((int) CFactory::_('Config')->component_id, $this->componentsActive); + return in_array((int) CompilerFactory::_('Config')->component_id, $this->componentsActive); } return false; } diff --git a/componentbuilderpowersautoloadercompiler.xml b/componentbuilderpowersautoloadercompiler.xml index 8e879bb..c4c6c20 100644 --- a/componentbuilderpowersautoloadercompiler.xml +++ b/componentbuilderpowersautoloadercompiler.xml @@ -1,13 +1,13 @@ - + PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER - 9th March, 2024 + 11th March, 2024 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.2.0 + 2.0.0 PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_XML_DESCRIPTION diff --git a/fields/joomlacomponents.php b/fields/joomlacomponents.php deleted file mode 100644 index 17b7bb1..0000000 --- a/fields/joomlacomponents.php +++ /dev/null @@ -1,61 +0,0 @@ - - * @git Joomla Component Builder - * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. - * @license GNU General Public License version 2 or later; see LICENSE.txt - */ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -use Joomla\CMS\Factory; -use Joomla\CMS\Language\Text; -use Joomla\CMS\HTML\HTMLHelper as Html; - -// import the list field type -jimport('joomla.form.helper'); -JFormHelper::loadFieldClass('list'); - -/** - * Joomlacomponents Form Field class for the Componentbuilder component - */ -class JFormFieldJoomlacomponents extends JFormFieldList -{ - /** - * The joomlacomponents field type. - * - * @var string - */ - public $type = 'joomlacomponents'; - - /** - * Method to get a list of options for a list input. - * - * @return array An array of Html options. - */ - protected function getOptions() - { - $db = JFactory::getDBO(); - $query = $db->getQuery(true); - $query->select($db->quoteName(array('a.id','a.system_name'),array('id','components_system_name'))); - $query->from($db->quoteName('#__componentbuilder_joomla_component', 'a')); - $query->where($db->quoteName('a.published') . ' >= 1'); - $query->order('a.system_name ASC'); - $db->setQuery((string)$query); - $items = $db->loadObjectList(); - $options = array(); - if ($items) - { - foreach($items as $item) - { - $options[] = JHtml::_('select.option', $item->id, $item->components_system_name); - } - } - - return $options; - } -} diff --git a/fields/joomlaplugins.php b/fields/joomlaplugins.php deleted file mode 100644 index 379ca5e..0000000 --- a/fields/joomlaplugins.php +++ /dev/null @@ -1,181 +0,0 @@ - - * @git Joomla Component Builder - * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. - * @license GNU General Public License version 2 or later; see LICENSE.txt - */ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -use Joomla\CMS\Factory; -use Joomla\CMS\Language\Text; -use Joomla\CMS\HTML\HTMLHelper as Html; - -// import the list field type -jimport('joomla.form.helper'); -JFormHelper::loadFieldClass('list'); - -/** - * Joomlaplugins Form Field class for the Componentbuilder component - */ -class JFormFieldJoomlaplugins extends JFormFieldList -{ - /** - * The joomlaplugins field type. - * - * @var string - */ - public $type = 'joomlaplugins'; - - /** - * Override to add new button - * - * @return string The field input markup. - * - * @since 3.2 - */ - protected function getInput() - { - // see if we should add buttons - $set_button = $this->getAttribute('button'); - // get html - $html = parent::getInput(); - // if true set button - if ($set_button === 'true') - { - $button = array(); - $script = array(); - $button_code_name = $this->getAttribute('name'); - // get the input from url - $app = Factory::getApplication(); - $jinput = $app->input; - // get the view name & id - $values = $jinput->getArray(array( - 'id' => 'int', - 'view' => 'word' - )); - // check if new item - $ref = ''; - $refJ = ''; - if (!is_null($values['id']) && strlen($values['view'])) - { - // only load referral if not new item. - $ref = '&ref=' . $values['view'] . '&refid=' . $values['id']; - $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id']; - // get the return value. - $_uri = (string) \Joomla\CMS\Uri\Uri::getInstance(); - $_return = urlencode(base64_encode($_uri)); - // load return value. - $ref .= '&return=' . $_return; - $refJ .= '&return=' . $_return; - } - // get button label - $button_label = trim($button_code_name); - $button_label = preg_replace('/_+/', ' ', $button_label); - $button_label = preg_replace('/\s+/', ' ', $button_label); - $button_label = preg_replace("/[^A-Za-z ]/", '', $button_label); - $button_label = ucfirst(strtolower($button_label)); - // get user object - $user = Factory::getUser(); - // only add if user allowed to create joomla_plugin - if ($user->authorise('joomla_plugin.create', 'com_componentbuilder') && $app->isClient('administrator')) // TODO for now only in admin area. - { - // build Create button - $button[] = ' - '; - } - // only add if user allowed to edit joomla_plugin - if ($user->authorise('joomla_plugin.edit', 'com_componentbuilder') && $app->isClient('administrator')) // TODO for now only in admin area. - { - // build edit button - $button[] = ''; - // build script - $script[] = " - jQuery(document).ready(function() { - jQuery('#adminForm').on('change', '#jform_".$button_code_name."',function (e) { - e.preventDefault(); - var ".$button_code_name."Value = jQuery('#jform_".$button_code_name."').val(); - ".$button_code_name."Button(".$button_code_name."Value); - }); - var ".$button_code_name."Value = jQuery('#jform_".$button_code_name."').val(); - ".$button_code_name."Button(".$button_code_name."Value); - }); - function ".$button_code_name."Button(value) { - if (value > 0) { - // hide the create button - jQuery('#".$button_code_name."Create').hide(); - // show edit button - jQuery('#".$button_code_name."Edit').show(); - var url = 'index.php?option=com_componentbuilder&view=joomla_plugins&task=joomla_plugin.edit&id='+value+'".$refJ."'; - jQuery('#".$button_code_name."Edit').attr('href', url); - } else { - // show the create button - jQuery('#".$button_code_name."Create').show(); - // hide edit button - jQuery('#".$button_code_name."Edit').hide(); - } - }"; - } - // check if button was created for joomla_plugin field. - if (is_array($button) && count($button) > 0) - { - // Load the needed script. - $document = Factory::getDocument(); - $document->addScriptDeclaration(implode(' ',$script)); - // return the button attached to input field. - return '
' .$html . implode('',$button).'
'; - } - } - return $html; - } - - /** - * Method to get a list of options for a list input. - * - * @return array An array of Html options. - */ - protected function getOptions() - { - // Get the user object. - $user = JFactory::getUser(); - // Get the databse object. - $db = JFactory::getDBO(); - $query = $db->getQuery(true); - $query->select($db->quoteName(array('a.id','a.system_name','a.name','b.name','c.name'),array('id','plugin_system_name','name','class_extends_name','joomla_plugin_group_name'))); - $query->from($db->quoteName('#__componentbuilder_joomla_plugin', 'a')); - $query->join('LEFT', $db->quoteName('#__componentbuilder_class_extends', 'b') . ' ON (' . $db->quoteName('a.class_extends') . ' = ' . $db->quoteName('b.id') . ')'); - $query->join('LEFT', $db->quoteName('#__componentbuilder_joomla_plugin_group', 'c') . ' ON (' . $db->quoteName('a.joomla_plugin_group') . ' = ' . $db->quoteName('c.id') . ')'); - $query->where($db->quoteName('a.published') . ' >= 1'); - $query->order('a.system_name ASC'); - // Implement View Level Access (if set in table) - if (!$user->authorise('core.options', 'com_componentbuilder')) - { - $columns = $db->getTableColumns('#__componentbuilder_joomla_plugin'); - if(isset($columns['access'])) - { - $groups = implode(',', $user->getAuthorisedViewLevels()); - $query->where('a.access IN (' . $groups . ')'); - } - } - $db->setQuery((string)$query); - $items = $db->loadObjectList(); - $options = array(); - if ($items) - { - $options[] = JHtml::_('select.option', '', 'Select a plugin'); - foreach($items as $item) - { - // set a full class name - $options[] = JHtml::_('select.option', $item->id, '( ' . $item->plugin_system_name . ' ) class Plg' . ucfirst($item->joomla_plugin_group_name) . $item->name . ' extends ' . $item->class_extends_name); - } - } - return $options; - } -} diff --git a/language/en-GB/en-GB.plg_extension_componentbuilderpowersautoloadercompiler.ini b/language/en-GB/en-GB.plg_extension_componentbuilderpowersautoloadercompiler.ini index f5ba1d0..823e3dc 100644 --- a/language/en-GB/en-GB.plg_extension_componentbuilderpowersautoloadercompiler.ini +++ b/language/en-GB/en-GB.plg_extension_componentbuilderpowersautoloadercompiler.ini @@ -1,6 +1,6 @@ PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER="Extension - Componentbuilder Powers Autoloader Compiler" PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_DESCRIPTION="This plugin is used to build the power autoloader 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." -PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_XML_DESCRIPTION="

Extension - Componentbuilder Powers Autoloader Compiler (v.1.2.0)

This plugin is used to build the power autoloader 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.

Created by Llewellyn van der Merwe
Development started 13th November, 2021

" +PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_XML_DESCRIPTION="

Extension - Componentbuilder Powers Autoloader Compiler (v.2.0.0)

This plugin is used to build the power autoloader 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.

Created by Llewellyn van der Merwe
Development started 10th March, 2024

" PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_YOU_DO_NOT_HAVE_A_GLOBAL_POWER_PLUGIN_SETUP_SO_THE_POWERS_PLUGIN_AUTOLOADER_COULD_NOT_BE_ADDED="You do not have a global power plugin setup, so the powers plugin autoloader could not be added." PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_GLOBAL_AUTOLOADER="Global Autoloader" PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_NOTE_SELECT_POWER_PLUGIN_LABEL="Select your power autoloader plugin here." diff --git a/language/en-GB/en-GB.plg_extension_componentbuilderpowersautoloadercompiler.sys.ini b/language/en-GB/en-GB.plg_extension_componentbuilderpowersautoloadercompiler.sys.ini index f5ba1d0..823e3dc 100644 --- a/language/en-GB/en-GB.plg_extension_componentbuilderpowersautoloadercompiler.sys.ini +++ b/language/en-GB/en-GB.plg_extension_componentbuilderpowersautoloadercompiler.sys.ini @@ -1,6 +1,6 @@ PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER="Extension - Componentbuilder Powers Autoloader Compiler" PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_DESCRIPTION="This plugin is used to build the power autoloader 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." -PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_XML_DESCRIPTION="

Extension - Componentbuilder Powers Autoloader Compiler (v.1.2.0)

This plugin is used to build the power autoloader 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.

Created by Llewellyn van der Merwe
Development started 13th November, 2021

" +PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_XML_DESCRIPTION="

Extension - Componentbuilder Powers Autoloader Compiler (v.2.0.0)

This plugin is used to build the power autoloader 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.

Created by Llewellyn van der Merwe
Development started 10th March, 2024

" PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_YOU_DO_NOT_HAVE_A_GLOBAL_POWER_PLUGIN_SETUP_SO_THE_POWERS_PLUGIN_AUTOLOADER_COULD_NOT_BE_ADDED="You do not have a global power plugin setup, so the powers plugin autoloader could not be added." PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_GLOBAL_AUTOLOADER="Global Autoloader" PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_NOTE_SELECT_POWER_PLUGIN_LABEL="Select your power autoloader plugin here." diff --git a/script.php b/script.php index 046fabb..6a78641 100644 --- a/script.php +++ b/script.php @@ -24,505 +24,4 @@ use Joomla\CMS\Filesystem\Folder; */ class plgExtensionComponentbuilderPowersAutoloaderCompilerInstallerScript { - - /** - * 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 Joomla Component Builder.', '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 Joomla Component Builder.', '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 Joomla Component Builder.', '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 Joomla Component Builder.', '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 Joomla Component Builder.', '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 Joomla Component Builder.', '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 Joomla Component Builder.', '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 Joomla Component Builder.', '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 Joomla Component Builder.', '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.1.18 or higher installed - if (count($jcbVersion) == 3 && $jcbVersion[0] >= 3 && - ( - ($jcbVersion[0] == 3 && $jcbVersion[1] == 1 && $jcbVersion[2] >= 18) || - ($jcbVersion[0] == 3 && $jcbVersion[1] > 1) || - $jcbVersion[0] > 3) - ) - { - $blockInstall = false; - } - } - - // allow install if all conditions are met - if ($blockInstall) - { - $app->enqueueMessage('Please upgrade to JCB v3.1.18 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 Joomla Component Builder.', '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.14 or higher installed - if (count($jcbVersion) == 3 && $jcbVersion[0] >= 3 && - ( - ($jcbVersion[0] == 3 && $jcbVersion[1] == 0 && $jcbVersion[2] >= 14) || - ($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.14 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 Joomla Component Builder.', '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.1.18 or higher installed - if (count($jcbVersion) == 3 && $jcbVersion[0] >= 3 && - ( - ($jcbVersion[0] == 3 && $jcbVersion[1] == 1 && $jcbVersion[2] >= 18) || - ($jcbVersion[0] == 3 && $jcbVersion[1] > 1) || - $jcbVersion[0] > 3) - ) - { - $blockInstall = false; - } - } - - // allow install if all conditions are met - if ($blockInstall) - { - $app->enqueueMessage('Please upgrade to JCB v3.1.18 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 Joomla Component Builder.', '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.14 or higher installed - if (count($jcbVersion) == 3 && $jcbVersion[0] >= 3 && - ( - ($jcbVersion[0] == 3 && $jcbVersion[1] == 0 && $jcbVersion[2] >= 14) || - ($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.14 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 Joomla Component Builder.', '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.14 or higher installed - if (count($jcbVersion) == 3 && $jcbVersion[0] >= 3 && - ( - ($jcbVersion[0] == 3 && $jcbVersion[1] == 0 && $jcbVersion[2] >= 14) || - ($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.14 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 Joomla Component Builder.', '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.14 or higher installed - if (count($jcbVersion) == 3 && $jcbVersion[0] >= 3 && - ( - ($jcbVersion[0] == 3 && $jcbVersion[1] == 0 && $jcbVersion[2] >= 14) || - ($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.14 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 Joomla Component Builder.', '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.10 or higher installed - if (count($jcbVersion) == 3 && $jcbVersion[0] >= 3 && - ( - ($jcbVersion[0] == 3 && $jcbVersion[1] == 0 && $jcbVersion[2] >= 10) || - ($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.10 or higher before installing this plugin.', 'error'); - return false; - } - - } - - return true; - } }