Release of v1.2.2
This commit is contained in:
parent
18a0f04ff4
commit
d36a989092
@ -12,6 +12,8 @@
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Application\CMSApplication;
|
||||
use Joomla\CMS\Plugin\CMSPlugin;
|
||||
use Joomla\Registry\Registry;
|
||||
@ -30,7 +32,7 @@ use VDM\Joomla\Componentbuilder\Compiler\Utilities\Line;
|
||||
* Extension - Componentbuilder Privacy Compiler plugin.
|
||||
*
|
||||
* @package ComponentbuilderPrivacyCompiler
|
||||
* @since 1.1.6
|
||||
* @since 1.2.2
|
||||
*/
|
||||
class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
|
||||
{
|
||||
@ -47,7 +49,7 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $languageArray = array();
|
||||
protected $languageArray = [];
|
||||
|
||||
/**
|
||||
* Global switch to see if component have need of privacy plugin to be loaded.
|
||||
@ -63,7 +65,7 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
|
||||
* @var array
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected $activeViews = array();
|
||||
protected $activeViews = [];
|
||||
|
||||
/**
|
||||
* The Views permission fields
|
||||
@ -71,7 +73,7 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
|
||||
* @var array
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected $permissionFields = array();
|
||||
protected $permissionFields = [];
|
||||
|
||||
/**
|
||||
* Event Triggered in the compiler [on Before Model View Data]
|
||||
@ -80,7 +82,7 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
public function jcb_ce_onBeforeModelViewData(&$context, &$view, &$placeholders)
|
||||
public function jcb_ce_onBeforeModelViewData(&$view)
|
||||
{
|
||||
// add the privacy
|
||||
$view->params = (isset($view->params) && JsonHelper::check($view->params)) ? json_decode($view->params, true) : $view->params;
|
||||
@ -117,7 +119,7 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
public function jcb_ce_onAfterGet(&$context, $compiler)
|
||||
public function jcb_ce_onAfterGet()
|
||||
{
|
||||
// check if this component needs a privacy plugin loaded
|
||||
if ($this->loadPrivacy)
|
||||
@ -139,7 +141,7 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
|
||||
}
|
||||
else
|
||||
{
|
||||
JFactory::getApplication()->enqueueMessage(JText::_('PLG_EXTENSION_COMPONENTBUILDERPRIVACYCOMPILER_YOU_DO_NOT_HAVE_A_GLOBAL_PRIVACY_PLUGIN_SETUP_SO_THE_INTEGRATION_WITH_JOOMLA_PRIVACY_SUITE_COULD_NOT_BE_BUILD'), 'Error');
|
||||
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->loadPrivacy= false;
|
||||
}
|
||||
}
|
||||
@ -152,14 +154,14 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
public function jcb_ce_onBeforeUpdateFiles(&$context, $compiler)
|
||||
public function jcb_ce_onBeforeUpdateFiles($compiler)
|
||||
{
|
||||
// check if privacy is to be loaded
|
||||
if ($this->loadPrivacy && ArrayHelper::check($this->activeViews))
|
||||
{
|
||||
// get compiler defaults
|
||||
$strictFieldExportPermissions = $compiler->strictFieldExportPermissions;
|
||||
$exportTextOnly = $compiler->exportTextOnly;
|
||||
$strictFieldExportPermissions = CFactory::_('Config')->get('permission_strict_per_field', false);
|
||||
$exportTextOnly = CFactory::_('Config')->get('export_text_only', 1);
|
||||
|
||||
// load the getPrivacyExport functions
|
||||
foreach ($this->activeViews as $id => &$view)
|
||||
@ -167,11 +169,11 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
|
||||
// set permissions based on view
|
||||
if (isset($view->params['privacy']['permissions']))
|
||||
{
|
||||
$compiler->strictFieldExportPermissions = (int) $view->params['privacy']['permissions'];
|
||||
CFactory::_('Config')->set('permission_strict_per_field', (bool) $view->params['privacy']['permissions']);
|
||||
}
|
||||
|
||||
// allow text only export
|
||||
$compiler->exportTextOnly = 1;
|
||||
CFactory::_('Config')->set('export_text_only', 1);
|
||||
|
||||
// set view list name
|
||||
$viewName_list = StringHelper::safe($view->name_list);
|
||||
@ -190,7 +192,7 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
|
||||
)
|
||||
);
|
||||
// get the permissions building values for later if needed
|
||||
if ($compiler->strictFieldExportPermissions &&
|
||||
if (CFactory::_('Config')->get('permission_strict_per_field', false) &&
|
||||
isset($compiler->permissionFields[$viewName_single]) &&
|
||||
ArrayHelper::check($compiler->permissionFields[$viewName_single]))
|
||||
{
|
||||
@ -199,8 +201,8 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
|
||||
}
|
||||
|
||||
// set compiler defaults
|
||||
$compiler->strictFieldExportPermissions = $strictFieldExportPermissions;
|
||||
$compiler->exportTextOnly = $exportTextOnly;
|
||||
CFactory::_('Config')->set('permission_strict_per_field', $strictFieldExportPermissions);
|
||||
CFactory::_('Config')->set('export_text_only', $exportTextOnly);
|
||||
|
||||
// add helper classes
|
||||
$helper_strings = ['CUSTOM_HELPER_SCRIPT', 'SITE_CUSTOM_HELPER_SCRIPT', 'BOTH_CUSTOM_HELPER_SCRIPT'];
|
||||
@ -218,8 +220,7 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
|
||||
foreach ($privacy_events as $privacy_event => &$add)
|
||||
{
|
||||
// check if the even is overwriten
|
||||
if (strpos($helper_content,
|
||||
'public static function on' . $privacy_event . '(') !== false)
|
||||
if (strpos($helper_content, 'public static function on' . $privacy_event . '(') !== false)
|
||||
{
|
||||
$add = false;
|
||||
}
|
||||
@ -241,7 +242,7 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
public function jcb_ce_onBeforeSetLangFileData(&$context, $compiler)
|
||||
public function jcb_ce_onBeforeSetLangFileData()
|
||||
{
|
||||
if (ArrayHelper::check($this->languageArray))
|
||||
{
|
||||
@ -315,9 +316,9 @@ 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::_('Builder.Permission')->getAction($viewName_single, 'core.delete')
|
||||
. CFactory::_('Compiler.Creator.Permission')->getAction($viewName_single, 'core.delete')
|
||||
. "', 'com_" . Placefix::_("component") . "') && !\$user->authorise('"
|
||||
. CFactory::_('Builder.Permission')->getAction($viewName_single, 'core.privacy.delete')
|
||||
. CFactory::_('Compiler.Creator.Permission')->getAction($viewName_single, 'core.privacy.delete')
|
||||
. "', 'com_" . Placefix::_("component") . "'))";
|
||||
$methods .= PHP_EOL . Indent::_(2) . "{";
|
||||
// set language key
|
||||
@ -373,9 +374,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::_('Builder.Permission')->getGlobal($viewName_single, 'core.access')
|
||||
. CFactory::_('Compiler.Creator.Permission')->getGlobal($viewName_single, 'core.access')
|
||||
. "', 'com_" . Placefix::_("component") . "') || \$user->authorise('"
|
||||
. CFactory::_('Builder.Permission')->getGlobal($viewName_single, 'core.privacy.access')
|
||||
. CFactory::_('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";
|
||||
@ -404,7 +405,7 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
|
||||
$methods .= PHP_EOL . Indent::_(2) . "//" . Line::_(__Line__, __Class__) . " create " . $view->name_list . " domain";
|
||||
$methods .= PHP_EOL . Indent::_(2) . "\$domain = self::createDomain('" . $viewName_single . "', '" . Placefix::_("component") . "_" . $viewName_single . "_data');";
|
||||
$methods .= PHP_EOL . Indent::_(2) . "//" . Line::_(__Line__, __Class__) . " get database object";
|
||||
$methods .= PHP_EOL . Indent::_(2) . "\$db = JFactory::getDbo();";
|
||||
$methods .= PHP_EOL . Indent::_(2) . "\$db = Factory::getDbo();";
|
||||
$methods .= PHP_EOL . Indent::_(2) . "//" . Line::_(__Line__, __Class__) . " get all item ids of " . $view->name_list . " that belong to this user";
|
||||
$methods .= PHP_EOL . Indent::_(2) . "\$query = \$db->getQuery(true)";
|
||||
$methods .= PHP_EOL . Indent::_(3) . "->select('id')";
|
||||
@ -575,9 +576,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::_('Builder.Permission')->getAction($viewName_single, 'core.delete')
|
||||
. CFactory::_('Compiler.Creator.Permission')->getAction($viewName_single, 'core.delete')
|
||||
. "', 'com_" . Placefix::_("component") . "') || \$user->authorise('"
|
||||
. CFactory::_('Builder.Permission')->getAction($viewName_single, 'core.privacy.delete')
|
||||
. CFactory::_('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
|
||||
@ -645,7 +646,7 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
|
||||
|
||||
$methods .= PHP_EOL . Indent::_(1) . "{";
|
||||
$methods .= PHP_EOL . Indent::_(2) . "//" . Line::_(__Line__, __Class__) . " get database object";
|
||||
$methods .= PHP_EOL . Indent::_(2) . "\$db = JFactory::getDbo();";
|
||||
$methods .= PHP_EOL . Indent::_(2) . "\$db = Factory::getDbo();";
|
||||
$methods .= PHP_EOL . Indent::_(2) . "//" . Line::_(__Line__, __Class__) . " get all item ids of " . $view->name_list . " that belong to this user";
|
||||
$methods .= PHP_EOL . Indent::_(2) . "\$query = \$db->getQuery(true)";
|
||||
$methods .= PHP_EOL . Indent::_(3) . "->select('id')";
|
||||
|
@ -1,13 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension type="plugin" version="4" group="extension" method="upgrade">
|
||||
<extension type="plugin" version="3.10" group="extension" method="upgrade">
|
||||
<name>PLG_EXTENSION_COMPONENTBUILDERPRIVACYCOMPILER</name>
|
||||
<creationDate>24th October, 2023</creationDate>
|
||||
<creationDate>2nd March, 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.1.6</version>
|
||||
<version>1.2.2</version>
|
||||
<description>PLG_EXTENSION_COMPONENTBUILDERPRIVACYCOMPILER_XML_DESCRIPTION</description>
|
||||
|
||||
<!-- Scripts to run on installation -->
|
||||
|
@ -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.1.6)</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.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_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."
|
@ -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.1.6)</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.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_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."
|
@ -12,6 +12,11 @@
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Filesystem\File;
|
||||
use Joomla\CMS\Filesystem\Folder;
|
||||
|
||||
/**
|
||||
* Extension - Componentbuilder Privacy Compiler script file.
|
||||
*
|
||||
@ -31,7 +36,7 @@ class plgExtensionComponentbuilderPrivacyCompilerInstallerScript
|
||||
public function preflight($route, $adapter)
|
||||
{
|
||||
// get application
|
||||
$app = JFactory::getApplication();
|
||||
$app = Factory::getApplication();
|
||||
|
||||
// the default for both install and update
|
||||
$jversion = new JVersion();
|
||||
|
Loading…
Reference in New Issue
Block a user