Fixed JCB package export to catch layouts in admin view custom code areas.

This commit is contained in:
Llewellyn van der Merwe 2021-05-17 05:57:02 +02:00
parent 30ff3fd2bd
commit 0f00ff90ed
Signed by: Llewellyn
GPG Key ID: EFC0C720A240551C
5 changed files with 65 additions and 16 deletions

View File

@ -143,11 +143,11 @@ TODO
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
+ *First Build*: 30th April, 2015
+ *Last Build*: 26th April, 2021
+ *Last Build*: 17th May, 2021
+ *Version*: 2.12.9
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **292188**
+ *Line count*: **292237**
+ *Field count*: **1629**
+ *File count*: **1935**
+ *Folder count*: **322**

View File

@ -143,11 +143,11 @@ TODO
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
+ *First Build*: 30th April, 2015
+ *Last Build*: 26th April, 2021
+ *Last Build*: 17th May, 2021
+ *Version*: 2.12.9
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **292188**
+ *Line count*: **292237**
+ *Field count*: **1629**
+ *File count*: **1935**
+ *Folder count*: **322**

View File

@ -1116,7 +1116,7 @@ abstract class ComponentbuilderHelper
{
// we must first store the current woking directory
$joomla = getcwd();
// we are changing the working directory to the componet path
// we are changing the working directory to the component path
chdir($folder);
// make sure we have file type filter
if (self::checkArray($fileTypes))

View File

@ -678,14 +678,56 @@ class ComponentbuilderModelJoomla_components extends JModelList
$this->_db->execute();
if ($this->_db->getNumRows())
{
// get the items
$items = $this->_db->loadObjectList();
// reset the search array (only search for template/layouts)
$searchTLArray = array();
// check if we have items
if (ComponentbuilderHelper::checkArray($items))
{
// set search array
// set search array if site/custom admin view
if ('site_view' === $table || 'custom_admin_view' === $table)
{
$searchArray = array('php_view', 'php_jview', 'php_jview_display', 'php_document', 'js_document', 'css_document', 'css');
$searchTLArray = array(
'default' => 'force_it',
'php_view' => 'add_php_view',
'php_jview' => 'add_php_jview',
'php_jview_display' => 'add_php_jview_display',
'php_document' => 'add_php_document',
'javascript_file' => 'add_javascript_file',
'js_document' => 'add_js_document',
'css_document' => 'add_css_document',
'css' => 'add_css'
);
}
// set search array if admin view
if ('admin_view' === $table)
{
$searchTLArray = array(
'php_getitem' => 'add_php_getitem',
'php_before_save' => 'add_php_before_save',
'php_save' => 'add_php_save',
'php_getform' => 'add_php_getform',
'php_postsavehook' => 'add_php_postsavehook',
'php_getitems' => 'add_php_getitems',
'php_getitems_after_all' => 'add_php_getitems_after_all',
'php_getlistquery' => 'add_php_getlistquery',
'php_allowadd' => 'add_php_allowadd',
'php_allowedit' => 'add_php_allowedit',
'php_before_cancel' => 'add_php_before_cancel',
'php_after_cancel' => 'add_php_after_cancel',
'php_before_delete' => 'add_php_before_delete',
'php_after_delete' => 'add_php_after_delete',
'php_before_publish' => 'add_php_before_publish',
'php_after_publish' => 'add_php_after_publish',
'php_batchcopy' => 'add_php_batchcopy',
'php_batchmove' => 'add_php_batchmove',
'php_document' => 'add_php_document',
'php_model' => 'add_custom_button',
'php_controller' => 'add_custom_button',
'php_model_list' => 'add_custom_button',
'php_controller_list' => 'add_custom_button'
);
}
// reset the global array
if ('template' === $table)
@ -913,19 +955,21 @@ class ComponentbuilderModelJoomla_components extends JModelList
}
}
}
// actions to take if table is site_view and custom_admin_view
if ('site_view' === $table || 'custom_admin_view' === $table)
{
// search for templates & layouts
$this->getTemplateLayout(base64_decode($item->default));
// check if a search is required
if (isset($searchTLArray) && ComponentbuilderHelper::checkArray($searchTLArray)){
// add search array templates and layouts
foreach ($searchArray as $scripter)
foreach ($searchTLArray as $scripter => $add)
{
if (isset($item->{'add_'.$scripter}) && $item->{'add_'.$scripter} == 1)
if ($add === 'force_it' || (isset($item->{$add}) && $item->{$add} == 1))
{
$this->getTemplateLayout($item->{$scripter});
}
}
}
// actions to take if table is site_view and custom_admin_view
if ('site_view' === $table || 'custom_admin_view' === $table)
{
// add dynamic gets
$this->setSmartIDs($item->main_get, 'dynamic_get');
$this->setSmartIDs($item->custom_get, 'dynamic_get');
@ -951,7 +995,7 @@ class ComponentbuilderModelJoomla_components extends JModelList
$this->setSmartIDs((int) $item->snippet, 'snippet');
}
// search for templates & layouts
$this->getTemplateLayout(base64_decode($item->$table), $this->user);
$this->getTemplateLayout($item->$table, $this->user);
// add search array templates and layouts
if (isset($item->add_php_view) && $item->add_php_view == 1)
{
@ -1420,6 +1464,11 @@ class ComponentbuilderModelJoomla_components extends JModelList
*/
protected function getTemplateLayout($default, $user = false)
{
// check if we have base64 encoding
if (base64_encode(base64_decode($default, true)) === $default)
{
$default = base64_decode($default);
}
// set the Template data
$temp1 = ComponentbuilderHelper::getAllBetween($default, "\$this->loadTemplate('","')");
$temp2 = ComponentbuilderHelper::getAllBetween($default, '$this->loadTemplate("','")');

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.2" method="upgrade">
<name>COM_COMPONENTBUILDER</name>
<creationDate>26th April, 2021</creationDate>
<creationDate>17th May, 2021</creationDate>
<author>Llewellyn van der Merwe</author>
<authorEmail>llewellyn@joomlacomponentbuilder.com</authorEmail>
<authorUrl>http://www.joomlacomponentbuilder.com</authorUrl>