Changed JArrayHelper to use ArrayHelper and added the use namespace to the files needed. Changed JString to use StringHelper and added the use namespace to the files needed. Fixed the spelling mistake of uniqe. Made changes to compiler to accomidate the new pro member feature that added viewsDefaultOrdering options. Fixed the moving of custom fields found in subforms of a plugin or module. Improved the sorting options to correctly map for custom fields and the category field.

This commit is contained in:
Llewellyn van der Merwe 2020-05-22 01:38:20 +02:00
parent f314464575
commit 2564b75e5d
Signed by untrusted user: Llewellyn
GPG Key ID: EFC0C720A240551C
236 changed files with 2041 additions and 1594 deletions

View File

@ -12,7 +12,7 @@ The Component Builder for [Joomla](https://extensions.joomla.org/extension/compo
Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will safe you lots of time and money. A real must have! Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will safe you lots of time and money. A real must have!
You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.11.0) with **ALL** its features and **ALL** concepts totally open-source and free! You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.11.1) with **ALL** its features and **ALL** concepts totally open-source and free!
> Watch Quick Build of a Hello World component in [JCB on Youtube](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45) > Watch Quick Build of a Hello World component in [JCB on Youtube](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45)
@ -144,14 +144,14 @@ TODO
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder) + *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
+ *First Build*: 30th April, 2015 + *First Build*: 30th April, 2015
+ *Last Build*: 23rd April, 2020 + *Last Build*: 21st May, 2020
+ *Version*: 2.11.0 + *Version*: 2.11.1
+ *Copyright*: Copyright (C) 2015 - 2020 Vast Development Method. All rights reserved. + *Copyright*: Copyright (C) 2015 - 2020 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt + *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **280795** + *Line count*: **281703**
+ *Field count*: **1514** + *Field count*: **1522**
+ *File count*: **1769** + *File count*: **1783**
+ *Folder count*: **286** + *Folder count*: **295**
> This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](http://joomlacomponentbuilder.com). > This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](http://joomlacomponentbuilder.com).
> Developed by [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) > Developed by [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)

View File

@ -12,7 +12,7 @@ The Component Builder for [Joomla](https://extensions.joomla.org/extension/compo
Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will safe you lots of time and money. A real must have! Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will safe you lots of time and money. A real must have!
You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.11.0) with **ALL** its features and **ALL** concepts totally open-source and free! You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.11.1) with **ALL** its features and **ALL** concepts totally open-source and free!
> Watch Quick Build of a Hello World component in [JCB on Youtube](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45) > Watch Quick Build of a Hello World component in [JCB on Youtube](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45)
@ -144,14 +144,14 @@ TODO
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder) + *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
+ *First Build*: 30th April, 2015 + *First Build*: 30th April, 2015
+ *Last Build*: 23rd April, 2020 + *Last Build*: 21st May, 2020
+ *Version*: 2.11.0 + *Version*: 2.11.1
+ *Copyright*: Copyright (C) 2015 - 2020 Vast Development Method. All rights reserved. + *Copyright*: Copyright (C) 2015 - 2020 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt + *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **280795** + *Line count*: **281703**
+ *Field count*: **1514** + *Field count*: **1522**
+ *File count*: **1769** + *File count*: **1783**
+ *Folder count*: **286** + *Folder count*: **295**
> This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](http://joomlacomponentbuilder.com). > This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](http://joomlacomponentbuilder.com).
> Developed by [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) > Developed by [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)

View File

@ -13,6 +13,7 @@
pointer-events: none; pointer-events: none;
} }
.fieldMedium { width: 120px; } .fieldMedium { width: 120px; }
.fieldLarge { width: 320px; }
.fieldMid { width: 80px; } .fieldMid { width: 80px; }
.fieldFull { width: 100%; } .fieldFull { width: 100%; }
.fieldSmall { width: 60px; } .fieldSmall { width: 60px; }

View File

@ -18,6 +18,8 @@ defined('_JEXEC') or die('Restricted access');
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
use Joomla\Registry\Registry; use Joomla\Registry\Registry;
use Joomla\String\StringHelper;
use Joomla\Utilities\ArrayHelper;
/** /**
* ###Component### ###View### Model * ###Component### ###View### Model
@ -303,7 +305,7 @@ class ###Component###Model###View### extends JModelAdmin
{ {
// Sanitize ids. // Sanitize ids.
$pks = array_unique($pks); $pks = array_unique($pks);
JArrayHelper::toInteger($pks); ArrayHelper::toInteger($pks);
// Remove any values of zero. // Remove any values of zero.
if (array_search(0, $pks, true)) if (array_search(0, $pks, true))
@ -344,7 +346,7 @@ class ###Component###Model###View### extends JModelAdmin
if (!empty($commands['move_copy'])) if (!empty($commands['move_copy']))
{ {
$cmd = JArrayHelper::getValue($commands, 'move_copy', 'c'); $cmd = ArrayHelper::getValue($commands, 'move_copy', 'c');
if ($cmd == 'c') if ($cmd == 'c')
{ {
@ -424,7 +426,7 @@ class ###Component###Model###View### extends JModelAdmin
} }
/** /**
* Method to generate a uniqe value. * Method to generate a unique value.
* *
* @param string $field name. * @param string $field name.
* @param string $value data. * @param string $value data.
@ -433,15 +435,15 @@ class ###Component###Model###View### extends JModelAdmin
* *
* @since 3.0 * @since 3.0
*/ */
protected function generateUniqe($field,$value) protected function generateUnique($field,$value)
{ {
// set field value uniqe // set field value unique
$table = $this->getTable(); $table = $this->getTable();
while ($table->load(array($field => $value))) while ($table->load(array($field => $value)))
{ {
$value = JString::increment($value); $value = StringHelper::increment($value);
} }
return $value; return $value;

View File

@ -18,6 +18,8 @@ defined('_JEXEC') or die('Restricted access');
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
use Joomla\Registry\Registry; use Joomla\Registry\Registry;
use Joomla\String\StringHelper;
use Joomla\Utilities\ArrayHelper;
/** /**
* ###Component### ###View### Model * ###Component### ###View### Model
@ -303,7 +305,7 @@ class ###Component###Model###View### extends JModelAdmin
{ {
// Sanitize ids. // Sanitize ids.
$pks = array_unique($pks); $pks = array_unique($pks);
JArrayHelper::toInteger($pks); ArrayHelper::toInteger($pks);
// Remove any values of zero. // Remove any values of zero.
if (array_search(0, $pks, true)) if (array_search(0, $pks, true))
@ -344,7 +346,7 @@ class ###Component###Model###View### extends JModelAdmin
if (!empty($commands['move_copy'])) if (!empty($commands['move_copy']))
{ {
$cmd = JArrayHelper::getValue($commands, 'move_copy', 'c'); $cmd = ArrayHelper::getValue($commands, 'move_copy', 'c');
if ($cmd == 'c') if ($cmd == 'c')
{ {
@ -424,7 +426,7 @@ class ###Component###Model###View### extends JModelAdmin
} }
/** /**
* Method to generate a uniqe value. * Method to generate a unique value.
* *
* @param string $field name. * @param string $field name.
* @param string $value data. * @param string $value data.
@ -433,15 +435,15 @@ class ###Component###Model###View### extends JModelAdmin
* *
* @since 3.0 * @since 3.0
*/ */
protected function generateUniqe($field,$value) protected function generateUnique($field,$value)
{ {
// set field value uniqe // set field value unique
$table = $this->getTable(); $table = $this->getTable();
while ($table->load(array($field => $value))) while ($table->load(array($field => $value)))
{ {
$value = JString::increment($value); $value = StringHelper::increment($value);
} }
return $value; return $value;

View File

@ -17,6 +17,8 @@ defined('_JEXEC') or die('Restricted access');
// 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\Utilities\ArrayHelper;
/** /**
* ###Views### Model * ###Views### Model
*/ */

View File

@ -17,6 +17,8 @@ defined('_JEXEC') or die('Restricted access');
// 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\Utilities\ArrayHelper;
/** /**
* ###Component### Ajax Model * ###Component### Ajax Model
*/ */

View File

@ -17,7 +17,7 @@ defined('_JEXEC') or die('Restricted access');
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
jimport('joomla.application.component.helper'); use Joomla\Utilities\ArrayHelper;
/** /**
* ###Component### Ajax Model * ###Component### Ajax Model

View File

@ -17,6 +17,8 @@ defined('_JEXEC') or die('Restricted access');
// 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\Utilities\ArrayHelper;
/** /**
* ###Component### Model for ###SViews### * ###Component### Model for ###SViews###
*/ */

View File

@ -17,6 +17,8 @@ defined('_JEXEC') or die('Restricted access');
// 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\Utilities\ArrayHelper;
/** /**
* ###Component### Model for ###SViews### * ###Component### Model for ###SViews###
*/ */

View File

@ -53,7 +53,7 @@ class ComponentbuilderControllerAdmin_views extends JControllerAdmin
$input = JFactory::getApplication()->input; $input = JFactory::getApplication()->input;
$pks = $input->post->get('cid', array(), 'array'); $pks = $input->post->get('cid', array(), 'array');
// Sanitize the input // Sanitize the input
JArrayHelper::toInteger($pks); ArrayHelper::toInteger($pks);
// Get the model // Get the model
$model = $this->getModel('Admin_views'); $model = $this->getModel('Admin_views');
// get the data to export // get the data to export

View File

@ -53,7 +53,7 @@ class ComponentbuilderControllerClass_methods extends JControllerAdmin
$input = JFactory::getApplication()->input; $input = JFactory::getApplication()->input;
$pks = $input->post->get('cid', array(), 'array'); $pks = $input->post->get('cid', array(), 'array');
// Sanitize the input // Sanitize the input
JArrayHelper::toInteger($pks); ArrayHelper::toInteger($pks);
// Get the model // Get the model
$model = $this->getModel('Class_methods'); $model = $this->getModel('Class_methods');
// get the data to export // get the data to export

View File

@ -53,7 +53,7 @@ class ComponentbuilderControllerClass_properties extends JControllerAdmin
$input = JFactory::getApplication()->input; $input = JFactory::getApplication()->input;
$pks = $input->post->get('cid', array(), 'array'); $pks = $input->post->get('cid', array(), 'array');
// Sanitize the input // Sanitize the input
JArrayHelper::toInteger($pks); ArrayHelper::toInteger($pks);
// Get the model // Get the model
$model = $this->getModel('Class_properties'); $model = $this->getModel('Class_properties');
// get the data to export // get the data to export

View File

@ -53,7 +53,7 @@ class ComponentbuilderControllerCustom_admin_views extends JControllerAdmin
$input = JFactory::getApplication()->input; $input = JFactory::getApplication()->input;
$pks = $input->post->get('cid', array(), 'array'); $pks = $input->post->get('cid', array(), 'array');
// Sanitize the input // Sanitize the input
JArrayHelper::toInteger($pks); ArrayHelper::toInteger($pks);
// Get the model // Get the model
$model = $this->getModel('Custom_admin_views'); $model = $this->getModel('Custom_admin_views');
// get the data to export // get the data to export

View File

@ -53,7 +53,7 @@ class ComponentbuilderControllerCustom_codes extends JControllerAdmin
$input = JFactory::getApplication()->input; $input = JFactory::getApplication()->input;
$pks = $input->post->get('cid', array(), 'array'); $pks = $input->post->get('cid', array(), 'array');
// Sanitize the input // Sanitize the input
JArrayHelper::toInteger($pks); ArrayHelper::toInteger($pks);
// Get the model // Get the model
$model = $this->getModel('Custom_codes'); $model = $this->getModel('Custom_codes');
// get the data to export // get the data to export

View File

@ -53,7 +53,7 @@ class ComponentbuilderControllerDynamic_gets extends JControllerAdmin
$input = JFactory::getApplication()->input; $input = JFactory::getApplication()->input;
$pks = $input->post->get('cid', array(), 'array'); $pks = $input->post->get('cid', array(), 'array');
// Sanitize the input // Sanitize the input
JArrayHelper::toInteger($pks); ArrayHelper::toInteger($pks);
// Get the model // Get the model
$model = $this->getModel('Dynamic_gets'); $model = $this->getModel('Dynamic_gets');
// get the data to export // get the data to export

View File

@ -53,7 +53,7 @@ class ComponentbuilderControllerFields extends JControllerAdmin
$input = JFactory::getApplication()->input; $input = JFactory::getApplication()->input;
$pks = $input->post->get('cid', array(), 'array'); $pks = $input->post->get('cid', array(), 'array');
// Sanitize the input // Sanitize the input
JArrayHelper::toInteger($pks); ArrayHelper::toInteger($pks);
// Get the model // Get the model
$model = $this->getModel('Fields'); $model = $this->getModel('Fields');
// get the data to export // get the data to export

View File

@ -53,7 +53,7 @@ class ComponentbuilderControllerFieldtypes extends JControllerAdmin
$input = JFactory::getApplication()->input; $input = JFactory::getApplication()->input;
$pks = $input->post->get('cid', array(), 'array'); $pks = $input->post->get('cid', array(), 'array');
// Sanitize the input // Sanitize the input
JArrayHelper::toInteger($pks); ArrayHelper::toInteger($pks);
// Get the model // Get the model
$model = $this->getModel('Fieldtypes'); $model = $this->getModel('Fieldtypes');
// get the data to export // get the data to export

View File

@ -53,7 +53,7 @@ class ComponentbuilderControllerHelp_documents extends JControllerAdmin
$input = JFactory::getApplication()->input; $input = JFactory::getApplication()->input;
$pks = $input->post->get('cid', array(), 'array'); $pks = $input->post->get('cid', array(), 'array');
// Sanitize the input // Sanitize the input
JArrayHelper::toInteger($pks); ArrayHelper::toInteger($pks);
// Get the model // Get the model
$model = $this->getModel('Help_documents'); $model = $this->getModel('Help_documents');
// get the data to export // get the data to export

View File

@ -53,7 +53,7 @@ class ComponentbuilderControllerJoomla_components extends JControllerAdmin
$input = JFactory::getApplication()->input; $input = JFactory::getApplication()->input;
$pks = $input->post->get('cid', array(), 'array'); $pks = $input->post->get('cid', array(), 'array');
// Sanitize the input // Sanitize the input
JArrayHelper::toInteger($pks); ArrayHelper::toInteger($pks);
// Get the model // Get the model
$model = $this->getModel('Joomla_components'); $model = $this->getModel('Joomla_components');
// get the data to export // get the data to export

View File

@ -53,7 +53,7 @@ class ComponentbuilderControllerLanguage_translations extends JControllerAdmin
$input = JFactory::getApplication()->input; $input = JFactory::getApplication()->input;
$pks = $input->post->get('cid', array(), 'array'); $pks = $input->post->get('cid', array(), 'array');
// Sanitize the input // Sanitize the input
JArrayHelper::toInteger($pks); ArrayHelper::toInteger($pks);
// Get the model // Get the model
$model = $this->getModel('Language_translations'); $model = $this->getModel('Language_translations');
// get the data to export // get the data to export

View File

@ -53,7 +53,7 @@ class ComponentbuilderControllerLanguages extends JControllerAdmin
$input = JFactory::getApplication()->input; $input = JFactory::getApplication()->input;
$pks = $input->post->get('cid', array(), 'array'); $pks = $input->post->get('cid', array(), 'array');
// Sanitize the input // Sanitize the input
JArrayHelper::toInteger($pks); ArrayHelper::toInteger($pks);
// Get the model // Get the model
$model = $this->getModel('Languages'); $model = $this->getModel('Languages');
// get the data to export // get the data to export

View File

@ -53,7 +53,7 @@ class ComponentbuilderControllerLayouts extends JControllerAdmin
$input = JFactory::getApplication()->input; $input = JFactory::getApplication()->input;
$pks = $input->post->get('cid', array(), 'array'); $pks = $input->post->get('cid', array(), 'array');
// Sanitize the input // Sanitize the input
JArrayHelper::toInteger($pks); ArrayHelper::toInteger($pks);
// Get the model // Get the model
$model = $this->getModel('Layouts'); $model = $this->getModel('Layouts');
// get the data to export // get the data to export

View File

@ -53,7 +53,7 @@ class ComponentbuilderControllerPlaceholders extends JControllerAdmin
$input = JFactory::getApplication()->input; $input = JFactory::getApplication()->input;
$pks = $input->post->get('cid', array(), 'array'); $pks = $input->post->get('cid', array(), 'array');
// Sanitize the input // Sanitize the input
JArrayHelper::toInteger($pks); ArrayHelper::toInteger($pks);
// Get the model // Get the model
$model = $this->getModel('Placeholders'); $model = $this->getModel('Placeholders');
// get the data to export // get the data to export

View File

@ -53,7 +53,7 @@ class ComponentbuilderControllerServers extends JControllerAdmin
$input = JFactory::getApplication()->input; $input = JFactory::getApplication()->input;
$pks = $input->post->get('cid', array(), 'array'); $pks = $input->post->get('cid', array(), 'array');
// Sanitize the input // Sanitize the input
JArrayHelper::toInteger($pks); ArrayHelper::toInteger($pks);
// Get the model // Get the model
$model = $this->getModel('Servers'); $model = $this->getModel('Servers');
// get the data to export // get the data to export

View File

@ -53,7 +53,7 @@ class ComponentbuilderControllerSite_views extends JControllerAdmin
$input = JFactory::getApplication()->input; $input = JFactory::getApplication()->input;
$pks = $input->post->get('cid', array(), 'array'); $pks = $input->post->get('cid', array(), 'array');
// Sanitize the input // Sanitize the input
JArrayHelper::toInteger($pks); ArrayHelper::toInteger($pks);
// Get the model // Get the model
$model = $this->getModel('Site_views'); $model = $this->getModel('Site_views');
// get the data to export // get the data to export

View File

@ -53,7 +53,7 @@ class ComponentbuilderControllerSnippets extends JControllerAdmin
$input = JFactory::getApplication()->input; $input = JFactory::getApplication()->input;
$pks = $input->post->get('cid', array(), 'array'); $pks = $input->post->get('cid', array(), 'array');
// Sanitize the input // Sanitize the input
JArrayHelper::toInteger($pks); ArrayHelper::toInteger($pks);
// Get the model // Get the model
$model = $this->getModel('Snippets'); $model = $this->getModel('Snippets');
// get the data to export // get the data to export

View File

@ -53,7 +53,7 @@ class ComponentbuilderControllerTemplates extends JControllerAdmin
$input = JFactory::getApplication()->input; $input = JFactory::getApplication()->input;
$pks = $input->post->get('cid', array(), 'array'); $pks = $input->post->get('cid', array(), 'array');
// Sanitize the input // Sanitize the input
JArrayHelper::toInteger($pks); ArrayHelper::toInteger($pks);
// Get the model // Get the model
$model = $this->getModel('Templates'); $model = $this->getModel('Templates');
// get the data to export // get the data to export

View File

@ -53,7 +53,7 @@ class ComponentbuilderControllerValidation_rules extends JControllerAdmin
$input = JFactory::getApplication()->input; $input = JFactory::getApplication()->input;
$pks = $input->post->get('cid', array(), 'array'); $pks = $input->post->get('cid', array(), 'array');
// Sanitize the input // Sanitize the input
JArrayHelper::toInteger($pks); ArrayHelper::toInteger($pks);
// Get the model // Get the model
$model = $this->getModel('Validation_rules'); $model = $this->getModel('Validation_rules');
// get the data to export // get the data to export

View File

@ -589,6 +589,13 @@ class Get
*/ */
public $fieldRelations = array(); public $fieldRelations = array();
/**
* The views default ordering
*
* @var array
*/
public $viewsDefaultOrdering = array();
/** /**
* Default Fields * Default Fields
* *
@ -1406,7 +1413,7 @@ class Get
? json_decode($component->addadmin_views, true) : null; ? json_decode($component->addadmin_views, true) : null;
if (ComponentbuilderHelper::checkArray($component->addadmin_views)) if (ComponentbuilderHelper::checkArray($component->addadmin_views))
{ {
// sort the views acording to order // sort the views according to order
usort( usort(
$component->addadmin_views, function ($a, $b) { $component->addadmin_views, function ($a, $b) {
if ($a['order'] != 0 && $b['order'] != 0) if ($a['order'] != 0 && $b['order'] != 0)
@ -2443,7 +2450,7 @@ class Get
// clear this data // clear this data
unset($old_view); unset($old_view);
} }
// sort the fields acording to order // sort the fields according to order
usort( usort(
$view->fields, function ($a, $b) { $view->fields, function ($a, $b) {
if (isset($a['order_list']) && isset($b['order_list'])) if (isset($a['order_list']) && isset($b['order_list']))

View File

@ -2555,62 +2555,94 @@ class Structure extends Get
*/ */
public function moveFieldsRules($field, $path) public function moveFieldsRules($field, $path)
{ {
// check if this is a custom field that should be moved // check if we have a subform or repeatable field
if (isset($this->extentionCustomfields[$field['type_name']])) if ($field['type_name'] === 'subform' || $field['type_name'] === 'repeatable')
{ {
// lets check if we already moved this // since we could have a custom field or rule inside
if (!isset( $this->moveMultiFieldsRules($field, $path);
$this->extentionTrackingFilesMoved[$path . 'type'
. $field['type_name']]
))
{
// check files exist
if (JFile::exists(
$this->componentPath . '/admin/models/fields/'
. $field['type_name'] . '.php'
))
{
// copy the custom field
JFile::copy(
$this->componentPath . '/admin/models/fields/'
. $field['type_name'] . '.php',
$path . '/fields/' . $field['type_name'] . '.php'
);
}
// stop from doing this again.
$this->extentionTrackingFilesMoved[$path . 'type'
. $field['type_name']]
= true;
}
} }
// check if this has validation that should be moved else
if (isset($this->validationLinkedFields[$field['field']]))
{ {
// lets check if we already moved this // check if this is a custom field that should be moved
if (!isset( if (isset($this->extentionCustomfields[$field['type_name']]))
$this->extentionTrackingFilesMoved[$path . 'rule'
. $this->validationLinkedFields[$field['field']]]
))
{ {
// check files exist $check = md5($path . 'type' . $field['type_name']);
if (JFile::exists( // lets check if we already moved this
$this->componentPath . '/admin/models/rules/' if (!isset($this->extentionTrackingFilesMoved[$check]))
. $this->validationLinkedFields[$field['field']] . '.php'
))
{ {
// copy the custom field // check files exist
JFile::copy( if (JFile::exists(
$this->componentPath . '/admin/models/fields/'
. $field['type_name'] . '.php'
))
{
// copy the custom field
JFile::copy(
$this->componentPath . '/admin/models/fields/'
. $field['type_name'] . '.php',
$path . '/fields/' . $field['type_name'] . '.php'
);
}
// stop from doing this again.
$this->extentionTrackingFilesMoved[$check] = true;
}
}
// check if this has validation that should be moved
if (isset($this->validationLinkedFields[$field['field']]))
{
$check = md5(
$path . 'rule'
. $this->validationLinkedFields[$field['field']]
);
// lets check if we already moved this
if (!isset($this->extentionTrackingFilesMoved[$check]))
{
// check files exist
if (JFile::exists(
$this->componentPath . '/admin/models/rules/' $this->componentPath . '/admin/models/rules/'
. $this->validationLinkedFields[$field['field']] . $this->validationLinkedFields[$field['field']]
. '.php', $path . '/rules/'
. $this->validationLinkedFields[$field['field']]
. '.php' . '.php'
); ))
{
// copy the custom field
JFile::copy(
$this->componentPath . '/admin/models/rules/'
. $this->validationLinkedFields[$field['field']]
. '.php', $path . '/rules/'
. $this->validationLinkedFields[$field['field']]
. '.php'
);
}
// stop from doing this again.
$this->extentionTrackingFilesMoved[$check] = true;
} }
// stop from doing this again. }
$this->extentionTrackingFilesMoved[$path . 'rule' }
. $this->validationLinkedFields[$field['field']]] }
= true;
/**
* move the fields and Rules of multi fields
*
* @param array $multi_field The field data
* @param string $path The path to move to
*
* @return void
*
*/
protected function moveMultiFieldsRules($multi_field, $path)
{
// get the fields ids
$ids = array_map( 'trim', explode(',', ComponentbuilderHelper::getBetween($multi_field['settings']->xml, 'fields="', '"')));
if (ComponentbuilderHelper::checkArray($ids))
{
foreach ($ids as $id)
{
// setup the field
$field = array();
$field['field'] = $id;
$this->setFieldDetails($field);
// move field and rules if needed
$this->moveFieldsRules($field, $path);
} }
} }
} }

View File

@ -237,7 +237,7 @@ class Interpretation extends Fields
*/ */
public function __construct($config = array()) public function __construct($config = array())
{ {
// first we run the perent constructor // first we run the parent constructor
if (parent::__construct($config)) if (parent::__construct($config))
{ {
return true; return true;
@ -4607,13 +4607,13 @@ class Interpretation extends Fields
/** /**
* get the a script from the custom script builder * get the a script from the custom script builder
* *
* @param string $first The first key * @param string $first The first key
* @param string $second The second key * @param string $second The second key
* @param string $prefix The prefix to add in front of the script if found * @param string $prefix The prefix to add in front of the script if found
* @param string $note The switch/note to add to the script * @param string $note The switch/note to add to the script
* @param bool $unset The switch to unset the value if found * @param bool $unset The switch to unset the value if found
* @param string $default The switch/string to use as default return if script not found * @param string $default The switch/string to use as default return if script not found
* @param string $sufix The sufix to add after the script if found * @param string $sufix The sufix to add after the script if found
* *
* @return mix The string/script if found or the default value if not found * @return mix The string/script if found or the default value if not found
* *
@ -5631,6 +5631,7 @@ class Interpretation extends Fields
return PHP_EOL . implode(PHP_EOL, $buttons); return PHP_EOL . implode(PHP_EOL, $buttons);
} }
return ''; return '';
} }
@ -9067,9 +9068,9 @@ class Interpretation extends Fields
$batchcopy[] = $this->_t(2) . "}" . $customScript; $batchcopy[] = $this->_t(2) . "}" . $customScript;
$batchcopy[] = PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) $batchcopy[] = PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__)
. " get list of uniqe fields"; . " get list of unique fields";
$batchcopy[] = $this->_t(2) $batchcopy[] = $this->_t(2)
. "\$uniqeFields = \$this->getUniqeFields();"; . "\$uniqueFields = \$this->getUniqueFields();";
$batchcopy[] = $this->_t(2) . "//" . $this->setLine(__LINE__) $batchcopy[] = $this->_t(2) . "//" . $this->setLine(__LINE__)
. " remove move_copy from array"; . " remove move_copy from array";
$batchcopy[] = $this->_t(2) . "unset(\$values['move_copy']);"; $batchcopy[] = $this->_t(2) . "unset(\$values['move_copy']);";
@ -9260,7 +9261,7 @@ class Interpretation extends Fields
$batchcopy[] = $this->_t(3) . "{"; $batchcopy[] = $this->_t(3) . "{";
$batchcopy[] = $this->_t(4) . "\$this->table->" . implode( $batchcopy[] = $this->_t(4) . "\$this->table->" . implode(
'', $titles '', $titles
) . " = \$this->generateUniqe('" . implode('', $titles) ) . " = \$this->generateUnique('" . implode('', $titles)
. "',\$this->table->" . implode('', $titles) . ");"; . "',\$this->table->" . implode('', $titles) . ");";
$batchcopy[] = $this->_t(3) . "}"; $batchcopy[] = $this->_t(3) . "}";
} }
@ -9281,14 +9282,15 @@ class Interpretation extends Fields
$batchcopy[] = $this->_t(3) . "}" . PHP_EOL; $batchcopy[] = $this->_t(3) . "}" . PHP_EOL;
$batchcopy[] = $this->_t(3) . "//" . $this->setLine(__LINE__) $batchcopy[] = $this->_t(3) . "//" . $this->setLine(__LINE__)
. " update all uniqe fields"; . " update all unique fields";
$batchcopy[] = $this->_t(3) . "if (" . $Helper $batchcopy[] = $this->_t(3) . "if (" . $Helper
. "::checkArray(\$uniqeFields))"; . "::checkArray(\$uniqueFields))";
$batchcopy[] = $this->_t(3) . "{"; $batchcopy[] = $this->_t(3) . "{";
$batchcopy[] = $this->_t(4) . "foreach (\$uniqeFields as \$uniqeField)"; $batchcopy[] = $this->_t(4)
. "foreach (\$uniqueFields as \$uniqueField)";
$batchcopy[] = $this->_t(4) . "{"; $batchcopy[] = $this->_t(4) . "{";
$batchcopy[] = $this->_t(5) $batchcopy[] = $this->_t(5)
. "\$this->table->\$uniqeField = \$this->generateUniqe(\$uniqeField,\$this->table->\$uniqeField);"; . "\$this->table->\$uniqueField = \$this->generateUnique(\$uniqueField,\$this->table->\$uniqueField);";
$batchcopy[] = $this->_t(4) . "}"; $batchcopy[] = $this->_t(4) . "}";
$batchcopy[] = $this->_t(3) . "}"; $batchcopy[] = $this->_t(3) . "}";
@ -9348,7 +9350,7 @@ class Interpretation extends Fields
public function setAliasTitleFix($viewName_single) public function setAliasTitleFix($viewName_single)
{ {
$fixUniqe = array(); $fixUnique = array();
// only load this if these two items are set // only load this if these two items are set
if (array_key_exists($viewName_single, $this->aliasBuilder) if (array_key_exists($viewName_single, $this->aliasBuilder)
&& (array_key_exists($viewName_single, $this->titleBuilder) && (array_key_exists($viewName_single, $this->titleBuilder)
@ -9381,16 +9383,16 @@ class Interpretation extends Fields
$titles = array($this->titleBuilder[$viewName_single]); $titles = array($this->titleBuilder[$viewName_single]);
} }
// start building the fix // start building the fix
$fixUniqe[] = PHP_EOL . $this->_t(2) . "//" . $this->setLine( $fixUnique[] = PHP_EOL . $this->_t(2) . "//" . $this->setLine(
__LINE__ __LINE__
) . " Alter the " . implode(', ', $titles) ) . " Alter the " . implode(', ', $titles)
. " for save as copy"; . " for save as copy";
$fixUniqe[] = $this->_t(2) $fixUnique[] = $this->_t(2)
. "if (\$input->get('task') === 'save2copy')"; . "if (\$input->get('task') === 'save2copy')";
$fixUniqe[] = $this->_t(2) . "{"; $fixUnique[] = $this->_t(2) . "{";
$fixUniqe[] = $this->_t(3) $fixUnique[] = $this->_t(3)
. "\$origTable = clone \$this->getTable();"; . "\$origTable = clone \$this->getTable();";
$fixUniqe[] = $this->_t(3) $fixUnique[] = $this->_t(3)
. "\$origTable->load(\$input->getInt('id'));"; . "\$origTable->load(\$input->getInt('id'));";
// reset the buckets // reset the buckets
$ifStatment = array(); $ifStatment = array();
@ -9407,13 +9409,13 @@ class Interpretation extends Fields
$titleUpdate[] = $this->_t(4) . "\$data['" . $title . "'] = \$" $titleUpdate[] = $this->_t(4) . "\$data['" . $title . "'] = \$"
. $title . ";"; . $title . ";";
} }
$fixUniqe[] = PHP_EOL . $this->_t(3) . "if (" . implode( $fixUnique[] = PHP_EOL . $this->_t(3) . "if (" . implode(
' || ', $ifStatment ' || ', $ifStatment
) . ")"; ) . ")";
$fixUniqe[] = $this->_t(3) . "{"; $fixUnique[] = $this->_t(3) . "{";
if ($setCategory && count((array) $titles) == 1) if ($setCategory && count((array) $titles) == 1)
{ {
$fixUniqe[] = $this->_t(4) . "list(" . implode('', $titleVars) $fixUnique[] = $this->_t(4) . "list(" . implode('', $titleVars)
. ", \$" . $alias . ") = \$this->generateNewTitle(\$data['" . ", \$" . $alias . ") = \$this->generateNewTitle(\$data['"
. $category . "'], \$data['" . $alias . "'], " . implode( . $category . "'], \$data['" . $alias . "'], " . implode(
'', $titleData '', $titleData
@ -9421,136 +9423,141 @@ class Interpretation extends Fields
} }
elseif (count((array) $titles) == 1) elseif (count((array) $titles) == 1)
{ {
$fixUniqe[] = $this->_t(4) . "list(" . implode(', ', $titleVars) $fixUnique[] = $this->_t(4) . "list(" . implode(
', ', $titleVars
)
. ", \$" . $alias . ") = \$this->_generateNewTitle(\$data['" . ", \$" . $alias . ") = \$this->_generateNewTitle(\$data['"
. $alias . "'], " . implode('', $titleData) . ");"; . $alias . "'], " . implode('', $titleData) . ");";
} }
else else
{ {
$fixUniqe[] = $this->_t(4) . "list(" . implode(', ', $titleVars) $fixUnique[] = $this->_t(4) . "list(" . implode(
', ', $titleVars
)
. ", \$" . $alias . ") = \$this->_generateNewTitle(\$data['" . ", \$" . $alias . ") = \$this->_generateNewTitle(\$data['"
. $alias . "'], array(" . implode(', ', $titleData) . "));"; . $alias . "'], array(" . implode(', ', $titleData) . "));";
} }
$fixUniqe[] = implode("\n", $titleUpdate); $fixUnique[] = implode("\n", $titleUpdate);
$fixUniqe[] = $this->_t(4) . "\$data['" . $alias . "'] = \$" $fixUnique[] = $this->_t(4) . "\$data['" . $alias . "'] = \$"
. $alias . ";"; . $alias . ";";
$fixUniqe[] = $this->_t(3) . "}"; $fixUnique[] = $this->_t(3) . "}";
$fixUniqe[] = $this->_t(3) . "else"; $fixUnique[] = $this->_t(3) . "else";
$fixUniqe[] = $this->_t(3) . "{"; $fixUnique[] = $this->_t(3) . "{";
$fixUniqe[] = $this->_t(4) . "if (\$data['" . $alias $fixUnique[] = $this->_t(4) . "if (\$data['" . $alias
. "'] == \$origTable->" . $alias . ")"; . "'] == \$origTable->" . $alias . ")";
$fixUniqe[] = $this->_t(4) . "{"; $fixUnique[] = $this->_t(4) . "{";
$fixUniqe[] = $this->_t(5) . "\$data['" . $alias . "'] = '';"; $fixUnique[] = $this->_t(5) . "\$data['" . $alias . "'] = '';";
$fixUniqe[] = $this->_t(4) . "}"; $fixUnique[] = $this->_t(4) . "}";
$fixUniqe[] = $this->_t(3) . "}"; $fixUnique[] = $this->_t(3) . "}";
$fixUniqe[] = PHP_EOL . $this->_t(3) . "\$data['published'] = 0;"; $fixUnique[] = PHP_EOL . $this->_t(3) . "\$data['published'] = 0;";
$fixUniqe[] = $this->_t(2) . "}"; $fixUnique[] = $this->_t(2) . "}";
$fixUniqe[] = PHP_EOL . $this->_t(2) . "//" . $this->setLine( $fixUnique[] = PHP_EOL . $this->_t(2) . "//" . $this->setLine(
__LINE__ __LINE__
) . " Automatic handling of " . $alias . " for empty fields"; ) . " Automatic handling of " . $alias . " for empty fields";
$fixUniqe[] = $this->_t(2) $fixUnique[] = $this->_t(2)
. "if (in_array(\$input->get('task'), array('apply', 'save', 'save2new')) && (int) \$input->get('id') == 0)"; . "if (in_array(\$input->get('task'), array('apply', 'save', 'save2new')) && (int) \$input->get('id') == 0)";
$fixUniqe[] = $this->_t(2) . "{"; $fixUnique[] = $this->_t(2) . "{";
$fixUniqe[] = $this->_t(3) . "if (\$data['" . $alias $fixUnique[] = $this->_t(3) . "if (\$data['" . $alias
. "'] == null || empty(\$data['" . $alias . "']))"; . "'] == null || empty(\$data['" . $alias . "']))";
$fixUniqe[] = $this->_t(3) . "{"; $fixUnique[] = $this->_t(3) . "{";
$fixUniqe[] = $this->_t(4) $fixUnique[] = $this->_t(4)
. "if (JFactory::getConfig()->get('unicodeslugs') == 1)"; . "if (JFactory::getConfig()->get('unicodeslugs') == 1)";
$fixUniqe[] = $this->_t(4) . "{"; $fixUnique[] = $this->_t(4) . "{";
$fixUniqe[] = $this->_t(5) . "\$data['" . $alias $fixUnique[] = $this->_t(5) . "\$data['" . $alias
. "'] = JFilterOutput::stringURLUnicodeSlug(" . implode( . "'] = JFilterOutput::stringURLUnicodeSlug(" . implode(
' . " " . ', $titleData ' . " " . ', $titleData
) . ");"; ) . ");";
$fixUniqe[] = $this->_t(4) . "}"; $fixUnique[] = $this->_t(4) . "}";
$fixUniqe[] = $this->_t(4) . "else"; $fixUnique[] = $this->_t(4) . "else";
$fixUniqe[] = $this->_t(4) . "{"; $fixUnique[] = $this->_t(4) . "{";
$fixUniqe[] = $this->_t(5) . "\$data['" . $alias $fixUnique[] = $this->_t(5) . "\$data['" . $alias
. "'] = JFilterOutput::stringURLSafe(" . implode( . "'] = JFilterOutput::stringURLSafe(" . implode(
' . " " . ', $titleData ' . " " . ', $titleData
) . ");"; ) . ");";
$fixUniqe[] = $this->_t(4) . "}"; $fixUnique[] = $this->_t(4) . "}";
$fixUniqe[] = PHP_EOL . $this->_t(4) $fixUnique[] = PHP_EOL . $this->_t(4)
. "\$table = JTable::getInstance('" . $viewName_single . "', '" . "\$table = JTable::getInstance('" . $viewName_single . "', '"
. $this->componentCodeName . "Table');"; . $this->componentCodeName . "Table');";
if ($setCategory && count($titles) == 1) if ($setCategory && count($titles) == 1)
{ {
$fixUniqe[] = PHP_EOL . $this->_t(4) $fixUnique[] = PHP_EOL . $this->_t(4)
. "if (\$table->load(array('" . $alias . "' => \$data['" . "if (\$table->load(array('" . $alias . "' => \$data['"
. $alias . "'], '" . $category . "' => \$data['" . $category . $alias . "'], '" . $category . "' => \$data['" . $category
. "'])) && (\$table->id != \$data['id'] || \$data['id'] == 0))"; . "'])) && (\$table->id != \$data['id'] || \$data['id'] == 0))";
$fixUniqe[] = $this->_t(4) . "{"; $fixUnique[] = $this->_t(4) . "{";
$fixUniqe[] = $this->_t(5) . "\$msg = JText:" . ":_('COM_" $fixUnique[] = $this->_t(5) . "\$msg = JText:" . ":_('COM_"
. $this->fileContentStatic[$this->hhh . 'COMPONENT' . $this->fileContentStatic[$this->hhh . 'COMPONENT'
. $this->hhh] . "_" . $VIEW . "_SAVE_WARNING');"; . $this->hhh] . "_" . $VIEW . "_SAVE_WARNING');";
$fixUniqe[] = $this->_t(4) . "}"; $fixUnique[] = $this->_t(4) . "}";
$fixUniqe[] = PHP_EOL . $this->_t(4) . "list(" . implode( $fixUnique[] = PHP_EOL . $this->_t(4) . "list(" . implode(
'', $titleVars '', $titleVars
) . ", \$" . $alias ) . ", \$" . $alias
. ") = \$this->generateNewTitle(\$data['" . $category . ") = \$this->generateNewTitle(\$data['" . $category
. "'], \$data['" . $alias . "'], " . implode('', $titleData) . "'], \$data['" . $alias . "'], " . implode('', $titleData)
. ");"; . ");";
$fixUniqe[] = $this->_t(4) . "\$data['" . $alias . "'] = \$" $fixUnique[] = $this->_t(4) . "\$data['" . $alias . "'] = \$"
. $alias . ";"; . $alias . ";";
} }
else else
{ {
$fixUniqe[] = PHP_EOL . $this->_t(4) $fixUnique[] = PHP_EOL . $this->_t(4)
. "if (\$table->load(array('" . $alias . "' => \$data['" . "if (\$table->load(array('" . $alias . "' => \$data['"
. $alias . $alias
. "'])) && (\$table->id != \$data['id'] || \$data['id'] == 0))"; . "'])) && (\$table->id != \$data['id'] || \$data['id'] == 0))";
$fixUniqe[] = $this->_t(4) . "{"; $fixUnique[] = $this->_t(4) . "{";
$fixUniqe[] = $this->_t(5) . "\$msg = JText:" . ":_('COM_" $fixUnique[] = $this->_t(5) . "\$msg = JText:" . ":_('COM_"
. $this->fileContentStatic[$this->hhh . 'COMPONENT' . $this->fileContentStatic[$this->hhh . 'COMPONENT'
. $this->hhh] . "_" . $VIEW . "_SAVE_WARNING');"; . $this->hhh] . "_" . $VIEW . "_SAVE_WARNING');";
$fixUniqe[] = $this->_t(4) . "}"; $fixUnique[] = $this->_t(4) . "}";
$fixUniqe[] = PHP_EOL . $this->_t(4) . "\$data['" . $alias $fixUnique[] = PHP_EOL . $this->_t(4) . "\$data['" . $alias
. "'] = \$this->_generateNewTitle(\$data['" . $alias . "'] = \$this->_generateNewTitle(\$data['" . $alias
. "']);"; . "']);";
} }
$fixUniqe[] = PHP_EOL . $this->_t(4) . "if (isset(\$msg))"; $fixUnique[] = PHP_EOL . $this->_t(4) . "if (isset(\$msg))";
$fixUniqe[] = $this->_t(4) . "{"; $fixUnique[] = $this->_t(4) . "{";
$fixUniqe[] = $this->_t(5) $fixUnique[] = $this->_t(5)
. "JFactory::getApplication()->enqueueMessage(\$msg, 'warning');"; . "JFactory::getApplication()->enqueueMessage(\$msg, 'warning');";
$fixUniqe[] = $this->_t(4) . "}"; $fixUnique[] = $this->_t(4) . "}";
$fixUniqe[] = $this->_t(3) . "}"; $fixUnique[] = $this->_t(3) . "}";
$fixUniqe[] = $this->_t(2) . "}"; $fixUnique[] = $this->_t(2) . "}";
// $fixUniqe[] = PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) . " Update alias if still empty at this point"; // $fixUnique[] = PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) . " Update alias if still empty at this point";
// $fixUniqe[] = $this->_t(2) . "if (\$data['" . $alias . "'] == null || empty(\$data['" . $alias . "']))"; // $fixUnique[] = $this->_t(2) . "if (\$data['" . $alias . "'] == null || empty(\$data['" . $alias . "']))";
// $fixUniqe[] = $this->_t(2) . "{"; // $fixUnique[] = $this->_t(2) . "{";
// $fixUniqe[] = $this->_t(3) . "if (JFactory::getConfig()->get('unicodeslugs') == 1)"; // $fixUnique[] = $this->_t(3) . "if (JFactory::getConfig()->get('unicodeslugs') == 1)";
// $fixUniqe[] = $this->_t(3) . "{"; // $fixUnique[] = $this->_t(3) . "{";
// $fixUniqe[] = $this->_t(4) . "\$data['" . $alias . "'] = JFilterOutput::stringURLUnicodeSlug(" . implode(' . " " . ', $titleData) . ");"; // $fixUnique[] = $this->_t(4) . "\$data['" . $alias . "'] = JFilterOutput::stringURLUnicodeSlug(" . implode(' . " " . ', $titleData) . ");";
// $fixUniqe[] = $this->_t(3) . "}"; // $fixUnique[] = $this->_t(3) . "}";
// $fixUniqe[] = $this->_t(3) . "else"; // $fixUnique[] = $this->_t(3) . "else";
// $fixUniqe[] = $this->_t(3) . "{"; // $fixUnique[] = $this->_t(3) . "{";
// $fixUniqe[] = $this->_t(4) . "\$data['" . $alias . "'] = JFilterOutput::stringURLSafe(" . implode(' . " " . ', $titleData) . ");"; // $fixUnique[] = $this->_t(4) . "\$data['" . $alias . "'] = JFilterOutput::stringURLSafe(" . implode(' . " " . ', $titleData) . ");";
// $fixUniqe[] = $this->_t(3) . "}"; // $fixUnique[] = $this->_t(3) . "}";
// $fixUniqe[] = $this->_t(2) . "}"; // $fixUnique[] = $this->_t(2) . "}";
} }
// handel other uniqe fields // handel other unique fields
$fixUniqe[] = PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) $fixUnique[] = PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__)
. " Alter the uniqe field for save as copy"; . " Alter the unique field for save as copy";
$fixUniqe[] = $this->_t(2) $fixUnique[] = $this->_t(2)
. "if (\$input->get('task') === 'save2copy')"; . "if (\$input->get('task') === 'save2copy')";
$fixUniqe[] = $this->_t(2) . "{"; $fixUnique[] = $this->_t(2) . "{";
$fixUniqe[] = $this->_t(3) . "//" . $this->setLine(__LINE__) $fixUnique[] = $this->_t(3) . "//" . $this->setLine(__LINE__)
. " Automatic handling of other uniqe fields"; . " Automatic handling of other unique fields";
$fixUniqe[] = $this->_t(3) $fixUnique[] = $this->_t(3)
. "\$uniqeFields = \$this->getUniqeFields();"; . "\$uniqueFields = \$this->getUniqueFields();";
$fixUniqe[] = $this->_t(3) . "if (" $fixUnique[] = $this->_t(3) . "if ("
. $this->fileContentStatic[$this->hhh . 'Component' . $this->hhh] . $this->fileContentStatic[$this->hhh . 'Component' . $this->hhh]
. "Helper::checkArray(\$uniqeFields))"; . "Helper::checkArray(\$uniqueFields))";
$fixUniqe[] = $this->_t(3) . "{"; $fixUnique[] = $this->_t(3) . "{";
$fixUniqe[] = $this->_t(4) . "foreach (\$uniqeFields as \$uniqeField)"; $fixUnique[] = $this->_t(4)
$fixUniqe[] = $this->_t(4) . "{"; . "foreach (\$uniqueFields as \$uniqueField)";
$fixUniqe[] = $this->_t(5) $fixUnique[] = $this->_t(4) . "{";
. "\$data[\$uniqeField] = \$this->generateUniqe(\$uniqeField,\$data[\$uniqeField]);"; $fixUnique[] = $this->_t(5)
$fixUniqe[] = $this->_t(4) . "}"; . "\$data[\$uniqueField] = \$this->generateUnique(\$uniqueField,\$data[\$uniqueField]);";
$fixUniqe[] = $this->_t(3) . "}"; $fixUnique[] = $this->_t(4) . "}";
$fixUniqe[] = $this->_t(2) . "}"; $fixUnique[] = $this->_t(3) . "}";
$fixUnique[] = $this->_t(2) . "}";
return PHP_EOL . implode(PHP_EOL, $fixUniqe); return PHP_EOL . implode(PHP_EOL, $fixUnique);
} }
public function setGenerateNewTitle($viewName_single) public function setGenerateNewTitle($viewName_single)
@ -9597,7 +9604,7 @@ class Interpretation extends Fields
. "foreach(\$title as \$nr => &\$_title)"; . "foreach(\$title as \$nr => &\$_title)";
$newFunction[] = $this->_t(4) . "{"; $newFunction[] = $this->_t(4) . "{";
$newFunction[] = $this->_t(5) $newFunction[] = $this->_t(5)
. "\$_title = JString::increment(\$_title);"; . "\$_title = StringHelper::increment(\$_title);";
$newFunction[] = $this->_t(4) . "}"; $newFunction[] = $this->_t(4) . "}";
$newFunction[] = $this->_t(3) . "}"; $newFunction[] = $this->_t(3) . "}";
$newFunction[] = $this->_t(3) . "//" . $this->setLine(__LINE__) $newFunction[] = $this->_t(3) . "//" . $this->setLine(__LINE__)
@ -9605,10 +9612,10 @@ class Interpretation extends Fields
$newFunction[] = $this->_t(3) . "elseif (\$title)"; $newFunction[] = $this->_t(3) . "elseif (\$title)";
$newFunction[] = $this->_t(3) . "{"; $newFunction[] = $this->_t(3) . "{";
$newFunction[] = $this->_t(4) $newFunction[] = $this->_t(4)
. "\$title = JString::increment(\$title);"; . "\$title = StringHelper::increment(\$title);";
$newFunction[] = $this->_t(3) . "}"; $newFunction[] = $this->_t(3) . "}";
$newFunction[] = $this->_t(3) $newFunction[] = $this->_t(3)
. "\$alias = JString::increment(\$alias, 'dash');"; . "\$alias = StringHelper::increment(\$alias, 'dash');";
$newFunction[] = $this->_t(2) . "}"; $newFunction[] = $this->_t(2) . "}";
$newFunction[] = $this->_t(2) . "//" . $this->setLine(__LINE__) $newFunction[] = $this->_t(2) . "//" . $this->setLine(__LINE__)
. " Check if this is an array of titles"; . " Check if this is an array of titles";
@ -9655,7 +9662,7 @@ class Interpretation extends Fields
. "while (\$table->load(array('title' => \$title)))"; . "while (\$table->load(array('title' => \$title)))";
$newFunction[] = $this->_t(2) . "{"; $newFunction[] = $this->_t(2) . "{";
$newFunction[] = $this->_t(3) $newFunction[] = $this->_t(3)
. "\$title = JString::increment(\$title);"; . "\$title = StringHelper::increment(\$title);";
$newFunction[] = $this->_t(2) . "}"; $newFunction[] = $this->_t(2) . "}";
$newFunction[] = PHP_EOL . $this->_t(2) . "return \$title;"; $newFunction[] = PHP_EOL . $this->_t(2) . "return \$title;";
$newFunction[] = $this->_t(1) . "}"; $newFunction[] = $this->_t(1) . "}";
@ -11635,24 +11642,44 @@ class Interpretation extends Fields
$item['lang'] $item['lang']
= $this->listHeadOverRide[$viewName_list][$item['id']]; = $this->listHeadOverRide[$viewName_list][$item['id']];
} }
// set the custom code
if (ComponentbuilderHelper::checkArray($item['custom']))
{
$item['code'] = $item['code'] . '_'
. $item['custom']['text'];
}
$class = 'nowrap hidden-phone'; $class = 'nowrap hidden-phone';
if ($item['link']) if ($item['link'])
{ {
$class = 'nowrap'; $class = 'nowrap';
} }
$title = "<?php echo JText:" . ":_('" . $item['lang'] // add sort options if required
. "'); ?>";
if ($item['sort']) if ($item['sort'])
{ {
$title = "<?php echo JHtml::_('grid.sort', '" // if category
. $item['lang'] . "', 'a." . $item['code'] if ($item['type'] === 'category')
. "', \$this->listDirn, \$this->listOrder); ?>"; {
// only one category per/view allowed at this point
$title = "<?php echo JHtml::_('grid.sort', '"
. $item['lang'] . "', 'category_title"
. "', \$this->listDirn, \$this->listOrder); ?>";
}
// set the custom code
elseif (ComponentbuilderHelper::checkArray(
$item['custom']
))
{
// keep an eye on this
$title = "<?php echo JHtml::_('grid.sort', '"
. $item['lang'] . "', '" . $item['custom']['db']
. "." . $item['custom']['text']
. "', \$this->listDirn, \$this->listOrder); ?>";
}
else
{
$title = "<?php echo JHtml::_('grid.sort', '"
. $item['lang'] . "', 'a." . $item['code']
. "', \$this->listDirn, \$this->listOrder); ?>";
}
}
else
{
$title = "<?php echo JText:" . ":_('" . $item['lang']
. "'); ?>";
} }
$head .= PHP_EOL . $this->_t(1) . '<th class="' . $class $head .= PHP_EOL . $this->_t(1) . '<th class="' . $class
. '" >'; . '" >';
@ -13674,12 +13701,42 @@ class Interpretation extends Fields
. "\$query->where('a.access IN (' . \$groups . ')');"; . "\$query->where('a.access IN (' . \$groups . ')');";
$query .= PHP_EOL . $this->_t(2) . "}"; $query .= PHP_EOL . $this->_t(2) . "}";
} }
$query .= PHP_EOL . PHP_EOL . $this->_t(2) . "//" . $this->setLine( // add dynamic ordering (Linked view)
__LINE__ if (isset($this->viewsDefaultOrdering[$viewName_list])
) . " Order the results by ordering"; && $this->viewsDefaultOrdering[$viewName_list]['add_linked_ordering']
$query .= PHP_EOL . $this->_t(2) == 1)
. "\$query->order('a.published ASC');"; {
$query .= PHP_EOL . $this->_t(2) . "\$query->order('a.ordering ASC');"; foreach (
$this->viewsDefaultOrdering[$viewName_list]['linked_ordering_fields']
as $order_field
)
{
if (($order_field_name = $this->getFieldDatabaseName(
$viewName_list, $order_field['field'], 'listJoinBuilder'
)) !== false)
{
// default ordering is by publish and ordering
$query .= PHP_EOL . PHP_EOL . $this->_t(2) . "//"
. $this->setLine(
__LINE__
) . " Order the results by ordering";
$query .= PHP_EOL . $this->_t(2)
. "\$query->order('"
. $order_field_name . " " . $order_field['direction'] . "');";
}
}
}
else
{
// default ordering is by publish and ordering
$query .= PHP_EOL . PHP_EOL . $this->_t(2) . "//" . $this->setLine(
__LINE__
) . " Order the results by ordering";
$query .= PHP_EOL . $this->_t(2)
. "\$query->order('a.published ASC');";
$query .= PHP_EOL . $this->_t(2)
. "\$query->order('a.ordering ASC');";
}
$query .= PHP_EOL . PHP_EOL . $this->_t(2) . "//" . $this->setLine( $query .= PHP_EOL . PHP_EOL . $this->_t(2) . "//" . $this->setLine(
__LINE__ __LINE__
) . " Load the items"; ) . " Load the items";
@ -14044,7 +14101,7 @@ class Interpretation extends Fields
. "\$pks = \$input->post->get('cid', array(), 'array');"; . "\$pks = \$input->post->get('cid', array(), 'array');";
$method[] = $this->_t(3) . "//" . $this->setLine(__LINE__) $method[] = $this->_t(3) . "//" . $this->setLine(__LINE__)
. " Sanitize the input"; . " Sanitize the input";
$method[] = $this->_t(3) . "JArrayHelper::toInteger(\$pks);"; $method[] = $this->_t(3) . "ArrayHelper::toInteger(\$pks);";
$method[] = $this->_t(3) . "//" . $this->setLine(__LINE__) $method[] = $this->_t(3) . "//" . $this->setLine(__LINE__)
. " convert to string"; . " convert to string";
$method[] = $this->_t(3) . "\$ids = implode('_', \$pks);"; $method[] = $this->_t(3) . "\$ids = implode('_', \$pks);";
@ -14211,11 +14268,40 @@ class Interpretation extends Fields
. "\$query->where('a.access IN (' . \$groups . ')');"; . "\$query->where('a.access IN (' . \$groups . ')');";
$query .= PHP_EOL . $this->_t(3) . "}"; $query .= PHP_EOL . $this->_t(3) . "}";
} }
$query .= PHP_EOL . PHP_EOL . $this->_t(3) . "//" . $this->setLine( // add dynamic ordering (Exported data)
__LINE__ if (isset($this->viewsDefaultOrdering[$viewName_list])
) . " Order the results by ordering"; && $this->viewsDefaultOrdering[$viewName_list]['add_admin_ordering']
$query .= PHP_EOL . $this->_t(3) == 1)
. "\$query->order('a.ordering ASC');"; {
foreach (
$this->viewsDefaultOrdering[$viewName_list]['admin_ordering_fields']
as $order_field
)
{
if (($order_field_name = $this->getFieldDatabaseName(
$viewName_list, $order_field['field']
)) !== false)
{
$query .= PHP_EOL . PHP_EOL . $this->_t(3) . "//"
. $this->setLine(
__LINE__
) . " Order the results by ordering";
$query .= PHP_EOL . $this->_t(3)
. "\$query->order('"
. $order_field_name . " "
. $order_field['direction'] . "');";
}
}
}
else
{
$query .= PHP_EOL . PHP_EOL . $this->_t(3) . "//"
. $this->setLine(
__LINE__
) . " Order the results by ordering";
$query .= PHP_EOL . $this->_t(3)
. "\$query->order('a.ordering ASC');";
}
$query .= PHP_EOL . PHP_EOL . $this->_t(3) . "//" . $this->setLine( $query .= PHP_EOL . PHP_EOL . $this->_t(3) . "//" . $this->setLine(
__LINE__ __LINE__
) . " Load the items"; ) . " Load the items";
@ -14324,7 +14410,7 @@ class Interpretation extends Fields
. "\$pks = \$input->post->get('cid', array(), 'array');"; . "\$pks = \$input->post->get('cid', array(), 'array');";
$method[] = $this->_t(3) . "//" . $this->setLine(__LINE__) $method[] = $this->_t(3) . "//" . $this->setLine(__LINE__)
. " Sanitize the input"; . " Sanitize the input";
$method[] = $this->_t(3) . "JArrayHelper::toInteger(\$pks);"; $method[] = $this->_t(3) . "ArrayHelper::toInteger(\$pks);";
$method[] = $this->_t(3) . "//" . $this->setLine(__LINE__) $method[] = $this->_t(3) . "//" . $this->setLine(__LINE__)
. " Get the model"; . " Get the model";
$method[] = $this->_t(3) . "\$model = \$this->getModel('" $method[] = $this->_t(3) . "\$model = \$this->getModel('"
@ -14715,7 +14801,7 @@ class Interpretation extends Fields
. "elseif (is_array(\$categoryId))"; . "elseif (is_array(\$categoryId))";
$query .= PHP_EOL . $this->_t(2) . "{"; $query .= PHP_EOL . $this->_t(2) . "{";
$query .= PHP_EOL . $this->_t(3) $query .= PHP_EOL . $this->_t(3)
. "JArrayHelper::toInteger(\$categoryId);"; . "ArrayHelper::toInteger(\$categoryId);";
$query .= PHP_EOL . $this->_t(3) $query .= PHP_EOL . $this->_t(3)
. "\$categoryId = implode(',', \$categoryId);"; . "\$categoryId = implode(',', \$categoryId);";
$query .= PHP_EOL . $this->_t(3) $query .= PHP_EOL . $this->_t(3)
@ -14723,24 +14809,127 @@ class Interpretation extends Fields
$query .= PHP_EOL . $this->_t(2) . "}"; $query .= PHP_EOL . $this->_t(2) . "}";
$query .= PHP_EOL; $query .= PHP_EOL;
} }
$query .= PHP_EOL . PHP_EOL . $this->_t(2) . "//" . $this->setLine( // add dynamic ordering (Admin view)
__LINE__ if (isset($this->viewsDefaultOrdering[$viewName_list])
) . " Add the list ordering clause."; && $this->viewsDefaultOrdering[$viewName_list]['add_admin_ordering']
$query .= PHP_EOL . $this->_t(2) == 1)
. "\$orderCol = \$this->state->get('list.ordering', 'a.id');"; {
$query .= PHP_EOL . $this->_t(2) // the first is from the state
. "\$orderDirn = \$this->state->get('list.direction', 'asc'); "; $order_first = true;
$query .= PHP_EOL . $this->_t(2) . "if (\$orderCol != '')"; foreach (
$query .= PHP_EOL . $this->_t(2) . "{"; $this->viewsDefaultOrdering[$viewName_list]['admin_ordering_fields']
$query .= PHP_EOL . $this->_t(3) as $order_field
. "\$query->order(\$db->escape(\$orderCol . ' ' . \$orderDirn));"; )
$query .= PHP_EOL . $this->_t(2) . "}"; {
if (($order_field_name = $this->getFieldDatabaseName(
$viewName_list, $order_field['field']
)) !== false)
{
if ($order_first)
{
// just the first field is based on state
$order_first = false;
$query .= PHP_EOL . PHP_EOL . $this->_t(2) . "//"
. $this->setLine(
__LINE__
) . " Add the list ordering clause.";
$query .= PHP_EOL . $this->_t(2)
. "\$orderCol = \$this->state->get('list.ordering', '"
. $order_field_name . "');";
$query .= PHP_EOL . $this->_t(2)
. "\$orderDirn = \$this->state->get('list.direction', '"
. $order_field['direction'] . "');";
$query .= PHP_EOL . $this->_t(2)
. "if (\$orderCol != '')";
$query .= PHP_EOL . $this->_t(2) . "{";
$query .= PHP_EOL . $this->_t(3)
. "\$query->order(\$db->escape(\$orderCol . ' ' . \$orderDirn));";
$query .= PHP_EOL . $this->_t(2) . "}";
}
else
{
$query .= PHP_EOL . PHP_EOL . $this->_t(2) . "//"
. $this->setLine(
__LINE__
) . " Add a permanent list ordering.";
$query .= PHP_EOL . $this->_t(2)
. "\$query->order(\$db->escape('"
. $order_field_name . " "
. $order_field['direction'] . "'));";
}
}
}
}
else
{
$query .= PHP_EOL . PHP_EOL . $this->_t(2) . "//" . $this->setLine(
__LINE__
) . " Add the list ordering clause.";
$query .= PHP_EOL . $this->_t(2)
. "\$orderCol = \$this->state->get('list.ordering', 'a.id');";
$query .= PHP_EOL . $this->_t(2)
. "\$orderDirn = \$this->state->get('list.direction', 'asc');";
$query .= PHP_EOL . $this->_t(2) . "if (\$orderCol != '')";
$query .= PHP_EOL . $this->_t(2) . "{";
$query .= PHP_EOL . $this->_t(3)
. "\$query->order(\$db->escape(\$orderCol . ' ' . \$orderDirn));";
$query .= PHP_EOL . $this->_t(2) . "}";
}
$query .= PHP_EOL; $query .= PHP_EOL;
$query .= PHP_EOL . $this->_t(2) . "return \$query;"; $query .= PHP_EOL . $this->_t(2) . "return \$query;";
return $query; return $query;
} }
/**
* get the field database name and AS prefix
*
* @return string
*
*/
protected function getFieldDatabaseName($viewName_list, int $fieldId, $targetArea = 'listBuilder')
{
if (isset($this->{$targetArea}[$viewName_list]))
{
if ($fieldId < 0)
{
switch($fieldId)
{
case -1:
return 'a.id';
case -2:
return 'a.ordering';
case -3:
return 'a.published';
}
}
foreach ($this->{$targetArea}[$viewName_list] as $field)
{
if ($field['id'] == $fieldId)
{
// now check if this is a category
if ($field['type'] === 'category')
{
return 'c.title';
}
// set the custom code
elseif (ComponentbuilderHelper::checkArray(
$field['custom']
))
{
return $field['custom']['db'] . "."
. $field['custom']['text'];
}
else
{
return 'a.' . $field['code'];
}
}
}
}
return false;
}
public function setSearchQuery($viewName_list) public function setSearchQuery($viewName_list)
{ {
if (isset($this->searchBuilder[$viewName_list]) if (isset($this->searchBuilder[$viewName_list])
@ -16923,7 +17112,7 @@ class Interpretation extends Fields
$fields[] = $this->_t(1) . " *"; $fields[] = $this->_t(1) . " *";
$fields[] = $this->_t(1) . " * @since 3.0"; $fields[] = $this->_t(1) . " * @since 3.0";
$fields[] = $this->_t(1) . " */"; $fields[] = $this->_t(1) . " */";
$fields[] = $this->_t(1) . "protected function getUniqeFields()"; $fields[] = $this->_t(1) . "protected function getUniqueFields()";
$fields[] = $this->_t(1) . "{"; $fields[] = $this->_t(1) . "{";
if (isset($this->dbUniqueKeys[$view]) if (isset($this->dbUniqueKeys[$view])
&& ComponentbuilderHelper::checkArray($this->dbUniqueKeys[$view])) && ComponentbuilderHelper::checkArray($this->dbUniqueKeys[$view]))
@ -17334,7 +17523,7 @@ class Interpretation extends Fields
$allow[] = $this->_t(2) . "}"; $allow[] = $this->_t(2) . "}";
} }
$allow[] = $this->_t(2) $allow[] = $this->_t(2)
. "\$categoryId = JArrayHelper::getValue(\$data, 'catid', \$this->input->getInt('filter_category_id'), 'int');"; . "\$categoryId = ArrayHelper::getValue(\$data, 'catid', \$this->input->getInt('filter_category_id'), 'int');";
$allow[] = $this->_t(2) . "\$allow = null;"; $allow[] = $this->_t(2) . "\$allow = null;";
$allow[] = PHP_EOL . $this->_t(2) . "if (\$categoryId)"; $allow[] = PHP_EOL . $this->_t(2) . "if (\$categoryId)";
$allow[] = $this->_t(2) . "{"; $allow[] = $this->_t(2) . "{";
@ -18928,12 +19117,20 @@ class Interpretation extends Fields
else else
{ {
// check if custom field is set // check if custom field is set
/* if (ComponentbuilderHelper::checkArray($filter['custom'])) if (ComponentbuilderHelper::checkArray(
$filter['custom']
))
{ {
$fields .= ",".PHP_EOL.$this->_t(4) . "'".$filter['custom']['db'].".".$filter['custom']['text']."','".$filter['code']."_".$filter['custom']['text']."'"; $fields .= "," . PHP_EOL . $this->_t(4) . "'"
} */ . $filter['custom']['db'] . "."
$fields .= "," . PHP_EOL . $this->_t(4) . "'a." . $filter['custom']['text'] . "'";
. $filter['code'] . "','" . $filter['code'] . "'"; }
else
{
$fields .= "," . PHP_EOL . $this->_t(4) . "'a."
. $filter['code'] . "','" . $filter['code']
. "'";
}
} }
$donelist[] = $filter['code']; $donelist[] = $filter['code'];
} }
@ -19572,7 +19769,7 @@ class Interpretation extends Fields
if ($filter['type'] === 'category') if ($filter['type'] === 'category')
{ {
$fields .= "," . PHP_EOL . $this->_t(3) $fields .= "," . PHP_EOL . $this->_t(3)
. "'c.category_title' => JText:" . ":_('" . "'category_title' => JText:" . ":_('"
. $filter['lang'] . "')"; . $filter['lang'] . "')";
} }
elseif (ComponentbuilderHelper::checkArray( elseif (ComponentbuilderHelper::checkArray(

View File

@ -1035,8 +1035,8 @@ COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_GETITEMS_LABEL="PHP getItems Method<br /><sm
COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_GETITEM_DESCRIPTION="Add PHP Here that should run in the getItem Method. Do not add the php tags." COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_GETITEM_DESCRIPTION="Add PHP Here that should run in the getItem Method. Do not add the php tags."
COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_GETITEM_LABEL="PHP getItem Method<br /><small>Target (object) $item values.</small>" COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_GETITEM_LABEL="PHP getItem Method<br /><small>Target (object) $item values.</small>"
COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_GETLISTQUERY="Php Getlistquery" COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_GETLISTQUERY="Php Getlistquery"
COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_GETLISTQUERY_DESCRIPTION="Add PHP Here that should run in the getlistquery Method of the model of this view. Do not add the php tags" COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_GETLISTQUERY_DESCRIPTION="Add PHP Here that should run in the getListQuery Method of the model of this view, just before the $query object is started. Do not add the php tags"
COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_GETLISTQUERY_LABEL="PHP getlistquery Method<br /><small>used to add custom filtering</small>" COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_GETLISTQUERY_LABEL="PHP getListQuery Method<br /><small>used to add custom filtering values.</small>"
COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_IMPORT="Php Import" COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_IMPORT="Php Import"
COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_IMPORT_DESCRIPTION="Add your PHP here! [Do not add the php tags]" COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_IMPORT_DESCRIPTION="Add your PHP here! [Do not add the php tags]"
COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_IMPORT_DISPLAY="Php Import Display" COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_IMPORT_DISPLAY="Php Import Display"
@ -4635,8 +4635,8 @@ COM_COMPONENTBUILDER_DYNAMIC_GET_PHP_CUSTOM_GET="Php Custom Get"
COM_COMPONENTBUILDER_DYNAMIC_GET_PHP_CUSTOM_GET_DESCRIPTION="Add Custom PHP that will be added to the method selected above as type. Do not add the php tags." COM_COMPONENTBUILDER_DYNAMIC_GET_PHP_CUSTOM_GET_DESCRIPTION="Add Custom PHP that will be added to the method selected above as type. Do not add the php tags."
COM_COMPONENTBUILDER_DYNAMIC_GET_PHP_CUSTOM_GET_LABEL="Custom get" COM_COMPONENTBUILDER_DYNAMIC_GET_PHP_CUSTOM_GET_LABEL="Custom get"
COM_COMPONENTBUILDER_DYNAMIC_GET_PHP_GETLISTQUERY="Php Getlistquery" COM_COMPONENTBUILDER_DYNAMIC_GET_PHP_GETLISTQUERY="Php Getlistquery"
COM_COMPONENTBUILDER_DYNAMIC_GET_PHP_GETLISTQUERY_DESCRIPTION="Add PHP Here that should run in the getlistquery Method of the model of this view. Do not add the php tags" COM_COMPONENTBUILDER_DYNAMIC_GET_PHP_GETLISTQUERY_DESCRIPTION="Add PHP Here that should run in the getListQuery Method of the model of this view, just before the $query object is started. Do not add the php tags"
COM_COMPONENTBUILDER_DYNAMIC_GET_PHP_GETLISTQUERY_LABEL="PHP getlistquery Method<br /><small>used to add custom filtering</small>" COM_COMPONENTBUILDER_DYNAMIC_GET_PHP_GETLISTQUERY_LABEL="PHP getListQuery Method<br /><small>used to add custom filtering values.</small>"
COM_COMPONENTBUILDER_DYNAMIC_GET_PHP_ROUTER_PARSE="Php Router Parse" COM_COMPONENTBUILDER_DYNAMIC_GET_PHP_ROUTER_PARSE="Php Router Parse"
COM_COMPONENTBUILDER_DYNAMIC_GET_PHP_ROUTER_PARSE_DESCRIPTION="Add your PHP here! [Do not add the php tags]<br />Add the php code to override the default JCB implementation of the router parse method for the related view where this dynamicGet is added." COM_COMPONENTBUILDER_DYNAMIC_GET_PHP_ROUTER_PARSE_DESCRIPTION="Add your PHP here! [Do not add the php tags]<br />Add the php code to override the default JCB implementation of the router parse method for the related view where this dynamicGet is added."
COM_COMPONENTBUILDER_DYNAMIC_GET_PHP_ROUTER_PARSE_HINT="// PHP Here that should run in the parse Method -> switch | (array) $segments - the segments of the URL to parse | (array) $vars - the URL attributes to be used by the application." COM_COMPONENTBUILDER_DYNAMIC_GET_PHP_ROUTER_PARSE_HINT="// PHP Here that should run in the parse Method -> switch | (array) $segments - the segments of the URL to parse | (array) $vars - the URL attributes to be used by the application."

View File

@ -13,6 +13,8 @@
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
use Joomla\Registry\Registry; use Joomla\Registry\Registry;
use Joomla\String\StringHelper;
use Joomla\Utilities\ArrayHelper;
/** /**
* Componentbuilder Admin_custom_tabs Model * Componentbuilder Admin_custom_tabs Model
@ -392,7 +394,7 @@ class ComponentbuilderModelAdmin_custom_tabs extends JModelAdmin
* *
* @since 3.0 * @since 3.0
*/ */
protected function getUniqeFields() protected function getUniqueFields()
{ {
return false; return false;
} }
@ -451,7 +453,7 @@ class ComponentbuilderModelAdmin_custom_tabs extends JModelAdmin
{ {
// Sanitize ids. // Sanitize ids.
$pks = array_unique($pks); $pks = array_unique($pks);
JArrayHelper::toInteger($pks); ArrayHelper::toInteger($pks);
// Remove any values of zero. // Remove any values of zero.
if (array_search(0, $pks, true)) if (array_search(0, $pks, true))
@ -492,7 +494,7 @@ class ComponentbuilderModelAdmin_custom_tabs extends JModelAdmin
if (!empty($commands['move_copy'])) if (!empty($commands['move_copy']))
{ {
$cmd = JArrayHelper::getValue($commands, 'move_copy', 'c'); $cmd = ArrayHelper::getValue($commands, 'move_copy', 'c');
if ($cmd == 'c') if ($cmd == 'c')
{ {
@ -559,8 +561,8 @@ class ComponentbuilderModelAdmin_custom_tabs extends JModelAdmin
return false; return false;
} }
// get list of uniqe fields // get list of unique fields
$uniqeFields = $this->getUniqeFields(); $uniqueFields = $this->getUniqueFields();
// remove move_copy from array // remove move_copy from array
unset($values['move_copy']); unset($values['move_copy']);
@ -611,7 +613,7 @@ class ComponentbuilderModelAdmin_custom_tabs extends JModelAdmin
// Only for strings // Only for strings
if (ComponentbuilderHelper::checkString($this->table->admin_view) && !is_numeric($this->table->admin_view)) if (ComponentbuilderHelper::checkString($this->table->admin_view) && !is_numeric($this->table->admin_view))
{ {
$this->table->admin_view = $this->generateUniqe('admin_view',$this->table->admin_view); $this->table->admin_view = $this->generateUnique('admin_view',$this->table->admin_view);
} }
// insert all set values // insert all set values
@ -626,12 +628,12 @@ class ComponentbuilderModelAdmin_custom_tabs extends JModelAdmin
} }
} }
// update all uniqe fields // update all unique fields
if (ComponentbuilderHelper::checkArray($uniqeFields)) if (ComponentbuilderHelper::checkArray($uniqueFields))
{ {
foreach ($uniqeFields as $uniqeField) foreach ($uniqueFields as $uniqueField)
{ {
$this->table->$uniqeField = $this->generateUniqe($uniqeField,$this->table->$uniqeField); $this->table->$uniqueField = $this->generateUnique($uniqueField,$this->table->$uniqueField);
} }
} }
@ -828,16 +830,16 @@ class ComponentbuilderModelAdmin_custom_tabs extends JModelAdmin
$data['params'] = (string) $params; $data['params'] = (string) $params;
} }
// Alter the uniqe field for save as copy // Alter the unique field for save as copy
if ($input->get('task') === 'save2copy') if ($input->get('task') === 'save2copy')
{ {
// Automatic handling of other uniqe fields // Automatic handling of other unique fields
$uniqeFields = $this->getUniqeFields(); $uniqueFields = $this->getUniqueFields();
if (ComponentbuilderHelper::checkArray($uniqeFields)) if (ComponentbuilderHelper::checkArray($uniqueFields))
{ {
foreach ($uniqeFields as $uniqeField) foreach ($uniqueFields as $uniqueField)
{ {
$data[$uniqeField] = $this->generateUniqe($uniqeField,$data[$uniqeField]); $data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]);
} }
} }
} }
@ -850,7 +852,7 @@ class ComponentbuilderModelAdmin_custom_tabs extends JModelAdmin
} }
/** /**
* Method to generate a uniqe value. * Method to generate a unique value.
* *
* @param string $field name. * @param string $field name.
* @param string $value data. * @param string $value data.
@ -859,15 +861,15 @@ class ComponentbuilderModelAdmin_custom_tabs extends JModelAdmin
* *
* @since 3.0 * @since 3.0
*/ */
protected function generateUniqe($field,$value) protected function generateUnique($field,$value)
{ {
// set field value uniqe // set field value unique
$table = $this->getTable(); $table = $this->getTable();
while ($table->load(array($field => $value))) while ($table->load(array($field => $value)))
{ {
$value = JString::increment($value); $value = StringHelper::increment($value);
} }
return $value; return $value;
@ -889,7 +891,7 @@ class ComponentbuilderModelAdmin_custom_tabs extends JModelAdmin
while ($table->load(array('title' => $title))) while ($table->load(array('title' => $title)))
{ {
$title = JString::increment($title); $title = StringHelper::increment($title);
} }
return $title; return $title;

View File

@ -13,6 +13,8 @@
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
use Joomla\Registry\Registry; use Joomla\Registry\Registry;
use Joomla\String\StringHelper;
use Joomla\Utilities\ArrayHelper;
/** /**
* Componentbuilder Admin_fields Model * Componentbuilder Admin_fields Model
@ -413,7 +415,7 @@ class ComponentbuilderModelAdmin_fields extends JModelAdmin
* *
* @since 3.0 * @since 3.0
*/ */
protected function getUniqeFields() protected function getUniqueFields()
{ {
return false; return false;
} }
@ -472,7 +474,7 @@ class ComponentbuilderModelAdmin_fields extends JModelAdmin
{ {
// Sanitize ids. // Sanitize ids.
$pks = array_unique($pks); $pks = array_unique($pks);
JArrayHelper::toInteger($pks); ArrayHelper::toInteger($pks);
// Remove any values of zero. // Remove any values of zero.
if (array_search(0, $pks, true)) if (array_search(0, $pks, true))
@ -513,7 +515,7 @@ class ComponentbuilderModelAdmin_fields extends JModelAdmin
if (!empty($commands['move_copy'])) if (!empty($commands['move_copy']))
{ {
$cmd = JArrayHelper::getValue($commands, 'move_copy', 'c'); $cmd = ArrayHelper::getValue($commands, 'move_copy', 'c');
if ($cmd == 'c') if ($cmd == 'c')
{ {
@ -580,8 +582,8 @@ class ComponentbuilderModelAdmin_fields extends JModelAdmin
return false; return false;
} }
// get list of uniqe fields // get list of unique fields
$uniqeFields = $this->getUniqeFields(); $uniqueFields = $this->getUniqueFields();
// remove move_copy from array // remove move_copy from array
unset($values['move_copy']); unset($values['move_copy']);
@ -632,7 +634,7 @@ class ComponentbuilderModelAdmin_fields extends JModelAdmin
// Only for strings // Only for strings
if (ComponentbuilderHelper::checkString($this->table->admin_view) && !is_numeric($this->table->admin_view)) if (ComponentbuilderHelper::checkString($this->table->admin_view) && !is_numeric($this->table->admin_view))
{ {
$this->table->admin_view = $this->generateUniqe('admin_view',$this->table->admin_view); $this->table->admin_view = $this->generateUnique('admin_view',$this->table->admin_view);
} }
// insert all set values // insert all set values
@ -647,12 +649,12 @@ class ComponentbuilderModelAdmin_fields extends JModelAdmin
} }
} }
// update all uniqe fields // update all unique fields
if (ComponentbuilderHelper::checkArray($uniqeFields)) if (ComponentbuilderHelper::checkArray($uniqueFields))
{ {
foreach ($uniqeFields as $uniqeField) foreach ($uniqueFields as $uniqueField)
{ {
$this->table->$uniqeField = $this->generateUniqe($uniqeField,$this->table->$uniqeField); $this->table->$uniqueField = $this->generateUnique($uniqueField,$this->table->$uniqueField);
} }
} }
@ -859,16 +861,16 @@ class ComponentbuilderModelAdmin_fields extends JModelAdmin
$data['params'] = (string) $params; $data['params'] = (string) $params;
} }
// Alter the uniqe field for save as copy // Alter the unique field for save as copy
if ($input->get('task') === 'save2copy') if ($input->get('task') === 'save2copy')
{ {
// Automatic handling of other uniqe fields // Automatic handling of other unique fields
$uniqeFields = $this->getUniqeFields(); $uniqueFields = $this->getUniqueFields();
if (ComponentbuilderHelper::checkArray($uniqeFields)) if (ComponentbuilderHelper::checkArray($uniqueFields))
{ {
foreach ($uniqeFields as $uniqeField) foreach ($uniqueFields as $uniqueField)
{ {
$data[$uniqeField] = $this->generateUniqe($uniqeField,$data[$uniqeField]); $data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]);
} }
} }
} }
@ -881,7 +883,7 @@ class ComponentbuilderModelAdmin_fields extends JModelAdmin
} }
/** /**
* Method to generate a uniqe value. * Method to generate a unique value.
* *
* @param string $field name. * @param string $field name.
* @param string $value data. * @param string $value data.
@ -890,15 +892,15 @@ class ComponentbuilderModelAdmin_fields extends JModelAdmin
* *
* @since 3.0 * @since 3.0
*/ */
protected function generateUniqe($field,$value) protected function generateUnique($field,$value)
{ {
// set field value uniqe // set field value unique
$table = $this->getTable(); $table = $this->getTable();
while ($table->load(array($field => $value))) while ($table->load(array($field => $value)))
{ {
$value = JString::increment($value); $value = StringHelper::increment($value);
} }
return $value; return $value;
@ -920,7 +922,7 @@ class ComponentbuilderModelAdmin_fields extends JModelAdmin
while ($table->load(array('title' => $title))) while ($table->load(array('title' => $title)))
{ {
$title = JString::increment($title); $title = StringHelper::increment($title);
} }
return $title; return $title;

View File

@ -13,6 +13,8 @@
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
use Joomla\Registry\Registry; use Joomla\Registry\Registry;
use Joomla\String\StringHelper;
use Joomla\Utilities\ArrayHelper;
/** /**
* Componentbuilder Admin_fields_conditions Model * Componentbuilder Admin_fields_conditions Model
@ -413,7 +415,7 @@ class ComponentbuilderModelAdmin_fields_conditions extends JModelAdmin
* *
* @since 3.0 * @since 3.0
*/ */
protected function getUniqeFields() protected function getUniqueFields()
{ {
return false; return false;
} }
@ -472,7 +474,7 @@ class ComponentbuilderModelAdmin_fields_conditions extends JModelAdmin
{ {
// Sanitize ids. // Sanitize ids.
$pks = array_unique($pks); $pks = array_unique($pks);
JArrayHelper::toInteger($pks); ArrayHelper::toInteger($pks);
// Remove any values of zero. // Remove any values of zero.
if (array_search(0, $pks, true)) if (array_search(0, $pks, true))
@ -513,7 +515,7 @@ class ComponentbuilderModelAdmin_fields_conditions extends JModelAdmin
if (!empty($commands['move_copy'])) if (!empty($commands['move_copy']))
{ {
$cmd = JArrayHelper::getValue($commands, 'move_copy', 'c'); $cmd = ArrayHelper::getValue($commands, 'move_copy', 'c');
if ($cmd == 'c') if ($cmd == 'c')
{ {
@ -580,8 +582,8 @@ class ComponentbuilderModelAdmin_fields_conditions extends JModelAdmin
return false; return false;
} }
// get list of uniqe fields // get list of unique fields
$uniqeFields = $this->getUniqeFields(); $uniqueFields = $this->getUniqueFields();
// remove move_copy from array // remove move_copy from array
unset($values['move_copy']); unset($values['move_copy']);
@ -632,7 +634,7 @@ class ComponentbuilderModelAdmin_fields_conditions extends JModelAdmin
// Only for strings // Only for strings
if (ComponentbuilderHelper::checkString($this->table->admin_view) && !is_numeric($this->table->admin_view)) if (ComponentbuilderHelper::checkString($this->table->admin_view) && !is_numeric($this->table->admin_view))
{ {
$this->table->admin_view = $this->generateUniqe('admin_view',$this->table->admin_view); $this->table->admin_view = $this->generateUnique('admin_view',$this->table->admin_view);
} }
// insert all set values // insert all set values
@ -647,12 +649,12 @@ class ComponentbuilderModelAdmin_fields_conditions extends JModelAdmin
} }
} }
// update all uniqe fields // update all unique fields
if (ComponentbuilderHelper::checkArray($uniqeFields)) if (ComponentbuilderHelper::checkArray($uniqueFields))
{ {
foreach ($uniqeFields as $uniqeField) foreach ($uniqueFields as $uniqueField)
{ {
$this->table->$uniqeField = $this->generateUniqe($uniqeField,$this->table->$uniqeField); $this->table->$uniqueField = $this->generateUnique($uniqueField,$this->table->$uniqueField);
} }
} }
@ -849,16 +851,16 @@ class ComponentbuilderModelAdmin_fields_conditions extends JModelAdmin
$data['params'] = (string) $params; $data['params'] = (string) $params;
} }
// Alter the uniqe field for save as copy // Alter the unique field for save as copy
if ($input->get('task') === 'save2copy') if ($input->get('task') === 'save2copy')
{ {
// Automatic handling of other uniqe fields // Automatic handling of other unique fields
$uniqeFields = $this->getUniqeFields(); $uniqueFields = $this->getUniqueFields();
if (ComponentbuilderHelper::checkArray($uniqeFields)) if (ComponentbuilderHelper::checkArray($uniqueFields))
{ {
foreach ($uniqeFields as $uniqeField) foreach ($uniqueFields as $uniqueField)
{ {
$data[$uniqeField] = $this->generateUniqe($uniqeField,$data[$uniqeField]); $data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]);
} }
} }
} }
@ -871,7 +873,7 @@ class ComponentbuilderModelAdmin_fields_conditions extends JModelAdmin
} }
/** /**
* Method to generate a uniqe value. * Method to generate a unique value.
* *
* @param string $field name. * @param string $field name.
* @param string $value data. * @param string $value data.
@ -880,15 +882,15 @@ class ComponentbuilderModelAdmin_fields_conditions extends JModelAdmin
* *
* @since 3.0 * @since 3.0
*/ */
protected function generateUniqe($field,$value) protected function generateUnique($field,$value)
{ {
// set field value uniqe // set field value unique
$table = $this->getTable(); $table = $this->getTable();
while ($table->load(array($field => $value))) while ($table->load(array($field => $value)))
{ {
$value = JString::increment($value); $value = StringHelper::increment($value);
} }
return $value; return $value;
@ -910,7 +912,7 @@ class ComponentbuilderModelAdmin_fields_conditions extends JModelAdmin
while ($table->load(array('title' => $title))) while ($table->load(array('title' => $title)))
{ {
$title = JString::increment($title); $title = StringHelper::increment($title);
} }
return $title; return $title;

View File

@ -13,6 +13,8 @@
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
use Joomla\Registry\Registry; use Joomla\Registry\Registry;
use Joomla\String\StringHelper;
use Joomla\Utilities\ArrayHelper;
/** /**
* Componentbuilder Admin_fields_relations Model * Componentbuilder Admin_fields_relations Model
@ -475,7 +477,7 @@ class ComponentbuilderModelAdmin_fields_relations extends JModelAdmin
* *
* @since 3.0 * @since 3.0
*/ */
protected function getUniqeFields() protected function getUniqueFields()
{ {
return false; return false;
} }
@ -534,7 +536,7 @@ class ComponentbuilderModelAdmin_fields_relations extends JModelAdmin
{ {
// Sanitize ids. // Sanitize ids.
$pks = array_unique($pks); $pks = array_unique($pks);
JArrayHelper::toInteger($pks); ArrayHelper::toInteger($pks);
// Remove any values of zero. // Remove any values of zero.
if (array_search(0, $pks, true)) if (array_search(0, $pks, true))
@ -575,7 +577,7 @@ class ComponentbuilderModelAdmin_fields_relations extends JModelAdmin
if (!empty($commands['move_copy'])) if (!empty($commands['move_copy']))
{ {
$cmd = JArrayHelper::getValue($commands, 'move_copy', 'c'); $cmd = ArrayHelper::getValue($commands, 'move_copy', 'c');
if ($cmd == 'c') if ($cmd == 'c')
{ {
@ -642,8 +644,8 @@ class ComponentbuilderModelAdmin_fields_relations extends JModelAdmin
return false; return false;
} }
// get list of uniqe fields // get list of unique fields
$uniqeFields = $this->getUniqeFields(); $uniqueFields = $this->getUniqueFields();
// remove move_copy from array // remove move_copy from array
unset($values['move_copy']); unset($values['move_copy']);
@ -694,7 +696,7 @@ class ComponentbuilderModelAdmin_fields_relations extends JModelAdmin
// Only for strings // Only for strings
if (ComponentbuilderHelper::checkString($this->table->admin_view) && !is_numeric($this->table->admin_view)) if (ComponentbuilderHelper::checkString($this->table->admin_view) && !is_numeric($this->table->admin_view))
{ {
$this->table->admin_view = $this->generateUniqe('admin_view',$this->table->admin_view); $this->table->admin_view = $this->generateUnique('admin_view',$this->table->admin_view);
} }
// insert all set values // insert all set values
@ -709,12 +711,12 @@ class ComponentbuilderModelAdmin_fields_relations extends JModelAdmin
} }
} }
// update all uniqe fields // update all unique fields
if (ComponentbuilderHelper::checkArray($uniqeFields)) if (ComponentbuilderHelper::checkArray($uniqueFields))
{ {
foreach ($uniqeFields as $uniqeField) foreach ($uniqueFields as $uniqueField)
{ {
$this->table->$uniqeField = $this->generateUniqe($uniqeField,$this->table->$uniqeField); $this->table->$uniqueField = $this->generateUnique($uniqueField,$this->table->$uniqueField);
} }
} }
@ -911,16 +913,16 @@ class ComponentbuilderModelAdmin_fields_relations extends JModelAdmin
$data['params'] = (string) $params; $data['params'] = (string) $params;
} }
// Alter the uniqe field for save as copy // Alter the unique field for save as copy
if ($input->get('task') === 'save2copy') if ($input->get('task') === 'save2copy')
{ {
// Automatic handling of other uniqe fields // Automatic handling of other unique fields
$uniqeFields = $this->getUniqeFields(); $uniqueFields = $this->getUniqueFields();
if (ComponentbuilderHelper::checkArray($uniqeFields)) if (ComponentbuilderHelper::checkArray($uniqueFields))
{ {
foreach ($uniqeFields as $uniqeField) foreach ($uniqueFields as $uniqueField)
{ {
$data[$uniqeField] = $this->generateUniqe($uniqeField,$data[$uniqeField]); $data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]);
} }
} }
} }
@ -933,7 +935,7 @@ class ComponentbuilderModelAdmin_fields_relations extends JModelAdmin
} }
/** /**
* Method to generate a uniqe value. * Method to generate a unique value.
* *
* @param string $field name. * @param string $field name.
* @param string $value data. * @param string $value data.
@ -942,15 +944,15 @@ class ComponentbuilderModelAdmin_fields_relations extends JModelAdmin
* *
* @since 3.0 * @since 3.0
*/ */
protected function generateUniqe($field,$value) protected function generateUnique($field,$value)
{ {
// set field value uniqe // set field value unique
$table = $this->getTable(); $table = $this->getTable();
while ($table->load(array($field => $value))) while ($table->load(array($field => $value)))
{ {
$value = JString::increment($value); $value = StringHelper::increment($value);
} }
return $value; return $value;
@ -972,7 +974,7 @@ class ComponentbuilderModelAdmin_fields_relations extends JModelAdmin
while ($table->load(array('title' => $title))) while ($table->load(array('title' => $title)))
{ {
$title = JString::increment($title); $title = StringHelper::increment($title);
} }
return $title; return $title;

View File

@ -13,6 +13,8 @@
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
use Joomla\Registry\Registry; use Joomla\Registry\Registry;
use Joomla\String\StringHelper;
use Joomla\Utilities\ArrayHelper;
/** /**
* Componentbuilder Admin_view Model * Componentbuilder Admin_view Model
@ -1009,9 +1011,9 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin
* *
* @since 3.0 * @since 3.0
*/ */
protected function getUniqeFields() protected function getUniqueFields()
{ {
return false; return array('guid');
} }
/** /**
@ -1112,7 +1114,7 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin
{ {
// Sanitize ids. // Sanitize ids.
$pks = array_unique($pks); $pks = array_unique($pks);
JArrayHelper::toInteger($pks); ArrayHelper::toInteger($pks);
// Remove any values of zero. // Remove any values of zero.
if (array_search(0, $pks, true)) if (array_search(0, $pks, true))
@ -1153,7 +1155,7 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin
if (!empty($commands['move_copy'])) if (!empty($commands['move_copy']))
{ {
$cmd = JArrayHelper::getValue($commands, 'move_copy', 'c'); $cmd = ArrayHelper::getValue($commands, 'move_copy', 'c');
if ($cmd == 'c') if ($cmd == 'c')
{ {
@ -1220,8 +1222,8 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin
return false; return false;
} }
// get list of uniqe fields // get list of unique fields
$uniqeFields = $this->getUniqeFields(); $uniqueFields = $this->getUniqueFields();
// remove move_copy from array // remove move_copy from array
unset($values['move_copy']); unset($values['move_copy']);
@ -1281,12 +1283,12 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin
} }
} }
// update all uniqe fields // update all unique fields
if (ComponentbuilderHelper::checkArray($uniqeFields)) if (ComponentbuilderHelper::checkArray($uniqueFields))
{ {
foreach ($uniqeFields as $uniqeField) foreach ($uniqueFields as $uniqueField)
{ {
$this->table->$uniqeField = $this->generateUniqe($uniqeField,$this->table->$uniqeField); $this->table->$uniqueField = $this->generateUnique($uniqueField,$this->table->$uniqueField);
} }
} }
@ -1822,16 +1824,16 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin
$data['params'] = (string) $params; $data['params'] = (string) $params;
} }
// Alter the uniqe field for save as copy // Alter the unique field for save as copy
if ($input->get('task') === 'save2copy') if ($input->get('task') === 'save2copy')
{ {
// Automatic handling of other uniqe fields // Automatic handling of other unique fields
$uniqeFields = $this->getUniqeFields(); $uniqueFields = $this->getUniqueFields();
if (ComponentbuilderHelper::checkArray($uniqeFields)) if (ComponentbuilderHelper::checkArray($uniqueFields))
{ {
foreach ($uniqeFields as $uniqeField) foreach ($uniqueFields as $uniqueField)
{ {
$data[$uniqeField] = $this->generateUniqe($uniqeField,$data[$uniqeField]); $data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]);
} }
} }
} }
@ -1844,7 +1846,7 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin
} }
/** /**
* Method to generate a uniqe value. * Method to generate a unique value.
* *
* @param string $field name. * @param string $field name.
* @param string $value data. * @param string $value data.
@ -1853,15 +1855,15 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin
* *
* @since 3.0 * @since 3.0
*/ */
protected function generateUniqe($field,$value) protected function generateUnique($field,$value)
{ {
// set field value uniqe // set field value unique
$table = $this->getTable(); $table = $this->getTable();
while ($table->load(array($field => $value))) while ($table->load(array($field => $value)))
{ {
$value = JString::increment($value); $value = StringHelper::increment($value);
} }
return $value; return $value;

View File

@ -12,6 +12,8 @@
// 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\Utilities\ArrayHelper;
/** /**
* Admin_views Model * Admin_views Model
*/ */
@ -320,7 +322,7 @@ class ComponentbuilderModelAdmin_views extends JModelList
// Add the list ordering clause. // Add the list ordering clause.
$orderCol = $this->state->get('list.ordering', 'a.id'); $orderCol = $this->state->get('list.ordering', 'a.id');
$orderDirn = $this->state->get('list.direction', 'asc'); $orderDirn = $this->state->get('list.direction', 'DESC');
if ($orderCol != '') if ($orderCol != '')
{ {
$query->order($db->escape($orderCol . ' ' . $orderDirn)); $query->order($db->escape($orderCol . ' ' . $orderDirn));
@ -367,7 +369,7 @@ class ComponentbuilderModelAdmin_views extends JModelList
} }
// Order the results by ordering // Order the results by ordering
$query->order('a.ordering ASC'); $query->order('a.id DESC');
// Load the items // Load the items
$db->setQuery($query); $db->setQuery($query);

View File

@ -12,6 +12,8 @@
// 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\Utilities\ArrayHelper;
/** /**
* Admins_custom_tabs Model * Admins_custom_tabs Model
*/ */
@ -160,7 +162,7 @@ class ComponentbuilderModelAdmins_custom_tabs extends JModelList
// Add the list ordering clause. // Add the list ordering clause.
$orderCol = $this->state->get('list.ordering', 'a.id'); $orderCol = $this->state->get('list.ordering', 'a.id');
$orderDirn = $this->state->get('list.direction', 'asc'); $orderDirn = $this->state->get('list.direction', 'asc');
if ($orderCol != '') if ($orderCol != '')
{ {
$query->order($db->escape($orderCol . ' ' . $orderDirn)); $query->order($db->escape($orderCol . ' ' . $orderDirn));

View File

@ -12,6 +12,8 @@
// 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\Utilities\ArrayHelper;
/** /**
* Admins_fields Model * Admins_fields Model
*/ */
@ -160,7 +162,7 @@ class ComponentbuilderModelAdmins_fields extends JModelList
// Add the list ordering clause. // Add the list ordering clause.
$orderCol = $this->state->get('list.ordering', 'a.id'); $orderCol = $this->state->get('list.ordering', 'a.id');
$orderDirn = $this->state->get('list.direction', 'asc'); $orderDirn = $this->state->get('list.direction', 'asc');
if ($orderCol != '') if ($orderCol != '')
{ {
$query->order($db->escape($orderCol . ' ' . $orderDirn)); $query->order($db->escape($orderCol . ' ' . $orderDirn));

View File

@ -12,6 +12,8 @@
// 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\Utilities\ArrayHelper;
/** /**
* Admins_fields_conditions Model * Admins_fields_conditions Model
*/ */
@ -160,7 +162,7 @@ class ComponentbuilderModelAdmins_fields_conditions extends JModelList
// Add the list ordering clause. // Add the list ordering clause.
$orderCol = $this->state->get('list.ordering', 'a.id'); $orderCol = $this->state->get('list.ordering', 'a.id');
$orderDirn = $this->state->get('list.direction', 'asc'); $orderDirn = $this->state->get('list.direction', 'asc');
if ($orderCol != '') if ($orderCol != '')
{ {
$query->order($db->escape($orderCol . ' ' . $orderDirn)); $query->order($db->escape($orderCol . ' ' . $orderDirn));

View File

@ -12,6 +12,8 @@
// 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\Utilities\ArrayHelper;
/** /**
* Admins_fields_relations Model * Admins_fields_relations Model
*/ */
@ -160,7 +162,7 @@ class ComponentbuilderModelAdmins_fields_relations extends JModelList
// Add the list ordering clause. // Add the list ordering clause.
$orderCol = $this->state->get('list.ordering', 'a.id'); $orderCol = $this->state->get('list.ordering', 'a.id');
$orderDirn = $this->state->get('list.direction', 'asc'); $orderDirn = $this->state->get('list.direction', 'asc');
if ($orderCol != '') if ($orderCol != '')
{ {
$query->order($db->escape($orderCol . ' ' . $orderDirn)); $query->order($db->escape($orderCol . ' ' . $orderDirn));

View File

@ -12,6 +12,8 @@
// 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\Utilities\ArrayHelper;
/** /**
* Componentbuilder Ajax Model * Componentbuilder Ajax Model
*/ */

View File

@ -12,6 +12,8 @@
// 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\Utilities\ArrayHelper;
/** /**
* Class_extendings Model * Class_extendings Model
*/ */
@ -218,7 +220,7 @@ class ComponentbuilderModelClass_extendings extends JModelList
// Add the list ordering clause. // Add the list ordering clause.
$orderCol = $this->state->get('list.ordering', 'a.id'); $orderCol = $this->state->get('list.ordering', 'a.id');
$orderDirn = $this->state->get('list.direction', 'asc'); $orderDirn = $this->state->get('list.direction', 'asc');
if ($orderCol != '') if ($orderCol != '')
{ {
$query->order($db->escape($orderCol . ' ' . $orderDirn)); $query->order($db->escape($orderCol . ' ' . $orderDirn));

View File

@ -13,6 +13,8 @@
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
use Joomla\Registry\Registry; use Joomla\Registry\Registry;
use Joomla\String\StringHelper;
use Joomla\Utilities\ArrayHelper;
/** /**
* Componentbuilder Class_extends Model * Componentbuilder Class_extends Model
@ -499,7 +501,7 @@ class ComponentbuilderModelClass_extends extends JModelAdmin
* *
* @since 3.0 * @since 3.0
*/ */
protected function getUniqeFields() protected function getUniqueFields()
{ {
return false; return false;
} }
@ -558,7 +560,7 @@ class ComponentbuilderModelClass_extends extends JModelAdmin
{ {
// Sanitize ids. // Sanitize ids.
$pks = array_unique($pks); $pks = array_unique($pks);
JArrayHelper::toInteger($pks); ArrayHelper::toInteger($pks);
// Remove any values of zero. // Remove any values of zero.
if (array_search(0, $pks, true)) if (array_search(0, $pks, true))
@ -599,7 +601,7 @@ class ComponentbuilderModelClass_extends extends JModelAdmin
if (!empty($commands['move_copy'])) if (!empty($commands['move_copy']))
{ {
$cmd = JArrayHelper::getValue($commands, 'move_copy', 'c'); $cmd = ArrayHelper::getValue($commands, 'move_copy', 'c');
if ($cmd == 'c') if ($cmd == 'c')
{ {
@ -666,8 +668,8 @@ class ComponentbuilderModelClass_extends extends JModelAdmin
return false; return false;
} }
// get list of uniqe fields // get list of unique fields
$uniqeFields = $this->getUniqeFields(); $uniqueFields = $this->getUniqueFields();
// remove move_copy from array // remove move_copy from array
unset($values['move_copy']); unset($values['move_copy']);
@ -718,7 +720,7 @@ class ComponentbuilderModelClass_extends extends JModelAdmin
// Only for strings // Only for strings
if (ComponentbuilderHelper::checkString($this->table->name) && !is_numeric($this->table->name)) if (ComponentbuilderHelper::checkString($this->table->name) && !is_numeric($this->table->name))
{ {
$this->table->name = $this->generateUniqe('name',$this->table->name); $this->table->name = $this->generateUnique('name',$this->table->name);
} }
// insert all set values // insert all set values
@ -733,12 +735,12 @@ class ComponentbuilderModelClass_extends extends JModelAdmin
} }
} }
// update all uniqe fields // update all unique fields
if (ComponentbuilderHelper::checkArray($uniqeFields)) if (ComponentbuilderHelper::checkArray($uniqueFields))
{ {
foreach ($uniqeFields as $uniqeField) foreach ($uniqueFields as $uniqueField)
{ {
$this->table->$uniqeField = $this->generateUniqe($uniqeField,$this->table->$uniqeField); $this->table->$uniqueField = $this->generateUnique($uniqueField,$this->table->$uniqueField);
} }
} }
@ -937,16 +939,16 @@ class ComponentbuilderModelClass_extends extends JModelAdmin
$data['params'] = (string) $params; $data['params'] = (string) $params;
} }
// Alter the uniqe field for save as copy // Alter the unique field for save as copy
if ($input->get('task') === 'save2copy') if ($input->get('task') === 'save2copy')
{ {
// Automatic handling of other uniqe fields // Automatic handling of other unique fields
$uniqeFields = $this->getUniqeFields(); $uniqueFields = $this->getUniqueFields();
if (ComponentbuilderHelper::checkArray($uniqeFields)) if (ComponentbuilderHelper::checkArray($uniqueFields))
{ {
foreach ($uniqeFields as $uniqeField) foreach ($uniqueFields as $uniqueField)
{ {
$data[$uniqeField] = $this->generateUniqe($uniqeField,$data[$uniqeField]); $data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]);
} }
} }
} }
@ -959,7 +961,7 @@ class ComponentbuilderModelClass_extends extends JModelAdmin
} }
/** /**
* Method to generate a uniqe value. * Method to generate a unique value.
* *
* @param string $field name. * @param string $field name.
* @param string $value data. * @param string $value data.
@ -968,15 +970,15 @@ class ComponentbuilderModelClass_extends extends JModelAdmin
* *
* @since 3.0 * @since 3.0
*/ */
protected function generateUniqe($field,$value) protected function generateUnique($field,$value)
{ {
// set field value uniqe // set field value unique
$table = $this->getTable(); $table = $this->getTable();
while ($table->load(array($field => $value))) while ($table->load(array($field => $value)))
{ {
$value = JString::increment($value); $value = StringHelper::increment($value);
} }
return $value; return $value;
@ -998,7 +1000,7 @@ class ComponentbuilderModelClass_extends extends JModelAdmin
while ($table->load(array('title' => $title))) while ($table->load(array('title' => $title)))
{ {
$title = JString::increment($title); $title = StringHelper::increment($title);
} }
return $title; return $title;

View File

@ -13,6 +13,8 @@
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
use Joomla\Registry\Registry; use Joomla\Registry\Registry;
use Joomla\String\StringHelper;
use Joomla\Utilities\ArrayHelper;
/** /**
* Componentbuilder Class_method Model * Componentbuilder Class_method Model
@ -551,9 +553,9 @@ class ComponentbuilderModelClass_method extends JModelAdmin
* *
* @since 3.0 * @since 3.0
*/ */
protected function getUniqeFields() protected function getUniqueFields()
{ {
return false; return array('guid');
} }
/** /**
@ -610,7 +612,7 @@ class ComponentbuilderModelClass_method extends JModelAdmin
{ {
// Sanitize ids. // Sanitize ids.
$pks = array_unique($pks); $pks = array_unique($pks);
JArrayHelper::toInteger($pks); ArrayHelper::toInteger($pks);
// Remove any values of zero. // Remove any values of zero.
if (array_search(0, $pks, true)) if (array_search(0, $pks, true))
@ -651,7 +653,7 @@ class ComponentbuilderModelClass_method extends JModelAdmin
if (!empty($commands['move_copy'])) if (!empty($commands['move_copy']))
{ {
$cmd = JArrayHelper::getValue($commands, 'move_copy', 'c'); $cmd = ArrayHelper::getValue($commands, 'move_copy', 'c');
if ($cmd == 'c') if ($cmd == 'c')
{ {
@ -718,8 +720,8 @@ class ComponentbuilderModelClass_method extends JModelAdmin
return false; return false;
} }
// get list of uniqe fields // get list of unique fields
$uniqeFields = $this->getUniqeFields(); $uniqueFields = $this->getUniqueFields();
// remove move_copy from array // remove move_copy from array
unset($values['move_copy']); unset($values['move_copy']);
@ -770,7 +772,7 @@ class ComponentbuilderModelClass_method extends JModelAdmin
// Only for strings // Only for strings
if (ComponentbuilderHelper::checkString($this->table->name) && !is_numeric($this->table->name)) if (ComponentbuilderHelper::checkString($this->table->name) && !is_numeric($this->table->name))
{ {
$this->table->name = $this->generateUniqe('name',$this->table->name); $this->table->name = $this->generateUnique('name',$this->table->name);
} }
// insert all set values // insert all set values
@ -785,12 +787,12 @@ class ComponentbuilderModelClass_method extends JModelAdmin
} }
} }
// update all uniqe fields // update all unique fields
if (ComponentbuilderHelper::checkArray($uniqeFields)) if (ComponentbuilderHelper::checkArray($uniqueFields))
{ {
foreach ($uniqeFields as $uniqeField) foreach ($uniqueFields as $uniqueField)
{ {
$this->table->$uniqeField = $this->generateUniqe($uniqeField,$this->table->$uniqeField); $this->table->$uniqueField = $this->generateUnique($uniqueField,$this->table->$uniqueField);
} }
} }
@ -1002,16 +1004,16 @@ class ComponentbuilderModelClass_method extends JModelAdmin
$data['params'] = (string) $params; $data['params'] = (string) $params;
} }
// Alter the uniqe field for save as copy // Alter the unique field for save as copy
if ($input->get('task') === 'save2copy') if ($input->get('task') === 'save2copy')
{ {
// Automatic handling of other uniqe fields // Automatic handling of other unique fields
$uniqeFields = $this->getUniqeFields(); $uniqueFields = $this->getUniqueFields();
if (ComponentbuilderHelper::checkArray($uniqeFields)) if (ComponentbuilderHelper::checkArray($uniqueFields))
{ {
foreach ($uniqeFields as $uniqeField) foreach ($uniqueFields as $uniqueField)
{ {
$data[$uniqeField] = $this->generateUniqe($uniqeField,$data[$uniqeField]); $data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]);
} }
} }
} }
@ -1024,7 +1026,7 @@ class ComponentbuilderModelClass_method extends JModelAdmin
} }
/** /**
* Method to generate a uniqe value. * Method to generate a unique value.
* *
* @param string $field name. * @param string $field name.
* @param string $value data. * @param string $value data.
@ -1033,15 +1035,15 @@ class ComponentbuilderModelClass_method extends JModelAdmin
* *
* @since 3.0 * @since 3.0
*/ */
protected function generateUniqe($field,$value) protected function generateUnique($field,$value)
{ {
// set field value uniqe // set field value unique
$table = $this->getTable(); $table = $this->getTable();
while ($table->load(array($field => $value))) while ($table->load(array($field => $value)))
{ {
$value = JString::increment($value); $value = StringHelper::increment($value);
} }
return $value; return $value;
@ -1063,7 +1065,7 @@ class ComponentbuilderModelClass_method extends JModelAdmin
while ($table->load(array('title' => $title))) while ($table->load(array('title' => $title)))
{ {
$title = JString::increment($title); $title = StringHelper::increment($title);
} }
return $title; return $title;

View File

@ -12,6 +12,8 @@
// 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\Utilities\ArrayHelper;
/** /**
* Class_methods Model * Class_methods Model
*/ */
@ -247,7 +249,7 @@ class ComponentbuilderModelClass_methods extends JModelList
// Add the list ordering clause. // Add the list ordering clause.
$orderCol = $this->state->get('list.ordering', 'a.id'); $orderCol = $this->state->get('list.ordering', 'a.id');
$orderDirn = $this->state->get('list.direction', 'asc'); $orderDirn = $this->state->get('list.direction', 'asc');
if ($orderCol != '') if ($orderCol != '')
{ {
$query->order($db->escape($orderCol . ' ' . $orderDirn)); $query->order($db->escape($orderCol . ' ' . $orderDirn));

View File

@ -12,6 +12,8 @@
// 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\Utilities\ArrayHelper;
/** /**
* Class_properties Model * Class_properties Model
*/ */
@ -247,7 +249,7 @@ class ComponentbuilderModelClass_properties extends JModelList
// Add the list ordering clause. // Add the list ordering clause.
$orderCol = $this->state->get('list.ordering', 'a.id'); $orderCol = $this->state->get('list.ordering', 'a.id');
$orderDirn = $this->state->get('list.direction', 'asc'); $orderDirn = $this->state->get('list.direction', 'asc');
if ($orderCol != '') if ($orderCol != '')
{ {
$query->order($db->escape($orderCol . ' ' . $orderDirn)); $query->order($db->escape($orderCol . ' ' . $orderDirn));

View File

@ -13,6 +13,8 @@
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
use Joomla\Registry\Registry; use Joomla\Registry\Registry;
use Joomla\String\StringHelper;
use Joomla\Utilities\ArrayHelper;
/** /**
* Componentbuilder Class_property Model * Componentbuilder Class_property Model
@ -542,9 +544,9 @@ class ComponentbuilderModelClass_property extends JModelAdmin
* *
* @since 3.0 * @since 3.0
*/ */
protected function getUniqeFields() protected function getUniqueFields()
{ {
return false; return array('guid');
} }
/** /**
@ -601,7 +603,7 @@ class ComponentbuilderModelClass_property extends JModelAdmin
{ {
// Sanitize ids. // Sanitize ids.
$pks = array_unique($pks); $pks = array_unique($pks);
JArrayHelper::toInteger($pks); ArrayHelper::toInteger($pks);
// Remove any values of zero. // Remove any values of zero.
if (array_search(0, $pks, true)) if (array_search(0, $pks, true))
@ -642,7 +644,7 @@ class ComponentbuilderModelClass_property extends JModelAdmin
if (!empty($commands['move_copy'])) if (!empty($commands['move_copy']))
{ {
$cmd = JArrayHelper::getValue($commands, 'move_copy', 'c'); $cmd = ArrayHelper::getValue($commands, 'move_copy', 'c');
if ($cmd == 'c') if ($cmd == 'c')
{ {
@ -709,8 +711,8 @@ class ComponentbuilderModelClass_property extends JModelAdmin
return false; return false;
} }
// get list of uniqe fields // get list of unique fields
$uniqeFields = $this->getUniqeFields(); $uniqueFields = $this->getUniqueFields();
// remove move_copy from array // remove move_copy from array
unset($values['move_copy']); unset($values['move_copy']);
@ -761,7 +763,7 @@ class ComponentbuilderModelClass_property extends JModelAdmin
// Only for strings // Only for strings
if (ComponentbuilderHelper::checkString($this->table->name) && !is_numeric($this->table->name)) if (ComponentbuilderHelper::checkString($this->table->name) && !is_numeric($this->table->name))
{ {
$this->table->name = $this->generateUniqe('name',$this->table->name); $this->table->name = $this->generateUnique('name',$this->table->name);
} }
// insert all set values // insert all set values
@ -776,12 +778,12 @@ class ComponentbuilderModelClass_property extends JModelAdmin
} }
} }
// update all uniqe fields // update all unique fields
if (ComponentbuilderHelper::checkArray($uniqeFields)) if (ComponentbuilderHelper::checkArray($uniqueFields))
{ {
foreach ($uniqeFields as $uniqeField) foreach ($uniqueFields as $uniqueField)
{ {
$this->table->$uniqeField = $this->generateUniqe($uniqeField,$this->table->$uniqeField); $this->table->$uniqueField = $this->generateUnique($uniqueField,$this->table->$uniqueField);
} }
} }
@ -987,16 +989,16 @@ class ComponentbuilderModelClass_property extends JModelAdmin
$data['params'] = (string) $params; $data['params'] = (string) $params;
} }
// Alter the uniqe field for save as copy // Alter the unique field for save as copy
if ($input->get('task') === 'save2copy') if ($input->get('task') === 'save2copy')
{ {
// Automatic handling of other uniqe fields // Automatic handling of other unique fields
$uniqeFields = $this->getUniqeFields(); $uniqueFields = $this->getUniqueFields();
if (ComponentbuilderHelper::checkArray($uniqeFields)) if (ComponentbuilderHelper::checkArray($uniqueFields))
{ {
foreach ($uniqeFields as $uniqeField) foreach ($uniqueFields as $uniqueField)
{ {
$data[$uniqeField] = $this->generateUniqe($uniqeField,$data[$uniqeField]); $data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]);
} }
} }
} }
@ -1009,7 +1011,7 @@ class ComponentbuilderModelClass_property extends JModelAdmin
} }
/** /**
* Method to generate a uniqe value. * Method to generate a unique value.
* *
* @param string $field name. * @param string $field name.
* @param string $value data. * @param string $value data.
@ -1018,15 +1020,15 @@ class ComponentbuilderModelClass_property extends JModelAdmin
* *
* @since 3.0 * @since 3.0
*/ */
protected function generateUniqe($field,$value) protected function generateUnique($field,$value)
{ {
// set field value uniqe // set field value unique
$table = $this->getTable(); $table = $this->getTable();
while ($table->load(array($field => $value))) while ($table->load(array($field => $value)))
{ {
$value = JString::increment($value); $value = StringHelper::increment($value);
} }
return $value; return $value;
@ -1048,7 +1050,7 @@ class ComponentbuilderModelClass_property extends JModelAdmin
while ($table->load(array('title' => $title))) while ($table->load(array('title' => $title)))
{ {
$title = JString::increment($title); $title = StringHelper::increment($title);
} }
return $title; return $title;

View File

@ -12,6 +12,8 @@
// 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\Utilities\ArrayHelper;
/** /**
* Componentbuilder Model for Compiler * Componentbuilder Model for Compiler
*/ */

View File

@ -13,6 +13,8 @@
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
use Joomla\Registry\Registry; use Joomla\Registry\Registry;
use Joomla\String\StringHelper;
use Joomla\Utilities\ArrayHelper;
/** /**
* Componentbuilder Component_admin_views Model * Componentbuilder Component_admin_views Model
@ -424,7 +426,7 @@ class ComponentbuilderModelComponent_admin_views extends JModelAdmin
* *
* @since 3.0 * @since 3.0
*/ */
protected function getUniqeFields() protected function getUniqueFields()
{ {
return false; return false;
} }
@ -483,7 +485,7 @@ class ComponentbuilderModelComponent_admin_views extends JModelAdmin
{ {
// Sanitize ids. // Sanitize ids.
$pks = array_unique($pks); $pks = array_unique($pks);
JArrayHelper::toInteger($pks); ArrayHelper::toInteger($pks);
// Remove any values of zero. // Remove any values of zero.
if (array_search(0, $pks, true)) if (array_search(0, $pks, true))
@ -524,7 +526,7 @@ class ComponentbuilderModelComponent_admin_views extends JModelAdmin
if (!empty($commands['move_copy'])) if (!empty($commands['move_copy']))
{ {
$cmd = JArrayHelper::getValue($commands, 'move_copy', 'c'); $cmd = ArrayHelper::getValue($commands, 'move_copy', 'c');
if ($cmd == 'c') if ($cmd == 'c')
{ {
@ -591,8 +593,8 @@ class ComponentbuilderModelComponent_admin_views extends JModelAdmin
return false; return false;
} }
// get list of uniqe fields // get list of unique fields
$uniqeFields = $this->getUniqeFields(); $uniqueFields = $this->getUniqueFields();
// remove move_copy from array // remove move_copy from array
unset($values['move_copy']); unset($values['move_copy']);
@ -643,7 +645,7 @@ class ComponentbuilderModelComponent_admin_views extends JModelAdmin
// Only for strings // Only for strings
if (ComponentbuilderHelper::checkString($this->table->joomla_component) && !is_numeric($this->table->joomla_component)) if (ComponentbuilderHelper::checkString($this->table->joomla_component) && !is_numeric($this->table->joomla_component))
{ {
$this->table->joomla_component = $this->generateUniqe('joomla_component',$this->table->joomla_component); $this->table->joomla_component = $this->generateUnique('joomla_component',$this->table->joomla_component);
} }
// insert all set values // insert all set values
@ -658,12 +660,12 @@ class ComponentbuilderModelComponent_admin_views extends JModelAdmin
} }
} }
// update all uniqe fields // update all unique fields
if (ComponentbuilderHelper::checkArray($uniqeFields)) if (ComponentbuilderHelper::checkArray($uniqueFields))
{ {
foreach ($uniqeFields as $uniqeField) foreach ($uniqueFields as $uniqueField)
{ {
$this->table->$uniqeField = $this->generateUniqe($uniqeField,$this->table->$uniqeField); $this->table->$uniqueField = $this->generateUnique($uniqueField,$this->table->$uniqueField);
} }
} }
@ -860,16 +862,16 @@ class ComponentbuilderModelComponent_admin_views extends JModelAdmin
$data['params'] = (string) $params; $data['params'] = (string) $params;
} }
// Alter the uniqe field for save as copy // Alter the unique field for save as copy
if ($input->get('task') === 'save2copy') if ($input->get('task') === 'save2copy')
{ {
// Automatic handling of other uniqe fields // Automatic handling of other unique fields
$uniqeFields = $this->getUniqeFields(); $uniqueFields = $this->getUniqueFields();
if (ComponentbuilderHelper::checkArray($uniqeFields)) if (ComponentbuilderHelper::checkArray($uniqueFields))
{ {
foreach ($uniqeFields as $uniqeField) foreach ($uniqueFields as $uniqueField)
{ {
$data[$uniqeField] = $this->generateUniqe($uniqeField,$data[$uniqeField]); $data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]);
} }
} }
} }
@ -882,7 +884,7 @@ class ComponentbuilderModelComponent_admin_views extends JModelAdmin
} }
/** /**
* Method to generate a uniqe value. * Method to generate a unique value.
* *
* @param string $field name. * @param string $field name.
* @param string $value data. * @param string $value data.
@ -891,15 +893,15 @@ class ComponentbuilderModelComponent_admin_views extends JModelAdmin
* *
* @since 3.0 * @since 3.0
*/ */
protected function generateUniqe($field,$value) protected function generateUnique($field,$value)
{ {
// set field value uniqe // set field value unique
$table = $this->getTable(); $table = $this->getTable();
while ($table->load(array($field => $value))) while ($table->load(array($field => $value)))
{ {
$value = JString::increment($value); $value = StringHelper::increment($value);
} }
return $value; return $value;
@ -921,7 +923,7 @@ class ComponentbuilderModelComponent_admin_views extends JModelAdmin
while ($table->load(array('title' => $title))) while ($table->load(array('title' => $title)))
{ {
$title = JString::increment($title); $title = StringHelper::increment($title);
} }
return $title; return $title;

View File

@ -13,6 +13,8 @@
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
use Joomla\Registry\Registry; use Joomla\Registry\Registry;
use Joomla\String\StringHelper;
use Joomla\Utilities\ArrayHelper;
/** /**
* Componentbuilder Component_config Model * Componentbuilder Component_config Model
@ -423,7 +425,7 @@ class ComponentbuilderModelComponent_config extends JModelAdmin
* *
* @since 3.0 * @since 3.0
*/ */
protected function getUniqeFields() protected function getUniqueFields()
{ {
return false; return false;
} }
@ -482,7 +484,7 @@ class ComponentbuilderModelComponent_config extends JModelAdmin
{ {
// Sanitize ids. // Sanitize ids.
$pks = array_unique($pks); $pks = array_unique($pks);
JArrayHelper::toInteger($pks); ArrayHelper::toInteger($pks);
// Remove any values of zero. // Remove any values of zero.
if (array_search(0, $pks, true)) if (array_search(0, $pks, true))
@ -523,7 +525,7 @@ class ComponentbuilderModelComponent_config extends JModelAdmin
if (!empty($commands['move_copy'])) if (!empty($commands['move_copy']))
{ {
$cmd = JArrayHelper::getValue($commands, 'move_copy', 'c'); $cmd = ArrayHelper::getValue($commands, 'move_copy', 'c');
if ($cmd == 'c') if ($cmd == 'c')
{ {
@ -590,8 +592,8 @@ class ComponentbuilderModelComponent_config extends JModelAdmin
return false; return false;
} }
// get list of uniqe fields // get list of unique fields
$uniqeFields = $this->getUniqeFields(); $uniqueFields = $this->getUniqueFields();
// remove move_copy from array // remove move_copy from array
unset($values['move_copy']); unset($values['move_copy']);
@ -642,7 +644,7 @@ class ComponentbuilderModelComponent_config extends JModelAdmin
// Only for strings // Only for strings
if (ComponentbuilderHelper::checkString($this->table->joomla_component) && !is_numeric($this->table->joomla_component)) if (ComponentbuilderHelper::checkString($this->table->joomla_component) && !is_numeric($this->table->joomla_component))
{ {
$this->table->joomla_component = $this->generateUniqe('joomla_component',$this->table->joomla_component); $this->table->joomla_component = $this->generateUnique('joomla_component',$this->table->joomla_component);
} }
// insert all set values // insert all set values
@ -657,12 +659,12 @@ class ComponentbuilderModelComponent_config extends JModelAdmin
} }
} }
// update all uniqe fields // update all unique fields
if (ComponentbuilderHelper::checkArray($uniqeFields)) if (ComponentbuilderHelper::checkArray($uniqueFields))
{ {
foreach ($uniqeFields as $uniqeField) foreach ($uniqueFields as $uniqueField)
{ {
$this->table->$uniqeField = $this->generateUniqe($uniqeField,$this->table->$uniqeField); $this->table->$uniqueField = $this->generateUnique($uniqueField,$this->table->$uniqueField);
} }
} }
@ -859,16 +861,16 @@ class ComponentbuilderModelComponent_config extends JModelAdmin
$data['params'] = (string) $params; $data['params'] = (string) $params;
} }
// Alter the uniqe field for save as copy // Alter the unique field for save as copy
if ($input->get('task') === 'save2copy') if ($input->get('task') === 'save2copy')
{ {
// Automatic handling of other uniqe fields // Automatic handling of other unique fields
$uniqeFields = $this->getUniqeFields(); $uniqueFields = $this->getUniqueFields();
if (ComponentbuilderHelper::checkArray($uniqeFields)) if (ComponentbuilderHelper::checkArray($uniqueFields))
{ {
foreach ($uniqeFields as $uniqeField) foreach ($uniqueFields as $uniqueField)
{ {
$data[$uniqeField] = $this->generateUniqe($uniqeField,$data[$uniqeField]); $data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]);
} }
} }
} }
@ -881,7 +883,7 @@ class ComponentbuilderModelComponent_config extends JModelAdmin
} }
/** /**
* Method to generate a uniqe value. * Method to generate a unique value.
* *
* @param string $field name. * @param string $field name.
* @param string $value data. * @param string $value data.
@ -890,15 +892,15 @@ class ComponentbuilderModelComponent_config extends JModelAdmin
* *
* @since 3.0 * @since 3.0
*/ */
protected function generateUniqe($field,$value) protected function generateUnique($field,$value)
{ {
// set field value uniqe // set field value unique
$table = $this->getTable(); $table = $this->getTable();
while ($table->load(array($field => $value))) while ($table->load(array($field => $value)))
{ {
$value = JString::increment($value); $value = StringHelper::increment($value);
} }
return $value; return $value;
@ -920,7 +922,7 @@ class ComponentbuilderModelComponent_config extends JModelAdmin
while ($table->load(array('title' => $title))) while ($table->load(array('title' => $title)))
{ {
$title = JString::increment($title); $title = StringHelper::increment($title);
} }
return $title; return $title;

View File

@ -13,6 +13,8 @@
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
use Joomla\Registry\Registry; use Joomla\Registry\Registry;
use Joomla\String\StringHelper;
use Joomla\Utilities\ArrayHelper;
/** /**
* Componentbuilder Component_custom_admin_menus Model * Componentbuilder Component_custom_admin_menus Model
@ -423,7 +425,7 @@ class ComponentbuilderModelComponent_custom_admin_menus extends JModelAdmin
* *
* @since 3.0 * @since 3.0
*/ */
protected function getUniqeFields() protected function getUniqueFields()
{ {
return false; return false;
} }
@ -482,7 +484,7 @@ class ComponentbuilderModelComponent_custom_admin_menus extends JModelAdmin
{ {
// Sanitize ids. // Sanitize ids.
$pks = array_unique($pks); $pks = array_unique($pks);
JArrayHelper::toInteger($pks); ArrayHelper::toInteger($pks);
// Remove any values of zero. // Remove any values of zero.
if (array_search(0, $pks, true)) if (array_search(0, $pks, true))
@ -523,7 +525,7 @@ class ComponentbuilderModelComponent_custom_admin_menus extends JModelAdmin
if (!empty($commands['move_copy'])) if (!empty($commands['move_copy']))
{ {
$cmd = JArrayHelper::getValue($commands, 'move_copy', 'c'); $cmd = ArrayHelper::getValue($commands, 'move_copy', 'c');
if ($cmd == 'c') if ($cmd == 'c')
{ {
@ -590,8 +592,8 @@ class ComponentbuilderModelComponent_custom_admin_menus extends JModelAdmin
return false; return false;
} }
// get list of uniqe fields // get list of unique fields
$uniqeFields = $this->getUniqeFields(); $uniqueFields = $this->getUniqueFields();
// remove move_copy from array // remove move_copy from array
unset($values['move_copy']); unset($values['move_copy']);
@ -642,7 +644,7 @@ class ComponentbuilderModelComponent_custom_admin_menus extends JModelAdmin
// Only for strings // Only for strings
if (ComponentbuilderHelper::checkString($this->table->joomla_component) && !is_numeric($this->table->joomla_component)) if (ComponentbuilderHelper::checkString($this->table->joomla_component) && !is_numeric($this->table->joomla_component))
{ {
$this->table->joomla_component = $this->generateUniqe('joomla_component',$this->table->joomla_component); $this->table->joomla_component = $this->generateUnique('joomla_component',$this->table->joomla_component);
} }
// insert all set values // insert all set values
@ -657,12 +659,12 @@ class ComponentbuilderModelComponent_custom_admin_menus extends JModelAdmin
} }
} }
// update all uniqe fields // update all unique fields
if (ComponentbuilderHelper::checkArray($uniqeFields)) if (ComponentbuilderHelper::checkArray($uniqueFields))
{ {
foreach ($uniqeFields as $uniqeField) foreach ($uniqueFields as $uniqueField)
{ {
$this->table->$uniqeField = $this->generateUniqe($uniqeField,$this->table->$uniqeField); $this->table->$uniqueField = $this->generateUnique($uniqueField,$this->table->$uniqueField);
} }
} }
@ -859,16 +861,16 @@ class ComponentbuilderModelComponent_custom_admin_menus extends JModelAdmin
$data['params'] = (string) $params; $data['params'] = (string) $params;
} }
// Alter the uniqe field for save as copy // Alter the unique field for save as copy
if ($input->get('task') === 'save2copy') if ($input->get('task') === 'save2copy')
{ {
// Automatic handling of other uniqe fields // Automatic handling of other unique fields
$uniqeFields = $this->getUniqeFields(); $uniqueFields = $this->getUniqueFields();
if (ComponentbuilderHelper::checkArray($uniqeFields)) if (ComponentbuilderHelper::checkArray($uniqueFields))
{ {
foreach ($uniqeFields as $uniqeField) foreach ($uniqueFields as $uniqueField)
{ {
$data[$uniqeField] = $this->generateUniqe($uniqeField,$data[$uniqeField]); $data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]);
} }
} }
} }
@ -881,7 +883,7 @@ class ComponentbuilderModelComponent_custom_admin_menus extends JModelAdmin
} }
/** /**
* Method to generate a uniqe value. * Method to generate a unique value.
* *
* @param string $field name. * @param string $field name.
* @param string $value data. * @param string $value data.
@ -890,15 +892,15 @@ class ComponentbuilderModelComponent_custom_admin_menus extends JModelAdmin
* *
* @since 3.0 * @since 3.0
*/ */
protected function generateUniqe($field,$value) protected function generateUnique($field,$value)
{ {
// set field value uniqe // set field value unique
$table = $this->getTable(); $table = $this->getTable();
while ($table->load(array($field => $value))) while ($table->load(array($field => $value)))
{ {
$value = JString::increment($value); $value = StringHelper::increment($value);
} }
return $value; return $value;
@ -920,7 +922,7 @@ class ComponentbuilderModelComponent_custom_admin_menus extends JModelAdmin
while ($table->load(array('title' => $title))) while ($table->load(array('title' => $title)))
{ {
$title = JString::increment($title); $title = StringHelper::increment($title);
} }
return $title; return $title;

View File

@ -13,6 +13,8 @@
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
use Joomla\Registry\Registry; use Joomla\Registry\Registry;
use Joomla\String\StringHelper;
use Joomla\Utilities\ArrayHelper;
/** /**
* Componentbuilder Component_custom_admin_views Model * Componentbuilder Component_custom_admin_views Model
@ -424,7 +426,7 @@ class ComponentbuilderModelComponent_custom_admin_views extends JModelAdmin
* *
* @since 3.0 * @since 3.0
*/ */
protected function getUniqeFields() protected function getUniqueFields()
{ {
return false; return false;
} }
@ -483,7 +485,7 @@ class ComponentbuilderModelComponent_custom_admin_views extends JModelAdmin
{ {
// Sanitize ids. // Sanitize ids.
$pks = array_unique($pks); $pks = array_unique($pks);
JArrayHelper::toInteger($pks); ArrayHelper::toInteger($pks);
// Remove any values of zero. // Remove any values of zero.
if (array_search(0, $pks, true)) if (array_search(0, $pks, true))
@ -524,7 +526,7 @@ class ComponentbuilderModelComponent_custom_admin_views extends JModelAdmin
if (!empty($commands['move_copy'])) if (!empty($commands['move_copy']))
{ {
$cmd = JArrayHelper::getValue($commands, 'move_copy', 'c'); $cmd = ArrayHelper::getValue($commands, 'move_copy', 'c');
if ($cmd == 'c') if ($cmd == 'c')
{ {
@ -591,8 +593,8 @@ class ComponentbuilderModelComponent_custom_admin_views extends JModelAdmin
return false; return false;
} }
// get list of uniqe fields // get list of unique fields
$uniqeFields = $this->getUniqeFields(); $uniqueFields = $this->getUniqueFields();
// remove move_copy from array // remove move_copy from array
unset($values['move_copy']); unset($values['move_copy']);
@ -643,7 +645,7 @@ class ComponentbuilderModelComponent_custom_admin_views extends JModelAdmin
// Only for strings // Only for strings
if (ComponentbuilderHelper::checkString($this->table->joomla_component) && !is_numeric($this->table->joomla_component)) if (ComponentbuilderHelper::checkString($this->table->joomla_component) && !is_numeric($this->table->joomla_component))
{ {
$this->table->joomla_component = $this->generateUniqe('joomla_component',$this->table->joomla_component); $this->table->joomla_component = $this->generateUnique('joomla_component',$this->table->joomla_component);
} }
// insert all set values // insert all set values
@ -658,12 +660,12 @@ class ComponentbuilderModelComponent_custom_admin_views extends JModelAdmin
} }
} }
// update all uniqe fields // update all unique fields
if (ComponentbuilderHelper::checkArray($uniqeFields)) if (ComponentbuilderHelper::checkArray($uniqueFields))
{ {
foreach ($uniqeFields as $uniqeField) foreach ($uniqueFields as $uniqueField)
{ {
$this->table->$uniqeField = $this->generateUniqe($uniqeField,$this->table->$uniqeField); $this->table->$uniqueField = $this->generateUnique($uniqueField,$this->table->$uniqueField);
} }
} }
@ -860,16 +862,16 @@ class ComponentbuilderModelComponent_custom_admin_views extends JModelAdmin
$data['params'] = (string) $params; $data['params'] = (string) $params;
} }
// Alter the uniqe field for save as copy // Alter the unique field for save as copy
if ($input->get('task') === 'save2copy') if ($input->get('task') === 'save2copy')
{ {
// Automatic handling of other uniqe fields // Automatic handling of other unique fields
$uniqeFields = $this->getUniqeFields(); $uniqueFields = $this->getUniqueFields();
if (ComponentbuilderHelper::checkArray($uniqeFields)) if (ComponentbuilderHelper::checkArray($uniqueFields))
{ {
foreach ($uniqeFields as $uniqeField) foreach ($uniqueFields as $uniqueField)
{ {
$data[$uniqeField] = $this->generateUniqe($uniqeField,$data[$uniqeField]); $data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]);
} }
} }
} }
@ -882,7 +884,7 @@ class ComponentbuilderModelComponent_custom_admin_views extends JModelAdmin
} }
/** /**
* Method to generate a uniqe value. * Method to generate a unique value.
* *
* @param string $field name. * @param string $field name.
* @param string $value data. * @param string $value data.
@ -891,15 +893,15 @@ class ComponentbuilderModelComponent_custom_admin_views extends JModelAdmin
* *
* @since 3.0 * @since 3.0
*/ */
protected function generateUniqe($field,$value) protected function generateUnique($field,$value)
{ {
// set field value uniqe // set field value unique
$table = $this->getTable(); $table = $this->getTable();
while ($table->load(array($field => $value))) while ($table->load(array($field => $value)))
{ {
$value = JString::increment($value); $value = StringHelper::increment($value);
} }
return $value; return $value;
@ -921,7 +923,7 @@ class ComponentbuilderModelComponent_custom_admin_views extends JModelAdmin
while ($table->load(array('title' => $title))) while ($table->load(array('title' => $title)))
{ {
$title = JString::increment($title); $title = StringHelper::increment($title);
} }
return $title; return $title;

View File

@ -13,6 +13,8 @@
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
use Joomla\Registry\Registry; use Joomla\Registry\Registry;
use Joomla\String\StringHelper;
use Joomla\Utilities\ArrayHelper;
/** /**
* Componentbuilder Component_dashboard Model * Componentbuilder Component_dashboard Model
@ -512,7 +514,7 @@ class ComponentbuilderModelComponent_dashboard extends JModelAdmin
* *
* @since 3.0 * @since 3.0
*/ */
protected function getUniqeFields() protected function getUniqueFields()
{ {
return false; return false;
} }
@ -571,7 +573,7 @@ class ComponentbuilderModelComponent_dashboard extends JModelAdmin
{ {
// Sanitize ids. // Sanitize ids.
$pks = array_unique($pks); $pks = array_unique($pks);
JArrayHelper::toInteger($pks); ArrayHelper::toInteger($pks);
// Remove any values of zero. // Remove any values of zero.
if (array_search(0, $pks, true)) if (array_search(0, $pks, true))
@ -612,7 +614,7 @@ class ComponentbuilderModelComponent_dashboard extends JModelAdmin
if (!empty($commands['move_copy'])) if (!empty($commands['move_copy']))
{ {
$cmd = JArrayHelper::getValue($commands, 'move_copy', 'c'); $cmd = ArrayHelper::getValue($commands, 'move_copy', 'c');
if ($cmd == 'c') if ($cmd == 'c')
{ {
@ -679,8 +681,8 @@ class ComponentbuilderModelComponent_dashboard extends JModelAdmin
return false; return false;
} }
// get list of uniqe fields // get list of unique fields
$uniqeFields = $this->getUniqeFields(); $uniqueFields = $this->getUniqueFields();
// remove move_copy from array // remove move_copy from array
unset($values['move_copy']); unset($values['move_copy']);
@ -731,7 +733,7 @@ class ComponentbuilderModelComponent_dashboard extends JModelAdmin
// Only for strings // Only for strings
if (ComponentbuilderHelper::checkString($this->table->joomla_component) && !is_numeric($this->table->joomla_component)) if (ComponentbuilderHelper::checkString($this->table->joomla_component) && !is_numeric($this->table->joomla_component))
{ {
$this->table->joomla_component = $this->generateUniqe('joomla_component',$this->table->joomla_component); $this->table->joomla_component = $this->generateUnique('joomla_component',$this->table->joomla_component);
} }
// insert all set values // insert all set values
@ -746,12 +748,12 @@ class ComponentbuilderModelComponent_dashboard extends JModelAdmin
} }
} }
// update all uniqe fields // update all unique fields
if (ComponentbuilderHelper::checkArray($uniqeFields)) if (ComponentbuilderHelper::checkArray($uniqueFields))
{ {
foreach ($uniqeFields as $uniqeField) foreach ($uniqueFields as $uniqueField)
{ {
$this->table->$uniqeField = $this->generateUniqe($uniqeField,$this->table->$uniqeField); $this->table->$uniqueField = $this->generateUnique($uniqueField,$this->table->$uniqueField);
} }
} }
@ -954,16 +956,16 @@ class ComponentbuilderModelComponent_dashboard extends JModelAdmin
$data['params'] = (string) $params; $data['params'] = (string) $params;
} }
// Alter the uniqe field for save as copy // Alter the unique field for save as copy
if ($input->get('task') === 'save2copy') if ($input->get('task') === 'save2copy')
{ {
// Automatic handling of other uniqe fields // Automatic handling of other unique fields
$uniqeFields = $this->getUniqeFields(); $uniqueFields = $this->getUniqueFields();
if (ComponentbuilderHelper::checkArray($uniqeFields)) if (ComponentbuilderHelper::checkArray($uniqueFields))
{ {
foreach ($uniqeFields as $uniqeField) foreach ($uniqueFields as $uniqueField)
{ {
$data[$uniqeField] = $this->generateUniqe($uniqeField,$data[$uniqeField]); $data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]);
} }
} }
} }
@ -976,7 +978,7 @@ class ComponentbuilderModelComponent_dashboard extends JModelAdmin
} }
/** /**
* Method to generate a uniqe value. * Method to generate a unique value.
* *
* @param string $field name. * @param string $field name.
* @param string $value data. * @param string $value data.
@ -985,15 +987,15 @@ class ComponentbuilderModelComponent_dashboard extends JModelAdmin
* *
* @since 3.0 * @since 3.0
*/ */
protected function generateUniqe($field,$value) protected function generateUnique($field,$value)
{ {
// set field value uniqe // set field value unique
$table = $this->getTable(); $table = $this->getTable();
while ($table->load(array($field => $value))) while ($table->load(array($field => $value)))
{ {
$value = JString::increment($value); $value = StringHelper::increment($value);
} }
return $value; return $value;
@ -1015,7 +1017,7 @@ class ComponentbuilderModelComponent_dashboard extends JModelAdmin
while ($table->load(array('title' => $title))) while ($table->load(array('title' => $title)))
{ {
$title = JString::increment($title); $title = StringHelper::increment($title);
} }
return $title; return $title;

View File

@ -13,6 +13,8 @@
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
use Joomla\Registry\Registry; use Joomla\Registry\Registry;
use Joomla\String\StringHelper;
use Joomla\Utilities\ArrayHelper;
/** /**
* Componentbuilder Component_files_folders Model * Componentbuilder Component_files_folders Model
@ -460,7 +462,7 @@ class ComponentbuilderModelComponent_files_folders extends JModelAdmin
* *
* @since 3.0 * @since 3.0
*/ */
protected function getUniqeFields() protected function getUniqueFields()
{ {
return false; return false;
} }
@ -519,7 +521,7 @@ class ComponentbuilderModelComponent_files_folders extends JModelAdmin
{ {
// Sanitize ids. // Sanitize ids.
$pks = array_unique($pks); $pks = array_unique($pks);
JArrayHelper::toInteger($pks); ArrayHelper::toInteger($pks);
// Remove any values of zero. // Remove any values of zero.
if (array_search(0, $pks, true)) if (array_search(0, $pks, true))
@ -560,7 +562,7 @@ class ComponentbuilderModelComponent_files_folders extends JModelAdmin
if (!empty($commands['move_copy'])) if (!empty($commands['move_copy']))
{ {
$cmd = JArrayHelper::getValue($commands, 'move_copy', 'c'); $cmd = ArrayHelper::getValue($commands, 'move_copy', 'c');
if ($cmd == 'c') if ($cmd == 'c')
{ {
@ -627,8 +629,8 @@ class ComponentbuilderModelComponent_files_folders extends JModelAdmin
return false; return false;
} }
// get list of uniqe fields // get list of unique fields
$uniqeFields = $this->getUniqeFields(); $uniqueFields = $this->getUniqueFields();
// remove move_copy from array // remove move_copy from array
unset($values['move_copy']); unset($values['move_copy']);
@ -679,7 +681,7 @@ class ComponentbuilderModelComponent_files_folders extends JModelAdmin
// Only for strings // Only for strings
if (ComponentbuilderHelper::checkString($this->table->joomla_component) && !is_numeric($this->table->joomla_component)) if (ComponentbuilderHelper::checkString($this->table->joomla_component) && !is_numeric($this->table->joomla_component))
{ {
$this->table->joomla_component = $this->generateUniqe('joomla_component',$this->table->joomla_component); $this->table->joomla_component = $this->generateUnique('joomla_component',$this->table->joomla_component);
} }
// insert all set values // insert all set values
@ -694,12 +696,12 @@ class ComponentbuilderModelComponent_files_folders extends JModelAdmin
} }
} }
// update all uniqe fields // update all unique fields
if (ComponentbuilderHelper::checkArray($uniqeFields)) if (ComponentbuilderHelper::checkArray($uniqueFields))
{ {
foreach ($uniqeFields as $uniqeField) foreach ($uniqueFields as $uniqueField)
{ {
$this->table->$uniqeField = $this->generateUniqe($uniqeField,$this->table->$uniqeField); $this->table->$uniqueField = $this->generateUnique($uniqueField,$this->table->$uniqueField);
} }
} }
@ -935,16 +937,16 @@ class ComponentbuilderModelComponent_files_folders extends JModelAdmin
$data['params'] = (string) $params; $data['params'] = (string) $params;
} }
// Alter the uniqe field for save as copy // Alter the unique field for save as copy
if ($input->get('task') === 'save2copy') if ($input->get('task') === 'save2copy')
{ {
// Automatic handling of other uniqe fields // Automatic handling of other unique fields
$uniqeFields = $this->getUniqeFields(); $uniqueFields = $this->getUniqueFields();
if (ComponentbuilderHelper::checkArray($uniqeFields)) if (ComponentbuilderHelper::checkArray($uniqueFields))
{ {
foreach ($uniqeFields as $uniqeField) foreach ($uniqueFields as $uniqueField)
{ {
$data[$uniqeField] = $this->generateUniqe($uniqeField,$data[$uniqeField]); $data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]);
} }
} }
} }
@ -957,7 +959,7 @@ class ComponentbuilderModelComponent_files_folders extends JModelAdmin
} }
/** /**
* Method to generate a uniqe value. * Method to generate a unique value.
* *
* @param string $field name. * @param string $field name.
* @param string $value data. * @param string $value data.
@ -966,15 +968,15 @@ class ComponentbuilderModelComponent_files_folders extends JModelAdmin
* *
* @since 3.0 * @since 3.0
*/ */
protected function generateUniqe($field,$value) protected function generateUnique($field,$value)
{ {
// set field value uniqe // set field value unique
$table = $this->getTable(); $table = $this->getTable();
while ($table->load(array($field => $value))) while ($table->load(array($field => $value)))
{ {
$value = JString::increment($value); $value = StringHelper::increment($value);
} }
return $value; return $value;
@ -996,7 +998,7 @@ class ComponentbuilderModelComponent_files_folders extends JModelAdmin
while ($table->load(array('title' => $title))) while ($table->load(array('title' => $title)))
{ {
$title = JString::increment($title); $title = StringHelper::increment($title);
} }
return $title; return $title;

View File

@ -13,6 +13,8 @@
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
use Joomla\Registry\Registry; use Joomla\Registry\Registry;
use Joomla\String\StringHelper;
use Joomla\Utilities\ArrayHelper;
/** /**
* Componentbuilder Component_modules Model * Componentbuilder Component_modules Model
@ -393,7 +395,7 @@ class ComponentbuilderModelComponent_modules extends JModelAdmin
* *
* @since 3.0 * @since 3.0
*/ */
protected function getUniqeFields() protected function getUniqueFields()
{ {
return false; return false;
} }
@ -452,7 +454,7 @@ class ComponentbuilderModelComponent_modules extends JModelAdmin
{ {
// Sanitize ids. // Sanitize ids.
$pks = array_unique($pks); $pks = array_unique($pks);
JArrayHelper::toInteger($pks); ArrayHelper::toInteger($pks);
// Remove any values of zero. // Remove any values of zero.
if (array_search(0, $pks, true)) if (array_search(0, $pks, true))
@ -493,7 +495,7 @@ class ComponentbuilderModelComponent_modules extends JModelAdmin
if (!empty($commands['move_copy'])) if (!empty($commands['move_copy']))
{ {
$cmd = JArrayHelper::getValue($commands, 'move_copy', 'c'); $cmd = ArrayHelper::getValue($commands, 'move_copy', 'c');
if ($cmd == 'c') if ($cmd == 'c')
{ {
@ -560,8 +562,8 @@ class ComponentbuilderModelComponent_modules extends JModelAdmin
return false; return false;
} }
// get list of uniqe fields // get list of unique fields
$uniqeFields = $this->getUniqeFields(); $uniqueFields = $this->getUniqueFields();
// remove move_copy from array // remove move_copy from array
unset($values['move_copy']); unset($values['move_copy']);
@ -612,7 +614,7 @@ class ComponentbuilderModelComponent_modules extends JModelAdmin
// Only for strings // Only for strings
if (ComponentbuilderHelper::checkString($this->table->joomla_component) && !is_numeric($this->table->joomla_component)) if (ComponentbuilderHelper::checkString($this->table->joomla_component) && !is_numeric($this->table->joomla_component))
{ {
$this->table->joomla_component = $this->generateUniqe('joomla_component',$this->table->joomla_component); $this->table->joomla_component = $this->generateUnique('joomla_component',$this->table->joomla_component);
} }
// insert all set values // insert all set values
@ -627,12 +629,12 @@ class ComponentbuilderModelComponent_modules extends JModelAdmin
} }
} }
// update all uniqe fields // update all unique fields
if (ComponentbuilderHelper::checkArray($uniqeFields)) if (ComponentbuilderHelper::checkArray($uniqueFields))
{ {
foreach ($uniqeFields as $uniqeField) foreach ($uniqueFields as $uniqueField)
{ {
$this->table->$uniqeField = $this->generateUniqe($uniqeField,$this->table->$uniqeField); $this->table->$uniqueField = $this->generateUnique($uniqueField,$this->table->$uniqueField);
} }
} }
@ -829,16 +831,16 @@ class ComponentbuilderModelComponent_modules extends JModelAdmin
$data['params'] = (string) $params; $data['params'] = (string) $params;
} }
// Alter the uniqe field for save as copy // Alter the unique field for save as copy
if ($input->get('task') === 'save2copy') if ($input->get('task') === 'save2copy')
{ {
// Automatic handling of other uniqe fields // Automatic handling of other unique fields
$uniqeFields = $this->getUniqeFields(); $uniqueFields = $this->getUniqueFields();
if (ComponentbuilderHelper::checkArray($uniqeFields)) if (ComponentbuilderHelper::checkArray($uniqueFields))
{ {
foreach ($uniqeFields as $uniqeField) foreach ($uniqueFields as $uniqueField)
{ {
$data[$uniqeField] = $this->generateUniqe($uniqeField,$data[$uniqeField]); $data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]);
} }
} }
} }
@ -851,7 +853,7 @@ class ComponentbuilderModelComponent_modules extends JModelAdmin
} }
/** /**
* Method to generate a uniqe value. * Method to generate a unique value.
* *
* @param string $field name. * @param string $field name.
* @param string $value data. * @param string $value data.
@ -860,15 +862,15 @@ class ComponentbuilderModelComponent_modules extends JModelAdmin
* *
* @since 3.0 * @since 3.0
*/ */
protected function generateUniqe($field,$value) protected function generateUnique($field,$value)
{ {
// set field value uniqe // set field value unique
$table = $this->getTable(); $table = $this->getTable();
while ($table->load(array($field => $value))) while ($table->load(array($field => $value)))
{ {
$value = JString::increment($value); $value = StringHelper::increment($value);
} }
return $value; return $value;
@ -890,7 +892,7 @@ class ComponentbuilderModelComponent_modules extends JModelAdmin
while ($table->load(array('title' => $title))) while ($table->load(array('title' => $title)))
{ {
$title = JString::increment($title); $title = StringHelper::increment($title);
} }
return $title; return $title;

View File

@ -13,6 +13,8 @@
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
use Joomla\Registry\Registry; use Joomla\Registry\Registry;
use Joomla\String\StringHelper;
use Joomla\Utilities\ArrayHelper;
/** /**
* Componentbuilder Component_mysql_tweaks Model * Componentbuilder Component_mysql_tweaks Model
@ -423,7 +425,7 @@ class ComponentbuilderModelComponent_mysql_tweaks extends JModelAdmin
* *
* @since 3.0 * @since 3.0
*/ */
protected function getUniqeFields() protected function getUniqueFields()
{ {
return false; return false;
} }
@ -482,7 +484,7 @@ class ComponentbuilderModelComponent_mysql_tweaks extends JModelAdmin
{ {
// Sanitize ids. // Sanitize ids.
$pks = array_unique($pks); $pks = array_unique($pks);
JArrayHelper::toInteger($pks); ArrayHelper::toInteger($pks);
// Remove any values of zero. // Remove any values of zero.
if (array_search(0, $pks, true)) if (array_search(0, $pks, true))
@ -523,7 +525,7 @@ class ComponentbuilderModelComponent_mysql_tweaks extends JModelAdmin
if (!empty($commands['move_copy'])) if (!empty($commands['move_copy']))
{ {
$cmd = JArrayHelper::getValue($commands, 'move_copy', 'c'); $cmd = ArrayHelper::getValue($commands, 'move_copy', 'c');
if ($cmd == 'c') if ($cmd == 'c')
{ {
@ -590,8 +592,8 @@ class ComponentbuilderModelComponent_mysql_tweaks extends JModelAdmin
return false; return false;
} }
// get list of uniqe fields // get list of unique fields
$uniqeFields = $this->getUniqeFields(); $uniqueFields = $this->getUniqueFields();
// remove move_copy from array // remove move_copy from array
unset($values['move_copy']); unset($values['move_copy']);
@ -642,7 +644,7 @@ class ComponentbuilderModelComponent_mysql_tweaks extends JModelAdmin
// Only for strings // Only for strings
if (ComponentbuilderHelper::checkString($this->table->joomla_component) && !is_numeric($this->table->joomla_component)) if (ComponentbuilderHelper::checkString($this->table->joomla_component) && !is_numeric($this->table->joomla_component))
{ {
$this->table->joomla_component = $this->generateUniqe('joomla_component',$this->table->joomla_component); $this->table->joomla_component = $this->generateUnique('joomla_component',$this->table->joomla_component);
} }
// insert all set values // insert all set values
@ -657,12 +659,12 @@ class ComponentbuilderModelComponent_mysql_tweaks extends JModelAdmin
} }
} }
// update all uniqe fields // update all unique fields
if (ComponentbuilderHelper::checkArray($uniqeFields)) if (ComponentbuilderHelper::checkArray($uniqueFields))
{ {
foreach ($uniqeFields as $uniqeField) foreach ($uniqueFields as $uniqueField)
{ {
$this->table->$uniqeField = $this->generateUniqe($uniqeField,$this->table->$uniqeField); $this->table->$uniqueField = $this->generateUnique($uniqueField,$this->table->$uniqueField);
} }
} }
@ -859,16 +861,16 @@ class ComponentbuilderModelComponent_mysql_tweaks extends JModelAdmin
$data['params'] = (string) $params; $data['params'] = (string) $params;
} }
// Alter the uniqe field for save as copy // Alter the unique field for save as copy
if ($input->get('task') === 'save2copy') if ($input->get('task') === 'save2copy')
{ {
// Automatic handling of other uniqe fields // Automatic handling of other unique fields
$uniqeFields = $this->getUniqeFields(); $uniqueFields = $this->getUniqueFields();
if (ComponentbuilderHelper::checkArray($uniqeFields)) if (ComponentbuilderHelper::checkArray($uniqueFields))
{ {
foreach ($uniqeFields as $uniqeField) foreach ($uniqueFields as $uniqueField)
{ {
$data[$uniqeField] = $this->generateUniqe($uniqeField,$data[$uniqeField]); $data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]);
} }
} }
} }
@ -881,7 +883,7 @@ class ComponentbuilderModelComponent_mysql_tweaks extends JModelAdmin
} }
/** /**
* Method to generate a uniqe value. * Method to generate a unique value.
* *
* @param string $field name. * @param string $field name.
* @param string $value data. * @param string $value data.
@ -890,15 +892,15 @@ class ComponentbuilderModelComponent_mysql_tweaks extends JModelAdmin
* *
* @since 3.0 * @since 3.0
*/ */
protected function generateUniqe($field,$value) protected function generateUnique($field,$value)
{ {
// set field value uniqe // set field value unique
$table = $this->getTable(); $table = $this->getTable();
while ($table->load(array($field => $value))) while ($table->load(array($field => $value)))
{ {
$value = JString::increment($value); $value = StringHelper::increment($value);
} }
return $value; return $value;
@ -920,7 +922,7 @@ class ComponentbuilderModelComponent_mysql_tweaks extends JModelAdmin
while ($table->load(array('title' => $title))) while ($table->load(array('title' => $title)))
{ {
$title = JString::increment($title); $title = StringHelper::increment($title);
} }
return $title; return $title;

View File

@ -13,6 +13,8 @@
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
use Joomla\Registry\Registry; use Joomla\Registry\Registry;
use Joomla\String\StringHelper;
use Joomla\Utilities\ArrayHelper;
/** /**
* Componentbuilder Component_placeholders Model * Componentbuilder Component_placeholders Model
@ -392,7 +394,7 @@ class ComponentbuilderModelComponent_placeholders extends JModelAdmin
* *
* @since 3.0 * @since 3.0
*/ */
protected function getUniqeFields() protected function getUniqueFields()
{ {
return false; return false;
} }
@ -451,7 +453,7 @@ class ComponentbuilderModelComponent_placeholders extends JModelAdmin
{ {
// Sanitize ids. // Sanitize ids.
$pks = array_unique($pks); $pks = array_unique($pks);
JArrayHelper::toInteger($pks); ArrayHelper::toInteger($pks);
// Remove any values of zero. // Remove any values of zero.
if (array_search(0, $pks, true)) if (array_search(0, $pks, true))
@ -492,7 +494,7 @@ class ComponentbuilderModelComponent_placeholders extends JModelAdmin
if (!empty($commands['move_copy'])) if (!empty($commands['move_copy']))
{ {
$cmd = JArrayHelper::getValue($commands, 'move_copy', 'c'); $cmd = ArrayHelper::getValue($commands, 'move_copy', 'c');
if ($cmd == 'c') if ($cmd == 'c')
{ {
@ -559,8 +561,8 @@ class ComponentbuilderModelComponent_placeholders extends JModelAdmin
return false; return false;
} }
// get list of uniqe fields // get list of unique fields
$uniqeFields = $this->getUniqeFields(); $uniqueFields = $this->getUniqueFields();
// remove move_copy from array // remove move_copy from array
unset($values['move_copy']); unset($values['move_copy']);
@ -611,7 +613,7 @@ class ComponentbuilderModelComponent_placeholders extends JModelAdmin
// Only for strings // Only for strings
if (ComponentbuilderHelper::checkString($this->table->joomla_component) && !is_numeric($this->table->joomla_component)) if (ComponentbuilderHelper::checkString($this->table->joomla_component) && !is_numeric($this->table->joomla_component))
{ {
$this->table->joomla_component = $this->generateUniqe('joomla_component',$this->table->joomla_component); $this->table->joomla_component = $this->generateUnique('joomla_component',$this->table->joomla_component);
} }
// insert all set values // insert all set values
@ -626,12 +628,12 @@ class ComponentbuilderModelComponent_placeholders extends JModelAdmin
} }
} }
// update all uniqe fields // update all unique fields
if (ComponentbuilderHelper::checkArray($uniqeFields)) if (ComponentbuilderHelper::checkArray($uniqueFields))
{ {
foreach ($uniqeFields as $uniqeField) foreach ($uniqueFields as $uniqueField)
{ {
$this->table->$uniqeField = $this->generateUniqe($uniqeField,$this->table->$uniqeField); $this->table->$uniqueField = $this->generateUnique($uniqueField,$this->table->$uniqueField);
} }
} }
@ -828,16 +830,16 @@ class ComponentbuilderModelComponent_placeholders extends JModelAdmin
$data['params'] = (string) $params; $data['params'] = (string) $params;
} }
// Alter the uniqe field for save as copy // Alter the unique field for save as copy
if ($input->get('task') === 'save2copy') if ($input->get('task') === 'save2copy')
{ {
// Automatic handling of other uniqe fields // Automatic handling of other unique fields
$uniqeFields = $this->getUniqeFields(); $uniqueFields = $this->getUniqueFields();
if (ComponentbuilderHelper::checkArray($uniqeFields)) if (ComponentbuilderHelper::checkArray($uniqueFields))
{ {
foreach ($uniqeFields as $uniqeField) foreach ($uniqueFields as $uniqueField)
{ {
$data[$uniqeField] = $this->generateUniqe($uniqeField,$data[$uniqeField]); $data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]);
} }
} }
} }
@ -850,7 +852,7 @@ class ComponentbuilderModelComponent_placeholders extends JModelAdmin
} }
/** /**
* Method to generate a uniqe value. * Method to generate a unique value.
* *
* @param string $field name. * @param string $field name.
* @param string $value data. * @param string $value data.
@ -859,15 +861,15 @@ class ComponentbuilderModelComponent_placeholders extends JModelAdmin
* *
* @since 3.0 * @since 3.0
*/ */
protected function generateUniqe($field,$value) protected function generateUnique($field,$value)
{ {
// set field value uniqe // set field value unique
$table = $this->getTable(); $table = $this->getTable();
while ($table->load(array($field => $value))) while ($table->load(array($field => $value)))
{ {
$value = JString::increment($value); $value = StringHelper::increment($value);
} }
return $value; return $value;
@ -889,7 +891,7 @@ class ComponentbuilderModelComponent_placeholders extends JModelAdmin
while ($table->load(array('title' => $title))) while ($table->load(array('title' => $title)))
{ {
$title = JString::increment($title); $title = StringHelper::increment($title);
} }
return $title; return $title;

View File

@ -13,6 +13,8 @@
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
use Joomla\Registry\Registry; use Joomla\Registry\Registry;
use Joomla\String\StringHelper;
use Joomla\Utilities\ArrayHelper;
/** /**
* Componentbuilder Component_plugins Model * Componentbuilder Component_plugins Model
@ -393,7 +395,7 @@ class ComponentbuilderModelComponent_plugins extends JModelAdmin
* *
* @since 3.0 * @since 3.0
*/ */
protected function getUniqeFields() protected function getUniqueFields()
{ {
return false; return false;
} }
@ -452,7 +454,7 @@ class ComponentbuilderModelComponent_plugins extends JModelAdmin
{ {
// Sanitize ids. // Sanitize ids.
$pks = array_unique($pks); $pks = array_unique($pks);
JArrayHelper::toInteger($pks); ArrayHelper::toInteger($pks);
// Remove any values of zero. // Remove any values of zero.
if (array_search(0, $pks, true)) if (array_search(0, $pks, true))
@ -493,7 +495,7 @@ class ComponentbuilderModelComponent_plugins extends JModelAdmin
if (!empty($commands['move_copy'])) if (!empty($commands['move_copy']))
{ {
$cmd = JArrayHelper::getValue($commands, 'move_copy', 'c'); $cmd = ArrayHelper::getValue($commands, 'move_copy', 'c');
if ($cmd == 'c') if ($cmd == 'c')
{ {
@ -560,8 +562,8 @@ class ComponentbuilderModelComponent_plugins extends JModelAdmin
return false; return false;
} }
// get list of uniqe fields // get list of unique fields
$uniqeFields = $this->getUniqeFields(); $uniqueFields = $this->getUniqueFields();
// remove move_copy from array // remove move_copy from array
unset($values['move_copy']); unset($values['move_copy']);
@ -612,7 +614,7 @@ class ComponentbuilderModelComponent_plugins extends JModelAdmin
// Only for strings // Only for strings
if (ComponentbuilderHelper::checkString($this->table->joomla_component) && !is_numeric($this->table->joomla_component)) if (ComponentbuilderHelper::checkString($this->table->joomla_component) && !is_numeric($this->table->joomla_component))
{ {
$this->table->joomla_component = $this->generateUniqe('joomla_component',$this->table->joomla_component); $this->table->joomla_component = $this->generateUnique('joomla_component',$this->table->joomla_component);
} }
// insert all set values // insert all set values
@ -627,12 +629,12 @@ class ComponentbuilderModelComponent_plugins extends JModelAdmin
} }
} }
// update all uniqe fields // update all unique fields
if (ComponentbuilderHelper::checkArray($uniqeFields)) if (ComponentbuilderHelper::checkArray($uniqueFields))
{ {
foreach ($uniqeFields as $uniqeField) foreach ($uniqueFields as $uniqueField)
{ {
$this->table->$uniqeField = $this->generateUniqe($uniqeField,$this->table->$uniqeField); $this->table->$uniqueField = $this->generateUnique($uniqueField,$this->table->$uniqueField);
} }
} }
@ -829,16 +831,16 @@ class ComponentbuilderModelComponent_plugins extends JModelAdmin
$data['params'] = (string) $params; $data['params'] = (string) $params;
} }
// Alter the uniqe field for save as copy // Alter the unique field for save as copy
if ($input->get('task') === 'save2copy') if ($input->get('task') === 'save2copy')
{ {
// Automatic handling of other uniqe fields // Automatic handling of other unique fields
$uniqeFields = $this->getUniqeFields(); $uniqueFields = $this->getUniqueFields();
if (ComponentbuilderHelper::checkArray($uniqeFields)) if (ComponentbuilderHelper::checkArray($uniqueFields))
{ {
foreach ($uniqeFields as $uniqeField) foreach ($uniqueFields as $uniqueField)
{ {
$data[$uniqeField] = $this->generateUniqe($uniqeField,$data[$uniqeField]); $data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]);
} }
} }
} }
@ -851,7 +853,7 @@ class ComponentbuilderModelComponent_plugins extends JModelAdmin
} }
/** /**
* Method to generate a uniqe value. * Method to generate a unique value.
* *
* @param string $field name. * @param string $field name.
* @param string $value data. * @param string $value data.
@ -860,15 +862,15 @@ class ComponentbuilderModelComponent_plugins extends JModelAdmin
* *
* @since 3.0 * @since 3.0
*/ */
protected function generateUniqe($field,$value) protected function generateUnique($field,$value)
{ {
// set field value uniqe // set field value unique
$table = $this->getTable(); $table = $this->getTable();
while ($table->load(array($field => $value))) while ($table->load(array($field => $value)))
{ {
$value = JString::increment($value); $value = StringHelper::increment($value);
} }
return $value; return $value;
@ -890,7 +892,7 @@ class ComponentbuilderModelComponent_plugins extends JModelAdmin
while ($table->load(array('title' => $title))) while ($table->load(array('title' => $title)))
{ {
$title = JString::increment($title); $title = StringHelper::increment($title);
} }
return $title; return $title;

View File

@ -13,6 +13,8 @@
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
use Joomla\Registry\Registry; use Joomla\Registry\Registry;
use Joomla\String\StringHelper;
use Joomla\Utilities\ArrayHelper;
/** /**
* Componentbuilder Component_site_views Model * Componentbuilder Component_site_views Model
@ -424,7 +426,7 @@ class ComponentbuilderModelComponent_site_views extends JModelAdmin
* *
* @since 3.0 * @since 3.0
*/ */
protected function getUniqeFields() protected function getUniqueFields()
{ {
return false; return false;
} }
@ -483,7 +485,7 @@ class ComponentbuilderModelComponent_site_views extends JModelAdmin
{ {
// Sanitize ids. // Sanitize ids.
$pks = array_unique($pks); $pks = array_unique($pks);
JArrayHelper::toInteger($pks); ArrayHelper::toInteger($pks);
// Remove any values of zero. // Remove any values of zero.
if (array_search(0, $pks, true)) if (array_search(0, $pks, true))
@ -524,7 +526,7 @@ class ComponentbuilderModelComponent_site_views extends JModelAdmin
if (!empty($commands['move_copy'])) if (!empty($commands['move_copy']))
{ {
$cmd = JArrayHelper::getValue($commands, 'move_copy', 'c'); $cmd = ArrayHelper::getValue($commands, 'move_copy', 'c');
if ($cmd == 'c') if ($cmd == 'c')
{ {
@ -591,8 +593,8 @@ class ComponentbuilderModelComponent_site_views extends JModelAdmin
return false; return false;
} }
// get list of uniqe fields // get list of unique fields
$uniqeFields = $this->getUniqeFields(); $uniqueFields = $this->getUniqueFields();
// remove move_copy from array // remove move_copy from array
unset($values['move_copy']); unset($values['move_copy']);
@ -643,7 +645,7 @@ class ComponentbuilderModelComponent_site_views extends JModelAdmin
// Only for strings // Only for strings
if (ComponentbuilderHelper::checkString($this->table->joomla_component) && !is_numeric($this->table->joomla_component)) if (ComponentbuilderHelper::checkString($this->table->joomla_component) && !is_numeric($this->table->joomla_component))
{ {
$this->table->joomla_component = $this->generateUniqe('joomla_component',$this->table->joomla_component); $this->table->joomla_component = $this->generateUnique('joomla_component',$this->table->joomla_component);
} }
// insert all set values // insert all set values
@ -658,12 +660,12 @@ class ComponentbuilderModelComponent_site_views extends JModelAdmin
} }
} }
// update all uniqe fields // update all unique fields
if (ComponentbuilderHelper::checkArray($uniqeFields)) if (ComponentbuilderHelper::checkArray($uniqueFields))
{ {
foreach ($uniqeFields as $uniqeField) foreach ($uniqueFields as $uniqueField)
{ {
$this->table->$uniqeField = $this->generateUniqe($uniqeField,$this->table->$uniqeField); $this->table->$uniqueField = $this->generateUnique($uniqueField,$this->table->$uniqueField);
} }
} }
@ -860,16 +862,16 @@ class ComponentbuilderModelComponent_site_views extends JModelAdmin
$data['params'] = (string) $params; $data['params'] = (string) $params;
} }
// Alter the uniqe field for save as copy // Alter the unique field for save as copy
if ($input->get('task') === 'save2copy') if ($input->get('task') === 'save2copy')
{ {
// Automatic handling of other uniqe fields // Automatic handling of other unique fields
$uniqeFields = $this->getUniqeFields(); $uniqueFields = $this->getUniqueFields();
if (ComponentbuilderHelper::checkArray($uniqeFields)) if (ComponentbuilderHelper::checkArray($uniqueFields))
{ {
foreach ($uniqeFields as $uniqeField) foreach ($uniqueFields as $uniqueField)
{ {
$data[$uniqeField] = $this->generateUniqe($uniqeField,$data[$uniqeField]); $data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]);
} }
} }
} }
@ -882,7 +884,7 @@ class ComponentbuilderModelComponent_site_views extends JModelAdmin
} }
/** /**
* Method to generate a uniqe value. * Method to generate a unique value.
* *
* @param string $field name. * @param string $field name.
* @param string $value data. * @param string $value data.
@ -891,15 +893,15 @@ class ComponentbuilderModelComponent_site_views extends JModelAdmin
* *
* @since 3.0 * @since 3.0
*/ */
protected function generateUniqe($field,$value) protected function generateUnique($field,$value)
{ {
// set field value uniqe // set field value unique
$table = $this->getTable(); $table = $this->getTable();
while ($table->load(array($field => $value))) while ($table->load(array($field => $value)))
{ {
$value = JString::increment($value); $value = StringHelper::increment($value);
} }
return $value; return $value;
@ -921,7 +923,7 @@ class ComponentbuilderModelComponent_site_views extends JModelAdmin
while ($table->load(array('title' => $title))) while ($table->load(array('title' => $title)))
{ {
$title = JString::increment($title); $title = StringHelper::increment($title);
} }
return $title; return $title;

View File

@ -13,6 +13,8 @@
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
use Joomla\Registry\Registry; use Joomla\Registry\Registry;
use Joomla\String\StringHelper;
use Joomla\Utilities\ArrayHelper;
/** /**
* Componentbuilder Component_updates Model * Componentbuilder Component_updates Model
@ -423,7 +425,7 @@ class ComponentbuilderModelComponent_updates extends JModelAdmin
* *
* @since 3.0 * @since 3.0
*/ */
protected function getUniqeFields() protected function getUniqueFields()
{ {
return false; return false;
} }
@ -482,7 +484,7 @@ class ComponentbuilderModelComponent_updates extends JModelAdmin
{ {
// Sanitize ids. // Sanitize ids.
$pks = array_unique($pks); $pks = array_unique($pks);
JArrayHelper::toInteger($pks); ArrayHelper::toInteger($pks);
// Remove any values of zero. // Remove any values of zero.
if (array_search(0, $pks, true)) if (array_search(0, $pks, true))
@ -523,7 +525,7 @@ class ComponentbuilderModelComponent_updates extends JModelAdmin
if (!empty($commands['move_copy'])) if (!empty($commands['move_copy']))
{ {
$cmd = JArrayHelper::getValue($commands, 'move_copy', 'c'); $cmd = ArrayHelper::getValue($commands, 'move_copy', 'c');
if ($cmd == 'c') if ($cmd == 'c')
{ {
@ -590,8 +592,8 @@ class ComponentbuilderModelComponent_updates extends JModelAdmin
return false; return false;
} }
// get list of uniqe fields // get list of unique fields
$uniqeFields = $this->getUniqeFields(); $uniqueFields = $this->getUniqueFields();
// remove move_copy from array // remove move_copy from array
unset($values['move_copy']); unset($values['move_copy']);
@ -642,7 +644,7 @@ class ComponentbuilderModelComponent_updates extends JModelAdmin
// Only for strings // Only for strings
if (ComponentbuilderHelper::checkString($this->table->joomla_component) && !is_numeric($this->table->joomla_component)) if (ComponentbuilderHelper::checkString($this->table->joomla_component) && !is_numeric($this->table->joomla_component))
{ {
$this->table->joomla_component = $this->generateUniqe('joomla_component',$this->table->joomla_component); $this->table->joomla_component = $this->generateUnique('joomla_component',$this->table->joomla_component);
} }
// insert all set values // insert all set values
@ -657,12 +659,12 @@ class ComponentbuilderModelComponent_updates extends JModelAdmin
} }
} }
// update all uniqe fields // update all unique fields
if (ComponentbuilderHelper::checkArray($uniqeFields)) if (ComponentbuilderHelper::checkArray($uniqueFields))
{ {
foreach ($uniqeFields as $uniqeField) foreach ($uniqueFields as $uniqueField)
{ {
$this->table->$uniqeField = $this->generateUniqe($uniqeField,$this->table->$uniqeField); $this->table->$uniqueField = $this->generateUnique($uniqueField,$this->table->$uniqueField);
} }
} }
@ -859,16 +861,16 @@ class ComponentbuilderModelComponent_updates extends JModelAdmin
$data['params'] = (string) $params; $data['params'] = (string) $params;
} }
// Alter the uniqe field for save as copy // Alter the unique field for save as copy
if ($input->get('task') === 'save2copy') if ($input->get('task') === 'save2copy')
{ {
// Automatic handling of other uniqe fields // Automatic handling of other unique fields
$uniqeFields = $this->getUniqeFields(); $uniqueFields = $this->getUniqueFields();
if (ComponentbuilderHelper::checkArray($uniqeFields)) if (ComponentbuilderHelper::checkArray($uniqueFields))
{ {
foreach ($uniqeFields as $uniqeField) foreach ($uniqueFields as $uniqueField)
{ {
$data[$uniqeField] = $this->generateUniqe($uniqeField,$data[$uniqeField]); $data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]);
} }
} }
} }
@ -881,7 +883,7 @@ class ComponentbuilderModelComponent_updates extends JModelAdmin
} }
/** /**
* Method to generate a uniqe value. * Method to generate a unique value.
* *
* @param string $field name. * @param string $field name.
* @param string $value data. * @param string $value data.
@ -890,15 +892,15 @@ class ComponentbuilderModelComponent_updates extends JModelAdmin
* *
* @since 3.0 * @since 3.0
*/ */
protected function generateUniqe($field,$value) protected function generateUnique($field,$value)
{ {
// set field value uniqe // set field value unique
$table = $this->getTable(); $table = $this->getTable();
while ($table->load(array($field => $value))) while ($table->load(array($field => $value)))
{ {
$value = JString::increment($value); $value = StringHelper::increment($value);
} }
return $value; return $value;
@ -920,7 +922,7 @@ class ComponentbuilderModelComponent_updates extends JModelAdmin
while ($table->load(array('title' => $title))) while ($table->load(array('title' => $title)))
{ {
$title = JString::increment($title); $title = StringHelper::increment($title);
} }
return $title; return $title;

View File

@ -12,6 +12,8 @@
// 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\Utilities\ArrayHelper;
/** /**
* Components_admin_views Model * Components_admin_views Model
*/ */
@ -160,7 +162,7 @@ class ComponentbuilderModelComponents_admin_views extends JModelList
// Add the list ordering clause. // Add the list ordering clause.
$orderCol = $this->state->get('list.ordering', 'a.id'); $orderCol = $this->state->get('list.ordering', 'a.id');
$orderDirn = $this->state->get('list.direction', 'asc'); $orderDirn = $this->state->get('list.direction', 'asc');
if ($orderCol != '') if ($orderCol != '')
{ {
$query->order($db->escape($orderCol . ' ' . $orderDirn)); $query->order($db->escape($orderCol . ' ' . $orderDirn));

View File

@ -12,6 +12,8 @@
// 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\Utilities\ArrayHelper;
/** /**
* Components_config Model * Components_config Model
*/ */
@ -160,7 +162,7 @@ class ComponentbuilderModelComponents_config extends JModelList
// Add the list ordering clause. // Add the list ordering clause.
$orderCol = $this->state->get('list.ordering', 'a.id'); $orderCol = $this->state->get('list.ordering', 'a.id');
$orderDirn = $this->state->get('list.direction', 'asc'); $orderDirn = $this->state->get('list.direction', 'asc');
if ($orderCol != '') if ($orderCol != '')
{ {
$query->order($db->escape($orderCol . ' ' . $orderDirn)); $query->order($db->escape($orderCol . ' ' . $orderDirn));

View File

@ -12,6 +12,8 @@
// 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\Utilities\ArrayHelper;
/** /**
* Components_custom_admin_menus Model * Components_custom_admin_menus Model
*/ */
@ -160,7 +162,7 @@ class ComponentbuilderModelComponents_custom_admin_menus extends JModelList
// Add the list ordering clause. // Add the list ordering clause.
$orderCol = $this->state->get('list.ordering', 'a.id'); $orderCol = $this->state->get('list.ordering', 'a.id');
$orderDirn = $this->state->get('list.direction', 'asc'); $orderDirn = $this->state->get('list.direction', 'asc');
if ($orderCol != '') if ($orderCol != '')
{ {
$query->order($db->escape($orderCol . ' ' . $orderDirn)); $query->order($db->escape($orderCol . ' ' . $orderDirn));

View File

@ -12,6 +12,8 @@
// 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\Utilities\ArrayHelper;
/** /**
* Components_custom_admin_views Model * Components_custom_admin_views Model
*/ */
@ -160,7 +162,7 @@ class ComponentbuilderModelComponents_custom_admin_views extends JModelList
// Add the list ordering clause. // Add the list ordering clause.
$orderCol = $this->state->get('list.ordering', 'a.id'); $orderCol = $this->state->get('list.ordering', 'a.id');
$orderDirn = $this->state->get('list.direction', 'asc'); $orderDirn = $this->state->get('list.direction', 'asc');
if ($orderCol != '') if ($orderCol != '')
{ {
$query->order($db->escape($orderCol . ' ' . $orderDirn)); $query->order($db->escape($orderCol . ' ' . $orderDirn));

View File

@ -12,6 +12,8 @@
// 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\Utilities\ArrayHelper;
/** /**
* Components_dashboard Model * Components_dashboard Model
*/ */
@ -160,7 +162,7 @@ class ComponentbuilderModelComponents_dashboard extends JModelList
// Add the list ordering clause. // Add the list ordering clause.
$orderCol = $this->state->get('list.ordering', 'a.id'); $orderCol = $this->state->get('list.ordering', 'a.id');
$orderDirn = $this->state->get('list.direction', 'asc'); $orderDirn = $this->state->get('list.direction', 'asc');
if ($orderCol != '') if ($orderCol != '')
{ {
$query->order($db->escape($orderCol . ' ' . $orderDirn)); $query->order($db->escape($orderCol . ' ' . $orderDirn));

View File

@ -12,6 +12,8 @@
// 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\Utilities\ArrayHelper;
/** /**
* Components_files_folders Model * Components_files_folders Model
*/ */
@ -160,7 +162,7 @@ class ComponentbuilderModelComponents_files_folders extends JModelList
// Add the list ordering clause. // Add the list ordering clause.
$orderCol = $this->state->get('list.ordering', 'a.id'); $orderCol = $this->state->get('list.ordering', 'a.id');
$orderDirn = $this->state->get('list.direction', 'asc'); $orderDirn = $this->state->get('list.direction', 'asc');
if ($orderCol != '') if ($orderCol != '')
{ {
$query->order($db->escape($orderCol . ' ' . $orderDirn)); $query->order($db->escape($orderCol . ' ' . $orderDirn));

View File

@ -12,6 +12,8 @@
// 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\Utilities\ArrayHelper;
/** /**
* Components_modules Model * Components_modules Model
*/ */
@ -160,7 +162,7 @@ class ComponentbuilderModelComponents_modules extends JModelList
// Add the list ordering clause. // Add the list ordering clause.
$orderCol = $this->state->get('list.ordering', 'a.id'); $orderCol = $this->state->get('list.ordering', 'a.id');
$orderDirn = $this->state->get('list.direction', 'asc'); $orderDirn = $this->state->get('list.direction', 'asc');
if ($orderCol != '') if ($orderCol != '')
{ {
$query->order($db->escape($orderCol . ' ' . $orderDirn)); $query->order($db->escape($orderCol . ' ' . $orderDirn));

View File

@ -12,6 +12,8 @@
// 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\Utilities\ArrayHelper;
/** /**
* Components_mysql_tweaks Model * Components_mysql_tweaks Model
*/ */
@ -160,7 +162,7 @@ class ComponentbuilderModelComponents_mysql_tweaks extends JModelList
// Add the list ordering clause. // Add the list ordering clause.
$orderCol = $this->state->get('list.ordering', 'a.id'); $orderCol = $this->state->get('list.ordering', 'a.id');
$orderDirn = $this->state->get('list.direction', 'asc'); $orderDirn = $this->state->get('list.direction', 'asc');
if ($orderCol != '') if ($orderCol != '')
{ {
$query->order($db->escape($orderCol . ' ' . $orderDirn)); $query->order($db->escape($orderCol . ' ' . $orderDirn));

View File

@ -12,6 +12,8 @@
// 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\Utilities\ArrayHelper;
/** /**
* Components_placeholders Model * Components_placeholders Model
*/ */
@ -160,7 +162,7 @@ class ComponentbuilderModelComponents_placeholders extends JModelList
// Add the list ordering clause. // Add the list ordering clause.
$orderCol = $this->state->get('list.ordering', 'a.id'); $orderCol = $this->state->get('list.ordering', 'a.id');
$orderDirn = $this->state->get('list.direction', 'asc'); $orderDirn = $this->state->get('list.direction', 'asc');
if ($orderCol != '') if ($orderCol != '')
{ {
$query->order($db->escape($orderCol . ' ' . $orderDirn)); $query->order($db->escape($orderCol . ' ' . $orderDirn));

View File

@ -12,6 +12,8 @@
// 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\Utilities\ArrayHelper;
/** /**
* Components_plugins Model * Components_plugins Model
*/ */
@ -160,7 +162,7 @@ class ComponentbuilderModelComponents_plugins extends JModelList
// Add the list ordering clause. // Add the list ordering clause.
$orderCol = $this->state->get('list.ordering', 'a.id'); $orderCol = $this->state->get('list.ordering', 'a.id');
$orderDirn = $this->state->get('list.direction', 'asc'); $orderDirn = $this->state->get('list.direction', 'asc');
if ($orderCol != '') if ($orderCol != '')
{ {
$query->order($db->escape($orderCol . ' ' . $orderDirn)); $query->order($db->escape($orderCol . ' ' . $orderDirn));

View File

@ -12,6 +12,8 @@
// 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\Utilities\ArrayHelper;
/** /**
* Components_site_views Model * Components_site_views Model
*/ */
@ -160,7 +162,7 @@ class ComponentbuilderModelComponents_site_views extends JModelList
// Add the list ordering clause. // Add the list ordering clause.
$orderCol = $this->state->get('list.ordering', 'a.id'); $orderCol = $this->state->get('list.ordering', 'a.id');
$orderDirn = $this->state->get('list.direction', 'asc'); $orderDirn = $this->state->get('list.direction', 'asc');
if ($orderCol != '') if ($orderCol != '')
{ {
$query->order($db->escape($orderCol . ' ' . $orderDirn)); $query->order($db->escape($orderCol . ' ' . $orderDirn));

View File

@ -12,6 +12,8 @@
// 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\Utilities\ArrayHelper;
/** /**
* Components_updates Model * Components_updates Model
*/ */
@ -160,7 +162,7 @@ class ComponentbuilderModelComponents_updates extends JModelList
// Add the list ordering clause. // Add the list ordering clause.
$orderCol = $this->state->get('list.ordering', 'a.id'); $orderCol = $this->state->get('list.ordering', 'a.id');
$orderDirn = $this->state->get('list.direction', 'asc'); $orderDirn = $this->state->get('list.direction', 'asc');
if ($orderCol != '') if ($orderCol != '')
{ {
$query->order($db->escape($orderCol . ' ' . $orderDirn)); $query->order($db->escape($orderCol . ' ' . $orderDirn));

View File

@ -13,6 +13,8 @@
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
use Joomla\Registry\Registry; use Joomla\Registry\Registry;
use Joomla\String\StringHelper;
use Joomla\Utilities\ArrayHelper;
/** /**
* Componentbuilder Custom_admin_view Model * Componentbuilder Custom_admin_view Model
@ -679,9 +681,9 @@ class ComponentbuilderModelCustom_admin_view extends JModelAdmin
* *
* @since 3.0 * @since 3.0
*/ */
protected function getUniqeFields() protected function getUniqueFields()
{ {
return false; return array('guid');
} }
/** /**
@ -738,7 +740,7 @@ class ComponentbuilderModelCustom_admin_view extends JModelAdmin
{ {
// Sanitize ids. // Sanitize ids.
$pks = array_unique($pks); $pks = array_unique($pks);
JArrayHelper::toInteger($pks); ArrayHelper::toInteger($pks);
// Remove any values of zero. // Remove any values of zero.
if (array_search(0, $pks, true)) if (array_search(0, $pks, true))
@ -779,7 +781,7 @@ class ComponentbuilderModelCustom_admin_view extends JModelAdmin
if (!empty($commands['move_copy'])) if (!empty($commands['move_copy']))
{ {
$cmd = JArrayHelper::getValue($commands, 'move_copy', 'c'); $cmd = ArrayHelper::getValue($commands, 'move_copy', 'c');
if ($cmd == 'c') if ($cmd == 'c')
{ {
@ -846,8 +848,8 @@ class ComponentbuilderModelCustom_admin_view extends JModelAdmin
return false; return false;
} }
// get list of uniqe fields // get list of unique fields
$uniqeFields = $this->getUniqeFields(); $uniqueFields = $this->getUniqueFields();
// remove move_copy from array // remove move_copy from array
unset($values['move_copy']); unset($values['move_copy']);
@ -898,7 +900,7 @@ class ComponentbuilderModelCustom_admin_view extends JModelAdmin
// Only for strings // Only for strings
if (ComponentbuilderHelper::checkString($this->table->name) && !is_numeric($this->table->name)) if (ComponentbuilderHelper::checkString($this->table->name) && !is_numeric($this->table->name))
{ {
$this->table->name = $this->generateUniqe('name',$this->table->name); $this->table->name = $this->generateUnique('name',$this->table->name);
} }
// insert all set values // insert all set values
@ -913,12 +915,12 @@ class ComponentbuilderModelCustom_admin_view extends JModelAdmin
} }
} }
// update all uniqe fields // update all unique fields
if (ComponentbuilderHelper::checkArray($uniqeFields)) if (ComponentbuilderHelper::checkArray($uniqueFields))
{ {
foreach ($uniqeFields as $uniqeField) foreach ($uniqueFields as $uniqueField)
{ {
$this->table->$uniqeField = $this->generateUniqe($uniqeField,$this->table->$uniqeField); $this->table->$uniqueField = $this->generateUnique($uniqueField,$this->table->$uniqueField);
} }
} }
@ -1261,16 +1263,16 @@ class ComponentbuilderModelCustom_admin_view extends JModelAdmin
$data['params'] = (string) $params; $data['params'] = (string) $params;
} }
// Alter the uniqe field for save as copy // Alter the unique field for save as copy
if ($input->get('task') === 'save2copy') if ($input->get('task') === 'save2copy')
{ {
// Automatic handling of other uniqe fields // Automatic handling of other unique fields
$uniqeFields = $this->getUniqeFields(); $uniqueFields = $this->getUniqueFields();
if (ComponentbuilderHelper::checkArray($uniqeFields)) if (ComponentbuilderHelper::checkArray($uniqueFields))
{ {
foreach ($uniqeFields as $uniqeField) foreach ($uniqueFields as $uniqueField)
{ {
$data[$uniqeField] = $this->generateUniqe($uniqeField,$data[$uniqeField]); $data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]);
} }
} }
} }
@ -1283,7 +1285,7 @@ class ComponentbuilderModelCustom_admin_view extends JModelAdmin
} }
/** /**
* Method to generate a uniqe value. * Method to generate a unique value.
* *
* @param string $field name. * @param string $field name.
* @param string $value data. * @param string $value data.
@ -1292,15 +1294,15 @@ class ComponentbuilderModelCustom_admin_view extends JModelAdmin
* *
* @since 3.0 * @since 3.0
*/ */
protected function generateUniqe($field,$value) protected function generateUnique($field,$value)
{ {
// set field value uniqe // set field value unique
$table = $this->getTable(); $table = $this->getTable();
while ($table->load(array($field => $value))) while ($table->load(array($field => $value)))
{ {
$value = JString::increment($value); $value = StringHelper::increment($value);
} }
return $value; return $value;
@ -1322,7 +1324,7 @@ class ComponentbuilderModelCustom_admin_view extends JModelAdmin
while ($table->load(array('title' => $title))) while ($table->load(array('title' => $title)))
{ {
$title = JString::increment($title); $title = StringHelper::increment($title);
} }
return $title; return $title;

View File

@ -12,6 +12,8 @@
// 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\Utilities\ArrayHelper;
/** /**
* Custom_admin_views Model * Custom_admin_views Model
*/ */
@ -30,7 +32,7 @@ class ComponentbuilderModelCustom_admin_views extends JModelList
'a.system_name','system_name', 'a.system_name','system_name',
'a.name','name', 'a.name','name',
'a.description','description', 'a.description','description',
'a.main_get','main_get', 'g.name',
'a.add_php_ajax','add_php_ajax', 'a.add_php_ajax','add_php_ajax',
'a.add_custom_button','add_custom_button' 'a.add_custom_button','add_custom_button'
); );
@ -261,7 +263,7 @@ class ComponentbuilderModelCustom_admin_views extends JModelList
// Add the list ordering clause. // Add the list ordering clause.
$orderCol = $this->state->get('list.ordering', 'a.id'); $orderCol = $this->state->get('list.ordering', 'a.id');
$orderDirn = $this->state->get('list.direction', 'asc'); $orderDirn = $this->state->get('list.direction', 'DESC');
if ($orderCol != '') if ($orderCol != '')
{ {
$query->order($db->escape($orderCol . ' ' . $orderDirn)); $query->order($db->escape($orderCol . ' ' . $orderDirn));
@ -308,7 +310,7 @@ class ComponentbuilderModelCustom_admin_views extends JModelList
} }
// Order the results by ordering // Order the results by ordering
$query->order('a.ordering ASC'); $query->order('a.id DESC');
// Load the items // Load the items
$db->setQuery($query); $db->setQuery($query);

View File

@ -13,6 +13,8 @@
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
use Joomla\Registry\Registry; use Joomla\Registry\Registry;
use Joomla\String\StringHelper;
use Joomla\Utilities\ArrayHelper;
/** /**
* Componentbuilder Custom_code Model * Componentbuilder Custom_code Model
@ -544,7 +546,7 @@ class ComponentbuilderModelCustom_code extends JModelAdmin
* *
* @since 3.0 * @since 3.0
*/ */
protected function getUniqeFields() protected function getUniqueFields()
{ {
return false; return false;
} }
@ -603,7 +605,7 @@ class ComponentbuilderModelCustom_code extends JModelAdmin
{ {
// Sanitize ids. // Sanitize ids.
$pks = array_unique($pks); $pks = array_unique($pks);
JArrayHelper::toInteger($pks); ArrayHelper::toInteger($pks);
// Remove any values of zero. // Remove any values of zero.
if (array_search(0, $pks, true)) if (array_search(0, $pks, true))
@ -644,7 +646,7 @@ class ComponentbuilderModelCustom_code extends JModelAdmin
if (!empty($commands['move_copy'])) if (!empty($commands['move_copy']))
{ {
$cmd = JArrayHelper::getValue($commands, 'move_copy', 'c'); $cmd = ArrayHelper::getValue($commands, 'move_copy', 'c');
if ($cmd == 'c') if ($cmd == 'c')
{ {
@ -711,8 +713,8 @@ class ComponentbuilderModelCustom_code extends JModelAdmin
return false; return false;
} }
// get list of uniqe fields // get list of unique fields
$uniqeFields = $this->getUniqeFields(); $uniqueFields = $this->getUniqueFields();
// remove move_copy from array // remove move_copy from array
unset($values['move_copy']); unset($values['move_copy']);
@ -763,7 +765,7 @@ class ComponentbuilderModelCustom_code extends JModelAdmin
// Only for strings // Only for strings
if (ComponentbuilderHelper::checkString($this->table->component) && !is_numeric($this->table->component)) if (ComponentbuilderHelper::checkString($this->table->component) && !is_numeric($this->table->component))
{ {
$this->table->component = $this->generateUniqe('component',$this->table->component); $this->table->component = $this->generateUnique('component',$this->table->component);
} }
// insert all set values // insert all set values
@ -778,12 +780,12 @@ class ComponentbuilderModelCustom_code extends JModelAdmin
} }
} }
// update all uniqe fields // update all unique fields
if (ComponentbuilderHelper::checkArray($uniqeFields)) if (ComponentbuilderHelper::checkArray($uniqueFields))
{ {
foreach ($uniqeFields as $uniqeField) foreach ($uniqueFields as $uniqueField)
{ {
$this->table->$uniqeField = $this->generateUniqe($uniqeField,$this->table->$uniqeField); $this->table->$uniqueField = $this->generateUnique($uniqueField,$this->table->$uniqueField);
} }
} }
@ -1008,16 +1010,16 @@ class ComponentbuilderModelCustom_code extends JModelAdmin
$data['params'] = (string) $params; $data['params'] = (string) $params;
} }
// Alter the uniqe field for save as copy // Alter the unique field for save as copy
if ($input->get('task') === 'save2copy') if ($input->get('task') === 'save2copy')
{ {
// Automatic handling of other uniqe fields // Automatic handling of other unique fields
$uniqeFields = $this->getUniqeFields(); $uniqueFields = $this->getUniqueFields();
if (ComponentbuilderHelper::checkArray($uniqeFields)) if (ComponentbuilderHelper::checkArray($uniqueFields))
{ {
foreach ($uniqeFields as $uniqeField) foreach ($uniqueFields as $uniqueField)
{ {
$data[$uniqeField] = $this->generateUniqe($uniqeField,$data[$uniqeField]); $data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]);
} }
} }
} }
@ -1030,7 +1032,7 @@ class ComponentbuilderModelCustom_code extends JModelAdmin
} }
/** /**
* Method to generate a uniqe value. * Method to generate a unique value.
* *
* @param string $field name. * @param string $field name.
* @param string $value data. * @param string $value data.
@ -1039,15 +1041,15 @@ class ComponentbuilderModelCustom_code extends JModelAdmin
* *
* @since 3.0 * @since 3.0
*/ */
protected function generateUniqe($field,$value) protected function generateUnique($field,$value)
{ {
// set field value uniqe // set field value unique
$table = $this->getTable(); $table = $this->getTable();
while ($table->load(array($field => $value))) while ($table->load(array($field => $value)))
{ {
$value = JString::increment($value); $value = StringHelper::increment($value);
} }
return $value; return $value;
@ -1069,7 +1071,7 @@ class ComponentbuilderModelCustom_code extends JModelAdmin
while ($table->load(array('title' => $title))) while ($table->load(array('title' => $title)))
{ {
$title = JString::increment($title); $title = StringHelper::increment($title);
} }
return $title; return $title;

View File

@ -12,6 +12,8 @@
// 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\Utilities\ArrayHelper;
/** /**
* Custom_codes Model * Custom_codes Model
*/ */
@ -27,7 +29,7 @@ class ComponentbuilderModelCustom_codes extends JModelList
'a.ordering','ordering', 'a.ordering','ordering',
'a.created_by','created_by', 'a.created_by','created_by',
'a.modified_by','modified_by', 'a.modified_by','modified_by',
'a.component','component', 'g.system_name',
'a.path','path', 'a.path','path',
'a.target','target', 'a.target','target',
'a.type','type', 'a.type','type',
@ -294,7 +296,7 @@ class ComponentbuilderModelCustom_codes extends JModelList
// Add the list ordering clause. // Add the list ordering clause.
$orderCol = $this->state->get('list.ordering', 'a.id'); $orderCol = $this->state->get('list.ordering', 'a.id');
$orderDirn = $this->state->get('list.direction', 'asc'); $orderDirn = $this->state->get('list.direction', 'DESC');
if ($orderCol != '') if ($orderCol != '')
{ {
$query->order($db->escape($orderCol . ' ' . $orderDirn)); $query->order($db->escape($orderCol . ' ' . $orderDirn));
@ -341,7 +343,7 @@ class ComponentbuilderModelCustom_codes extends JModelList
} }
// Order the results by ordering // Order the results by ordering
$query->order('a.ordering ASC'); $query->order('a.id DESC');
// Load the items // Load the items
$db->setQuery($query); $db->setQuery($query);

View File

@ -13,6 +13,8 @@
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
use Joomla\Registry\Registry; use Joomla\Registry\Registry;
use Joomla\String\StringHelper;
use Joomla\Utilities\ArrayHelper;
/** /**
* Componentbuilder Dynamic_get Model * Componentbuilder Dynamic_get Model
@ -729,9 +731,9 @@ class ComponentbuilderModelDynamic_get extends JModelAdmin
* *
* @since 3.0 * @since 3.0
*/ */
protected function getUniqeFields() protected function getUniqueFields()
{ {
return false; return array('guid');
} }
/** /**
@ -788,7 +790,7 @@ class ComponentbuilderModelDynamic_get extends JModelAdmin
{ {
// Sanitize ids. // Sanitize ids.
$pks = array_unique($pks); $pks = array_unique($pks);
JArrayHelper::toInteger($pks); ArrayHelper::toInteger($pks);
// Remove any values of zero. // Remove any values of zero.
if (array_search(0, $pks, true)) if (array_search(0, $pks, true))
@ -829,7 +831,7 @@ class ComponentbuilderModelDynamic_get extends JModelAdmin
if (!empty($commands['move_copy'])) if (!empty($commands['move_copy']))
{ {
$cmd = JArrayHelper::getValue($commands, 'move_copy', 'c'); $cmd = ArrayHelper::getValue($commands, 'move_copy', 'c');
if ($cmd == 'c') if ($cmd == 'c')
{ {
@ -896,8 +898,8 @@ class ComponentbuilderModelDynamic_get extends JModelAdmin
return false; return false;
} }
// get list of uniqe fields // get list of unique fields
$uniqeFields = $this->getUniqeFields(); $uniqueFields = $this->getUniqueFields();
// remove move_copy from array // remove move_copy from array
unset($values['move_copy']); unset($values['move_copy']);
@ -948,7 +950,7 @@ class ComponentbuilderModelDynamic_get extends JModelAdmin
// Only for strings // Only for strings
if (ComponentbuilderHelper::checkString($this->table->name) && !is_numeric($this->table->name)) if (ComponentbuilderHelper::checkString($this->table->name) && !is_numeric($this->table->name))
{ {
$this->table->name = $this->generateUniqe('name',$this->table->name); $this->table->name = $this->generateUnique('name',$this->table->name);
} }
// insert all set values // insert all set values
@ -963,12 +965,12 @@ class ComponentbuilderModelDynamic_get extends JModelAdmin
} }
} }
// update all uniqe fields // update all unique fields
if (ComponentbuilderHelper::checkArray($uniqeFields)) if (ComponentbuilderHelper::checkArray($uniqueFields))
{ {
foreach ($uniqeFields as $uniqeField) foreach ($uniqueFields as $uniqueField)
{ {
$this->table->$uniqeField = $this->generateUniqe($uniqeField,$this->table->$uniqeField); $this->table->$uniqueField = $this->generateUnique($uniqueField,$this->table->$uniqueField);
} }
} }
@ -1305,16 +1307,16 @@ class ComponentbuilderModelDynamic_get extends JModelAdmin
$data['params'] = (string) $params; $data['params'] = (string) $params;
} }
// Alter the uniqe field for save as copy // Alter the unique field for save as copy
if ($input->get('task') === 'save2copy') if ($input->get('task') === 'save2copy')
{ {
// Automatic handling of other uniqe fields // Automatic handling of other unique fields
$uniqeFields = $this->getUniqeFields(); $uniqueFields = $this->getUniqueFields();
if (ComponentbuilderHelper::checkArray($uniqeFields)) if (ComponentbuilderHelper::checkArray($uniqueFields))
{ {
foreach ($uniqeFields as $uniqeField) foreach ($uniqueFields as $uniqueField)
{ {
$data[$uniqeField] = $this->generateUniqe($uniqeField,$data[$uniqeField]); $data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]);
} }
} }
} }
@ -1327,7 +1329,7 @@ class ComponentbuilderModelDynamic_get extends JModelAdmin
} }
/** /**
* Method to generate a uniqe value. * Method to generate a unique value.
* *
* @param string $field name. * @param string $field name.
* @param string $value data. * @param string $value data.
@ -1336,15 +1338,15 @@ class ComponentbuilderModelDynamic_get extends JModelAdmin
* *
* @since 3.0 * @since 3.0
*/ */
protected function generateUniqe($field,$value) protected function generateUnique($field,$value)
{ {
// set field value uniqe // set field value unique
$table = $this->getTable(); $table = $this->getTable();
while ($table->load(array($field => $value))) while ($table->load(array($field => $value)))
{ {
$value = JString::increment($value); $value = StringHelper::increment($value);
} }
return $value; return $value;
@ -1366,7 +1368,7 @@ class ComponentbuilderModelDynamic_get extends JModelAdmin
while ($table->load(array('title' => $title))) while ($table->load(array('title' => $title)))
{ {
$title = JString::increment($title); $title = StringHelper::increment($title);
} }
return $title; return $title;

View File

@ -12,6 +12,8 @@
// 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\Utilities\ArrayHelper;
/** /**
* Dynamic_gets Model * Dynamic_gets Model
*/ */
@ -244,7 +246,7 @@ class ComponentbuilderModelDynamic_gets extends JModelList
// Add the list ordering clause. // Add the list ordering clause.
$orderCol = $this->state->get('list.ordering', 'a.id'); $orderCol = $this->state->get('list.ordering', 'a.id');
$orderDirn = $this->state->get('list.direction', 'asc'); $orderDirn = $this->state->get('list.direction', 'DESC');
if ($orderCol != '') if ($orderCol != '')
{ {
$query->order($db->escape($orderCol . ' ' . $orderDirn)); $query->order($db->escape($orderCol . ' ' . $orderDirn));
@ -291,7 +293,7 @@ class ComponentbuilderModelDynamic_gets extends JModelList
} }
// Order the results by ordering // Order the results by ordering
$query->order('a.ordering ASC'); $query->order('a.id DESC');
// Load the items // Load the items
$db->setQuery($query); $db->setQuery($query);

View File

@ -13,6 +13,8 @@
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
use Joomla\Registry\Registry; use Joomla\Registry\Registry;
use Joomla\String\StringHelper;
use Joomla\Utilities\ArrayHelper;
/** /**
* Componentbuilder Field Model * Componentbuilder Field Model
@ -628,9 +630,9 @@ class ComponentbuilderModelField extends JModelAdmin
* *
* @since 3.0 * @since 3.0
*/ */
protected function getUniqeFields() protected function getUniqueFields()
{ {
return false; return array('guid');
} }
/** /**
@ -687,7 +689,7 @@ class ComponentbuilderModelField extends JModelAdmin
{ {
// Sanitize ids. // Sanitize ids.
$pks = array_unique($pks); $pks = array_unique($pks);
JArrayHelper::toInteger($pks); ArrayHelper::toInteger($pks);
// Remove any values of zero. // Remove any values of zero.
if (array_search(0, $pks, true)) if (array_search(0, $pks, true))
@ -728,7 +730,7 @@ class ComponentbuilderModelField extends JModelAdmin
if (!empty($commands['move_copy'])) if (!empty($commands['move_copy']))
{ {
$cmd = JArrayHelper::getValue($commands, 'move_copy', 'c'); $cmd = ArrayHelper::getValue($commands, 'move_copy', 'c');
if ($cmd == 'c') if ($cmd == 'c')
{ {
@ -795,8 +797,8 @@ class ComponentbuilderModelField extends JModelAdmin
return false; return false;
} }
// get list of uniqe fields // get list of unique fields
$uniqeFields = $this->getUniqeFields(); $uniqueFields = $this->getUniqueFields();
// remove move_copy from array // remove move_copy from array
unset($values['move_copy']); unset($values['move_copy']);
@ -871,12 +873,12 @@ class ComponentbuilderModelField extends JModelAdmin
} }
} }
// update all uniqe fields // update all unique fields
if (ComponentbuilderHelper::checkArray($uniqeFields)) if (ComponentbuilderHelper::checkArray($uniqueFields))
{ {
foreach ($uniqeFields as $uniqeField) foreach ($uniqueFields as $uniqueField)
{ {
$this->table->$uniqeField = $this->generateUniqe($uniqeField,$this->table->$uniqeField); $this->table->$uniqueField = $this->generateUnique($uniqueField,$this->table->$uniqueField);
} }
} }
@ -1210,16 +1212,16 @@ class ComponentbuilderModelField extends JModelAdmin
$data['params'] = (string) $params; $data['params'] = (string) $params;
} }
// Alter the uniqe field for save as copy // Alter the unique field for save as copy
if ($input->get('task') === 'save2copy') if ($input->get('task') === 'save2copy')
{ {
// Automatic handling of other uniqe fields // Automatic handling of other unique fields
$uniqeFields = $this->getUniqeFields(); $uniqueFields = $this->getUniqueFields();
if (ComponentbuilderHelper::checkArray($uniqeFields)) if (ComponentbuilderHelper::checkArray($uniqueFields))
{ {
foreach ($uniqeFields as $uniqeField) foreach ($uniqueFields as $uniqueField)
{ {
$data[$uniqeField] = $this->generateUniqe($uniqeField,$data[$uniqeField]); $data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]);
} }
} }
} }
@ -1232,7 +1234,7 @@ class ComponentbuilderModelField extends JModelAdmin
} }
/** /**
* Method to generate a uniqe value. * Method to generate a unique value.
* *
* @param string $field name. * @param string $field name.
* @param string $value data. * @param string $value data.
@ -1241,15 +1243,15 @@ class ComponentbuilderModelField extends JModelAdmin
* *
* @since 3.0 * @since 3.0
*/ */
protected function generateUniqe($field,$value) protected function generateUnique($field,$value)
{ {
// set field value uniqe // set field value unique
$table = $this->getTable(); $table = $this->getTable();
while ($table->load(array($field => $value))) while ($table->load(array($field => $value)))
{ {
$value = JString::increment($value); $value = StringHelper::increment($value);
} }
return $value; return $value;
@ -1271,7 +1273,7 @@ class ComponentbuilderModelField extends JModelAdmin
while ($table->load(array('title' => $title))) while ($table->load(array('title' => $title)))
{ {
$title = JString::increment($title); $title = StringHelper::increment($title);
} }
return $title; return $title;

View File

@ -12,6 +12,8 @@
// 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\Utilities\ArrayHelper;
/** /**
* Fields Model * Fields Model
*/ */
@ -28,7 +30,7 @@ class ComponentbuilderModelFields extends JModelList
'a.created_by','created_by', 'a.created_by','created_by',
'a.modified_by','modified_by', 'a.modified_by','modified_by',
'a.name','name', 'a.name','name',
'a.fieldtype','fieldtype', 'g.name',
'a.datatype','datatype', 'a.datatype','datatype',
'a.indexes','indexes', 'a.indexes','indexes',
'a.null_switch','null_switch', 'a.null_switch','null_switch',
@ -352,7 +354,7 @@ class ComponentbuilderModelFields extends JModelList
} }
elseif (is_array($categoryId)) elseif (is_array($categoryId))
{ {
JArrayHelper::toInteger($categoryId); ArrayHelper::toInteger($categoryId);
$categoryId = implode(',', $categoryId); $categoryId = implode(',', $categoryId);
$query->where('a.category IN (' . $categoryId . ')'); $query->where('a.category IN (' . $categoryId . ')');
} }
@ -360,7 +362,7 @@ class ComponentbuilderModelFields extends JModelList
// Add the list ordering clause. // Add the list ordering clause.
$orderCol = $this->state->get('list.ordering', 'a.id'); $orderCol = $this->state->get('list.ordering', 'a.id');
$orderDirn = $this->state->get('list.direction', 'asc'); $orderDirn = $this->state->get('list.direction', 'DESC');
if ($orderCol != '') if ($orderCol != '')
{ {
$query->order($db->escape($orderCol . ' ' . $orderDirn)); $query->order($db->escape($orderCol . ' ' . $orderDirn));
@ -407,7 +409,7 @@ class ComponentbuilderModelFields extends JModelList
} }
// Order the results by ordering // Order the results by ordering
$query->order('a.ordering ASC'); $query->order('a.id DESC');
// Load the items // Load the items
$db->setQuery($query); $db->setQuery($query);

View File

@ -35,7 +35,7 @@ class JFormFieldLibconfigfield extends JFormFieldList
*/ */
protected function getOptions() protected function getOptions()
{ {
// load the db opbject // load the db object
$db = JFactory::getDBO(); $db = JFactory::getDBO();
// get the input from url // get the input from url
$jinput = JFactory::getApplication()->input; $jinput = JFactory::getApplication()->input;

View File

@ -77,8 +77,9 @@ class JFormFieldListfields extends JFormFieldList
if (ComponentbuilderHelper::checkArray($fieldIds)) if (ComponentbuilderHelper::checkArray($fieldIds))
{ {
$query = $db->getQuery(true); $query = $db->getQuery(true);
$query->select($db->quoteName(array('a.id','a.name'),array('id','name'))); $query->select($db->quoteName(array('a.id','a.name', 'a.xml', 'b.name'),array('id','name', 'xml', 'type')));
$query->from($db->quoteName('#__componentbuilder_field', 'a')); $query->from($db->quoteName('#__componentbuilder_field', 'a'));
$query->join('LEFT', '#__componentbuilder_fieldtype AS b ON b.id = a.fieldtype');
$query->where($db->quoteName('a.published') . ' >= 1'); $query->where($db->quoteName('a.published') . ' >= 1');
// only load these fields // only load these fields
$query->where($db->quoteName('a.id') . ' IN (' . implode(',', $fieldIds) . ')'); $query->where($db->quoteName('a.id') . ' IN (' . implode(',', $fieldIds) . ')');
@ -91,7 +92,9 @@ class JFormFieldListfields extends JFormFieldList
$options[] = JHtml::_('select.option', '', JText::_('COM_COMPONENTBUILDER_SELECT_AN_OPTION')); $options[] = JHtml::_('select.option', '', JText::_('COM_COMPONENTBUILDER_SELECT_AN_OPTION'));
foreach($items as $item) foreach($items as $item)
{ {
$options[] = JHtml::_('select.option', $item->id, $item->name); // get the field name (TODO this could slow down the system so we will need to improve on this)
$field_name = ComponentbuilderHelper::safeFieldName(ComponentbuilderHelper::getBetween(json_decode($item->xml),'name="','"'));
$options[] = JHtml::_('select.option', $item->id, $item->name . ' [ ' . $field_name . ' - ' . $item->type . ' ]');
} }
} }
return $options; return $options;

View File

@ -75,8 +75,9 @@ class JFormFieldMatchfield extends JFormFieldList
} }
} }
$query = $db->getQuery(true); $query = $db->getQuery(true);
$query->select($db->quoteName(array('a.id','a.name'),array('id','name'))); $query->select($db->quoteName(array('a.id','a.name','t.name'),array('id','name','type')));
$query->from($db->quoteName('#__componentbuilder_field', 'a')); $query->from($db->quoteName('#__componentbuilder_field', 'a'));
$query->join('LEFT', $db->quoteName('#__componentbuilder_fieldtype', 't') . ' ON (' . $db->quoteName('a.fieldtype') . ' = ' . $db->quoteName('t.id') . ')');
$query->where($db->quoteName('a.published') . ' >= 1'); $query->where($db->quoteName('a.published') . ' >= 1');
// filter by fields linked // filter by fields linked
if (ComponentbuilderHelper::checkArray($fieldIds)) if (ComponentbuilderHelper::checkArray($fieldIds))
@ -93,10 +94,10 @@ class JFormFieldMatchfield extends JFormFieldList
$options[] = JHtml::_('select.option', '', 'Select an option'); $options[] = JHtml::_('select.option', '', 'Select an option');
foreach($items as $item) foreach($items as $item)
{ {
$options[] = JHtml::_('select.option', $item->id, $item->name); $options[] = JHtml::_('select.option', $item->id, $item->name . ' [' . $item->type . ']');
} }
} }
return $options; return $options;
} }
} }

View File

@ -82,8 +82,9 @@ class JFormFieldTargetfields extends JFormFieldList
} }
} }
$query = $db->getQuery(true); $query = $db->getQuery(true);
$query->select($db->quoteName(array('a.id','a.name'),array('id','name'))); $query->select($db->quoteName(array('a.id','a.name','t.name'),array('id','name','type')));
$query->from($db->quoteName('#__componentbuilder_field', 'a')); $query->from($db->quoteName('#__componentbuilder_field', 'a'));
$query->join('LEFT', $db->quoteName('#__componentbuilder_fieldtype', 't') . ' ON (' . $db->quoteName('a.fieldtype') . ' = ' . $db->quoteName('t.id') . ')');
$query->where($db->quoteName('a.published') . ' >= 1'); $query->where($db->quoteName('a.published') . ' >= 1');
// filter by fields linked // filter by fields linked
if (ComponentbuilderHelper::checkArray($fieldIds)) if (ComponentbuilderHelper::checkArray($fieldIds))
@ -99,7 +100,7 @@ class JFormFieldTargetfields extends JFormFieldList
{ {
foreach($items as $item) foreach($items as $item)
{ {
$options[] = JHtml::_('select.option', $item->id, $item->name); $options[] = JHtml::_('select.option', $item->id, $item->name . ' [' . $item->type . ']');
} }
} }

View File

@ -13,6 +13,8 @@
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
use Joomla\Registry\Registry; use Joomla\Registry\Registry;
use Joomla\String\StringHelper;
use Joomla\Utilities\ArrayHelper;
/** /**
* Componentbuilder Fieldtype Model * Componentbuilder Fieldtype Model
@ -753,9 +755,9 @@ class ComponentbuilderModelFieldtype extends JModelAdmin
* *
* @since 3.0 * @since 3.0
*/ */
protected function getUniqeFields() protected function getUniqueFields()
{ {
return false; return array('guid');
} }
/** /**
@ -812,7 +814,7 @@ class ComponentbuilderModelFieldtype extends JModelAdmin
{ {
// Sanitize ids. // Sanitize ids.
$pks = array_unique($pks); $pks = array_unique($pks);
JArrayHelper::toInteger($pks); ArrayHelper::toInteger($pks);
// Remove any values of zero. // Remove any values of zero.
if (array_search(0, $pks, true)) if (array_search(0, $pks, true))
@ -853,7 +855,7 @@ class ComponentbuilderModelFieldtype extends JModelAdmin
if (!empty($commands['move_copy'])) if (!empty($commands['move_copy']))
{ {
$cmd = JArrayHelper::getValue($commands, 'move_copy', 'c'); $cmd = ArrayHelper::getValue($commands, 'move_copy', 'c');
if ($cmd == 'c') if ($cmd == 'c')
{ {
@ -920,8 +922,8 @@ class ComponentbuilderModelFieldtype extends JModelAdmin
return false; return false;
} }
// get list of uniqe fields // get list of unique fields
$uniqeFields = $this->getUniqeFields(); $uniqueFields = $this->getUniqueFields();
// remove move_copy from array // remove move_copy from array
unset($values['move_copy']); unset($values['move_copy']);
@ -996,12 +998,12 @@ class ComponentbuilderModelFieldtype extends JModelAdmin
} }
} }
// update all uniqe fields // update all unique fields
if (ComponentbuilderHelper::checkArray($uniqeFields)) if (ComponentbuilderHelper::checkArray($uniqueFields))
{ {
foreach ($uniqeFields as $uniqeField) foreach ($uniqueFields as $uniqueField)
{ {
$this->table->$uniqeField = $this->generateUniqe($uniqeField,$this->table->$uniqeField); $this->table->$uniqueField = $this->generateUnique($uniqueField,$this->table->$uniqueField);
} }
} }
@ -1222,16 +1224,16 @@ class ComponentbuilderModelFieldtype extends JModelAdmin
$data['params'] = (string) $params; $data['params'] = (string) $params;
} }
// Alter the uniqe field for save as copy // Alter the unique field for save as copy
if ($input->get('task') === 'save2copy') if ($input->get('task') === 'save2copy')
{ {
// Automatic handling of other uniqe fields // Automatic handling of other unique fields
$uniqeFields = $this->getUniqeFields(); $uniqueFields = $this->getUniqueFields();
if (ComponentbuilderHelper::checkArray($uniqeFields)) if (ComponentbuilderHelper::checkArray($uniqueFields))
{ {
foreach ($uniqeFields as $uniqeField) foreach ($uniqueFields as $uniqueField)
{ {
$data[$uniqeField] = $this->generateUniqe($uniqeField,$data[$uniqeField]); $data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]);
} }
} }
} }
@ -1244,7 +1246,7 @@ class ComponentbuilderModelFieldtype extends JModelAdmin
} }
/** /**
* Method to generate a uniqe value. * Method to generate a unique value.
* *
* @param string $field name. * @param string $field name.
* @param string $value data. * @param string $value data.
@ -1253,15 +1255,15 @@ class ComponentbuilderModelFieldtype extends JModelAdmin
* *
* @since 3.0 * @since 3.0
*/ */
protected function generateUniqe($field,$value) protected function generateUnique($field,$value)
{ {
// set field value uniqe // set field value unique
$table = $this->getTable(); $table = $this->getTable();
while ($table->load(array($field => $value))) while ($table->load(array($field => $value)))
{ {
$value = JString::increment($value); $value = StringHelper::increment($value);
} }
return $value; return $value;
@ -1283,7 +1285,7 @@ class ComponentbuilderModelFieldtype extends JModelAdmin
while ($table->load(array('title' => $title))) while ($table->load(array('title' => $title)))
{ {
$title = JString::increment($title); $title = StringHelper::increment($title);
} }
return $title; return $title;

View File

@ -12,6 +12,8 @@
// 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\Utilities\ArrayHelper;
/** /**
* Fieldtypes Model * Fieldtypes Model
*/ */
@ -205,7 +207,7 @@ class ComponentbuilderModelFieldtypes extends JModelList
} }
elseif (is_array($categoryId)) elseif (is_array($categoryId))
{ {
JArrayHelper::toInteger($categoryId); ArrayHelper::toInteger($categoryId);
$categoryId = implode(',', $categoryId); $categoryId = implode(',', $categoryId);
$query->where('a.category IN (' . $categoryId . ')'); $query->where('a.category IN (' . $categoryId . ')');
} }
@ -213,7 +215,7 @@ class ComponentbuilderModelFieldtypes extends JModelList
// Add the list ordering clause. // Add the list ordering clause.
$orderCol = $this->state->get('list.ordering', 'a.id'); $orderCol = $this->state->get('list.ordering', 'a.id');
$orderDirn = $this->state->get('list.direction', 'asc'); $orderDirn = $this->state->get('list.direction', 'asc');
if ($orderCol != '') if ($orderCol != '')
{ {
$query->order($db->escape($orderCol . ' ' . $orderDirn)); $query->order($db->escape($orderCol . ' ' . $orderDirn));

View File

@ -103,7 +103,7 @@
type="subform" type="subform"
name="addconditions" name="addconditions"
label="COM_COMPONENTBUILDER_ADMIN_FIELDS_CONDITIONS_ADDCONDITIONS_LABEL" label="COM_COMPONENTBUILDER_ADMIN_FIELDS_CONDITIONS_ADDCONDITIONS_LABEL"
layout="joomla.form.field.subform.repeatable-table" layout="joomla.form.field.subform.repeatable"
multiple="true" multiple="true"
description="COM_COMPONENTBUILDER_ADMIN_FIELDS_CONDITIONS_ADDCONDITIONS_DESCRIPTION" description="COM_COMPONENTBUILDER_ADMIN_FIELDS_CONDITIONS_ADDCONDITIONS_DESCRIPTION"
default="" default=""
@ -115,7 +115,7 @@
name="target_field" name="target_field"
label="COM_COMPONENTBUILDER_ADMIN_FIELDS_CONDITIONS_TARGET_FIELD_LABEL" label="COM_COMPONENTBUILDER_ADMIN_FIELDS_CONDITIONS_TARGET_FIELD_LABEL"
description="COM_COMPONENTBUILDER_ADMIN_FIELDS_CONDITIONS_TARGET_FIELD_DESCRIPTION" description="COM_COMPONENTBUILDER_ADMIN_FIELDS_CONDITIONS_TARGET_FIELD_DESCRIPTION"
class="fieldMedium" class="fieldLarge"
multiple="true" multiple="true"
default="" default=""
required="true" required="true"
@ -127,7 +127,7 @@
name="target_behavior" name="target_behavior"
label="COM_COMPONENTBUILDER_ADMIN_FIELDS_CONDITIONS_TARGET_BEHAVIOR_LABEL" label="COM_COMPONENTBUILDER_ADMIN_FIELDS_CONDITIONS_TARGET_BEHAVIOR_LABEL"
description="COM_COMPONENTBUILDER_ADMIN_FIELDS_CONDITIONS_TARGET_BEHAVIOR_DESCRIPTION" description="COM_COMPONENTBUILDER_ADMIN_FIELDS_CONDITIONS_TARGET_BEHAVIOR_DESCRIPTION"
class="list_class" class="list_class fieldLarge"
multiple="false" multiple="false"
filter="INT" filter="INT"
required="true" required="true"
@ -148,7 +148,7 @@
name="target_relation" name="target_relation"
label="COM_COMPONENTBUILDER_ADMIN_FIELDS_CONDITIONS_TARGET_RELATION_LABEL" label="COM_COMPONENTBUILDER_ADMIN_FIELDS_CONDITIONS_TARGET_RELATION_LABEL"
description="COM_COMPONENTBUILDER_ADMIN_FIELDS_CONDITIONS_TARGET_RELATION_DESCRIPTION" description="COM_COMPONENTBUILDER_ADMIN_FIELDS_CONDITIONS_TARGET_RELATION_DESCRIPTION"
class="list_class" class="list_class fieldLarge"
multiple="false" multiple="false"
filter="INT" filter="INT"
required="true" required="true"
@ -165,8 +165,8 @@
name="match_field" name="match_field"
label="COM_COMPONENTBUILDER_ADMIN_FIELDS_CONDITIONS_MATCH_FIELD_LABEL" label="COM_COMPONENTBUILDER_ADMIN_FIELDS_CONDITIONS_MATCH_FIELD_LABEL"
description="COM_COMPONENTBUILDER_ADMIN_FIELDS_CONDITIONS_MATCH_FIELD_DESCRIPTION" description="COM_COMPONENTBUILDER_ADMIN_FIELDS_CONDITIONS_MATCH_FIELD_DESCRIPTION"
class="fieldLarge"
multiple="false" multiple="false"
default=""
required="true" required="true"
button="false" button="false"
/> />
@ -176,7 +176,7 @@
name="match_behavior" name="match_behavior"
label="COM_COMPONENTBUILDER_ADMIN_FIELDS_CONDITIONS_MATCH_BEHAVIOR_LABEL" label="COM_COMPONENTBUILDER_ADMIN_FIELDS_CONDITIONS_MATCH_BEHAVIOR_LABEL"
description="COM_COMPONENTBUILDER_ADMIN_FIELDS_CONDITIONS_MATCH_BEHAVIOR_DESCRIPTION" description="COM_COMPONENTBUILDER_ADMIN_FIELDS_CONDITIONS_MATCH_BEHAVIOR_DESCRIPTION"
class="list_class" class="list_class fieldLarge"
multiple="false" multiple="false"
filter="INT" filter="INT"
required="true" required="true"

View File

@ -103,7 +103,7 @@
type="subform" type="subform"
name="addrelations" name="addrelations"
label="COM_COMPONENTBUILDER_ADMIN_FIELDS_RELATIONS_ADDRELATIONS_LABEL" label="COM_COMPONENTBUILDER_ADMIN_FIELDS_RELATIONS_ADDRELATIONS_LABEL"
layout="joomla.form.field.subform.repeatable-table" layout="joomla.form.field.subform.repeatable"
multiple="true" multiple="true"
description="COM_COMPONENTBUILDER_ADMIN_FIELDS_RELATIONS_ADDRELATIONS_DESCRIPTION" description="COM_COMPONENTBUILDER_ADMIN_FIELDS_RELATIONS_ADDRELATIONS_DESCRIPTION"
default="" default=""
@ -115,7 +115,7 @@
name="listfield" name="listfield"
label="COM_COMPONENTBUILDER_ADMIN_FIELDS_RELATIONS_LISTFIELD_LABEL" label="COM_COMPONENTBUILDER_ADMIN_FIELDS_RELATIONS_LISTFIELD_LABEL"
description="COM_COMPONENTBUILDER_ADMIN_FIELDS_RELATIONS_LISTFIELD_DESCRIPTION" description="COM_COMPONENTBUILDER_ADMIN_FIELDS_RELATIONS_LISTFIELD_DESCRIPTION"
class="fieldMedium" class="fieldLarge"
multiple="false" multiple="false"
default="" default=""
required="true" required="true"
@ -130,7 +130,7 @@
size="50" size="50"
maxlength="50" maxlength="50"
default="Default" default="Default"
class="text_area" class="text_area fieldLarge"
filter="STRING" filter="STRING"
message="COM_COMPONENTBUILDER_ADMIN_FIELDS_RELATIONS_COLUMN_NAME_MESSAGE" message="COM_COMPONENTBUILDER_ADMIN_FIELDS_RELATIONS_COLUMN_NAME_MESSAGE"
hint="COM_COMPONENTBUILDER_ADMIN_FIELDS_RELATIONS_COLUMN_NAME_HINT" hint="COM_COMPONENTBUILDER_ADMIN_FIELDS_RELATIONS_COLUMN_NAME_HINT"
@ -142,9 +142,8 @@
name="joinfields" name="joinfields"
label="COM_COMPONENTBUILDER_ADMIN_FIELDS_RELATIONS_JOINFIELDS_LABEL" label="COM_COMPONENTBUILDER_ADMIN_FIELDS_RELATIONS_JOINFIELDS_LABEL"
description="COM_COMPONENTBUILDER_ADMIN_FIELDS_RELATIONS_JOINFIELDS_DESCRIPTION" description="COM_COMPONENTBUILDER_ADMIN_FIELDS_RELATIONS_JOINFIELDS_DESCRIPTION"
class="fieldMedium" class="fieldLarge"
multiple="true" multiple="true"
default=""
onchange="getCodeGlueOptions(this)" onchange="getCodeGlueOptions(this)"
button="false" button="false"
/> />
@ -153,7 +152,7 @@
type="list" type="list"
name="area" name="area"
label="COM_COMPONENTBUILDER_ADMIN_FIELDS_RELATIONS_AREA_LABEL" label="COM_COMPONENTBUILDER_ADMIN_FIELDS_RELATIONS_AREA_LABEL"
class="list_class" class="list_class fieldLarge"
multiple="false" multiple="false"
validate="int" validate="int"
default="1" default="1"
@ -171,7 +170,7 @@
type="list" type="list"
name="join_type" name="join_type"
label="COM_COMPONENTBUILDER_ADMIN_FIELDS_RELATIONS_JOIN_TYPE_LABEL" label="COM_COMPONENTBUILDER_ADMIN_FIELDS_RELATIONS_JOIN_TYPE_LABEL"
class="list_class" class="list_class fieldLarge"
multiple="false" multiple="false"
validate="int" validate="int"
default="1" default="1"

View File

@ -455,7 +455,7 @@
size="40" size="40"
maxlength="150" maxlength="150"
description="COM_COMPONENTBUILDER_DYNAMIC_GET_JOIN_FIELD_DESCRIPTION" description="COM_COMPONENTBUILDER_DYNAMIC_GET_JOIN_FIELD_DESCRIPTION"
class="text_area fieldMedium" class="text_area fieldLarge"
readonly="false" readonly="false"
disabled="false" disabled="false"
required="true" required="true"
@ -954,8 +954,7 @@
class="list_class" class="list_class"
multiple="false" multiple="false"
filter="WORD" filter="WORD"
required="true" required="true">
default="">
<!-- Option Set. --> <!-- Option Set. -->
<option value="ASC"> <option value="ASC">
COM_COMPONENTBUILDER_DYNAMIC_GET_ASCENDING</option> COM_COMPONENTBUILDER_DYNAMIC_GET_ASCENDING</option>
@ -1431,7 +1430,7 @@
size="40" size="40"
maxlength="150" maxlength="150"
description="COM_COMPONENTBUILDER_DYNAMIC_GET_JOIN_FIELD_DESCRIPTION" description="COM_COMPONENTBUILDER_DYNAMIC_GET_JOIN_FIELD_DESCRIPTION"
class="text_area fieldMedium" class="text_area fieldLarge"
readonly="false" readonly="false"
disabled="false" disabled="false"
required="true" required="true"

View File

@ -209,7 +209,7 @@
type="subform" type="subform"
name="addconditions" name="addconditions"
label="COM_COMPONENTBUILDER_LIBRARY_ADDCONDITIONS_LABEL" label="COM_COMPONENTBUILDER_LIBRARY_ADDCONDITIONS_LABEL"
layout="joomla.form.field.subform.repeatable-table" layout="joomla.form.field.subform.repeatable"
multiple="true" multiple="true"
description="COM_COMPONENTBUILDER_LIBRARY_ADDCONDITIONS_DESCRIPTION" description="COM_COMPONENTBUILDER_LIBRARY_ADDCONDITIONS_DESCRIPTION"
default="" default=""
@ -221,7 +221,7 @@
name="file" name="file"
label="COM_COMPONENTBUILDER_LIBRARY_FILE_LABEL" label="COM_COMPONENTBUILDER_LIBRARY_FILE_LABEL"
description="COM_COMPONENTBUILDER_LIBRARY_FILE_DESCRIPTION" description="COM_COMPONENTBUILDER_LIBRARY_FILE_DESCRIPTION"
class="list_class" class="list_class fieldLarge"
multiple="true" multiple="true"
default="0" default="0"
required="true" required="true"
@ -233,7 +233,7 @@
name="target_behavior" name="target_behavior"
label="COM_COMPONENTBUILDER_LIBRARY_TARGET_BEHAVIOR_LABEL" label="COM_COMPONENTBUILDER_LIBRARY_TARGET_BEHAVIOR_LABEL"
description="COM_COMPONENTBUILDER_LIBRARY_TARGET_BEHAVIOR_DESCRIPTION" description="COM_COMPONENTBUILDER_LIBRARY_TARGET_BEHAVIOR_DESCRIPTION"
class="list_class" class="list_class fieldLarge"
multiple="false" multiple="false"
filter="INT" filter="INT"
required="true" required="true"
@ -250,7 +250,7 @@
name="target_relation" name="target_relation"
label="COM_COMPONENTBUILDER_LIBRARY_TARGET_RELATION_LABEL" label="COM_COMPONENTBUILDER_LIBRARY_TARGET_RELATION_LABEL"
description="COM_COMPONENTBUILDER_LIBRARY_TARGET_RELATION_DESCRIPTION" description="COM_COMPONENTBUILDER_LIBRARY_TARGET_RELATION_DESCRIPTION"
class="list_class" class="list_class fieldLarge"
multiple="false" multiple="false"
filter="INT" filter="INT"
required="true" required="true"
@ -267,6 +267,7 @@
name="option_field" name="option_field"
label="COM_COMPONENTBUILDER_LIBRARY_OPTION_FIELD_LABEL" label="COM_COMPONENTBUILDER_LIBRARY_OPTION_FIELD_LABEL"
description="COM_COMPONENTBUILDER_LIBRARY_OPTION_FIELD_DESCRIPTION" description="COM_COMPONENTBUILDER_LIBRARY_OPTION_FIELD_DESCRIPTION"
class="list_class fieldLarge"
multiple="false" multiple="false"
required="true" required="true"
button="false" button="false"
@ -277,7 +278,7 @@
name="option_behaviour" name="option_behaviour"
label="COM_COMPONENTBUILDER_LIBRARY_OPTION_BEHAVIOUR_LABEL" label="COM_COMPONENTBUILDER_LIBRARY_OPTION_BEHAVIOUR_LABEL"
description="COM_COMPONENTBUILDER_LIBRARY_OPTION_BEHAVIOUR_DESCRIPTION" description="COM_COMPONENTBUILDER_LIBRARY_OPTION_BEHAVIOUR_DESCRIPTION"
class="list_class" class="list_class fieldLarge"
multiple="false" multiple="false"
filter="INT" filter="INT"
required="true" required="true"

View File

@ -12,6 +12,8 @@
// 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\Utilities\ArrayHelper;
/** /**
* Componentbuilder Model for Get_snippets * Componentbuilder Model for Get_snippets
*/ */

View File

@ -13,6 +13,8 @@
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
use Joomla\Registry\Registry; use Joomla\Registry\Registry;
use Joomla\String\StringHelper;
use Joomla\Utilities\ArrayHelper;
/** /**
* Componentbuilder Help_document Model * Componentbuilder Help_document Model
@ -440,7 +442,7 @@ class ComponentbuilderModelHelp_document extends JModelAdmin
* *
* @since 3.0 * @since 3.0
*/ */
protected function getUniqeFields() protected function getUniqueFields()
{ {
return false; return false;
} }
@ -499,7 +501,7 @@ class ComponentbuilderModelHelp_document extends JModelAdmin
{ {
// Sanitize ids. // Sanitize ids.
$pks = array_unique($pks); $pks = array_unique($pks);
JArrayHelper::toInteger($pks); ArrayHelper::toInteger($pks);
// Remove any values of zero. // Remove any values of zero.
if (array_search(0, $pks, true)) if (array_search(0, $pks, true))
@ -540,7 +542,7 @@ class ComponentbuilderModelHelp_document extends JModelAdmin
if (!empty($commands['move_copy'])) if (!empty($commands['move_copy']))
{ {
$cmd = JArrayHelper::getValue($commands, 'move_copy', 'c'); $cmd = ArrayHelper::getValue($commands, 'move_copy', 'c');
if ($cmd == 'c') if ($cmd == 'c')
{ {
@ -607,8 +609,8 @@ class ComponentbuilderModelHelp_document extends JModelAdmin
return false; return false;
} }
// get list of uniqe fields // get list of unique fields
$uniqeFields = $this->getUniqeFields(); $uniqueFields = $this->getUniqueFields();
// remove move_copy from array // remove move_copy from array
unset($values['move_copy']); unset($values['move_copy']);
@ -669,12 +671,12 @@ class ComponentbuilderModelHelp_document extends JModelAdmin
} }
} }
// update all uniqe fields // update all unique fields
if (ComponentbuilderHelper::checkArray($uniqeFields)) if (ComponentbuilderHelper::checkArray($uniqueFields))
{ {
foreach ($uniqeFields as $uniqeField) foreach ($uniqueFields as $uniqueField)
{ {
$this->table->$uniqeField = $this->generateUniqe($uniqeField,$this->table->$uniqeField); $this->table->$uniqueField = $this->generateUnique($uniqueField,$this->table->$uniqueField);
} }
} }
@ -917,16 +919,16 @@ class ComponentbuilderModelHelp_document extends JModelAdmin
} }
} }
// Alter the uniqe field for save as copy // Alter the unique field for save as copy
if ($input->get('task') === 'save2copy') if ($input->get('task') === 'save2copy')
{ {
// Automatic handling of other uniqe fields // Automatic handling of other unique fields
$uniqeFields = $this->getUniqeFields(); $uniqueFields = $this->getUniqueFields();
if (ComponentbuilderHelper::checkArray($uniqeFields)) if (ComponentbuilderHelper::checkArray($uniqueFields))
{ {
foreach ($uniqeFields as $uniqeField) foreach ($uniqueFields as $uniqueField)
{ {
$data[$uniqeField] = $this->generateUniqe($uniqeField,$data[$uniqeField]); $data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]);
} }
} }
} }
@ -939,7 +941,7 @@ class ComponentbuilderModelHelp_document extends JModelAdmin
} }
/** /**
* Method to generate a uniqe value. * Method to generate a unique value.
* *
* @param string $field name. * @param string $field name.
* @param string $value data. * @param string $value data.
@ -948,15 +950,15 @@ class ComponentbuilderModelHelp_document extends JModelAdmin
* *
* @since 3.0 * @since 3.0
*/ */
protected function generateUniqe($field,$value) protected function generateUnique($field,$value)
{ {
// set field value uniqe // set field value unique
$table = $this->getTable(); $table = $this->getTable();
while ($table->load(array($field => $value))) while ($table->load(array($field => $value)))
{ {
$value = JString::increment($value); $value = StringHelper::increment($value);
} }
return $value; return $value;
@ -984,15 +986,15 @@ class ComponentbuilderModelHelp_document extends JModelAdmin
{ {
foreach($title as $nr => &$_title) foreach($title as $nr => &$_title)
{ {
$_title = JString::increment($_title); $_title = StringHelper::increment($_title);
} }
} }
// Make sure we have a title // Make sure we have a title
elseif ($title) elseif ($title)
{ {
$title = JString::increment($title); $title = StringHelper::increment($title);
} }
$alias = JString::increment($alias, 'dash'); $alias = StringHelper::increment($alias, 'dash');
} }
// Check if this is an array of titles // Check if this is an array of titles
if (ComponentbuilderHelper::checkArray($title)) if (ComponentbuilderHelper::checkArray($title))

View File

@ -12,6 +12,8 @@
// 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\Utilities\ArrayHelper;
/** /**
* Help_documents Model * Help_documents Model
*/ */
@ -30,8 +32,8 @@ class ComponentbuilderModelHelp_documents extends JModelList
'a.title','title', 'a.title','title',
'a.type','type', 'a.type','type',
'a.location','location', 'a.location','location',
'a.admin_view','admin_view', 'g.',
'a.site_view','site_view' 'h.'
); );
} }
@ -256,7 +258,7 @@ class ComponentbuilderModelHelp_documents extends JModelList
// Add the list ordering clause. // Add the list ordering clause.
$orderCol = $this->state->get('list.ordering', 'a.id'); $orderCol = $this->state->get('list.ordering', 'a.id');
$orderDirn = $this->state->get('list.direction', 'asc'); $orderDirn = $this->state->get('list.direction', 'asc');
if ($orderCol != '') if ($orderCol != '')
{ {
$query->order($db->escape($orderCol . ' ' . $orderDirn)); $query->order($db->escape($orderCol . ' ' . $orderDirn));

View File

@ -13,6 +13,8 @@
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
use Joomla\Registry\Registry; use Joomla\Registry\Registry;
use Joomla\String\StringHelper;
use Joomla\Utilities\ArrayHelper;
/** /**
* Componentbuilder Joomla_component Model * Componentbuilder Joomla_component Model
@ -903,9 +905,9 @@ class ComponentbuilderModelJoomla_component extends JModelAdmin
* *
* @since 3.0 * @since 3.0
*/ */
protected function getUniqeFields() protected function getUniqueFields()
{ {
return false; return array('guid');
} }
/** /**
@ -1020,7 +1022,7 @@ class ComponentbuilderModelJoomla_component extends JModelAdmin
{ {
// Sanitize ids. // Sanitize ids.
$pks = array_unique($pks); $pks = array_unique($pks);
JArrayHelper::toInteger($pks); ArrayHelper::toInteger($pks);
// Remove any values of zero. // Remove any values of zero.
if (array_search(0, $pks, true)) if (array_search(0, $pks, true))
@ -1061,7 +1063,7 @@ class ComponentbuilderModelJoomla_component extends JModelAdmin
if (!empty($commands['move_copy'])) if (!empty($commands['move_copy']))
{ {
$cmd = JArrayHelper::getValue($commands, 'move_copy', 'c'); $cmd = ArrayHelper::getValue($commands, 'move_copy', 'c');
if ($cmd == 'c') if ($cmd == 'c')
{ {
@ -1128,8 +1130,8 @@ class ComponentbuilderModelJoomla_component extends JModelAdmin
return false; return false;
} }
// get list of uniqe fields // get list of unique fields
$uniqeFields = $this->getUniqeFields(); $uniqueFields = $this->getUniqueFields();
// remove move_copy from array // remove move_copy from array
unset($values['move_copy']); unset($values['move_copy']);
@ -1180,7 +1182,7 @@ class ComponentbuilderModelJoomla_component extends JModelAdmin
// Only for strings // Only for strings
if (ComponentbuilderHelper::checkString($this->table->system_name) && !is_numeric($this->table->system_name)) if (ComponentbuilderHelper::checkString($this->table->system_name) && !is_numeric($this->table->system_name))
{ {
$this->table->system_name = $this->generateUniqe('system_name',$this->table->system_name); $this->table->system_name = $this->generateUnique('system_name',$this->table->system_name);
} }
// insert all set values // insert all set values
@ -1195,12 +1197,12 @@ class ComponentbuilderModelJoomla_component extends JModelAdmin
} }
} }
// update all uniqe fields // update all unique fields
if (ComponentbuilderHelper::checkArray($uniqeFields)) if (ComponentbuilderHelper::checkArray($uniqueFields))
{ {
foreach ($uniqeFields as $uniqeField) foreach ($uniqueFields as $uniqueField)
{ {
$this->table->$uniqeField = $this->generateUniqe($uniqeField,$this->table->$uniqeField); $this->table->$uniqueField = $this->generateUnique($uniqueField,$this->table->$uniqueField);
} }
} }
@ -1553,16 +1555,16 @@ class ComponentbuilderModelJoomla_component extends JModelAdmin
$data['params'] = (string) $params; $data['params'] = (string) $params;
} }
// Alter the uniqe field for save as copy // Alter the unique field for save as copy
if ($input->get('task') === 'save2copy') if ($input->get('task') === 'save2copy')
{ {
// Automatic handling of other uniqe fields // Automatic handling of other unique fields
$uniqeFields = $this->getUniqeFields(); $uniqueFields = $this->getUniqueFields();
if (ComponentbuilderHelper::checkArray($uniqeFields)) if (ComponentbuilderHelper::checkArray($uniqueFields))
{ {
foreach ($uniqeFields as $uniqeField) foreach ($uniqueFields as $uniqueField)
{ {
$data[$uniqeField] = $this->generateUniqe($uniqeField,$data[$uniqeField]); $data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]);
} }
} }
} }
@ -1575,7 +1577,7 @@ class ComponentbuilderModelJoomla_component extends JModelAdmin
} }
/** /**
* Method to generate a uniqe value. * Method to generate a unique value.
* *
* @param string $field name. * @param string $field name.
* @param string $value data. * @param string $value data.
@ -1584,15 +1586,15 @@ class ComponentbuilderModelJoomla_component extends JModelAdmin
* *
* @since 3.0 * @since 3.0
*/ */
protected function generateUniqe($field,$value) protected function generateUnique($field,$value)
{ {
// set field value uniqe // set field value unique
$table = $this->getTable(); $table = $this->getTable();
while ($table->load(array($field => $value))) while ($table->load(array($field => $value)))
{ {
$value = JString::increment($value); $value = StringHelper::increment($value);
} }
return $value; return $value;
@ -1614,7 +1616,7 @@ class ComponentbuilderModelJoomla_component extends JModelAdmin
while ($table->load(array('title' => $title))) while ($table->load(array('title' => $title)))
{ {
$title = JString::increment($title); $title = StringHelper::increment($title);
} }
return $title; return $title;

View File

@ -12,6 +12,8 @@
// 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\Utilities\ArrayHelper;
/** /**
* Joomla_components Model * Joomla_components Model
*/ */
@ -2230,7 +2232,7 @@ class ComponentbuilderModelJoomla_components extends JModelList
// Add the list ordering clause. // Add the list ordering clause.
$orderCol = $this->state->get('list.ordering', 'a.id'); $orderCol = $this->state->get('list.ordering', 'a.id');
$orderDirn = $this->state->get('list.direction', 'asc'); $orderDirn = $this->state->get('list.direction', 'DESC');
if ($orderCol != '') if ($orderCol != '')
{ {
$query->order($db->escape($orderCol . ' ' . $orderDirn)); $query->order($db->escape($orderCol . ' ' . $orderDirn));
@ -2277,7 +2279,7 @@ class ComponentbuilderModelJoomla_components extends JModelList
} }
// Order the results by ordering // Order the results by ordering
$query->order('a.ordering ASC'); $query->order('a.id DESC');
// Load the items // Load the items
$db->setQuery($query); $db->setQuery($query);

View File

@ -13,6 +13,8 @@
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
use Joomla\Registry\Registry; use Joomla\Registry\Registry;
use Joomla\String\StringHelper;
use Joomla\Utilities\ArrayHelper;
/** /**
* Componentbuilder Joomla_module Model * Componentbuilder Joomla_module Model
@ -723,9 +725,9 @@ class ComponentbuilderModelJoomla_module extends JModelAdmin
* *
* @since 3.0 * @since 3.0
*/ */
protected function getUniqeFields() protected function getUniqueFields()
{ {
return false; return array('guid');
} }
/** /**
@ -826,7 +828,7 @@ class ComponentbuilderModelJoomla_module extends JModelAdmin
{ {
// Sanitize ids. // Sanitize ids.
$pks = array_unique($pks); $pks = array_unique($pks);
JArrayHelper::toInteger($pks); ArrayHelper::toInteger($pks);
// Remove any values of zero. // Remove any values of zero.
if (array_search(0, $pks, true)) if (array_search(0, $pks, true))
@ -867,7 +869,7 @@ class ComponentbuilderModelJoomla_module extends JModelAdmin
if (!empty($commands['move_copy'])) if (!empty($commands['move_copy']))
{ {
$cmd = JArrayHelper::getValue($commands, 'move_copy', 'c'); $cmd = ArrayHelper::getValue($commands, 'move_copy', 'c');
if ($cmd == 'c') if ($cmd == 'c')
{ {
@ -934,8 +936,8 @@ class ComponentbuilderModelJoomla_module extends JModelAdmin
return false; return false;
} }
// get list of uniqe fields // get list of unique fields
$uniqeFields = $this->getUniqeFields(); $uniqueFields = $this->getUniqueFields();
// remove move_copy from array // remove move_copy from array
unset($values['move_copy']); unset($values['move_copy']);
@ -986,7 +988,7 @@ class ComponentbuilderModelJoomla_module extends JModelAdmin
// Only for strings // Only for strings
if (ComponentbuilderHelper::checkString($this->table->system_name) && !is_numeric($this->table->system_name)) if (ComponentbuilderHelper::checkString($this->table->system_name) && !is_numeric($this->table->system_name))
{ {
$this->table->system_name = $this->generateUniqe('system_name',$this->table->system_name); $this->table->system_name = $this->generateUnique('system_name',$this->table->system_name);
} }
// insert all set values // insert all set values
@ -1001,12 +1003,12 @@ class ComponentbuilderModelJoomla_module extends JModelAdmin
} }
} }
// update all uniqe fields // update all unique fields
if (ComponentbuilderHelper::checkArray($uniqeFields)) if (ComponentbuilderHelper::checkArray($uniqueFields))
{ {
foreach ($uniqeFields as $uniqeField) foreach ($uniqueFields as $uniqueField)
{ {
$this->table->$uniqeField = $this->generateUniqe($uniqeField,$this->table->$uniqeField); $this->table->$uniqueField = $this->generateUnique($uniqueField,$this->table->$uniqueField);
} }
} }
@ -1334,16 +1336,16 @@ class ComponentbuilderModelJoomla_module extends JModelAdmin
$data['params'] = (string) $params; $data['params'] = (string) $params;
} }
// Alter the uniqe field for save as copy // Alter the unique field for save as copy
if ($input->get('task') === 'save2copy') if ($input->get('task') === 'save2copy')
{ {
// Automatic handling of other uniqe fields // Automatic handling of other unique fields
$uniqeFields = $this->getUniqeFields(); $uniqueFields = $this->getUniqueFields();
if (ComponentbuilderHelper::checkArray($uniqeFields)) if (ComponentbuilderHelper::checkArray($uniqueFields))
{ {
foreach ($uniqeFields as $uniqeField) foreach ($uniqueFields as $uniqueField)
{ {
$data[$uniqeField] = $this->generateUniqe($uniqeField,$data[$uniqeField]); $data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]);
} }
} }
} }
@ -1356,7 +1358,7 @@ class ComponentbuilderModelJoomla_module extends JModelAdmin
} }
/** /**
* Method to generate a uniqe value. * Method to generate a unique value.
* *
* @param string $field name. * @param string $field name.
* @param string $value data. * @param string $value data.
@ -1365,15 +1367,15 @@ class ComponentbuilderModelJoomla_module extends JModelAdmin
* *
* @since 3.0 * @since 3.0
*/ */
protected function generateUniqe($field,$value) protected function generateUnique($field,$value)
{ {
// set field value uniqe // set field value unique
$table = $this->getTable(); $table = $this->getTable();
while ($table->load(array($field => $value))) while ($table->load(array($field => $value)))
{ {
$value = JString::increment($value); $value = StringHelper::increment($value);
} }
return $value; return $value;
@ -1395,7 +1397,7 @@ class ComponentbuilderModelJoomla_module extends JModelAdmin
while ($table->load(array('title' => $title))) while ($table->load(array('title' => $title)))
{ {
$title = JString::increment($title); $title = StringHelper::increment($title);
} }
return $title; return $title;

View File

@ -13,6 +13,8 @@
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
use Joomla\Registry\Registry; use Joomla\Registry\Registry;
use Joomla\String\StringHelper;
use Joomla\Utilities\ArrayHelper;
/** /**
* Componentbuilder Joomla_module_files_folders_urls Model * Componentbuilder Joomla_module_files_folders_urls Model
@ -438,7 +440,7 @@ class ComponentbuilderModelJoomla_module_files_folders_urls extends JModelAdmin
* *
* @since 3.0 * @since 3.0
*/ */
protected function getUniqeFields() protected function getUniqueFields()
{ {
return false; return false;
} }
@ -497,7 +499,7 @@ class ComponentbuilderModelJoomla_module_files_folders_urls extends JModelAdmin
{ {
// Sanitize ids. // Sanitize ids.
$pks = array_unique($pks); $pks = array_unique($pks);
JArrayHelper::toInteger($pks); ArrayHelper::toInteger($pks);
// Remove any values of zero. // Remove any values of zero.
if (array_search(0, $pks, true)) if (array_search(0, $pks, true))
@ -538,7 +540,7 @@ class ComponentbuilderModelJoomla_module_files_folders_urls extends JModelAdmin
if (!empty($commands['move_copy'])) if (!empty($commands['move_copy']))
{ {
$cmd = JArrayHelper::getValue($commands, 'move_copy', 'c'); $cmd = ArrayHelper::getValue($commands, 'move_copy', 'c');
if ($cmd == 'c') if ($cmd == 'c')
{ {
@ -605,8 +607,8 @@ class ComponentbuilderModelJoomla_module_files_folders_urls extends JModelAdmin
return false; return false;
} }
// get list of uniqe fields // get list of unique fields
$uniqeFields = $this->getUniqeFields(); $uniqueFields = $this->getUniqueFields();
// remove move_copy from array // remove move_copy from array
unset($values['move_copy']); unset($values['move_copy']);
@ -657,7 +659,7 @@ class ComponentbuilderModelJoomla_module_files_folders_urls extends JModelAdmin
// Only for strings // Only for strings
if (ComponentbuilderHelper::checkString($this->table->joomla_module) && !is_numeric($this->table->joomla_module)) if (ComponentbuilderHelper::checkString($this->table->joomla_module) && !is_numeric($this->table->joomla_module))
{ {
$this->table->joomla_module = $this->generateUniqe('joomla_module',$this->table->joomla_module); $this->table->joomla_module = $this->generateUnique('joomla_module',$this->table->joomla_module);
} }
// insert all set values // insert all set values
@ -672,12 +674,12 @@ class ComponentbuilderModelJoomla_module_files_folders_urls extends JModelAdmin
} }
} }
// update all uniqe fields // update all unique fields
if (ComponentbuilderHelper::checkArray($uniqeFields)) if (ComponentbuilderHelper::checkArray($uniqueFields))
{ {
foreach ($uniqeFields as $uniqeField) foreach ($uniqueFields as $uniqueField)
{ {
$this->table->$uniqeField = $this->generateUniqe($uniqeField,$this->table->$uniqeField); $this->table->$uniqueField = $this->generateUnique($uniqueField,$this->table->$uniqueField);
} }
} }
@ -926,16 +928,16 @@ class ComponentbuilderModelJoomla_module_files_folders_urls extends JModelAdmin
$data['params'] = (string) $params; $data['params'] = (string) $params;
} }
// Alter the uniqe field for save as copy // Alter the unique field for save as copy
if ($input->get('task') === 'save2copy') if ($input->get('task') === 'save2copy')
{ {
// Automatic handling of other uniqe fields // Automatic handling of other unique fields
$uniqeFields = $this->getUniqeFields(); $uniqueFields = $this->getUniqueFields();
if (ComponentbuilderHelper::checkArray($uniqeFields)) if (ComponentbuilderHelper::checkArray($uniqueFields))
{ {
foreach ($uniqeFields as $uniqeField) foreach ($uniqueFields as $uniqueField)
{ {
$data[$uniqeField] = $this->generateUniqe($uniqeField,$data[$uniqeField]); $data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]);
} }
} }
} }
@ -948,7 +950,7 @@ class ComponentbuilderModelJoomla_module_files_folders_urls extends JModelAdmin
} }
/** /**
* Method to generate a uniqe value. * Method to generate a unique value.
* *
* @param string $field name. * @param string $field name.
* @param string $value data. * @param string $value data.
@ -957,15 +959,15 @@ class ComponentbuilderModelJoomla_module_files_folders_urls extends JModelAdmin
* *
* @since 3.0 * @since 3.0
*/ */
protected function generateUniqe($field,$value) protected function generateUnique($field,$value)
{ {
// set field value uniqe // set field value unique
$table = $this->getTable(); $table = $this->getTable();
while ($table->load(array($field => $value))) while ($table->load(array($field => $value)))
{ {
$value = JString::increment($value); $value = StringHelper::increment($value);
} }
return $value; return $value;
@ -987,7 +989,7 @@ class ComponentbuilderModelJoomla_module_files_folders_urls extends JModelAdmin
while ($table->load(array('title' => $title))) while ($table->load(array('title' => $title)))
{ {
$title = JString::increment($title); $title = StringHelper::increment($title);
} }
return $title; return $title;

Some files were not shown because too many files have changed in this diff Show More