fixed gh-383 to insure the new button works on frontend/site. Improved the JCB package import to also now import the new placeholder feature values correctly.

This commit is contained in:
Llewellyn van der Merwe 2019-03-04 14:47:28 +02:00
parent 9fcb317275
commit 098c82c222
No known key found for this signature in database
GPG Key ID: CAD7B16D27AF28C5
15 changed files with 176 additions and 49 deletions

View File

@ -146,11 +146,11 @@ 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 February, 2019 + *Last Build*: 4th March, 2019
+ *Version*: 2.9.13 + *Version*: 2.9.13
+ *Copyright*: Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + *Copyright*: Copyright (C) 2015 - 2019 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*: **203476** + *Line count*: **203595**
+ *Field count*: **1114** + *Field count*: **1114**
+ *File count*: **1337** + *File count*: **1337**
+ *Folder count*: **209** + *Folder count*: **209**

View File

@ -146,11 +146,11 @@ 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 February, 2019 + *Last Build*: 4th March, 2019
+ *Version*: 2.9.13 + *Version*: 2.9.13
+ *Copyright*: Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + *Copyright*: Copyright (C) 2015 - 2019 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*: **203476** + *Line count*: **203595**
+ *Field count*: **1114** + *Field count*: **1114**
+ *File count*: **1337** + *File count*: **1337**
+ *Folder count*: **209** + *Folder count*: **209**

View File

@ -5,7 +5,7 @@
* @created 30th April, 2015 * @created 30th April, 2015
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com> * @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder> * @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
* @copyright Copyright (C) 2015 - 2018 Vast Development Method. All rights reserved. * @copyright Copyright (C) 2015 - 2019 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
*/ */

View File

@ -5,7 +5,7 @@
* @created 30th April, 2015 * @created 30th April, 2015
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com> * @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder> * @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
* @copyright Copyright (C) 2015 - 2018 Vast Development Method. All rights reserved. * @copyright Copyright (C) 2015 - 2019 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
*/ */

View File

@ -5,7 +5,7 @@
* @created 30th April, 2015 * @created 30th April, 2015
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com> * @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder> * @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
* @copyright Copyright (C) 2015 - 2018 Vast Development Method. All rights reserved. * @copyright Copyright (C) 2015 - 2019 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
*/ */

View File

@ -5,7 +5,7 @@
* @created 30th April, 2015 * @created 30th April, 2015
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com> * @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder> * @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
* @copyright Copyright (C) 2015 - 2018 Vast Development Method. All rights reserved. * @copyright Copyright (C) 2015 - 2019 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
*/ */

View File

@ -5,7 +5,7 @@
* @created 30th April, 2015 * @created 30th April, 2015
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com> * @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder> * @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
* @copyright Copyright (C) 2015 - 2018 Vast Development Method. All rights reserved. * @copyright Copyright (C) 2015 - 2019 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
*/ */
@ -8083,21 +8083,29 @@ class Interpretation extends Fields
$headerscript .= PHP_EOL . '{'; $headerscript .= PHP_EOL . '{';
$headerscript .= PHP_EOL . $this->_t(1) . '$return .= "&return=" . $_return;'; $headerscript .= PHP_EOL . $this->_t(1) . '$return .= "&return=" . $_return;';
$headerscript .= PHP_EOL . '}'; $headerscript .= PHP_EOL . '}';
$headerscript .= PHP_EOL . '//' . $this->setLine(__LINE__) . ' set the referral values'; $headerscript .= PHP_EOL . '//' . $this->setLine(__LINE__) . ' check if return value was set';
$headerscript .= PHP_EOL . '$ref = ($id) ? "&ref=' . $viewName_single . '&refid=" . $id . "&return=" . urlencode(base64_encode($return)) : "";'; $headerscript .= PHP_EOL . 'if (' . $this->fileContentStatic[$this->hhh . 'Component' . $this->hhh] . 'Helper::checkString($return))';
$headerscript .= PHP_EOL . '{';
$headerscript .= PHP_EOL . $this->_t(1) . '//' . $this->setLine(__LINE__) . ' set the referral values';
$headerscript .= PHP_EOL . $this->_t(1) . '$ref = ($id) ? "&ref=' . $viewName_single . '&refid=" . $id . "&return=" . urlencode(base64_encode($return)) : "&return=" . urlencode(base64_encode($return));';
$headerscript .= PHP_EOL . '}';
$headerscript .= PHP_EOL . 'else';
$headerscript .= PHP_EOL . '{';
$headerscript .= PHP_EOL . $this->_t(1) . '$ref = ($id) ? "&ref=' . $viewName_single . '&refid=" . $id : "";';
$headerscript .= PHP_EOL . '}';
if ($addNewButon > 0) if ($addNewButon > 0)
{ {
// add the link for new // add the link for new
if ($addNewButon == 1 || $addNewButon == 2) if ($addNewButon == 1 || $addNewButon == 2)
{ {
$headerscript .= PHP_EOL . '//' . $this->setLine(__LINE__) . ' set the create new URL'; $headerscript .= PHP_EOL . '//' . $this->setLine(__LINE__) . ' set the create new URL';
$headerscript .= PHP_EOL . '$new = "index.php?option=com_' . $this->fileContentStatic[$this->hhh . 'component' . $this->hhh] . '&view=' . $single . '&layout=edit".$ref;'; $headerscript .= PHP_EOL . '$new = "index.php?option=com_' . $this->fileContentStatic[$this->hhh . 'component' . $this->hhh] . '&view=' . $list . '&task=' . $single . '.edit" . $ref;';
} }
// and the link for close and new // and the link for close and new
if ($addNewButon == 2 || $addNewButon == 3) if ($addNewButon == 2 || $addNewButon == 3)
{ {
$headerscript .= PHP_EOL . '//' . $this->setLine(__LINE__) . ' set the create new and close URL'; $headerscript .= PHP_EOL . '//' . $this->setLine(__LINE__) . ' set the create new and close URL';
$headerscript .= PHP_EOL . '$close_new = "index.php?option=com_' . $this->fileContentStatic[$this->hhh . 'component' . $this->hhh] . '&view=' . $single . '&layout=edit";'; $headerscript .= PHP_EOL . '$close_new = "index.php?option=com_' . $this->fileContentStatic[$this->hhh . 'component' . $this->hhh] . '&view=' . $list . '&task=' . $single . '.edit";';
} }
$headerscript .= PHP_EOL . '//' . $this->setLine(__LINE__) . ' load the action object'; $headerscript .= PHP_EOL . '//' . $this->setLine(__LINE__) . ' load the action object';
$headerscript .= PHP_EOL . '$can = ' . $this->fileContentStatic[$this->hhh . 'Component' . $this->hhh] . 'Helper::getActions(' . "'" . $single . "'" . ');'; $headerscript .= PHP_EOL . '$can = ' . $this->fileContentStatic[$this->hhh . 'Component' . $this->hhh] . 'Helper::getActions(' . "'" . $single . "'" . ');';

View File

@ -5,7 +5,7 @@
* @created 30th April, 2015 * @created 30th April, 2015
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com> * @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder> * @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
* @copyright Copyright (C) 2015 - 2018 Vast Development Method. All rights reserved. * @copyright Copyright (C) 2015 - 2019 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
*/ */

View File

@ -1209,7 +1209,7 @@ abstract class ComponentbuilderHelper
'message' => JText::_('COM_COMPONENTBUILDER_SORRY_THIS_PLACEHOLDER_IS_ALREADY_IN_USE'), 'message' => JText::_('COM_COMPONENTBUILDER_SORRY_THIS_PLACEHOLDER_IS_ALREADY_IN_USE'),
'status' => 'danger'); 'status' => 'danger');
} }
return false; return false;
} }
// check if we must return boolean // check if we must return boolean
if (!$bool) if (!$bool)
@ -4080,6 +4080,10 @@ abstract class ComponentbuilderHelper
{ {
$checked_out = (int) $item->checked_out; $checked_out = (int) $item->checked_out;
} }
else
{
$checked_out = self::getVar($view, $item->id, 'id', 'checked_out', '=', str_replace('com_', '', $component));
}
} }
elseif (self::checkArray($item) && isset($item['id'])) elseif (self::checkArray($item) && isset($item['id']))
{ {
@ -4088,6 +4092,14 @@ abstract class ComponentbuilderHelper
{ {
$checked_out = (int) $item['checked_out']; $checked_out = (int) $item['checked_out'];
} }
else
{
$checked_out = self::getVar($view, $item['id'], 'id', 'checked_out', '=', str_replace('com_', '', $component));
}
}
elseif (is_numeric($item) && $item > 0)
{
$checked_out = self::getVar($view, $item, 'id', 'checked_out', '=', str_replace('com_', '', $component));
} }
// set the link title // set the link title
$title = self::safeString(JText::_('COM_COMPONENTBUILDER_EDIT') . ' ' . $view, 'W'); $title = self::safeString(JText::_('COM_COMPONENTBUILDER_EDIT') . ' ' . $view, 'W');
@ -4180,6 +4192,10 @@ abstract class ComponentbuilderHelper
{ {
$checked_out = (int) $item->checked_out; $checked_out = (int) $item->checked_out;
} }
else
{
$checked_out = self::getVar($view, $item->id, 'id', 'checked_out', '=', str_replace('com_', '', $component));
}
} }
elseif (self::checkArray($item) && isset($item['id'])) elseif (self::checkArray($item) && isset($item['id']))
{ {
@ -4188,6 +4204,14 @@ abstract class ComponentbuilderHelper
{ {
$checked_out = (int) $item['checked_out']; $checked_out = (int) $item['checked_out'];
} }
else
{
$checked_out = self::getVar($view, $item['id'], 'id', 'checked_out', '=', str_replace('com_', '', $component));
}
}
elseif (is_numeric($item) && $item > 0)
{
$checked_out = self::getVar($view, $item, 'id', 'checked_out', '=', str_replace('com_', '', $component));
} }
// set the link title // set the link title
$title = self::safeString(JText::_('COM_COMPONENTBUILDER_EDIT') . ' ' . $view, 'W'); $title = self::safeString(JText::_('COM_COMPONENTBUILDER_EDIT') . ' ' . $view, 'W');

View File

@ -26,12 +26,20 @@ if ($_return = $jinput->get('return', null, 'base64'))
{ {
$return .= "&return=" . $_return; $return .= "&return=" . $_return;
} }
// set the referral values // check if return value was set
$ref = ($id) ? "&ref=fieldtype&refid=" . $id . "&return=" . urlencode(base64_encode($return)) : ""; if (ComponentbuilderHelper::checkString($return))
{
// set the referral values
$ref = ($id) ? "&ref=fieldtype&refid=" . $id . "&return=" . urlencode(base64_encode($return)) : "&return=" . urlencode(base64_encode($return));
}
else
{
$ref = ($id) ? "&ref=fieldtype&refid=" . $id : "";
}
// set the create new URL // set the create new URL
$new = "index.php?option=com_componentbuilder&view=field&layout=edit".$ref; $new = "index.php?option=com_componentbuilder&view=fields&task=field.edit" . $ref;
// set the create new and close URL // set the create new and close URL
$close_new = "index.php?option=com_componentbuilder&view=field&layout=edit"; $close_new = "index.php?option=com_componentbuilder&view=fields&task=field.edit";
// load the action object // load the action object
$can = ComponentbuilderHelper::getActions('field'); $can = ComponentbuilderHelper::getActions('field');

View File

@ -26,8 +26,16 @@ if ($_return = $jinput->get('return', null, 'base64'))
{ {
$return .= "&return=" . $_return; $return .= "&return=" . $_return;
} }
// set the referral values // check if return value was set
$ref = ($id) ? "&ref=server&refid=" . $id . "&return=" . urlencode(base64_encode($return)) : ""; if (ComponentbuilderHelper::checkString($return))
{
// set the referral values
$ref = ($id) ? "&ref=server&refid=" . $id . "&return=" . urlencode(base64_encode($return)) : "&return=" . urlencode(base64_encode($return));
}
else
{
$ref = ($id) ? "&ref=server&refid=" . $id : "";
}
?> ?>
<div class="form-vertical"> <div class="form-vertical">

View File

@ -699,7 +699,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
// the array of tables to store // the array of tables to store
$tables = array( $tables = array(
'validation_rule', 'fieldtype', 'field', 'admin_view', 'snippet', 'dynamic_get', 'custom_admin_view', 'site_view', 'validation_rule', 'fieldtype', 'field', 'admin_view', 'snippet', 'dynamic_get', 'custom_admin_view', 'site_view',
'template', 'layout', 'joomla_component', 'language', 'language_translation', 'custom_code', 'template', 'layout', 'joomla_component', 'language', 'language_translation', 'custom_code', 'placeholder',
'admin_fields', 'admin_fields_conditions', 'admin_fields_relations', 'admin_custom_tabs', 'component_admin_views', 'admin_fields', 'admin_fields_conditions', 'admin_fields_relations', 'admin_custom_tabs', 'component_admin_views',
'component_site_views', 'component_custom_admin_views', 'component_updates', 'component_mysql_tweaks', 'component_site_views', 'component_custom_admin_views', 'component_updates', 'component_mysql_tweaks',
'component_custom_admin_menus', 'component_config', 'component_dashboard', 'component_files_folders', 'component_custom_admin_menus', 'component_config', 'component_dashboard', 'component_files_folders',
@ -2746,6 +2746,10 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
$retryAgain = 2; $retryAgain = 2;
} }
break; break;
case 'placeholder':
// search for placeholder (since there should only be one)
$getter = 'target';
break;
case 'custom_code': case 'custom_code':
// search for custom code // search for custom code
$getter = array('comment_type', 'target'); $getter = array('comment_type', 'target');

View File

@ -66,6 +66,8 @@ class ComponentbuilderModelJoomla_components extends JModelList
protected $smartBox = array(); protected $smartBox = array();
protected $smartIDs = array(); protected $smartIDs = array();
protected $customCodeM = array(); protected $customCodeM = array();
protected $placeholderM = array();
protected $placeholderS = array();
protected $fieldTypes = array(); protected $fieldTypes = array();
protected $isMultiple = array(); protected $isMultiple = array();
@ -254,7 +256,9 @@ class ComponentbuilderModelJoomla_components extends JModelList
// component image // component image
$this->moveIt(array($item->image), 'image'); $this->moveIt(array($item->image), 'image');
// set the custom code ID's // set the custom code ID's
$this->setCustomCodeIds($item, 'joomla_component'); $this->setCodePlaceholdersIds($item, 'joomla_component');
// set the placeholder ID's
$this->setCodePlaceholdersIds($item, 'joomla_component', 'placeholder');
// set the language strings for this component // set the language strings for this component
$this->setLanguageTranslation($item->id); $this->setLanguageTranslation($item->id);
// load to global object // load to global object
@ -351,6 +355,11 @@ class ComponentbuilderModelJoomla_components extends JModelList
{ {
$this->setData('custom_code', array_values($this->smartIDs['custom_code']), 'id'); $this->setData('custom_code', array_values($this->smartIDs['custom_code']), 'id');
} }
// add placeholder
if (isset($this->smartIDs['placeholder']) && ComponentbuilderHelper::checkArray($this->smartIDs['placeholder']))
{
$this->setData('placeholder', array_values($this->smartIDs['placeholder']), 'id');
}
// set limiter // set limiter
$limit = 0; $limit = 0;
// and add those custom codes found in custom codes // and add those custom codes found in custom codes
@ -614,10 +623,14 @@ class ComponentbuilderModelJoomla_components extends JModelList
{ {
$this->smartIDs['layout'] = array(); $this->smartIDs['layout'] = array();
} }
elseif ('custom_code' === $table && 'id' === $key) elseif ('custom_code' === $table && 'id' === $key && !isset($this->smartIDs['custom_code']))
{ {
$this->smartIDs['custom_code'] = array(); $this->smartIDs['custom_code'] = array();
} }
elseif ('placeholder' === $table && 'id' === $key && !isset($this->smartIDs['placeholder']))
{
$this->smartIDs['placeholder'] = array();
}
// start loading the data // start loading the data
if (!isset($this->smartBox[$table])) if (!isset($this->smartBox[$table]))
{ {
@ -666,7 +679,9 @@ class ComponentbuilderModelJoomla_components extends JModelList
// load to global object // load to global object
$this->smartBox[$table][$item->id] = $item; $this->smartBox[$table][$item->id] = $item;
// set the custom code ID's // set the custom code ID's
$this->setCustomCodeIds($item, $table); $this->setCodePlaceholdersIds($item, $table);
// set the placeholder ID's
$this->setCodePlaceholdersIds($item, $table, 'placeholder');
// actions to take if table is component_files_folders // actions to take if table is component_files_folders
if ('component_files_folders' === $table && 'clone' !== $this->activeType) if ('component_files_folders' === $table && 'clone' !== $this->activeType)
{ {
@ -866,7 +881,7 @@ class ComponentbuilderModelJoomla_components extends JModelList
// the array of tables to store // the array of tables to store
$tables = array( $tables = array(
'fieldtype', 'field', 'admin_view', 'snippet', 'dynamic_get', 'custom_admin_view', 'site_view', 'fieldtype', 'field', 'admin_view', 'snippet', 'dynamic_get', 'custom_admin_view', 'site_view',
'template', 'layout', 'joomla_component', 'language', 'language_translation', 'custom_code', 'template', 'layout', 'joomla_component', 'language', 'language_translation', 'custom_code', 'placeholder',
'admin_fields', 'admin_fields_conditions', 'admin_fields_relations', 'admin_custom_tabs', 'component_admin_views', 'admin_fields', 'admin_fields_conditions', 'admin_fields_relations', 'admin_custom_tabs', 'component_admin_views',
'component_site_views', 'component_custom_admin_views', 'component_updates', 'component_mysql_tweaks', 'component_site_views', 'component_custom_admin_views', 'component_updates', 'component_mysql_tweaks',
'component_custom_admin_menus', 'component_config', 'component_dashboard', 'component_files_folders', 'component_custom_admin_menus', 'component_config', 'component_dashboard', 'component_files_folders',
@ -1378,15 +1393,16 @@ class ComponentbuilderModelJoomla_components extends JModelList
} }
/** /**
* Set the ids of the found custom code * Set the ids of the found code placeholders
* *
* @param object $item The item being searched * @param object $item The item being searched
* @param string $target The target table * @param string $target The target table
* @param string $type The type of placeholder to search and set
* *
* @return void * @return void
* *
*/ */
protected function setCustomCodeIds($item, $target) protected function setCodePlaceholdersIds($item, $target, $type = 'custom_code')
{ {
if ($keys = $this->getCodeSearchKeys($target)) if ($keys = $this->getCodeSearchKeys($target))
{ {
@ -1415,35 +1431,70 @@ class ComponentbuilderModelJoomla_components extends JModelList
// search and open the base64 strings // search and open the base64 strings
$this->searchOpenBase64($value, $keys['base64_search'][$key]); $this->searchOpenBase64($value, $keys['base64_search'][$key]);
} }
// search the value to see if it has custom code // based on the type of search
$codeArray = ComponentbuilderHelper::getAllBetween($value, '[CUSTOMC' . 'ODE=',']'); if ('custom_code' === $type)
if (ComponentbuilderHelper::checkArray($codeArray))
{ {
foreach ($codeArray as $func) // search the value to see if it has custom code
$codeArray = ComponentbuilderHelper::getAllBetween($value, '[CUSTOMC' . 'ODE=',']');
if (ComponentbuilderHelper::checkArray($codeArray))
{ {
// first make sure we have only the function key foreach ($codeArray as $func)
if (strpos($func, '+') !== false)
{ {
$funcArray = explode('+', $func); // first make sure we have only the function key
$func = $funcArray[0]; if (strpos($func, '+') !== false)
}
if (!isset($this->customCodeM[$func]))
{
$this->customCodeM[$func] = $func;
// if numeric add to ids
if (is_numeric($func))
{ {
$this->setSmartIDs($func, 'custom_code'); $funcArray = explode('+', $func);
$func = $funcArray[0];
} }
elseif (ComponentbuilderHelper::checkString($func)) if (!isset($this->customCodeM[$func]))
{ {
if (($funcID = ComponentbuilderHelper::getVar('custom_code', $func, 'function_name', 'id')) !== false && is_numeric($funcID)) $this->customCodeM[$func] = $func;
// if numeric add to ids
if (is_numeric($func))
{ {
$this->setSmartIDs($funcID, 'custom_code'); $this->setSmartIDs($func, $type);
}
elseif (ComponentbuilderHelper::checkString($func))
{
if (($funcID = ComponentbuilderHelper::getVar($type, $func, 'function_name', 'id')) !== false && is_numeric($funcID))
{
$this->setSmartIDs($funcID, $type);
}
else
{
// set a notice that custom code was not found (weird)
}
}
}
}
}
}
elseif ('placeholder' === $type)
{
// check if we already have the placeholder search array
if (!componentbuilderHelper::checkArray($this->placeholderM) && !componentbuilderHelper::checkArray($this->placeholderS))
{
$this->placeholderS = ComponentbuilderHelper::getVars($type, 1, 'published', 'target');
}
// only continue search if placeholders found
if (componentbuilderHelper::checkArray($this->placeholderS))
{
foreach ($this->placeholderS as $remove => $placeholder)
{
// search the value to see if it has this placeholder and is not already set
if (!isset($this->placeholderM[$placeholder]) && strpos($value, $placeholder) !== false)
{
// add only once
$this->placeholderM[$placeholder] = $placeholder;
unset($this->placeholderS[$remove]);
// get the ID
if (($placeholderID = ComponentbuilderHelper::getVar($type, $placeholder, 'target', 'id')) !== false && is_numeric($placeholderID))
{
$this->setSmartIDs($placeholderID, $type);
} }
else else
{ {
// set a notice that custom code was not found // set a notice that placeholder was not found (weird)
} }
} }
} }

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.2" method="upgrade"> <extension type="component" version="3.2" method="upgrade">
<name>COM_COMPONENTBUILDER</name> <name>COM_COMPONENTBUILDER</name>
<creationDate>23rd February, 2019</creationDate> <creationDate>4th March, 2019</creationDate>
<author>Llewellyn van der Merwe</author> <author>Llewellyn van der Merwe</author>
<authorEmail>llewellyn@joomlacomponentbuilder.com</authorEmail> <authorEmail>llewellyn@joomlacomponentbuilder.com</authorEmail>
<authorUrl>http://www.joomlacomponentbuilder.com</authorUrl> <authorUrl>http://www.joomlacomponentbuilder.com</authorUrl>

View File

@ -1209,7 +1209,7 @@ abstract class ComponentbuilderHelper
'message' => JText::_('COM_COMPONENTBUILDER_SORRY_THIS_PLACEHOLDER_IS_ALREADY_IN_USE'), 'message' => JText::_('COM_COMPONENTBUILDER_SORRY_THIS_PLACEHOLDER_IS_ALREADY_IN_USE'),
'status' => 'danger'); 'status' => 'danger');
} }
return false; return false;
} }
// check if we must return boolean // check if we must return boolean
if (!$bool) if (!$bool)
@ -4080,6 +4080,10 @@ abstract class ComponentbuilderHelper
{ {
$checked_out = (int) $item->checked_out; $checked_out = (int) $item->checked_out;
} }
else
{
$checked_out = self::getVar($view, $item->id, 'id', 'checked_out', '=', str_replace('com_', '', $component));
}
} }
elseif (self::checkArray($item) && isset($item['id'])) elseif (self::checkArray($item) && isset($item['id']))
{ {
@ -4088,6 +4092,14 @@ abstract class ComponentbuilderHelper
{ {
$checked_out = (int) $item['checked_out']; $checked_out = (int) $item['checked_out'];
} }
else
{
$checked_out = self::getVar($view, $item['id'], 'id', 'checked_out', '=', str_replace('com_', '', $component));
}
}
elseif (is_numeric($item) && $item > 0)
{
$checked_out = self::getVar($view, $item, 'id', 'checked_out', '=', str_replace('com_', '', $component));
} }
// set the link title // set the link title
$title = self::safeString(JText::_('COM_COMPONENTBUILDER_EDIT') . ' ' . $view, 'W'); $title = self::safeString(JText::_('COM_COMPONENTBUILDER_EDIT') . ' ' . $view, 'W');
@ -4180,6 +4192,10 @@ abstract class ComponentbuilderHelper
{ {
$checked_out = (int) $item->checked_out; $checked_out = (int) $item->checked_out;
} }
else
{
$checked_out = self::getVar($view, $item->id, 'id', 'checked_out', '=', str_replace('com_', '', $component));
}
} }
elseif (self::checkArray($item) && isset($item['id'])) elseif (self::checkArray($item) && isset($item['id']))
{ {
@ -4188,6 +4204,14 @@ abstract class ComponentbuilderHelper
{ {
$checked_out = (int) $item['checked_out']; $checked_out = (int) $item['checked_out'];
} }
else
{
$checked_out = self::getVar($view, $item['id'], 'id', 'checked_out', '=', str_replace('com_', '', $component));
}
}
elseif (is_numeric($item) && $item > 0)
{
$checked_out = self::getVar($view, $item, 'id', 'checked_out', '=', str_replace('com_', '', $component));
} }
// set the link title // set the link title
$title = self::safeString(JText::_('COM_COMPONENTBUILDER_EDIT') . ' ' . $view, 'W'); $title = self::safeString(JText::_('COM_COMPONENTBUILDER_EDIT') . ' ' . $view, 'W');