From 3388015c4624e69d34e40cc4eb36f5ee8156c6ff Mon Sep 17 00:00:00 2001 From: aB0t Date: Mon, 27 Feb 2023 00:41:45 +0200 Subject: [PATCH] Update on v2.0.1 (beta for next version) Here's an update on the current version, which includes changes towards the next release still in beta. --- componentbuildercustomadminheaderstabs.xml | 2 +- script.php | 195 ++++++++++++--------- 2 files changed, 116 insertions(+), 81 deletions(-) diff --git a/componentbuildercustomadminheaderstabs.xml b/componentbuildercustomadminheaderstabs.xml index 2edaa5e..d37f7cb 100644 --- a/componentbuildercustomadminheaderstabs.xml +++ b/componentbuildercustomadminheaderstabs.xml @@ -1,7 +1,7 @@ PLG_CONTENT_COMPONENTBUILDERCUSTOMADMINHEADERSTABS - 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 4984350..44d50f9 100644 --- a/script.php +++ b/script.php @@ -57,10 +57,13 @@ class plgContentComponentbuilderCustomAdminHeadersTabsInstallerScript $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 plgContentComponentbuilderCustomAdminHeadersTabsInstallerScript $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 plgContentComponentbuilderCustomAdminHeadersTabsInstallerScript $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 plgContentComponentbuilderCustomAdminHeadersTabsInstallerScript $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 plgContentComponentbuilderCustomAdminHeadersTabsInstallerScript $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 plgContentComponentbuilderCustomAdminHeadersTabsInstallerScript $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 plgContentComponentbuilderCustomAdminHeadersTabsInstallerScript $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 plgContentComponentbuilderCustomAdminHeadersTabsInstallerScript $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 plgContentComponentbuilderCustomAdminHeadersTabsInstallerScript $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,84 +389,14 @@ class plgContentComponentbuilderCustomAdminHeadersTabsInstallerScript $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;