forked from joomla/Component-Builder
Update master #1
@ -140,14 +140,14 @@ TODO
|
||||
+ *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io)
|
||||
+ *Name*: [Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
+ *First Build*: 30th April, 2015
|
||||
+ *Last Build*: 4th December, 2022
|
||||
+ *Last Build*: 11th December, 2022
|
||||
+ *Version*: 3.1.13
|
||||
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
|
||||
+ *Line count*: **336766**
|
||||
+ *Line count*: **337314**
|
||||
+ *Field count*: **2009**
|
||||
+ *File count*: **2204**
|
||||
+ *Folder count*: **387**
|
||||
+ *File count*: **2206**
|
||||
+ *Folder count*: **388**
|
||||
|
||||
> This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](https://www.joomlacomponentbuilder.com).
|
||||
> Developed by [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
|
||||
|
@ -140,14 +140,14 @@ TODO
|
||||
+ *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io)
|
||||
+ *Name*: [Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
+ *First Build*: 30th April, 2015
|
||||
+ *Last Build*: 4th December, 2022
|
||||
+ *Last Build*: 11th December, 2022
|
||||
+ *Version*: 3.1.13
|
||||
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
|
||||
+ *Line count*: **336766**
|
||||
+ *Line count*: **337314**
|
||||
+ *Field count*: **2009**
|
||||
+ *File count*: **2204**
|
||||
+ *Folder count*: **387**
|
||||
+ *File count*: **2206**
|
||||
+ *Folder count*: **388**
|
||||
|
||||
> This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](https://www.joomlacomponentbuilder.com).
|
||||
> Developed by [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
|
||||
|
@ -99,7 +99,7 @@ class Compiler extends Infusion
|
||||
$this->repoPath = $this->params->get('git_folder_path', null);
|
||||
}
|
||||
// remove site folder if not needed (TODO add check if custom script was moved to site folder then we must do a more complex cleanup here)
|
||||
if ($this->removeSiteFolder && $this->removeSiteEditFolder)
|
||||
if (CFactory::_('Config')->remove_site_folder && CFactory::_('Config')->remove_site_edit_folder)
|
||||
{
|
||||
// first remove the files and folders
|
||||
$this->removeFolder($this->componentPath . '/site');
|
||||
@ -397,9 +397,9 @@ class Compiler extends Infusion
|
||||
// now we do the dynamic files
|
||||
foreach ($this->newFiles['dynamic'] as $view => $files)
|
||||
{
|
||||
if (isset($this->fileContentDynamic[$view])
|
||||
if (CFactory::_('Content')->exist_($view)
|
||||
&& ArrayHelper::check(
|
||||
$this->fileContentDynamic[$view]
|
||||
CFactory::_('Content')->get_($view)
|
||||
))
|
||||
{
|
||||
foreach ($files as $file)
|
||||
@ -417,7 +417,7 @@ class Compiler extends Infusion
|
||||
}
|
||||
}
|
||||
// free up some memory
|
||||
unset($this->fileContentDynamic[$view]);
|
||||
CFactory::_('Content')->remove_($view);
|
||||
}
|
||||
// free up some memory
|
||||
unset($this->newFiles['dynamic']);
|
||||
@ -498,7 +498,7 @@ class Compiler extends Infusion
|
||||
}
|
||||
// free up some memory
|
||||
unset($this->newFiles[$module->key]);
|
||||
unset($this->fileContentDynamic[$module->key]);
|
||||
CFactory::_('Content')->remove_($module->key);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -579,7 +579,7 @@ class Compiler extends Infusion
|
||||
}
|
||||
// free up some memory
|
||||
unset($this->newFiles[$plugin->key]);
|
||||
unset($this->fileContentDynamic[$plugin->key]);
|
||||
CFactory::_('Content')->remove_($plugin->key);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -607,7 +607,7 @@ class Compiler extends Infusion
|
||||
}
|
||||
// free up some memory
|
||||
unset($this->newFiles[$power->key]);
|
||||
unset($this->fileContentDynamic[$power->key]);
|
||||
CFactory::_('Content')->remove_($power->key);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -661,7 +661,7 @@ class Compiler extends Infusion
|
||||
if ($view)
|
||||
{
|
||||
$answer = CFactory::_('Placeholder')->update(
|
||||
$answer, $this->fileContentDynamic[$view], 3
|
||||
$answer, CFactory::_('Content')->get_($view), 3
|
||||
);
|
||||
}
|
||||
// check if this file needs extra care :)
|
||||
@ -1421,8 +1421,8 @@ class Compiler extends Infusion
|
||||
$target['id']
|
||||
);
|
||||
$data = $placeholder['start'] . PHP_EOL
|
||||
. CFactory::_('Placeholder')->update(
|
||||
$target['code'], CFactory::_('Placeholder')->active
|
||||
. CFactory::_('Placeholder')->update_(
|
||||
$target['code']
|
||||
) . $placeholder['end'] . PHP_EOL;
|
||||
if ($target['type'] == 2)
|
||||
{
|
||||
|
@ -2275,49 +2275,31 @@ class Get
|
||||
CFactory::_('Customcode.Dispenser')->hub['token'][$view->name_single_code]
|
||||
= false;
|
||||
CFactory::_('Customcode.Dispenser')->hub['token'][$view->name_list_code] = false;
|
||||
|
||||
// set some placeholders
|
||||
CFactory::_('Placeholder')->active[Placefix::_h('view')]
|
||||
= $view->name_single_code;
|
||||
CFactory::_('Placeholder')->active[Placefix::_h('views')]
|
||||
= $view->name_list_code;
|
||||
CFactory::_('Placeholder')->active[Placefix::_h('View')]
|
||||
= StringHelper::safe(
|
||||
CFactory::_('Placeholder')->set('view', $view->name_single_code);
|
||||
CFactory::_('Placeholder')->set('views', $view->name_list_code);
|
||||
CFactory::_('Placeholder')->set('View', StringHelper::safe(
|
||||
$view->name_single, 'F'
|
||||
);
|
||||
CFactory::_('Placeholder')->active[Placefix::_h('Views')]
|
||||
= StringHelper::safe(
|
||||
));
|
||||
CFactory::_('Placeholder')->set('Views', StringHelper::safe(
|
||||
$view->name_list, 'F'
|
||||
);
|
||||
CFactory::_('Placeholder')->active[Placefix::_h('VIEW')]
|
||||
= StringHelper::safe(
|
||||
));
|
||||
CFactory::_('Placeholder')->set('VIEW', StringHelper::safe(
|
||||
$view->name_single, 'U'
|
||||
);
|
||||
CFactory::_('Placeholder')->active[Placefix::_h('VIEWS')]
|
||||
= StringHelper::safe(
|
||||
));
|
||||
CFactory::_('Placeholder')->set('VIEWS', StringHelper::safe(
|
||||
$view->name_list, 'U'
|
||||
);
|
||||
CFactory::_('Placeholder')->active[Placefix::_('view')]
|
||||
= CFactory::_('Placeholder')->active[Placefix::_h('view')];
|
||||
CFactory::_('Placeholder')->active[Placefix::_('views')]
|
||||
= CFactory::_('Placeholder')->active[Placefix::_h('views')];
|
||||
CFactory::_('Placeholder')->active[Placefix::_('View')]
|
||||
= CFactory::_('Placeholder')->active[Placefix::_h('View')];
|
||||
CFactory::_('Placeholder')->active[Placefix::_('Views')]
|
||||
= CFactory::_('Placeholder')->active[Placefix::_h('Views')];
|
||||
CFactory::_('Placeholder')->active[Placefix::_('VIEW')]
|
||||
= CFactory::_('Placeholder')->active[Placefix::_h('VIEW')];
|
||||
CFactory::_('Placeholder')->active[Placefix::_('VIEWS')]
|
||||
= CFactory::_('Placeholder')->active[Placefix::_h('VIEWS')];
|
||||
));
|
||||
|
||||
// for plugin event TODO change event api signatures
|
||||
$this->placeholders = CFactory::_('Placeholder')->active;
|
||||
$placeholders = CFactory::_('Placeholder')->active;
|
||||
// Trigger Event: jcb_ce_onBeforeModelViewData
|
||||
CFactory::_('Event')->trigger(
|
||||
'jcb_ce_onBeforeModelViewData',
|
||||
array(&$this->componentContext, &$view, &$this->placeholders)
|
||||
array(&$this->componentContext, &$view, &$placeholders)
|
||||
);
|
||||
// for plugin event TODO change event api signatures
|
||||
CFactory::_('Placeholder')->active = $this->placeholders;
|
||||
unset($placeholders);
|
||||
|
||||
// add the tables
|
||||
$view->addtables = (isset($view->addtables)
|
||||
@ -2343,9 +2325,8 @@ class Get
|
||||
// set the view name
|
||||
$tab['view'] = $view->name_single_code;
|
||||
// load the dynamic data
|
||||
$tab['html'] = CFactory::_('Placeholder')->update(
|
||||
CFactory::_('Customcode')->update($tab['html']),
|
||||
CFactory::_('Placeholder')->active
|
||||
$tab['html'] = CFactory::_('Placeholder')->update_(
|
||||
CFactory::_('Customcode')->update($tab['html'])
|
||||
);
|
||||
// set the tab name
|
||||
$tab['name'] = (isset($tab['name'])
|
||||
@ -2425,7 +2406,7 @@ class Get
|
||||
$tab['lang_permission_desc'] = $tab['lang']
|
||||
. '_TAB_PERMISSION_DESC';
|
||||
$tab['lang_permission_title']
|
||||
= CFactory::_('Placeholder')->active[Placefix::_h('Views')] . ' View '
|
||||
= CFactory::_('Placeholder')->get('Views') . ' View '
|
||||
. $tab['name'] . ' Tab';
|
||||
CFactory::_('Language')->set(
|
||||
'both', $tab['lang_permission'],
|
||||
@ -2435,7 +2416,7 @@ class Get
|
||||
'both', $tab['lang_permission_desc'],
|
||||
'Allow the users in this group to view '
|
||||
. $tab['name'] . ' Tab of '
|
||||
. CFactory::_('Placeholder')->active[Placefix::_h('views')]
|
||||
. CFactory::_('Placeholder')->get('views')
|
||||
);
|
||||
// set the sort key
|
||||
$tab['sortKey']
|
||||
@ -3261,28 +3242,21 @@ class Get
|
||||
}
|
||||
|
||||
// for plugin event TODO change event api signatures
|
||||
$this->placeholders = CFactory::_('Placeholder')->active;
|
||||
$placeholders = CFactory::_('Placeholder')->active;
|
||||
// Trigger Event: jcb_ce_onAfterModelViewData
|
||||
CFactory::_('Event')->trigger(
|
||||
'jcb_ce_onAfterModelViewData',
|
||||
array(&$this->componentContext, &$view, &$this->placeholders)
|
||||
array(&$this->componentContext, &$view, &$placeholders)
|
||||
);
|
||||
// for plugin event TODO change event api signatures
|
||||
CFactory::_('Placeholder')->active = $this->placeholders;
|
||||
unset($placeholders);
|
||||
|
||||
// clear placeholders
|
||||
unset(CFactory::_('Placeholder')->active[Placefix::_h('view')]);
|
||||
unset(CFactory::_('Placeholder')->active[Placefix::_h('views')]);
|
||||
unset(CFactory::_('Placeholder')->active[Placefix::_h('View')]);
|
||||
unset(CFactory::_('Placeholder')->active[Placefix::_h('Views')]);
|
||||
unset(CFactory::_('Placeholder')->active[Placefix::_h('VIEW')]);
|
||||
unset(CFactory::_('Placeholder')->active[Placefix::_h('VIEWS')]);
|
||||
unset(CFactory::_('Placeholder')->active[Placefix::_('view')]);
|
||||
unset(CFactory::_('Placeholder')->active[Placefix::_('views')]);
|
||||
unset(CFactory::_('Placeholder')->active[Placefix::_('View')]);
|
||||
unset(CFactory::_('Placeholder')->active[Placefix::_('Views')]);
|
||||
unset(CFactory::_('Placeholder')->active[Placefix::_('VIEW')]);
|
||||
unset(CFactory::_('Placeholder')->active[Placefix::_('VIEWS')]);
|
||||
CFactory::_('Placeholder')->remove('view');
|
||||
CFactory::_('Placeholder')->remove('views');
|
||||
CFactory::_('Placeholder')->remove('View');
|
||||
CFactory::_('Placeholder')->remove('Views');
|
||||
CFactory::_('Placeholder')->remove('VIEW');
|
||||
CFactory::_('Placeholder')->remove('VIEWS');
|
||||
|
||||
// store this view to class object
|
||||
$this->_adminViewData[$id] = $view;
|
||||
@ -4272,10 +4246,10 @@ class Get
|
||||
$option2['operator']
|
||||
= $operatorArray[$option2['operator']];
|
||||
$option2['state_key']
|
||||
= CFactory::_('Placeholder')->update(
|
||||
= CFactory::_('Placeholder')->update_(
|
||||
CFactory::_('Customcode')->update(
|
||||
$option2['state_key']
|
||||
), CFactory::_('Placeholder')->active
|
||||
)
|
||||
);
|
||||
$option2['key'] = $result->key;
|
||||
}
|
||||
@ -6884,8 +6858,8 @@ class Get
|
||||
$guiMapper = array('table' => 'joomla_module',
|
||||
'id' => (int) $id, 'type' => 'php');
|
||||
// update the name if it has dynamic values
|
||||
$module->name = CFactory::_('Placeholder')->update(
|
||||
CFactory::_('Customcode')->update($module->name), CFactory::_('Placeholder')->active
|
||||
$module->name = CFactory::_('Placeholder')->update_(
|
||||
CFactory::_('Customcode')->update($module->name)
|
||||
);
|
||||
// set safe class function name
|
||||
$module->code_name
|
||||
@ -6927,22 +6901,17 @@ class Get
|
||||
$module->key, CFactory::_('Config')->lang_prefix, $module->official_name
|
||||
);
|
||||
// set some placeholder for this module
|
||||
CFactory::_('Placeholder')->active[Placefix::_('Module_name')]
|
||||
= $module->official_name;
|
||||
CFactory::_('Placeholder')->active[Placefix::_('Module')]
|
||||
= ucfirst(
|
||||
CFactory::_('Placeholder')->set('Module_name', $module->official_name);
|
||||
CFactory::_('Placeholder')->set('Module', ucfirst(
|
||||
$module->code_name
|
||||
);
|
||||
CFactory::_('Placeholder')->active[Placefix::_('module')]
|
||||
= strtolower(
|
||||
));
|
||||
CFactory::_('Placeholder')->set('module', strtolower(
|
||||
$module->code_name
|
||||
);
|
||||
CFactory::_('Placeholder')->active[Placefix::_('module.version')]
|
||||
= $module->module_version;
|
||||
CFactory::_('Placeholder')->active[Placefix::_('module_version')]
|
||||
= str_replace(
|
||||
));
|
||||
CFactory::_('Placeholder')->set('module.version', $module->module_version);
|
||||
CFactory::_('Placeholder')->set('module_version', str_replace(
|
||||
'.', '_', $module->module_version
|
||||
);
|
||||
));
|
||||
// set description (TODO) add description field to module
|
||||
if (!isset($module->description)
|
||||
|| !StringHelper::check(
|
||||
@ -6953,9 +6922,8 @@ class Get
|
||||
}
|
||||
else
|
||||
{
|
||||
$module->description = CFactory::_('Placeholder')->update(
|
||||
CFactory::_('Customcode')->update($module->description),
|
||||
CFactory::_('Placeholder')->active
|
||||
$module->description = CFactory::_('Placeholder')->update_(
|
||||
CFactory::_('Customcode')->update($module->description)
|
||||
);
|
||||
CFactory::_('Language')->set(
|
||||
$module->key, $module->lang_prefix . '_DESCRIPTION',
|
||||
@ -6982,9 +6950,8 @@ class Get
|
||||
// update the readme if set
|
||||
if ($module->addreadme == 1 && !empty($module->readme))
|
||||
{
|
||||
$module->readme = CFactory::_('Placeholder')->update(
|
||||
CFactory::_('Customcode')->update(base64_decode($module->readme)),
|
||||
CFactory::_('Placeholder')->active
|
||||
$module->readme = CFactory::_('Placeholder')->update_(
|
||||
CFactory::_('Customcode')->update(base64_decode($module->readme))
|
||||
);
|
||||
}
|
||||
else
|
||||
@ -7022,12 +6989,12 @@ class Get
|
||||
// base64 Decode code
|
||||
$module->class_helper_header = PHP_EOL
|
||||
. CFactory::_('Customcode.Gui')->set(
|
||||
CFactory::_('Placeholder')->update(
|
||||
CFactory::_('Placeholder')->update_(
|
||||
CFactory::_('Customcode')->update(
|
||||
base64_decode(
|
||||
$module->class_helper_header
|
||||
)
|
||||
), CFactory::_('Placeholder')->active
|
||||
)
|
||||
),
|
||||
$guiMapper
|
||||
) . PHP_EOL;
|
||||
@ -7041,10 +7008,10 @@ class Get
|
||||
$guiMapper['field'] = 'class_helper_code';
|
||||
// base64 Decode code
|
||||
$module->class_helper_code = CFactory::_('Customcode.Gui')->set(
|
||||
CFactory::_('Placeholder')->update(
|
||||
CFactory::_('Placeholder')->update_(
|
||||
CFactory::_('Customcode')->update(
|
||||
base64_decode($module->class_helper_code)
|
||||
), CFactory::_('Placeholder')->active
|
||||
)
|
||||
),
|
||||
$guiMapper
|
||||
);
|
||||
@ -7071,10 +7038,10 @@ class Get
|
||||
// set GUI mapper field
|
||||
$guiMapper['field'] = 'mod_code';
|
||||
$module->mod_code = CFactory::_('Customcode.Gui')->set(
|
||||
CFactory::_('Placeholder')->update(
|
||||
CFactory::_('Placeholder')->update_(
|
||||
CFactory::_('Customcode')->update(
|
||||
base64_decode($module->mod_code)
|
||||
), CFactory::_('Placeholder')->active
|
||||
)
|
||||
),
|
||||
$guiMapper
|
||||
);
|
||||
@ -7099,10 +7066,10 @@ class Get
|
||||
// set GUI mapper field
|
||||
$guiMapper['field'] = 'default_header';
|
||||
$module->default_header = CFactory::_('Customcode.Gui')->set(
|
||||
CFactory::_('Placeholder')->update(
|
||||
CFactory::_('Placeholder')->update_(
|
||||
CFactory::_('Customcode')->update(
|
||||
base64_decode($module->default_header)
|
||||
), CFactory::_('Placeholder')->active
|
||||
)
|
||||
),
|
||||
$guiMapper
|
||||
);
|
||||
@ -7119,10 +7086,10 @@ class Get
|
||||
$guiMapper['field'] = 'default';
|
||||
$guiMapper['type'] = 'html';
|
||||
$module->default = CFactory::_('Customcode.Gui')->set(
|
||||
CFactory::_('Placeholder')->update(
|
||||
CFactory::_('Placeholder')->update_(
|
||||
CFactory::_('Customcode')->update(
|
||||
base64_decode($module->default)
|
||||
), CFactory::_('Placeholder')->active
|
||||
)
|
||||
),
|
||||
$guiMapper
|
||||
);
|
||||
@ -7464,15 +7431,14 @@ class Get
|
||||
// set GUI mapper field
|
||||
$guiMapper['field'] = $scriptMethod . '_'
|
||||
. $scriptType;
|
||||
$module->{$scriptMethod . '_' . $scriptType}
|
||||
= CFactory::_('Customcode.Gui')->set(
|
||||
CFactory::_('Placeholder')->update(
|
||||
$module->{$scriptMethod . '_' . $scriptType} = CFactory::_('Customcode.Gui')->set(
|
||||
CFactory::_('Placeholder')->update_(
|
||||
CFactory::_('Customcode')->update(
|
||||
base64_decode(
|
||||
$module->{$scriptMethod . '_'
|
||||
. $scriptType}
|
||||
)
|
||||
), CFactory::_('Placeholder')->active
|
||||
)
|
||||
),
|
||||
$guiMapper
|
||||
);
|
||||
@ -7491,9 +7457,8 @@ class Get
|
||||
if ($module->add_sql == 1
|
||||
&& StringHelper::check($module->sql))
|
||||
{
|
||||
$module->sql = CFactory::_('Placeholder')->update(
|
||||
CFactory::_('Customcode')->update(base64_decode($module->sql)),
|
||||
CFactory::_('Placeholder')->active
|
||||
$module->sql = CFactory::_('Placeholder')->update_(
|
||||
CFactory::_('Customcode')->update(base64_decode($module->sql))
|
||||
);
|
||||
}
|
||||
else
|
||||
@ -7507,10 +7472,10 @@ class Get
|
||||
$module->sql_uninstall
|
||||
))
|
||||
{
|
||||
$module->sql_uninstall = CFactory::_('Placeholder')->update(
|
||||
$module->sql_uninstall = CFactory::_('Placeholder')->update_(
|
||||
CFactory::_('Customcode')->update(
|
||||
base64_decode($module->sql_uninstall)
|
||||
), CFactory::_('Placeholder')->active
|
||||
)
|
||||
);
|
||||
}
|
||||
else
|
||||
@ -7524,9 +7489,8 @@ class Get
|
||||
$module->update_server_url
|
||||
))
|
||||
{
|
||||
$module->update_server_url = CFactory::_('Placeholder')->update(
|
||||
CFactory::_('Customcode')->update($module->update_server_url),
|
||||
CFactory::_('Placeholder')->active
|
||||
$module->update_server_url = CFactory::_('Placeholder')->update_(
|
||||
CFactory::_('Customcode')->update($module->update_server_url)
|
||||
);
|
||||
}
|
||||
// add the update/sales server FTP details if that is the expected protocol
|
||||
@ -7566,17 +7530,11 @@ class Get
|
||||
$this->langPrefix = $_backup_langPrefix;
|
||||
CFactory::_('Config')->lang_prefix = $_backup_langPrefix;
|
||||
|
||||
unset(
|
||||
CFactory::_('Placeholder')->active[Placefix::_('Module_name')]
|
||||
);
|
||||
unset(CFactory::_('Placeholder')->active[Placefix::_('Module')]);
|
||||
unset(CFactory::_('Placeholder')->active[Placefix::_('module')]);
|
||||
unset(
|
||||
CFactory::_('Placeholder')->active[Placefix::_('module.version')]
|
||||
);
|
||||
unset(
|
||||
CFactory::_('Placeholder')->active[Placefix::_('module_version')]
|
||||
);
|
||||
CFactory::_('Placeholder')->remove('Module_name');
|
||||
CFactory::_('Placeholder')->remove('Module');
|
||||
CFactory::_('Placeholder')->remove('module');
|
||||
CFactory::_('Placeholder')->remove('module.version');
|
||||
CFactory::_('Placeholder')->remove('module_version');
|
||||
|
||||
$this->joomlaModules[$id] = $module;
|
||||
|
||||
@ -7801,8 +7759,8 @@ class Get
|
||||
$guiMapper = array('table' => 'joomla_plugin',
|
||||
'id' => (int) $id, 'type' => 'php');
|
||||
// update the name if it has dynamic values
|
||||
$plugin->name = CFactory::_('Placeholder')->update(
|
||||
CFactory::_('Customcode')->update($plugin->name), CFactory::_('Placeholder')->active
|
||||
$plugin->name = CFactory::_('Placeholder')->update_(
|
||||
CFactory::_('Customcode')->update($plugin->name)
|
||||
);
|
||||
// update the name if it has dynamic values
|
||||
$plugin->code_name
|
||||
@ -7852,37 +7810,19 @@ class Get
|
||||
$plugin->key, CFactory::_('Config')->lang_prefix, $plugin->official_name
|
||||
);
|
||||
// set some placeholder for this plugin
|
||||
CFactory::_('Placeholder')->active[Placefix::_('Plugin_name')]
|
||||
= $plugin->official_name;
|
||||
CFactory::_('Placeholder')->active[Placefix::_h('PLUGIN_NAME')]
|
||||
= $plugin->official_name;
|
||||
CFactory::_('Placeholder')->active[Placefix::_('Plugin')]
|
||||
= ucfirst(
|
||||
$plugin->code_name
|
||||
);
|
||||
CFactory::_('Placeholder')->active[Placefix::_('plugin')]
|
||||
= strtolower(
|
||||
$plugin->code_name
|
||||
);
|
||||
CFactory::_('Placeholder')->active[Placefix::_('Plugin_group')]
|
||||
= ucfirst(
|
||||
$plugin->group
|
||||
);
|
||||
CFactory::_('Placeholder')->active[Placefix::_('plugin_group')]
|
||||
= strtolower(
|
||||
$plugin->group
|
||||
);
|
||||
CFactory::_('Placeholder')->active[Placefix::_('plugin.version')]
|
||||
= $plugin->plugin_version;
|
||||
CFactory::_('Placeholder')->active[Placefix::_h('VERSION')]
|
||||
= $plugin->plugin_version;
|
||||
CFactory::_('Placeholder')->active[Placefix::_('plugin_version')]
|
||||
= str_replace(
|
||||
CFactory::_('Placeholder')->set('Plugin_name', $plugin->official_name);
|
||||
CFactory::_('Placeholder')->set('PLUGIN_NAME', $plugin->official_name);
|
||||
CFactory::_('Placeholder')->set('Plugin', ucfirst($plugin->code_name));
|
||||
CFactory::_('Placeholder')->set('plugin', strtolower($plugin->code_name));
|
||||
CFactory::_('Placeholder')->set('Plugin_group', ucfirst($plugin->group));
|
||||
CFactory::_('Placeholder')->set('plugin_group', strtolower($plugin->group));
|
||||
CFactory::_('Placeholder')->set('plugin.version', $plugin->plugin_version);
|
||||
CFactory::_('Placeholder')->set('VERSION', $plugin->plugin_version);
|
||||
CFactory::_('Placeholder')->set('plugin_version', str_replace(
|
||||
'.', '_', $plugin->plugin_version
|
||||
);
|
||||
));
|
||||
// set description
|
||||
CFactory::_('Placeholder')->active[Placefix::_h('DESCRIPTION')]
|
||||
= '';
|
||||
CFactory::_('Placeholder')->set('DESCRIPTION', '');
|
||||
if (!isset($plugin->description)
|
||||
|| !StringHelper::check(
|
||||
$plugin->description
|
||||
@ -7892,19 +7832,16 @@ class Get
|
||||
}
|
||||
else
|
||||
{
|
||||
$plugin->description = CFactory::_('Placeholder')->update(
|
||||
CFactory::_('Customcode')->update($plugin->description),
|
||||
CFactory::_('Placeholder')->active
|
||||
$plugin->description = CFactory::_('Placeholder')->update_(
|
||||
CFactory::_('Customcode')->update($plugin->description)
|
||||
);
|
||||
CFactory::_('Language')->set(
|
||||
$plugin->key, $plugin->lang_prefix . '_DESCRIPTION',
|
||||
$plugin->description
|
||||
);
|
||||
// set description
|
||||
CFactory::_('Placeholder')->active[Placefix::_h('DESCRIPTION')]
|
||||
= $plugin->description;
|
||||
$plugin->description = '<p>' . $plugin->description
|
||||
. '</p>';
|
||||
CFactory::_('Placeholder')->set('DESCRIPTION', $plugin->description);
|
||||
$plugin->description = '<p>' . $plugin->description . '</p>';
|
||||
}
|
||||
$plugin->xml_description = "<h1>" . $plugin->official_name
|
||||
. " (v." . $plugin->plugin_version
|
||||
@ -7924,9 +7861,8 @@ class Get
|
||||
// update the readme if set
|
||||
if ($plugin->addreadme == 1 && !empty($plugin->readme))
|
||||
{
|
||||
$plugin->readme = CFactory::_('Placeholder')->update(
|
||||
CFactory::_('Customcode')->update(base64_decode($plugin->readme)),
|
||||
CFactory::_('Placeholder')->active
|
||||
$plugin->readme = CFactory::_('Placeholder')->update_(
|
||||
CFactory::_('Customcode')->update(base64_decode($plugin->readme))
|
||||
);
|
||||
}
|
||||
else
|
||||
@ -7941,10 +7877,10 @@ class Get
|
||||
$guiMapper['field'] = 'main_class_code';
|
||||
// base64 Decode main_class_code.
|
||||
$plugin->main_class_code = CFactory::_('Customcode.Gui')->set(
|
||||
CFactory::_('Placeholder')->update(
|
||||
CFactory::_('Placeholder')->update_(
|
||||
CFactory::_('Customcode')->update(
|
||||
base64_decode($plugin->main_class_code)
|
||||
), CFactory::_('Placeholder')->active
|
||||
)
|
||||
),
|
||||
$guiMapper
|
||||
);
|
||||
@ -7956,10 +7892,10 @@ class Get
|
||||
$guiMapper['field'] = 'head';
|
||||
// base64 Decode head.
|
||||
$plugin->head = CFactory::_('Customcode.Gui')->set(
|
||||
CFactory::_('Placeholder')->update(
|
||||
CFactory::_('Placeholder')->update_(
|
||||
CFactory::_('Customcode')->update(
|
||||
base64_decode($plugin->head)
|
||||
), CFactory::_('Placeholder')->active
|
||||
)
|
||||
),
|
||||
$guiMapper
|
||||
);
|
||||
@ -7968,10 +7904,10 @@ class Get
|
||||
{
|
||||
// base64 Decode head.
|
||||
$plugin->head = CFactory::_('Customcode.Gui')->set(
|
||||
CFactory::_('Placeholder')->update(
|
||||
CFactory::_('Placeholder')->update_(
|
||||
CFactory::_('Customcode')->update(
|
||||
base64_decode($plugin->class_head)
|
||||
), CFactory::_('Placeholder')->active
|
||||
)
|
||||
),
|
||||
array(
|
||||
'table' => 'class_extends',
|
||||
@ -7986,10 +7922,10 @@ class Get
|
||||
{
|
||||
// base64 Decode comment.
|
||||
$plugin->comment = CFactory::_('Customcode.Gui')->set(
|
||||
CFactory::_('Placeholder')->update(
|
||||
CFactory::_('Placeholder')->update_(
|
||||
CFactory::_('Customcode')->update(
|
||||
base64_decode($plugin->comment)
|
||||
), CFactory::_('Placeholder')->active
|
||||
)
|
||||
),
|
||||
array(
|
||||
'table' => 'class_extends',
|
||||
@ -8292,13 +8228,13 @@ class Get
|
||||
. $scriptType;
|
||||
$plugin->{$scriptMethod . '_' . $scriptType}
|
||||
= CFactory::_('Customcode.Gui')->set(
|
||||
CFactory::_('Placeholder')->update(
|
||||
CFactory::_('Placeholder')->update_(
|
||||
CFactory::_('Customcode')->update(
|
||||
base64_decode(
|
||||
$plugin->{$scriptMethod . '_'
|
||||
. $scriptType}
|
||||
)
|
||||
), CFactory::_('Placeholder')->active
|
||||
)
|
||||
),
|
||||
$guiMapper
|
||||
);
|
||||
@ -8317,9 +8253,8 @@ class Get
|
||||
if ($plugin->add_sql == 1
|
||||
&& StringHelper::check($plugin->sql))
|
||||
{
|
||||
$plugin->sql = CFactory::_('Placeholder')->update(
|
||||
CFactory::_('Customcode')->update(base64_decode($plugin->sql)),
|
||||
CFactory::_('Placeholder')->active
|
||||
$plugin->sql = CFactory::_('Placeholder')->update_(
|
||||
CFactory::_('Customcode')->update(base64_decode($plugin->sql))
|
||||
);
|
||||
}
|
||||
else
|
||||
@ -8333,10 +8268,10 @@ class Get
|
||||
$plugin->sql_uninstall
|
||||
))
|
||||
{
|
||||
$plugin->sql_uninstall = CFactory::_('Placeholder')->update(
|
||||
$plugin->sql_uninstall = CFactory::_('Placeholder')->update_(
|
||||
CFactory::_('Customcode')->update(
|
||||
base64_decode($plugin->sql_uninstall)
|
||||
), CFactory::_('Placeholder')->active
|
||||
)
|
||||
);
|
||||
}
|
||||
else
|
||||
@ -8350,9 +8285,8 @@ class Get
|
||||
$plugin->update_server_url
|
||||
))
|
||||
{
|
||||
$plugin->update_server_url = CFactory::_('Placeholder')->update(
|
||||
CFactory::_('Customcode')->update($plugin->update_server_url),
|
||||
CFactory::_('Placeholder')->active
|
||||
$plugin->update_server_url = CFactory::_('Placeholder')->update_(
|
||||
CFactory::_('Customcode')->update($plugin->update_server_url)
|
||||
);
|
||||
}
|
||||
// add the update/sales server FTP details if that is the expected protocol
|
||||
@ -8392,32 +8326,16 @@ class Get
|
||||
$this->langPrefix = $_backup_langPrefix;
|
||||
CFactory::_('Config')->set('lang_prefix', $_backup_langPrefix);
|
||||
|
||||
unset(
|
||||
CFactory::_('Placeholder')->active[Placefix::_('Plugin_name')]
|
||||
);
|
||||
unset(CFactory::_('Placeholder')->active[Placefix::_('Plugin')]);
|
||||
unset(CFactory::_('Placeholder')->active[Placefix::_('plugin')]);
|
||||
unset(
|
||||
CFactory::_('Placeholder')->active[Placefix::_('Plugin_group')]
|
||||
);
|
||||
unset(
|
||||
CFactory::_('Placeholder')->active[Placefix::_('plugin_group')]
|
||||
);
|
||||
unset(
|
||||
CFactory::_('Placeholder')->active[Placefix::_('plugin.version')]
|
||||
);
|
||||
unset(
|
||||
CFactory::_('Placeholder')->active[Placefix::_('plugin_version')]
|
||||
);
|
||||
unset(
|
||||
CFactory::_('Placeholder')->active[Placefix::_h('VERSION')]
|
||||
);
|
||||
unset(
|
||||
CFactory::_('Placeholder')->active[Placefix::_h('DESCRIPTION')]
|
||||
);
|
||||
unset(
|
||||
CFactory::_('Placeholder')->active[Placefix::_h('PLUGIN_NAME')]
|
||||
);
|
||||
CFactory::_('Placeholder')->remove('Plugin_name');
|
||||
CFactory::_('Placeholder')->remove('Plugin');
|
||||
CFactory::_('Placeholder')->remove('plugin');
|
||||
CFactory::_('Placeholder')->remove('Plugin_group');
|
||||
CFactory::_('Placeholder')->remove('plugin_group');
|
||||
CFactory::_('Placeholder')->remove('plugin.version');
|
||||
CFactory::_('Placeholder')->remove('plugin_version');
|
||||
CFactory::_('Placeholder')->remove('VERSION');
|
||||
CFactory::_('Placeholder')->remove('DESCRIPTION');
|
||||
CFactory::_('Placeholder')->remove('PLUGIN_NAME');
|
||||
|
||||
$this->joomlaPlugins[$id] = $plugin;
|
||||
|
||||
|
@ -3087,8 +3087,8 @@ class Structure extends Get
|
||||
'//', '/', $custom['file']
|
||||
);
|
||||
// update the dynamic component name placholders in file names
|
||||
$custom['path'] = CFactory::_('Placeholder')->update(
|
||||
$custom['path'], CFactory::_('Placeholder')->active
|
||||
$custom['path'] = CFactory::_('Placeholder')->update_(
|
||||
$custom['path']
|
||||
);
|
||||
// get the path info
|
||||
$pathInfo = pathinfo($custom['path']);
|
||||
@ -3227,10 +3227,10 @@ class Structure extends Get
|
||||
*/
|
||||
protected function updateDynamicPath($path)
|
||||
{
|
||||
return CFactory::_('Placeholder')->update(
|
||||
return CFactory::_('Placeholder')->update_(
|
||||
CFactory::_('Placeholder')->update(
|
||||
$path, ComponentbuilderHelper::$constantPaths
|
||||
), CFactory::_('Placeholder')->active
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -403,9 +403,9 @@ class Fields extends Structure
|
||||
}
|
||||
// main lang prefix
|
||||
$langView = CFactory::_('Config')->lang_prefix . '_'
|
||||
. CFactory::_('Placeholder')->active[Placefix::_h('VIEW')];
|
||||
. CFactory::_('Placeholder')->get('VIEW');
|
||||
$langViews = CFactory::_('Config')->lang_prefix . '_'
|
||||
. CFactory::_('Placeholder')->active[Placefix::_h('VIEWS')];
|
||||
. CFactory::_('Placeholder')->get('VIEWS');
|
||||
// set default lang
|
||||
CFactory::_('Language')->set(
|
||||
CFactory::_('Config')->lang_target, $langView, $view['settings']->name_single
|
||||
@ -607,17 +607,16 @@ class Fields extends Structure
|
||||
// set the custom table key
|
||||
$dbkey = 'g';
|
||||
// for plugin event TODO change event api signatures
|
||||
$this->placeholders = CFactory::_('Placeholder')->active;
|
||||
$placeholders = CFactory::_('Placeholder')->active;
|
||||
// Trigger Event: jcb_ce_onBeforeBuildFields
|
||||
CFactory::_('Event')->trigger(
|
||||
'jcb_ce_onBeforeBuildFields',
|
||||
array(&$this->componentContext, &$dynamicFields, &$readOnly,
|
||||
&$dbkey, &$view, &$component, &$nameSingleCode,
|
||||
&$nameListCode, &$this->placeholders, &$langView,
|
||||
&$nameListCode, &$placeholders, &$langView,
|
||||
&$langViews)
|
||||
);
|
||||
// for plugin event TODO change event api signatures
|
||||
CFactory::_('Placeholder')->active = $this->placeholders;
|
||||
unset($placeholders);
|
||||
// TODO we should add the global and local view switch if field for front end
|
||||
foreach ($view['settings']->fields as $field)
|
||||
{
|
||||
@ -628,17 +627,16 @@ class Fields extends Structure
|
||||
);
|
||||
}
|
||||
// for plugin event TODO change event api signatures
|
||||
$this->placeholders = CFactory::_('Placeholder')->active;
|
||||
$placeholders = CFactory::_('Placeholder')->active;
|
||||
// Trigger Event: jcb_ce_onAfterBuildFields
|
||||
CFactory::_('Event')->trigger(
|
||||
'jcb_ce_onAfterBuildFields',
|
||||
array(&$this->componentContext, &$dynamicFields, &$readOnly,
|
||||
&$dbkey, &$view, &$component, &$nameSingleCode,
|
||||
&$nameListCode, &$this->placeholders, &$langView,
|
||||
&$nameListCode, &$placeholders, &$langView,
|
||||
&$langViews)
|
||||
);
|
||||
// for plugin event TODO change event api signatures
|
||||
CFactory::_('Placeholder')->active = $this->placeholders;
|
||||
unset($placeholders);
|
||||
// set the default fields
|
||||
$fieldSet = array();
|
||||
$fieldSet[] = '<fieldset name="details">';
|
||||
@ -1026,17 +1024,16 @@ class Fields extends Structure
|
||||
// set the custom table key
|
||||
$dbkey = 'g';
|
||||
// for plugin event TODO change event api signatures
|
||||
$this->placeholders = CFactory::_('Placeholder')->active;
|
||||
$placeholders = CFactory::_('Placeholder')->active;
|
||||
// Trigger Event: jcb_ce_onBeforeBuildFields
|
||||
CFactory::_('Event')->trigger(
|
||||
'jcb_ce_onBeforeBuildFields',
|
||||
array(&$this->componentContext, &$dynamicFieldsXML, &$readOnlyXML,
|
||||
&$dbkey, &$view, &$component, &$nameSingleCode,
|
||||
&$nameListCode, &$this->placeholders, &$langView,
|
||||
&$nameListCode, &$placeholders, &$langView,
|
||||
&$langViews)
|
||||
);
|
||||
// for plugin event TODO change event api signatures
|
||||
CFactory::_('Placeholder')->active = $this->placeholders;
|
||||
unset($placeholders);
|
||||
// TODO we should add the global and local view switch if field for front end
|
||||
foreach ($view['settings']->fields as $field)
|
||||
{
|
||||
@ -1047,17 +1044,16 @@ class Fields extends Structure
|
||||
);
|
||||
}
|
||||
// for plugin event TODO change event api signatures
|
||||
$this->placeholders = CFactory::_('Placeholder')->active;
|
||||
$placeholders = CFactory::_('Placeholder')->active;
|
||||
// Trigger Event: jcb_ce_onAfterBuildFields
|
||||
CFactory::_('Event')->trigger(
|
||||
'jcb_ce_onAfterBuildFields',
|
||||
array(&$this->componentContext, &$dynamicFieldsXML, &$readOnlyXML,
|
||||
&$dbkey, &$view, &$component, &$nameSingleCode,
|
||||
&$nameListCode, &$this->placeholders, &$langView,
|
||||
&$nameListCode, &$placeholders, &$langView,
|
||||
&$langViews)
|
||||
);
|
||||
// for plugin event TODO change event api signatures
|
||||
CFactory::_('Placeholder')->active = $this->placeholders;
|
||||
unset($placeholders);
|
||||
// set the default fields
|
||||
$XML = new simpleXMLElement('<a/>');
|
||||
$fieldSetXML = $XML->addChild('fieldset');
|
||||
@ -4752,11 +4748,11 @@ class Fields extends Structure
|
||||
else
|
||||
{
|
||||
// get it from the field xml string
|
||||
$listFieldName = (string) CFactory::_('Placeholder')->update(
|
||||
$listFieldName = (string) CFactory::_('Placeholder')->update_(
|
||||
GetHelper::between(
|
||||
$field['settings']->xml, 'label="',
|
||||
'"'
|
||||
), CFactory::_('Placeholder')->active
|
||||
)
|
||||
);
|
||||
}
|
||||
// make sure there is no html in the list field name
|
||||
@ -4954,10 +4950,10 @@ class Fields extends Structure
|
||||
$otherView = $nameSingleCode;
|
||||
}
|
||||
// get the xml extension name
|
||||
$_extension = CFactory::_('Placeholder')->update(
|
||||
$_extension = CFactory::_('Placeholder')->update_(
|
||||
GetHelper::between(
|
||||
$field['settings']->xml, 'extension="', '"'
|
||||
), CFactory::_('Placeholder')->active
|
||||
)
|
||||
);
|
||||
// if they left out the extension for some reason
|
||||
if (!StringHelper::check($_extension))
|
||||
@ -5332,12 +5328,11 @@ class Fields extends Structure
|
||||
if (isset($data['custom']) && isset($data['custom']['extends'])
|
||||
&& ((isset($data['custom']['prime_php'])
|
||||
&& $data['custom']['prime_php'] == 1)
|
||||
|| !isset(
|
||||
$this->fileContentDynamic['customfield_' . $data['type']]
|
||||
)
|
||||
|| !CFactory::_('Content')->exist_('customfield_' . $data['type'])
|
||||
|| !ArrayHelper::check(
|
||||
$this->fileContentDynamic['customfield_' . $data['type']]
|
||||
)))
|
||||
CFactory::_('Content')->get_('customfield_' . $data['type'])
|
||||
)
|
||||
))
|
||||
{
|
||||
// set J prefix
|
||||
$jprefix = 'J';
|
||||
@ -5416,18 +5411,17 @@ class Fields extends Structure
|
||||
$replace[$globalPlaceholder] = $gloabalValue;
|
||||
}
|
||||
// start loading the field type
|
||||
$this->fileContentDynamic['customfield_' . $data['type']] = array();
|
||||
// $this->fileContentDynamic['customfield_' . $data['type']] = array();
|
||||
// JPREFIX <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic['customfield_' . $data['type']][Placefix::_h('JPREFIX')]
|
||||
= $jprefix;
|
||||
CFactory::_('Content')->set_('customfield_' . $data['type'], 'JPREFIX', $jprefix);
|
||||
// Type <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic['customfield_' . $data['type']][Placefix::_h('Type')]
|
||||
= StringHelper::safe(
|
||||
CFactory::_('Content')->set_('customfield_' . $data['type'], 'Type',
|
||||
StringHelper::safe(
|
||||
$data['custom']['type'], 'F'
|
||||
)
|
||||
);
|
||||
// type <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic['customfield_' . $data['type']][Placefix::_h('type')]
|
||||
= StringHelper::safe($data['custom']['type']);
|
||||
CFactory::_('Content')->set_('customfield_' . $data['type'], 'type', StringHelper::safe($data['custom']['type']));
|
||||
// is this a own custom field
|
||||
if (isset($data['custom']['own_custom']))
|
||||
{
|
||||
@ -5457,28 +5451,28 @@ class Fields extends Structure
|
||||
);
|
||||
// JFORM_TYPE_HEADER <<<DYNAMIC>>>
|
||||
$add_default_header = true;
|
||||
$this->fileContentDynamic['customfield_'
|
||||
. $data['type']][Placefix::_h('JFORM_TYPE_HEADER')]
|
||||
= "//" . Line::_(
|
||||
CFactory::_('Content')->set_('customfield_' . $data['type'], 'JFORM_TYPE_HEADER',
|
||||
"//" . Line::_(
|
||||
__LINE__,__CLASS__
|
||||
) . " Import the " . $JFORM_extends
|
||||
. " field type classes needed";
|
||||
. " field type classes needed"
|
||||
);
|
||||
// JFORM_extens <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic['customfield_'
|
||||
. $data['type']][Placefix::_h('JFORM_extends')]
|
||||
= $JFORM_extends;
|
||||
CFactory::_('Content')->set_('customfield_' . $data['type'],
|
||||
'JFORM_extends', $JFORM_extends
|
||||
);
|
||||
// JFORM_EXTENDS <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic['customfield_'
|
||||
. $data['type']][Placefix::_h('JFORM_EXTENDS')]
|
||||
= StringHelper::safe(
|
||||
CFactory::_('Content')->set_('customfield_' . $data['type'], 'JFORM_EXTENDS',
|
||||
StringHelper::safe(
|
||||
$data['custom']['extends'], 'F'
|
||||
)
|
||||
);
|
||||
// JFORM_TYPE_PHP <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic['customfield_'
|
||||
. $data['type']][Placefix::_h('JFORM_TYPE_PHP')]
|
||||
= PHP_EOL . PHP_EOL . Indent::_(1) . "//" . Line::_(
|
||||
CFactory::_('Content')->set_('customfield_' . $data['type'], 'JFORM_TYPE_PHP',
|
||||
PHP_EOL . PHP_EOL . Indent::_(1) . "//" . Line::_(
|
||||
__LINE__,__CLASS__
|
||||
) . " A " . $data['custom']['own_custom'] . " Field";
|
||||
) . " A " . $data['custom']['own_custom'] . " Field"
|
||||
);
|
||||
// load the other PHP options
|
||||
foreach (ComponentbuilderHelper::$phpFieldArray as $x)
|
||||
{
|
||||
@ -5502,10 +5496,10 @@ class Fields extends Structure
|
||||
// check if this is header text
|
||||
if ('HEADER' === $x)
|
||||
{
|
||||
$this->fileContentDynamic['customfield_'
|
||||
. $data['type']][Placefix::_h('JFORM_TYPE_HEADER')]
|
||||
.= PHP_EOL . CFactory::_('Placeholder')->update(
|
||||
CFactory::_('Content')->add_('customfield_' . $data['type'], 'JFORM_TYPE_HEADER',
|
||||
PHP_EOL . CFactory::_('Placeholder')->update(
|
||||
$phpBucket, $replace
|
||||
)
|
||||
);
|
||||
// stop default headers from loading
|
||||
$add_default_header = false;
|
||||
@ -5513,10 +5507,10 @@ class Fields extends Structure
|
||||
else
|
||||
{
|
||||
// JFORM_TYPE_PHP <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic['customfield_'
|
||||
. $data['type']][Placefix::_h('JFORM_TYPE_PHP')]
|
||||
.= PHP_EOL . CFactory::_('Placeholder')->update(
|
||||
CFactory::_('Content')->add_('customfield_' . $data['type'], 'JFORM_TYPE_PHP',
|
||||
PHP_EOL . CFactory::_('Placeholder')->update(
|
||||
$phpBucket, $replace
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -5524,24 +5518,21 @@ class Fields extends Structure
|
||||
// check if we should add default header
|
||||
if ($add_default_header)
|
||||
{
|
||||
$this->fileContentDynamic['customfield_'
|
||||
. $data['type']][Placefix::_h('JFORM_TYPE_HEADER')]
|
||||
.= PHP_EOL . "jimport('joomla.form.helper');";
|
||||
$this->fileContentDynamic['customfield_'
|
||||
. $data['type']][Placefix::_h('JFORM_TYPE_HEADER')]
|
||||
.= PHP_EOL . "JFormHelper::loadFieldClass('"
|
||||
. $JFORM_extends . "');";
|
||||
CFactory::_('Content')->add_('customfield_' . $data['type'], 'JFORM_TYPE_HEADER',
|
||||
PHP_EOL . "jimport('joomla.form.helper');"
|
||||
);
|
||||
CFactory::_('Content')->add_('customfield_' . $data['type'], 'JFORM_TYPE_HEADER',
|
||||
PHP_EOL . "JFormHelper::loadFieldClass('" . $JFORM_extends . "');"
|
||||
);
|
||||
}
|
||||
// check the the JFormHelper::loadFieldClass(..) was set
|
||||
elseif (strpos(
|
||||
$this->fileContentDynamic['customfield_'
|
||||
. $data['type']][Placefix::_h('JFORM_TYPE_HEADER')], 'JFormHelper::loadFieldClass('
|
||||
) === false)
|
||||
elseif (strpos(CFactory::_('Content')->get_('customfield_' . $data['type'], 'JFORM_TYPE_HEADER'),
|
||||
'JFormHelper::loadFieldClass(') === false)
|
||||
{
|
||||
$this->fileContentDynamic['customfield_'
|
||||
. $data['type']][Placefix::_h('JFORM_TYPE_HEADER')]
|
||||
.= PHP_EOL . "JFormHelper::loadFieldClass('"
|
||||
. $JFORM_extends . "');";
|
||||
CFactory::_('Content')->add_('customfield_' . $data['type'], 'JFORM_TYPE_HEADER',
|
||||
PHP_EOL . "JFormHelper::loadFieldClass('"
|
||||
. $JFORM_extends . "');"
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -5637,25 +5628,25 @@ class Fields extends Structure
|
||||
// build the Group Control
|
||||
$this->setGroupControl[$data['type']] = $groupLangName;
|
||||
// JFORM_GETGROUPS_PHP <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic['customfield_'
|
||||
. $data['type']][Placefix::_h('JFORM_GETGROUPS_PHP')]
|
||||
= $phpCode;
|
||||
CFactory::_('Content')->set_('customfield_' . $data['type'], 'JFORM_GETGROUPS_PHP',
|
||||
$phpCode
|
||||
);
|
||||
// JFORM_GETEXCLUDED_PHP <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic['customfield_'
|
||||
. $data['type']][Placefix::_h('JFORM_GETEXCLUDED_PHP')]
|
||||
= $phpxCode;
|
||||
CFactory::_('Content')->set_('customfield_' . $data['type'], 'JFORM_GETEXCLUDED_PHP',
|
||||
$phpxCode
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
// JFORM_GETOPTIONS_PHP <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic['customfield_'
|
||||
. $data['type']][Placefix::_h('JFORM_GETOPTIONS_PHP')]
|
||||
= $phpCode;
|
||||
CFactory::_('Content')->set_('customfield_' . $data['type'], 'JFORM_GETOPTIONS_PHP',
|
||||
$phpCode
|
||||
);
|
||||
}
|
||||
// type <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic['customfield_'
|
||||
. $data['type']][Placefix::_h('ADD_BUTTON')]
|
||||
= $this->setAddButtonToListField($data['custom']);
|
||||
CFactory::_('Content')->set_('customfield_' . $data['type'], 'ADD_BUTTON',
|
||||
$this->setAddButtonToListField($data['custom'])
|
||||
);
|
||||
}
|
||||
}
|
||||
// if this field gets used in plugin or module we should track it so if needed we can copy it over
|
||||
@ -6065,42 +6056,34 @@ class Fields extends Structure
|
||||
public function setFilterFieldFile($getOptions, $filter)
|
||||
{
|
||||
// make sure it is not already been build
|
||||
if (!isset(
|
||||
$this->fileContentDynamic['customfilterfield_'
|
||||
. $filter['filter_type']]
|
||||
)
|
||||
if (!CFactory::_('Content')->exist_('customfilterfield_' . $filter['filter_type'])
|
||||
|| !ArrayHelper::check(
|
||||
$this->fileContentDynamic['customfilterfield_'
|
||||
. $filter['filter_type']]
|
||||
CFactory::_('Content')->get_('customfilterfield_' . $filter['filter_type'])
|
||||
)
|
||||
)
|
||||
{
|
||||
// start loading the field type
|
||||
$this->fileContentDynamic['customfilterfield_'
|
||||
. $filter['filter_type']]
|
||||
= array();
|
||||
// $this->fileContentDynamic['customfilterfield_'
|
||||
// . $filter['filter_type']]
|
||||
// = array();
|
||||
// JPREFIX <<DYNAMIC>>>
|
||||
$this->fileContentDynamic['customfilterfield_'
|
||||
. $filter['filter_type']][Placefix::_h('JPREFIX')]
|
||||
= 'J';
|
||||
CFactory::_('Content')->set_('customfilterfield_' . $filter['filter_type'], 'JPREFIX', 'J');
|
||||
// Type <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic['customfilterfield_'
|
||||
. $filter['filter_type']][Placefix::_h('Type')]
|
||||
= StringHelper::safe(
|
||||
CFactory::_('Content')->set_('customfilterfield_' . $filter['filter_type'], 'Type',
|
||||
StringHelper::safe(
|
||||
$filter['filter_type'], 'F'
|
||||
)
|
||||
);
|
||||
// type <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic['customfilterfield_'
|
||||
. $filter['filter_type']][Placefix::_h('type')]
|
||||
= StringHelper::safe($filter['filter_type']);
|
||||
CFactory::_('Content')->set_('customfilterfield_' . $filter['filter_type'], 'type',
|
||||
StringHelper::safe($filter['filter_type'])
|
||||
);
|
||||
// JFORM_GETOPTIONS_PHP <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic['customfilterfield_'
|
||||
. $filter['filter_type']][Placefix::_h('JFORM_GETOPTIONS_PHP')]
|
||||
= $getOptions;
|
||||
CFactory::_('Content')->set_('customfilterfield_' . $filter['filter_type'], 'JFORM_GETOPTIONS_PHP',
|
||||
$getOptions
|
||||
);
|
||||
// ADD_BUTTON <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic['customfilterfield_'
|
||||
. $filter['filter_type']][Placefix::_h('ADD_BUTTON')]
|
||||
= '';
|
||||
CFactory::_('Content')->set_('customfilterfield_' . $filter['filter_type'], 'ADD_BUTTON', '');
|
||||
// now build the custom filter field type file
|
||||
$target = array('admin' => 'customfilterfield');
|
||||
$this->buildDynamique(
|
||||
@ -6153,8 +6136,8 @@ class Fields extends Structure
|
||||
$fieldData['component'], Placefix::b()
|
||||
) !== false) // should not be needed... but
|
||||
{
|
||||
$fieldData['component'] = CFactory::_('Placeholder')->update(
|
||||
$fieldData['component'], CFactory::_('Placeholder')->active
|
||||
$fieldData['component'] = CFactory::_('Placeholder')->update_(
|
||||
$fieldData['component']
|
||||
);
|
||||
}
|
||||
// get core permissions
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension type="component" version="4" method="upgrade">
|
||||
<name>COM_COMPONENTBUILDER</name>
|
||||
<creationDate>4th December, 2022</creationDate>
|
||||
<creationDate>11th December, 2022</creationDate>
|
||||
<author>Llewellyn van der Merwe</author>
|
||||
<authorEmail>joomla@vdm.io</authorEmail>
|
||||
<authorUrl>https://dev.vdm.io</authorUrl>
|
||||
|
@ -417,5 +417,27 @@ class Config extends BaseConfig
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should we remove the site folder
|
||||
*
|
||||
* @return bool Switch to control the removal
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function getRemovesitefolder(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should we remove the site edit folder
|
||||
*
|
||||
* @return bool Switch to control the removal
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function getRemovesiteeditfolder(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -104,6 +104,19 @@ class Content
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove content
|
||||
*
|
||||
* @param string $key The main string key
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function remove(string $key)
|
||||
{
|
||||
unset($this->active[Placefix::_h($key)]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set dynamic content
|
||||
*
|
||||
@ -123,14 +136,14 @@ class Content
|
||||
* Get dynamic content
|
||||
*
|
||||
* @param string $view The view key
|
||||
* @param string $key The main string key
|
||||
* @param string|null $key The main string key
|
||||
*
|
||||
* @return mixed
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function get_(string $view, string $key = null)
|
||||
public function get_(string $view, ?string $key = null)
|
||||
{
|
||||
if (!is_null($key))
|
||||
if (is_string($key))
|
||||
{
|
||||
return $this->_active[$view][Placefix::_h($key)] ?? null;
|
||||
}
|
||||
@ -141,18 +154,22 @@ class Content
|
||||
* Does view key exist
|
||||
*
|
||||
* @param string $view The view key
|
||||
* @param string $key The main string key
|
||||
* @param string|null $key The main string key
|
||||
*
|
||||
* @return bool
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function exist_(string $view, string $key): bool
|
||||
public function exist_(string $view, ?string $key = null): bool
|
||||
{
|
||||
if (isset($this->_active[$view]) &&
|
||||
if (is_string($key) && isset($this->_active[$view]) &&
|
||||
isset($this->_active[$view][Placefix::_h($key)]))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
elseif (is_null($key) && isset($this->_active[$view]))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -179,5 +196,26 @@ class Content
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove dynamic content
|
||||
*
|
||||
* @param string $view The view key
|
||||
* @param string|null $key The main string key
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function remove_(string $view, ?string $key = null)
|
||||
{
|
||||
if (is_string($key))
|
||||
{
|
||||
unset($this->_active[$view][Placefix::_h($key)]);
|
||||
}
|
||||
else
|
||||
{
|
||||
unset($this->_active[$view]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,164 @@ namespace VDM\Joomla\Componentbuilder\Compiler\Interfaces;
|
||||
*/
|
||||
interface PlaceholderInterface
|
||||
{
|
||||
/**
|
||||
* Set content
|
||||
*
|
||||
* @param string $key The main string key
|
||||
* @param mixed $value The values to set
|
||||
* @param bool $hash Add the hash around the key
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function set(string $key, $value, bool $hash = true);
|
||||
|
||||
/**
|
||||
* Get content by key
|
||||
*
|
||||
* @param string $key The main string key
|
||||
*
|
||||
* @return mixed
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function get(string $key);
|
||||
|
||||
/**
|
||||
* Does key exist at all in any variation
|
||||
*
|
||||
* @param string $key The main string key
|
||||
*
|
||||
* @return bool
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function exist(string $key): bool;
|
||||
|
||||
/**
|
||||
* Add content
|
||||
*
|
||||
* @param string $key The main string key
|
||||
* @param mixed $value The values to set
|
||||
* @param bool $hash Add the hash around the key
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function add(string $key, $value, bool $hash = true);
|
||||
|
||||
/**
|
||||
* Remove content
|
||||
*
|
||||
* @param string $key The main string key
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function remove(string $key);
|
||||
|
||||
/**
|
||||
* Set content with [ [ [ ... ] ] ] hash
|
||||
*
|
||||
* @param string $key The main string key
|
||||
* @param mixed $value The values to set
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function set_(string $key, $value);
|
||||
|
||||
/**
|
||||
* Get content with [ [ [ ... ] ] ] hash
|
||||
*
|
||||
* @param string $key The main string key
|
||||
*
|
||||
* @return mixed
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function get_(string $key);
|
||||
|
||||
/**
|
||||
* Does key exist with [ [ [ ... ] ] ] hash
|
||||
*
|
||||
* @param string $key The main string key
|
||||
*
|
||||
* @return bool
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function exist_(string $key): bool;
|
||||
|
||||
/**
|
||||
* Add content with [ [ [ ... ] ] ] hash
|
||||
*
|
||||
* @param string $key The main string key
|
||||
* @param mixed $value The values to set
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function add_(string $key, $value);
|
||||
|
||||
/**
|
||||
* Remove content with [ [ [ ... ] ] ] hash
|
||||
*
|
||||
* @param string $key The main string key
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function remove_(string $key);
|
||||
|
||||
/**
|
||||
* Set content with # # # hash
|
||||
*
|
||||
* @param string $key The main string key
|
||||
* @param mixed $value The values to set
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function set_h(string $key, $value);
|
||||
|
||||
/**
|
||||
* Get content with # # # hash
|
||||
*
|
||||
* @param string $key The main string key
|
||||
*
|
||||
* @return mixed
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function get_h(string $key);
|
||||
|
||||
/**
|
||||
* Does key exist with # # # hash
|
||||
*
|
||||
* @param string $key The main string key
|
||||
*
|
||||
* @return bool
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function exist_h(string $key): bool;
|
||||
|
||||
/**
|
||||
* Add content with # # # hash
|
||||
*
|
||||
* @param string $key The main string key
|
||||
* @param mixed $value The values to set
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function add_h(string $key, $value);
|
||||
|
||||
/**
|
||||
* Remove content with # # # hash
|
||||
*
|
||||
* @param string $key The main string key
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function remove_h(string $key);
|
||||
|
||||
/**
|
||||
* Set a type of placeholder with set of values
|
||||
*
|
||||
@ -57,6 +215,16 @@ interface PlaceholderInterface
|
||||
*/
|
||||
public function update(string $data, array &$placeholder, int $action = 1): string;
|
||||
|
||||
/**
|
||||
* Update the data with the active placeholders
|
||||
*
|
||||
* @param string $data The actual data
|
||||
*
|
||||
* @return string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function update_(string $data): string;
|
||||
|
||||
/**
|
||||
* return the placeholders for inserted and replaced code
|
||||
*
|
||||
|
@ -13,8 +13,6 @@ namespace VDM\Joomla\Componentbuilder\Compiler;
|
||||
|
||||
|
||||
use VDM\Joomla\Utilities\ArrayHelper;
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
use VDM\Joomla\Utilities\GetHelper;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Factory as Compiler;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Config;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Placefix;
|
||||
@ -56,6 +54,270 @@ class Placeholder implements PlaceholderInterface
|
||||
$this->config = $config ?: Compiler::_('Config');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set content
|
||||
*
|
||||
* @param string $key The main string key
|
||||
* @param mixed $value The values to set
|
||||
* @param bool $hash Add the hash around the key
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function set(string $key, $value, bool $hash = true)
|
||||
{
|
||||
if ($hash)
|
||||
{
|
||||
$this->set_($key, $value);
|
||||
$this->set_h($key, $value);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->active[$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get content by key
|
||||
*
|
||||
* @param string $key The main string key
|
||||
*
|
||||
* @return mixed
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function get(string $key)
|
||||
{
|
||||
return $this->active[$key] ?? $this->get_($key) ?? $this->get_h($key) ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Does key exist at all in any variation
|
||||
*
|
||||
* @param string $key The main string key
|
||||
*
|
||||
* @return bool
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function exist(string $key): bool
|
||||
{
|
||||
if (isset($this->active[$key]) || $this->exist_($key) || $this->exist_h($key))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add content
|
||||
*
|
||||
* @param string $key The main string key
|
||||
* @param mixed $value The values to set
|
||||
* @param bool $hash Add the hash around the key
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function add(string $key, $value, bool $hash = true)
|
||||
{
|
||||
if ($hash)
|
||||
{
|
||||
$this->add_($key, $value);
|
||||
$this->add_h($key, $value);
|
||||
}
|
||||
elseif (isset($this->active[$key]))
|
||||
{
|
||||
$this->active[$key] .= $value;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->active[$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove content
|
||||
*
|
||||
* @param string $key The main string key
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function remove(string $key)
|
||||
{
|
||||
if (isset($this->active[$key]))
|
||||
{
|
||||
unset($this->active[$key]);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->remove_($key);
|
||||
$this->remove_h($key);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set content with [ [ [ ... ] ] ] hash
|
||||
*
|
||||
* @param string $key The main string key
|
||||
* @param mixed $value The values to set
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function set_(string $key, $value)
|
||||
{
|
||||
$this->active[Placefix::_($key)] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get content with [ [ [ ... ] ] ] hash
|
||||
*
|
||||
* @param string $key The main string key
|
||||
*
|
||||
* @return mixed
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function get_(string $key)
|
||||
{
|
||||
return $this->active[Placefix::_($key)] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Does key exist with [ [ [ ... ] ] ] hash
|
||||
*
|
||||
* @param string $key The main string key
|
||||
*
|
||||
* @return bool
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function exist_(string $key): bool
|
||||
{
|
||||
if (isset($this->active[Placefix::_($key)]))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add content with [ [ [ ... ] ] ] hash
|
||||
*
|
||||
* @param string $key The main string key
|
||||
* @param mixed $value The values to set
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function add_(string $key, $value)
|
||||
{
|
||||
if (isset($this->active[Placefix::_($key)]))
|
||||
{
|
||||
$this->active[Placefix::_($key)] .= $value;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->active[Placefix::_($key)] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove content with [ [ [ ... ] ] ] hash
|
||||
*
|
||||
* @param string $key The main string key
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function remove_(string $key)
|
||||
{
|
||||
if ($this->exist_($key))
|
||||
{
|
||||
unset($this->active[Placefix::_($key)]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set content with # # # hash
|
||||
*
|
||||
* @param string $key The main string key
|
||||
* @param mixed $value The values to set
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function set_h(string $key, $value)
|
||||
{
|
||||
$this->active[Placefix::_h($key)] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get content with # # # hash
|
||||
*
|
||||
* @param string $key The main string key
|
||||
*
|
||||
* @return mixed
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function get_h(string $key)
|
||||
{
|
||||
return $this->active[Placefix::_h($key)] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Does key exist with # # # hash
|
||||
*
|
||||
* @param string $key The main string key
|
||||
*
|
||||
* @return bool
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function exist_h(string $key): bool
|
||||
{
|
||||
if (isset($this->active[Placefix::_h($key)]))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add content with # # # hash
|
||||
*
|
||||
* @param string $key The main string key
|
||||
* @param mixed $value The values to set
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function add_h(string $key, $value)
|
||||
{
|
||||
if ($this->exist_h($key))
|
||||
{
|
||||
$this->active[Placefix::_h($key)] .= $value;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->active[Placefix::_h($key)] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove content with # # # hash
|
||||
*
|
||||
* @param string $key The main string key
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function remove_h(string $key)
|
||||
{
|
||||
if ($this->exist_h($key))
|
||||
{
|
||||
unset($this->active[Placefix::_h($key)]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a type of placeholder with set of values
|
||||
*
|
||||
@ -76,8 +338,7 @@ class Placeholder implements PlaceholderInterface
|
||||
$number = 0;
|
||||
foreach ($values as $value)
|
||||
{
|
||||
$this->active[Placefix::_($key . $number)]
|
||||
= $value;
|
||||
$this->set($key . $number, $value);
|
||||
$number++;
|
||||
}
|
||||
}
|
||||
@ -93,16 +354,19 @@ class Placeholder implements PlaceholderInterface
|
||||
*/
|
||||
public function clearType(string $key)
|
||||
{
|
||||
$key = Placefix::_($key);
|
||||
$keys = [Placefix::_($key), Placefix::_h($key), $key];
|
||||
|
||||
foreach ($keys as $_key)
|
||||
{
|
||||
$this->active = array_filter(
|
||||
$this->active,
|
||||
function(string $k) use($key){
|
||||
return preg_replace('/\d/', '', $k) !== $key;
|
||||
function (string $k) use ($_key) {
|
||||
return preg_replace('/\d/', '', $k) !== $_key;
|
||||
},
|
||||
ARRAY_FILTER_USE_KEY
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the data with the placeholders
|
||||
@ -124,9 +388,9 @@ class Placeholder implements PlaceholderInterface
|
||||
// make sure the placeholders is an array
|
||||
if (!ArrayHelper::check($placeholder))
|
||||
{
|
||||
// This is an error, TODO actually we need to add a kind of log here to know that this happened
|
||||
return $data;
|
||||
}
|
||||
|
||||
// continue with the work of replacement
|
||||
if (1 == $action) // <-- just replace (default)
|
||||
{
|
||||
@ -148,7 +412,6 @@ class Placeholder implements PlaceholderInterface
|
||||
// only replace if the data has these placeholder values
|
||||
if ($replace === true)
|
||||
{
|
||||
|
||||
return str_replace(
|
||||
array_keys($placeholder), array_values($placeholder), $data
|
||||
);
|
||||
@ -176,6 +439,22 @@ class Placeholder implements PlaceholderInterface
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the data with the active placeholders
|
||||
*
|
||||
* @param string $data The actual data
|
||||
*
|
||||
* @return string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function update_(string $data): string
|
||||
{
|
||||
// just replace the placeholders in data
|
||||
return str_replace(
|
||||
array_keys($this->active), array_values($this->active), $data
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* return the placeholders for inserted and replaced code
|
||||
*
|
||||
@ -240,6 +519,5 @@ class Placeholder implements PlaceholderInterface
|
||||
return [ 'start' => "", 'end' => ""];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -44,6 +44,22 @@ class Power implements PowerInterface
|
||||
**/
|
||||
public array $active = [];
|
||||
|
||||
/**
|
||||
* All power namespaces
|
||||
*
|
||||
* @var array
|
||||
* @since 3.2.0
|
||||
**/
|
||||
public array $namespace = [];
|
||||
|
||||
/**
|
||||
* All composer namespaces
|
||||
*
|
||||
* @var array
|
||||
* @since 3.2.0
|
||||
**/
|
||||
public array $composer = [];
|
||||
|
||||
/**
|
||||
* The url to the power, if there is an error.
|
||||
*
|
||||
@ -475,10 +491,13 @@ class Power implements PowerInterface
|
||||
$namespace_array = array_map(function ($val) {
|
||||
return $this->getCleanNamespace($val);
|
||||
}, $namespace_array);
|
||||
|
||||
// set the actual class namespace
|
||||
$this->active[$guid]->_namespace = implode('\\', $namespace_array);
|
||||
// prefix values
|
||||
$this->active[$guid]->_namespace_prefix = $path_array;
|
||||
|
||||
// set global namespaces for autoloader
|
||||
$this->namespace[implode('.', $path_array)] = $path_array;
|
||||
|
||||
// get the parent folder (the first value in array)
|
||||
$prefix_folder = implode('.', $path_array);
|
||||
|
||||
@ -579,10 +598,10 @@ class Power implements PowerInterface
|
||||
$this->active[$guid]->composer
|
||||
)) ? json_decode($this->active[$guid]->composer, true) : null;
|
||||
|
||||
unset($this->active[$guid]->composer);
|
||||
|
||||
if (ArrayHelper::check($_composer))
|
||||
{
|
||||
$this->active[$guid]->composer = [];
|
||||
|
||||
foreach ($_composer as $composer)
|
||||
{
|
||||
if (isset($composer['access_point']) && StringHelper::check($composer['access_point']))
|
||||
@ -612,17 +631,15 @@ class Power implements PowerInterface
|
||||
{
|
||||
$namespace = $this->getCleanNamespace(explode(' as ', $namespace)[0]);
|
||||
}
|
||||
$this->active[$guid]->composer[$namespace] = $composer['access_point'];
|
||||
|
||||
// add composer namespaces for autoloader
|
||||
$this->composer[$namespace] = $composer['access_point'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->active[$guid]->composer = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -0,0 +1,214 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Compiler\Power;
|
||||
|
||||
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Factory as Compiler;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Power;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Config;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Content;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Line;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Indent;
|
||||
use VDM\Joomla\Utilities\ArrayHelper;
|
||||
|
||||
|
||||
/**
|
||||
* Compiler Autoloader
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
class Autoloader
|
||||
{
|
||||
/**
|
||||
* Power Objects
|
||||
*
|
||||
* @var Power
|
||||
* @since 3.2.0
|
||||
**/
|
||||
protected Power $power;
|
||||
|
||||
/**
|
||||
* Compiler Config
|
||||
*
|
||||
* @var Config
|
||||
* @since 3.2.0
|
||||
**/
|
||||
protected Config $config;
|
||||
|
||||
/**
|
||||
* Compiler Content
|
||||
*
|
||||
* @var Content
|
||||
* @since 3.2.0
|
||||
**/
|
||||
protected Content $content;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param Power|null $power The power object.
|
||||
* @param Config|null $config The compiler config object.
|
||||
* @param Content|null $content The compiler content object.
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function __construct(?Power $power = null, ?Config $config = null, ?Content $content = null)
|
||||
{
|
||||
$this->power = $power ?: Compiler::_('Power');
|
||||
$this->config = $config ?: Compiler::_('Config');
|
||||
$this->content = $content ?: Compiler::_('Content');
|
||||
|
||||
// reset all autoloaders power placeholders
|
||||
$this->content->set('ADMIN_POWER_HELPER', '');
|
||||
$this->content->set('SITE_POWER_HELPER', '');
|
||||
$this->content->set('CUSTOM_POWER_AUTOLOADER', '');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the autoloader into the active content array
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function set()
|
||||
{
|
||||
if (($size = ArrayHelper::check($this->power->namespace)) > 0)
|
||||
{
|
||||
// set if we should load the autoloader on the site area
|
||||
$loadSite = true;
|
||||
// check if we are using a plugin
|
||||
$use_plugin = $this->content->exist('PLUGIN_POWER_AUTOLOADER');
|
||||
// build the methods
|
||||
$autoloadNotSiteMethod = array();
|
||||
$autoloadMethod = array();
|
||||
// add only if we are not using a plugin
|
||||
$tab_space = 2;
|
||||
if (!$use_plugin)
|
||||
{
|
||||
$autoloadNotSiteMethod[] = PHP_EOL . PHP_EOL;
|
||||
$tab_space = 0;
|
||||
}
|
||||
elseif (!$loadSite)
|
||||
{
|
||||
// we add code to prevent this plugin from triggering on the site area
|
||||
$autoloadNotSiteMethod[] = PHP_EOL . Indent::_(2) . '//'
|
||||
. Line::_(__Line__, __Class__) . ' do not run the autoloader in the site area';
|
||||
$autoloadNotSiteMethod[] = Indent::_(2) . 'if ($this->app->isClient(\'site\'))';
|
||||
$autoloadNotSiteMethod[] = Indent::_(2) . '{';
|
||||
$autoloadNotSiteMethod[] = Indent::_(3) . 'return;';
|
||||
$autoloadNotSiteMethod[] = Indent::_(2) . '}' . PHP_EOL;
|
||||
}
|
||||
// we start building the spl_autoload_register function call
|
||||
$autoloadMethod[] = Indent::_($tab_space) . '//'
|
||||
. Line::_(__Line__, __Class__) . ' register this component namespace';
|
||||
$autoloadMethod[] = Indent::_($tab_space) . 'spl_autoload_register(function ($class) {';
|
||||
$autoloadMethod[] = Indent::_($tab_space) . Indent::_(1) . '//'
|
||||
. Line::_(__Line__, __Class__) . ' project-specific base directories and namespace prefix';
|
||||
$autoloadMethod[] = Indent::_($tab_space) . Indent::_(1) . '$search = array(';
|
||||
// ==== IMPORTANT NOTICE =====
|
||||
// make sure the name space values are sorted from the longest string to the shortest
|
||||
// so that the search do not mistakenly match a shorter namespace before a longer one
|
||||
// that has the same short namespace for example:
|
||||
// NameSpace\SubName\Sub <- will always match first
|
||||
// NameSpace\SubName\SubSubName
|
||||
// Should the shorter namespace be listed [first] it will match both of these:
|
||||
// NameSpace\SubName\Sub\ClassName
|
||||
// ^^^^^^^^^^^^^^^^^^^^^
|
||||
// NameSpace\SubName\SubSubName\ClassName
|
||||
// ^^^^^^^^^^^^^^^^^^^^^
|
||||
uksort($this->power->namespace, function ($a, $b) {
|
||||
return strlen($b) - strlen($a);
|
||||
});
|
||||
// counter to manage the comma in the actual array
|
||||
$counter = 1;
|
||||
foreach ($this->power->namespace as $base_dir => $prefix)
|
||||
{
|
||||
// don't add the ending comma on last value
|
||||
if ($size == $counter)
|
||||
{
|
||||
$autoloadMethod[] = Indent::_($tab_space) . Indent::_(2) . "'" . $this->config->get('jcb_powers_path', 'libraries/jcb_powers') . "/$base_dir' => '" . implode('\\\\', $prefix) . "'";
|
||||
}
|
||||
else
|
||||
{
|
||||
$autoloadMethod[] = Indent::_($tab_space) . Indent::_(2) . "'" . $this->config->get('jcb_powers_path', 'libraries/jcb_powers') . "/$base_dir' => '" . implode('\\\\', $prefix) . "',";
|
||||
}
|
||||
$counter++;
|
||||
}
|
||||
$autoloadMethod[] = Indent::_($tab_space) . Indent::_(1) . ');';
|
||||
$autoloadMethod[] = Indent::_($tab_space) . Indent::_(1) . '// Start the search and load if found';
|
||||
$autoloadMethod[] = Indent::_($tab_space) . Indent::_(1) . '$found = false;';
|
||||
$autoloadMethod[] = Indent::_($tab_space) . Indent::_(1) . '$found_base_dir = "";';
|
||||
$autoloadMethod[] = Indent::_($tab_space) . Indent::_(1) . '$found_len = 0;';
|
||||
$autoloadMethod[] = Indent::_($tab_space) . Indent::_(1) . 'foreach ($search as $base_dir => $prefix)';
|
||||
$autoloadMethod[] = Indent::_($tab_space) . Indent::_(1) . '{';
|
||||
$autoloadMethod[] = Indent::_($tab_space) . Indent::_(2) . '//'
|
||||
. Line::_(__Line__, __Class__) . ' does the class use the namespace prefix?';
|
||||
$autoloadMethod[] = Indent::_($tab_space) . Indent::_(2) . '$len = strlen($prefix);';
|
||||
$autoloadMethod[] = Indent::_($tab_space) . Indent::_(2) . 'if (strncmp($prefix, $class, $len) === 0)';
|
||||
$autoloadMethod[] = Indent::_($tab_space) . Indent::_(2) . '{';
|
||||
$autoloadMethod[] = Indent::_($tab_space) . Indent::_(3) . '//'
|
||||
. Line::_(__Line__, __Class__) . ' we have a match so load the values';
|
||||
$autoloadMethod[] = Indent::_($tab_space) . Indent::_(3) . '$found = true;';
|
||||
$autoloadMethod[] = Indent::_($tab_space) . Indent::_(3) . '$found_base_dir = $base_dir;';
|
||||
$autoloadMethod[] = Indent::_($tab_space) . Indent::_(3) . '$found_len = $len;';
|
||||
$autoloadMethod[] = Indent::_($tab_space) . Indent::_(3) . '//'
|
||||
. Line::_(__Line__, __Class__) . ' done here';
|
||||
$autoloadMethod[] = Indent::_($tab_space) . Indent::_(3) . 'break;';
|
||||
$autoloadMethod[] = Indent::_($tab_space) . Indent::_(2) . '}';
|
||||
$autoloadMethod[] = Indent::_($tab_space) . Indent::_(1) . '}';
|
||||
$autoloadMethod[] = Indent::_($tab_space) . Indent::_(1) . '//'
|
||||
. Line::_(__Line__, __Class__) . ' check if we found a match';
|
||||
$autoloadMethod[] = Indent::_($tab_space) . Indent::_(1) . 'if (!$found)';
|
||||
$autoloadMethod[] = Indent::_($tab_space) . Indent::_(1) . '{';
|
||||
$autoloadMethod[] = Indent::_($tab_space) . Indent::_(2) . '//'
|
||||
. Line::_(__Line__, __Class__) . ' no, move to the next registered autoloader';
|
||||
$autoloadMethod[] = Indent::_($tab_space) . Indent::_(2) . 'return;';
|
||||
$autoloadMethod[] = Indent::_($tab_space) . Indent::_(1) . '}';
|
||||
$autoloadMethod[] = Indent::_($tab_space) . Indent::_(1) . '//'
|
||||
. Line::_(__Line__, __Class__) . ' get the relative class name';
|
||||
$autoloadMethod[] = Indent::_($tab_space) . Indent::_(1) . '$relative_class = substr($class, $found_len);';
|
||||
$autoloadMethod[] = Indent::_($tab_space) . Indent::_(1) . '//'
|
||||
. Line::_(__Line__, __Class__) . ' replace the namespace prefix with the base directory, replace namespace';
|
||||
$autoloadMethod[] = Indent::_($tab_space) . Indent::_(1) . '// separators with directory separators in the relative class name, append';
|
||||
$autoloadMethod[] = Indent::_($tab_space) . Indent::_(1) . '// with .php';
|
||||
$autoloadMethod[] = Indent::_($tab_space) . Indent::_(1) . "\$file = JPATH_ROOT . '/' . \$found_base_dir . '/src' . str_replace('\\\\', '/', \$relative_class) . '.php';";
|
||||
$autoloadMethod[] = Indent::_($tab_space) . Indent::_(1) . '//'
|
||||
. Line::_(__Line__, __Class__) . ' if the file exists, require it';
|
||||
$autoloadMethod[] = Indent::_($tab_space) . Indent::_(1) . 'if (file_exists($file))';
|
||||
$autoloadMethod[] = Indent::_($tab_space) . Indent::_(1) . '{';
|
||||
$autoloadMethod[] = Indent::_($tab_space) . Indent::_(2) . 'require $file;';
|
||||
$autoloadMethod[] = Indent::_($tab_space) . Indent::_(1) . '}';
|
||||
$autoloadMethod[] = Indent::_($tab_space) . '});';
|
||||
// create the method string
|
||||
$autoloader = implode(PHP_EOL, $autoloadNotSiteMethod) . implode(PHP_EOL, $autoloadMethod);
|
||||
// check if we are using a plugin
|
||||
if ($use_plugin)
|
||||
{
|
||||
$this->content->set('PLUGIN_POWER_AUTOLOADER', PHP_EOL . $autoloader);
|
||||
}
|
||||
else
|
||||
{
|
||||
// load to events placeholders
|
||||
$this->content->add('ADMIN_POWER_HELPER', $autoloader);
|
||||
// load to site if needed
|
||||
if ($loadSite)
|
||||
{
|
||||
$this->content->add('SITE_POWER_HELPER', $autoloader);
|
||||
}
|
||||
}
|
||||
// to add to custom files
|
||||
$this->content->add('CUSTOM_POWER_AUTOLOADER', PHP_EOL . implode(PHP_EOL, $autoloadMethod));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
@ -14,7 +14,8 @@ namespace VDM\Joomla\Componentbuilder\Compiler\Service;
|
||||
|
||||
use Joomla\DI\Container;
|
||||
use Joomla\DI\ServiceProviderInterface;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Power as CompilerPower;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Power as Powers;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Power\Autoloader;
|
||||
|
||||
|
||||
/**
|
||||
@ -34,26 +35,47 @@ class Power implements ServiceProviderInterface
|
||||
*/
|
||||
public function register(Container $container)
|
||||
{
|
||||
$container->alias(CompilerPower::class, 'Power')
|
||||
->share('Power', [$this, 'getPower'], true);
|
||||
$container->alias(Powers::class, 'Power')
|
||||
->share('Power', [$this, 'getPowers'], true);
|
||||
|
||||
$container->alias(Autoloader::class, 'Power.Autoloader')
|
||||
->share('Power.Autoloader', [$this, 'getAutoloader'], true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Compiler Power
|
||||
* Get the Powers
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return CompilerPower
|
||||
* @return Powers
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getPower(Container $container): CompilerPower
|
||||
public function getPowers(Container $container): Powers
|
||||
{
|
||||
return new CompilerPower(
|
||||
return new Powers(
|
||||
$container->get('Config'),
|
||||
$container->get('Placeholder'),
|
||||
$container->get('Customcode'),
|
||||
$container->get('Customcode.Gui')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Compiler Autoloader
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Autoloader
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getAutoloader(Container $container): Autoloader
|
||||
{
|
||||
return new Autoloader(
|
||||
$container->get('Power'),
|
||||
$container->get('Config'),
|
||||
$container->get('Content')
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user