Moves all major structre function to container. Adds new Server replacment class for legacy calls. Refactored multiple classes. Add more advanced compiler options, with donation notice.

This commit is contained in:
2023-02-12 21:15:41 +02:00
parent 7fa8964b44
commit 339aec221e
58 changed files with 4552 additions and 1755 deletions

View File

@ -19,7 +19,6 @@ use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Componentbuilder\Compiler\Factory as CFactory;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Placefix;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Indent;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Line;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Unique;
/**
@ -1140,7 +1139,7 @@ class Get
// set the old version
CFactory::_('Component')->set('old_component_version', CFactory::_('Component')->component_version);
// set the new version, and set update switch
CFactory::_('Component')->set('component_version ', implode(
CFactory::_('Component')->set('component_version', implode(
'.', $version
));
}
@ -2772,7 +2771,7 @@ class Get
* get the plugin xml template
*
* @return string
*
* @deprecated 3.3
*/
public function getPluginXMLTemplate(&$plugin)
{
@ -2804,7 +2803,6 @@ class Get
* @param int $when To set when to update
*
* @return void
*
* @deprecated 3.3
*/
protected function setNewCustomCode($when = 1)
@ -2826,7 +2824,6 @@ class Get
* @param int $when To set when to update
*
* @return void
*
* @deprecated 3.3
*/
protected function setExistingCustomCode($when = 1)

File diff suppressed because it is too large Load Diff

View File

@ -5443,7 +5443,7 @@ class Fields extends Structure
}
// load another file
$target = array('admin' => 'customfield');
$this->buildDynamique(
CFactory::_('Utilities.Structure')->build(
$target, 'fieldcustom', $data['custom']['type']
);
// get the extends name
@ -5540,7 +5540,7 @@ class Fields extends Structure
{
// first build the custom field type file
$target = array('admin' => 'customfield');
$this->buildDynamique(
CFactory::_('Utilities.Structure')->build(
$target, 'field' . $data['custom']['extends'],
$data['custom']['type']
);
@ -5739,7 +5739,7 @@ class Fields extends Structure
{
// we first create the file
$target = array('admin' => 'filter_' . $nameListCode);
$this->buildDynamique(
CFactory::_('Utilities.Structure')->build(
$target, 'filter'
);
// the search language string
@ -6087,7 +6087,7 @@ class Fields extends Structure
CFactory::_('Content')->set_('customfilterfield_' . $filter['filter_type'], 'ADD_BUTTON', '');
// now build the custom filter field type file
$target = array('admin' => 'customfilterfield');
$this->buildDynamique(
CFactory::_('Utilities.Structure')->build(
$target, 'fieldlist',
$filter['filter_type']
);

View File

@ -273,7 +273,7 @@ class Interpretation extends Fields
$component = CFactory::_('Config')->component_code_name;
$Component = CFactory::_('Content')->get('Component');
$target = array('admin' => 'emailer');
$done = $this->buildDynamique($target, 'emailer', $component);
$done = CFactory::_('Utilities.Structure')->build($target, 'emailer', $component);
if ($done)
{
// the text for the file BAKING
@ -820,7 +820,7 @@ class Interpretation extends Fields
{
// set whmcs encrypt file into place
$target = array('admin' => 'whmcs');
$done = $this->buildDynamique($target, 'whmcs');
$done = CFactory::_('Utilities.Structure')->build($target, 'whmcs');
// the text for the file WHMCS_ENCRYPTION_BODY
CFactory::_('Content')->set_('whmcs', 'WHMCS_ENCRYPTION_BODY', $this->setWHMCSCryption());
// ENCRYPT_FILE
@ -1105,7 +1105,7 @@ class Interpretation extends Fields
);
$name = explode('.xml', $name)[0];
$target = array('admin' => $name);
$this->buildDynamique($target, 'update_server');
CFactory::_('Utilities.Structure')->build($target, 'update_server');
CFactory::_('Content')->set_($name, 'UPDATE_SERVER_XML', implode(PHP_EOL, $updateXML));
// set the Update server file name
@ -1284,7 +1284,7 @@ class Interpretation extends Fields
{
$name = StringHelper::safe($update['version']);
$target = array('admin' => $name);
$this->buildDynamique($target, 'sql_update', $update['version']);
CFactory::_('Utilities.Structure')->build($target, 'sql_update', $update['version']);
$_name = preg_replace('/[\.]+/', '_', (string) $update['version']);
CFactory::_('Content')->set_($name . '_' . $_name, 'UPDATE_VERSION_MYSQL',
$update['mysql']
@ -1389,10 +1389,10 @@ class Interpretation extends Fields
{
// set help file into admin place
$target = array('admin' => 'help');
$admindone = $this->buildDynamique($target, 'help');
$admindone = CFactory::_('Utilities.Structure')->build($target, 'help');
// set the help file into site place
$target = array('site' => 'help');
$sitedone = $this->buildDynamique($target, 'help');
$sitedone = CFactory::_('Utilities.Structure')->build($target, 'help');
if ($admindone && $sitedone)
{
// HELP
@ -2133,7 +2133,7 @@ class Interpretation extends Fields
// build the file target values
$target = array('site' => $nameSingleCode);
// build the edit.xml file
if ($this->buildDynamique($target, 'admin_menu'))
if (CFactory::_('Utilities.Structure')->build($target, 'admin_menu'))
{
// set the lang
$lang = StringHelper::safe(
@ -2183,7 +2183,7 @@ class Interpretation extends Fields
// build the file target values
$target = array('site' => $view['settings']->code);
// build the default.xml file
if ($this->buildDynamique($target, 'menu'))
if (CFactory::_('Utilities.Structure')->build($target, 'menu'))
{
// set the lang
$lang = StringHelper::safe(
@ -5471,9 +5471,11 @@ class Interpretation extends Fields
elseif (1 == $type)
{
// add this button only if this is not the default view
if ($this->dynamicDashboardType !== 'custom_admin_views'
|| ($this->dynamicDashboardType === 'custom_admin_views'
&& $this->dynamicDashboard !== $viewCodeName))
$dynamic_dashboard = CFactory::_('Registry')->get('build.dashboard', '');
$dynamic_dashboard_type = CFactory::_('Registry')->get('build.dashboard.type', '');
if ($dynamic_dashboard_type !== 'custom_admin_views'
|| ($dynamic_dashboard_type === 'custom_admin_views'
&& $dynamic_dashboard !== $viewCodeName))
{
$buttons[] = $tab . Indent::_(2)
. "//" . Line::_(__Line__, __Class__) . " add cpanel button";
@ -5663,7 +5665,7 @@ class Interpretation extends Fields
// add the controller for this view
// build the file
$target = array(CFactory::_('Config')->build_target => $viewCodeName);
$this->buildDynamique($target, 'custom_form');
CFactory::_('Utilities.Structure')->build($target, 'custom_form');
// GET_FORM_CUSTOM
}
}
@ -5807,14 +5809,14 @@ class Interpretation extends Fields
))
{
// get dates
$created = $this->getCreatedDate($view);
$modified = $this->getLastModifiedDate($view);
$created = CFactory::_('Model.Createdate')->get($view);
$modified = CFactory::_('Model.Modifieddate')->get($view);
// add file to view
$target = array(CFactory::_('Config')->build_target => $view['settings']->code);
$config = array(Placefix::_h('CREATIONDATE') => $created,
Placefix::_h('BUILDDATE') => $modified,
Placefix::_h('VERSION') => $view['settings']->version);
$this->buildDynamique($target, 'javascript_file', false, $config);
CFactory::_('Utilities.Structure')->build($target, 'javascript_file', false, $config);
// set path
if ('site' === CFactory::_('Config')->build_target)
{
@ -6997,8 +6999,8 @@ class Interpretation extends Fields
if (($data_ = CFactory::_('Registry')->
extract('builder.template_data.' . CFactory::_('Config')->build_target . '.' . $view['settings']->code)) !== null)
{
$created = $this->getCreatedDate($view);
$modified = $this->getLastModifiedDate($view);
$created = CFactory::_('Model.Createdate')->get($view);
$modified = CFactory::_('Model.Modifieddate')->get($view);
foreach ($data_ as $template => $data)
{
// build the file
@ -7006,7 +7008,7 @@ class Interpretation extends Fields
$config = array(Placefix::_h('CREATIONDATE') => $created,
Placefix::_h('BUILDDATE') => $modified,
Placefix::_h('VERSION') => $view['settings']->version);
$this->buildDynamique($target, 'template', $template, $config);
CFactory::_('Utilities.Structure')->build($target, 'template', $template, $config);
// set the file data
$TARGET = StringHelper::safe(
CFactory::_('Config')->build_target, 'U'
@ -7050,7 +7052,7 @@ class Interpretation extends Fields
{
// build the file
$target = array(CFactory::_('Config')->build_target => $layout);
$this->buildDynamique($target, 'layout');
CFactory::_('Utilities.Structure')->build($target, 'layout');
// set the file data
$TARGET = StringHelper::safe(
CFactory::_('Config')->build_target, 'U'
@ -13424,12 +13426,12 @@ class Interpretation extends Fields
{
// first build the layout file
$target = array('admin' => $nameSingleCode);
$this->buildDynamique($target, $type, $layoutName);
CFactory::_('Utilities.Structure')->build($target, $type, $layoutName);
// add to front if needed
if (CFactory::_('Config')->lang_target === 'both')
{
$target = array('site' => $nameSingleCode);
$this->buildDynamique($target, $type, $layoutName);
CFactory::_('Utilities.Structure')->build($target, $type, $layoutName);
}
if (StringHelper::check($items))
{
@ -13458,12 +13460,12 @@ class Interpretation extends Fields
{
// first build the layout file
$target = array('admin' => $nameSingleCode);
$this->buildDynamique($target, 'layoutoverride', $layoutName);
CFactory::_('Utilities.Structure')->build($target, 'layoutoverride', $layoutName);
// add to front if needed
if (CFactory::_('Config')->lang_target === 'both')
{
$target = array('site' => $nameSingleCode);
$this->buildDynamique($target, 'layoutoverride', $layoutName);
CFactory::_('Utilities.Structure')->build($target, 'layoutoverride', $layoutName);
}
// make sure items is an empty string (should not be needed.. but)
if (!StringHelper::check($items))
@ -15404,7 +15406,7 @@ class Interpretation extends Fields
{
// setup Ajax files
$target = array('admin' => 'import_' . $nameListCode);
$this->buildDynamique($target, 'customimport');
CFactory::_('Utilities.Structure')->build($target, 'customimport');
// load the custom script to the files
// IMPORT_EXT_METHOD <<<DYNAMIC>>>
CFactory::_('Content')->set_('import_' . $nameListCode, 'IMPORT_EXT_METHOD', CFactory::_('Customcode.Dispenser')->get(
@ -16566,14 +16568,14 @@ class Interpretation extends Fields
&& StringHelper::check($list_fileScript))
{
// get dates
$_created = $this->getCreatedDate($viewArray);
$_modified = $this->getLastModifiedDate($viewArray);
$_created = CFactory::_('Model.Createdate')->get($viewArray);
$_modified = CFactory::_('Model.Modifieddate')->get($viewArray);
// add file to view
$_target = array(CFactory::_('Config')->build_target => $nameListCode);
$_config = array(Placefix::_h('CREATIONDATE') => $_created,
Placefix::_h('BUILDDATE') => $_modified,
Placefix::_h('VERSION') => $viewArray['settings']->version);
$this->buildDynamique($_target, 'javascript_file', false, $_config);
CFactory::_('Utilities.Structure')->build($_target, 'javascript_file', false, $_config);
// set path
$_path = '/administrator/components/com_' . CFactory::_('Config')->component_code_name
. '/assets/js/' . $nameListCode . '.js';
@ -18733,7 +18735,7 @@ class Interpretation extends Fields
{
// lets also set the category helper for this view
$target = array('site' => 'category' . $otherView);
$this->buildDynamique($target, 'category');
CFactory::_('Utilities.Structure')->build($target, 'category');
// insure the file gets updated
CFactory::_('Content')->set_('category' . $otherView, 'view', $otherView);
CFactory::_('Content')->set_('category' . $otherView, 'View', ucfirst((string) $otherView));
@ -22951,7 +22953,7 @@ class Interpretation extends Fields
$slidecounter++;
// build the template file
$target = array('custom_admin' => CFactory::_('Config')->component_code_name);
$this->buildDynamique($target, 'template', $tempName);
CFactory::_('Utilities.Structure')->build($target, 'template', $tempName);
// set the file data
$TARGET = StringHelper::safe(
CFactory::_('Config')->build_target, 'U'
@ -23178,7 +23180,7 @@ class Interpretation extends Fields
// set the code name
$codeName = CFactory::_('Config')->component_code_name;
// set default dashboard
if (!StringHelper::check($this->dynamicDashboard))
if (!CFactory::_('Registry')->get('build.dashboard'))
{
$menus .= "JHtmlSidebar::addEntry(JText:" . ":_('" . $lang
. "_DASHBOARD'), 'index.php?option=com_" . $codeName
@ -24272,7 +24274,7 @@ class Interpretation extends Fields
CFactory::_('Config')->lang_target, $lang . '_GLOBAL_DESC', "The Global Parameters"
);
// add auto checkin if required
if ($this->addCheckin)
if (CFactory::_('Config')->get('add_checkin', false))
{
$this->configFieldSets[] = Indent::_(2) . "<field";
$this->configFieldSets[] = Indent::_(3) . 'name="check_in"';

View File

@ -116,7 +116,8 @@ class Infusion extends Interpretation
CFactory::_('Content')->get('CREATIONDATE'));
// BUILDDATE
CFactory::_('Content')->set('BUILDDATE', JFactory::getDate()->format('jS F, Y'));
CFactory::_('Content')->set('BUILDDATE', JFactory::getDate(
CFactory::_('Config')->get('build_date', 'now'))->format('jS F, Y'));
CFactory::_('Content')->set('GLOBALBUILDDATE',
CFactory::_('Content')->get('BUILDDATE'));
@ -1104,8 +1105,8 @@ class Infusion extends Interpretation
);
// check if this custom admin view is the default view
if ($this->dynamicDashboardType === 'custom_admin_views'
&& $this->dynamicDashboard === $view['settings']->code)
if (CFactory::_('Registry')->get('build.dashboard.type', '') === 'custom_admin_views'
&& CFactory::_('Registry')->get('build.dashboard', '') === $view['settings']->code)
{
// HIDEMAINMENU <<<DYNAMIC>>>
CFactory::_('Content')->set_($view['settings']->code, 'HIDEMAINMENU', '');
@ -1328,7 +1329,7 @@ class Infusion extends Interpretation
$this->setVersionController();
// only set these if default dashboard it used
if (!StringHelper::check($this->dynamicDashboard))
if (!CFactory::_('Registry')->get('build.dashboard'))
{
// DASHBOARDVIEW
CFactory::_('Content')->set('DASHBOARDVIEW', CFactory::_('Config')->component_code_name);
@ -1360,7 +1361,7 @@ class Infusion extends Interpretation
else
{
// DASHBOARDVIEW
CFactory::_('Content')->set('DASHBOARDVIEW', $this->dynamicDashboard);
CFactory::_('Content')->set('DASHBOARDVIEW', CFactory::_('Registry')->get('build.dashboard'));
}
// add import
@ -1368,7 +1369,7 @@ class Infusion extends Interpretation
{
// setup import files
$target = array('admin' => 'import');
$this->buildDynamique($target, 'import');
CFactory::_('Utilities.Structure')->build($target, 'import');
// IMPORT_EXT_METHOD <<<DYNAMIC>>>
CFactory::_('Content')->set_('import', 'IMPORT_EXT_METHOD', PHP_EOL . PHP_EOL . CFactory::_('Placeholder')->update_(
ComponentbuilderHelper::getDynamicScripts('ext')
@ -1388,7 +1389,7 @@ class Infusion extends Interpretation
{
// setup Ajax files
$target = array('admin' => 'ajax');
$this->buildDynamique($target, 'ajax');
CFactory::_('Utilities.Structure')->build($target, 'ajax');
// set the controller
CFactory::_('Content')->set_('ajax', 'REGISTER_AJAX_TASK', $this->setRegisterAjaxTask('admin'));
CFactory::_('Content')->set_('ajax', 'AJAX_INPUT_RETURN', $this->setAjaxInputReturn('admin'));
@ -1403,7 +1404,7 @@ class Infusion extends Interpretation
{
// setup Ajax files
$target = array('site' => 'ajax');
$this->buildDynamique($target, 'ajax');
CFactory::_('Utilities.Structure')->build($target, 'ajax');
// set the controller
CFactory::_('Content')->set_('ajax', 'REGISTER_SITE_AJAX_TASK', $this->setRegisterAjaxTask('site'));
CFactory::_('Content')->set_('ajax', 'AJAX_SITE_INPUT_RETURN', $this->setAjaxInputReturn('site'));
@ -1420,7 +1421,7 @@ class Infusion extends Interpretation
{
// setup rule file
$target = array('admin' => 'a_rule_zi');
$this->buildDynamique($target, 'rule', $rule);
CFactory::_('Utilities.Structure')->build($target, 'rule', $rule);
// set the JFormRule Name
CFactory::_('Content')->set_('a_rule_zi_' . $rule, 'Name', ucfirst((string) $rule));
// set the JFormRule PHP