Stable release of v3.2.0-beta1
Move beta to main repo. Fix #1053 so that the right and left tabs display correctly in Joomla 4&5.
This commit is contained in:
@ -12,14 +12,22 @@
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Component\ComponentHelper;
|
||||
use Joomla\CMS\Filter\InputFilter;
|
||||
use Joomla\CMS\Filter\OutputFilter;
|
||||
use Joomla\CMS\MVC\Model\AdminModel;
|
||||
use Joomla\CMS\Table\Table;
|
||||
use Joomla\CMS\UCM\UCMType;
|
||||
use Joomla\Registry\Registry;
|
||||
use Joomla\String\StringHelper;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
use Joomla\CMS\Helper\TagsHelper;
|
||||
use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper;
|
||||
use VDM\Joomla\Utilities\ObjectHelper;
|
||||
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
|
||||
use VDM\Joomla\Utilities\GuidHelper;
|
||||
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
|
||||
use VDM\Joomla\Utilities\String\ClassfunctionHelper;
|
||||
use VDM\Joomla\Utilities\GetHelper;
|
||||
|
||||
@ -131,16 +139,16 @@ class ComponentbuilderModelJoomla_plugin extends AdminModel
|
||||
* @param string $prefix A prefix for the table class name. Optional.
|
||||
* @param array $config Configuration array for model. Optional.
|
||||
*
|
||||
* @return JTable A database object
|
||||
* @return Table A database object
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getTable($type = 'joomla_plugin', $prefix = 'ComponentbuilderTable', $config = array())
|
||||
public function getTable($type = 'joomla_plugin', $prefix = 'ComponentbuilderTable', $config = [])
|
||||
{
|
||||
// add table path for when model gets used from other component
|
||||
$this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/tables');
|
||||
// get instance of the table
|
||||
return JTable::getInstance($type, $prefix, $config);
|
||||
return Table::getInstance($type, $prefix, $config);
|
||||
}
|
||||
|
||||
|
||||
@ -176,13 +184,12 @@ class ComponentbuilderModelJoomla_plugin extends AdminModel
|
||||
ComponentbuilderHelper::set($this->vastDevMod, 'joomla_plugin__'.$id);
|
||||
ComponentbuilderHelper::set('joomla_plugin__'.$id, $this->vastDevMod);
|
||||
// set a return value if found
|
||||
$jinput = JFactory::getApplication()->input;
|
||||
$jinput = Factory::getApplication()->input;
|
||||
$return = $jinput->get('return', null, 'base64');
|
||||
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
|
||||
// set a GUID value if found
|
||||
if (isset($item) && ObjectHelper::check($item) && isset($item->guid)
|
||||
&& method_exists('ComponentbuilderHelper', 'validGUID')
|
||||
&& ComponentbuilderHelper::validGUID($item->guid))
|
||||
&& GuidHelper::valid($item->guid))
|
||||
{
|
||||
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
|
||||
}
|
||||
@ -191,7 +198,7 @@ class ComponentbuilderModelJoomla_plugin extends AdminModel
|
||||
return $this->vastDevMod;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Method to get a single record.
|
||||
*
|
||||
@ -338,13 +345,12 @@ class ComponentbuilderModelJoomla_plugin extends AdminModel
|
||||
ComponentbuilderHelper::set($this->vastDevMod, 'joomla_plugin__'.$id);
|
||||
ComponentbuilderHelper::set('joomla_plugin__'.$id, $this->vastDevMod);
|
||||
// set a return value if found
|
||||
$jinput = JFactory::getApplication()->input;
|
||||
$jinput = Factory::getApplication()->input;
|
||||
$return = $jinput->get('return', null, 'base64');
|
||||
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
|
||||
// set a GUID value if found
|
||||
if (isset($item) && ObjectHelper::check($item) && isset($item->guid)
|
||||
&& method_exists('ComponentbuilderHelper', 'validGUID')
|
||||
&& ComponentbuilderHelper::validGUID($item->guid))
|
||||
&& GuidHelper::valid($item->guid))
|
||||
{
|
||||
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
|
||||
}
|
||||
@ -365,7 +371,7 @@ class ComponentbuilderModelJoomla_plugin extends AdminModel
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform'))
|
||||
public function getForm($data = [], $loadData = true, $options = array('control' => 'jform'))
|
||||
{
|
||||
// set load data option
|
||||
$options['load_data'] = $loadData;
|
||||
@ -392,7 +398,7 @@ class ComponentbuilderModelJoomla_plugin extends AdminModel
|
||||
return false;
|
||||
}
|
||||
|
||||
$jinput = JFactory::getApplication()->input;
|
||||
$jinput = Factory::getApplication()->input;
|
||||
|
||||
// The front end calls this model and uses a_id to avoid id clashes so we need to check for that first.
|
||||
if ($jinput->get('a_id'))
|
||||
@ -405,7 +411,7 @@ class ComponentbuilderModelJoomla_plugin extends AdminModel
|
||||
$id = $jinput->get('id', 0, 'INT');
|
||||
}
|
||||
|
||||
$user = JFactory::getUser();
|
||||
$user = Factory::getUser();
|
||||
|
||||
// Check for existing item.
|
||||
// Modify the form based on Edit State access controls.
|
||||
@ -464,7 +470,7 @@ class ComponentbuilderModelJoomla_plugin extends AdminModel
|
||||
}
|
||||
|
||||
// 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');
|
||||
// now get all the editor fields
|
||||
$editors = $form->getXml()->xpath("//field[@type='editor']");
|
||||
// check if we found any
|
||||
@ -492,13 +498,13 @@ class ComponentbuilderModelJoomla_plugin extends AdminModel
|
||||
/**
|
||||
* Method to get the script that have to be included on the form
|
||||
*
|
||||
* @return string script files
|
||||
* @return string script files
|
||||
*/
|
||||
public function getScript()
|
||||
{
|
||||
return 'media/com_componentbuilder/js/joomla_plugin.js';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Method to test whether a record can be deleted.
|
||||
*
|
||||
@ -517,7 +523,7 @@ class ComponentbuilderModelJoomla_plugin extends AdminModel
|
||||
return;
|
||||
}
|
||||
|
||||
$user = JFactory::getUser();
|
||||
$user = Factory::getUser();
|
||||
// The record has been set. Check the record permissions.
|
||||
return $user->authorise('joomla_plugin.delete', 'com_componentbuilder.joomla_plugin.' . (int) $record->id);
|
||||
}
|
||||
@ -535,8 +541,8 @@ class ComponentbuilderModelJoomla_plugin extends AdminModel
|
||||
*/
|
||||
protected function canEditState($record)
|
||||
{
|
||||
$user = JFactory::getUser();
|
||||
$recordId = (!empty($record->id)) ? $record->id : 0;
|
||||
$user = Factory::getUser();
|
||||
$recordId = $record->id ?? 0;
|
||||
|
||||
if ($recordId)
|
||||
{
|
||||
@ -550,28 +556,28 @@ class ComponentbuilderModelJoomla_plugin extends AdminModel
|
||||
// In the absence of better information, revert to the component permissions.
|
||||
return $user->authorise('joomla_plugin.edit.state', 'com_componentbuilder');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Method override to check if you can edit an existing record.
|
||||
*
|
||||
* @param array $data An array of input data.
|
||||
* @param string $key The name of the key for the primary key.
|
||||
* @param array $data An array of input data.
|
||||
* @param string $key The name of the key for the primary key.
|
||||
*
|
||||
* @return boolean
|
||||
* @since 2.5
|
||||
* @return boolean
|
||||
* @since 2.5
|
||||
*/
|
||||
protected function allowEdit($data = array(), $key = 'id')
|
||||
protected function allowEdit($data = [], $key = 'id')
|
||||
{
|
||||
// Check specific edit permission then general edit permission.
|
||||
$user = JFactory::getUser();
|
||||
$user = Factory::getUser();
|
||||
|
||||
return $user->authorise('joomla_plugin.edit', 'com_componentbuilder.joomla_plugin.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('joomla_plugin.edit', 'com_componentbuilder');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Prepare and sanitise the table data prior to saving.
|
||||
*
|
||||
* @param JTable $table A JTable object.
|
||||
* @param Table $table A Table object.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
@ -579,19 +585,19 @@ class ComponentbuilderModelJoomla_plugin extends AdminModel
|
||||
*/
|
||||
protected function prepareTable($table)
|
||||
{
|
||||
$date = JFactory::getDate();
|
||||
$user = JFactory::getUser();
|
||||
|
||||
$date = Factory::getDate();
|
||||
$user = Factory::getUser();
|
||||
|
||||
if (isset($table->name))
|
||||
{
|
||||
$table->name = htmlspecialchars_decode($table->name, ENT_QUOTES);
|
||||
}
|
||||
|
||||
|
||||
if (isset($table->alias) && empty($table->alias))
|
||||
{
|
||||
$table->generateAlias();
|
||||
}
|
||||
|
||||
|
||||
if (empty($table->id))
|
||||
{
|
||||
$table->created = $date->toSql();
|
||||
@ -603,7 +609,7 @@ class ComponentbuilderModelJoomla_plugin extends AdminModel
|
||||
// Set ordering to the last item if not set
|
||||
if (empty($table->ordering))
|
||||
{
|
||||
$db = JFactory::getDbo();
|
||||
$db = Factory::getDbo();
|
||||
$query = $db->getQuery(true)
|
||||
->select('MAX(ordering)')
|
||||
->from($db->quoteName('#__componentbuilder_joomla_plugin'));
|
||||
@ -618,7 +624,7 @@ class ComponentbuilderModelJoomla_plugin extends AdminModel
|
||||
$table->modified = $date->toSql();
|
||||
$table->modified_by = $user->id;
|
||||
}
|
||||
|
||||
|
||||
if (!empty($table->id))
|
||||
{
|
||||
// Increment the items version number.
|
||||
@ -633,10 +639,10 @@ class ComponentbuilderModelJoomla_plugin extends AdminModel
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function loadFormData()
|
||||
protected function loadFormData()
|
||||
{
|
||||
// Check the session for previously entered form data.
|
||||
$data = JFactory::getApplication()->getUserState('com_componentbuilder.edit.joomla_plugin.data', array());
|
||||
$data = Factory::getApplication()->getUserState('com_componentbuilder.edit.joomla_plugin.data', []);
|
||||
|
||||
if (empty($data))
|
||||
{
|
||||
@ -664,7 +670,7 @@ class ComponentbuilderModelJoomla_plugin extends AdminModel
|
||||
public function validate($form, $data, $group = null)
|
||||
{
|
||||
// check if the not_required field is set
|
||||
if (isset($data['not_required']) && ComponentbuilderHelper::checkString($data['not_required']))
|
||||
if (isset($data['not_required']) && UtilitiesStringHelper::check($data['not_required']))
|
||||
{
|
||||
$requiredFields = (array) explode(',',(string) $data['not_required']);
|
||||
$requiredFields = array_unique($requiredFields);
|
||||
@ -672,7 +678,7 @@ class ComponentbuilderModelJoomla_plugin extends AdminModel
|
||||
foreach ($requiredFields as $requiredField)
|
||||
{
|
||||
// make sure there is a string value
|
||||
if (ComponentbuilderHelper::checkString($requiredField))
|
||||
if (UtilitiesStringHelper::check($requiredField))
|
||||
{
|
||||
// change to false
|
||||
$form->setFieldAttribute($requiredField, 'required', 'false');
|
||||
@ -695,7 +701,7 @@ class ComponentbuilderModelJoomla_plugin extends AdminModel
|
||||
{
|
||||
return array('guid');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Method to delete one or more records.
|
||||
*
|
||||
@ -733,7 +739,7 @@ class ComponentbuilderModelJoomla_plugin extends AdminModel
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -775,10 +781,10 @@ class ComponentbuilderModelJoomla_plugin extends AdminModel
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to perform batch operations on an item or a set of items.
|
||||
*
|
||||
@ -804,30 +810,30 @@ class ComponentbuilderModelJoomla_plugin extends AdminModel
|
||||
|
||||
if (empty($pks))
|
||||
{
|
||||
$this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED'));
|
||||
$this->setError(Text::_('JGLOBAL_NO_ITEM_SELECTED'));
|
||||
return false;
|
||||
}
|
||||
|
||||
$done = false;
|
||||
|
||||
// Set some needed variables.
|
||||
$this->user = JFactory::getUser();
|
||||
$this->table = $this->getTable();
|
||||
$this->tableClassName = get_class($this->table);
|
||||
$this->contentType = new JUcmType;
|
||||
$this->type = $this->contentType->getTypeByTable($this->tableClassName);
|
||||
$this->canDo = ComponentbuilderHelper::getActions('joomla_plugin');
|
||||
$this->batchSet = true;
|
||||
$this->user = Factory::getUser();
|
||||
$this->table = $this->getTable();
|
||||
$this->tableClassName = get_class($this->table);
|
||||
$this->contentType = new UCMType;
|
||||
$this->type = $this->contentType->getTypeByTable($this->tableClassName);
|
||||
$this->canDo = ComponentbuilderHelper::getActions('joomla_plugin');
|
||||
$this->batchSet = true;
|
||||
|
||||
if (!$this->canDo->get('core.batch'))
|
||||
{
|
||||
$this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION'));
|
||||
$this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION'));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if ($this->type == false)
|
||||
{
|
||||
$type = new JUcmType;
|
||||
$type = new UCMType;
|
||||
$this->type = $type->getTypeByAlias($this->typeAlias);
|
||||
}
|
||||
|
||||
@ -864,8 +870,7 @@ class ComponentbuilderModelJoomla_plugin extends AdminModel
|
||||
|
||||
if (!$done)
|
||||
{
|
||||
$this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION'));
|
||||
|
||||
$this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION'));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -891,7 +896,7 @@ class ComponentbuilderModelJoomla_plugin extends AdminModel
|
||||
if (empty($this->batchSet))
|
||||
{
|
||||
// Set some needed variables.
|
||||
$this->user = JFactory::getUser();
|
||||
$this->user = Factory::getUser();
|
||||
$this->table = $this->getTable();
|
||||
$this->tableClassName = get_class($this->table);
|
||||
$this->canDo = ComponentbuilderHelper::getActions('joomla_plugin');
|
||||
@ -917,7 +922,7 @@ class ComponentbuilderModelJoomla_plugin extends AdminModel
|
||||
$values['published'] = 0;
|
||||
}
|
||||
|
||||
$newIds = array();
|
||||
$newIds = [];
|
||||
// Parent exists so let's proceed
|
||||
while (!empty($pks))
|
||||
{
|
||||
@ -930,7 +935,7 @@ class ComponentbuilderModelJoomla_plugin extends AdminModel
|
||||
if (!$this->user->authorise('joomla_plugin.edit', $contexts[$pk]))
|
||||
{
|
||||
// Not fatal error
|
||||
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
|
||||
$this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -946,19 +951,19 @@ class ComponentbuilderModelJoomla_plugin extends AdminModel
|
||||
else
|
||||
{
|
||||
// Not fatal error
|
||||
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
|
||||
$this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// Only for strings
|
||||
if (ComponentbuilderHelper::checkString($this->table->system_name) && !is_numeric($this->table->system_name))
|
||||
if (UtilitiesStringHelper::check($this->table->system_name) && !is_numeric($this->table->system_name))
|
||||
{
|
||||
$this->table->system_name = $this->generateUnique('system_name',$this->table->system_name);
|
||||
}
|
||||
|
||||
// insert all set values
|
||||
if (ComponentbuilderHelper::checkArray($values))
|
||||
if (UtilitiesArrayHelper::check($values))
|
||||
{
|
||||
foreach ($values as $key => $value)
|
||||
{
|
||||
@ -970,7 +975,7 @@ class ComponentbuilderModelJoomla_plugin extends AdminModel
|
||||
}
|
||||
|
||||
// update all unique fields
|
||||
if (ComponentbuilderHelper::checkArray($uniqueFields))
|
||||
if (UtilitiesArrayHelper::check($uniqueFields))
|
||||
{
|
||||
foreach ($uniqueFields as $uniqueField)
|
||||
{
|
||||
@ -1034,7 +1039,7 @@ class ComponentbuilderModelJoomla_plugin extends AdminModel
|
||||
if (empty($this->batchSet))
|
||||
{
|
||||
// Set some needed variables.
|
||||
$this->user = JFactory::getUser();
|
||||
$this->user = Factory::getUser();
|
||||
$this->table = $this->getTable();
|
||||
$this->tableClassName = get_class($this->table);
|
||||
$this->canDo = ComponentbuilderHelper::getActions('joomla_plugin');
|
||||
@ -1042,7 +1047,7 @@ class ComponentbuilderModelJoomla_plugin extends AdminModel
|
||||
|
||||
if (!$this->canDo->get('joomla_plugin.edit') && !$this->canDo->get('joomla_plugin.batch'))
|
||||
{
|
||||
$this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT'));
|
||||
$this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT'));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1059,7 +1064,7 @@ class ComponentbuilderModelJoomla_plugin extends AdminModel
|
||||
{
|
||||
if (!$this->user->authorise('joomla_plugin.edit', $contexts[$pk]))
|
||||
{
|
||||
$this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT'));
|
||||
$this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT'));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1075,13 +1080,13 @@ class ComponentbuilderModelJoomla_plugin extends AdminModel
|
||||
else
|
||||
{
|
||||
// Not fatal error
|
||||
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
|
||||
$this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// insert all set values.
|
||||
if (ComponentbuilderHelper::checkArray($values))
|
||||
if (UtilitiesArrayHelper::check($values))
|
||||
{
|
||||
foreach ($values as $key => $value)
|
||||
{
|
||||
@ -1125,7 +1130,7 @@ class ComponentbuilderModelJoomla_plugin extends AdminModel
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Method to save the form data.
|
||||
*
|
||||
@ -1137,15 +1142,15 @@ class ComponentbuilderModelJoomla_plugin extends AdminModel
|
||||
*/
|
||||
public function save($data)
|
||||
{
|
||||
$input = JFactory::getApplication()->input;
|
||||
$filter = JFilterInput::getInstance();
|
||||
|
||||
$input = Factory::getApplication()->input;
|
||||
$filter = InputFilter::getInstance();
|
||||
|
||||
// set the metadata to the Item Data
|
||||
if (isset($data['metadata']) && isset($data['metadata']['author']))
|
||||
{
|
||||
$data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM');
|
||||
|
||||
$metadata = new JRegistry;
|
||||
|
||||
$metadata = new Registry;
|
||||
$metadata->loadArray($data['metadata']);
|
||||
$data['metadata'] = (string) $metadata;
|
||||
}
|
||||
@ -1179,7 +1184,7 @@ class ComponentbuilderModelJoomla_plugin extends AdminModel
|
||||
// Set the method_selection items to data.
|
||||
if (isset($data['method_selection']) && is_array($data['method_selection']))
|
||||
{
|
||||
$method_selection = new JRegistry;
|
||||
$method_selection = new Registry;
|
||||
$method_selection->loadArray($data['method_selection']);
|
||||
$data['method_selection'] = (string) $method_selection;
|
||||
}
|
||||
@ -1192,7 +1197,7 @@ class ComponentbuilderModelJoomla_plugin extends AdminModel
|
||||
// Set the property_selection items to data.
|
||||
if (isset($data['property_selection']) && is_array($data['property_selection']))
|
||||
{
|
||||
$property_selection = new JRegistry;
|
||||
$property_selection = new Registry;
|
||||
$property_selection->loadArray($data['property_selection']);
|
||||
$data['property_selection'] = (string) $property_selection;
|
||||
}
|
||||
@ -1205,7 +1210,7 @@ class ComponentbuilderModelJoomla_plugin extends AdminModel
|
||||
// Set the fields items to data.
|
||||
if (isset($data['fields']) && is_array($data['fields']))
|
||||
{
|
||||
$fields = new JRegistry;
|
||||
$fields = new Registry;
|
||||
$fields->loadArray($data['fields']);
|
||||
$data['fields'] = (string) $fields;
|
||||
}
|
||||
@ -1286,11 +1291,11 @@ class ComponentbuilderModelJoomla_plugin extends AdminModel
|
||||
{
|
||||
$data['php_preflight_uninstall'] = base64_encode($data['php_preflight_uninstall']);
|
||||
}
|
||||
|
||||
|
||||
// Set the Params Items to data
|
||||
if (isset($data['params']) && is_array($data['params']))
|
||||
{
|
||||
$params = new JRegistry;
|
||||
$params = new Registry;
|
||||
$params->loadArray($data['params']);
|
||||
$data['params'] = (string) $params;
|
||||
}
|
||||
@ -1300,7 +1305,7 @@ class ComponentbuilderModelJoomla_plugin extends AdminModel
|
||||
{
|
||||
// Automatic handling of other unique fields
|
||||
$uniqueFields = $this->getUniqueFields();
|
||||
if (ComponentbuilderHelper::checkArray($uniqueFields))
|
||||
if (UtilitiesArrayHelper::check($uniqueFields))
|
||||
{
|
||||
foreach ($uniqueFields as $uniqueField)
|
||||
{
|
||||
@ -1308,14 +1313,14 @@ class ComponentbuilderModelJoomla_plugin extends AdminModel
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (parent::save($data))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Method to generate a unique value.
|
||||
*
|
||||
@ -1328,7 +1333,6 @@ class ComponentbuilderModelJoomla_plugin extends AdminModel
|
||||
*/
|
||||
protected function generateUnique($field,$value)
|
||||
{
|
||||
|
||||
// set field value unique
|
||||
$table = $this->getTable();
|
||||
|
||||
@ -1354,7 +1358,7 @@ class ComponentbuilderModelJoomla_plugin extends AdminModel
|
||||
// Alter the title
|
||||
$table = $this->getTable();
|
||||
|
||||
while ($table->load(array('title' => $title)))
|
||||
while ($table->load(['title' => $title]))
|
||||
{
|
||||
$title = StringHelper::increment($title);
|
||||
}
|
||||
|
Reference in New Issue
Block a user