52
0

Compare commits

...

38 Commits
3.x ... 5.x

Author SHA1 Message Date
9f2bd76e7b
Update on v3.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-11-07 10:55:30 +02:00
12f42d5862
Update on v3.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-10-13 22:54:01 +02:00
c2be954cb9
Update on v3.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-10-08 00:33:55 +02:00
a4db1430a3
Update on v3.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-09-30 01:56:42 +02:00
f3df2e8cae
Update on v3.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-09-20 03:01:45 +02:00
3400287ea9
Update on v3.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-09-19 05:50:09 +02:00
2d9a5cbd8c
Update on v3.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-09-18 04:40:33 +02:00
6ae490271f
Update on v3.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-08-24 14:27:31 +02:00
9be4b8b3d5
Update on v3.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-08-21 21:38:38 +02:00
e176e70832
Update on v3.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-08-20 22:34:47 +02:00
214bbd23d1
Update on v3.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-08-16 19:22:12 +02:00
aa37b1961e
Release of v3.0.0 2024-08-15 01:35:23 +02:00
052d51263e
Release of v2.0.1 2024-07-27 23:05:12 +02:00
a778d12183
Release of v2.0.1 2024-07-26 15:44:48 +02:00
a396b50bfd
Release of v2.0.1 2024-07-20 22:50:17 +02:00
48280b0053
Release of v2.0.1 2024-07-18 15:07:58 +02:00
e240f1aff5
Release of v2.0.1 2024-07-17 02:40:33 +02:00
a2065c141a
Release of v2.0.1 2024-07-08 23:04:46 +02:00
466897f9a8
Release of v2.0.1 2024-06-28 04:00:28 +02:00
2fd0d4c784
Release of v2.0.1 2024-06-21 03:36:25 +02:00
36b11971d4
Release of v2.0.1 2024-06-07 23:31:21 +02:00
c54d2a1338
Release of v2.0.0 2024-05-16 16:15:38 +02:00
4ae1650844
Release of v2.0.0 2024-05-13 12:29:41 +02:00
ec4143067c
Release of v2.0.0 2024-05-10 18:23:22 +02:00
a17d579ea7
Release of v2.0.0 2024-05-06 07:57:16 +02:00
7647206027
Release of v2.0.0 2024-05-03 07:56:11 +02:00
cc10c12a85
Release of v2.0.0 2024-04-30 12:38:13 +02:00
6f4fa877a4
Release of v2.0.0 2024-04-27 16:09:02 +02:00
b68ab9e1a8
Release of v2.0.0 2024-04-24 21:46:39 +02:00
7766a51e43
Release of v2.0.0 2024-04-22 01:23:28 +02:00
03882d5952
Release of v2.0.0 2024-04-09 14:03:59 +02:00
85c66ba77a
Release of v2.0.0 2024-04-07 12:09:55 +02:00
58d993b319
Release of v2.0.0 2024-04-06 23:50:19 +02:00
52493a408f
Release of v2.0.0 2024-03-26 22:41:08 +02:00
0f3808a8b4
Release of v2.0.0 2024-03-20 14:30:39 +02:00
b58ee63a61
Release of v2.0.0 2024-03-15 12:35:14 +02:00
828acf546a
Release of v2.0.0 2024-03-12 13:05:01 +02:00
fcfea05579
Release of v2.0.0 2024-03-11 18:39:21 +02:00
10 changed files with 240 additions and 158 deletions

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="5.0" group="extension" method="upgrade">
<name>PLG_EXTENSION_COMPONENTBUILDERPRIVACYCOMPILER</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.2</version>
<version>3.0.0</version>
<namespace path="src">VDM\Plugin\Extension\ComponentbuilderPrivacyCompiler</namespace>
<description>PLG_EXTENSION_COMPONENTBUILDERPRIVACYCOMPILER_XML_DESCRIPTION</description>
<!-- Scripts to run on installation -->
@ -15,14 +16,17 @@
<!-- Language files -->
<languages folder="language">
<language tag="en-GB">en-GB/en-GB.plg_extension_componentbuilderprivacycompiler.ini</language>
<language tag="en-GB">en-GB/en-GB.plg_extension_componentbuilderprivacycompiler.sys.ini</language>
<language tag="en-GB">en-GB/plg_extension_componentbuilderprivacycompiler.ini</language>
<language tag="en-GB">en-GB/plg_extension_componentbuilderprivacycompiler.sys.ini</language>
<language tag="af-ZA">af-ZA/plg_extension_componentbuilderprivacycompiler.ini</language>
<language tag="af-ZA">af-ZA/plg_extension_componentbuilderprivacycompiler.sys.ini</language>
</languages>
<!-- Plugin files -->
<files>
<filename plugin="componentbuilderprivacycompiler">componentbuilderprivacycompiler.php</filename>
<folder plugin="componentbuilderprivacycompiler">services</folder>
<filename>index.html</filename>
<folder>language</folder>
<folder>services</folder>
<folder>src</folder>
</files>
</extension>

View File

@ -0,0 +1,2 @@
PLG_CONTENT_COMPONENTBUILDERLANGUAGETABS_YES="Ja"
PLG_CONTENT_COMPONENTBUILDERLANGUAGETABS_NO="Nee"

View File

@ -0,0 +1,2 @@
PLG_CONTENT_COMPONENTBUILDERLANGUAGETABS_YES="Ja"
PLG_CONTENT_COMPONENTBUILDERLANGUAGETABS_NO="Nee"

View File

@ -1,4 +1,4 @@
PLG_EXTENSION_COMPONENTBUILDERPRIVACYCOMPILER="Extension - Componentbuilder Privacy Compiler"
PLG_EXTENSION_COMPONENTBUILDERPRIVACYCOMPILER_DESCRIPTION="This plugin is used to build the privacy 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.Also be sure to link your admin views to the privacy suite of Joomla via our other Content - Componentbuilder Privacy Tabs plugin."
PLG_EXTENSION_COMPONENTBUILDERPRIVACYCOMPILER_XML_DESCRIPTION="<h1>Extension - Componentbuilder Privacy Compiler (v.1.2.2)</h1> <div style='clear: both;'></div><p>This plugin is used to build the privacy 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.Also be sure to link your admin views to the privacy suite of Joomla via our other Content - Componentbuilder Privacy Tabs plugin.</p><p>Created by <a href='https://dev.vdm.io' target='_blank'>Llewellyn van der Merwe</a><br /><small>Development started 17th August, 2019</small></p>"
PLG_EXTENSION_COMPONENTBUILDERPRIVACYCOMPILER_XML_DESCRIPTION="<h1>Extension - Componentbuilder Privacy Compiler (v.3.0.0)</h1> <div style='clear: both;'></div><p>This plugin is used to build the privacy 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.Also be sure to link your admin views to the privacy suite of Joomla via our other Content - Componentbuilder Privacy Tabs plugin.</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_COMPONENTBUILDERPRIVACYCOMPILER_YOU_DO_NOT_HAVE_A_GLOBAL_PRIVACY_PLUGIN_SETUP_SO_THE_INTEGRATION_WITH_JOOMLA_PRIVACY_SUITE_COULD_NOT_BE_BUILD="You do not have a global privacy plugin setup, so the integration with Joomla privacy suite could not be build."

View File

@ -1,4 +1,4 @@
PLG_EXTENSION_COMPONENTBUILDERPRIVACYCOMPILER="Extension - Componentbuilder Privacy Compiler"
PLG_EXTENSION_COMPONENTBUILDERPRIVACYCOMPILER_DESCRIPTION="This plugin is used to build the privacy 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.Also be sure to link your admin views to the privacy suite of Joomla via our other Content - Componentbuilder Privacy Tabs plugin."
PLG_EXTENSION_COMPONENTBUILDERPRIVACYCOMPILER_XML_DESCRIPTION="<h1>Extension - Componentbuilder Privacy Compiler (v.1.2.2)</h1> <div style='clear: both;'></div><p>This plugin is used to build the privacy 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.Also be sure to link your admin views to the privacy suite of Joomla via our other Content - Componentbuilder Privacy Tabs plugin.</p><p>Created by <a href='https://dev.vdm.io' target='_blank'>Llewellyn van der Merwe</a><br /><small>Development started 17th August, 2019</small></p>"
PLG_EXTENSION_COMPONENTBUILDERPRIVACYCOMPILER_XML_DESCRIPTION="<h1>Extension - Componentbuilder Privacy Compiler (v.3.0.0)</h1> <div style='clear: both;'></div><p>This plugin is used to build the privacy 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.Also be sure to link your admin views to the privacy suite of Joomla via our other Content - Componentbuilder Privacy Tabs plugin.</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_COMPONENTBUILDERPRIVACYCOMPILER_YOU_DO_NOT_HAVE_A_GLOBAL_PRIVACY_PLUGIN_SETUP_SO_THE_INTEGRATION_WITH_JOOMLA_PRIVACY_SUITE_COULD_NOT_BE_BUILD="You do not have a global privacy plugin setup, so the integration with Joomla privacy suite could not be build."

View File

@ -13,131 +13,129 @@
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
use Joomla\CMS\Version;
use Joomla\CMS\Installer\InstallerAdapter;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Filesystem\File;
use Joomla\CMS\Filesystem\Folder;
use Joomla\Filesystem\File;
use Joomla\Filesystem\Folder;
/**
* Extension - Componentbuilder Privacy Compiler script file.
*
* @package PlgExtensionComponentbuilderPrivacyCompiler
* @package ComponentbuilderPrivacyCompiler
*/
class plgExtensionComponentbuilderPrivacyCompilerInstallerScript
{
/**
* The CMS Application.
*
* @since 4.4.2
*/
protected $app;
/**
* A list of files to be deleted
*
* @var array
* @since 3.6
*/
protected array $deleteFiles = [];
/**
* A list of folders to be deleted
*
* @var array
* @since 3.6
*/
protected array $deleteFolders = [];
/**
* Constructor
*
* @param InstallerAdapter $adapter The object responsible for running this script
*/
public function __construct($adapter)
{
// get application
$this->app = Factory::getApplication();
if (is_file(JPATH_ROOT . '/plugins/extension/componentbuilderprivacycompiler/componentbuilderprivacycompiler.php'))
{
$this->deleteFiles[] = '/plugins/extension/componentbuilderprivacycompiler/componentbuilderprivacycompiler.php';
}
}
/**
* 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
* @param InstallerAdapter $adapter The object responsible for running this script
*
* @return boolean True on success
*/
public function preflight($route, $adapter)
{
// get application
$app = Factory::getApplication();
// set application to local method var, just use $this->app in future [we will drop $app in J6]
$app = $this->app;
// the default for both install and update
$jversion = new JVersion();
if (!$jversion->isCompatible('3.8.0'))
$jversion = new Version();
if (!$jversion->isCompatible('5.0.0'))
{
$app->enqueueMessage('Please upgrade to at least Joomla! 3.8.0 before continuing!', 'error');
$app->enqueueMessage('Please upgrade to at least Joomla! 5.0.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;
}
}
// remove old files and folders
$this->removeFiles();
return true;
}
/**
* Called before any type of action
*
* @param string $route Which action is happening (install|uninstall|discover_install|update)
* @param InstallerAdapter $adapter The object responsible for running this script
*
* @return boolean True on success
*/
public function postflight($route, $adapter)
{
// set application to local method var, just use $this->app in future [we will drop $app in J6]
$app = $this->app;
return true;
}
/**
* Remove the files and folders in the given array from
*
* @return void
* @since 5.0.2
*/
protected function removeFiles()
{
if (!empty($this->deleteFiles))
{
foreach ($this->deleteFiles as $file)
{
if (is_file(JPATH_ROOT . $file) && !File::delete(JPATH_ROOT . $file))
{
echo Text::sprintf('JLIB_INSTALLER_ERROR_FILE_FOLDER', $file) . '<br>';
}
}
}
if (!empty($this->deleteFolders))
{
foreach ($this->deleteFolders as $folder)
{
if (is_dir(JPATH_ROOT . $folder) && !Folder::delete(JPATH_ROOT . $folder))
{
echo Text::sprintf('JLIB_INSTALLER_ERROR_FILE_FOLDER', $folder) . '<br>';
}
}
}
}
}

1
services/index.html Normal file
View File

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

47
services/provider.php Normal file
View File

@ -0,0 +1,47 @@
<?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\Plugin\Extension\ComponentbuilderPrivacyCompiler\Extension\ComponentbuilderPrivacyCompiler;
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 ComponentbuilderPrivacyCompiler(
$container->get(DispatcherInterface::class),
(array) PluginHelper::getPlugin('extension', 'componentbuilderprivacycompiler')
);
$plugin->setApplication(Factory::getApplication());
return $plugin;
}
);
}
};

View File

@ -8,9 +8,7 @@
* @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');
namespace VDM\Plugin\Extension\ComponentbuilderPrivacyCompiler\Extension;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
@ -19,22 +17,24 @@ use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\Registry\Registry;
use VDM\Joomla\Utilities\JsonHelper;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Componentbuilder\Compiler\Factory as CompilerFactory;
use VDM\Joomla\Utilities\StringHelper;
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\Placefix;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Indent;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Line;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Placefix;
use Joomla\Event\SubscriberInterface;
use Joomla\CMS\Plugin\PluginHelper;
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
/**
* Extension - Componentbuilder Privacy Compiler plugin.
*
* @package ComponentbuilderPrivacyCompiler
* @since 1.2.2
* @since 3.0.0
*/
class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
final class ComponentbuilderPrivacyCompiler extends CMSPlugin implements SubscriberInterface
{
/**
* Affects constructor behavior. If true, language files will be loaded automatically.
@ -99,15 +99,25 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
{
$view->addpermissions = array_values($view->addpermissions);
// add the new permissions
$view->addpermissions[] = array('action' => 'view.privacy.delete', 'implementation' => 3, 'title' => $view->name_list . ' Privacy Delete', 'description' => ' Allows the users in this group to remove their personal data in ' . $view->name_list . ' via the Joomla privacy suite.');
$view->addpermissions[] = array('action' => 'view.privacy.access', 'implementation' => 3, 'title' => $view->name_list . ' Privacy Access', 'description' => ' Allows the users in this group to access their personal data in ' . $view->name_list . ' via the Joomla privacy suite.');
$view->addpermissions[] = [
'action' => 'view.privacy.delete',
'implementation' => 3,
'title' => $view->name_list . ' Privacy Delete',
'description' => ' Allows the users in this group to remove their personal data in ' . $view->name_list . ' via the Joomla privacy suite.'
];
$view->addpermissions[] = [
'action' => 'view.privacy.access',
'implementation' => 3,
'title' => $view->name_list . ' Privacy Access',
'description' => ' Allows the users in this group to access their personal data in ' . $view->name_list . ' via the Joomla privacy suite.'
];
// convert back to json
$view->addpermissions = json_encode($view->addpermissions, JSON_FORCE_OBJECT);
}
// add placeholders to view if not already set
if (!isset($this->activeViews[$view->id]->placeholders))
{
$this->activeViews[$view->id]->placeholders = CFactory::_('Placeholder')->active;
$this->activeViews[$view->id]->placeholders = CompilerFactory::_('Placeholder')->active;
}
}
}
@ -124,7 +134,7 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
// check if this component needs a privacy plugin loaded
if ($this->loadPrivacy)
{
$plugin = JPluginHelper::getPlugin('content', 'componentbuilderprivacytabs');
$plugin = PluginHelper::getPlugin('content', 'componentbuilderprivacytabs');
// check if this is json
if (isset($plugin->params) && JsonHelper::check($plugin->params))
{
@ -137,11 +147,11 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
if (isset($plugin->params['plugin']) && $plugin->params['plugin'] > 0)
{
// if linked it will only load it once
CFactory::_('Joomlaplugin.Data')->set($plugin->params['plugin']);
CompilerFactory::_('Joomlaplugin.Data')->set($plugin->params['plugin']);
}
else
{
Factory::getApplication()->enqueueMessage(Text::_('PLG_EXTENSION_COMPONENTBUILDERPRIVACYCOMPILER_YOU_DO_NOT_HAVE_A_GLOBAL_PRIVACY_PLUGIN_SETUP_SO_THE_INTEGRATION_WITH_JOOMLA_PRIVACY_SUITE_COULD_NOT_BE_BUILD'), 'Error');
$this->getApplication()->enqueueMessage(Text::_('PLG_EXTENSION_COMPONENTBUILDERPRIVACYCOMPILER_YOU_DO_NOT_HAVE_A_GLOBAL_PRIVACY_PLUGIN_SETUP_SO_THE_INTEGRATION_WITH_JOOMLA_PRIVACY_SUITE_COULD_NOT_BE_BUILD'), 'Warning');
$this->loadPrivacy= false;
}
}
@ -160,8 +170,8 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
if ($this->loadPrivacy && ArrayHelper::check($this->activeViews))
{
// get compiler defaults
$strictFieldExportPermissions = CFactory::_('Config')->get('permission_strict_per_field', false);
$exportTextOnly = CFactory::_('Config')->get('export_text_only', 1);
$strictFieldExportPermissions = CompilerFactory::_('Config')->get('permission_strict_per_field', false);
$exportTextOnly = CompilerFactory::_('Config')->get('export_text_only', 1);
// load the getPrivacyExport functions
foreach ($this->activeViews as $id => &$view)
@ -169,18 +179,18 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
// set permissions based on view
if (isset($view->params['privacy']['permissions']))
{
CFactory::_('Config')->set('permission_strict_per_field', (bool) $view->params['privacy']['permissions']);
CompilerFactory::_('Config')->set('permission_strict_per_field', (bool) $view->params['privacy']['permissions']);
}
// allow text only export
CFactory::_('Config')->set('export_text_only', 1);
CompilerFactory::_('Config')->set('export_text_only', 1);
// set view list name
$viewName_list = StringHelper::safe($view->name_list);
// set view single name
$viewName_single = StringHelper::safe($view->name_single);
// load the function
CFactory::_('Compiler.Builder.Content.Multi')->add($viewName_list . '|MODELEXPORTMETHOD',
CompilerFactory::_('Compiler.Builder.Content.Multi')->add($viewName_list . '|MODELEXPORTMETHOD',
$compiler->setGetItemsModelMethod(
$viewName_single,
$viewName_list,
@ -192,7 +202,7 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
)
);
// get the permissions building values for later if needed
if (CFactory::_('Config')->get('permission_strict_per_field', false) &&
if (CompilerFactory::_('Config')->get('permission_strict_per_field', false) &&
isset($compiler->permissionFields[$viewName_single]) &&
ArrayHelper::check($compiler->permissionFields[$viewName_single]))
{
@ -201,8 +211,8 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
}
// set compiler defaults
CFactory::_('Config')->set('permission_strict_per_field', $strictFieldExportPermissions);
CFactory::_('Config')->set('export_text_only', $exportTextOnly);
CompilerFactory::_('Config')->set('permission_strict_per_field', $strictFieldExportPermissions);
CompilerFactory::_('Config')->set('export_text_only', $exportTextOnly);
// add helper classes
$helper_strings = ['CUSTOM_HELPER_SCRIPT', 'SITE_CUSTOM_HELPER_SCRIPT', 'BOTH_CUSTOM_HELPER_SCRIPT'];
@ -214,7 +224,7 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
foreach ($helper_strings as $helper)
{
if (($helper_content = CFactory::_('Compiler.Builder.Content.One')->get($helper)) !== null &&
if (($helper_content = CompilerFactory::_('Compiler.Builder.Content.One')->get($helper)) !== null &&
StringHelper::check($helper_content))
{
foreach ($privacy_events as $privacy_event => &$add)
@ -229,8 +239,8 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
}
// add the events still needed
CFactory::_('Compiler.Builder.Content.One')->add('BOTH_CUSTOM_HELPER_SCRIPT',
CFactory::_('Placeholder')->update_($this->getHelperMethod($privacy_events))
CompilerFactory::_('Compiler.Builder.Content.One')->add('BOTH_CUSTOM_HELPER_SCRIPT',
CompilerFactory::_('Placeholder')->update_($this->getHelperMethod($privacy_events))
);
}
}
@ -248,7 +258,7 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
{
foreach($this->languageArray as $key => $string)
{
CFactory::_('Language')->set('site', $key, $string);
CompilerFactory::_('Language')->set('site', $key, $string);
}
}
}
@ -299,7 +309,7 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
$methods .= PHP_EOL . Indent::_(1) . " * @param PrivacyPlugin \$plugin The plugin being processed";
$methods .= PHP_EOL . Indent::_(1) . " * @param PrivacyRemovalStatus \$status The status being set";
$methods .= PHP_EOL . Indent::_(1) . " * @param PrivacyTableRequest \$request The request record being processed";
$methods .= PHP_EOL . Indent::_(1) . " * @param JUser \$user The user account associated with this request if available";
$methods .= PHP_EOL . Indent::_(1) . " * @param Joomla__"."_effdaf6d_2275_425d_9f52_d4952e564d34___Power \$user The user account associated with this request if available";
$methods .= PHP_EOL . Indent::_(1) . " *";
$methods .= PHP_EOL . Indent::_(1) . " * @return PrivacyRemovalStatus";
$methods .= PHP_EOL . Indent::_(1) . " */";
@ -316,27 +326,27 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
$methods .= PHP_EOL . Indent::_(2) . "//" . Line::_(__Line__, __Class__) . " Check if user has permission to delete " . $view->name_list;
// set the if statement based on the permission builder
$methods .= PHP_EOL . Indent::_(2) . "if (!\$user->authorise('"
. CFactory::_('Compiler.Creator.Permission')->getAction($viewName_single, 'core.delete')
. CompilerFactory::_('Compiler.Creator.Permission')->getAction($viewName_single, 'core.delete')
. "', 'com_" . Placefix::_("component") . "') && !\$user->authorise('"
. CFactory::_('Compiler.Creator.Permission')->getAction($viewName_single, 'core.privacy.delete')
. CompilerFactory::_('Compiler.Creator.Permission')->getAction($viewName_single, 'core.privacy.delete')
. "', 'com_" . Placefix::_("component") . "'))";
$methods .= PHP_EOL . Indent::_(2) . "{";
// set language key
$lang_key = $view->placeholders[Placefix::_("LANG_PREFIX")] . '_PRIVACY_CANT_REMOVE_' . $view->placeholders[Placefix::_("VIEWS")];
// set language string
$this->languageArray[$lang_key] = "You do not have permission to remove/delete ". $view->name_list . ".";
$methods .= PHP_EOL . Indent::_(3) . "\$reasons[] = JTe" . "xt::_('" . $lang_key . "');";
$methods .= PHP_EOL . Indent::_(3) . "\$reasons[] = Joomla__" . "_ba6326ef_cb79_4348_80f4_ab086082e3c5___Power::_('" . $lang_key . "');";
$methods .= PHP_EOL . Indent::_(2) . "}";
// set language key
$lang_key = $view->placeholders[Placefix::_("LANG_PREFIX")] . '_PRIVACY_CANT_REMOVE_CONTACT_SUPPORT';
}
$methods .= PHP_EOL . Indent::_(2) . "//" . Line::_(__Line__, __Class__) . " Check if any reasons were found not to allow removal";
$methods .= PHP_EOL . Indent::_(2) . "if (ArrayHelper::check(\$reasons))";
$methods .= PHP_EOL . Indent::_(2) . "if (Super__" . "_0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check(\$reasons))";
$methods .= PHP_EOL . Indent::_(2) . "{";
$methods .= PHP_EOL . Indent::_(3) . "\$status->canRemove = false;";
// set language string
$this->languageArray[$lang_key] = 'Please contact support for more details.';
$methods .= PHP_EOL . Indent::_(3) . "\$status->reason = implode(' ' . PHP_EOL, \$reasons) . ' ' . PHP_EOL . JTe" . "xt::_('" . $lang_key . "');";
$methods .= PHP_EOL . Indent::_(3) . "\$status->reason = implode(' ' . PHP_EOL, \$reasons) . ' ' . PHP_EOL . Joomla__" . "_ba6326ef_cb79_4348_80f4_ab086082e3c5___Power::_('" . $lang_key . "');";
$methods .= PHP_EOL . Indent::_(2) . "}";
$methods .= PHP_EOL . Indent::_(2) . "return \$status;";
$methods .= PHP_EOL . Indent::_(1) . "}" . PHP_EOL;
@ -358,7 +368,7 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
$methods .= PHP_EOL . Indent::_(1) . " * @param PrivacyPlugin \$plugin The plugin being processed";
$methods .= PHP_EOL . Indent::_(1) . " * @param DomainArray \$domains The array of domains";
$methods .= PHP_EOL . Indent::_(1) . " * @param PrivacyTableRequest \$request The request record being processed";
$methods .= PHP_EOL . Indent::_(1) . " * @param JUser \$user The user account associated with this request if available";
$methods .= PHP_EOL . Indent::_(1) . " * @param Joomla__"."_effdaf6d_2275_425d_9f52_d4952e564d34___Power \$user The user account associated with this request if available";
$methods .= PHP_EOL . Indent::_(1) . " *";
$methods .= PHP_EOL . Indent::_(1) . " * @return PrivacyExportDomain[]";
$methods .= PHP_EOL . Indent::_(1) . " */";
@ -374,9 +384,9 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
$methods .= PHP_EOL . Indent::_(2) . "//" . Line::_(__Line__, __Class__) . " Check if user has permission to access " . $view->name_list;
// set the if statement based on the permission builder
$methods .= PHP_EOL . Indent::_(2) . "if (\$user->authorise('"
. CFactory::_('Compiler.Creator.Permission')->getGlobal($viewName_single, 'core.access')
. CompilerFactory::_('Compiler.Creator.Permission')->getGlobal($viewName_single, 'core.access')
. "', 'com_" . Placefix::_("component") . "') || \$user->authorise('"
. CFactory::_('Compiler.Creator.Permission')->getGlobal($viewName_single, 'core.privacy.access')
. CompilerFactory::_('Compiler.Creator.Permission')->getGlobal($viewName_single, 'core.privacy.access')
. "', 'com_" . Placefix::_("component") . "'))";
$methods .= PHP_EOL . Indent::_(2) . "{";
$methods .= PHP_EOL . Indent::_(3) . "//" . Line::_(__Line__, __Class__) . " Get " . $view->name_single . " domain";
@ -396,7 +406,7 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
$methods .= PHP_EOL . Indent::_(1) . "/**";
$methods .= PHP_EOL . Indent::_(1) . " * Create the domain for the " . $view->name_single;
$methods .= PHP_EOL . Indent::_(1) . " *";
$methods .= PHP_EOL . Indent::_(1) . " * @param JTableUser \$user The JTableUser object to process";
$methods .= PHP_EOL . Indent::_(1) . " * @param Joomla__"."_11accf54_fcb9_4ba0_a645_7c80ce14e224___Power \$user The Joomla__"."_11accf54_fcb9_4ba0_a645_7c80ce14e224___Power object to process";
$methods .= PHP_EOL . Indent::_(1) . " *";
$methods .= PHP_EOL . Indent::_(1) . " * @return PrivacyExportDomain";
$methods .= PHP_EOL . Indent::_(1) . " */";
@ -444,7 +454,7 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
$methods .= PHP_EOL . Indent::_(2) . "//" . Line::_(__Line__, __Class__) . " Get all item details of " . $view->name_list . " that belong to this user";
$methods .= PHP_EOL . Indent::_(2) . "\$items = \$model->getPrivacyExport(\$pks, \$user);";
$methods .= PHP_EOL . Indent::_(2) . "//" . Line::_(__Line__, __Class__) . " check if we have items since permissions could block the request";
$methods .= PHP_EOL . Indent::_(2) . "if (ArrayHelper::check(\$items))";
$methods .= PHP_EOL . Indent::_(2) . "if (Super__" . "_0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check(\$items))";
$methods .= PHP_EOL . Indent::_(2) . "{";
$methods .= PHP_EOL . Indent::_(3) . "//" . Line::_(__Line__, __Class__) . " Remove " . $view->name_single . " default columns";
$methods .= PHP_EOL . Indent::_(3) . "foreach (array('params', 'asset_id', 'checked_out', 'checked_out_time', 'created', 'created_by', 'modified', 'modified_by', 'published', 'ordering', 'access', 'version', 'hits') as \$column)";
@ -553,7 +563,7 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
$methods .= PHP_EOL . Indent::_(1) . " * Removes the data associated with a remove information request";
$methods .= PHP_EOL . Indent::_(1) . " *";
$methods .= PHP_EOL . Indent::_(1) . " * @param PrivacyTableRequest \$request The request record being processed";
$methods .= PHP_EOL . Indent::_(1) . " * @param JUser \$user The user account associated with this request if available";
$methods .= PHP_EOL . Indent::_(1) . " * @param Joomla__"."_effdaf6d_2275_425d_9f52_d4952e564d34___Power \$user The user account associated with this request if available";
$methods .= PHP_EOL . Indent::_(1) . " *";
$methods .= PHP_EOL . Indent::_(1) . " * @return void";
$methods .= PHP_EOL . Indent::_(1) . " */";
@ -576,9 +586,9 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
$methods .= PHP_EOL . Indent::_(2) . "//" . Line::_(__Line__, __Class__) . " Check if user has permission to delet " . $view->name_list;
// set the if statement based on the permission builder
$methods .= PHP_EOL . Indent::_(2) . "if (\$user->authorise('"
. CFactory::_('Compiler.Creator.Permission')->getAction($viewName_single, 'core.delete')
. CompilerFactory::_('Compiler.Creator.Permission')->getAction($viewName_single, 'core.delete')
. "', 'com_" . Placefix::_("component") . "') || \$user->authorise('"
. CFactory::_('Compiler.Creator.Permission')->getAction($viewName_single, 'core.privacy.delete')
. CompilerFactory::_('Compiler.Creator.Permission')->getAction($viewName_single, 'core.privacy.delete')
. "', 'com_" . Placefix::_("component") . "'))";
$methods .= PHP_EOL . Indent::_(2) . "{";
// check if this is a plain delete, or it is a Anonymize
@ -627,7 +637,7 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
}
$methods .= PHP_EOL . Indent::_(1) . " *";
$methods .= PHP_EOL . Indent::_(1) . " * @param JTableUser \$user The JTableUser object to process";
$methods .= PHP_EOL . Indent::_(1) . " * @param Joomla__"."_11accf54_fcb9_4ba0_a645_7c80ce14e224___Power \$user The Joomla__"."_11accf54_fcb9_4ba0_a645_7c80ce14e224___Power object to process";
$methods .= PHP_EOL . Indent::_(1) . " *";
$methods .= PHP_EOL . Indent::_(1) . " * @return void";
$methods .= PHP_EOL . Indent::_(1) . " */";
@ -681,7 +691,7 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
$methods .= PHP_EOL . Indent::_(2) . "//" . Line::_(__Line__, __Class__) . " get all items for the " . $view->name_list . " table that belong to this user";
$methods .= PHP_EOL . Indent::_(2) . "\$pks = \$db->setQuery(\$query)->loadColumn();";
$methods .= PHP_EOL .PHP_EOL . Indent::_(2) . "if (ArrayHelper::check(\$pks))";
$methods .= PHP_EOL .PHP_EOL . Indent::_(2) . "if (Super__" . "_0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check(\$pks))";
$methods .= PHP_EOL . Indent::_(2) . "{";
$methods .= PHP_EOL . Indent::_(3) . "//" . Line::_(__Line__, __Class__) . " get the " . $viewName_single . " model";
$methods .= PHP_EOL . Indent::_(3) . "\$model = self::getModel('" . $viewName_single . "', JPATH_ADMINISTRATOR . '/components/com_" . Placefix::_("component") . "');";
@ -738,7 +748,7 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
if ($hasPermissional)
{
$methods .= PHP_EOL . PHP_EOL . Indent::_(3) . "//" . Line::_(__Line__, __Class__) . " Get global permissional control activation. (default is inactive)";
$methods .= PHP_EOL . Indent::_(3) . "\$strict_permission_per_field = \JComponentHelper::getParams('com_" . Placefix::_("component") . "')->get('strict_permission_per_field', 0);";
$methods .= PHP_EOL . Indent::_(3) . "\$strict_permission_per_field = Joomla__" . "_aeb8e463_291f_4445_9ac4_34b637c12dbd___Power::getParams('com_" . Placefix::_("component") . "')->get('strict_permission_per_field', 0);";
$methods .= PHP_EOL . Indent::_(3) . "if(\$strict_permission_per_field)";
$methods .= PHP_EOL . Indent::_(3) . "{";
$methods .= PHP_EOL . Indent::_(4) . "//" . Line::_(__Line__, __Class__) . " remove all fields that is not permitted to be changed";
@ -768,7 +778,7 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
$methods .= PHP_EOL . Indent::_(3) . "\$table = \$model->getTable();";
$methods .= PHP_EOL . Indent::_(3) . "//" . Line::_(__Line__, __Class__) . " check that we still have pseudoanonymised data for " . $view->name_list . " set";
$methods .= PHP_EOL . Indent::_(3) . "if (!ArrayHelper::check(\$pseudoanonymisedData))";
$methods .= PHP_EOL . Indent::_(3) . "if (!Super__" . "_0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check(\$pseudoanonymisedData))";
$methods .= PHP_EOL . Indent::_(3) . "{";
$methods .= PHP_EOL . Indent::_(4) . "//" . Line::_(__Line__, __Class__) . " still archive all items";
$methods .= PHP_EOL . Indent::_(4) . "\$table->publish(\$pks, 2);";
@ -819,4 +829,21 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
$methods .= PHP_EOL . Indent::_(1) . "}" . PHP_EOL;
}
}
/**
* Returns an array of events this subscriber will listen to.
*
* @return array
*
* @since 5.0.0
*/
public static function getSubscribedEvents(): array
{
return [
'jcb_ce_onBeforeModelViewData' => 'jcb_ce_onBeforeModelViewData',
'jcb_ce_onAfterGet' => 'jcb_ce_onAfterGet',
'jcb_ce_onBeforeUpdateFiles' => 'jcb_ce_onBeforeUpdateFiles',
'jcb_ce_onBeforeSetLangFileData' => 'jcb_ce_onBeforeSetLangFileData'
];
}
}

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

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