Compare commits
23 Commits
Author | SHA1 | Date | |
---|---|---|---|
4b5acffedc | |||
40ace267c5 | |||
16c928c733 | |||
b0aafb7eda | |||
6070a3ac7a | |||
01345745bf | |||
2021c84dd8 | |||
8201d70a20 | |||
c4aa55cdc6 | |||
eafedd6b66 | |||
3b961b27cf | |||
2572920fef | |||
2251418e73 | |||
4c4633f108 | |||
75c0c4826c | |||
846bbc433b | |||
816a3137b2 | |||
c3db4c75a6 | |||
ec31369930 | |||
3b6ed39a07 | |||
1bd9f9bc89 | |||
dbbea86dc4 | |||
18fd689410 |
|
@ -13,20 +13,23 @@
|
|||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\CMS\Form\Form;
|
||||
use Joomla\CMS\Plugin\CMSPlugin;
|
||||
use Joomla\CMS\Component\ComponentHelper;
|
||||
use Joomla\CMS\Plugin\CMSPlugin;
|
||||
use VDM\Joomla\Utilities\ArrayHelper;
|
||||
use Joomla\CMS\Component\ComponentHelper;
|
||||
|
||||
JLoader::register('ComponentbuilderHelper', JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/componentbuilder.php');
|
||||
|
||||
/**
|
||||
* Content - Componentbuilder Component Headers Tabs plugin.
|
||||
*
|
||||
* @package ComponentbuilderComponentHeadersTabs
|
||||
* @since 3.0.0
|
||||
* @since 2.0.1
|
||||
*/
|
||||
class PlgContentComponentbuilderComponentHeadersTabs extends CMSPlugin
|
||||
{
|
||||
|
||||
/**
|
||||
* Affects constructor behaviour. If true, language files will be loaded automatically.
|
||||
* Affects constructor behavior. If true, language files will be loaded automatically.
|
||||
*
|
||||
* @var boolean
|
||||
* @since 1.0
|
||||
|
@ -36,8 +39,8 @@ class PlgContentComponentbuilderComponentHeadersTabs extends CMSPlugin
|
|||
/**
|
||||
* Runs on content preparation of form.
|
||||
*
|
||||
* @param Form $form The form
|
||||
* @param \stdClass $data The data
|
||||
* @param JForm $form The form
|
||||
* @param stdClass $data The data
|
||||
*
|
||||
* @return boolean
|
||||
*
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension type="plugin" version="5.0" group="content" method="upgrade">
|
||||
<extension type="plugin" version="3.10" group="content" method="upgrade">
|
||||
<name>PLG_CONTENT_COMPONENTBUILDERCOMPONENTHEADERSTABS</name>
|
||||
<creationDate>7th June, 2024</creationDate>
|
||||
<author>Llewellyn van der Merwe</author>
|
||||
|
@ -7,7 +7,7 @@
|
|||
<authorUrl>https://dev.vdm.io</authorUrl>
|
||||
<copyright>Copyright (C) 2015 Vast Development Method. All rights reserved.</copyright>
|
||||
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
|
||||
<version>3.0.0</version>
|
||||
<version>2.0.1</version>
|
||||
<description>PLG_CONTENT_COMPONENTBUILDERCOMPONENTHEADERSTABS_XML_DESCRIPTION</description>
|
||||
|
||||
<!-- Scripts to run on installation -->
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- default paths of joomla_component form points to componentbuilder -->
|
||||
<form
|
||||
addruleprefix="VDM\Component\Componentbuilder\Administrator\Rule"
|
||||
addfieldprefix="VDM\Component\Componentbuilder\Administrator\Field"
|
||||
addrulepath="/administrator/components/com_componentbuilder/models/rules"
|
||||
addfieldpath="/administrator/components/com_componentbuilder/models/fields"
|
||||
>
|
||||
<fields name="params">
|
||||
<fieldset name="joomla_component_headers" label="PLG_CONTENT_COMPONENTBUILDERCOMPONENTHEADERSTABS_CLASS_HEADERS">
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
PLG_CONTENT_COMPONENTBUILDERCOMPONENTHEADERSTABS="Content - Componentbuilder Component Headers Tabs"
|
||||
PLG_CONTENT_COMPONENTBUILDERCOMPONENTHEADERSTABS_DESCRIPTION="This plugin is used to set component class custom headers."
|
||||
PLG_CONTENT_COMPONENTBUILDERCOMPONENTHEADERSTABS_XML_DESCRIPTION="<h1>Content - Componentbuilder Component Headers Tabs (v.3.0.0)</h1> <div style='clear: both;'></div><p>This plugin is used to set component class custom headers.</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_CONTENT_COMPONENTBUILDERCOMPONENTHEADERSTABS_XML_DESCRIPTION="<h1>Content - Componentbuilder Component Headers Tabs (v.2.0.1)</h1> <div style='clear: both;'></div><p>This plugin is used to set component class custom headers.</p><p>Created by <a href='https://dev.vdm.io' target='_blank'>Llewellyn van der Merwe</a><br /><small>Development started 26th December, 2020</small></p>"
|
||||
PLG_CONTENT_COMPONENTBUILDERCOMPONENTHEADERSTABS_CLASS_HEADERS="Class Headers"
|
||||
PLG_CONTENT_COMPONENTBUILDERCOMPONENTHEADERSTABS_ADD_ADMIN_COMPONENT_LABEL="Admin Component<br />Header"
|
||||
PLG_CONTENT_COMPONENTBUILDERCOMPONENTHEADERSTABS_YES="Yes"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
PLG_CONTENT_COMPONENTBUILDERCOMPONENTHEADERSTABS="Content - Componentbuilder Component Headers Tabs"
|
||||
PLG_CONTENT_COMPONENTBUILDERCOMPONENTHEADERSTABS_DESCRIPTION="This plugin is used to set component class custom headers."
|
||||
PLG_CONTENT_COMPONENTBUILDERCOMPONENTHEADERSTABS_XML_DESCRIPTION="<h1>Content - Componentbuilder Component Headers Tabs (v.3.0.0)</h1> <div style='clear: both;'></div><p>This plugin is used to set component class custom headers.</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_CONTENT_COMPONENTBUILDERCOMPONENTHEADERSTABS_XML_DESCRIPTION="<h1>Content - Componentbuilder Component Headers Tabs (v.2.0.1)</h1> <div style='clear: both;'></div><p>This plugin is used to set component class custom headers.</p><p>Created by <a href='https://dev.vdm.io' target='_blank'>Llewellyn van der Merwe</a><br /><small>Development started 26th December, 2020</small></p>"
|
||||
PLG_CONTENT_COMPONENTBUILDERCOMPONENTHEADERSTABS_CLASS_HEADERS="Class Headers"
|
||||
PLG_CONTENT_COMPONENTBUILDERCOMPONENTHEADERSTABS_ADD_ADMIN_COMPONENT_LABEL="Admin Component<br />Header"
|
||||
PLG_CONTENT_COMPONENTBUILDERCOMPONENTHEADERSTABS_YES="Yes"
|
||||
|
|
68
script.php
68
script.php
|
@ -24,4 +24,72 @@ use Joomla\CMS\Filesystem\Folder;
|
|||
*/
|
||||
class plgContentComponentbuilderComponentHeadersTabsInstallerScript
|
||||
{
|
||||
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
|
||||
// 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.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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user