diff --git a/componentbuildercomponentheaderstabs.xml b/componentbuildercomponentheaderstabs.xml index 390e498..0b825b5 100644 --- a/componentbuildercomponentheaderstabs.xml +++ b/componentbuildercomponentheaderstabs.xml @@ -1,7 +1,7 @@ PLG_CONTENT_COMPONENTBUILDERCOMPONENTHEADERSTABS - 15th February, 2023 + 26th February, 2023 Llewellyn van der Merwe joomla@vdm.io https://dev.vdm.io diff --git a/script.php b/script.php index 36fe6c8..3bb304b 100644 --- a/script.php +++ b/script.php @@ -57,10 +57,13 @@ class plgContentComponentbuilderComponentHeadersTabsInstallerScript $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) @@ -78,12 +81,14 @@ class plgContentComponentbuilderComponentHeadersTabsInstallerScript $blockInstall = false; } } + // allow install if all conditions are met if ($blockInstall) { - $app->enqueueMessage('Please upgrade to JCB-Pro v3.0.0 or higher before installing this plugin.', 'error'); + $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'; @@ -155,10 +160,13 @@ class plgContentComponentbuilderComponentHeadersTabsInstallerScript $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) @@ -176,12 +184,14 @@ class plgContentComponentbuilderComponentHeadersTabsInstallerScript $blockInstall = false; } } + // allow install if all conditions are met if ($blockInstall) { - $app->enqueueMessage('Please upgrade to JCB-Pro v3.0.0 or higher before installing this plugin.', 'error'); + $app->enqueueMessage('Please upgrade to JCB v3.0.0 or higher before installing this plugin.', 'error'); return false; - } + } + // check that componentbuilder is installed @@ -191,10 +201,13 @@ class plgContentComponentbuilderComponentHeadersTabsInstallerScript $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) @@ -212,12 +225,14 @@ class plgContentComponentbuilderComponentHeadersTabsInstallerScript $blockInstall = false; } } + // allow install if all conditions are met if ($blockInstall) { - $app->enqueueMessage('Please upgrade to JCB-Pro v3.0.0 or higher before installing this plugin.', 'error'); + $app->enqueueMessage('Please upgrade to JCB v3.0.0 or higher before installing this plugin.', 'error'); return false; - } + } + // check that componentbuilder is installed @@ -227,10 +242,54 @@ class plgContentComponentbuilderComponentHeadersTabsInstallerScript $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) @@ -248,12 +307,14 @@ class plgContentComponentbuilderComponentHeadersTabsInstallerScript $blockInstall = false; } } + // allow install if all conditions are met if ($blockInstall) { - $app->enqueueMessage('Please upgrade to JCB-Pro v3.0.14 or higher before installing this plugin.', 'error'); + $app->enqueueMessage('Please upgrade to JCB v3.0.14 or higher before installing this plugin.', 'error'); return false; - } + } + // check that componentbuilder is installed @@ -263,10 +324,54 @@ class plgContentComponentbuilderComponentHeadersTabsInstallerScript $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) @@ -284,12 +389,14 @@ class plgContentComponentbuilderComponentHeadersTabsInstallerScript $blockInstall = false; } } + // allow install if all conditions are met if ($blockInstall) { - $app->enqueueMessage('Please upgrade to JCB-Pro v3.0.14 or higher before installing this plugin.', 'error'); + $app->enqueueMessage('Please upgrade to JCB v3.0.14 or higher before installing this plugin.', 'error'); return false; - } + } + // check that componentbuilder is installed @@ -299,10 +406,13 @@ class plgContentComponentbuilderComponentHeadersTabsInstallerScript $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) @@ -320,12 +430,14 @@ class plgContentComponentbuilderComponentHeadersTabsInstallerScript $blockInstall = false; } } + // allow install if all conditions are met if ($blockInstall) { - $app->enqueueMessage('Please upgrade to JCB-Pro v3.0.14 or higher before installing this plugin.', 'error'); + $app->enqueueMessage('Please upgrade to JCB v3.0.14 or higher before installing this plugin.', 'error'); return false; - } + } + // check that componentbuilder is installed @@ -335,10 +447,13 @@ class plgContentComponentbuilderComponentHeadersTabsInstallerScript $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) @@ -356,84 +471,14 @@ class plgContentComponentbuilderComponentHeadersTabsInstallerScript $blockInstall = false; } } + // allow install if all conditions are met if ($blockInstall) { - $app->enqueueMessage('Please upgrade to JCB-Pro 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'); + $app->enqueueMessage('Please upgrade to JCB v3.0.14 or higher before installing this plugin.', '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-Pro 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-Pro v3.0.14 or higher before installing this plugin.', 'error'); - return false; - } } return true;