Release of v2.0.0
This commit is contained in:
parent
9e1521a503
commit
2a1a36154d
@ -12,20 +12,18 @@
|
|||||||
// No direct access to this file
|
// No direct access to this file
|
||||||
defined('_JEXEC') or die('Restricted access');
|
defined('_JEXEC') or die('Restricted access');
|
||||||
|
|
||||||
|
use Joomla\CMS\Component\ComponentHelper;
|
||||||
use Joomla\CMS\Application\CMSApplication;
|
use Joomla\CMS\Application\CMSApplication;
|
||||||
use Joomla\CMS\Plugin\CMSPlugin;
|
use Joomla\CMS\Plugin\CMSPlugin;
|
||||||
use Joomla\Registry\Registry;
|
use Joomla\Registry\Registry;
|
||||||
use Joomla\CMS\Form\Form;
|
use Joomla\CMS\Form\Form;
|
||||||
use VDM\Joomla\Utilities\JsonHelper;
|
use VDM\Joomla\Utilities\JsonHelper;
|
||||||
use VDM\Joomla\Utilities\ArrayHelper;
|
use VDM\Joomla\Utilities\ArrayHelper;
|
||||||
|
|
||||||
JLoader::register('ComponentbuilderHelper', JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/componentbuilder.php');
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Content - Componentbuilder Privacy Tabs plugin.
|
* Content - Componentbuilder Privacy Tabs plugin.
|
||||||
*
|
*
|
||||||
* @package ComponentbuilderPrivacyTabs
|
* @package ComponentbuilderPrivacyTabs
|
||||||
* @since 1.0.1
|
* @since 2.0.0
|
||||||
*/
|
*/
|
||||||
class PlgContentComponentbuilderPrivacyTabs extends CMSPlugin
|
class PlgContentComponentbuilderPrivacyTabs extends CMSPlugin
|
||||||
{
|
{
|
||||||
@ -68,7 +66,7 @@ class PlgContentComponentbuilderPrivacyTabs extends CMSPlugin
|
|||||||
//$form->setFieldAttribute('note_select_privacy_plugin', 'showon', 'activate:1', 'params.privacy');
|
//$form->setFieldAttribute('note_select_privacy_plugin', 'showon', 'activate:1', 'params.privacy');
|
||||||
}
|
}
|
||||||
// update all editors to use this components global editor
|
// update all editors to use this components global editor
|
||||||
$global_editor = \JComponentHelper::getParams('com_componentbuilder')->get('editor', 'none');
|
$global_editor = ComponentHelper::getParams('com_componentbuilder')->get('editor', 'none');
|
||||||
// set the field editor value (with none as fallback)
|
// set the field editor value (with none as fallback)
|
||||||
$form->setFieldAttribute('custom_link', 'editor', $global_editor . '|none', 'params.privacy');
|
$form->setFieldAttribute('custom_link', 'editor', $global_editor . '|none', 'params.privacy');
|
||||||
}
|
}
|
||||||
@ -106,7 +104,7 @@ class PlgContentComponentbuilderPrivacyTabs extends CMSPlugin
|
|||||||
// first set new params
|
// first set new params
|
||||||
$this->params->set('plugin', (int) $item->params['plugin']);
|
$this->params->set('plugin', (int) $item->params['plugin']);
|
||||||
// update the global plugin settings
|
// update the global plugin settings
|
||||||
$extensionTable = new JtableExtension(Factory::getDbo());
|
$extensionTable = new \JtableExtension(Factory::getDbo());
|
||||||
$extensionTable->load(array('element' => 'componentbuilderprivacytabs'));
|
$extensionTable->load(array('element' => 'componentbuilderprivacytabs'));
|
||||||
// Save the change
|
// Save the change
|
||||||
$extensionTable->set('params', $this->params->toString());
|
$extensionTable->set('params', $this->params->toString());
|
||||||
@ -121,7 +119,7 @@ class PlgContentComponentbuilderPrivacyTabs extends CMSPlugin
|
|||||||
if (ArrayHelper::check($item->params))
|
if (ArrayHelper::check($item->params))
|
||||||
{
|
{
|
||||||
// Convert the params field to a string.
|
// Convert the params field to a string.
|
||||||
$params = new JRegistry;
|
$params = new Registry;
|
||||||
$params->loadArray($item->params);
|
$params->loadArray($item->params);
|
||||||
$item->params = (string) $params;
|
$item->params = (string) $params;
|
||||||
}
|
}
|
||||||
@ -140,10 +138,10 @@ class PlgContentComponentbuilderPrivacyTabs extends CMSPlugin
|
|||||||
*/
|
*/
|
||||||
protected function cleanCache($group = null, $client_id = 0)
|
protected function cleanCache($group = null, $client_id = 0)
|
||||||
{
|
{
|
||||||
$conf = \Factory::getConfig();
|
$conf = Factory::getConfig();
|
||||||
|
|
||||||
$options = array(
|
$options = array(
|
||||||
'defaultgroup' => $group ?: (isset($this->option) ? $this->option : \Factory::getApplication()->input->get('option')),
|
'defaultgroup' => $group ?: (isset($this->option) ? $this->option : Factory::getApplication()->input->get('option')),
|
||||||
'cachebase' => $client_id ? JPATH_ADMINISTRATOR . '/cache' : $conf->get('cache_path', JPATH_SITE . '/cache'),
|
'cachebase' => $client_id ? JPATH_ADMINISTRATOR . '/cache' : $conf->get('cache_path', JPATH_SITE . '/cache'),
|
||||||
'result' => true,
|
'result' => true,
|
||||||
);
|
);
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<extension type="plugin" version="3.10" group="content" method="upgrade">
|
<extension type="plugin" version="5.0" group="content" method="upgrade">
|
||||||
<name>PLG_CONTENT_COMPONENTBUILDERPRIVACYTABS</name>
|
<name>PLG_CONTENT_COMPONENTBUILDERPRIVACYTABS</name>
|
||||||
<creationDate>9th March, 2024</creationDate>
|
<creationDate>11th March, 2024</creationDate>
|
||||||
<author>Llewellyn van der Merwe</author>
|
<author>Llewellyn van der Merwe</author>
|
||||||
<authorEmail>joomla@vdm.io</authorEmail>
|
<authorEmail>joomla@vdm.io</authorEmail>
|
||||||
<authorUrl>https://dev.vdm.io</authorUrl>
|
<authorUrl>https://dev.vdm.io</authorUrl>
|
||||||
<copyright>Copyright (C) 2015 Vast Development Method. All rights reserved.</copyright>
|
<copyright>Copyright (C) 2015 Vast Development Method. All rights reserved.</copyright>
|
||||||
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
|
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
|
||||||
<version>1.0.1</version>
|
<version>2.0.0</version>
|
||||||
<description>PLG_CONTENT_COMPONENTBUILDERPRIVACYTABS_XML_DESCRIPTION</description>
|
<description>PLG_CONTENT_COMPONENTBUILDERPRIVACYTABS_XML_DESCRIPTION</description>
|
||||||
|
|
||||||
<!-- Scripts to run on installation -->
|
<!-- Scripts to run on installation -->
|
||||||
|
@ -1,181 +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\Factory;
|
|
||||||
use Joomla\CMS\Language\Text;
|
|
||||||
use Joomla\CMS\HTML\HTMLHelper as Html;
|
|
||||||
|
|
||||||
// import the list field type
|
|
||||||
jimport('joomla.form.helper');
|
|
||||||
JFormHelper::loadFieldClass('list');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Joomlaplugins Form Field class for the Componentbuilder component
|
|
||||||
*/
|
|
||||||
class JFormFieldJoomlaplugins extends JFormFieldList
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* The joomlaplugins field type.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
public $type = 'joomlaplugins';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Override to add new button
|
|
||||||
*
|
|
||||||
* @return string The field input markup.
|
|
||||||
*
|
|
||||||
* @since 3.2
|
|
||||||
*/
|
|
||||||
protected function getInput()
|
|
||||||
{
|
|
||||||
// see if we should add buttons
|
|
||||||
$set_button = $this->getAttribute('button');
|
|
||||||
// get html
|
|
||||||
$html = parent::getInput();
|
|
||||||
// if true set button
|
|
||||||
if ($set_button === 'true')
|
|
||||||
{
|
|
||||||
$button = array();
|
|
||||||
$script = array();
|
|
||||||
$button_code_name = $this->getAttribute('name');
|
|
||||||
// get the input from url
|
|
||||||
$app = Factory::getApplication();
|
|
||||||
$jinput = $app->input;
|
|
||||||
// get the view name & id
|
|
||||||
$values = $jinput->getArray(array(
|
|
||||||
'id' => 'int',
|
|
||||||
'view' => 'word'
|
|
||||||
));
|
|
||||||
// check if new item
|
|
||||||
$ref = '';
|
|
||||||
$refJ = '';
|
|
||||||
if (!is_null($values['id']) && strlen($values['view']))
|
|
||||||
{
|
|
||||||
// only load referral if not new item.
|
|
||||||
$ref = '&ref=' . $values['view'] . '&refid=' . $values['id'];
|
|
||||||
$refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
|
|
||||||
// get the return value.
|
|
||||||
$_uri = (string) \Joomla\CMS\Uri\Uri::getInstance();
|
|
||||||
$_return = urlencode(base64_encode($_uri));
|
|
||||||
// load return value.
|
|
||||||
$ref .= '&return=' . $_return;
|
|
||||||
$refJ .= '&return=' . $_return;
|
|
||||||
}
|
|
||||||
// get button label
|
|
||||||
$button_label = trim($button_code_name);
|
|
||||||
$button_label = preg_replace('/_+/', ' ', $button_label);
|
|
||||||
$button_label = preg_replace('/\s+/', ' ', $button_label);
|
|
||||||
$button_label = preg_replace("/[^A-Za-z ]/", '', $button_label);
|
|
||||||
$button_label = ucfirst(strtolower($button_label));
|
|
||||||
// get user object
|
|
||||||
$user = Factory::getUser();
|
|
||||||
// only add if user allowed to create joomla_plugin
|
|
||||||
if ($user->authorise('joomla_plugin.create', 'com_componentbuilder') && $app->isClient('administrator')) // TODO for now only in admin area.
|
|
||||||
{
|
|
||||||
// build Create button
|
|
||||||
$button[] = '<a id="'.$button_code_name.'Create" class="btn btn-small btn-success hasTooltip" title="'.Text::sprintf('PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_CREATE_NEW_S', $button_label).'" style="border-radius: 0px 4px 4px 0px; padding: 4px 4px 4px 7px;"
|
|
||||||
href="index.php?option=com_componentbuilder&view=joomla_plugin&layout=edit'.$ref.'" >
|
|
||||||
<span class="icon-new icon-white"></span></a>';
|
|
||||||
}
|
|
||||||
// only add if user allowed to edit joomla_plugin
|
|
||||||
if ($user->authorise('joomla_plugin.edit', 'com_componentbuilder') && $app->isClient('administrator')) // TODO for now only in admin area.
|
|
||||||
{
|
|
||||||
// build edit button
|
|
||||||
$button[] = '<a id="'.$button_code_name.'Edit" class="btn btn-small hasTooltip" title="'.Text::sprintf('PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_EDIT_S', $button_label).'" style="display: none; padding: 4px 4px 4px 7px;" href="#" >
|
|
||||||
<span class="icon-edit"></span></a>';
|
|
||||||
// build script
|
|
||||||
$script[] = "
|
|
||||||
jQuery(document).ready(function() {
|
|
||||||
jQuery('#adminForm').on('change', '#jform_".$button_code_name."',function (e) {
|
|
||||||
e.preventDefault();
|
|
||||||
var ".$button_code_name."Value = jQuery('#jform_".$button_code_name."').val();
|
|
||||||
".$button_code_name."Button(".$button_code_name."Value);
|
|
||||||
});
|
|
||||||
var ".$button_code_name."Value = jQuery('#jform_".$button_code_name."').val();
|
|
||||||
".$button_code_name."Button(".$button_code_name."Value);
|
|
||||||
});
|
|
||||||
function ".$button_code_name."Button(value) {
|
|
||||||
if (value > 0) {
|
|
||||||
// hide the create button
|
|
||||||
jQuery('#".$button_code_name."Create').hide();
|
|
||||||
// show edit button
|
|
||||||
jQuery('#".$button_code_name."Edit').show();
|
|
||||||
var url = 'index.php?option=com_componentbuilder&view=joomla_plugins&task=joomla_plugin.edit&id='+value+'".$refJ."';
|
|
||||||
jQuery('#".$button_code_name."Edit').attr('href', url);
|
|
||||||
} else {
|
|
||||||
// show the create button
|
|
||||||
jQuery('#".$button_code_name."Create').show();
|
|
||||||
// hide edit button
|
|
||||||
jQuery('#".$button_code_name."Edit').hide();
|
|
||||||
}
|
|
||||||
}";
|
|
||||||
}
|
|
||||||
// check if button was created for joomla_plugin field.
|
|
||||||
if (is_array($button) && count($button) > 0)
|
|
||||||
{
|
|
||||||
// Load the needed script.
|
|
||||||
$document = Factory::getDocument();
|
|
||||||
$document->addScriptDeclaration(implode(' ',$script));
|
|
||||||
// return the button attached to input field.
|
|
||||||
return '<div class="input-append">' .$html . implode('',$button).'</div>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $html;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method to get a list of options for a list input.
|
|
||||||
*
|
|
||||||
* @return array An array of Html options.
|
|
||||||
*/
|
|
||||||
protected function getOptions()
|
|
||||||
{
|
|
||||||
// Get the user object.
|
|
||||||
$user = JFactory::getUser();
|
|
||||||
// Get the databse object.
|
|
||||||
$db = JFactory::getDBO();
|
|
||||||
$query = $db->getQuery(true);
|
|
||||||
$query->select($db->quoteName(array('a.id','a.system_name','a.name','b.name','c.name'),array('id','plugin_system_name','name','class_extends_name','joomla_plugin_group_name')));
|
|
||||||
$query->from($db->quoteName('#__componentbuilder_joomla_plugin', 'a'));
|
|
||||||
$query->join('LEFT', $db->quoteName('#__componentbuilder_class_extends', 'b') . ' ON (' . $db->quoteName('a.class_extends') . ' = ' . $db->quoteName('b.id') . ')');
|
|
||||||
$query->join('LEFT', $db->quoteName('#__componentbuilder_joomla_plugin_group', 'c') . ' ON (' . $db->quoteName('a.joomla_plugin_group') . ' = ' . $db->quoteName('c.id') . ')');
|
|
||||||
$query->where($db->quoteName('a.published') . ' >= 1');
|
|
||||||
$query->order('a.system_name ASC');
|
|
||||||
// Implement View Level Access (if set in table)
|
|
||||||
if (!$user->authorise('core.options', 'com_componentbuilder'))
|
|
||||||
{
|
|
||||||
$columns = $db->getTableColumns('#__componentbuilder_joomla_plugin');
|
|
||||||
if(isset($columns['access']))
|
|
||||||
{
|
|
||||||
$groups = implode(',', $user->getAuthorisedViewLevels());
|
|
||||||
$query->where('a.access IN (' . $groups . ')');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$db->setQuery((string)$query);
|
|
||||||
$items = $db->loadObjectList();
|
|
||||||
$options = array();
|
|
||||||
if ($items)
|
|
||||||
{
|
|
||||||
$options[] = JHtml::_('select.option', '', 'Select a plugin');
|
|
||||||
foreach($items as $item)
|
|
||||||
{
|
|
||||||
// set a full class name
|
|
||||||
$options[] = JHtml::_('select.option', $item->id, '( ' . $item->plugin_system_name . ' ) class Plg' . ucfirst($item->joomla_plugin_group_name) . $item->name . ' extends ' . $item->class_extends_name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $options;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +1,6 @@
|
|||||||
PLG_CONTENT_COMPONENTBUILDERPRIVACYTABS="Content - Componentbuilder Privacy Tabs"
|
PLG_CONTENT_COMPONENTBUILDERPRIVACYTABS="Content - Componentbuilder Privacy Tabs"
|
||||||
PLG_CONTENT_COMPONENTBUILDERPRIVACYTABS_DESCRIPTION="This plugin is used to link your components to the privacy suite of Joomla by adding a new privacy tab to the JCB admin views, where you can set all the required details for the integration."
|
PLG_CONTENT_COMPONENTBUILDERPRIVACYTABS_DESCRIPTION="This plugin is used to link your components to the privacy suite of Joomla by adding a new privacy tab to the JCB admin views, where you can set all the required details for the integration."
|
||||||
PLG_CONTENT_COMPONENTBUILDERPRIVACYTABS_XML_DESCRIPTION="<h1>Content - Componentbuilder Privacy Tabs (v.1.0.1)</h1> <div style='clear: both;'></div><p>This plugin is used to link your components to the privacy suite of Joomla by adding a new privacy tab to the JCB admin views, where you can set all the required details for the integration.</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_CONTENT_COMPONENTBUILDERPRIVACYTABS_XML_DESCRIPTION="<h1>Content - Componentbuilder Privacy Tabs (v.2.0.0)</h1> <div style='clear: both;'></div><p>This plugin is used to link your components to the privacy suite of Joomla by adding a new privacy tab to the JCB admin views, where you can set all the required details for the integration.</p><p>Created by <a href='https://dev.vdm.io' target='_blank'>Llewellyn van der Merwe</a><br /><small>Development started 10th March, 2024</small></p>"
|
||||||
PLG_CONTENT_COMPONENTBUILDERPRIVACYTABS_GLOBAL_PRIVACY="Global Privacy"
|
PLG_CONTENT_COMPONENTBUILDERPRIVACYTABS_GLOBAL_PRIVACY="Global Privacy"
|
||||||
PLG_CONTENT_COMPONENTBUILDERPRIVACYTABS_PLUGIN="Plugin"
|
PLG_CONTENT_COMPONENTBUILDERPRIVACYTABS_PLUGIN="Plugin"
|
||||||
PLG_CONTENT_COMPONENTBUILDERPRIVACYTABS_PRIVACY="Privacy"
|
PLG_CONTENT_COMPONENTBUILDERPRIVACYTABS_PRIVACY="Privacy"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
PLG_CONTENT_COMPONENTBUILDERPRIVACYTABS="Content - Componentbuilder Privacy Tabs"
|
PLG_CONTENT_COMPONENTBUILDERPRIVACYTABS="Content - Componentbuilder Privacy Tabs"
|
||||||
PLG_CONTENT_COMPONENTBUILDERPRIVACYTABS_DESCRIPTION="This plugin is used to link your components to the privacy suite of Joomla by adding a new privacy tab to the JCB admin views, where you can set all the required details for the integration."
|
PLG_CONTENT_COMPONENTBUILDERPRIVACYTABS_DESCRIPTION="This plugin is used to link your components to the privacy suite of Joomla by adding a new privacy tab to the JCB admin views, where you can set all the required details for the integration."
|
||||||
PLG_CONTENT_COMPONENTBUILDERPRIVACYTABS_XML_DESCRIPTION="<h1>Content - Componentbuilder Privacy Tabs (v.1.0.1)</h1> <div style='clear: both;'></div><p>This plugin is used to link your components to the privacy suite of Joomla by adding a new privacy tab to the JCB admin views, where you can set all the required details for the integration.</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_CONTENT_COMPONENTBUILDERPRIVACYTABS_XML_DESCRIPTION="<h1>Content - Componentbuilder Privacy Tabs (v.2.0.0)</h1> <div style='clear: both;'></div><p>This plugin is used to link your components to the privacy suite of Joomla by adding a new privacy tab to the JCB admin views, where you can set all the required details for the integration.</p><p>Created by <a href='https://dev.vdm.io' target='_blank'>Llewellyn van der Merwe</a><br /><small>Development started 10th March, 2024</small></p>"
|
||||||
PLG_CONTENT_COMPONENTBUILDERPRIVACYTABS_GLOBAL_PRIVACY="Global Privacy"
|
PLG_CONTENT_COMPONENTBUILDERPRIVACYTABS_GLOBAL_PRIVACY="Global Privacy"
|
||||||
PLG_CONTENT_COMPONENTBUILDERPRIVACYTABS_PLUGIN="Plugin"
|
PLG_CONTENT_COMPONENTBUILDERPRIVACYTABS_PLUGIN="Plugin"
|
||||||
PLG_CONTENT_COMPONENTBUILDERPRIVACYTABS_PRIVACY="Privacy"
|
PLG_CONTENT_COMPONENTBUILDERPRIVACYTABS_PRIVACY="Privacy"
|
||||||
|
@ -1,56 +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('JPATH_PLATFORM') or die;
|
|
||||||
|
|
||||||
use Joomla\CMS\Factory;
|
|
||||||
use Joomla\CMS\Language\Text;
|
|
||||||
use Joomla\CMS\Form\Form;
|
|
||||||
use Joomla\CMS\Form\FormRule;
|
|
||||||
use Joomla\Registry\Registry;
|
|
||||||
use Joomla\CMS\HTML\HTMLHelper as Html;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Form Rule (Code) class for the Joomla Platform.
|
|
||||||
*/
|
|
||||||
class JFormRuleCode extends FormRule
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Method to test the value.
|
|
||||||
*
|
|
||||||
* @param \SimpleXMLElement $element The SimpleXMLElement object representing the `<field>` tag for the form field object.
|
|
||||||
* @param mixed $value The form field value to validate.
|
|
||||||
* @param string $group The field name group control value. This acts as an array container for the field.
|
|
||||||
* For example if the field has name="foo" and the group value is set to "bar" then the
|
|
||||||
* full field name would end up being "bar[foo]".
|
|
||||||
* @param Registry $input An optional Registry object with the entire data set to validate against the entire form.
|
|
||||||
* @param Form $form The form object for which the field is being tested.
|
|
||||||
*
|
|
||||||
* @return boolean True if the value is valid, false otherwise.
|
|
||||||
*/
|
|
||||||
public function test(\SimpleXMLElement $element, $value, $group = null, Registry $input = null, Form $form = null)
|
|
||||||
{
|
|
||||||
// This removes all validation (is dangerous) but needed to submit code via JCB
|
|
||||||
return true;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* My idea is to add some kind of validation to improve JCB code (per/language)
|
|
||||||
*
|
|
||||||
* So at this time this code validation is used for JavaScript,CSS,HTML and PHP.
|
|
||||||
* We can see what language is being worked on with the syntax property in the $element. (in JCB)
|
|
||||||
* What complicates things is the placeholders, of both custom code, component, and view names.
|
|
||||||
* Ideally we could strip them and then validate the code to being syntactically correct.
|
|
||||||
* But since some of the placeholders form part of the class/function names and the more, it seems like we are pressed for a much more advance solution.
|
|
||||||
* If you have any ideas to how we can go about to do this, then please open an issue on github and lets begin. (this is a nice to have, so don't break a leg...)
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
}
|
|
124
script.php
124
script.php
@ -24,128 +24,4 @@ use Joomla\CMS\Filesystem\Folder;
|
|||||||
*/
|
*/
|
||||||
class plgContentComponentbuilderPrivacyTabsInstallerScript
|
class plgContentComponentbuilderPrivacyTabsInstallerScript
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
|
||||||
* 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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user