52
0

Compare commits

...

42 Commits
5.x ... 4.x

Author SHA1 Message Date
fd17ceff14
Release of v3.0.0 2024-11-07 11:00:24 +02:00
aa1328410a
Release of v3.0.0 2024-10-13 17:39:06 +02:00
3682051b0b
Release of v3.0.0 2024-10-08 00:38:32 +02:00
9234d153d0
Release of v3.0.0 2024-09-30 02:02:49 +02:00
449c3e7d10
Release of v3.0.0 2024-09-20 03:07:28 +02:00
2019c9593b
Release of v3.0.0 2024-09-19 05:54:25 +02:00
b9ef62c63e
Release of v3.0.0 2024-09-18 04:46:00 +02:00
05a9e3db2e
Release of v3.0.0 2024-08-23 19:55:12 +02:00
39efa1cdf9
Release of v3.0.0 2024-08-21 21:42:53 +02:00
b6cbb427cf
Release of v3.0.0 2024-08-20 22:39:50 +02:00
d3be419308
Release of v3.0.0 2024-08-16 19:27:08 +02:00
bf467e4280
Release of v3.0.0 2024-08-15 01:42:44 +02:00
fc8742e895
Update on v2.0.0 (changes towards the next release)
Here's an update on the current version, which includes changes towards the next release still in development.
2024-07-27 22:51:45 +02:00
3c1f5ac91d
Update on v2.0.0 (changes towards the next release)
Here's an update on the current version, which includes changes towards the next release still in development.
2024-07-26 15:33:19 +02:00
cba4d9a3ed
Update on v2.0.0 (changes towards the next release)
Here's an update on the current version, which includes changes towards the next release still in development.
2024-07-20 22:39:22 +02:00
16b41d096e
Update on v2.0.0 (changes towards the next release)
Here's an update on the current version, which includes changes towards the next release still in development.
2024-07-18 14:57:56 +02:00
f3ac9d0ae2
Update on v2.0.0 (changes towards the next release)
Here's an update on the current version, which includes changes towards the next release still in development.
2024-07-17 02:38:33 +02:00
aeafe02431
Update on v2.0.0 (changes towards the next release)
Here's an update on the current version, which includes changes towards the next release still in development.
2024-07-08 22:54:12 +02:00
e18c29cca4
Update on v2.0.0 (changes towards the next release)
Here's an update on the current version, which includes changes towards the next release still in development.
2024-06-28 03:50:30 +02:00
f0466acc80
Update on v2.0.0 (changes towards the next release)
Here's an update on the current version, which includes changes towards the next release still in development.
2024-06-21 01:37:13 +02:00
de2e4b9932
Update on v2.0.0 (changes towards the next release)
Here's an update on the current version, which includes changes towards the next release still in development.
2024-06-07 23:07:37 +02:00
1f1b493ab6
Update on v2.0.0 (changes towards the next release)
Here's an update on the current version, which includes changes towards the next release still in development.
2024-06-05 16:38:32 +02:00
0738f3063d
Update on v2.0.0 (changes towards the next release)
Here's an update on the current version, which includes changes towards the next release still in development.
2024-05-16 16:06:17 +02:00
a13b26f240
Update on v2.0.0 (changes towards the next release)
Here's an update on the current version, which includes changes towards the next release still in development.
2024-05-13 12:22:56 +02:00
5d74f1f840
Update on v2.0.0 (changes towards the next release)
Here's an update on the current version, which includes changes towards the next release still in development.
2024-05-10 18:12:11 +02:00
577be918fd
Update on v2.0.0 (changes towards the next release)
Here's an update on the current version, which includes changes towards the next release still in development.
2024-05-06 07:43:47 +02:00
28aa53bff5
Update on v2.0.0 (changes towards the next release)
Here's an update on the current version, which includes changes towards the next release still in development.
2024-05-03 07:12:58 +02:00
8cd501c81e
Update on v2.0.0 (changes towards the next release)
Here's an update on the current version, which includes changes towards the next release still in development.
2024-04-30 10:42:14 +02:00
7587446311
Update on v2.0.0 (changes towards the next release)
Here's an update on the current version, which includes changes towards the next release still in development.
2024-04-27 15:51:57 +02:00
df639d5e05
Update on v2.0.0 (changes towards the next release)
Here's an update on the current version, which includes changes towards the next release still in development.
2024-04-24 21:31:12 +02:00
ebefbd8925
Update on v2.0.0 (changes towards the next release)
Here's an update on the current version, which includes changes towards the next release still in development.
2024-04-22 01:07:22 +02:00
805ebd7d78
Update on v2.0.0 (changes towards the next release)
Here's an update on the current version, which includes changes towards the next release still in development.
2024-04-16 20:03:38 +02:00
19ac3408f2
Update on v2.0.0 (changes towards the next release)
Here's an update on the current version, which includes changes towards the next release still in development.
2024-04-09 13:49:29 +02:00
8e0e70717d
Update on v2.0.0 (changes towards the next release)
Here's an update on the current version, which includes changes towards the next release still in development.
2024-04-07 11:54:20 +02:00
e600979c73
Update on v2.0.0 (changes towards the next release)
Here's an update on the current version, which includes changes towards the next release still in development.
2024-04-06 23:29:23 +02:00
3bc83f484c
Update on v2.0.0 (changes towards the next release)
Here's an update on the current version, which includes changes towards the next release still in development.
2024-03-26 22:31:36 +02:00
3879a908c5
Update on v2.0.0 (changes towards the next release)
Here's an update on the current version, which includes changes towards the next release still in development.
2024-03-20 14:20:20 +02:00
58022aa777
Update on v2.0.0 (changes towards the next release)
Here's an update on the current version, which includes changes towards the next release still in development.
2024-03-15 12:12:09 +02:00
a686d7104f
Update on v2.0.0 (changes towards the next release)
Here's an update on the current version, which includes changes towards the next release still in development.
2024-03-12 12:50:20 +02:00
2f4861cb3e
Update on v2.0.0 (changes towards the next release)
Here's an update on the current version, which includes changes towards the next release still in development.
2024-03-11 18:22:04 +02:00
e187592118
Update on v2.0.0 (changes towards the next release)
Here's an update on the current version, which includes changes towards the next release still in development.
2024-03-11 17:01:01 +02:00
1c30e0dfb7
Release of v2.0.0 2024-03-11 16:14:23 +02:00
9 changed files with 332 additions and 403 deletions

View File

@ -1,258 +0,0 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/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\Application\CMSApplication;
use Joomla\CMS\Plugin\CMSPlugin;
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 VDM\Joomla\Componentbuilder\Compiler\Utilities\Indent;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Line;
/**
* Extension - Componentbuilder Export Compiler plugin.
*
* @package ComponentbuilderExportCompiler
* @since 1.2.0
*/
class PlgExtensionComponentbuilderExportCompiler extends CMSPlugin
{
/**
* Application object
*
* @var CMSApplication
* @since 1.0.0
*/
protected $app;
/**
* Affects constructor behavior. If true, language files will be loaded automatically.
*
* @var boolean
* @since 1.0.0
*/
protected $autoloadLanguage = true;
/**
* The language string builder
*
* @var array
*/
protected $languageArray = [];
/*
* The Export Text Only switch
*
* @var int
*/
protected $exportTextOnly = 0;
/*
* The Strict Field Export Permissions switch
*
* @var bool
*/
protected $strictFieldExportPermissions = false;
/**
* Event Triggered in the compiler [on Before Get Component Data]
*
* @return void
*
* @since 1.0
*/
public function jcb_ce_onAfterGetComponentData()
{
if ($this->exportTextOnly && $this->componentActive())
{
// activate export text only
CFactory::_('Config')->set('export_text_only', (int) $this->exportTextOnly);
// activate strict_permission_per_field if set in plugin (default true)
CFactory::_('Config')->set('permission_strict_per_field', (bool) $this->strictFieldExportPermissions);
}
}
/**
* Event Triggered in the compiler [on After Model Component Data]
*
* @return void
*
* @since 1.0
*/
public function jcb_ce_onAfterModelComponentData(&$component)
{
// check if we have export for any view
if ($this->componentActive())
{
// set the export/import option
if (isset($component->admin_views) && ArrayHelper::check($component->admin_views))
{
foreach ($component->admin_views as $view)
{
if (!$this->exportTextOnly && (isset($view['port']) && $view['port'] || 1 == $view['settings']->add_custom_import))
{
$this->exportTextOnly = 1;
$this->strictFieldExportPermissions = (bool) $this->params->get('strict_permission_per_field', 1);
}
}
}
}
}
/**
* Event Triggered in the compiler [on Before Set Lang File Data]
*
* @return void
*
* @since 1.0
*/
public function jcb_ce_onBeforeSetLangFileData()
{
if ($this->exportTextOnly && $this->componentActive() && ArrayHelper::check($this->languageArray))
{
foreach($this->languageArray as $key => $string)
{
CFactory::_('Language')->set('adminsys', $key, $string);
}
}
}
/**
* Event Triggered in the compiler [on Before Set Config Field sets]
*
* @return void
*
* @since 1.0
*/
public function jcb_ce_onBeforeSetConfigFieldsets(&$timer)
{
// only add fields after second time
if ($this->exportTextOnly && $this->componentActive() && $timer == 2)
{
// main lang prefix
$lang = CFactory::_('Config')->lang_prefix . '_CONFIG';
// start building field set for config
$configFieldSets[] = Indent::_(1) . "<fieldset";
$configFieldSets[] = Indent::_(2) . 'name="export_text_only_config"';
$configFieldSets[] = Indent::_(2) . 'label="' . $lang . '_EXPORT_TEXT_ONLY_TAB_LABEL"';
$configFieldSets[] = Indent::_(2) . 'description="' . $lang . '_EXPORT_TEXT_ONLY_TAB_DESCRIPTION">';
// setup lang
$this->languageArray[$lang . '_EXPORT_TEXT_ONLY_TAB_LABEL'] = "Export Options";
$this->languageArray[$lang . '_EXPORT_TEXT_ONLY_TAB_DESCRIPTION'] = "Here are some extra option to adjust the export behavior of admin views.";
// add custom Export Options
if (isset($configFieldSetsCustomField['Export Options']) && ArrayHelper::check($configFieldSetsCustomField['Export Options']))
{
$configFieldSets[] = implode("", $configFieldSetsCustomField['Export Options']);
unset($configFieldSetsCustomField['Export Options']);
}
else
{
$this->languageArray[$lang . '_EXPORT_TEXT_ONLY_LABEL'] = "Export Text Only";
$this->languageArray[$lang . '_EXPORT_TEXT_ONLY_DESCRIPTION'] = "This option enables the export of string/text instead of linked IDs in all admin views that have an export option.";
$this->languageArray[$lang . '_ACTIVATE'] = "Activate";
$this->languageArray[$lang . '_DEACTIVATE'] = "Deactivate";
$configFieldSets[] = PHP_EOL . Indent::_(2) . "<!--" . Line::_(__Line__, __Class__) . " Export Text Only Field. Type: Radio. (joomla) -->";
$configFieldSets[] = Indent::_(2) . "<field";
$configFieldSets[] = Indent::_(3) . "type=\"radio\"";
$configFieldSets[] = Indent::_(3) . "name=\"export_text_only\"";
$configFieldSets[] = Indent::_(3) . "label=\"" . $lang . "_EXPORT_TEXT_ONLY_LABEL\"";
$configFieldSets[] = Indent::_(3) . "description=\"" . $lang . "_EXPORT_TEXT_ONLY_DESCRIPTION\"";
$configFieldSets[] = Indent::_(3) . "class=\"btn-group btn-group-yesno\"";
$configFieldSets[] = Indent::_(3) . "default=\"0\">";
$configFieldSets[] = Indent::_(3) . "<!--" . Line::_(__Line__, __Class__) . " Option Set. -->";
$configFieldSets[] = Indent::_(3) . "<option value=\"1\">";
$configFieldSets[] = Indent::_(4) . $lang . "_ACTIVATE</option>";
$configFieldSets[] = Indent::_(3) . "<option value=\"0\">";
$configFieldSets[] = Indent::_(4) . $lang . "_DEACTIVATE</option>";
$configFieldSets[] = Indent::_(2) . "</field>";
// add strict Field Export Permissions field
if ($this->strictFieldExportPermissions)
{
$this->languageArray[$lang . '_STRICT_PERMISSION_PER_FIELD_LABEL'] = "Use Strict Permission per/field";
$this->languageArray[$lang . '_STRICT_PERMISSION_PER_FIELD_DESCRIPTION'] = "Use strict permissions per/field in the export methods where there are fields permissions in a view.";
$configFieldSets[] = PHP_EOL . Indent::_(2) . "<!--" . Line::_(__Line__, __Class__) . " Strict_permission_per_field Field. Type: Radio. (joomla) -->";
$configFieldSets[] = Indent::_(2) . "<field";
$configFieldSets[] = Indent::_(3) . "type=\"radio\"";
$configFieldSets[] = Indent::_(3) . "name=\"strict_permission_per_field\"";
$configFieldSets[] = Indent::_(3) . "label=\"" . $lang . "_STRICT_PERMISSION_PER_FIELD_LABEL\"";
$configFieldSets[] = Indent::_(3) . "description=\"" . $lang . "_STRICT_PERMISSION_PER_FIELD_DESCRIPTION\"";
$configFieldSets[] = Indent::_(3) . "class=\"btn-group btn-group-yesno\"";
$configFieldSets[] = Indent::_(3) . "default=\"1\">";
$configFieldSets[] = Indent::_(3) . "<!--" . Line::_(__Line__, __Class__) . " Option Set. -->";
$configFieldSets[] = Indent::_(3) . "<option value=\"1\">";
$configFieldSets[] = Indent::_(4) . $lang . "_ACTIVATE</option>";
$configFieldSets[] = Indent::_(3) . "<option value=\"0\">";
$configFieldSets[] = Indent::_(4) . $lang . "_DEACTIVATE</option>";
$configFieldSets[] = Indent::_(2) . "</field>";
}
}
// close that fieldset
$configFieldSets[] = Indent::_(1) . "</fieldset>";
}
}
/**
* The array of active components
*
* @var array
*/
protected $componentsActive;
/**
* The activate option
*
* @var int
*/
protected $activateOption = 0;
/**
* Set the line number in comments
*
* @return bool
*
*/
protected function componentActive()
{
// check the active option
if (!$this->activateOption)
{
$this->activateOption = $this->params->get('activate_option', 1);
}
// active for all components
if ($this->activateOption == 1)
{
return true;
}
// first check is we have the active components set
if ($this->activateOption == 2 && !ArrayHelper::check($this->componentsActive))
{
$this->componentsActive = $this->params->get('components');
}
// only check if there are active
if (ArrayHelper::check($this->componentsActive))
{
return in_array((int) CFactory::_('Config')->component_id, $this->componentsActive);
}
return false;
}
}

View File

@ -1,13 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="plugin" version="3.10" group="extension" method="upgrade">
<extension type="plugin" version="4.0" group="extension" method="upgrade">
<name>PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER</name>
<creationDate>9th March, 2024</creationDate>
<creationDate>7th November, 2024</creationDate>
<author>Llewellyn van der Merwe</author>
<authorEmail>joomla@vdm.io</authorEmail>
<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>1.2.0</version>
<version>3.0.0</version>
<namespace path="src">VDM\Plugin\Extension\ComponentbuilderExportCompiler</namespace>
<description>PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_XML_DESCRIPTION</description>
<!-- Scripts to run on installation -->
@ -15,21 +16,22 @@
<!-- Language files -->
<languages folder="language">
<language tag="en-GB">en-GB/en-GB.plg_extension_componentbuilderexportcompiler.ini</language>
<language tag="en-GB">en-GB/en-GB.plg_extension_componentbuilderexportcompiler.sys.ini</language>
<language tag="en-GB">en-GB/plg_extension_componentbuilderexportcompiler.ini</language>
<language tag="en-GB">en-GB/plg_extension_componentbuilderexportcompiler.sys.ini</language>
</languages>
<!-- Plugin files -->
<files>
<filename plugin="componentbuilderexportcompiler">componentbuilderexportcompiler.php</filename>
<folder plugin="componentbuilderexportcompiler">services</folder>
<filename>index.html</filename>
<folder>language</folder>
<folder>services</folder>
<folder>src</folder>
</files>
<!-- Config parameter -->
<!-- Config parameters -->
<config
addrulepath="/administrator/components/com_componentbuilder/models/rules"
addfieldpath="/administrator/components/com_componentbuilder/models/fields"
addruleprefix="VDM\Component\Componentbuilder\Administrator\Rule"
addfieldprefix="VDM\Component\Componentbuilder\Administrator\Field">
>
<fields name="params">
<fieldset name="basic" label="PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_SETTINGS">

View File

@ -1,6 +1,6 @@
PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER="Extension - Componentbuilder Export Compiler"
PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_DESCRIPTION="This plugin is used to tweak the export options for your components 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 activate the component/s that should be targeted with this added export feature under the Component Activation tab."
PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_XML_DESCRIPTION="<h1>Extension - Componentbuilder Export Compiler (v.1.2.0)</h1> <div style='clear: both;'></div><p>This plugin is used to tweak the export options for your components 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 activate the component/s that should be targeted with this added export feature under the Component Activation tab.</p><p>Created by <a href='https://dev.vdm.io' target='_blank'>Llewellyn van der Merwe</a><br /><small>Development started 21st August, 2019</small></p>"
PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_XML_DESCRIPTION="<h1>Extension - Componentbuilder Export Compiler (v.3.0.0)</h1> <div style='clear: both;'></div><p>This plugin is used to tweak the export options for your components 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 activate the component/s that should be targeted with this added export feature under the Component Activation tab.</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_COMPONENTBUILDEREXPORTCOMPILER_SETTINGS="Settings"
PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_ACTIVATE_OPTION_LABEL="Activate Options"
PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_ACTIVATE_OPTION_DESCRIPTION="You can select the kind of activation control you would like to use. <b>All</b> will target all components, and <b>Selected</b> will let you select only those you want to be active."

View File

@ -1,6 +1,6 @@
PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER="Extension - Componentbuilder Export Compiler"
PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_DESCRIPTION="This plugin is used to tweak the export options for your components 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 activate the component/s that should be targeted with this added export feature under the Component Activation tab."
PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_XML_DESCRIPTION="<h1>Extension - Componentbuilder Export Compiler (v.1.2.0)</h1> <div style='clear: both;'></div><p>This plugin is used to tweak the export options for your components 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 activate the component/s that should be targeted with this added export feature under the Component Activation tab.</p><p>Created by <a href='https://dev.vdm.io' target='_blank'>Llewellyn van der Merwe</a><br /><small>Development started 21st August, 2019</small></p>"
PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_XML_DESCRIPTION="<h1>Extension - Componentbuilder Export Compiler (v.3.0.0)</h1> <div style='clear: both;'></div><p>This plugin is used to tweak the export options for your components 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 activate the component/s that should be targeted with this added export feature under the Component Activation tab.</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_COMPONENTBUILDEREXPORTCOMPILER_SETTINGS="Settings"
PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_ACTIVATE_OPTION_LABEL="Activate Options"
PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_ACTIVATE_OPTION_DESCRIPTION="You can select the kind of activation control you would like to use. <b>All</b> will target all components, and <b>Selected</b> will let you select only those you want to be active."

View File

@ -20,140 +20,8 @@ use Joomla\CMS\Filesystem\Folder;
/**
* Extension - Componentbuilder Export Compiler script file.
*
* @package PlgExtensionComponentbuilderExportCompiler
* @package ComponentbuilderExportCompiler
*/
class plgExtensionComponentbuilderExportCompilerInstallerScript
{
/**
* 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;
}
// 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;
}
}

1
services/index.html Normal file
View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

48
services/provider.php Normal file
View File

@ -0,0 +1,48 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/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\Plugin\PluginHelper;
use Joomla\CMS\Extension\PluginInterface;
use Joomla\Event\DispatcherInterface;
use Joomla\DI\ServiceProviderInterface;
use Joomla\DI\Container;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use VDM\Plugin\Extension\ComponentbuilderExportCompiler\Extension\ComponentbuilderExportCompiler;
return new class () implements ServiceProviderInterface {
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
* @since 4.3.0
*/
public function register(Container $container)
{
$container->set(
PluginInterface::class,
function (Container $container) {
$plugin = new ComponentbuilderExportCompiler(
$container->get(DispatcherInterface::class),
(array) PluginHelper::getPlugin('extension', 'componentbuilderexportcompiler')
);
$plugin->setApplication(Factory::getApplication());
return $plugin;
}
);
}
};

View File

@ -0,0 +1,267 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/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
*/
namespace VDM\Plugin\Extension\ComponentbuilderExportCompiler\Extension;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use Joomla\CMS\Application\CMSApplication;
use Joomla\CMS\Plugin\CMSPlugin;
use VDM\Joomla\Componentbuilder\Compiler\Factory;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Indent;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Line;
use Joomla\Event\SubscriberInterface;
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
/**
* Extension - Componentbuilder Export Compiler plugin.
*
* @package ComponentbuilderExportCompiler
* @since 3.0.0
*/
final class ComponentbuilderExportCompiler extends CMSPlugin implements SubscriberInterface
{
/**
* Affects constructor behavior. If true, language files will be loaded automatically.
*
* @var boolean
* @since 1.0.0
*/
protected $autoloadLanguage = true;
/**
* The language string builder
*
* @var array
*/
protected $languageArray = [];
/*
* The Export Text Only switch
*
* @var int
*/
protected $exportTextOnly = 0;
/*
* The Strict Field Export Permissions switch
*
* @var bool
*/
protected $strictFieldExportPermissions = false;
/**
* Event Triggered in the compiler [on Before Get Component Data]
*
* @return void
*
* @since 1.0
*/
public function jcb_ce_onAfterGetComponentData()
{
if ($this->exportTextOnly && $this->componentActive())
{
// activate export text only
Factory::_('Config')->set('export_text_only', (int) $this->exportTextOnly);
// activate strict_permission_per_field if set in plugin (default true)
Factory::_('Config')->set('permission_strict_per_field', (bool) $this->strictFieldExportPermissions);
}
}
/**
* Event Triggered in the compiler [on After Model Component Data]
*
* @return void
*
* @since 1.0
*/
public function jcb_ce_onAfterModelComponentData(&$component)
{
// check if we have export for any view
if ($this->componentActive())
{
// set the export/import option
if (isset($component->admin_views) && ArrayHelper::check($component->admin_views))
{
foreach ($component->admin_views as $view)
{
if (!$this->exportTextOnly && (isset($view['port']) && $view['port'] || 1 == $view['settings']->add_custom_import))
{
$this->exportTextOnly = 1;
$this->strictFieldExportPermissions = (bool) $this->params->get('strict_permission_per_field', 1);
}
}
}
}
}
/**
* Event Triggered in the compiler [on Before Set Lang File Data]
*
* @return void
*
* @since 1.0
*/
public function jcb_ce_onBeforeSetLangFileData()
{
if ($this->exportTextOnly && $this->componentActive() && ArrayHelper::check($this->languageArray))
{
foreach($this->languageArray as $key => $string)
{
Factory::_('Language')->set('adminsys', $key, $string);
}
}
}
/**
* Event Triggered in the compiler [on Before Set Config Field sets]
*
* @return void
*
* @since 1.0
*/
public function jcb_ce_onBeforeSetConfigFieldsets(&$timer)
{
// only add fields after second time
if ($this->exportTextOnly && $this->componentActive() && $timer == 2)
{
// main lang prefix
$lang = Factory::_('Config')->lang_prefix . '_CONFIG';
// start building field set for config
Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(1) . "<fieldset");
Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(2) . 'name="export_text_only_config"');
Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(2) . 'label="' . $lang . '_EXPORT_TEXT_ONLY_TAB_LABEL"');
Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(2) . 'description="' . $lang . '_EXPORT_TEXT_ONLY_TAB_DESCRIPTION">');
// setup lang
$this->languageArray[$lang . '_EXPORT_TEXT_ONLY_TAB_LABEL'] = "Export Options";
$this->languageArray[$lang . '_EXPORT_TEXT_ONLY_TAB_DESCRIPTION'] = "Here are some extra option to adjust the export behaviour of admin views.";
// add custom Export Options
if (isset($configFieldSetsCustomField['Export Options']) && ArrayHelper::check($configFieldSetsCustomField['Export Options']))
{
Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', implode("", $configFieldSetsCustomField['Export Options']));
unset($configFieldSetsCustomField['Export Options']);
}
else
{
$this->languageArray[$lang . '_EXPORT_TEXT_ONLY_LABEL'] = "Export Text Only";
$this->languageArray[$lang . '_EXPORT_TEXT_ONLY_DESCRIPTION'] = "This option enables the export of string/text instead of linked IDs in all admin views that have an export option.";
$this->languageArray[$lang . '_ACTIVATE'] = "Activate";
$this->languageArray[$lang . '_DEACTIVATE'] = "Deactivate";
Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', PHP_EOL . Indent::_(2) . "<!--" . Line::_(__Line__, __Class__) . " Export Text Only Field. Type: Radio. (joomla) -->");
Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(2) . "<field");
Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(3) . "type=\"radio\"");
Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(3) . "name=\"export_text_only\"");
Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(3) . "label=\"" . $lang . "_EXPORT_TEXT_ONLY_LABEL\"");
Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(3) . "description=\"" . $lang . "_EXPORT_TEXT_ONLY_DESCRIPTION\"");
Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(3) . "class=\"btn-group btn-group-yesno\"");
Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(3) . "default=\"0\">");
Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(3) . "<!--" . Line::_(__Line__, __Class__) . " Option Set. -->");
Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(3) . "<option value=\"1\">");
Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(4) . $lang . "_ACTIVATE</option>");
Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(3) . "<option value=\"0\">");
Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(4) . $lang . "_DEACTIVATE</option>");
Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(2) . "</field>");
// add strict Field Export Permissions field
if ($this->strictFieldExportPermissions)
{
$this->languageArray[$lang . '_STRICT_PERMISSION_PER_FIELD_LABEL'] = "Use Strict Permission per/field";
$this->languageArray[$lang . '_STRICT_PERMISSION_PER_FIELD_DESCRIPTION'] = "Use strict permissions per/field in the export methods where there are fields permissions in a view.";
Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', PHP_EOL . Indent::_(2) . "<!--" . Line::_(__Line__, __Class__) . " Strict_permission_per_field Field. Type: Radio. (joomla) -->");
Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(2) . "<field");
Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(3) . "type=\"radio\"");
Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(3) . "name=\"strict_permission_per_field\"");
Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(3) . "label=\"" . $lang . "_STRICT_PERMISSION_PER_FIELD_LABEL\"");
Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(3) . "description=\"" . $lang . "_STRICT_PERMISSION_PER_FIELD_DESCRIPTION\"");
Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(3) . "class=\"btn-group btn-group-yesno\"");
Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(3) . "default=\"1\">");
Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(3) . "<!--" . Line::_(__Line__, __Class__) . " Option Set. -->");
Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(3) . "<option value=\"1\">");
Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(4) . $lang . "_ACTIVATE</option>");
Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(3) . "<option value=\"0\">");
Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(4) . $lang . "_DEACTIVATE</option>");
Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(2) . "</field>");
}
}
// close that fieldset
Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(1) . "</fieldset>");
}
}
/**
* The array of active components
*
* @var array
*/
protected $componentsActive;
/**
* The activate option
*
* @var int
*/
protected $activateOption = 0;
/**
* Set the line number in comments
*
* @return bool
*
*/
protected function componentActive()
{
// check the active option
if (!$this->activateOption)
{
$this->activateOption = $this->params->get('activate_option', 1);
}
// active for all components
if ($this->activateOption == 1)
{
return true;
}
// first check is we have the active components set
if ($this->activateOption == 2 && !ArrayHelper::check($this->componentsActive))
{
$this->componentsActive = $this->params->get('components');
}
// only check if there are active
if (ArrayHelper::check($this->componentsActive))
{
return in_array((int) Factory::_('Config')->component_id, $this->componentsActive);
}
return false;
}
/**
* Returns an array of events this subscriber will listen to.
*
* @return array
*
* @since 5.0.0
*/
public static function getSubscribedEvents(): array
{
return [
'jcb_ce_onAfterGetComponentData' => 'jcb_ce_onAfterGetComponentData',
'jcb_ce_onAfterModelComponentData' => 'jcb_ce_onAfterModelComponentData',
'jcb_ce_onBeforeSetLangFileData' => 'jcb_ce_onBeforeSetLangFileData',
'jcb_ce_onBeforeSetConfigFieldsets' => 'jcb_ce_onBeforeSetConfigFieldsets'
];
}
}

1
src/Extension/index.html Normal file
View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>