Added InoDB options, Expanded the Custom Field #350

Merged
Llewellyn merged 13 commits from staging into master 2018-10-07 19:47:50 +00:00
9 changed files with 349 additions and 252 deletions
Showing only changes of commit 1447e06dd7 - Show all commits

View File

@ -125,11 +125,11 @@ Watch the [proposed development workflow](https://vdm.bz/proposed-development-wo
+ *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 September, 2018
+ *Last Build*: 28th September, 2018
+ *Version*: 2.9.6
+ *Copyright*: Copyright (C) 2015 - 2018 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **195608**
+ *Line count*: **195702**
+ *Field count*: **1087**
+ *File count*: **1278**
+ *Folder count*: **201**

View File

@ -125,11 +125,11 @@ Watch the [proposed development workflow](https://vdm.bz/proposed-development-wo
+ *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 September, 2018
+ *Last Build*: 28th September, 2018
+ *Version*: 2.9.6
+ *Copyright*: Copyright (C) 2015 - 2018 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **195608**
+ *Line count*: **195702**
+ *Field count*: **1087**
+ *File count*: **1278**
+ *Folder count*: **201**

View File

@ -2036,6 +2036,10 @@ abstract class ComponentbuilderHelper
**/
public static function set($key, $value)
{
if (!isset(self::$session) || !self::checkObject(self::$session))
{
self::$session = JFactory::getSession();
}
// set to local memory to speed up program
self::$localSession[$key] = $value;
// load to session for later use
@ -2047,6 +2051,10 @@ abstract class ComponentbuilderHelper
**/
public static function get($key, $default = null)
{
if (!isset(self::$session) || !self::checkObject(self::$session))
{
self::$session = JFactory::getSession();
}
// check if in local memory
if (!isset(self::$localSession[$key]))
{

View File

@ -3688,22 +3688,25 @@ COM_COMPONENTBUILDER_CUSTOM_CODE_NOTE_PLACEHOLDERS_EXPLAINED_DESCRIPTION="<div c
<p><b><span class='placeholder-key-id'>x</span> is the ID of the code in the system don&apos;t change it when you edit the code in your IDE outside of JCB!</b></p>
</div>
<div class='span6' id='usedin' style='display: none;'>
<h1>USED IN</h1>
<div id='before-usedin'>Soon as enough data is available we will display all the areas where this code is used.</div>
<div id='usedin-a' style='display: none;'><h2>Components</h2><div id='area-a'></div></div>
<div id='usedin-b' style='display:none;'><h2>Admin Views</h2><div id='area-b'></div></div>
<div id='usedin-c' style='display:none;'><h2>Custom Admin Views</h2><div id='area-c'></div></div>
<div id='usedin-d' style='display:none;'><h2>Site Views</h2><div id='area-d'></div></div>
<div id='usedin-e' style='display:none;'><h2>Fields</h2><div id='area-e'></div></div>
<div id='usedin-f' style='display:none;'><h2>Dynamic Gets</h2><div id='area-f'></div></div>
<div id='usedin-g' style='display:none;'><h2>Templates</h2><div id='area-g'></div></div>
<div id='usedin-h' style='display:none;'><h2>Layouts</h2><div id='area-h'></div></div>
<div id='usedin-i' style='display:none;'><h2>Component Dashboards</h2><div id='area-i'></div></div>
<div id='usedin-j' style='display:none;'><h2>Libraries</h2><div id='area-j'></div></div>
<div id='usedin-b' style='display:none;'><h2>Component Dashboard</h2><div id='area-b'></div></div>
<div id='usedin-c' style='display:none;'><h2>Admin Views</h2><div id='area-c'></div></div>
<div id='usedin-d' style='display:none;'><h2>Admin Fields Relations</h2><div id='area-d'></div></div>
<div id='usedin-e' style='display:none;'><h2>Custom Admin Views</h2><div id='area-e'></div></div>
<div id='usedin-f' style='display:none;'><h2>Site Views</h2><div id='area-r'></div></div>
<div id='usedin-g' style='display:none;'><h2>Fields</h2><div id='area-g'></div></div>
<div id='usedin-h' style='display:none;'><h2>Fieldtypes</h2><div id='area-h'></div></div>
<div id='usedin-i' style='display:none;'><h2>Dynamic Gets</h2><div id='area-i'></div></div>
<div id='usedin-j' style='display:none;'><h2>Templates</h2><div id='area-j'></div></div>
<div id='usedin-k' style='display:none;'><h2>Layouts</h2><div id='area-k'></div></div>
<div id='usedin-l' style='display:none;'><h2>Libraries</h2><div id='area-l'></div></div>
<div id='loading-usedin' style='display: none;'><h2>Scanning Database<span class='loading-dots'>..</span></h2></div>
<div id='note-usedin-found' style='display: none;'><small>You can edit the above areas where this code is used.</small></div>
<div id='note-usedin-not' style='display: none;'><small>This code is not used in any area of the JCB custom code blocks at this time.</small></div>
</div></div>"
</div>"
COM_COMPONENTBUILDER_CUSTOM_CODE_NOTE_PLACEHOLDERS_EXPLAINED_LABEL="Information Area."
COM_COMPONENTBUILDER_CUSTOM_CODE_NOT_REQUIRED="Not Required"
COM_COMPONENTBUILDER_CUSTOM_CODE_ORDERING_LABEL="Ordering"

View File

@ -2065,7 +2065,33 @@ class ComponentbuilderModelAjax extends JModelList
{
if (!isset($target['not_base64'][$key]))
{
$value = base64_decode($value);
$value = ComponentbuilderHelper::openValidBase64($value, null);
}
elseif ('json' === $target['not_base64'][$key] && 'xml' === $key) // just for field search
{
$value = json_decode($value);
}
// check if we should search for base64 string inside the text
if (isset($target['base64_search']) && isset($target['base64_search'][$key])
&& isset($target['base64_search'][$key]['start']) && strpos($value, $target['base64_search'][$key]['start']) !== false)
{
// first get the start property (if dynamic)
if (isset($target['base64_search'][$key]['_start']))
{
$_start_property = $target['base64_search'][$key]['start'];
$_start_property .= ComponentbuilderHelper::getBetween($value, $target['base64_search'][$key]['start'], $target['base64_search'][$key]['_start']);
$_start_property .= $target['base64_search'][$key]['_start'];
}
else
{
$_start_property = $target['base64_search'][$key]['start'];
}
// get the base64 string
$_base64 = ComponentbuilderHelper::getBetween($value, $_start_property, $target['base64_search'][$key]['end']);
// now open the base64 text
$_tmp = ComponentbuilderHelper::openValidBase64($_base64);
// insert it back into the value (so we still search the whole string)
$value = str_replace($_base64, $_tmp, $value);
}
// check if place holder set
if (strpos($value, '[CUSTOMC' . 'ODE=' . (string) $functioName . ']') !== false || strpos($value, '[CUSTOMC' . 'ODE=' . (int) $id . ']') !== false ||
@ -2089,7 +2115,7 @@ class ComponentbuilderModelAjax extends JModelList
$usedin = array();
foreach ($bucket as $editId => $values)
{
$usedin[] = '<a href="index.php?option=com_componentbuilder&ref=custom_code&refid=' . (int) $id . '&view=' . $target['view'] . '&task=' . $target['table'] . '.edit&id=' . (int) $editId . '">' . $values['name'] . '</a> (' . implode(', ', $values['fields']) . ')';
$usedin[] = '<a href="index.php?option=com_componentbuilder&ref=custom_code&refid=' . (int) $id . '&view=' . $target['views'] . '&task=' . $target['table'] . '.edit&id=' . (int) $editId . '">' . $values['name'] . '</a> (' . implode(', ', $values['fields']) . ')';
}
$html = '<ul><li>' . implode('</li><li>', $usedin) . '</li></ul>';
return array('in' => $html, 'id' => $targeting);
@ -2099,6 +2125,111 @@ class ComponentbuilderModelAjax extends JModelList
return false;
}
/**
* The code search keys/targets
*
* @var array
*/
protected $codeSearchKeys = array(
// #__componentbuilder_joomla_component
'joomla_component' => array(
'search' => array('id', 'system_name', 'php_preflight_install','php_postflight_install',
'php_preflight_update','php_postflight_update','php_method_uninstall',
'php_helper_admin','php_admin_event','php_helper_both','php_helper_site',
'php_site_event','javascript'),
'views' => 'joomla_components',
'not_base64' => array(),
'name' => 'system_name'
),
// #__componentbuilder_component_dashboard
'component_dashboard' => array(
'search' => array('id', 'joomla_component', 'php_dashboard_methods','dashboard_tab'),
'views' => 'components_dashboard',
'not_base64' => array('dashboard_tab' => 'json'),
'name' => 'joomla_component->id:joomla_component.system_name'
),
// #__componentbuilder_admin_view
'admin_view' => array(
'search' => array('id', 'system_name', 'javascript_view_file','javascript_view_footer',
'javascript_views_file','javascript_views_footer','html_import_view',
'php_after_delete','php_after_publish','php_ajaxmethod','php_allowedit','php_batchcopy',
'php_batchmove','php_before_delete','php_before_publish','php_before_save','php_controller',
'php_controller_list','php_document','php_getitem','php_getitems','php_getitems_after_all',
'php_getlistquery','php_import','php_import_display','php_import_ext','php_import_headers','php_getform',
'php_import_save','php_import_setdata','php_model','php_model_list','php_postsavehook','php_save'),
'views' => 'admin_views',
'not_base64' => array(),
'name' => 'system_name'
),
// #__componentbuilder_admin_fields_relations
'admin_fields_relations' => array(
'search' => array('id', 'admin_view', 'addrelations'),
'views' => 'admins_fields_relations',
'not_base64' => array('addrelations' => 'json'),
'name' => 'admin_view->id:admin_view.system_name'
),
// #__componentbuilder_custom_admin_view
'custom_admin_view' => array(
'search' => array('id', 'system_name', 'default','php_view','php_jview','php_jview_display','php_document',
'js_document','css_document','css','php_ajaxmethod','php_model','php_controller'),
'views' => 'custom_admin_views',
'not_base64' => array(),
'name' => 'system_name'
),
// #__componentbuilder_site_view
'site_view' => array(
'search' => array('id', 'system_name', 'default','php_view','php_jview','php_jview_display','php_document',
'js_document','css_document','css','php_ajaxmethod','php_model','php_controller'),
'views' => 'site_views',
'not_base64' => array(),
'name' => 'system_name'
),
// #__componentbuilder_field
'field' => array(
'search' => array('id', 'name', 'xml','javascript_view_footer','javascript_views_footer'),
'views' => 'fields',
'not_base64' => array('xml' => 'json'),
'base64_search' => array('xml' => array('start' => 'type_php', '_start' => '="', 'end' => '"')),
'name' => 'name'
),
// #__componentbuilder_fieldtype
'fieldtype' => array(
'search' => array('id', 'name', 'properties'),
'views' => 'fieldtypes',
'not_base64' => array('properties' => 'json'),
'name' => 'name'
),
// #__componentbuilder_dynamic_get
'dynamic_get' => array(
'search' => array('id', 'name', 'php_before_getitem','php_after_getitem','php_before_getitems','php_after_getitems',
'php_getlistquery'),
'views' => 'dynamic_gets',
'not_base64' => array(),
'name' => 'name'
),
// #__componentbuilder_template
'template' => array(
'search' => array('id', 'name', 'php_view','template'),
'views' => 'templates',
'not_base64' => array(),
'name' => 'name'
),
// #__componentbuilder_layout
'layout' => array(
'search' => array('id', 'name', 'php_view','layout'),
'views' => 'layouts',
'not_base64' => array(),
'name' => 'name'
),
// #__componentbuilder_library
'library' => array(
'search' => array('id', 'name', 'php_setdocument'),
'views' => 'libraries',
'not_base64' => array(),
'name' => 'name'
)
);
/**
* Get the keys of the values to search custom code in
*
@ -2113,136 +2244,44 @@ class ComponentbuilderModelAjax extends JModelList
// set the template if type is query
if ('query' === $type)
{
$tables = array(
'a' => 'joomla_component',
'b' => 'admin_view',
'c' => 'custom_admin_view',
'd' => 'site_view',
'e' => 'field',
'f' => 'dynamic_get',
'g' => 'template',
'h' => 'layout',
'i' => 'component_dashboard',
'j' => 'library',
);
// setup the tables
$tables = array();
$key = 'a';
foreach (array_keys($this->codeSearchKeys) as $table)
{
$tables[$key] = $table;
$key++;
}
// check if we have a match
if (isset($tables[$target]))
{
$target = $tables[$target];
}
}
// start target arrays
$targets = array();
// #__componentbuilder_joomla_component
$targets['joomla_component'] = array();
$targets['joomla_component']['search'] = array('id', 'system_name', 'php_preflight_install','php_postflight_install',
'php_preflight_update','php_postflight_update','php_method_uninstall',
'php_helper_admin','php_admin_event','php_helper_both','php_helper_site',
'php_site_event','javascript');
$targets['joomla_component']['view'] = 'joomla_components';
$targets['joomla_component']['not_base64'] = array();
$targets['joomla_component']['name'] = 'system_name';
// #__componentbuilder_component_dashboard
$targets['component_dashboard'] = array();
$targets['component_dashboard']['search'] = array('id', 'joomla_component', 'php_dashboard_methods','dashboard_tab');
$targets['component_dashboard']['view'] = 'components_dashboard';
$targets['component_dashboard']['not_base64'] = array('dashboard_tab' => 'json');
$targets['component_dashboard']['name'] = 'joomla_component->id:joomla_component.system_name';
// #__componentbuilder_admin_view
$targets['admin_view'] = array();
$targets['admin_view']['search'] = array('id', 'system_name', 'javascript_view_file','javascript_view_footer',
'javascript_views_file','javascript_views_footer','html_import_view',
'php_after_delete','php_after_publish','php_ajaxmethod','php_allowedit','php_batchcopy',
'php_batchmove','php_before_delete','php_before_publish','php_before_save','php_controller',
'php_controller_list','php_document','php_getitem','php_getitems','php_getitems_after_all',
'php_getlistquery','php_import','php_import_display','php_import_ext','php_import_headers','php_getform',
'php_import_save','php_import_setdata','php_model','php_model_list','php_postsavehook','php_save');
$targets['admin_view']['view'] = 'admin_views';
$targets['admin_view']['not_base64'] = array();
$targets['admin_view']['name'] = 'system_name';
// #__componentbuilder_admin_fields_relations
$targets['library'] = array();
$targets['library']['search'] = array('id', 'admin_view', 'addrelations');
$targets['library']['view'] = 'admin_fields_relations';
$targets['library']['not_base64'] = array('addrelations' => 'json');
$targets['library']['name'] = 'admin_view->id:admin_view.system_name';
// #__componentbuilder_custom_admin_view
$targets['custom_admin_view'] = array();
$targets['custom_admin_view']['search'] = array('id', 'system_name', 'default','php_view','php_jview','php_jview_display','php_document',
'js_document','css_document','css','php_ajaxmethod','php_model','php_controller');
$targets['custom_admin_view']['view'] = 'custom_admin_views';
$targets['custom_admin_view']['not_base64'] = array();
$targets['custom_admin_view']['name'] = 'system_name';
// #__componentbuilder_site_view
$targets['site_view'] = array();
$targets['site_view']['search'] = array('id', 'system_name', 'default','php_view','php_jview','php_jview_display','php_document',
'js_document','css_document','css','php_ajaxmethod','php_model','php_controller');
$targets['site_view']['view'] = 'site_views';
$targets['site_view']['not_base64'] = array();
$targets['site_view']['name'] = 'system_name';
// #__componentbuilder_field
$targets['field'] = array();
$targets['field']['search'] = array('id', 'name', 'xml','javascript_view_footer','javascript_views_footer');
$targets['field']['view'] = 'fields';
$targets['field']['not_base64'] = array('xml' => 'json');
$targets['field']['name'] = 'name';
// #__componentbuilder_dynamic_get
$targets['dynamic_get'] = array();
$targets['dynamic_get']['search'] = array('id', 'name', 'php_before_getitem','php_after_getitem','php_before_getitems','php_after_getitems',
'php_getlistquery');
$targets['dynamic_get']['view'] = 'dynamic_gets';
$targets['dynamic_get']['not_base64'] = array();
$targets['dynamic_get']['name'] = 'name';
// #__componentbuilder_template
$targets['template'] = array();
$targets['template']['search'] = array('id', 'name', 'php_view','template');
$targets['template']['view'] = 'templates';
$targets['template']['not_base64'] = array();
$targets['template']['name'] = 'name';
// #__componentbuilder_layout
$targets['layout'] = array();
$targets['layout']['search'] = array('id', 'name', 'php_view','layout');
$targets['layout']['view'] = 'layouts';
$targets['layout']['not_base64'] = array();
$targets['layout']['name'] = 'name';
// #__componentbuilder_library
$targets['library'] = array();
$targets['library']['search'] = array('id', 'name', 'php_setdocument');
$targets['library']['view'] = 'libraries';
$targets['library']['not_base64'] = array();
$targets['library']['name'] = 'name';
// return result ready for a.query
if ('query' === $type && isset($targets[$target]))
if ('query' === $type && isset($this->codeSearchKeys[$target]))
{
// set the targets
$codeSearchTarget = $this->codeSearchKeys[$target];
// add the .a to the selection array
$targets[$target]['select'] = array_map( function($select) { return 'a.'.$select; }, $targets[$target]['search']);
$codeSearchTarget['select'] = array_map( function($select) { return 'a.' . $select; }, $codeSearchTarget['search']);
// also set the table
$targets[$target]['table'] = $target;
$codeSearchTarget['table'] = $target;
// remove search
unset($targets[$target]['search']);
// return
return $targets[$target];
unset($codeSearchTarget['search']);
// return targeted array to use in query
return $codeSearchTarget;
}
// return the query string to search
elseif (isset($targets[$target]))
// does the target exist
elseif (isset($this->codeSearchKeys[$target]))
{
// remove name and id
return $targets[$target];
// return target array values to use in search
return $this->codeSearchKeys[$target];
}
return false;
}
// Used in validation_rule
public function getExistingValidationRuleCode($name)
{

View File

@ -237,14 +237,14 @@ function setCustomCodePlaceholder() {
var ide = jQuery('#jform_id').val();
var functioName = jQuery('#jform_function_name').val();
if (ide > 0 && functioName.length > 2) {
jQuery('#jcb-placeholder').html('<code>[CUSTO'+'MCODE='+ide+']</code> or <code>[CUSTO'+'MCODE='+functioName+']</code>');
jQuery('#jcb-placeholder-arg').html('<code>[CUSTO'+'MCODE='+ide+'&#43;value1,value2]</code> or <code>[CUSTO'+'MCODE='+functioName+'&#43;value1,value2]</code>');
jQuery('#jcb-placeholder').html('<code>[CUSTO'+'MCODE='+functioName+']</code>');
jQuery('#jcb-placeholder-arg').html('<code>[CUSTO'+'MCODE='+functioName+'&#43;value1,value2]</code>');
} else if (ide > 0){
jQuery('#jcb-placeholder').html('<code>[CUSTO'+'MCODE='+ide+']</code> or <code>[not ready]</code>');
jQuery('#jcb-placeholder-arg').html('<code>[CUSTO'+'MCODE='+ide+'&#43;value1,value2]</code> or <code>[not ready]</code>');
jQuery('#jcb-placeholder').html('<code>[not ready]</code>');
jQuery('#jcb-placeholder-arg').html('<code>[not ready]</code>');
} else if (functioName.length > 2) {
jQuery('#jcb-placeholder').html('<code>[save to see]</code> or <code>[CUSTO'+'MCODE='+functioName+']</code>');
jQuery('#jcb-placeholder-arg').html('<code>[save to see]</code> or <code>[CUSTO'+'MCODE='+functioName+'&#43;value1,value2]</code>');
jQuery('#jcb-placeholder').html('<code><code>[CUSTO'+'MCODE='+functioName+']</code>');
jQuery('#jcb-placeholder-arg').html('<code>[CUSTO'+'MCODE='+functioName+'&#43;value1,value2]</code>');
} else {
jQuery('#jcb-placeholder').html('<code>[save to see]</code>');
jQuery('#jcb-placeholder-arg').html('<code>[save to see]</code>');
@ -308,7 +308,7 @@ function usedin(functioName, ide) {
jQuery('#note-usedin-not').hide();
jQuery('#note-usedin-found').hide();
jQuery('#loading-usedin').show();
var targets = ['a','b','c','d','e','f','g','h','i','j'];
var targets = ['a','b','c','d','e','f','g','h','i','j','k','l']; // if you update this, also update [customcode-codeUsedInHtmlNote]!
var run = 0;
var usedinChecker = setInterval(function(){
var target = targets[run];

View File

@ -1383,12 +1383,38 @@ class ComponentbuilderModelJoomla_components extends JModelList
}
elseif (!isset($keys['not_base64'][$key]))
{
$value = base64_decode($item->{$key});
$value = ComponentbuilderHelper::openValidBase64($item->{$key}, null);
}
elseif ('json' === $target['not_base64'][$key] && 'xml' === $key) // just for field search
{
$value = json_decode($item->{$key});
}
else
{
$value = $item->{$key};
}
// check if we should search for base64 string inside the text
if (isset($target['base64_search']) && isset($target['base64_search'][$key])
&& isset($target['base64_search'][$key]['start']) && strpos($value, $target['base64_search'][$key]['start']) !== false)
{
// first get the start property (if dynamic)
if (isset($target['base64_search'][$key]['_start']))
{
$_start_property = $target['base64_search'][$key]['start'];
$_start_property .= ComponentbuilderHelper::getBetween($value, $target['base64_search'][$key]['start'], $target['base64_search'][$key]['_start']);
$_start_property .= $target['base64_search'][$key]['_start'];
}
else
{
$_start_property = $target['base64_search'][$key]['start'];
}
// get the base64 string
$_base64 = ComponentbuilderHelper::getBetween($value, $_start_property, $target['base64_search'][$key]['end']);
// now open the base64 text
$_tmp = ComponentbuilderHelper::openValidBase64($_base64);
// insert it back into the value (so we still search the whole string)
$value = str_replace($_base64, $_tmp, $value);
}
// search the value to see if it has custom code
$codeArray = ComponentbuilderHelper::getAllBetween($value, '[CUSTOMC' . 'ODE=',']');
if (ComponentbuilderHelper::checkArray($codeArray))
@ -1546,6 +1572,111 @@ class ComponentbuilderModelJoomla_components extends JModelList
return str_replace(array_keys(ComponentbuilderHelper::$constantPaths), array_values(ComponentbuilderHelper::$constantPaths), $path);
}
/**
* The code search keys/targets
*
* @var array
*/
protected $codeSearchKeys = array(
// #__componentbuilder_joomla_component
'joomla_component' => array(
'search' => array('id', 'system_name', 'php_preflight_install','php_postflight_install',
'php_preflight_update','php_postflight_update','php_method_uninstall',
'php_helper_admin','php_admin_event','php_helper_both','php_helper_site',
'php_site_event','javascript'),
'views' => 'joomla_components',
'not_base64' => array(),
'name' => 'system_name'
),
// #__componentbuilder_component_dashboard
'component_dashboard' => array(
'search' => array('id', 'joomla_component', 'php_dashboard_methods','dashboard_tab'),
'views' => 'components_dashboard',
'not_base64' => array('dashboard_tab' => 'json'),
'name' => 'joomla_component->id:joomla_component.system_name'
),
// #__componentbuilder_admin_view
'admin_view' => array(
'search' => array('id', 'system_name', 'javascript_view_file','javascript_view_footer',
'javascript_views_file','javascript_views_footer','html_import_view',
'php_after_delete','php_after_publish','php_ajaxmethod','php_allowedit','php_batchcopy',
'php_batchmove','php_before_delete','php_before_publish','php_before_save','php_controller',
'php_controller_list','php_document','php_getitem','php_getitems','php_getitems_after_all',
'php_getlistquery','php_import','php_import_display','php_import_ext','php_import_headers','php_getform',
'php_import_save','php_import_setdata','php_model','php_model_list','php_postsavehook','php_save'),
'views' => 'admin_views',
'not_base64' => array(),
'name' => 'system_name'
),
// #__componentbuilder_admin_fields_relations
'admin_fields_relations' => array(
'search' => array('id', 'admin_view', 'addrelations'),
'views' => 'admins_fields_relations',
'not_base64' => array('addrelations' => 'json'),
'name' => 'admin_view->id:admin_view.system_name'
),
// #__componentbuilder_custom_admin_view
'custom_admin_view' => array(
'search' => array('id', 'system_name', 'default','php_view','php_jview','php_jview_display','php_document',
'js_document','css_document','css','php_ajaxmethod','php_model','php_controller'),
'views' => 'custom_admin_views',
'not_base64' => array(),
'name' => 'system_name'
),
// #__componentbuilder_site_view
'site_view' => array(
'search' => array('id', 'system_name', 'default','php_view','php_jview','php_jview_display','php_document',
'js_document','css_document','css','php_ajaxmethod','php_model','php_controller'),
'views' => 'site_views',
'not_base64' => array(),
'name' => 'system_name'
),
// #__componentbuilder_field
'field' => array(
'search' => array('id', 'name', 'xml','javascript_view_footer','javascript_views_footer'),
'views' => 'fields',
'not_base64' => array('xml' => 'json'),
'base64_search' => array('xml' => array('start' => 'type_php', '_start' => '="', 'end' => '"')),
'name' => 'name'
),
// #__componentbuilder_fieldtype
'fieldtype' => array(
'search' => array('id', 'name', 'properties'),
'views' => 'fieldtypes',
'not_base64' => array('properties' => 'json'),
'name' => 'name'
),
// #__componentbuilder_dynamic_get
'dynamic_get' => array(
'search' => array('id', 'name', 'php_before_getitem','php_after_getitem','php_before_getitems','php_after_getitems',
'php_getlistquery'),
'views' => 'dynamic_gets',
'not_base64' => array(),
'name' => 'name'
),
// #__componentbuilder_template
'template' => array(
'search' => array('id', 'name', 'php_view','template'),
'views' => 'templates',
'not_base64' => array(),
'name' => 'name'
),
// #__componentbuilder_layout
'layout' => array(
'search' => array('id', 'name', 'php_view','layout'),
'views' => 'layouts',
'not_base64' => array(),
'name' => 'name'
),
// #__componentbuilder_library
'library' => array(
'search' => array('id', 'name', 'php_setdocument'),
'views' => 'libraries',
'not_base64' => array(),
'name' => 'name'
)
);
/**
* Get the keys of the values to search custom code in
*
@ -1560,136 +1691,44 @@ class ComponentbuilderModelJoomla_components extends JModelList
// set the template if type is query
if ('query' === $type)
{
$tables = array(
'a' => 'joomla_component',
'b' => 'admin_view',
'c' => 'custom_admin_view',
'd' => 'site_view',
'e' => 'field',
'f' => 'dynamic_get',
'g' => 'template',
'h' => 'layout',
'i' => 'component_dashboard',
'j' => 'library',
);
// setup the tables
$tables = array();
$key = 'a';
foreach (array_keys($this->codeSearchKeys) as $table)
{
$tables[$key] = $table;
$key++;
}
// check if we have a match
if (isset($tables[$target]))
{
$target = $tables[$target];
}
}
// start target arrays
$targets = array();
// #__componentbuilder_joomla_component
$targets['joomla_component'] = array();
$targets['joomla_component']['search'] = array('id', 'system_name', 'php_preflight_install','php_postflight_install',
'php_preflight_update','php_postflight_update','php_method_uninstall',
'php_helper_admin','php_admin_event','php_helper_both','php_helper_site',
'php_site_event','javascript');
$targets['joomla_component']['view'] = 'joomla_components';
$targets['joomla_component']['not_base64'] = array();
$targets['joomla_component']['name'] = 'system_name';
// #__componentbuilder_component_dashboard
$targets['component_dashboard'] = array();
$targets['component_dashboard']['search'] = array('id', 'joomla_component', 'php_dashboard_methods','dashboard_tab');
$targets['component_dashboard']['view'] = 'components_dashboard';
$targets['component_dashboard']['not_base64'] = array('dashboard_tab' => 'json');
$targets['component_dashboard']['name'] = 'joomla_component->id:joomla_component.system_name';
// #__componentbuilder_admin_view
$targets['admin_view'] = array();
$targets['admin_view']['search'] = array('id', 'system_name', 'javascript_view_file','javascript_view_footer',
'javascript_views_file','javascript_views_footer','html_import_view',
'php_after_delete','php_after_publish','php_ajaxmethod','php_allowedit','php_batchcopy',
'php_batchmove','php_before_delete','php_before_publish','php_before_save','php_controller',
'php_controller_list','php_document','php_getitem','php_getitems','php_getitems_after_all',
'php_getlistquery','php_import','php_import_display','php_import_ext','php_import_headers','php_getform',
'php_import_save','php_import_setdata','php_model','php_model_list','php_postsavehook','php_save');
$targets['admin_view']['view'] = 'admin_views';
$targets['admin_view']['not_base64'] = array();
$targets['admin_view']['name'] = 'system_name';
// #__componentbuilder_admin_fields_relations
$targets['library'] = array();
$targets['library']['search'] = array('id', 'admin_view', 'addrelations');
$targets['library']['view'] = 'admin_fields_relations';
$targets['library']['not_base64'] = array('addrelations' => 'json');
$targets['library']['name'] = 'admin_view->id:admin_view.system_name';
// #__componentbuilder_custom_admin_view
$targets['custom_admin_view'] = array();
$targets['custom_admin_view']['search'] = array('id', 'system_name', 'default','php_view','php_jview','php_jview_display','php_document',
'js_document','css_document','css','php_ajaxmethod','php_model','php_controller');
$targets['custom_admin_view']['view'] = 'custom_admin_views';
$targets['custom_admin_view']['not_base64'] = array();
$targets['custom_admin_view']['name'] = 'system_name';
// #__componentbuilder_site_view
$targets['site_view'] = array();
$targets['site_view']['search'] = array('id', 'system_name', 'default','php_view','php_jview','php_jview_display','php_document',
'js_document','css_document','css','php_ajaxmethod','php_model','php_controller');
$targets['site_view']['view'] = 'site_views';
$targets['site_view']['not_base64'] = array();
$targets['site_view']['name'] = 'system_name';
// #__componentbuilder_field
$targets['field'] = array();
$targets['field']['search'] = array('id', 'name', 'xml','javascript_view_footer','javascript_views_footer');
$targets['field']['view'] = 'fields';
$targets['field']['not_base64'] = array('xml' => 'json');
$targets['field']['name'] = 'name';
// #__componentbuilder_dynamic_get
$targets['dynamic_get'] = array();
$targets['dynamic_get']['search'] = array('id', 'name', 'php_before_getitem','php_after_getitem','php_before_getitems','php_after_getitems',
'php_getlistquery');
$targets['dynamic_get']['view'] = 'dynamic_gets';
$targets['dynamic_get']['not_base64'] = array();
$targets['dynamic_get']['name'] = 'name';
// #__componentbuilder_template
$targets['template'] = array();
$targets['template']['search'] = array('id', 'name', 'php_view','template');
$targets['template']['view'] = 'templates';
$targets['template']['not_base64'] = array();
$targets['template']['name'] = 'name';
// #__componentbuilder_layout
$targets['layout'] = array();
$targets['layout']['search'] = array('id', 'name', 'php_view','layout');
$targets['layout']['view'] = 'layouts';
$targets['layout']['not_base64'] = array();
$targets['layout']['name'] = 'name';
// #__componentbuilder_library
$targets['library'] = array();
$targets['library']['search'] = array('id', 'name', 'php_setdocument');
$targets['library']['view'] = 'libraries';
$targets['library']['not_base64'] = array();
$targets['library']['name'] = 'name';
// return result ready for a.query
if ('query' === $type && isset($targets[$target]))
if ('query' === $type && isset($this->codeSearchKeys[$target]))
{
// set the targets
$codeSearchTarget = $this->codeSearchKeys[$target];
// add the .a to the selection array
$targets[$target]['select'] = array_map( function($select) { return 'a.'.$select; }, $targets[$target]['search']);
$codeSearchTarget['select'] = array_map( function($select) { return 'a.' . $select; }, $codeSearchTarget['search']);
// also set the table
$targets[$target]['table'] = $target;
$codeSearchTarget['table'] = $target;
// remove search
unset($targets[$target]['search']);
// return
return $targets[$target];
unset($codeSearchTarget['search']);
// return targeted array to use in query
return $codeSearchTarget;
}
// return the query string to search
elseif (isset($targets[$target]))
// does the target exist
elseif (isset($this->codeSearchKeys[$target]))
{
// remove name and id
return $targets[$target];
// return target array values to use in search
return $this->codeSearchKeys[$target];
}
return false;
}
/**
* Method to auto-populate the model state.
*

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 September, 2018</creationDate>
<creationDate>28th September, 2018</creationDate>
<author>Llewellyn van der Merwe</author>
<authorEmail>llewellyn@joomlacomponentbuilder.com</authorEmail>
<authorUrl>http://www.joomlacomponentbuilder.com</authorUrl>

View File

@ -2036,6 +2036,10 @@ abstract class ComponentbuilderHelper
**/
public static function set($key, $value)
{
if (!isset(self::$session) || !self::checkObject(self::$session))
{
self::$session = JFactory::getSession();
}
// set to local memory to speed up program
self::$localSession[$key] = $value;
// load to session for later use
@ -2047,6 +2051,10 @@ abstract class ComponentbuilderHelper
**/
public static function get($key, $default = null)
{
if (!isset(self::$session) || !self::checkObject(self::$session))
{
self::$session = JFactory::getSession();
}
// check if in local memory
if (!isset(self::$localSession[$key]))
{