From f44f38515980764f6d69998a234b6c62b61e3fcf Mon Sep 17 00:00:00 2001 From: Llewellyn van der Merwe Date: Sun, 15 Jan 2023 10:42:19 +0200 Subject: [PATCH] Converts compiler to move component get methods to the powers area. --- README.md | 4 +- admin/README.txt | 4 +- admin/helpers/compiler.php | 46 +- admin/helpers/compiler/a_Get.php | 1087 ++++++++--------- admin/helpers/compiler/b_Structure.php | 86 +- admin/helpers/compiler/c_Fields.php | 74 +- admin/helpers/compiler/e_Interpretation.php | 1085 ++++++++-------- admin/helpers/compiler/f_Infusion.php | 41 +- admin/sql/install.mysql.utf8.sql | 2 +- componentbuilder.xml | 2 +- .../Abstraction/BaseConfig.php | 14 +- .../src/Componentbuilder/Compiler/Config.php | 347 +++++- 12 files changed, 1446 insertions(+), 1346 deletions(-) diff --git a/README.md b/README.md index 52c479f86..c09c7d233 100644 --- a/README.md +++ b/README.md @@ -140,11 +140,11 @@ 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*: 8th January, 2023 ++ *Last Build*: 15th January, 2023 + *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*: **344993** ++ *Line count*: **345248** + *Field count*: **2009** + *File count*: **2240** + *Folder count*: **399** diff --git a/admin/README.txt b/admin/README.txt index 52c479f86..c09c7d233 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -140,11 +140,11 @@ 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*: 8th January, 2023 ++ *Last Build*: 15th January, 2023 + *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*: **344993** ++ *Line count*: **345248** + *Field count*: **2009** + *File count*: **2240** + *Folder count*: **399** diff --git a/admin/helpers/compiler.php b/admin/helpers/compiler.php index 61915e6cc..8e577cba5 100644 --- a/admin/helpers/compiler.php +++ b/admin/helpers/compiler.php @@ -120,10 +120,12 @@ class Compiler extends Infusion ); $this->writeFile($xmlPath, $componentXML); } + // for plugin event TODO change event api signatures + $component_context = CFactory::_('Config')->component_context; // Trigger Event: jcb_ce_onBeforeUpdateFiles CFactory::_('Event')->trigger( 'jcb_ce_onBeforeUpdateFiles', - array(&$this->componentContext, &$this) + array(&$component_context, &$this) ); // now update the files if (!$this->updateFiles()) @@ -133,7 +135,7 @@ class Compiler extends Infusion // Trigger Event: jcb_ce_onBeforeGetCustomCode CFactory::_('Event')->trigger( 'jcb_ce_onBeforeGetCustomCode', - array(&$this->componentContext, &$this) + array(&$component_context, &$this) ); // now insert into the new files if (CFactory::_('Customcode')->get()) @@ -141,7 +143,7 @@ class Compiler extends Infusion // Trigger Event: jcb_ce_onBeforeAddCustomCode CFactory::_('Event')->trigger( 'jcb_ce_onBeforeAddCustomCode', - array(&$this->componentContext, &$this) + array(&$component_context, &$this) ); $this->addCustomCode(); @@ -149,7 +151,7 @@ class Compiler extends Infusion // Trigger Event: jcb_ce_onBeforeSetLangFileData CFactory::_('Event')->trigger( 'jcb_ce_onBeforeSetLangFileData', - array(&$this->componentContext, &$this) + array(&$component_context, &$this) ); // set the lang data now $this->setLangFileData(); @@ -216,13 +218,15 @@ class Compiler extends Infusion $message_fix['sql'] = JText::_( 'The SQL fix updates the #__assets table\'s column size on installation of the component and reverses it back to the Joomla default on uninstall of the component.' ); + // get the asset table fix switch + $add_assets_table_fix = CFactory::_('Config')->get('add_assets_table_fix', 0); // set assets table rules column notice - if (CFactory::_('Config')->add_assets_table_fix) + if ($add_assets_table_fix) { $this->app->enqueueMessage( JText::_('

Assets Table Notice

'), 'Notice' ); - $asset_table_fix_type = (CFactory::_('Config')->add_assets_table_fix == 2) + $asset_table_fix_type = ($add_assets_table_fix == 2) ? 'intelligent' : 'sql'; $this->app->enqueueMessage( JText::sprintf( @@ -241,13 +245,13 @@ class Compiler extends Infusion $this->app->enqueueMessage( JText::sprintf( 'The Joomla #__assets table\'s rules column has to be fixed for this component to work coherently. JCB has detected that in worse case the rules column in the #__assets table may require %s characters, and yet the Joomla default is only varchar(5120). JCB has three option to resolve this issue, first use less permissions in your component, second use the SQL fix, or the intelligent fix. %s %s', - $this->accessWorseCase, $message_fix['intelligent'], + CFactory::_('Config')->access_worse_case, $message_fix['intelligent'], $message_fix['sql'] ), 'Warning' ); } // set assets table name column warning if not set - if (!CFactory::_('Config')->add_assets_table_fix && $this->addAssetsTableNameFix) + if (!$add_assets_table_fix && CFactory::_('Config')->add_assets_table_name_fix) { // only add if not already added if ($this->accessSize < 30) @@ -381,7 +385,7 @@ class Compiler extends Infusion && ArrayHelper::check($this->newFiles['dynamic'])) { // get the bom file - $bom = FileHelper::getContent($this->bomPath); + $bom = FileHelper::getContent(CFactory::_('Config')->bom_path); // first we do the static files foreach ($this->newFiles['static'] as $static) { @@ -624,10 +628,12 @@ class Compiler extends Infusion */ protected function setFileContent(&$name, &$path, &$bom, $view = null) { + // for plugin event TODO change event api signatures + $component_context = CFactory::_('Config')->component_context; // Trigger Event: jcb_ce_onBeforeSetFileContent CFactory::_('Event')->trigger( 'jcb_ce_onBeforeSetFileContent', - array(&$this->componentContext, &$name, &$path, &$bom, &$view) + array(&$component_context, &$name, &$path, &$bom, &$view) ); // set the file name CFactory::_('Content')->set('FILENAME', $name); @@ -642,7 +648,7 @@ class Compiler extends Infusion // Trigger Event: jcb_ce_onGetFileContents CFactory::_('Event')->trigger( 'jcb_ce_onGetFileContents', - array(&$this->componentContext, &$string, &$name, &$path, &$bom, + array(&$component_context, &$string, &$name, &$path, &$bom, &$view) ); // see if we should add a BOM @@ -670,7 +676,7 @@ class Compiler extends Infusion // Trigger Event: jcb_ce_onBeforeSetFileContent CFactory::_('Event')->trigger( 'jcb_ce_onBeforeWriteFileContent', - array(&$this->componentContext, &$answer, &$name, &$path, &$bom, + array(&$component_context, &$answer, &$name, &$path, &$bom, &$view) ); // add answer back to file @@ -939,10 +945,12 @@ class Compiler extends Infusion $repoFullPath = $this->repoPath . '/com_' . $this->componentData->sales_name . '__joomla_' . CFactory::_('Config')->get('version', 3); + // for plugin event TODO change event api signatures + $component_context = CFactory::_('Config')->component_context; // Trigger Event: jcb_ce_onBeforeUpdateRepo CFactory::_('Event')->trigger( 'jcb_ce_onBeforeUpdateRepo', - array(&$this->componentContext, &$this->componentPath, + array(&$component_context, &$this->componentPath, &$repoFullPath, &$this->componentData) ); // remove old data @@ -952,7 +960,7 @@ class Compiler extends Infusion // Trigger Event: jcb_ce_onAfterUpdateRepo CFactory::_('Event')->trigger( 'jcb_ce_onAfterUpdateRepo', - array(&$this->componentContext, &$this->componentPath, + array(&$component_context, &$this->componentPath, &$repoFullPath, &$this->componentData) ); @@ -1040,10 +1048,12 @@ class Compiler extends Infusion // the name of the zip file to create $this->filepath['component'] = $this->tempPath . '/' . $this->filepath['component-folder'] . '.zip'; + // for plugin event TODO change event api signatures + $component_context = CFactory::_('Config')->component_context; // Trigger Event: jcb_ce_onBeforeZipComponent CFactory::_('Event')->trigger( 'jcb_ce_onBeforeZipComponent', - array(&$this->componentContext, &$this->componentPath, + array(&$component_context, &$this->componentPath, &$this->filepath['component'], &$this->tempPath, &$this->componentFolderName, &$this->componentData) ); @@ -1057,7 +1067,7 @@ class Compiler extends Infusion { // Trigger Event: jcb_ce_onBeforeBackupZip CFactory::_('Event')->trigger( - 'jcb_ce_onBeforeBackupZip', array(&$this->componentContext, + 'jcb_ce_onBeforeBackupZip', array(&$component_context, &$this->filepath['component'], &$this->tempPath, &$this->backupPath, @@ -1080,7 +1090,7 @@ class Compiler extends Infusion // Trigger Event: jcb_ce_onBeforeMoveToServer CFactory::_('Event')->trigger( 'jcb_ce_onBeforeMoveToServer', - array(&$this->componentContext, + array(&$component_context, &$this->filepath['component'], &$this->tempPath, &$this->componentSalesName, &$this->componentData) ); @@ -1096,7 +1106,7 @@ class Compiler extends Infusion // Trigger Event: jcb_ce_onAfterZipComponent CFactory::_('Event')->trigger( 'jcb_ce_onAfterZipComponent', - array(&$this->componentContext, &$this->filepath['component'], + array(&$component_context, &$this->filepath['component'], &$this->tempPath, &$this->componentFolderName, &$this->componentData) ); diff --git a/admin/helpers/compiler/a_Get.php b/admin/helpers/compiler/a_Get.php index a396974bf..90227ae4e 100644 --- a/admin/helpers/compiler/a_Get.php +++ b/admin/helpers/compiler/a_Get.php @@ -50,6 +50,7 @@ class Get * The Joomla Versions * * @var array + * @deprecated 3.3 Use CFactory::_('Config')->joomla_versions; */ public $joomlaVersions = array( 3 => array('folder_key' => 3, 'xml_version' => 3.9), // only joomla 3 @@ -152,6 +153,7 @@ class Get * Assets table worse case * * @var int + * @deprecated 3.3 Use CFactory::_('Config')->access_worse_case; */ public $accessWorseCase; @@ -159,6 +161,7 @@ class Get * Switch to add assets table name fix * * @var bool + * @deprecated 3.3 Use CFactory::_('Config')->add_assets_table_name_fix; */ public $addAssetsTableNameFix = false; @@ -510,6 +513,7 @@ class Get * The Component version * * @var string + * @deprecated 3.3 Use CFactory::_('Config')->component_version; */ public $component_version; @@ -517,6 +521,7 @@ class Get * The UIKIT Switch * * @var boolean + * @deprecated 3.3 Use CFactory::_('Config')->uikit; */ public $uikit = 0; @@ -524,6 +529,7 @@ class Get * The UIKIT component checker * * @var array + * @deprecated 3.3 Use CFactory::_('Registry')->get('builder.uikit_comp'); */ public $uikitComp = array(); @@ -531,6 +537,7 @@ class Get * The FOOTABLE Switch * * @var boolean + * @deprecated 3.3 Use CFactory::_('Config')->footable; */ public $footable = false; @@ -538,6 +545,7 @@ class Get * The FOOTABLE Version * * @var int + * @deprecated 3.3 Use CFactory::_('Config')->footable_version; */ public $footableVersion; @@ -545,13 +553,15 @@ class Get * The Google Chart Switch per view * * @var array + * @deprecated 3.3 Use CFactory::_('Registry')->get('builder.google_chart'); */ - public $googleChart = array(); + public $googleChart = []; /** * The Google Chart Switch * * @var boolean + * @deprecated 3.3 Use CFactory::_('Config')->google_chart; */ public $googlechart = false; @@ -559,6 +569,7 @@ class Get * The Import & Export Switch * * @var boolean + * @deprecated 3.3 Use CFactory::_('Config')->add_eximport; */ public $addEximport = false; @@ -580,6 +591,7 @@ class Get * The Tag & History Switch * * @var boolean + * @deprecated 3.3 Use CFactory::_('Config')->set_tag_history; */ public $setTagHistory = false; @@ -587,6 +599,7 @@ class Get * The Joomla Fields Switch * * @var boolean + * @deprecated 3.3 Use CFactory::_('Config')->set_joomla_fields; */ public $setJoomlaFields = false; @@ -594,13 +607,15 @@ class Get * The site edit views * * @var array + * @deprecated 3.3 Use CFactory::_('Registry')->get('builder.site_edit_view.'); */ - public $siteEditView = array(); + public $siteEditView = []; /** * The admin list view filter type * * @var array + * @deprecated 3.3 Use CFactory::_('Registry')->get('builder.admin_filter_type'); */ public $adminFilterType = array(); @@ -632,6 +647,7 @@ class Get * The unique codes * * @var array + * @deprecated 3.3 */ public $uniquecodes = array(); @@ -639,13 +655,15 @@ class Get * The unique keys * * @var array + * @deprecated 3.3 */ public $uniquekeys = array(); /** - * The Ad contributors Switch + * The Add contributors Switch * * @var boolean + * @deprecated 3.3 Use CFactory::_('Config')->add_contributors; */ public $addContributors = false; @@ -661,13 +679,15 @@ class Get * The Footable Script Builder * * @var array + * @deprecated 3.3 Use CFactory::_('Registry')->get('builder.footable_scripts'); */ - public $footableScripts = array(); + public $footableScripts = []; /** * The pathe to the bom file to be used * * @var string + * @deprecated 3.3 Use CFactory::_('Config')->bom_path; */ public $bomPath; @@ -675,8 +695,9 @@ class Get * The SQL Tweak of admin views * * @var array + * @deprecated 3.3 Use CFactory::_('Registry')->get('builder.sql_tweak'); */ - public $sqlTweak = array(); + public $sqlTweak = []; /** * The validation rules that should be added @@ -698,6 +719,7 @@ class Get * The admin views data array * * @var array + * @deprecated 3.3 */ private $_adminViewData = array(); @@ -713,8 +735,9 @@ class Get * The custom alias builder * * @var array + * @deprecated 3.3 Use CFactory::_('Registry')->get('builder.custom_alias'); */ - public $customAliasBuilder = array(); + public $customAliasBuilder = []; /** * The field builder type @@ -755,7 +778,7 @@ class Get * The field relations values * * @var array - * @deprecate Use CFactory::_('Registry')->get('builder.field_relations'); + * @deprecate 3.3 Use CFactory::_('Registry')->get('builder.field_relations'); */ public $fieldRelations = array(); @@ -770,6 +793,7 @@ class Get * Default Fields * * @var array + * @deprecated 3.3 Use CFactory::_('Config')->default_fields; */ public $defaultFields = array('created', 'created_by', 'modified', 'modified_by', 'published', @@ -779,7 +803,7 @@ class Get * The list join fields * * @var array - * @deprecate Use CFactory::_('Registry')->get('builder.list_join'); + * @deprecate 3.3 Use CFactory::_('Registry')->get('builder.list_join'); */ public $listJoinBuilder = array(); @@ -787,7 +811,7 @@ class Get * The list head over ride * * @var array - * @deprecate Use CFactory::_('Registry')->get('builder.list_head_override'); + * @deprecate 3.3 Use CFactory::_('Registry')->get('builder.list_head_override'); */ public $listHeadOverRide = array(); @@ -795,6 +819,7 @@ class Get * The linked admin view tabs * * @var array + * @deprecate 3.3 Use CFactory::_('Registry')->get('builder.linked_admin_views'); */ public $linkedAdminViews = array(); @@ -802,6 +827,7 @@ class Get * The custom admin view tabs * * @var array + * @deprecate 3.3 Use CFactory::_('Registry')->get('builder.custom_tabs'); */ public $customTabs = array(); @@ -809,6 +835,7 @@ class Get * The Add Ajax Switch * * @var boolean + * @deprecate 3.3 Use CFactory::_('Config')->add_ajax */ public $addAjax = false; @@ -816,6 +843,7 @@ class Get * The Add Site Ajax Switch * * @var boolean + * @deprecate 3.3 Use CFactory::_('Config')->add_site_ajax; */ public $addSiteAjax = false; @@ -823,27 +851,31 @@ class Get * The get Module Script Switch * * @var array + * @deprecate 3.3 Use CFactory::_('Registry')->get('builder.get_module'); */ - public $getModule = array(); + public $getModule = []; /** * The template data * * @var array + * @deprecate 3.3 Use CFactory::_('Registry')->get('builder.template_data'); */ - public $templateData = array(); + public $templateData = []; /** * The layout data * * @var array + * @deprecate 3.3 Use CFactory::_('Registry')->get('builder.layout_data'); */ - public $layoutData = array(); + public $layoutData = []; /** * The Encryption Types * * @var array + * @deprecated 3.3 Use CFactory::_('Config')->cryption_types; */ public $cryptionTypes = array('basic', 'medium', 'whmcs', 'expert'); @@ -883,64 +915,73 @@ class Get * The site main get * * @var array + * @deprecate 3.3 Use CFactory::_('Registry')->get('builder.site_main_get'); */ - public $siteMainGet = array(); + public $siteMainGet = []; /** * The site dynamic get * * @var array + * @deprecate 3.3 Use CFactory::_('Registry')->get('builder.site_dynamic_get'); */ - public $siteDynamicGet = array(); + public $siteDynamicGet = []; /** * The get AS lookup * * @var array + * @deprecate 3.3 Use CFactory::_('Registry')->get('builder.get_as_lookup'); */ - public $getAsLookup = array(); + public $getAsLookup = []; /** * The site fields * * @var array + * @deprecate 3.3 Use CFactory::_('Registry')->get('builder.site_fields'); */ - public $siteFields = array(); + public $siteFields = []; /** * The add SQL * * @var array + * @deprecate 3.3 Use CFactory::_('Registry')->get('builder.add_sql'); */ - public $addSQL = array(); + public $addSQL = []; /** * The update SQL * * @var array + * @deprecate 3.3 Use CFactory::_('Registry')->get('builder.update_sql'); */ - public $updateSQL = array(); + public $updateSQL = []; /** * The data by alias keys * * @var array + * @deprecate 3.3 Use CFactory::_('Registry')->get('builder.data_with_alias_keys'); */ - protected $dataWithAliasKeys = array(); + protected $dataWithAliasKeys = []; /** * The Library Manager * * @var array + * @deprecate 3.3 Use CFactory::_('Registry')->get('builder.library_manager'); */ - public $libManager = array(); + public $libManager = []; /** * The Libraries * * @var array + * @deprecated 3.3 Use CFactory::_('Registry')->get('builder.libraries'); */ - public $libraries = array(); + public $libraries = []; /** * Is minify Enabled @@ -962,6 +1003,7 @@ class Get * Set Tidy warning once switch * * @var bool + * @deprecated 3.3 Use CFactory::_('Config')->set_tidy_warning; */ public $setTidyWarning = false; @@ -969,6 +1011,7 @@ class Get * mysql table setting keys * * @var array + * @deprecated 3.3 Use CFactory::_('Config')->mysql_table_keys; */ public $mysqlTableKeys = array( @@ -982,8 +1025,9 @@ class Get * mysql table settings * * @var array + * @deprecated 3.3 Use CFactory::_('Registry')->get('builder.mysql_table_setting'); */ - public $mysqlTableSetting = array(); + public $mysqlTableSetting = []; /** * Constructor @@ -1063,17 +1107,19 @@ class Get // get the custom code from installed files CFactory::_('Customcode.Extractor')->run(); + // for plugin event TODO change event api signatures + $component_context = CFactory::_('Config')->component_context; // Trigger Event: jcb_ce_onBeforeGetComponentData CFactory::_('Event')->trigger( 'jcb_ce_onBeforeGetComponentData', - array(&$this->componentContext, &$this) + array(&$component_context, &$this) ); // get the component data $this->componentData = $this->getComponentData(); // Trigger Event: jcb_ce_onAfterGetComponentData CFactory::_('Event')->trigger( 'jcb_ce_onAfterGetComponentData', - array(&$this->componentContext, &$this) + array(&$component_context, &$this) ); // make sure we have a version if (strpos((string) $this->componentData->component_version, '.') @@ -1083,10 +1129,8 @@ class Get } // update the version if (!isset($this->componentData->old_component_version) - && (ArrayHelper::check($this->addSQL) - || ArrayHelper::check( - $this->updateSQL - ))) + && (CFactory::_('Registry')->get('builder.add_sql', null) + || CFactory::_('Registry')->get('builder.update_sql', null))) { // set the new version $version = (array) explode( @@ -1114,7 +1158,7 @@ class Get // Trigger Event: jcb_ce_onBeforeGet CFactory::_('Event')->trigger( - 'jcb_ce_onAfterGet', array(&$this->componentContext, &$this) + 'jcb_ce_onAfterGet', array(&$component_context, &$this) ); return true; @@ -1228,11 +1272,13 @@ class Get $query->where( $this->db->quoteName('a.id') . ' = ' . (int) CFactory::_('Config')->component_id ); - + // for plugin event TODO change event api signatures + $component_context = CFactory::_('Config')->component_context; + $component_id = CFactory::_('Config')->component_id; // Trigger Event: jcb_ce_onBeforeQueryComponentData CFactory::_('Event')->trigger( 'jcb_ce_onBeforeQueryComponentData', - array(&$this->componentContext, &$this->componentID, &$query, + array(&$component_context, &$component_id, &$query, &$this->db) ); @@ -1245,65 +1291,7 @@ class Get // Trigger Event: jcb_ce_onBeforeModelComponentData CFactory::_('Event')->trigger( 'jcb_ce_onBeforeModelComponentData', - array(&$this->componentContext, &$component) - ); - - // set updater - $updater = array( - 'unique' => array( - 'addadmin_views' => array('table' => 'component_admin_views', - 'val' => (int) $component->addadmin_views_id, - 'key' => 'id'), - 'addconfig' => array('table' => 'component_config', - 'val' => (int) CFactory::_('Config')->component_id, - 'key' => 'joomla_component'), - 'addcustom_admin_views' => array('table' => 'component_custom_admin_views', - 'val' => (int) CFactory::_('Config')->component_id, - 'key' => 'joomla_component'), - 'addcustommenus' => array('table' => 'component_custom_admin_menus', - 'val' => (int) CFactory::_('Config')->component_id, - 'key' => 'joomla_component'), - 'addfiles' => array('table' => 'component_files_folders', - 'val' => (int) CFactory::_('Config')->component_id, - 'key' => 'joomla_component'), - 'addfolders' => array('table' => 'component_files_folders', - 'val' => (int) CFactory::_('Config')->component_id, - 'key' => 'joomla_component'), - 'addsite_views' => array('table' => 'component_site_views', - 'val' => (int) CFactory::_('Config')->component_id, - 'key' => 'joomla_component'), - 'dashboard_tab' => array('table' => 'component_dashboard', - 'val' => (int) CFactory::_('Config')->component_id, - 'key' => 'joomla_component'), - 'sql_tweak' => array('table' => 'component_mysql_tweaks', - 'val' => (int) CFactory::_('Config')->component_id, - 'key' => 'joomla_component'), - 'version_update' => array('table' => 'component_updates', - 'val' => (int) CFactory::_('Config')->component_id, - 'key' => 'joomla_component') - ), - 'table' => 'joomla_component', - 'key' => 'id', - 'val' => (int) CFactory::_('Config')->component_id - ); - // repeatable fields to update - $searchRepeatables = array( - // repeatablefield => checker - 'addadmin_views' => 'adminview', - 'addconfig' => 'field', - 'addcontributors' => 'name', - 'addcustom_admin_views' => 'customadminview', - 'addcustommenus' => 'name', - 'addfiles' => 'file', - 'addfolders' => 'folder', - 'addsite_views' => 'siteview', - 'dashboard_tab' => 'name', - 'sql_tweak' => 'adminview', - 'version_update' => 'version' - ); - // update the repeatable fields - $component = ComponentbuilderHelper::convertRepeatableFields( - $component, $searchRepeatables, $updater + array(&$component_context, &$component) ); // load the global placeholders @@ -1320,8 +1308,9 @@ class Get ); // ensure version naming is correct - $this->component_version = preg_replace( - '/[^0-9.]+/', '', (string) $component->component_version + CFactory::_('Config')->set('component_version', preg_replace( + '/[^0-9.]+/', '', (string) $component->component_version + ) ); // set the add targets @@ -1363,7 +1352,7 @@ class Get } // set the uikit switch - $this->uikit = $component->adduikit; + CFactory::_('Config')->set('uikit', $component->adduikit); // set whmcs links if needed if (1 == $component->add_license @@ -1404,10 +1393,10 @@ class Get // set the footable switch if ($component->addfootable) { - $this->footable = true; + // force add footable + CFactory::_('Config')->set('footable ', true); // add the version - $this->footableVersion = (1 == $component->addfootable - || 2 == $component->addfootable) ? 2 : $component->addfootable; + CFactory::_('Config')->set('footable_version', (3 == $component->addfootable) ? 3 : 2); } // set the addcustommenus data @@ -1501,27 +1490,23 @@ class Get ) && $array['edit_create_site_view'] > 0) { - $this->siteEditView[$array['adminview']] = true; + CFactory::_('Registry')->set('builder.site_edit_view.' . $array['adminview'], true); CFactory::_('Config')->lang_target = 'both'; } // set the import/export option for this view - if (isset($array['port']) && $array['port'] - && !$this->addEximport) + if (isset($array['port']) && $array['port']) { - $this->addEximport = true; + CFactory::_('Config')->set('add_eximport', true); } // set the history tracking option for this view - if (isset($array['history']) && $array['history'] - && !$this->setTagHistory) + if (isset($array['history']) && $array['history']) { - $this->setTagHistory = true; + CFactory::_('Config')->set('set_tag_history', true); } // set the custom field integration for this view - if (isset($array['joomla_fields']) - && $array['joomla_fields'] - && !$this->setJoomlaFields) + if (isset($array['joomla_fields']) && $array['joomla_fields']) { - $this->setJoomlaFields = true; + CFactory::_('Config')->set('set_joomla_fields', true); } // has become a legacy issue, can't remove this $array['view'] = $array['adminview']; @@ -1530,16 +1515,17 @@ class Get $array['view'] ); // set the filter option for this view - $this->adminFilterType[$array['settings']->name_list_code] - = 1; // Side (old) [default for now] + CFactory::_('Registry')-> // Side (old) [default for now] + set('builder.admin_filter_type.' . $array['settings']->name_list_code, + 1); if (isset($array['filter']) && is_numeric( $array['filter'] - ) - && $array['filter'] > 0) + ) && $array['filter'] > 0) { - $this->adminFilterType[$array['settings']->name_list_code] - = (int) $array['filter']; + CFactory::_('Registry')-> + set('builder.admin_filter_type.' . $array['settings']->name_list_code, + (int) $array['filter']); } return $array; @@ -1651,20 +1637,20 @@ class Get unset($component->addconfig); } - // set the addcustommenus data + // set the add contributors $component->addcontributors = (isset($component->addcontributors) && JsonHelper::check($component->addcontributors)) ? json_decode((string) $component->addcontributors, true) : null; if (ArrayHelper::check($component->addcontributors)) { - $this->addContributors = true; + CFactory::_('Config')->set('add_contributors', true); $component->contributors = array_values( $component->addcontributors ); } unset($component->addcontributors); - // set the addcustommenus data + // set the version updates $component->version_update = (isset($component->version_update) && JsonHelper::check($component->version_update)) ? json_decode((string) $component->version_update, true) : null; @@ -1697,13 +1683,13 @@ class Get $component->addadmin_views, 'adminview' ); } - // check if a new version was manualy set + // check if a new version was manually set if (ObjectHelper::check($old_component)) { $old_component_version = preg_replace( '/[^0-9.]+/', '', (string) $old_component->component_version ); - if ($old_component_version != $this->component_version) + if ($old_component_version != CFactory::_('Config')->component_version) { // yes, this is a new version, this mean there may be manual sql and must be checked and updated $component->old_component_version @@ -1931,11 +1917,9 @@ class Get // bom if (StringHelper::check($component->bom)) { - $this->bomPath = CFactory::_('Config')->get('compiler_path', JPATH_COMPONENT_ADMINISTRATOR . '/compiler') . '/' . $component->bom; - } - else - { - $this->bomPath = CFactory::_('Config')->get('compiler_path', JPATH_COMPONENT_ADMINISTRATOR . '/compiler') . '/default.txt'; + CFactory::_('Config')->set('bom_path', + CFactory::_('Config')->get('compiler_path', JPATH_COMPONENT_ADMINISTRATOR . '/compiler') . '/' . $component->bom + ); } unset($component->bom); // README @@ -1993,7 +1977,7 @@ class Get { $component->php_dashboard_methods = ''; } - // reset back to nowlang + // reset back to now lang CFactory::_('Config')->lang_target = $nowLang; // add the update/sales server FTP details if that is the expected protocol @@ -2091,7 +2075,7 @@ class Get // Trigger Event: jcb_ce_onAfterModelComponentData CFactory::_('Event')->trigger( 'jcb_ce_onAfterModelComponentData', - array(&$this->componentContext, &$component) + array(&$component_context, &$component) ); // return the found component data @@ -2196,10 +2180,12 @@ class Get ); $query->where($this->db->quoteName('a.id') . ' = ' . (int) $id); + // for plugin event TODO change event api signatures + $component_context = CFactory::_('Config')->component_context; // Trigger Event: jcb_ce_onBeforeQueryViewData CFactory::_('Event')->trigger( 'jcb_ce_onBeforeQueryViewData', - array(&$this->componentContext, &$id, &$query, &$this->db) + array(&$component_context, &$id, &$query, &$this->db) ); // Reset the query using our newly populated query object. @@ -2233,7 +2219,7 @@ class Get // when the name is larger than 49 we need to add the assets' table name fix if ($name_length > 49) { - $this->addAssetsTableNameFix = true; + CFactory::_('Config')->set('add_assets_table_name_fix', true); } // set updater @@ -2294,10 +2280,11 @@ class Get // for plugin event TODO change event api signatures $placeholders = CFactory::_('Placeholder')->active; + $component_context = CFactory::_('Config')->component_context; // Trigger Event: jcb_ce_onBeforeModelViewData CFactory::_('Event')->trigger( 'jcb_ce_onBeforeModelViewData', - array(&$this->componentContext, &$view, &$placeholders) + array(&$component_context, &$view, &$placeholders) ); unset($placeholders); @@ -2312,122 +2299,122 @@ class Get unset($view->addtables); // set custom tabs - $this->customTabs[$view->name_single_code] = null; - $view->customtabs - = (isset($view->customtabs) + $view->customtabs = (isset($view->customtabs) && JsonHelper::check($view->customtabs)) ? json_decode((string) $view->customtabs, true) : null; if (ArrayHelper::check($view->customtabs)) { // setup custom tabs to global data sets - $this->customTabs[$view->name_single_code] = array_map( - function ($tab) use (&$view) { - // set the view name - $tab['view'] = $view->name_single_code; - // load the dynamic data - $tab['html'] = CFactory::_('Placeholder')->update_( - CFactory::_('Customcode')->update($tab['html']) - ); - // set the tab name - $tab['name'] = (isset($tab['name']) - && StringHelper::check( + CFactory::_('Registry')->set('builder.custom_tabs.' . $view->name_single_code, + array_map( + function ($tab) use (&$view) { + // set the view name + $tab['view'] = $view->name_single_code; + // load the dynamic data + $tab['html'] = CFactory::_('Placeholder')->update_( + CFactory::_('Customcode')->update($tab['html']) + ); + // set the tab name + $tab['name'] = (isset($tab['name']) + && StringHelper::check( + $tab['name'] + )) ? $tab['name'] : 'Tab'; + // set lang + $tab['lang'] = CFactory::_('Config')->lang_prefix . '_' + . StringHelper::safe( + $tab['view'], 'U' + ) . '_' . StringHelper::safe( + $tab['name'], 'U' + ); + CFactory::_('Language')->set( + 'both', $tab['lang'], $tab['name'] + ); + // set code name + $tab['code'] = StringHelper::safe( $tab['name'] - )) ? $tab['name'] : 'Tab'; - // set lang - $tab['lang'] = CFactory::_('Config')->lang_prefix . '_' - . StringHelper::safe( - $tab['view'], 'U' - ) . '_' . StringHelper::safe( - $tab['name'], 'U' ); - CFactory::_('Language')->set( - 'both', $tab['lang'], $tab['name'] - ); - // set code name - $tab['code'] = StringHelper::safe( - $tab['name'] - ); - // check if the permissions for the tab should be added - $_tab = ''; - if (isset($tab['permission']) - && $tab['permission'] == 1) - { - $_tab = Indent::_(1); - } - // check if the php of the tab is set, if not load it now - if (strpos((string) $tab['html'], 'bootstrap.addTab') === false - && strpos((string) $tab['html'], 'bootstrap.endTab') - === false) - { - // add the tab - $tmp = PHP_EOL . $_tab . Indent::_(1) - . ""; - $tmp .= PHP_EOL . $_tab . Indent::_(2) - . '
'; - $tmp .= PHP_EOL . $_tab . Indent::_(3) - . '
'; - $tmp .= PHP_EOL . $_tab . Indent::_(4) . implode( - PHP_EOL . $_tab . Indent::_(4), - (array) explode(PHP_EOL, trim((string) $tab['html'])) - ); - $tmp .= PHP_EOL . $_tab . Indent::_(3) . '
'; - $tmp .= PHP_EOL . $_tab . Indent::_(2) . '
'; - $tmp .= PHP_EOL . $_tab . Indent::_(1) - . ""; - // update html - $tab['html'] = $tmp; - } - else - { - $tab['html'] = PHP_EOL . $_tab . Indent::_(1) - . implode( - PHP_EOL . $_tab . Indent::_(1), - (array) explode(PHP_EOL, trim((string) $tab['html'])) - ); - } - // add the permissions if needed - if (isset($tab['permission']) - && $tab['permission'] == 1) - { - $tmp = PHP_EOL . Indent::_(1) - . "canDo->get('" - . $tab['view'] . "." . $tab['code'] - . ".viewtab')) : ?>"; - $tmp .= $tab['html']; - $tmp .= PHP_EOL . Indent::_(1) . ""; - // update html - $tab['html'] = $tmp; - // set lang for permissions - $tab['lang_permission'] = $tab['lang'] - . '_TAB_PERMISSION'; - $tab['lang_permission_desc'] = $tab['lang'] - . '_TAB_PERMISSION_DESC'; - $tab['lang_permission_title'] - = CFactory::_('Placeholder')->get('Views') . ' View ' - . $tab['name'] . ' Tab'; - CFactory::_('Language')->set( - 'both', $tab['lang_permission'], + // check if the permissions for the tab should be added + $_tab = ''; + if (isset($tab['permission']) + && $tab['permission'] == 1) + { + $_tab = Indent::_(1); + } + // check if the php of the tab is set, if not load it now + if (strpos((string) $tab['html'], 'bootstrap.addTab') === false + && strpos((string) $tab['html'], 'bootstrap.endTab') + === false) + { + // add the tab + $tmp = PHP_EOL . $_tab . Indent::_(1) + . ""; + $tmp .= PHP_EOL . $_tab . Indent::_(2) + . '
'; + $tmp .= PHP_EOL . $_tab . Indent::_(3) + . '
'; + $tmp .= PHP_EOL . $_tab . Indent::_(4) . implode( + PHP_EOL . $_tab . Indent::_(4), + (array) explode(PHP_EOL, trim((string) $tab['html'])) + ); + $tmp .= PHP_EOL . $_tab . Indent::_(3) . '
'; + $tmp .= PHP_EOL . $_tab . Indent::_(2) . '
'; + $tmp .= PHP_EOL . $_tab . Indent::_(1) + . ""; + // update html + $tab['html'] = $tmp; + } + else + { + $tab['html'] = PHP_EOL . $_tab . Indent::_(1) + . implode( + PHP_EOL . $_tab . Indent::_(1), + (array) explode(PHP_EOL, trim((string) $tab['html'])) + ); + } + // add the permissions if needed + if (isset($tab['permission']) + && $tab['permission'] == 1) + { + $tmp = PHP_EOL . Indent::_(1) + . "canDo->get('" + . $tab['view'] . "." . $tab['code'] + . ".viewtab')) : ?>"; + $tmp .= $tab['html']; + $tmp .= PHP_EOL . Indent::_(1) . ""; + // update html + $tab['html'] = $tmp; + // set lang for permissions + $tab['lang_permission'] = $tab['lang'] + . '_TAB_PERMISSION'; + $tab['lang_permission_desc'] = $tab['lang'] + . '_TAB_PERMISSION_DESC'; $tab['lang_permission_title'] - ); - CFactory::_('Language')->set( - 'both', $tab['lang_permission_desc'], - 'Allow the users in this group to view ' - . $tab['name'] . ' Tab of ' - . CFactory::_('Placeholder')->get('views') - ); - // set the sort key - $tab['sortKey'] - = StringHelper::safe( - $tab['lang_permission_title'] - ); - } + = CFactory::_('Placeholder')->get('Views') . ' View ' + . $tab['name'] . ' Tab'; + CFactory::_('Language')->set( + 'both', $tab['lang_permission'], + $tab['lang_permission_title'] + ); + CFactory::_('Language')->set( + 'both', $tab['lang_permission_desc'], + 'Allow the users in this group to view ' + . $tab['name'] . ' Tab of ' + . CFactory::_('Placeholder')->get('views') + ); + // set the sort key + $tab['sortKey'] + = StringHelper::safe( + $tab['lang_permission_title'] + ); + } - // return tab - return $tab; - }, array_values($view->customtabs) + // return tab + return $tab; + }, array_values($view->customtabs) + ) ); } unset($view->customtabs); @@ -2477,11 +2464,12 @@ class Get ? json_decode((string) $view->addfields, true) : null; if (ArrayHelper::check($view->addfields)) { - $ignoreFields = array(); + $ignore_fields = array(); + $default_fields = CFactory::_('Config')->default_fields; // load the field data $view->fields = array_map( function ($field) use ( - &$view, &$ignoreFields + &$view, &$ignore_fields, &$default_fields ) { // set the field details CFactory::_('Field')->set( @@ -2490,14 +2478,14 @@ class Get ); // check if this field is a default field OR // check if this is none database related field - if (in_array($field['base_name'], $this->defaultFields) + if (in_array($field['base_name'], $default_fields) || ComponentbuilderHelper::fieldCheck( $field['type_name'], 'spacer' ) || (isset($field['list']) && $field['list'] == 2)) // 2 = none database { - $ignoreFields[$field['field']] = $field['field']; + $ignore_fields[$field['field']] = $field['field']; } // return field @@ -2518,7 +2506,7 @@ class Get $this->setUpdateSQL( json_decode((string) $old_view->addfields, true), $view->addfields, 'field', $view->name_single_code, - $ignoreFields + $ignore_fields ); } // clear this data @@ -2556,7 +2544,7 @@ class Get $field, $view->name_list_code ); // check if the field changed since the last compilation (default fields never change and are always added) - if (!isset($ignoreFields[$field['field']]) + if (!isset($ignore_fields[$field['field']]) && ObjectHelper::check( $field['settings']->history )) @@ -2667,32 +2655,32 @@ class Get } // loop the mysql table settings foreach ( - $this->mysqlTableKeys as $_mysqlTableKey => $_mysqlTableVal + CFactory::_('Config')->mysql_table_keys as $mysql_table_key => $mysql_table_val ) { // check if the table engine changed - if (isset($old_view->{'mysql_table_' . $_mysqlTableKey}) - && isset($view->{'mysql_table_' . $_mysqlTableKey})) + if (isset($old_view->{'mysql_table_' . $mysql_table_key}) + && isset($view->{'mysql_table_' . $mysql_table_key})) { $this->setUpdateSQL( - $old_view->{'mysql_table_' . $_mysqlTableKey}, - $view->{'mysql_table_' . $_mysqlTableKey}, - 'table_' . $_mysqlTableKey, $view->name_single_code + $old_view->{'mysql_table_' . $mysql_table_key}, + $view->{'mysql_table_' . $mysql_table_key}, + 'table_' . $mysql_table_key, $view->name_single_code ); } // check if there is no history on table engine, and it changed from the default/global - elseif (isset($view->{'mysql_table_' . $_mysqlTableKey}) + elseif (isset($view->{'mysql_table_' . $mysql_table_key}) && StringHelper::check( - $view->{'mysql_table_' . $_mysqlTableKey} + $view->{'mysql_table_' . $mysql_table_key} ) && !is_numeric( - $view->{'mysql_table_' . $_mysqlTableKey} + $view->{'mysql_table_' . $mysql_table_key} )) { $this->setUpdateSQL( - $_mysqlTableVal['default'], - $view->{'mysql_table_' . $_mysqlTableKey}, - 'table_' . $_mysqlTableKey, $view->name_single_code + $mysql_table_val['default'], + $view->{'mysql_table_' . $mysql_table_key}, + 'table_' . $mysql_table_key, $view->name_single_code ); } } @@ -2882,22 +2870,22 @@ class Get unset($view->addrelations); // set linked views - $this->linkedAdminViews[$view->name_single_code] = null; - $view->addlinked_views - = (isset($view->addlinked_views) + $view->addlinked_views = (isset($view->addlinked_views) && JsonHelper::check($view->addlinked_views)) ? json_decode((string) $view->addlinked_views, true) : null; if (ArrayHelper::check($view->addlinked_views)) { // setup linked views to global data sets - $this->linkedAdminViews[$view->name_single_code] = array_values( - $view->addlinked_views + CFactory::_('Registry')->set('builder.linked_admin_views.' . $view->name_single_code, + array_values( + $view->addlinked_views + ) ); } unset($view->addlinked_views); // set the lang target CFactory::_('Config')->lang_target = 'admin'; - if (isset($this->siteEditView[$id])) + if (CFactory::_('Registry')->get('builder.site_edit_view..' . $id, false)) { CFactory::_('Config')->lang_target = 'both'; } @@ -3097,14 +3085,11 @@ class Get CFactory::_('Customcode.Dispenser')->hub['token'][$view->name_single_code] = true; $addAjaxSite = false; - if (isset($this->siteEditView[$id]) && $this->siteEditView[$id]) + if (CFactory::_('Registry')->get('builder.site_edit_view..' . $id, false)) { // we should add this site ajax to front ajax $addAjaxSite = true; - if (!isset($this->addSiteAjax) || !$this->addSiteAjax) - { - $this->addSiteAjax = true; - } + CFactory::_('Config')->set('add_site_ajax', true); } // check if controller input as been set $view->ajax_input = (isset($view->ajax_input) @@ -3119,7 +3104,7 @@ class Get } CFactory::_('Customcode.Dispenser')->hub['admin']['ajax_controller'][$view->name_single_code] = array_values($view->ajax_input); - $this->addAjax = true; + CFactory::_('Config')->set('add_ajax', true); unset($view->ajax_input); } if (StringHelper::check($view->php_ajaxmethod)) @@ -3148,13 +3133,14 @@ class Get false ); } + // switch ajax on + CFactory::_('Config')->set('add_ajax', true); // unset anyway unset($view->php_ajaxmethod); - $this->addAjax = true; } } // activate alias builder - if (!isset($this->customAliasBuilder[$view->name_single_code]) + if (!CFactory::_('Registry')->get('builder.custom_alias.' . $view->name_single_code, null) && isset($view->alias_builder_type) && 2 == $view->alias_builder_type && isset($view->alias_builder) @@ -3165,26 +3151,27 @@ class Get // get the active fields $alias_fields = (array) array_filter( $view->fields, function ($field) use ($alias_fields) { - // check if field is in view fields - if (in_array($field['field'], $alias_fields)) - { - return true; - } + // check if field is in view fields + if (in_array($field['field'], $alias_fields)) + { + return true; + } - return false; - } + return false; + } ); // check if all is well if (ArrayHelper::check($alias_fields)) { // load the field names - $this->customAliasBuilder[$view->name_single_code] - = (array) array_map( - function ($field) use (&$view) { - return CFactory::_('Field.Name')->get( - $field, $view->name_list_code - ); - }, $alias_fields + CFactory::_('Registry')->set('builder.custom_alias.' . $view->name_single_code, + (array) array_map( + function ($field) use (&$view) { + return CFactory::_('Field.Name')->get( + $field, $view->name_list_code + ); + }, $alias_fields + ) ); } } @@ -3213,32 +3200,29 @@ class Get unset($view->sql); } } - // load table settings - if (!isset($this->mysqlTableSetting[$view->name_single_code])) - { - $this->mysqlTableSetting[$view->name_single_code] = array(); - } // set mySql Table Settings foreach ( - $this->mysqlTableKeys as $_mysqlTableKey => $_mysqlTableVal + CFactory::_('Config')->mysql_table_keys as $mysql_table_key => $mysql_table_val ) { - if (isset($view->{'mysql_table_' . $_mysqlTableKey}) + if (isset($view->{'mysql_table_' . $mysql_table_key}) && StringHelper::check( - $view->{'mysql_table_' . $_mysqlTableKey} + $view->{'mysql_table_' . $mysql_table_key} ) - && !is_numeric($view->{'mysql_table_' . $_mysqlTableKey})) + && !is_numeric($view->{'mysql_table_' . $mysql_table_key})) { - $this->mysqlTableSetting[$view->name_single_code][$_mysqlTableKey] - = $view->{'mysql_table_' . $_mysqlTableKey}; + CFactory::_('Registry')->set('builder.mysql_table_setting.' . $view->name_single_code . '.' . + $mysql_table_key, $view->{'mysql_table_' . $mysql_table_key} + ); } else { - $this->mysqlTableSetting[$view->name_single_code][$_mysqlTableKey] - = $_mysqlTableVal['default']; + CFactory::_('Registry')->set('builder.mysql_table_setting.' . $view->name_single_code . '.' . + $mysql_table_key, $mysql_table_val['default'] + ); } // remove the table values since we moved to another object - unset($view->{'mysql_table_' . $_mysqlTableKey}); + unset($view->{'mysql_table_' . $mysql_table_key}); } // for plugin event TODO change event api signatures @@ -3246,7 +3230,7 @@ class Get // Trigger Event: jcb_ce_onAfterModelViewData CFactory::_('Event')->trigger( 'jcb_ce_onAfterModelViewData', - array(&$this->componentContext, &$view, &$placeholders) + array(&$component_context, &$view, &$placeholders) ); unset($placeholders); @@ -3284,10 +3268,12 @@ class Get $query->from('#__componentbuilder_' . $table . ' AS a'); $query->where($this->db->quoteName('a.id') . ' = ' . (int) $id); + // for plugin event TODO change event api signatures + $component_context = CFactory::_('Config')->component_context; // Trigger Event: jcb_ce_onBeforeQueryCustomViewData CFactory::_('Event')->trigger( 'jcb_ce_onBeforeQueryCustomViewData', - array(&$this->componentContext, &$id, &$table, &$query, &$this->db) + array(&$component_context, &$id, &$table, &$query, &$this->db) ); // Reset the query using our newly populated query object. @@ -3304,37 +3290,7 @@ class Get // Trigger Event: jcb_ce_onBeforeModelCustomViewData CFactory::_('Event')->trigger( 'jcb_ce_onBeforeModelCustomViewData', - array(&$this->componentContext, &$view, &$id, &$table) - ); - - if ($table === 'site_view') - { - CFactory::_('Config')->lang_target = 'site'; - // repeatable fields to update - $searchRepeatables = array( - // repeatablefield => checker - 'ajax_input' => 'value_name', - 'custom_button' => 'name' - ); - } - else - { - CFactory::_('Config')->lang_target = 'admin'; - // repeatable fields to update - $searchRepeatables = array( - // repeatablefield => checker - 'custom_button' => 'name' - ); - } - // set upater - $updater = array( - 'table' => $table, - 'key' => 'id', - 'val' => (int) $id - ); - // update the repeatable fields - $view = ComponentbuilderHelper::convertRepeatableFields( - $view, $searchRepeatables, $updater + array(&$component_context, &$view, &$id, &$table) ); // set GUI mapper @@ -3359,15 +3315,6 @@ class Get // always make sure context is a safe string $view->context = StringHelper::safe($view->context); } - // load the library - if (!isset($this->libManager[CFactory::_('Config')->build_target])) - { - $this->libManager[CFactory::_('Config')->build_target] = array(); - } - if (!isset($this->libManager[CFactory::_('Config')->build_target][$view->code])) - { - $this->libManager[CFactory::_('Config')->build_target][$view->code] = array(); - } // make sure json become array if (JsonHelper::check($view->libraries)) { @@ -3378,63 +3325,64 @@ class Get { foreach ($view->libraries as $library) { - if (!isset($this->libManager[CFactory::_('Config')->build_target][$view->code][$library])) + if (!CFactory::_('Registry')->exists('builder.library_manager.' . + CFactory::_('Config')->build_target . '.' . $view->code . '.' . $library)) { if ($this->getMediaLibrary((int) $library)) { - $this->libManager[CFactory::_('Config')->build_target][$view->code][(int) $library] - = true; + CFactory::_('Registry')->set('builder.library_manager.' . + CFactory::_('Config')->build_target . '.' . + $view->code . '.' . $library, true); } } } } elseif (is_numeric($view->libraries) - && !isset($this->libManager[CFactory::_('Config')->build_target][$view->code][(int) $view->libraries])) + && !CFactory::_('Registry')->exists('builder.library_manager.' . + CFactory::_('Config')->build_target . '.' . $view->code . '.' . (int) $view->libraries)) { if ($this->getMediaLibrary((int) $view->libraries)) { - $this->libManager[CFactory::_('Config')->build_target][$view->code][(int) $view->libraries] - = true; + CFactory::_('Registry')->set('builder.library_manager.' . + CFactory::_('Config')->build_target . '.' . + $view->code . '.' . (int) $view->libraries, true); } } - // setup template array - $this->templateData[CFactory::_('Config')->build_target][$view->code] = array(); // setup template and layout data $this->setTemplateAndLayoutData($view->default, $view->code); + // get uikit switch + $uikit = CFactory::_('Config')->get('uikit', 0); // insure the uikit components are loaded - if (2 == $this->uikit || 1 == $this->uikit) + if (2 == $uikit || 1 == $uikit) { - if (!isset($this->uikitComp[$view->code])) + // set uikit to views + if (($found = ComponentbuilderHelper::getUikitComp( + $view->default, (array) CFactory::_('Registry')->get('builder.uikit_comp.' . $view->code, []) + )) !== false) { - $this->uikitComp[$view->code] = array(); + CFactory::_('Registry')->set('builder.uikit_comp.' . $view->code, $found); } - $this->uikitComp[$view->code] - = ComponentbuilderHelper::getUikitComp( - $view->default, $this->uikitComp[$view->code] - ); } // check for footable - if (!isset($this->footableScripts[CFactory::_('Config')->build_target][$view->code]) - || !$this->footableScripts[CFactory::_('Config')->build_target][$view->code]) + if (!CFactory::_('Registry')-> + exists('builder.footable_scripts.' . CFactory::_('Config')->build_target . '.' . $view->code)) { - $foundFoo = $this->getFootableScripts($view->default); - if ($foundFoo) + if ($this->getFootableScripts($view->default)) { - $this->footableScripts[CFactory::_('Config')->build_target][$view->code] = true; - } - if ($foundFoo && !$this->footableScripts) - { - $this->footable = true; + CFactory::_('Registry')-> + set('builder.footable_scripts.' . CFactory::_('Config')->build_target . '.' . $view->code, true); + + CFactory::_('Config')->set('footable ', true); } } // check for get module - if (!isset($this->getModule[CFactory::_('Config')->build_target][$view->code]) - || !$this->getModule[CFactory::_('Config')->build_target][$view->code]) + if (!CFactory::_('Registry')-> + exists('builder.get_module.' . CFactory::_('Config')->build_target . '.' . $view->code)) { - $found = $this->getGetModule($view->default); - if ($found) + if ($this->getGetModule($view->default)) { - $this->getModule[CFactory::_('Config')->build_target][$view->code] = true; + CFactory::_('Registry')-> + set('builder.get_module.' . CFactory::_('Config')->build_target . '.' . $view->code, true); } } // set the main get data @@ -3476,58 +3424,51 @@ class Get base64_decode((string) $view->$scripter) ); } - if (2 == $this->uikit || 1 == $this->uikit) + if (2 == $uikit || 1 == $uikit) { - if (!isset($this->uikitComp[$view->code])) - { - $this->uikitComp[$view->code] = array(); - } // set uikit to views - $this->uikitComp[$view->code] - = ComponentbuilderHelper::getUikitComp( - $view->$scripter, $this->uikitComp[$view->code] - ); + if (($found = ComponentbuilderHelper::getUikitComp( + $view->$scripter, (array) CFactory::_('Registry')->get('builder.uikit_comp.' . $view->code, []) + )) !== false) + { + CFactory::_('Registry')->set('builder.uikit_comp.' . $view->code, $found); + } } $this->setTemplateAndLayoutData($view->$scripter, $view->code); // check for footable - if (!isset($this->footableScripts[CFactory::_('Config')->build_target][$view->code]) - || !$this->footableScripts[CFactory::_('Config')->build_target][$view->code]) + if (!CFactory::_('Registry')-> + exists('builder.footable_scripts.' . CFactory::_('Config')->build_target . '.' . $view->code)) { - $foundFoo = $this->getFootableScripts($view->$scripter); - if ($foundFoo) + if ($this->getFootableScripts($view->$scripter)) { - $this->footableScripts[CFactory::_('Config')->build_target][$view->code] - = true; - } - if ($foundFoo && !$this->footable) - { - $this->footable = true; + CFactory::_('Registry')-> + set('builder.footable_scripts.' . CFactory::_('Config')->build_target . '.' . $view->code, true); + + CFactory::_('Config')->set('footable ', true); } } // check for google chart - if (!isset($this->googleChart[CFactory::_('Config')->build_target][$view->code]) - || !$this->googleChart[CFactory::_('Config')->build_target][$view->code]) + if (!CFactory::_('Registry')-> + exists('builder.google_chart.' . CFactory::_('Config')->build_target . '.' . $view->code)) { - $found = $this->getGoogleChart($view->$scripter); - if ($found) + if ($this->getGoogleChart($view->$scripter)) { - $this->googleChart[CFactory::_('Config')->build_target][$view->code] = true; - } - if ($found && !$this->googlechart) - { - $this->googlechart = true; + CFactory::_('Registry')-> + set('builder.google_chart.' . CFactory::_('Config')->build_target . '.' . $view->code, true); + + CFactory::_('Config')->set('google_chart', true); } } // check for get module - if (!isset($this->getModule[CFactory::_('Config')->build_target][$view->code]) - || !$this->getModule[CFactory::_('Config')->build_target][$view->code]) + if (!CFactory::_('Registry')-> + exists('builder.get_module.' . CFactory::_('Config')->build_target . '.' . $view->code)) { - $found = $this->getGetModule($view->$scripter); - if ($found) + if ($this->getGetModule($view->$scripter)) { - $this->getModule[CFactory::_('Config')->build_target][$view->code] = true; + CFactory::_('Registry')-> + set('builder.get_module.' . CFactory::_('Config')->build_target . '.' . $view->code, true); } } } @@ -3578,11 +3519,11 @@ class Get // turn on ajax area if ('site' === CFactory::_('Config')->build_target) { - $this->addSiteAjax = true; + CFactory::_('Config')->set('add_site_ajax', true); } else { - $this->addAjax = true; + CFactory::_('Config')->set('add_ajax', true); } } } @@ -3625,7 +3566,7 @@ class Get // Trigger Event: jcb_ce_onAfterModelCustomViewData CFactory::_('Event')->trigger( 'jcb_ce_onAfterModelCustomViewData', - array(&$this->componentContext, &$view) + array(&$component_context, &$view) ); // return the found view data @@ -3796,6 +3737,8 @@ class Get if (ArrayHelper::check($ids)) { $ids = implode(',', $ids); + // for plugin event TODO change event api signatures + $component_context = CFactory::_('Config')->component_context; if (StringHelper::check($ids)) { // Create a new query object. @@ -3822,7 +3765,7 @@ class Get // Trigger Event: jcb_ce_onBeforeModelDynamicGetData CFactory::_('Event')->trigger( 'jcb_ce_onBeforeModelDynamicGetData', - array(&$this->componentContext, &$result, &$result->id, &$view_code, &$context) + array(&$component_context, &$result, &$result->id, &$view_code, &$context) ); // set GUI mapper id $guiMapper['id'] = (int) $result->id; @@ -4108,13 +4051,15 @@ class Get || isset($_part_of_a[$join_field[0]]) || isset($_part_of_a[$on_field[0]])) { - $this->siteMainGet[CFactory::_('Config')->build_target][$view_code][$option['as']] - = $option['as']; + CFactory::_('Registry')-> + set('builder.site_main_get.' . CFactory::_('Config')->build_target . + '.' . $view_code . '.' . $option['as'], $option['as']); } else { - $this->siteDynamicGet[CFactory::_('Config')->build_target][$view_code][$option['as']][$join_field[1]] - = $on_field[0]; + CFactory::_('Registry')-> + set('builder.site_dynamic_get.' . CFactory::_('Config')->build_target . + '.' . $view_code . '.' . $option['as'] . '.' . $join_field[1], $on_field[0]); } } elseif ($option['row_type'] == 2) @@ -4122,8 +4067,9 @@ class Get $result->custom_get[] = $option; if ($on_field[0] != 'a') { - $this->siteDynamicGet[CFactory::_('Config')->build_target][$view_code][$option['as']][$join_field[1]] - = $on_field[0]; + CFactory::_('Registry')-> + set('builder.site_dynamic_get.' . CFactory::_('Config')->build_target . + '.' . $view_code . '.' . $option['as'] . '.' . $join_field[1], $on_field[0]); } } } @@ -4208,13 +4154,15 @@ class Get || isset($_part_of_a[$join_field[0]]) || isset($_part_of_a[$on_field[0]])) { - $this->siteMainGet[CFactory::_('Config')->build_target][$view_code][$option1['as']] - = $option1['as']; + CFactory::_('Registry')-> + set('builder.site_main_get.' . CFactory::_('Config')->build_target . + '.' . $view_code . '.' . $option1['as'], $option1['as']); } else { - $this->siteDynamicGet[CFactory::_('Config')->build_target][$view_code][$option1['as']][$join_field[1]] - = $on_field[0]; + CFactory::_('Registry')-> + set('builder.site_dynamic_get.' . CFactory::_('Config')->build_target . + '.' . $view_code . '.' . $option1['as'] . '.' . $join_field[1], $on_field[0]); } } elseif ($option1['row_type'] == 2) @@ -4222,8 +4170,9 @@ class Get $result->custom_get[] = $option1; if ($on_field[0] != 'a') { - $this->siteDynamicGet[CFactory::_('Config')->build_target][$view_code][$option1['as']][$join_field[1]] - = $on_field[0]; + CFactory::_('Registry')-> + set('builder.site_dynamic_get.' . CFactory::_('Config')->build_target . + '.' . $view_code . '.' . $option1['as'] . '.' . $join_field[1], $on_field[0]); } } } @@ -4337,7 +4286,7 @@ class Get // Trigger Event: jcb_ce_onAfterModelDynamicGetData CFactory::_('Event')->trigger( 'jcb_ce_onAfterModelDynamicGetData', - array(&$this->componentContext, &$result, &$result->id, &$view_code, &$context) + array(&$component_context, &$result, &$result->id, &$view_code, &$context) ); } @@ -4396,7 +4345,7 @@ class Get * @deprecated 3.3 Use CFactory::_('Customcode.Dispenser')->get($first, $second, $prefix, $note, $unset, $default, $sufix); */ public function getCustomScriptBuilder($first, $second, $prefix = '', - $note = null, $unset = null, $default = null, $sufix = '' + $note = null, $unset = null, $default = null, $sufix = '' ) { return CFactory::_('Customcode.Dispenser')->get($first, $second, $prefix, $note, $unset, $default, $sufix); @@ -4466,21 +4415,21 @@ class Get // final fixing to array if (ArrayHelper::check($id_array)) { - // uniqe + // unique $id_array = array_unique($id_array, SORT_NUMERIC); // sort sort($id_array, SORT_NUMERIC); // now set it to global - $this->sqlTweak[(int) $setting['adminview']]['where'] - = implode(',', $id_array); + CFactory::_('Registry')-> + set('builder.sql_tweak.' . (int) $setting['adminview'] . '.where', implode(',', $id_array)); } } } else { - // remove all sql dump options - $this->sqlTweak[(int) $setting['adminview']]['remove'] - = true; + // do not add sql dump options + CFactory::_('Registry')-> + set('builder.sql_tweak.' . (int) $setting['adminview'] . '.add', false); } } } @@ -4629,60 +4578,39 @@ class Get || (is_numeric($new) && is_numeric($old))) && $new !== $old) { - // the string changed, lets add to SQL update - if (!isset($this->updateSQL[$type]) - || !ArrayHelper::check($this->updateSQL[$type])) - { - $this->updateSQL[$type] = array(); - } // set at key - $this->updateSQL[$type][$key] = array('old' => $old, 'new' => $new); + CFactory::_('Registry')->set('builder.update_sql.' . $type . '.' . $key, ['old' => $old, 'new' => $new]); } } /** * Set the add sql * - * @param string $type The type of values - * @param int $item The item id to add - * @param int $key The id/key where values changed + * @param string $type The type of values + * @param int $item The item id to add + * @param int|null $key The id/key where values changed * * @return void */ - protected function setAddSQL($type, $item, $key) + protected function setAddSQL(string $type, int $item, ?int $key = null) { - // we have a new item, lets add to SQL - if (!isset($this->addSQL[$type]) - || !ArrayHelper::check( - $this->addSQL[$type] - )) - { - $this->addSQL[$type] = array(); - } // add key if found if ($key) { - if (!isset($this->addSQL[$type][$key]) - || !ArrayHelper::check( - $this->addSQL[$type][$key] - )) - { - $this->addSQL[$type][$key] = array(); - } - $this->addSQL[$type][$key][] = (int) $item; + CFactory::_('Registry')->set('builder.add_sql.' . $type . '.' . $key . '.' . $item, $item); } else { // convert adminview id to name if ('adminview' === $type) { - $this->addSQL[$type][] = StringHelper::safe( + CFactory::_('Registry')->set('builder.add_sql.' . $type, StringHelper::safe( $this->getAdminViewData($item)->name_single - ); + )); } else { - $this->addSQL[$type][] = (int) $item; + CFactory::_('Registry')->set('builder.add_sql.' . $type, $item); } } } @@ -4776,10 +4704,8 @@ class Get { foreach ($templates as $template) { - if (!isset($this->templateData[CFactory::_('Config')->build_target][$view]) - || !array_key_exists( - $template, $this->templateData[CFactory::_('Config')->build_target][$view] - )) + if (!CFactory::_('Registry')-> + get('builder.template_data.' . CFactory::_('Config')->build_target . '.' . $view . '.' . $template, null)) { $data = $this->getDataWithAlias( $template, 'template', $view @@ -4787,16 +4713,16 @@ class Get if (ArrayHelper::check($data)) { // load it to the template data array - $this->templateData[CFactory::_('Config')->build_target][$view][$template] - = $data; + CFactory::_('Registry')-> + set('builder.template_data.' . CFactory::_('Config')->build_target . '.' . $view . '.' . $template, $data); // call self to get child data $again[] = array($data['html'], $view); $again[] = array($data['php_view'], $view); } } // check if we have the template set (and nothing yet found) - if (!$found - && isset($this->templateData[CFactory::_('Config')->build_target][$view][$template])) + if (!$found && CFactory::_('Registry')-> + get('builder.template_data.' . CFactory::_('Config')->build_target . '.' . $view . '.' . $template, null)) { // something was found $found = true; @@ -4841,23 +4767,20 @@ class Get } foreach ($layouts as $layout) { - if (!isset($this->layoutData[CFactory::_('Config')->build_target]) - || !ArrayHelper::check( - $this->layoutData[CFactory::_('Config')->build_target] - ) - || !array_key_exists( - $layout, $this->layoutData[CFactory::_('Config')->build_target] - )) + if (!CFactory::_('Registry')-> + get('builder.layout_data.' . CFactory::_('Config')->build_target . '.' . $layout, null)) { $data = $this->getDataWithAlias($layout, 'layout', $view); if (ArrayHelper::check($data)) { // load it to the layout data array - $this->layoutData[CFactory::_('Config')->build_target][$layout] = $data; + CFactory::_('Registry')-> + set('builder.layout_data.' . CFactory::_('Config')->build_target . '.' . $layout, $data); // check if other target is set if (CFactory::_('Config')->lang_target === 'both' && $_target) { - $this->layoutData[$_target][$layout] = $data; + CFactory::_('Registry')-> + set('builder.layout_data.' . $_target . '.' . $layout, $data); } // call self to get child data $again[] = array($data['html'], $view); @@ -4865,7 +4788,8 @@ class Get } } // check if we have the layout set (and nothing yet found) - if (!$found && isset($this->layoutData[CFactory::_('Config')->build_target][$layout])) + if (!$found && CFactory::_('Registry')-> + get('builder.layout_data.' . CFactory::_('Config')->build_target . '.' . $layout, null)) { // something was found $found = true; @@ -4903,15 +4827,8 @@ class Get $this->setDataWithAliasKeys($table); // now check if key is found $name = preg_replace("/[^A-Za-z]/", '', $n_ame); - if (isset($this->dataWithAliasKeys[$table][$name])) - { - $ID = $this->dataWithAliasKeys[$table][$name]; - } - elseif (isset($this->dataWithAliasKeys[$table][$n_ame])) - { - $ID = $this->dataWithAliasKeys[$table][$n_ame]; - } - else + if (($ID = CFactory::_('Registry')->get('builder.data_with_alias_keys.' . $table . '.' . $name, null)) === null && + ($ID = CFactory::_('Registry')->get('builder.data_with_alias_keys.' . $table . '.' . $n_ame, null)) === null) { return false; } @@ -4945,7 +4862,7 @@ class Get 'type' => 'php') ); } - $contnent = CFactory::_('Customcode.Gui')->set( + $content = CFactory::_('Customcode.Gui')->set( CFactory::_('Customcode')->update(base64_decode((string) $row->{$table})), array( 'table' => $table, @@ -4956,15 +4873,6 @@ class Get // load all targets foreach ($_targets as $_target) { - // load the library - if (!isset($this->libManager[$_target])) - { - $this->libManager[$_target] = array(); - } - if (!isset($this->libManager[$_target][$view])) - { - $this->libManager[$_target][$view] = array(); - } // make sure json become array if (JsonHelper::check($row->libraries)) { @@ -4975,84 +4883,83 @@ class Get { foreach ($row->libraries as $library) { - if (!isset($this->libManager[$_target][$view][$library])) + if (!CFactory::_('Registry')->exists('builder.library_manager.' . + $_target . '.' . $view . '.' . (int) $library)) { if ($this->getMediaLibrary((int) $library)) { - $this->libManager[$_target][$view][(int) $library] - = true; + CFactory::_('Registry')->set('builder.library_manager.' . + $_target . '.' . $view . '.' . (int) $library, true); } } } } elseif (is_numeric($row->libraries) - && !isset($this->libManager[$_target][$view][(int) $row->libraries])) + && !CFactory::_('Registry')->exists('builder.library_manager.' . + $_target . '.' . $view . '.' . (int) $row->libraries)) { if ($this->getMediaLibrary((int) $row->libraries)) { - $this->libManager[$_target][$view][(int) $row->libraries] - = true; + CFactory::_('Registry')->set('builder.library_manager.' . + $_target . '.' . $view . '.' . (int) $row->libraries, true); } } // set footable to views and turn it on - if (!isset($this->footableScripts[$_target][$view]) - || !$this->footableScripts[$_target][$view]) + if (!CFactory::_('Registry')-> + exists('builder.footable_scripts.' . $_target . '.' . $view)) { - $foundFoo = $this->getFootableScripts($contnent); - if ($foundFoo) + if ($this->getFootableScripts($content)) { - $this->footableScripts[$_target][$view] = true; - } - if ($foundFoo && !$this->footable) - { - $this->footable = true; + CFactory::_('Registry')-> + set('builder.footable_scripts.' . $_target . '.' . $view, true); + + CFactory::_('Config')->set('footable ', true); } } // set google charts to views and turn it on - if (!isset($this->googleChart[$_target][$view]) - || !$this->googleChart[$_target][$view]) + if (!CFactory::_('Registry')-> + exists('builder.google_chart.' . $_target . '.' . $view)) { $foundA = $this->getGoogleChart($php_view); - $foundB = $this->getGoogleChart($contnent); + $foundB = $this->getGoogleChart($content); if ($foundA || $foundB) { - $this->googleChart[$_target][$view] = true; - } - if ($foundA || $foundB && !$this->googlechart) - { - $this->googlechart = true; + CFactory::_('Registry')-> + set('builder.google_chart.' . $_target . '.' . $view, true); + + CFactory::_('Config')->set('google_chart', true); } } // check for get module - if (!isset($this->getModule[$_target][$view]) - || !$this->getModule[$_target][$view]) + if (!CFactory::_('Registry')-> + exists('builder.get_module.' . $_target . '.' . $view)) { $foundA = $this->getGetModule($php_view); - $foundB = $this->getGetModule($contnent); + $foundB = $this->getGetModule($content); if ($foundA || $foundB) { - $this->getModule[$_target][$view] = true; + CFactory::_('Registry')-> + set('builder.get_module.' . $_target . '.' . $view, true); } } } // load UIKIT if needed - if (2 == $this->uikit || 1 == $this->uikit) + $uikit = CFactory::_('Config')->get('uikit', 0); + if (2 == $uikit || 1 == $uikit) { - if (!isset($this->uikitComp[$view])) - { - $this->uikitComp[$view] = array(); - } // set uikit to views - $this->uikitComp[$view] - = ComponentbuilderHelper::getUikitComp( - $contnent, $this->uikitComp[$view] - ); + if (($found = ComponentbuilderHelper::getUikitComp( + $content, (array) CFactory::_('Registry')->get('builder.uikit_comp.' . $view, []) + )) !== false) + { + CFactory::_('Registry')->set('builder.uikit_comp.' . $view, $found); + } } return array( 'id' => $row->id, 'html' => CFactory::_('Customcode.Gui')->set( - $contnent, + $content, array( 'table' => $table, 'field' => $table, @@ -5083,10 +4990,8 @@ class Get protected function setDataWithAliasKeys($table) { // now check if key is found - if (!isset($this->dataWithAliasKeys[$table])) + if (!CFactory::_('Registry')->get('builder.data_with_alias_keys.' . $table, null)) { - // load this table keys - $this->dataWithAliasKeys[$table] = array(); // Create a new query object. $query = $this->db->getQuery(true); $query->select(array('a.id', 'a.alias')); @@ -5102,9 +5007,9 @@ class Get $k_ey = StringHelper::safe($row->alias); $key = preg_replace("/[^A-Za-z]/", '', (string) $k_ey); // set the keys - $this->dataWithAliasKeys[$table][$row->alias] = $row->id; - $this->dataWithAliasKeys[$table][$k_ey] = $row->id; - $this->dataWithAliasKeys[$table][$key] = $row->id; + CFactory::_('Registry')->set('builder.data_with_alias_keys.' . $table . '.' . $row->alias, $row->id); + CFactory::_('Registry')->set('builder.data_with_alias_keys.' . $table . '.' . $k_ey, $row->id); + CFactory::_('Registry')->set('builder.data_with_alias_keys.' . $table . '.' . $key, $row->id); } } } @@ -5121,8 +5026,11 @@ class Get protected function getMediaLibrary($id) { // check if the lib has already been set - if (!isset($this->libraries[$id])) + if (!CFactory::_('Registry')->exists("builder.libraries.$id")) { + // get some switches + $uikit = CFactory::_('Config')->get('uikit', 0); + $footable_version = CFactory::_('Config')->get('footable_version', 0); // make sure we should continue and that the lib is not already being loaded switch ($id) { @@ -5130,38 +5038,37 @@ class Get return false; break; case 3: // Uikit v3 - if (2 == $this->uikit || 3 == $this->uikit) + if (2 == $uikit || 3 == $uikit) { // already being loaded - $this->libraries[$id] = false; + CFactory::_('Registry')->set("builder.libraries.$id", false); } break; case 4: // Uikit v2 - if (2 == $this->uikit || 1 == $this->uikit) + if (2 == $uikit || 1 == $uikit) { // already being loaded - $this->libraries[$id] = false; + CFactory::_('Registry')->set("builder.libraries.$id", false); } break; case 5: // FooTable v2 - if (!isset($this->footableVersion) - || 2 == $this->footableVersion) + if (2 == $footable_version) { // already being loaded - $this->libraries[$id] = false; + CFactory::_('Registry')->set("builder.libraries.$id", false); } break; case 6: // FooTable v3 - if (3 == $this->footableVersion) + if (3 == $footable_version) { // already being loaded - $this->libraries[$id] = false; + CFactory::_('Registry')->set("builder.libraries.$id", false); } break; } } // check if the lib has already been set - if (!isset($this->libraries[$id])) + if (!CFactory::_('Registry')->exists("builder.libraries.$id")) { $query = $this->db->getQuery(true); @@ -5226,9 +5133,9 @@ class Get // fall back on build-in features $buildin = array(3 => array('uikit' => 3), 4 => array('uikit' => 1), - 5 => array('footableVersion' => 2, + 5 => array('footable_version' => 2, 'footable' => true), - 6 => array('footableVersion' => 3, + 6 => array('footable_version' => 3, 'footable' => true)); if (isset($buildin[$library->id]) && ArrayHelper::check( @@ -5238,7 +5145,11 @@ class Get // set the lib switch foreach ($buildin[$library->id] as $lib => $val) { - $this->{$lib} = $val; + // ---- we are targeting these ---- + // $this->uikit CFactory::_('Config')->uikit + // $this->footableVersion CFactory::_('Config')->footable_version + // $this->footable CFactory::_('Config')->footable + CFactory::_('Config')->set($lib, $val); } // since we are falling back on build-in feature $library->how = 0; @@ -5356,20 +5267,15 @@ class Get unset($library->addconditions); unset($library->addconfig); // load to global lib - $this->libraries[$id] = $library; + CFactory::_('Registry')->set("builder.libraries.$id", $library); } else { - $this->libraries[$id] = false; + CFactory::_('Registry')->set("builder.libraries.$id", false); } } // if set return - if (isset($this->libraries[$id])) - { - return $this->libraries[$id]; - } - - return false; + return CFactory::_('Registry')->get("builder.libraries.$id", false); } /** @@ -5479,7 +5385,7 @@ class Get $get = trim($lineArray[0]); $key = trim($lineArray[1]); // only add the view (we must adapt this) - if (isset($this->getAsLookup[$method_key][$get]) + if (CFactory::_('Registry')->exists('builder.get_as_lookup.' . $method_key . '.' . $get) && 'a' != $as && 1 == $row_type && 'view' === $type @@ -5494,38 +5400,30 @@ class Get $gets[] = $this->db->quote($get); if (StringHelper::check($key)) { - $this->getAsLookup[$method_key][$get] = $key; - $keys[] - = $this->db->quote( - $key - ); + CFactory::_('Registry')-> + set('builder.get_as_lookup.' . $method_key . '.' . $get, $key); } else { - $key = str_replace( + $key = str_replace( $as . '.', '', $get ); - $this->getAsLookup[$method_key][$get] = $key; - $keys[] - = $this->db->quote( - $key - ); + CFactory::_('Registry')-> + set('builder.get_as_lookup.' . $method_key . '.' . $get, $key); } + // set the keys + $keys[] = $this->db->quote( + $key + ); // make sure we have the view name if (StringHelper::check($view)) { // prep the field name $field = str_replace($as . '.', '', $get); - // make sure the array is set - if (!isset($this->siteFields[$view][$field])) - { - $this->siteFields[$view][$field] = array(); - } // load to the site fields memory bucket - $this->siteFields[$view][$field][$method_key . '___' - . $as] - = array('site' => $view_code, 'get' => $get, - 'as' => $as, 'key' => $key); + CFactory::_('Registry')-> + set('builder.site_fields.' . $view . '.' . $field . '.' . $method_key . '___' . $as, + ['site' => $view_code, 'get' => $get, 'as' => $as, 'key' => $key]); } } } @@ -5598,10 +5496,10 @@ class Get */ public function buildSqlDump($tables, $view, $view_id) { - // first build a query statment to get all the data (insure it must be added - check the tweaking) + // first build a query statement to get all the data (insure it must be added - check the tweaking) if (ArrayHelper::check($tables) - && (!isset($this->sqlTweak[$view_id]['remove']) - || !$this->sqlTweak[$view_id]['remove'])) + && CFactory::_('Registry')-> // default is to add + get('builder.sql_tweak.' . (int) $view_id . '.add', true)) { $counter = 'a'; // Create a new query object. @@ -5655,13 +5553,12 @@ class Get $runQuery = true; } // we may need to filter the selection - if (isset($this->sqlTweak[$view_id]['where'])) + if (($ids_ = CFactory::_('Registry')-> + get('builder.sql_tweak.' . (int) $view_id . '.where', null)) !== null) { // add to query the where filter $query->where( - 'a.id IN (' - . $this->sqlTweak[$view_id]['where'] - . ')' + 'a.id IN (' . $ids_ . ')' ); } } @@ -7366,16 +7263,6 @@ class Get } unset($module->{'add' . $addTarget}); } - // load the library - if (!isset($this->libManager[CFactory::_('Config')->build_target])) - { - $this->libManager[CFactory::_('Config')->build_target] = array(); - } - if (!isset($this->libManager[CFactory::_('Config')->build_target][$module->code_name])) - { - $this->libManager[CFactory::_('Config')->build_target][$module->code_name] - = array(); - } // make sure json become array if (JsonHelper::check($module->libraries)) { @@ -7386,23 +7273,25 @@ class Get { foreach ($module->libraries as $library) { - if (!isset($this->libManager[CFactory::_('Config')->build_target][$module->code_name][$library])) + if (!CFactory::_('Registry')->exists('builder.library_manager.' . + CFactory::_('Config')->build_target . '.' . $module->code_name . '.' . (int) $library)) { if ($this->getMediaLibrary((int) $library)) { - $this->libManager[CFactory::_('Config')->build_target][$module->code_name][(int) $library] - = true; + CFactory::_('Registry')->set('builder.library_manager.' . + CFactory::_('Config')->build_target . '.' . $module->code_name . '.' . (int) $library, true); } } } } elseif (is_numeric($module->libraries) - && !isset($this->libManager[CFactory::_('Config')->build_target][$module->code_name][(int) $module->libraries])) + && !CFactory::_('Registry')->exists('builder.library_manager.' . + CFactory::_('Config')->build_target . '.' . $module->code_name . '.' . (int) $module->libraries)) { if ($this->getMediaLibrary((int) $module->libraries)) { - $this->libManager[CFactory::_('Config')->build_target][$module->code_name][(int) $module->libraries] - = true; + CFactory::_('Registry')->set('builder.library_manager.' . + CFactory::_('Config')->build_target . '.' . $module->code_name . '.' . (int) $module->libraries, true); } } // add PHP in module install diff --git a/admin/helpers/compiler/b_Structure.php b/admin/helpers/compiler/b_Structure.php index 5fad4c0ab..88258ec34 100644 --- a/admin/helpers/compiler/b_Structure.php +++ b/admin/helpers/compiler/b_Structure.php @@ -431,10 +431,12 @@ class Structure extends Get $this->buildPlugins(); // set the Joomla Version Data $this->joomlaVersionData = $this->setJoomlaVersionData(); + // for plugin event TODO change event api signatures + $component_context = CFactory::_('Config')->component_context; // Trigger Event: jcb_ce_onAfterSetJoomlaVersionData CFactory::_('Event')->trigger( 'jcb_ce_onAfterSetJoomlaVersionData', - array(&$this->componentContext, &$this->joomlaVersionData) + array(&$component_context, &$this->joomlaVersionData) ); // set the dashboard $this->setDynamicDashboard(); @@ -472,10 +474,11 @@ class Structure extends Get { // for plugin event TODO change event api signatures $this->powers = CFactory::_('Power')->active; + $component_context = CFactory::_('Config')->component_context; // Trigger Event: jcb_ce_onBeforeSetModules CFactory::_('Event')->trigger( 'jcb_ce_onBeforeBuildPowers', - array(&$this->componentContext, &$this->powers) + array(&$component_context, &$this->powers) ); // for plugin event TODO change event api signatures CFactory::_('Power')->active = $this->powers; @@ -590,10 +593,12 @@ class Structure extends Get { if (ArrayHelper::check($this->joomlaModules)) { + // for plugin event TODO change event api signatures + $component_context = CFactory::_('Config')->component_context; // Trigger Event: jcb_ce_onBeforeSetModules CFactory::_('Event')->trigger( 'jcb_ce_onBeforeBuildModules', - array(&$this->componentContext, &$this->joomlaModules) + array(&$component_context, &$this->joomlaModules) ); foreach ($this->joomlaModules as $module) { @@ -877,7 +882,7 @@ class Structure extends Get $xml = ''; $xml .= PHP_EOL . ''; // search if we must add the component path $add_component_path = false; @@ -1171,10 +1176,12 @@ class Structure extends Get { if (ArrayHelper::check($this->joomlaPlugins)) { + // for plugin event TODO change event api signatures + $component_context = CFactory::_('Config')->component_context; // Trigger Event: jcb_ce_onBeforeSetPlugins CFactory::_('Event')->trigger( 'jcb_ce_onBeforeBuildPlugins', - array(&$this->componentContext, &$this->joomlaPlugins) + array(&$component_context, &$this->joomlaPlugins) ); foreach ($this->joomlaPlugins as $plugin) { @@ -1585,12 +1592,14 @@ class Structure extends Get */ private function setLibraries() { - if (ArrayHelper::check($this->libraries)) + if (($libraries_ = CFactory::_('Registry')->extract('builder.libraries')) !== null) { + // for plugin event TODO change event api signatures + $component_context = CFactory::_('Config')->component_context; // Trigger Event: jcb_ce_onBeforeSetLibraries CFactory::_('Event')->trigger( 'jcb_ce_onBeforeSetLibraries', - array(&$this->componentContext, &$this->libraries) + array(&$component_context, &$libraries_) ); // creat the main component folder if (!Folder::exists($this->componentPath)) @@ -1602,7 +1611,7 @@ class Structure extends Get } // create media path if not set $this->createFolder($this->componentPath . '/media'); - foreach ($this->libraries as $id => &$library) + foreach ($libraries_ as $id => &$library) { if (ObjectHelper::check($library)) { @@ -1722,6 +1731,8 @@ class Structure extends Get } } } + // update the global value just in case for now + CFactory::_('Registry')->set("builder.libraries.$id", $library); } } } @@ -2862,62 +2873,59 @@ class Structure extends Get ) ); } + // set some defaults + $uikit = CFactory::_('Config')->get('uikit', 0); + $footable = CFactory::_('Config')->get('footable', false); + $add_eximport = CFactory::_('Config')->get('add_eximport', false); // add custom folders if ((isset($this->componentData->folders) && ArrayHelper::check( $this->componentData->folders - )) - || $this->addEximport - || $this->uikit - || $this->footable) + )) || $add_eximport || $uikit || $footable) { - if ($this->addEximport) + if ($add_eximport) { // move the import view folder in place - $importView = array('folder' => 'importViews', + $this->componentData->folders[] = array('folder' => 'importViews', 'path' => 'admin/views/import', 'rename' => 1); - $this->componentData->folders[] = $importView; // move the phpspreadsheet Folder (TODO we must move this to a library package) - $PHPExcel - = array('folderpath' => 'JPATH_LIBRARIES/phpspreadsheet/vendor', + $this->componentData->folders[] = array('folderpath' => 'JPATH_LIBRARIES/phpspreadsheet/vendor', 'path' => '/libraries/phpspreadsheet/', 'rename' => 0); - $this->componentData->folders[] = $PHPExcel; } - if (2 == $this->uikit || 1 == $this->uikit) + + // set uikit + if (2 == $uikit || 1 == $uikit) { // move the UIKIT Folder into place - $uikit = array('folder' => 'uikit-v2', + $this->componentData->folders[] = array('folder' => 'uikit-v2', 'path' => 'media', 'rename' => 0); - $this->componentData->folders[] = $uikit; } - if (2 == $this->uikit || 3 == $this->uikit) + if (2 == $uikit || 3 == $uikit) { // move the UIKIT-3 Folder into place - $uikit = array('folder' => 'uikit-v3', + $this->componentData->folders[] = array('folder' => 'uikit-v3', 'path' => 'media', 'rename' => 0); - $this->componentData->folders[] = $uikit; } - if ($this->footable - && (!isset($this->footableVersion) - || 2 == $this->footableVersion)) + + // set footable + $footable_version = CFactory::_('Config')->get('footable_version', 2); + if ($footable && 2 == $footable_version) { // move the footable folder into place - $footable = array('folder' => 'footable-v2', + $this->componentData->folders[] = array('folder' => 'footable-v2', 'path' => 'media', 'rename' => 0); - $this->componentData->folders[] = $footable; } - elseif ($this->footable && 3 == $this->footableVersion) + elseif ($footable && 3 == $footable_version) { // move the footable folder into place - $footable = array('folder' => 'footable-v3', + $this->componentData->folders[] = array('folder' => 'footable-v3', 'path' => 'media', 'rename' => 0); - $this->componentData->folders[] = $footable; } // pointer tracker @@ -3021,25 +3029,23 @@ class Structure extends Get unset($this->componentData->folders); unset($custom); } + // get the google chart switch + $google_chart = CFactory::_('Config')->get('google_chart', false); // add custom files if ((isset($this->componentData->files) && ArrayHelper::check( $this->componentData->files - )) - || $this->googlechart) + )) || $google_chart) { - if ($this->googlechart) + if ($google_chart) { // move the google chart files - $googleChart = array('file' => 'google.jsapi.js', + $this->componentData->files[] = array('file' => 'google.jsapi.js', 'path' => 'media/js', 'rename' => 0); - $this->componentData->files[] = $googleChart; - $googleChart - = array('file' => 'chartbuilder.php', + $this->componentData->files[] = array('file' => 'chartbuilder.php', 'path' => 'admin/helpers', 'rename' => 0); - $this->componentData->files[] = $googleChart; } // pointer tracker diff --git a/admin/helpers/compiler/c_Fields.php b/admin/helpers/compiler/c_Fields.php index cf9208352..d026a53b9 100644 --- a/admin/helpers/compiler/c_Fields.php +++ b/admin/helpers/compiler/c_Fields.php @@ -608,10 +608,11 @@ class Fields extends Structure $dbkey = 'g'; // for plugin event TODO change event api signatures $placeholders = CFactory::_('Placeholder')->active; + $component_context = CFactory::_('Config')->component_context; // Trigger Event: jcb_ce_onBeforeBuildFields CFactory::_('Event')->trigger( 'jcb_ce_onBeforeBuildFields', - array(&$this->componentContext, &$dynamicFields, &$readOnly, + array(&$component_context, &$dynamicFields, &$readOnly, &$dbkey, &$view, &$component, &$nameSingleCode, &$nameListCode, &$placeholders, &$langView, &$langViews) @@ -631,7 +632,7 @@ class Fields extends Structure // Trigger Event: jcb_ce_onAfterBuildFields CFactory::_('Event')->trigger( 'jcb_ce_onAfterBuildFields', - array(&$this->componentContext, &$dynamicFields, &$readOnly, + array(&$component_context, &$dynamicFields, &$readOnly, &$dbkey, &$view, &$component, &$nameSingleCode, &$nameListCode, &$placeholders, &$langView, &$langViews) @@ -1025,10 +1026,11 @@ class Fields extends Structure $dbkey = 'g'; // for plugin event TODO change event api signatures $placeholders = CFactory::_('Placeholder')->active; + $component_context = CFactory::_('Config')->component_context; // Trigger Event: jcb_ce_onBeforeBuildFields CFactory::_('Event')->trigger( 'jcb_ce_onBeforeBuildFields', - array(&$this->componentContext, &$dynamicFieldsXML, &$readOnlyXML, + array(&$component_context, &$dynamicFieldsXML, &$readOnlyXML, &$dbkey, &$view, &$component, &$nameSingleCode, &$nameListCode, &$placeholders, &$langView, &$langViews) @@ -1048,7 +1050,7 @@ class Fields extends Structure // Trigger Event: jcb_ce_onAfterBuildFields CFactory::_('Event')->trigger( 'jcb_ce_onAfterBuildFields', - array(&$this->componentContext, &$dynamicFieldsXML, &$readOnlyXML, + array(&$component_context, &$dynamicFieldsXML, &$readOnlyXML, &$dbkey, &$view, &$component, &$nameSingleCode, &$nameListCode, &$placeholders, &$langView, &$langViews) @@ -3947,6 +3949,8 @@ class Fields extends Structure $field['order_edit'] = $this->zeroOrderFix[$nameSingleCode][(int) $field['tab']]; } + // get the default fields + $default_fields = CFactory::_('Config')->default_fields; // now build the layout if (StringHelper::check($tabName) && strtolower($tabName) != 'publishing') @@ -3971,7 +3975,7 @@ class Fields extends Structure = $name; } // check if default fields were over written - if (in_array($name, $this->defaultFields)) + if (in_array($name, $default_fields)) { // just to eliminate $this->movedPublishingFields[$nameSingleCode][$name] = $name; @@ -3979,7 +3983,7 @@ class Fields extends Structure } elseif ($tabName === 'publishing' || $tabName === 'Publishing') { - if (!in_array($name, $this->defaultFields)) + if (!in_array($name, $default_fields)) { if (isset($this->newPublishingFields[$nameSingleCode][(int) $field['alignment']][(int) $field['order_edit']])) { @@ -4021,7 +4025,7 @@ class Fields extends Structure = $name; } // check if default fields were over written - if (in_array($name, $this->defaultFields)) + if (in_array($name, $default_fields)) { // just to eliminate $this->movedPublishingFields[$nameSingleCode][$name] = $name; @@ -4045,12 +4049,10 @@ class Fields extends Structure $decode = array('json', 'base64', 'basic_encryption', 'whmcs_encryption', 'medium_encryption', 'expert_mode'); $textareas = array('textarea', 'editor'); - if (isset($this->siteFields[$view][$field]) - && ArrayHelper::check( - $this->siteFields[$view][$field] - )) + if (($site_fields = CFactory::_('Registry')-> + extract('builder.site_fields.' . $view . '.' . $field)) !== null) { - foreach ($this->siteFields[$view][$field] as $codeString => $array) + foreach ($site_fields as $codeString => $site_field) { // get the code array $codeArray = explode('___', (string) $codeString); @@ -4059,40 +4061,40 @@ class Fields extends Structure // set the decoding methods if (in_array($set, $decode)) { - if (isset($this->siteFieldData['decode'][$array['site']][$code][$array['as']][$array['key']]) - && isset($this->siteFieldData['decode'][$array['site']][$code][$array['as']][$array['key']]['decode'])) + if (isset($this->siteFieldData['decode'][$site_field->site][$code][$site_field->as][$site_field->key]) + && isset($this->siteFieldData['decode'][$site_field->site][$code][$site_field->as][$site_field->key]['decode'])) { if (!in_array( $set, - $this->siteFieldData['decode'][$array['site']][$code][$array['as']][$array['key']]['decode'] + $this->siteFieldData['decode'][$site_field->site][$code][$site_field->as][$site_field->key]['decode'] )) { - $this->siteFieldData['decode'][$array['site']][$code][$array['as']][$array['key']]['decode'][] + $this->siteFieldData['decode'][$site_field->site][$code][$site_field->as][$site_field->key]['decode'][] = $set; } } else { - $this->siteFieldData['decode'][$array['site']][$code][$array['as']][$array['key']] - = array('decode' => array($set), + $this->siteFieldData['decode'][$site_field->site][$code][$site_field->as][$site_field->key] + = array('decode' => [$set], 'type' => $type, 'admin_view' => $view); } } // set the uikit checker - if ((2 == $this->uikit || 1 == $this->uikit) + if ((2 == CFactory::_('Config')->uikit || 1 == CFactory::_('Config')->uikit) && in_array( $type, $textareas )) { - $this->siteFieldData['uikit'][$array['site']][$code][$array['as']][$array['key']] - = $array; + $this->siteFieldData['uikit'][$site_field->site][$code][$site_field->as][$site_field->key] + = (array) $site_field; } // set the textareas checker if (in_array($type, $textareas)) { - $this->siteFieldData['textareas'][$array['site']][$code][$array['as']][$array['key']] - = $array; + $this->siteFieldData['textareas'][$site_field->site][$code][$site_field->as][$site_field->key] + = (array) $site_field; } } } @@ -4863,10 +4865,12 @@ class Fields extends Structure } $this->intFieldsBuilder[$nameSingleCode] .= ',"' . $name . '"'; } + // Get the default fields + $default_fields = CFactory::_('Config')->default_fields; // set all dynamic field of this view if ($dbSwitch && $typeName != 'category' && $typeName != 'repeatable' && $typeName != 'subform' - && !in_array($name, $this->defaultFields)) + && !in_array($name, $default_fields)) { if (!isset($this->dynamicfieldsBuilder[$nameSingleCode])) { @@ -5188,8 +5192,8 @@ class Fields extends Structure // add the language only for new filter option $filter_name_asc_lang = ''; $filter_name_desc_lang = ''; - if (isset($this->adminFilterType[$nameListCode]) - && $this->adminFilterType[$nameListCode] == 2) + if (CFactory::_('Registry')-> + get('builder.admin_filter_type.' . $nameListCode, 1) == 2) { // set the language strings for ascending $filter_name_asc = $listFieldName . ' ascending'; @@ -5248,8 +5252,8 @@ class Fields extends Structure ); // add the language only for new filter option $filter_name_select_lang = ''; - if (isset($this->adminFilterType[$nameListCode]) - && $this->adminFilterType[$nameListCode] == 2) + if (CFactory::_('Registry')-> + get('builder.admin_filter_type.' . $nameListCode, 1) == 2) { // set the language strings for selection $filter_name_select = 'Select ' . $listFieldName; @@ -5734,8 +5738,8 @@ class Fields extends Structure public function setFieldFilterSet(&$nameSingleCode, &$nameListCode) { // check if this is the above/new filter option - if (isset($this->adminFilterType[$nameListCode]) - && $this->adminFilterType[$nameListCode] == 2) + if (CFactory::_('Registry')-> + get('builder.admin_filter_type.' . $nameListCode, 1) == 2) { // we first create the file $target = array('admin' => 'filter_' . $nameListCode); @@ -5930,8 +5934,8 @@ class Fields extends Structure public function setFieldFilterListSet(&$nameSingleCode, &$nameListCode) { // check if this is the above/new filter option - if (isset($this->adminFilterType[$nameListCode]) - && $this->adminFilterType[$nameListCode] == 2) + if (CFactory::_('Registry')-> + get('builder.admin_filter_type.' . $nameListCode, 1) == 2) { // keep track of all fields already added $donelist = array('ordering' => true, 'id' => true); @@ -6437,11 +6441,11 @@ class Fields extends Structure return $this->xmlIndent((string) $tidy, ' ', 8, true, false); } - // set tidy waring atleast once - elseif (!$this->setTidyWarning) + // set tidy waring only once + elseif (CFactory::_('Config')->set_tidy_warning) { // set the warning only once - $this->setTidyWarning = true; + CFactory::_('Config')->set('set_tidy_warning', false); // now set the warning $this->app->enqueueMessage( JText::_('

Tidy Error

'), 'Error' diff --git a/admin/helpers/compiler/e_Interpretation.php b/admin/helpers/compiler/e_Interpretation.php index 09285183e..e514e1fd8 100644 --- a/admin/helpers/compiler/e_Interpretation.php +++ b/admin/helpers/compiler/e_Interpretation.php @@ -1528,7 +1528,7 @@ class Interpretation extends Fields public function setHelperExelMethods() { - if ($this->addEximport) + if (CFactory::_('Config')->get('add_eximport', false)) { // we use the company name set in the GUI $company_name = CFactory::_('Content')->get('COMPANYNAME'); @@ -2453,19 +2453,17 @@ class Interpretation extends Fields $the_get, $code )) !== false) { - if (isset($this->siteDynamicGet[CFactory::_('Config')->build_target][$default['code']][$default['as']][$default['join_field']]) - && StringHelper::check( - $this->siteDynamicGet[CFactory::_('Config')->build_target][$default['code']][$default['as']][$default['join_field']] - ) + if (($join_field_ = CFactory::_('Registry')->get('builder.site_dynamic_get.' . CFactory::_('Config')->build_target . + '.' . $default['code'] . '.' . $default['as'] . '.' . $default['join_field'], null)) !== null && !in_array($check, $mainAsArray)) { // load to other query - if (!isset($this->otherQuery[CFactory::_('Config')->build_target][$default['code']][$this->siteDynamicGet[CFactory::_('Config')->build_target][$default['code']][$default['as']][$default['join_field']]][$default['valueName']])) + if (!isset($this->otherQuery[CFactory::_('Config')->build_target][$default['code']][$join_field_][$default['valueName']])) { - $this->otherQuery[CFactory::_('Config')->build_target][$default['code']][$this->siteDynamicGet[CFactory::_('Config')->build_target][$default['code']][$default['as']][$default['join_field']]][$default['valueName']] + $this->otherQuery[CFactory::_('Config')->build_target][$default['code']][$join_field_][$default['valueName']] = ''; } - $this->otherQuery[CFactory::_('Config')->build_target][$default['code']][$this->siteDynamicGet[CFactory::_('Config')->build_target][$default['code']][$default['as']][$default['join_field']]][$default['valueName']] + $this->otherQuery[CFactory::_('Config')->build_target][$default['code']][$join_field_][$default['valueName']] .= $getItem; } else @@ -2935,7 +2933,7 @@ class Interpretation extends Fields // set the key $this->loadTracker[$key] = $key; // only load for uikit version 2 (TODO) we may need to add another check here - if (2 == $this->uikit || 1 == $this->uikit) + if (2 == CFactory::_('Config')->uikit || 1 == CFactory::_('Config')->uikit) { $fieldUikit .= PHP_EOL . Indent::_(1) . $tab . Indent::_(1) . "//" . Line::_(__Line__, __Class__) . " Checking if " @@ -2976,15 +2974,18 @@ class Interpretation extends Fields . Indent::_(1) . Placefix::_h("STRING") . "->" . $default['valueName'] . " = \$this->get" . $default['methodName'] . "(" . Placefix::_h("STRING") . "->" - . $this->getAsLookup[$get['key']][$get['on_field']] + . CFactory::_('Registry')-> + get('builder.get_as_lookup.' . $get['key'] . '.' . $get['on_field'], 'Error') . ");"; + $join_field_ = CFactory::_('Registry')->get('builder.site_dynamic_get.' . CFactory::_('Config')->build_target . + '.' . $default['code'] . '.' . $default['as'] . '.' . $default['join_field'], 'ZZZ'); // load to other join - if (!isset($this->otherJoin[CFactory::_('Config')->build_target][$default['code']][$this->siteDynamicGet[CFactory::_('Config')->build_target][$default['code']][$default['as']][$default['join_field']]][$default['valueName']])) + if (!isset($this->otherJoin[CFactory::_('Config')->build_target][$default['code']][$join_field_][$default['valueName']])) { - $this->otherJoin[CFactory::_('Config')->build_target][$default['code']][$this->siteDynamicGet[CFactory::_('Config')->build_target][$default['code']][$default['as']][$default['join_field']]][$default['valueName']] + $this->otherJoin[CFactory::_('Config')->build_target][$default['code']][$join_field_][$default['valueName']] = ''; } - $this->otherJoin[CFactory::_('Config')->build_target][$default['code']][$this->siteDynamicGet[CFactory::_('Config')->build_target][$default['code']][$default['as']][$default['join_field']]][$default['valueName']] + $this->otherJoin[CFactory::_('Config')->build_target][$default['code']][$join_field_][$default['valueName']] .= $otherJoin; } else @@ -2998,7 +2999,8 @@ class Interpretation extends Fields . Indent::_(1) . $string . "->" . $default['valueName'] . " = \$this->get" . $default['methodName'] . "(" . $string . "->" - . $this->getAsLookup[$get['key']][$get['on_field']] + . CFactory::_('Registry')-> + get('builder.get_as_lookup.' . $get['key'] . '.' . $get['on_field'], 'Error') . ");"; } } @@ -3022,10 +3024,9 @@ class Interpretation extends Fields return false; } // default fallback - elseif (isset($this->siteDynamicGet[CFactory::_('Config')->build_target][$default['code']][$default['as']][$default['join_field']]) - && StringHelper::check( - $this->siteDynamicGet[CFactory::_('Config')->build_target][$default['code']][$default['as']][$default['join_field']] - )) + elseif (CFactory::_('Registry')-> + exists('builder.site_dynamic_get.' . CFactory::_('Config')->build_target . + '.' . $default['code'] . '.' . $default['as'] . '.' . $default['join_field'])) { return true; } @@ -3213,10 +3214,9 @@ class Interpretation extends Fields { // sort where if ($as === 'a' - || (isset($this->siteMainGet[CFactory::_('Config')->build_target][$code][$as]) - && StringHelper::check( - $this->siteMainGet[CFactory::_('Config')->build_target][$code][$as] - ))) + || CFactory::_('Registry')-> + exists('builder.site_main_get.' . CFactory::_('Config')->build_target . + '.' . $code . '.' . $as)) { $filters .= $string; } @@ -3246,10 +3246,9 @@ class Interpretation extends Fields $string = "\$query->group('" . $gr['table_key'] . "');"; // sort where if ($as === 'a' - || (isset($this->siteMainGet[CFactory::_('Config')->build_target][$code][$as]) - && StringHelper::check( - $this->siteMainGet[CFactory::_('Config')->build_target][$code][$as] - ))) + || CFactory::_('Registry')-> + exists('builder.site_main_get.' . CFactory::_('Config')->build_target . + '.' . $code . '.' . $as)) { $grouping .= PHP_EOL . Indent::_(1) . $tab . Indent::_(1) . $string; @@ -3289,10 +3288,9 @@ class Interpretation extends Fields } // sort where if ($as === 'a' - || (isset($this->siteMainGet[CFactory::_('Config')->build_target][$code][$as]) - && StringHelper::check( - $this->siteMainGet[CFactory::_('Config')->build_target][$code][$as] - ))) + || CFactory::_('Registry')-> + exists('builder.site_main_get.' . CFactory::_('Config')->build_target . + '.' . $code . '.' . $as)) { $ordering .= PHP_EOL . Indent::_(1) . $tab . Indent::_(1) . $string; @@ -3400,10 +3398,9 @@ class Interpretation extends Fields } // sort where if ($as === 'a' - || (isset($this->siteMainGet[CFactory::_('Config')->build_target][$code][$as]) - && StringHelper::check( - $this->siteMainGet[CFactory::_('Config')->build_target][$code][$as] - ))) + || CFactory::_('Registry')-> + exists('builder.site_main_get.' . CFactory::_('Config')->build_target . + '.' . $code . '.' . $as)) { $wheres .= PHP_EOL . Indent::_(1) . $tab . Indent::_(1) . $string; @@ -4068,7 +4065,7 @@ class Interpretation extends Fields public function setUikitHelperMethods() { // only load for uikit version 2 - if (2 == $this->uikit || 1 == $this->uikit) + if (2 == CFactory::_('Config')->uikit || 1 == CFactory::_('Config')->uikit) { // build uikit get method $ukit = array(); @@ -4193,7 +4190,7 @@ class Interpretation extends Fields { $method = ''; // only load for uikit version 2 - if (2 == $this->uikit || 1 == $this->uikit) + if (2 == CFactory::_('Config')->uikit || 1 == CFactory::_('Config')->uikit) { // build uikit get method $method .= PHP_EOL . PHP_EOL . Indent::_(1) . "/**"; @@ -4998,8 +4995,8 @@ class Interpretation extends Fields { $script = ''; // add the the new filter methods for the search toolbar above the list view (2 = topbar) - if (isset($this->adminFilterType[$nameListCode]) - && $this->adminFilterType[$nameListCode] == 2) + if (CFactory::_('Registry')-> + get('builder.admin_filter_type.' . $nameListCode, 1) == 2) { $script .= PHP_EOL . Indent::_(2) . "//" . Line::_( @@ -5294,8 +5291,8 @@ class Interpretation extends Fields public function setGetModules($view, $TARGET) { - if (isset($this->getModule[CFactory::_('Config')->build_target][$view['settings']->code]) - && $this->getModule[CFactory::_('Config')->build_target][$view['settings']->code]) + if (CFactory::_('Registry')-> + exists('builder.get_module.' . CFactory::_('Config')->build_target . '.' . $view['settings']->code)) { $addModule = array(); $addModule[] = PHP_EOL . PHP_EOL . Indent::_(1) . "/**"; @@ -5897,8 +5894,8 @@ class Interpretation extends Fields public function setFootableScriptsLoader(&$view) { - if (isset($this->footableScripts[CFactory::_('Config')->build_target][$view['settings']->code]) - && $this->footableScripts[CFactory::_('Config')->build_target][$view['settings']->code]) + if (CFactory::_('Registry')-> + exists('builder.footable_scripts.' . CFactory::_('Config')->build_target . '.' . $view['settings']->code)) { return $this->setFootableScripts(false); } @@ -6059,8 +6056,8 @@ class Interpretation extends Fields public function setGoogleChartLoader(&$view) { - if (isset($this->googleChart[CFactory::_('Config')->build_target][$view['settings']->code]) - && $this->googleChart[CFactory::_('Config')->build_target][$view['settings']->code]) + if (CFactory::_('Registry')-> + exists('builder.google_chart.' . CFactory::_('Config')->build_target . '.' . $view['settings']->code)) { $chart = array(); $chart[] = PHP_EOL . PHP_EOL . Indent::_(2) . "//" . Line::_( @@ -6099,7 +6096,7 @@ class Interpretation extends Fields } // reset bucket $setter = ''; - // allways load these in + // always load these in if ($view_active) { $setter .= PHP_EOL . PHP_EOL . Indent::_(2) . "//" . Line::_( @@ -6124,34 +6121,25 @@ class Interpretation extends Fields . CFactory::_('Config')->component_code_name . "HeaderCheck;"; } // check if this view should get libraries - if (isset($this->libManager[CFactory::_('Config')->build_target][$code]) - && ArrayHelper::check( - $this->libManager[CFactory::_('Config')->build_target][$code] - )) + if (($data = CFactory::_('Registry')->extract('builder.library_manager.' . + CFactory::_('Config')->build_target . '.' . $code)) !== null) { - foreach ($this->libManager[CFactory::_('Config')->build_target][$code] as $id => $true) + foreach ($data as $id => $true) { - if (isset($this->libraries[$id]) - && ObjectHelper::check( - $this->libraries[$id] - ) - && isset($this->libraries[$id]->document) - && StringHelper::check( - $this->libraries[$id]->document - )) + // get the library + $library = CFactory::_('Registry')->get("builder.libraries.$id", null); + if (is_object($library) && isset($library->document) + && StringHelper::check($library->document)) { $setter .= PHP_EOL . PHP_EOL . CFactory::_('Placeholder')->update_( str_replace( '$document->', '$this->document->', - (string) $this->libraries[$id]->document + (string) $library->document ) ); } - elseif (isset($this->libraries[$id]) - && ObjectHelper::check( - $this->libraries[$id] - ) - && isset($this->libraries[$id]->how)) + elseif (is_object($library) + && isset($library->how)) { $setter .= $this->setLibraryDocument($id); } @@ -6168,29 +6156,35 @@ class Interpretation extends Fields protected function setLibraryDocument($id) { - if (2 == $this->libraries[$id]->how - && isset($this->libraries[$id]->conditions) - && ArrayHelper::check( - $this->libraries[$id]->conditions - )) + // get the library + $library = CFactory::_('Registry')->get("builder.libraries.$id", null); + // make sure we have an object + if (is_object($library)) { - // build document with the conditions values - $this->setLibraryDocConditions( - $id, $this->setLibraryScripts($id, false) - ); - } - elseif (1 == $this->libraries[$id]->how) - { - // build document to allways add all files and urls - $this->setLibraryScripts($id); - } - // check if the document was build - if (isset($this->libraries[$id]->document) - && StringHelper::check( - $this->libraries[$id]->document - )) - { - return PHP_EOL . PHP_EOL . $this->libraries[$id]->document; + if (isset($library->how) && 2 == $library->how + && isset($library->conditions) + && ArrayHelper::check( + $library->conditions + )) + { + // build document with the conditions values + $this->setLibraryDocConditions( + $id, $this->setLibraryScripts($id, false) + ); + } + elseif (isset($library->how) && 1 == $library->how) + { + // build document to allways add all files and urls + $this->setLibraryScripts($id); + } + // check if the document was build + if (isset($library->document) + && StringHelper::check( + $library->document + )) + { + return PHP_EOL . PHP_EOL . $library->document; + } } return ''; @@ -6198,50 +6192,75 @@ class Interpretation extends Fields protected function setLibraryDocConditions($id, $scripts) { - $document = ''; // Start script builder for library files if (!isset($this->libwarning[$id])) { + // set the warning only once + $this->libwarning[$id] = true; + + // get the library + $library = CFactory::_('Registry')->get("builder.libraries.$id", null); + $this->app->enqueueMessage( JText::_('

Conditional Script Warning

'), 'Warning' ); - $this->app->enqueueMessage( - JText::sprintf( - 'The conditional script builder for %s is not ready, sorry!', - $this->libraries[$id]->name - ), 'Warning' - ); - // set the warning only once - $this->libwarning[$id] = true; - } - // if there was any code added to document then set globaly - if (StringHelper::check($document)) - { - $this->libraries[$id]->document = $document; + + // message with name + if (is_object($library) && isset($library->name)) + { + $this->app->enqueueMessage( + JText::sprintf( + 'The conditional script builder for %s is not ready, sorry!', + $library->name + ), 'Warning' + ); + } + else + { + $this->app->enqueueMessage( + JText::_( + 'The conditional script builder for ID:%s is not ready, sorry!', + $id + ), 'Warning' + ); + } } } protected function setLibraryScripts($id, $buildDoc = true) { - $scripts = array(); - // load the urls if found - if (isset($this->libraries[$id]->urls) - && ArrayHelper::check($this->libraries[$id]->urls)) + $scripts = []; + // get the library + $library = CFactory::_('Registry')->get("builder.libraries.$id", null); + // check that we have a library + if (is_object($library)) { - // set all the files - foreach ($this->libraries[$id]->urls as $url) + // load the urls if found + if (isset($library->urls) + && ArrayHelper::check($library->urls)) { - // if local path is set, then use it first - if (isset($url['path'])) + // set all the files + foreach ($library->urls as $url) { - // update the root path - $path = $this->getScriptRootPath($url['path']); - // load document script - $scripts[md5((string) $url['path'])] = $this->setIncludeLibScript( - $path - ); - // load url also if not building document - if (!$buildDoc) + // if local path is set, then use it first + if (isset($url['path'])) + { + // update the root path + $path = $this->getScriptRootPath($url['path']); + // load document script + $scripts[md5((string) $url['path'])] = $this->setIncludeLibScript( + $path + ); + // load url also if not building document + if (!$buildDoc) + { + // load document script + $scripts[md5((string) $url['url'])] = $this->setIncludeLibScript( + $url['url'], false + ); + } + } + else { // load document script $scripts[md5((string) $url['url'])] = $this->setIncludeLibScript( @@ -6249,100 +6268,99 @@ class Interpretation extends Fields ); } } - else - { - // load document script - $scripts[md5((string) $url['url'])] = $this->setIncludeLibScript( - $url['url'], false - ); - } } - } - // load the local files if found - if (isset($this->libraries[$id]->files) - && ArrayHelper::check($this->libraries[$id]->files)) - { - // set all the files - foreach ($this->libraries[$id]->files as $file) + // load the local files if found + if (isset($library->files) + && ArrayHelper::check($library->files)) { - $path = '/' . trim((string) $file['path'], '/'); - // check if path has new file name (has extetion) - $pathInfo = pathinfo($path); - // update the root path - $_path = $this->getScriptRootPath($path); - if (isset($pathInfo['extension']) && $pathInfo['extension']) + // set all the files + foreach ($library->files as $file) { - // load document script - $scripts[md5($path)] = $this->setIncludeLibScript( - $_path, false, $pathInfo - ); - } - else - { - // load document script - $scripts[md5($path . '/' . trim((string) $file['file'], '/'))] - = $this->setIncludeLibScript( - $_path . '/' . trim((string) $file['file'], '/') - ); - } - } - } - // load the local folders if found - if (isset($this->libraries[$id]->folders) - && ArrayHelper::check( - $this->libraries[$id]->folders - )) - { - // get all the file paths - foreach ($this->libraries[$id]->folders as $folder) - { - if (isset($folder['path']) && isset($folder['folder'])) - { - $path = '/' . trim((string) $folder['path'], '/'); - if (isset($folder['rename']) && 1 == $folder['rename']) + $path = '/' . trim((string) $file['path'], '/'); + // check if path has new file name (has extetion) + $pathInfo = pathinfo($path); + // update the root path + $_path = $this->getScriptRootPath($path); + if (isset($pathInfo['extension']) && $pathInfo['extension']) { - if ($_paths = FileHelper::getPaths( - $this->componentPath . $path - )) - { - $files[$path] = $_paths; - } + // load document script + $scripts[md5($path)] = $this->setIncludeLibScript( + $_path, false, $pathInfo + ); } else { - $path = $path . '/' . trim((string) $folder['folder'], '/'); - if ($_paths = FileHelper::getPaths( - $this->componentPath . $path - )) + // load document script + $scripts[md5($path . '/' . trim((string) $file['file'], '/'))] + = $this->setIncludeLibScript( + $_path . '/' . trim((string) $file['file'], '/') + ); + } + } + } + // load the local folders if found + if (isset($library->folders) + && ArrayHelper::check( + $library->folders + )) + { + // get all the file paths + $files = []; + foreach ($library->folders as $folder) + { + if (isset($folder['path']) && isset($folder['folder'])) + { + $path = '/' . trim((string)$folder['path'], '/'); + if (isset($folder['rename']) && 1 == $folder['rename']) { - $files[$path] = $_paths; + if ($_paths = FileHelper::getPaths( + $this->componentPath . $path + )) + { + $files[$path] = $_paths; + } + } + else + { + $path = $path . '/' . trim((string)$folder['folder'], '/'); + if ($_paths = FileHelper::getPaths( + $this->componentPath . $path + )) + { + $files[$path] = $_paths; + } + } + } + } + // now load the script + if (ArrayHelper::check($files)) + { + foreach ($files as $root => $paths) + { + // update the root path + $_root = $this->getScriptRootPath($root); + // load per path + foreach ($paths as $path) + { + $scripts[md5($root . '/' . trim((string)$path, '/'))] + = $this->setIncludeLibScript( + $_root . '/' . trim((string)$path, '/') + ); } } } } - // now load the script - foreach ($files as $root => $paths) - { - // update the root path - $_root = $this->getScriptRootPath($root); - // load per path - foreach ($paths as $path) - { - $scripts[md5($root . '/' . trim((string) $path, '/'))] - = $this->setIncludeLibScript( - $_root . '/' . trim((string) $path, '/') - ); - } - } } - // if there was any code added to document then set globaly + + // if there was any code added to document then set globally if ($buildDoc && ArrayHelper::check($scripts)) { - $this->libraries[$id]->document = Indent::_(2) . "//" + CFactory::_('Registry')->set("builder.libraries.${id}.document", Indent::_(2) . "//" . Line::_(__Line__, __Class__) . " always load these files." . PHP_EOL . Indent::_(2) . implode( PHP_EOL . Indent::_(2), $scripts - ); + ) + ); // success return true; @@ -6436,7 +6454,7 @@ class Interpretation extends Fields // reset setter $setter = ''; // load the defaults needed - if ($this->uikit > 0) + if (CFactory::_('Config')->uikit > 0) { $setter .= PHP_EOL . PHP_EOL . Indent::_(2) . "//" . Line::_( __LINE__,__CLASS__ @@ -6449,7 +6467,7 @@ class Interpretation extends Fields . "\$size = \$this->params->get('uikit_min');"; $tabV = ""; // if both versions should be loaded then add some more logic - if (2 == $this->uikit) + if (2 == CFactory::_('Config')->uikit) { $setter .= PHP_EOL . PHP_EOL . Indent::_(2) . "//" . Line::_(__Line__, __Class__) . " Load uikit version."; @@ -6464,7 +6482,7 @@ class Interpretation extends Fields } } // load the defaults needed - if (2 == $this->uikit || 1 == $this->uikit) + if (2 == CFactory::_('Config')->uikit || 1 == CFactory::_('Config')->uikit) { $setter .= PHP_EOL . $tabV . Indent::_(2) . "//" . Line::_( __LINE__,__CLASS__ @@ -6495,11 +6513,9 @@ class Interpretation extends Fields $setter .= PHP_EOL . $tabV . Indent::_(2) . "}"; } // load the components need - if ((2 == $this->uikit || 1 == $this->uikit) - && isset($this->uikitComp[$view['settings']->code]) - && ArrayHelper::check( - $this->uikitComp[$view['settings']->code] - )) + if ((2 == CFactory::_('Config')->uikit || 1 == CFactory::_('Config')->uikit) + && ($data_ = CFactory::_('Registry')->extract('builder.uikit_comp.' . + $view['settings']->code)) !== null) { $setter .= PHP_EOL . PHP_EOL . $tabV . Indent::_(2) . "//" . Line::_(__Line__, __Class__) @@ -6511,7 +6527,7 @@ class Interpretation extends Fields ) . " Set the default uikit components in this view."; $setter .= PHP_EOL . $tabV . Indent::_(3) . "\$uikitComp = array();"; - foreach ($this->uikitComp[$view['settings']->code] as $class) + foreach ($data_ as $class) { $setter .= PHP_EOL . $tabV . Indent::_(3) . "\$uikitComp[] = '" . $class . "';"; @@ -6605,7 +6621,7 @@ class Interpretation extends Fields $setter .= PHP_EOL . $tabV . Indent::_(3) . "}"; $setter .= PHP_EOL . $tabV . Indent::_(2) . "}"; } - elseif ((2 == $this->uikit || 1 == $this->uikit) + elseif ((2 == CFactory::_('Config')->uikit || 1 == CFactory::_('Config')->uikit) && isset($this->siteFieldData['uikit'][$view['settings']->code]) && ArrayHelper::check( $this->siteFieldData['uikit'][$view['settings']->code] @@ -6666,9 +6682,9 @@ class Interpretation extends Fields $setter .= PHP_EOL . $tabV . Indent::_(2) . "}"; } // now set the version 3 - if (2 == $this->uikit || 3 == $this->uikit) + if (2 == CFactory::_('Config')->uikit || 3 == CFactory::_('Config')->uikit) { - if (2 == $this->uikit) + if (2 == CFactory::_('Config')->uikit) { $setter .= PHP_EOL . Indent::_(2) . "}"; $setter .= PHP_EOL . Indent::_(2) . "//" . Line::_( @@ -6705,7 +6721,7 @@ class Interpretation extends Fields . CFactory::_('Config')->component_code_name . "/uikit-v3/js/uikit-icons'.\$size.'.js', ['version' => 'auto']);"; $setter .= PHP_EOL . $tabV . Indent::_(2) . "}"; - if (2 == $this->uikit) + if (2 == CFactory::_('Config')->uikit) { $setter .= PHP_EOL . Indent::_(2) . "}"; } @@ -6996,17 +7012,12 @@ class Interpretation extends Fields public function setCustomViewTemplateBody(&$view) { - if (isset($this->templateData[CFactory::_('Config')->build_target][$view['settings']->code]) - && ArrayHelper::check( - $this->templateData[CFactory::_('Config')->build_target][$view['settings']->code] - )) + if (($data_ = CFactory::_('Registry')-> + extract('builder.template_data.' . CFactory::_('Config')->build_target . '.' . $view['settings']->code)) !== null) { $created = $this->getCreatedDate($view); $modified = $this->getLastModifiedDate($view); - foreach ( - $this->templateData[CFactory::_('Config')->build_target][$view['settings']->code] as - $template => $data - ) + foreach ($data_ as $template => $data) { // build the file $target = array(CFactory::_('Config')->build_target => $view['settings']->code); @@ -7021,12 +7032,12 @@ class Interpretation extends Fields // SITE_TEMPLATE_BODY <<>> CFactory::_('Content')->set_($view['settings']->code . '_' . $template, $TARGET . '_TEMPLATE_BODY', PHP_EOL . CFactory::_('Placeholder')->update_( - $data['html'] + $data->html )); // SITE_TEMPLATE_CODE_BODY <<>> CFactory::_('Content')->set_($view['settings']->code . '_' . $template,$TARGET . '_TEMPLATE_CODE_BODY', - $this->setCustomViewTemplateCode($data['php_view']) + $this->setCustomViewTemplateCode($data->php_view) ); } } @@ -7050,12 +7061,10 @@ class Interpretation extends Fields public function setCustomViewLayouts() { - if (isset($this->layoutData[CFactory::_('Config')->build_target]) - && ArrayHelper::check( - $this->layoutData[CFactory::_('Config')->build_target] - )) + if (($data_ = CFactory::_('Registry')-> + extract('builder.layout_data.' . CFactory::_('Config')->build_target)) !== null) { - foreach ($this->layoutData[CFactory::_('Config')->build_target] as $layout => $data) + foreach ($data_ as $layout => $data) { // build the file $target = array(CFactory::_('Config')->build_target => $layout); @@ -7065,7 +7074,7 @@ class Interpretation extends Fields CFactory::_('Config')->build_target, 'U' ); // SITE_LAYOUT_CODE <<>> - $php_view = (array) explode(PHP_EOL, (string) $data['php_view']); + $php_view = (array) explode(PHP_EOL, (string) $data->php_view); if (ArrayHelper::check($php_view)) { $php_view = PHP_EOL . PHP_EOL . implode(PHP_EOL, $php_view); @@ -7083,7 +7092,7 @@ class Interpretation extends Fields // SITE_LAYOUT_BODY <<>> CFactory::_('Content')->set_($layout,$TARGET . '_LAYOUT_BODY', PHP_EOL . CFactory::_('Placeholder')->update_( - $data['html'] + $data->html ) ); // SITE_LAYOUT_HEADER <<>> @@ -8392,11 +8401,13 @@ class Interpretation extends Fields // check if we should add the intelligent fix treatment for the assets table if (CFactory::_('Config')->add_assets_table_fix == 2) { + // get worse case + $access_worse_case = CFactory::_('Config')->get('access_worse_case', 0); // get the type we will convert to - $data_type = ($this->accessWorseCase > 64000) ? "MEDIUMTEXT" + $data_type = ($access_worse_case > 64000) ? "MEDIUMTEXT" : "TEXT"; // the if statement about $rule_length - $codeIF = "\$rule_length <= " . $this->accessWorseCase; + $codeIF = "\$rule_length <= " . $access_worse_case; // fix column size $script = array(); $script[] = Indent::_(5) . "//" . Line::_(__Line__, __Class__) @@ -9292,10 +9303,10 @@ class Interpretation extends Fields $alias = $this->aliasBuilder[$nameSingleCode]; } // only load title if set in this view - if (isset($this->customAliasBuilder[$nameSingleCode])) + if (($customAliasBuilder = CFactory::_('Registry')->get('builder.custom_alias.' . $nameSingleCode, null)) !== null) { $titles = array_values( - $this->customAliasBuilder[$nameSingleCode] + $customAliasBuilder ); $title = true; } @@ -9663,7 +9674,7 @@ class Interpretation extends Fields // only load this if these two items are set if (array_key_exists($nameSingleCode, $this->aliasBuilder) && (array_key_exists($nameSingleCode, $this->titleBuilder) - || isset($this->customAliasBuilder[$nameSingleCode]))) + || CFactory::_('Registry')->get('builder.custom_alias.' . $nameSingleCode, null))) { // set needed defaults $setCategory = false; @@ -9677,10 +9688,10 @@ class Interpretation extends Fields $setCategory = true; } // set the title stuff - if (isset($this->customAliasBuilder[$nameSingleCode])) + if (($customAliasBuilder = CFactory::_('Registry')->get('builder.custom_alias.' . $nameSingleCode, null)) !== null) { $titles = array_values( - $this->customAliasBuilder[$nameSingleCode] + $customAliasBuilder ); if (isset($this->titleBuilder[$nameSingleCode])) { @@ -9872,7 +9883,7 @@ class Interpretation extends Fields // if category is added to this view then do nothing if (array_key_exists($nameSingleCode, $this->aliasBuilder) && (array_key_exists($nameSingleCode, $this->titleBuilder) - || isset($this->customAliasBuilder[$nameSingleCode]))) + || CFactory::_('Registry')->get('builder.custom_alias.' . $nameSingleCode, null))) { // get component name $Component = CFactory::_('Content')->get('Component'); @@ -9985,10 +9996,10 @@ class Interpretation extends Fields if (isset($this->aliasBuilder[$nameSingleCode])) { // set the title stuff - if (isset($this->customAliasBuilder[$nameSingleCode])) + if (($customAliasBuilder = CFactory::_('Registry')->get('builder.custom_alias.' . $nameSingleCode, null)) !== null) { $titles = array_values( - $this->customAliasBuilder[$nameSingleCode] + $customAliasBuilder ); } elseif (isset($this->titleBuilder[$nameSingleCode])) @@ -10065,7 +10076,7 @@ class Interpretation extends Fields )) { // set the main db prefix - $component = $this->componentCodeName; + $component = CFactory::_('Config')->component_code_name; // start building the db $db = ''; foreach ($this->queryBuilder as $view => $fields) @@ -10079,11 +10090,9 @@ class Interpretation extends Fields $db_ .= "CREATE TABLE IF NOT EXISTS `#__" . $component . "_" . $view . "` ("; // check if the table name has changed - if (isset($this->updateSQL['table_name']) - && isset($this->updateSQL['table_name'][$view])) + if (($old_table_name = CFactory::_('Registry')-> + get('builder.update_sql.table_name.' . $view . '.old', null)) !== null) { - $old_table_name - = $this->updateSQL['table_name'][$view]['old']; $this->updateSQLBuilder["RENAMETABLE`#__" . $component . "_" . $old_table_name . "`"] = "RENAME TABLE `#__" . $component . "_" @@ -10155,12 +10164,8 @@ class Interpretation extends Fields $db_ .= PHP_EOL . Indent::_(1) . "`" . $field . "` " . $data['type'] . $lenght . " " . $default . ","; // check if this a new field that should be added via SQL update - if (isset($this->addSQL['field']) - && isset($this->addSQL['field'][$view]) - && ArrayHelper::check( - $this->addSQL['field'][$view] - ) - && in_array($data['ID'], $this->addSQL['field'][$view])) + if (CFactory::_('Registry')-> + get('builder.add_sql.field.' . $view . '.' . $data['ID'], null)) { // to soon.... //$this->updateSQLBuilder["ALTERTABLE`#__" . $component @@ -10177,33 +10182,16 @@ class Interpretation extends Fields . "`;"; } // check if the field has changed name and/or data type and lenght - elseif ((isset($this->updateSQL['field.datatype']) - && isset( - $this->updateSQL['field.datatype'][$view . '.' - . $field] - )) - || (isset($this->updateSQL['field.lenght']) - && isset( - $this->updateSQL['field.lenght'][$view . '.' - . $field] - )) - || (isset($this->updateSQL['field.name']) - && isset( - $this->updateSQL['field.name'][$view . '.' - . $field] - ))) + elseif (CFactory::_('Registry')-> + get('builder.update_sql.field.datatype.' . $view . '.' . $field, null) + || CFactory::_('Registry')-> + get('builder.update_sql.field.lenght.' . $view . '.' . $field, null) + || CFactory::_('Registry')-> + get('builder.update_sql.field.name.' . $view . '.' . $field, null)) { // if the name changed - if (isset($this->updateSQL['field.name']) - && isset( - $this->updateSQL['field.name'][$view . '.' - . $field] - )) - { - $oldName = $this->updateSQL['field.name'][$view - . '.' . $field]['old']; - } - else + if (($oldName = CFactory::_('Registry')-> + get('builder.update_sql.field.name.' . $view . '.' . $field . '.old', null)) === null) { $oldName = $field; } @@ -10287,7 +10275,7 @@ class Interpretation extends Fields $db_ .= PHP_EOL . Indent::_(1) . "`access` INT(10) unsigned NOT NULL DEFAULT 0,"; } - // check if default field was over written + // check if default field was overwritten if (!isset($this->fieldsNames[$view]['ordering'])) { $db_ .= PHP_EOL . Indent::_(1) @@ -10299,19 +10287,19 @@ class Interpretation extends Fields $this->metadataBuilder[$view] )) { - // check if default field was over written + // check if default field was overwritten if (!isset($this->fieldsNames[$view]['metakey'])) { $db_ .= PHP_EOL . Indent::_(1) . "`metakey` TEXT NOT NULL,"; } - // check if default field was over written + // check if default field was overwritten if (!isset($this->fieldsNames[$view]['metadesc'])) { $db_ .= PHP_EOL . Indent::_(1) . "`metadesc` TEXT NOT NULL,"; } - // check if default field was over written + // check if default field was overwritten if (!isset($this->fieldsNames[$view]['metadata'])) { $db_ .= PHP_EOL . Indent::_(1) @@ -10354,25 +10342,25 @@ class Interpretation extends Fields $db_ .= "," . PHP_EOL . Indent::_(1) . "KEY `idx_access` (`access`)"; } - // check if default field was over written + // check if default field was overwritten if (!isset($check_keys_set['checked_out'])) { $db_ .= "," . PHP_EOL . Indent::_(1) . "KEY `idx_checkout` (`checked_out`)"; } - // check if default field was over written + // check if default field was overwritten if (!isset($check_keys_set['created_by'])) { $db_ .= "," . PHP_EOL . Indent::_(1) . "KEY `idx_createdby` (`created_by`)"; } - // check if default field was over written + // check if default field was overwritten if (!isset($check_keys_set['modified_by'])) { $db_ .= "," . PHP_EOL . Indent::_(1) . "KEY `idx_modifiedby` (`modified_by`)"; } - // check if default field was over written + // check if default field was overwritten if (!isset($check_keys_set['published'])) { $db_ .= "," . PHP_EOL . Indent::_(1) @@ -10382,22 +10370,14 @@ class Interpretation extends Fields $easy = array(); // get the mysql table settings foreach ( - $this->mysqlTableKeys as $_mysqlTableKey => $_mysqlTableVal + CFactory::_('Config')->mysql_table_keys as $_mysqlTableKey => $_mysqlTableVal ) { - if (isset($this->mysqlTableSetting[$view]) - && ArrayHelper::check( - $this->mysqlTableSetting[$view] - ) - && isset($this->mysqlTableSetting[$view][$_mysqlTableKey])) + if (($easy[$_mysqlTableKey] = CFactory::_('Registry')-> + get('builder.mysql_table_setting.' . $view . '.' . $_mysqlTableKey, null)) === null) { $easy[$_mysqlTableKey] - = $this->mysqlTableSetting[$view][$_mysqlTableKey]; - } - else - { - $easy[$_mysqlTableKey] - = $this->mysqlTableKeys[$_mysqlTableKey]['default']; + = CFactory::_('Config')->mysql_table_keys[$_mysqlTableKey]['default']; } } // add a little fix for the row_format @@ -10412,11 +10392,8 @@ class Interpretation extends Fields . $easy['row_format'] . ";"; // check if this is a new table that should be added via update SQL - if (isset($this->addSQL['adminview']) - && ArrayHelper::check( - $this->addSQL['adminview'] - ) - && in_array($view, $this->addSQL['adminview'])) + if (CFactory::_('Registry')-> + get('builder.add_sql.adminview.' . $view, null)) { // build the update array $this->updateSQLBuilder["CREATETABLEIFNOTEXISTS`#__" @@ -10425,8 +10402,8 @@ class Interpretation extends Fields } // check if the table row_format has changed if (StringHelper::check($easy['row_format']) - && isset($this->updateSQL['table_row_format']) - && isset($this->updateSQL['table_row_format'][$view])) + && CFactory::_('Registry')-> + get('builder.update_sql.table_row_format.' . $view, null)) { // build the update array $this->updateSQLBuilder["ALTERTABLE`#__" . $component . "_" @@ -10435,8 +10412,8 @@ class Interpretation extends Fields . $easy['row_format'] . ";"; } // check if the table engine has changed - if (isset($this->updateSQL['table_engine']) - && isset($this->updateSQL['table_engine'][$view])) + if (CFactory::_('Registry')-> + get('builder.update_sql.table_engine.' . $view, null)) { // build the update array $this->updateSQLBuilder["ALTERTABLE`#__" . $component . "_" @@ -10445,10 +10422,10 @@ class Interpretation extends Fields . "` ENGINE = " . $easy['engine'] . ";"; } // check if the table charset OR collation has changed (must be updated together) - if ((isset($this->updateSQL['table_charset']) - && isset($this->updateSQL['table_charset'][$view])) - || (isset($this->updateSQL['table_collate']) - && isset($this->updateSQL['table_collate'][$view]))) + if (CFactory::_('Registry')-> + get('builder.update_sql.table_charset.' . $view, null) + || CFactory::_('Registry')-> + get('builder.update_sql.table_collate.' . $view, null)) { // build the update array $this->updateSQLBuilder["ALTERTABLE`#__" . $component . "_" @@ -10541,7 +10518,7 @@ class Interpretation extends Fields // also check if the developer will allow this // the config length must be checked before this // only add this option if set to SQL fix - if (CFactory::_('Config')->add_assets_table_fix && $this->addAssetsTableNameFix) + if (CFactory::_('Config')->add_assets_table_fix && CFactory::_('Config')->add_assets_table_name_fix) { $db .= PHP_EOL; $db .= PHP_EOL . '--'; @@ -10608,7 +10585,7 @@ class Interpretation extends Fields // check if this component used larger names // now revert them back on uninstall // only add this option if set to SQL fix - if (CFactory::_('Config')->add_assets_table_fix == 1 && $this->addAssetsTableNameFix) + if (CFactory::_('Config')->add_assets_table_fix == 1 && CFactory::_('Config')->add_assets_table_name_fix) { // https://github.com/joomla/joomla-cms/blob/3.10.0-alpha3/installation/sql/mysql/joomla.sql#L20 // Checked 1st December 2020 (let us know if this changes) @@ -10633,10 +10610,11 @@ class Interpretation extends Fields $componentName = JFilterOutput::cleanText($this->componentData->name); // for plugin event TODO change event api signatures $langContent = CFactory::_('Language')->getTarget('admin'); + $component_context = CFactory::_('Config')->component_context; // Trigger Event: jcb_ce_onBeforeBuildAdminLang CFactory::_('Event')->trigger( 'jcb_ce_onBeforeBuildAdminLang', - array(&$this->componentContext, &$langContent, + array(&$component_context, &$langContent, &$this->langPrefix, &$componentName) ); // for plugin event TODO change event api signatures @@ -10739,7 +10717,7 @@ class Interpretation extends Fields ); } // add the langug files needed to import and export data - if ($this->addEximport) + if (CFactory::_('Config')->get('add_eximport', false)) { CFactory::_('Language')->set( 'admin', CFactory::_('Config')->lang_prefix . '_EXPORT_FAILED', "Export Failed" @@ -10901,7 +10879,7 @@ class Interpretation extends Fields // Trigger Event: jcb_ce_onAfterBuildAdminLang CFactory::_('Event')->trigger( 'jcb_ce_onAfterBuildAdminLang', - array(&$this->componentContext, &$langContent, + array(&$component_context, &$langContent, &$this->langPrefix, &$componentName) ); // for plugin event TODO change event api signatures @@ -10926,10 +10904,11 @@ class Interpretation extends Fields $componentName = JFilterOutput::cleanText($this->componentData->name); // for plugin event TODO change event api signatures $langContent = CFactory::_('Language')->getTarget('site'); + $component_context = CFactory::_('Config')->component_context; // Trigger Event: jcb_ce_onBeforeBuildSiteLang CFactory::_('Event')->trigger( 'jcb_ce_onBeforeBuildSiteLang', - array(&$this->componentContext, &$langContent, + array(&$component_context, &$langContent, &$this->langPrefix, &$componentName) ); // for plugin event TODO change event api signatures @@ -11000,7 +10979,7 @@ class Interpretation extends Fields // Trigger Event: jcb_ce_onAfterBuildSiteLang CFactory::_('Event')->trigger( 'jcb_ce_onAfterBuildSiteLang', - array(&$this->componentContext, &$langContent, + array(&$component_context, &$langContent, &$this->langPrefix, &$componentName) ); // for plugin event TODO change event api signatures @@ -11025,10 +11004,11 @@ class Interpretation extends Fields $componentName = JFilterOutput::cleanText($this->componentData->name); // for plugin event TODO change event api signatures $langContent = CFactory::_('Language')->getTarget('sitesys'); + $component_context = CFactory::_('Config')->component_context; // Trigger Event: jcb_ce_onBeforeBuildSiteSysLang CFactory::_('Event')->trigger( 'jcb_ce_onBeforeBuildSiteSysLang', - array(&$this->componentContext, &$langContent, + array(&$component_context, &$langContent, &$this->langPrefix, &$componentName) ); // for plugin event TODO change event api signatures @@ -11060,7 +11040,7 @@ class Interpretation extends Fields // Trigger Event: jcb_ce_onAfterBuildSiteSysLang CFactory::_('Event')->trigger( 'jcb_ce_onAfterBuildSiteSysLang', - array(&$this->componentContext, &$langContent, + array(&$component_context, &$langContent, &$this->langPrefix, &$componentName) ); // for plugin event TODO change event api signatures @@ -11085,10 +11065,11 @@ class Interpretation extends Fields $componentName = JFilterOutput::cleanText($this->componentData->name); // for plugin event TODO change event api signatures $langContent = CFactory::_('Language')->getTarget('adminsys'); + $component_context = CFactory::_('Config')->component_context; // Trigger Event: jcb_ce_onBeforeBuildAdminSysLang CFactory::_('Event')->trigger( 'jcb_ce_onBeforeBuildAdminSysLang', - array(&$this->componentContext, &$langContent, + array(&$component_context, &$langContent, &$this->langPrefix, &$componentName) ); // for plugin event TODO change event api signatures @@ -11109,7 +11090,7 @@ class Interpretation extends Fields // Trigger Event: jcb_ce_onAfterBuildAdminSysLang CFactory::_('Event')->trigger( 'jcb_ce_onAfterBuildAdminSysLang', - array(&$this->componentContext, &$langContent, + array(&$component_context, &$langContent, &$this->langPrefix, &$componentName) ); // for plugin event TODO change event api signatures @@ -11698,7 +11679,7 @@ class Interpretation extends Fields . ".access')): ?>"; $customAdminViewButton .= PHP_EOL . Indent::_(4) . 'get('COMPONENT') . '_' . $customLinkView['NAME'] . "'" @@ -11910,7 +11891,7 @@ class Interpretation extends Fields // return the authority to category return $user . "->authorise('core.edit', 'com_" - . $this->componentCodeName . "." . $otherView + . CFactory::_('Config')->component_code_name . "." . $otherView . ".category.' . (int)\$item->" . $item['code'] . ")"; } elseif ($item['type'] === 'user' && !$item['title']) @@ -11949,14 +11930,14 @@ class Interpretation extends Fields if (isset($item['custom']['id']) && $item['custom']['id'] !== 'id') { return $user . "->authorise('" . $coreLink['core.edit'] - . "', 'com_" . $this->componentCodeName . "." + . "', 'com_" . CFactory::_('Config')->component_code_name . "." . $item['custom']['view'] . ".' . (int) \$item->" . $item['id_code'] . "_id)"; } else { return $user . "->authorise('" . $coreLink['core.edit'] - . "', 'com_" . $this->componentCodeName . "." + . "', 'com_" . CFactory::_('Config')->component_code_name . "." . $item['custom']['view'] . ".' . (int) \$item->" . $item['id_code'] . ")"; } @@ -11966,14 +11947,14 @@ class Interpretation extends Fields { // return default for this external item return $user . "->authorise('core.edit', 'com_" - . $this->componentCodeName . "." . $item['custom']['view'] + . CFactory::_('Config')->component_code_name . "." . $item['custom']['view'] . ".' . (int) \$item->" . $item['id_code'] . "_id)"; } else { // return default for this external item return $user . "->authorise('core.edit', 'com_" - . $this->componentCodeName . "." . $item['custom']['view'] + . CFactory::_('Config')->component_code_name . "." . $item['custom']['view'] . ".' . (int) \$item->" . $item['id_code'] . ")"; } } @@ -12035,7 +12016,7 @@ class Interpretation extends Fields public function setDefaultViewsBody($nameSingleCode, $nameListCode) { // set component name - $component = $this->componentCodeName; + $component = CFactory::_('Config')->component_code_name; $Component = ucfirst((string) $component); $COMPONENT = strtoupper((string) $component); // set uppercase view @@ -12043,8 +12024,8 @@ class Interpretation extends Fields // build the body $body = array(); // check if the filter type is sidebar (1 = sidebar) - if (isset($this->adminFilterType[$nameListCode]) - && $this->adminFilterType[$nameListCode] == 1) + if (CFactory::_('Registry')-> + get('builder.admin_filter_type.' . $nameListCode, 1) == 1) { $body[] = ""; - $fadein[] = "
componentCodeName + $fadein[] = "
component_code_name . "_loader\" style=\"display: none;\">"; return implode(PHP_EOL, $fadein); } - return "
componentCodeName . "_loader\">"; + return "
component_code_name . "_loader\">"; } /** @@ -13502,7 +13479,7 @@ class Interpretation extends Fields protected function setLayoutOverride($nameSingleCode, $layoutName, $items) { if (($data = $this->getLayoutOverride($nameSingleCode, $layoutName)) - !== false) + !== null) { // first build the layout file $target = array('admin' => $nameSingleCode); @@ -13522,7 +13499,7 @@ class Interpretation extends Fields $placeholder = CFactory::_('Placeholder')->active; $placeholder[Placefix::_h('LAYOUTITEMS')] = $items; // OVERRIDE_LAYOUT_CODE <<>> - $php_view = (array) explode(PHP_EOL, (string) $data['php_view']); + $php_view = (array) explode(PHP_EOL, (string) $data->php_view); if (ArrayHelper::check($php_view)) { $php_view = PHP_EOL . PHP_EOL . implode(PHP_EOL, $php_view); @@ -13539,7 +13516,7 @@ class Interpretation extends Fields // OVERRIDE_LAYOUT_BODY <<>> CFactory::_('Content')->set_($nameSingleCode . '_' . $layoutName, 'OVERRIDE_LAYOUT_BODY', PHP_EOL . CFactory::_('Placeholder')->update( - $data['html'], $placeholder + $data->html, $placeholder ) ); // OVERRIDE_LAYOUT_HEADER <<>> @@ -13565,65 +13542,22 @@ class Interpretation extends Fields */ protected function getLayoutOverride($nameSingleCode, $layoutName) { + $get_key = null; // check if there is an override by component name, view name, & layout name if ($this->setTemplateAndLayoutData( 'override', $nameSingleCode, false, array(''), - array($this->componentCodeName . $nameSingleCode . $layoutName) + array(CFactory::_('Config')->component_code_name . $nameSingleCode . $layoutName) )) { - $data = $this->layoutData[CFactory::_('Config')->build_target][$this->componentCodeName - . $nameSingleCode . $layoutName]; - // remove since we will add the layout now - if (CFactory::_('Config')->lang_target === 'both') - { - unset( - $this->layoutData['admin'][$this->componentCodeName - . $nameSingleCode . $layoutName] - ); - unset( - $this->layoutData['site'][$this->componentCodeName - . $nameSingleCode . $layoutName] - ); - } - else - { - unset( - $this->layoutData[CFactory::_('Config')->build_target][$this->componentCodeName - . $nameSingleCode . $layoutName] - ); - } - - return $data; + $get_key = CFactory::_('Config')->component_code_name . $nameSingleCode . $layoutName; } // check if there is an override by component name & layout name elseif ($this->setTemplateAndLayoutData( 'override', $nameSingleCode, false, array(''), - array($this->componentCodeName . $layoutName) + array(CFactory::_('Config')->component_code_name . $layoutName) )) { - $data = $this->layoutData[CFactory::_('Config')->build_target][$this->componentCodeName - . $layoutName]; - // remove since we will add the layout now - if (CFactory::_('Config')->lang_target === 'both') - { - unset( - $this->layoutData['admin'][$this->componentCodeName - . $layoutName] - ); - unset( - $this->layoutData['site'][$this->componentCodeName - . $layoutName] - ); - } - else - { - unset( - $this->layoutData[CFactory::_('Config')->build_target][$this->componentCodeName - . $layoutName] - ); - } - - return $data; + $get_key = CFactory::_('Config')->component_code_name . $layoutName; } // check if there is an override by view & layout name elseif ($this->setTemplateAndLayoutData( @@ -13631,22 +13565,7 @@ class Interpretation extends Fields array($nameSingleCode . $layoutName) )) { - $data = $this->layoutData[CFactory::_('Config')->build_target][$nameSingleCode - . $layoutName]; - // remove since we will add the layout now - if (CFactory::_('Config')->lang_target === 'both') - { - unset( - $this->layoutData['admin'][$nameSingleCode . $layoutName] - ); - unset($this->layoutData['site'][$nameSingleCode . $layoutName]); - } - else - { - unset($this->layoutData[CFactory::_('Config')->build_target][$layoutName]); - } - - return $data; + $get_key = $nameSingleCode . $layoutName; } // check if there is an override by layout name (global layout) elseif ($this->setTemplateAndLayoutData( @@ -13654,22 +13573,34 @@ class Interpretation extends Fields array($layoutName) )) { - $data = $this->layoutData[CFactory::_('Config')->build_target][$layoutName]; + $get_key = $layoutName; + } + + // check if we have a get key + if ($get_key) + { + $data = CFactory::_('Registry')-> + extract('builder.layout_data.' . CFactory::_('Config')->build_target . '.' . $get_key); + // remove since we will add the layout now if (CFactory::_('Config')->lang_target === 'both') { - unset($this->layoutData['admin'][$layoutName]); - unset($this->layoutData['site'][$layoutName]); + CFactory::_('Registry')-> + remove('builder.layout_data.admin.' . $get_key); + CFactory::_('Registry')-> + remove('builder.layout_data.site.' . $get_key); } else { - unset($this->layoutData[CFactory::_('Config')->build_target][$layoutName]); + CFactory::_('Registry')-> + remove('builder.layout_data.' . + CFactory::_('Config')->build_target . '.' . $get_key); } return $data; } - return false; + return null; } /** @@ -13717,14 +13648,14 @@ class Interpretation extends Fields $headerscript = '//' . Line::_(__Line__, __Class__) . ' set the edit URL'; $headerscript .= PHP_EOL . '$edit = "index.php?option=com_' - . $this->componentCodeName . '&view=' . $name_list_code + . CFactory::_('Config')->component_code_name . '&view=' . $name_list_code . '&task=' . $name_single_code . '.edit";'; $headerscript .= PHP_EOL . '//' . Line::_(__Line__, __Class__) . ' set a return value'; $headerscript .= PHP_EOL . '$return = ($id) ? "index.php?option=com_' - . $this->componentCodeName . '&view=' . $nameSingleCode + . CFactory::_('Config')->component_code_name . '&view=' . $nameSingleCode . '&layout=edit&id=" . $id : "";'; $headerscript .= PHP_EOL . '//' . Line::_(__Line__, __Class__) . ' check for a return value'; @@ -13761,7 +13692,7 @@ class Interpretation extends Fields $headerscript .= PHP_EOL . '//' . Line::_(__Line__, __Class__) . ' set the create new URL'; $headerscript .= PHP_EOL . '$new = "index.php?option=com_' - . $this->componentCodeName . '&view=' . $name_list_code + . CFactory::_('Config')->component_code_name . '&view=' . $name_list_code . '&task=' . $name_single_code . '.edit" . $ref;'; } @@ -13772,7 +13703,7 @@ class Interpretation extends Fields . ' set the create new and close URL'; $headerscript .= PHP_EOL . '$close_new = "index.php?option=com_' - . $this->componentCodeName . '&view=' . $name_list_code + . CFactory::_('Config')->component_code_name . '&view=' . $name_list_code . '&task=' . $name_single_code . '.edit";'; } @@ -13878,15 +13809,15 @@ class Interpretation extends Fields */ public function setFootableScripts($init = true) { - if (!isset($this->footableVersion) - || 2 == $this->footableVersion) // loading version 2 + $footable_version = CFactory::_('Config')->get('footable_version', 2); + if (2 == $footable_version) // loading version 2 { $foo = PHP_EOL . PHP_EOL . Indent::_(2) . "//" . Line::_( __LINE__,__CLASS__ ) . " Add the CSS for Footable."; $foo .= PHP_EOL . Indent::_(2) . "JHtml::_('stylesheet', 'media/com_" - . $this->componentCodeName + . CFactory::_('Config')->component_code_name . "/footable-v2/css/footable.core.min.css', ['version' => 'auto']);"; $foo .= PHP_EOL . PHP_EOL . Indent::_(2) . "//" . Line::_( __LINE__,__CLASS__ @@ -13896,7 +13827,7 @@ class Interpretation extends Fields $foo .= PHP_EOL . Indent::_(2) . "{"; $foo .= PHP_EOL . Indent::_(3) . "JHtml::_('stylesheet', 'media/com_" - . $this->componentCodeName + . CFactory::_('Config')->component_code_name . "/footable-v2/css/footable.metro.min.css', ['version' => 'auto']);"; $foo .= PHP_EOL . Indent::_(2) . "}"; $foo .= PHP_EOL . Indent::_(2) . "//" . Line::_(__Line__, __Class__) @@ -13906,7 +13837,7 @@ class Interpretation extends Fields $foo .= PHP_EOL . Indent::_(2) . "{"; $foo .= PHP_EOL . Indent::_(3) . "JHtml::_('stylesheet', 'media/com_" - . $this->componentCodeName + . CFactory::_('Config')->component_code_name . "/footable-v2/css/footable.standalone.min.css', ['version' => 'auto']);"; $foo .= PHP_EOL . Indent::_(2) . "}"; $foo .= PHP_EOL . PHP_EOL . Indent::_(2) . "//" . Line::_( @@ -13914,18 +13845,18 @@ class Interpretation extends Fields ) . " Add the JavaScript for Footable"; $foo .= PHP_EOL . Indent::_(2) . "JHtml::_('script', 'media/com_" - . $this->componentCodeName . "/footable-v2/js/footable.js', ['version' => 'auto']);"; + . CFactory::_('Config')->component_code_name . "/footable-v2/js/footable.js', ['version' => 'auto']);"; $foo .= PHP_EOL . Indent::_(2) . "JHtml::_('script', 'media/com_" - . $this->componentCodeName + . CFactory::_('Config')->component_code_name . "/footable-v2/js/footable.sort.js', ['version' => 'auto']);"; $foo .= PHP_EOL . Indent::_(2) . "JHtml::_('script', 'media/com_" - . $this->componentCodeName + . CFactory::_('Config')->component_code_name . "/footable-v2/js/footable.filter.js', ['version' => 'auto']);"; $foo .= PHP_EOL . Indent::_(2) . "JHtml::_('script', 'media/com_" - . $this->componentCodeName + . CFactory::_('Config')->component_code_name . "/footable-v2/js/footable.paginate.js', ['version' => 'auto']);"; if ($init) { @@ -13941,7 +13872,7 @@ class Interpretation extends Fields . PHP_EOL; } } - elseif (3 == $this->footableVersion) // loading version 3 + elseif (3 == $footable_version) // loading version 3 { $foo = PHP_EOL . PHP_EOL . Indent::_(2) . "//" . Line::_( @@ -13951,13 +13882,13 @@ class Interpretation extends Fields . "\$this->document->addStyleSheet('https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css');"; $foo .= PHP_EOL . Indent::_(2) . "JHtml::_('stylesheet', 'media/com_" - . $this->componentCodeName + . CFactory::_('Config')->component_code_name . "/footable-v3/css/footable.standalone.min.css', ['version' => 'auto']);"; $foo .= PHP_EOL . Indent::_(2) . "//" . Line::_(__Line__, __Class__) . " Add the JavaScript for Footable (adding all functions)"; $foo .= PHP_EOL . Indent::_(2) . "JHtml::_('script', 'media/com_" - . $this->componentCodeName + . CFactory::_('Config')->component_code_name . "/footable-v3/js/footable.min.js', ['version' => 'auto']);"; if ($init) { @@ -13990,6 +13921,7 @@ class Interpretation extends Fields { // component helper name $Helper = CFactory::_('Content')->get('Component') . 'Helper'; + $footable_version = CFactory::_('Config')->get('footable_version', 2); // make sure the custom links are only added once $firstTimeBeingAdded = true; // setup correct core target @@ -14056,7 +13988,7 @@ class Interpretation extends Fields $counter++; } } - $data_value = (3 == $this->footableVersion) ? 'data-sort-value' + $data_value = (3 == $footable_version) ? 'data-sort-value' : 'data-value'; // add the defaults @@ -14134,7 +14066,7 @@ class Interpretation extends Fields $body .= PHP_EOL . Indent::_(1) . ""; $body .= PHP_EOL . ""; $body .= PHP_EOL . ""; - if (2 == $this->footableVersion) + if (2 == $footable_version) { $body .= PHP_EOL . ''; $body .= PHP_EOL . Indent::_(1) . ''; @@ -14181,6 +14113,7 @@ class Interpretation extends Fields // component helper name $Helper = CFactory::_('Content')->get('Component') . 'Helper'; $head = ''; + $footable_version = CFactory::_('Config')->get('footable_version', 2); // only add new button if set if ($addNewButon > 0) { @@ -14250,17 +14183,17 @@ class Interpretation extends Fields } $head .= ''; // set the style for V2 - $metro_blue = (2 == $this->footableVersion) ? ' metro-blue' : ''; + $metro_blue = (2 == $footable_version) ? ' metro-blue' : ''; // set the toggle for V3 - $toggle = (3 == $this->footableVersion) + $toggle = (3 == $footable_version) ? ' data-show-toggle="true" data-toggle-column="first"' : ''; // set paging - $paging = (2 == $this->footableVersion) + $paging = (2 == $footable_version) ? ' data-page-size="20" data-filter="#filter_' . $nameListCode . '"' : ' data-sorting="true" data-paging="true" data-paging-size="20" data-filtering="true"'; // add html fix for V3 - $htmlFix = (3 == $this->footableVersion) + $htmlFix = (3 == $footable_version) ? ' data-type="html" data-sort-use="text"' : ''; $head .= PHP_EOL . ''; @@ -14294,24 +14227,24 @@ class Interpretation extends Fields { $item['lang'] = $list_head_override; } - $setin = (2 == $this->footableVersion) + $setin = (2 == $footable_version) ? ' data-hide="phone"' : ' data-breakpoints="xs sm"'; if ($controller > 3) { - $setin = (2 == $this->footableVersion) + $setin = (2 == $footable_version) ? ' data-hide="phone,tablet"' : ' data-breakpoints="xs sm md"'; } if ($controller > 6) { - $setin = (2 == $this->footableVersion) + $setin = (2 == $footable_version) ? ' data-hide="all"' : ' data-breakpoints="all"'; } if ($item['link'] && $firstLink) { - $setin = (2 == $this->footableVersion) + $setin = (2 == $footable_version) ? ' data-toggle="true"' : ''; $firstLink = false; } @@ -14324,7 +14257,7 @@ class Interpretation extends Fields } } // set some V3 attr - $data_hide = (2 == $this->footableVersion) + $data_hide = (2 == $footable_version) ? 'data-hide="phone,tablet"' : 'data-breakpoints="xs sm md"'; // add the defaults if (!isset($this->fieldsNames[$nameSingleCode]['published'])) @@ -14339,7 +14272,7 @@ class Interpretation extends Fields // add the defaults if (!isset($this->fieldsNames[$nameSingleCode]['id'])) { - $data_type = (2 == $this->footableVersion) + $data_type = (2 == $footable_version) ? 'data-type="numeric"' : 'data-type="number"'; $head .= PHP_EOL . Indent::_(2) . '
componentCodeName . "_" + ) . " From the " . CFactory::_('Config')->component_code_name . "_" . $nameSingleCode . " table"; $query .= PHP_EOL . Indent::_(2) . "\$query->from(\$db->quoteName('#__" - . $this->componentCodeName . "_" . $nameSingleCode . "', 'a'));"; + . CFactory::_('Config')->component_code_name . "_" . $nameSingleCode . "', 'a'));"; // add the category if ($addCategory) { @@ -14574,7 +14507,7 @@ class Interpretation extends Fields . " Implement View Level Access"; $query .= PHP_EOL . Indent::_(2) . "if (!\$user->authorise('core.options', 'com_" - . $this->componentCodeName . "'))"; + . CFactory::_('Config')->component_code_name . "'))"; $query .= PHP_EOL . Indent::_(2) . "{"; $query .= PHP_EOL . Indent::_(3) . "\$groups = implode(',', \$user->getAuthorisedViewLevels());"; @@ -14961,7 +14894,7 @@ class Interpretation extends Fields $method[] = Indent::_(2) . "\$user = JFactory::getUser();"; $method[] = Indent::_(2) . "if (\$user->authorise('" . $custom_button['link'] . ".access', 'com_" - . $this->componentCodeName . "'))"; + . CFactory::_('Config')->component_code_name . "'))"; $method[] = Indent::_(2) . "{"; $method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__) . " Get the input"; @@ -14978,7 +14911,7 @@ class Interpretation extends Fields $method[] = Indent::_(3) . "\$ids = implode('_', \$pks);"; $method[] = Indent::_(3) . "\$this->setRedirect(JRoute::_('index.php?option=com_" - . $this->componentCodeName . "&view=" + . CFactory::_('Config')->component_code_name . "&view=" . $custom_button['link'] . "&cid='.\$ids, false));"; $method[] = Indent::_(3) . "return;"; $method[] = Indent::_(2) . "}"; @@ -14989,7 +14922,7 @@ class Interpretation extends Fields . "_FAILED');"; $method[] = Indent::_(2) . "\$this->setRedirect(JRoute::_('index.php?option=com_" - . $this->componentCodeName . "&view=" . $nameListCode + . CFactory::_('Config')->component_code_name . "&view=" . $nameListCode . "', false), \$message, 'error');"; $method[] = Indent::_(2) . "return;"; $method[] = Indent::_(1) . "}"; @@ -15076,11 +15009,11 @@ class Interpretation extends Fields $query .= PHP_EOL . Indent::_(3) . "\$query->select('a.*');"; $query .= PHP_EOL . PHP_EOL . Indent::_(3) . "//" . Line::_( __LINE__,__CLASS__ - ) . " From the " . $this->componentCodeName . "_" + ) . " From the " . CFactory::_('Config')->component_code_name . "_" . $nameSingleCode . " table"; $query .= PHP_EOL . Indent::_(3) . "\$query->from(\$db->quoteName('#__" - . $this->componentCodeName . "_" . $nameSingleCode + . CFactory::_('Config')->component_code_name . "_" . $nameSingleCode . "', 'a'));"; $query .= PHP_EOL . Indent::_(3) . "//" . Line::_(__Line__, __Class__) . " The bulk export path"; @@ -15129,7 +15062,7 @@ class Interpretation extends Fields ) . " Get global switch to activate text only export"; $query .= PHP_EOL . Indent::_(3) . "\$export_text_only = JComponentHelper::getParams('com_" - . $this->componentCodeName + . CFactory::_('Config')->component_code_name . "')->get('export_text_only', 0);"; // first check if we have custom queries $custom_query = $this->setCustomQuery( @@ -15162,7 +15095,7 @@ class Interpretation extends Fields ) . " Implement View Level Access"; $query .= PHP_EOL . Indent::_(3) . "if (!\$user->authorise('core.options', 'com_" - . $this->componentCodeName . "'))"; + . CFactory::_('Config')->component_code_name . "'))"; $query .= PHP_EOL . Indent::_(3) . "{"; $query .= PHP_EOL . Indent::_(4) . "\$groups = implode(',', \$user->getAuthorisedViewLevels());"; @@ -15301,9 +15234,9 @@ class Interpretation extends Fields $method[] = Indent::_(2) . "\$user = JFactory::getUser();"; $method[] = Indent::_(2) . "if (\$user->authorise('" . $nameSingleCode . ".export', 'com_" - . $this->componentCodeName + . CFactory::_('Config')->component_code_name . "') && \$user->authorise('core.export', 'com_" - . $this->componentCodeName . "'))"; + . CFactory::_('Config')->component_code_name . "'))"; $method[] = Indent::_(2) . "{"; $method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__) . " Get the input"; @@ -15344,7 +15277,7 @@ class Interpretation extends Fields . $this->langPrefix . "_EXPORT_FAILED');"; $method[] = Indent::_(2) . "\$this->setRedirect(JRoute::_('index.php?option=com_" - . $this->componentCodeName . "&view=" . $nameListCode + . CFactory::_('Config')->component_code_name . "&view=" . $nameListCode . "', false), \$message, 'error');"; $method[] = Indent::_(2) . "return;"; $method[] = Indent::_(1) . "}"; @@ -15362,9 +15295,9 @@ class Interpretation extends Fields $method[] = Indent::_(2) . "\$user = JFactory::getUser();"; $method[] = Indent::_(2) . "if (\$user->authorise('" . $nameSingleCode . ".import', 'com_" - . $this->componentCodeName + . CFactory::_('Config')->component_code_name . "') && \$user->authorise('core.import', 'com_" - . $this->componentCodeName . "'))"; + . CFactory::_('Config')->component_code_name . "'))"; $method[] = Indent::_(2) . "{"; $method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__) . " Get the import model"; @@ -15407,14 +15340,14 @@ class Interpretation extends Fields { $method[] = Indent::_(4) . "\$this->setRedirect(JRoute::_('index.php?option=com_" - . $this->componentCodeName . "&view=import_" + . CFactory::_('Config')->component_code_name . "&view=import_" . $nameListCode . "', false), \$message);"; } else { $method[] = Indent::_(4) . "\$this->setRedirect(JRoute::_('index.php?option=com_" - . $this->componentCodeName + . CFactory::_('Config')->component_code_name . "&view=import', false), \$message);"; } $method[] = Indent::_(4) . "return;"; @@ -15426,7 +15359,7 @@ class Interpretation extends Fields . $this->langPrefix . "_IMPORT_FAILED');"; $method[] = Indent::_(2) . "\$this->setRedirect(JRoute::_('index.php?option=com_" - . $this->componentCodeName . "&view=" . $nameListCode + . CFactory::_('Config')->component_code_name . "&view=" . $nameListCode . "', false), \$message, 'error');"; $method[] = Indent::_(2) . "return;"; $method[] = Indent::_(1) . "}"; @@ -15579,9 +15512,9 @@ class Interpretation extends Fields } $query .= PHP_EOL . PHP_EOL . Indent::_(2) . "//" . Line::_( __LINE__,__CLASS__ - ) . " From the " . $this->componentCodeName . "_item table"; + ) . " From the " . CFactory::_('Config')->component_code_name . "_item table"; $query .= PHP_EOL . Indent::_(2) . "\$query->from(\$db->quoteName('#__" - . $this->componentCodeName . "_" . $nameSingleCode . "', 'a'));"; + . CFactory::_('Config')->component_code_name . "_" . $nameSingleCode . "', 'a'));"; // add the category if ($addCategory) { @@ -15660,7 +15593,7 @@ class Interpretation extends Fields . " Implement View Level Access"; $query .= PHP_EOL . Indent::_(2) . "if (!\$user->authorise('core.options', 'com_" - . $this->componentCodeName . "'))"; + . CFactory::_('Config')->component_code_name . "'))"; $query .= PHP_EOL . Indent::_(2) . "{"; $query .= PHP_EOL . Indent::_(3) . "\$groups = implode(',', \$user->getAuthorisedViewLevels());"; @@ -15980,8 +15913,8 @@ class Interpretation extends Fields . ucwords((string) $filter['code']) . "."; // we only add multi filter option if new filter type // and we have multi filter set for this field (2 = topbar) - if (isset($this->adminFilterType[$nameListCode]) - && $this->adminFilterType[$nameListCode] == 2 + if (CFactory::_('Registry')-> + get('builder.admin_filter_type.' . $nameListCode, 1) == 2 && isset($filter['multi']) && $filter['multi'] == 2) { @@ -16667,7 +16600,7 @@ class Interpretation extends Fields Placefix::_h('VERSION') => $viewArray['settings']->version); $this->buildDynamique($_target, 'javascript_file', false, $_config); // set path - $_path = '/administrator/components/com_' . $this->componentCodeName + $_path = '/administrator/components/com_' . CFactory::_('Config')->component_code_name . '/assets/js/' . $nameListCode . '.js'; // load the file to the list view CFactory::_('Content')->set_($nameListCode, 'ADMIN_ADD_JAVASCRIPT_FILE', PHP_EOL . PHP_EOL . Indent::_(2) . "//" . Line::_( @@ -17834,14 +17767,14 @@ class Interpretation extends Fields { // set the function or file path (2 = topbar) $funtion_path = true; - if (isset($this->adminFilterType[$nameListCode]) - && $this->adminFilterType[$nameListCode] == 2) + if (CFactory::_('Registry')-> + get('builder.admin_filter_type.' . $nameListCode, 1) == 2) { $funtion_path = false; } $function = array(); // set component name - $component = $this->componentCodeName; + $component = CFactory::_('Config')->component_code_name; $Component = ucfirst((string) $component); foreach ($this->filterBuilder[$nameListCode] as $filter) { @@ -18284,8 +18217,8 @@ class Interpretation extends Fields // add the category filter stuff $this->setCategorySidebarFilterHelper($fieldFilters, $nameListCode); // check if filter fields are added (1 = sidebar) - if (isset($this->adminFilterType[$nameListCode]) - && $this->adminFilterType[$nameListCode] == 1 + if (CFactory::_('Registry')-> + get('builder.admin_filter_type.' . $nameListCode, 1) == 1 && isset($this->filterBuilder[$nameListCode]) && ArrayHelper::check( $this->filterBuilder[$nameListCode] @@ -18452,8 +18385,8 @@ class Interpretation extends Fields ) { // add the default filters if we are on the old filter paths (1 = sidebar) - if (isset($this->adminFilterType[$nameListCode]) - && $this->adminFilterType[$nameListCode] == 1) + if (CFactory::_('Registry')-> + get('builder.admin_filter_type.' . $nameListCode, 1) == 1) { // set batch $filter[] = PHP_EOL . Indent::_(2) @@ -18500,8 +18433,8 @@ class Interpretation extends Fields protected function setCategorySidebarFilterHelper(&$filter, &$nameListCode) { // add the category filter if we are on the old filter paths (1 = sidebar) - if (isset($this->adminFilterType[$nameListCode]) - && $this->adminFilterType[$nameListCode] == 1 + if (CFactory::_('Registry')-> + get('builder.admin_filter_type.' . $nameListCode, 1) == 1 && isset($this->categoryBuilder[$nameListCode]) && ArrayHelper::check( $this->categoryBuilder[$nameListCode] @@ -18550,8 +18483,8 @@ class Interpretation extends Fields { // check if we should add some help to get the values (2 = topbar) $get_values = false; - if (isset($this->adminFilterType[$nameListCode]) - && $this->adminFilterType[$nameListCode] == 2) + if (CFactory::_('Registry')-> + get('builder.admin_filter_type.' . $nameListCode, 1) == 2) { // since the old path is not used, we need to add those values here $get_values = true; @@ -18804,7 +18737,7 @@ class Interpretation extends Fields } else { - $component = $this->componentCodeName; + $component = CFactory::_('Config')->component_code_name; } // check if category has another name if (CFactory::_('Registry')->get('category.other.name.' . $nameListCode . '.view') @@ -18874,7 +18807,7 @@ class Interpretation extends Fields { $allow = array(); // set component name - $component = $this->componentCodeName; + $component = CFactory::_('Config')->component_code_name; // prepare custom permission script $customAllow = CFactory::_('Customcode.Dispenser')->get( 'php_allowadd', $nameSingleCode, '', null, true @@ -19029,7 +18962,7 @@ class Interpretation extends Fields { $allow = array(); // set component name - $component = $this->componentCodeName; + $component = CFactory::_('Config')->component_code_name; // prepare custom permission script $customAllow = CFactory::_('Customcode.Dispenser')->get( 'php_allowedit', $nameSingleCode, '', null, true @@ -19385,7 +19318,7 @@ class Interpretation extends Fields public function setJmodelAdminGetForm($nameSingleCode, $nameListCode) { // set component name - $component = $this->componentCodeName; + $component = CFactory::_('Config')->component_code_name; // allways load these $getForm = array(); $getForm[] = PHP_EOL . Indent::_(2) . "//" . Line::_(__Line__, __Class__) @@ -19977,7 +19910,7 @@ class Interpretation extends Fields { $allow = array(); // set component name - $component = $this->componentCodeName; + $component = CFactory::_('Config')->component_code_name; // prepare custom permission script $customAllow = CFactory::_('Customcode.Dispenser')->get( 'php_allowedit', $nameSingleCode, Indent::_(2) @@ -20035,7 +19968,7 @@ class Interpretation extends Fields { $allow = array(); // set component name - $component = $this->componentCodeName; + $component = CFactory::_('Config')->component_code_name; // setup correct core target $coreLoad = false; if (isset($this->permissionCore[$nameSingleCode])) @@ -20157,7 +20090,7 @@ class Interpretation extends Fields { $allow = array(); // set component name - $component = $this->componentCodeName; + $component = CFactory::_('Config')->component_code_name; // setup correct core target $coreLoad = false; if (isset($this->permissionCore[$nameSingleCode])) @@ -20323,7 +20256,7 @@ class Interpretation extends Fields { $allow = array(); // set component name - $component = $this->componentCodeName; + $component = CFactory::_('Config')->component_code_name; // setup correct core target $coreLoad = false; if (isset($this->permissionCore[$nameSingleCode])) @@ -20438,7 +20371,7 @@ class Interpretation extends Fields if ($view != 'component') { // set component name - $component = $this->componentCodeName; + $component = CFactory::_('Config')->component_code_name; // set label $label = 'Permissions in relation to this ' . $view; // set the access fieldset @@ -20611,7 +20544,7 @@ class Interpretation extends Fields public function setStoredId(&$nameSingleCode, &$nameListCode) { // set component name - $Component = ucwords((string) $this->componentCodeName); + $Component = ucwords((string) CFactory::_('Config')->component_code_name); // keep track of all fields already added $donelist = array('id' => true, 'search' => true, 'published' => true, 'access' => true, @@ -20636,8 +20569,8 @@ class Interpretation extends Fields && !isset($this->fieldsNames[$nameSingleCode]['access'])) { // the side bar option is single - if (isset($this->adminFilterType[$nameListCode]) - && $this->adminFilterType[$nameListCode] == 1) + if (CFactory::_('Registry')-> + get('builder.admin_filter_type.' . $nameListCode, 1) == 1) { $stored .= PHP_EOL . Indent::_(2) . "\$id .= ':' . \$this->getState('filter.access');"; @@ -20716,8 +20649,8 @@ class Interpretation extends Fields if ($filter['type'] === 'category') { // the side bar option is single (1 = sidebar) - if (isset($this->adminFilterType[$nameListCode]) - && $this->adminFilterType[$nameListCode] == 1) + if (CFactory::_('Registry')-> + get('builder.admin_filter_type.' . $nameListCode, 1) == 1) { $stored = PHP_EOL . Indent::_(2) . "\$id .= ':' . \$this->getState('filter.category');"; @@ -20748,8 +20681,8 @@ class Interpretation extends Fields { // check if this is the topbar filter, and multi option (2 = topbar) if (isset($filter['multi']) && $filter['multi'] == 2 - && isset($this->adminFilterType[$nameListCode]) - && $this->adminFilterType[$nameListCode] == 2) + && CFactory::_('Registry')-> + get('builder.admin_filter_type.' . $nameListCode, 1) == 2) { // top bar selection can result in // an array due to multi selection @@ -21063,7 +20996,7 @@ class Interpretation extends Fields $toolBar .= PHP_EOL . Indent::_(4) . "{"; $toolBar .= PHP_EOL . Indent::_(5) . "JToolbarHelper::versions('com_" - . $this->componentCodeName . "." . $nameSingleCode + . CFactory::_('Config')->component_code_name . "." . $nameSingleCode . "', \$this->item->id);"; $toolBar .= PHP_EOL . Indent::_(4) . "}"; } @@ -21083,7 +21016,7 @@ class Interpretation extends Fields $toolBar .= PHP_EOL . Indent::_(4) . "{"; $toolBar .= PHP_EOL . Indent::_(5) . "JToolbarHelper::versions('com_" - . $this->componentCodeName . "." . $nameSingleCode + . CFactory::_('Config')->component_code_name . "." . $nameSingleCode . "', \$this->item->id);"; $toolBar .= PHP_EOL . Indent::_(4) . "}"; } @@ -21151,8 +21084,8 @@ class Interpretation extends Fields $donelist = array(); // we must add the formSubmited code if new above filters is used (2 = topbar) $new_filter = false; - if (isset($this->adminFilterType[$nameListCode]) - && $this->adminFilterType[$nameListCode] == 2) + if (CFactory::_('Registry')-> + get('builder.admin_filter_type.' . $nameListCode, 1) == 2) { $state .= PHP_EOL . PHP_EOL . Indent::_(2) . "//" . Line::_(__Line__, __Class__) . " Check if the form was submitted"; @@ -21865,11 +21798,11 @@ class Interpretation extends Fields // check if this is a local table if (strpos( (string) $item['custom']['table'], - '#__' . $this->componentCodeName . '_' + '#__' . CFactory::_('Config')->component_code_name . '_' ) !== false) { $keyTableNAme = str_replace( - '#__' . $this->componentCodeName . '_', + '#__' . CFactory::_('Config')->component_code_name . '_', '', (string) $item['custom']['table'] ); } @@ -22259,11 +22192,9 @@ class Interpretation extends Fields case 'custom.admin.views.html': $headers[] = 'use Joomla\CMS\MVC\View\HtmlView;'; // load the file class if uikit is being loaded - if ((2 == $this->uikit || 1 == $this->uikit) - && isset($this->uikitComp[$codeName]) - && ArrayHelper::check( - $this->uikitComp[$codeName] - )) + if ((2 == CFactory::_('Config')->uikit || 1 == CFactory::_('Config')->uikit) + && CFactory::_('Registry')-> + exists('builder.uikit_comp.' . $codeName)) { $headers[] = 'use Joomla\CMS\Filesystem\File;'; } @@ -22288,10 +22219,12 @@ class Interpretation extends Fields $headers[] = 'use Joomla\Utilities\ArrayHelper;'; break; } + // for plugin event TODO change event api signatures + $component_context = CFactory::_('Config')->component_context; // Trigger Event: jcb_ce_setClassHeader CFactory::_('Event')->trigger( 'jcb_ce_setClassHeader', - array(&$this->componentContext, &$context, &$codeName, + array(&$component_context, &$context, &$codeName, &$headers) ); // check if headers were added @@ -22315,7 +22248,7 @@ class Interpretation extends Fields protected function setHelperClassHeader(&$headers, $target_client) { // add only to admin client - if ('admin' === $target_client && $this->addEximport) + if ('admin' === $target_client && CFactory::_('Config')->get('add_eximport', false)) { $headers[] = 'use PhpOffice\PhpSpreadsheet\IOFactory;'; $headers[] = 'use PhpOffice\PhpSpreadsheet\Spreadsheet;'; @@ -22335,8 +22268,8 @@ class Interpretation extends Fields protected function setChosenMultiSelectionHeaders(&$headers, $nameListCode) { // check that the filter type is the new filter option (2 = topbar) - if (isset($this->adminFilterType[$nameListCode]) - && $this->adminFilterType[$nameListCode] == 2) + if (CFactory::_('Registry')-> + get('builder.admin_filter_type.' . $nameListCode, 1) == 2) { // add category switch $add_category = false; @@ -23049,17 +22982,17 @@ class Interpretation extends Fields . ""; $slidecounter++; // build the template file - $target = array('custom_admin' => $this->componentCodeName); + $target = array('custom_admin' => CFactory::_('Config')->component_code_name); $this->buildDynamique($target, 'template', $tempName); // set the file data $TARGET = StringHelper::safe( CFactory::_('Config')->build_target, 'U' ); // SITE_TEMPLATE_BODY <<>> - CFactory::_('Content')->set_($this->componentCodeName . '_' . $tempName, + CFactory::_('Content')->set_(CFactory::_('Config')->component_code_name . '_' . $tempName, 'CUSTOM_ADMIN_TEMPLATE_BODY', PHP_EOL . $html); // SITE_TEMPLATE_CODE_BODY <<>> - CFactory::_('Content')->set_($this->componentCodeName . '_' . $tempName, + CFactory::_('Content')->set_(CFactory::_('Config')->component_code_name . '_' . $tempName, 'CUSTOM_ADMIN_TEMPLATE_CODE_BODY', ''); } $display[] = $tab . Indent::_(1) @@ -23284,7 +23217,7 @@ class Interpretation extends Fields // main lang prefix $lang = $this->langPrefix . '_SUBMENU'; // set the code name - $codeName = $this->componentCodeName; + $codeName = CFactory::_('Config')->component_code_name; // set default dashboard if (!StringHelper::check($this->dynamicDashboard)) { @@ -23683,7 +23616,7 @@ class Interpretation extends Fields // main lang prefix $lang = $this->langPrefix . '_MENU'; // set the code name - $codeName = $this->componentCodeName; + $codeName = CFactory::_('Config')->component_code_name; // default prefix is none $prefix = ''; // check if local is set @@ -23950,6 +23883,8 @@ class Interpretation extends Fields { // main lang prefix $lang = $this->langPrefix . '_CONFIG'; + // for plugin event TODO change event api signatures + $component_context = CFactory::_('Config')->component_context; if (1 == $timer) // this is before the admin views are build { // start loading Global params @@ -23968,13 +23903,13 @@ class Interpretation extends Fields )) { // set component code name - $component = $this->componentCodeName; + $component = CFactory::_('Config')->component_code_name; $nameSingleCode = 'config'; $nameListCode = 'configs'; // set place holders $placeholders = array(); $placeholders[Placefix::_h('component')] - = $this->componentCodeName; + = CFactory::_('Config')->component_code_name; $placeholders[Placefix::_h('Component')] = StringHelper::safe( $this->componentData->name_code, 'F' @@ -23988,7 +23923,7 @@ class Interpretation extends Fields $placeholders[Placefix::_h('views')] = $nameListCode; $placeholders[Placefix::_('component')] - = $this->componentCodeName; + = CFactory::_('Config')->component_code_name; $placeholders[Placefix::_('Component')] = $placeholders[Placefix::_h('Component')]; $placeholders[Placefix::_('COMPONENT')] @@ -24009,7 +23944,7 @@ class Interpretation extends Fields // Trigger Event: jcb_ce_onBeforeSetConfigFieldsets CFactory::_('Event')->trigger( 'jcb_ce_onBeforeSetConfigFieldsets', - array(&$this->componentContext, &$timer, + array(&$component_context, &$timer, &$this->configFieldSets, &$this->configFieldSetsCustomField, &$this->componentData->config, @@ -24088,7 +24023,7 @@ class Interpretation extends Fields // Trigger Event: jcb_ce_onBeforeSetConfigFieldsets CFactory::_('Event')->trigger( 'jcb_ce_onBeforeSetConfigFieldsets', - array(&$this->componentContext, &$timer, + array(&$component_context, &$timer, &$this->configFieldSets, &$this->configFieldSetsCustomField, &$this->componentData->config, &$this->extensionsParams, @@ -24109,7 +24044,7 @@ class Interpretation extends Fields // Trigger Event: jcb_ce_onAfterSetConfigFieldsets CFactory::_('Event')->trigger( 'jcb_ce_onAfterSetConfigFieldsets', - array(&$this->componentContext, &$timer, &$this->configFieldSets, + array(&$component_context, &$timer, &$this->configFieldSets, &$this->configFieldSetsCustomField, &$this->extensionsParams, &$this->frontEndParams, &$placeholders) ); @@ -24377,7 +24312,7 @@ class Interpretation extends Fields public function setGlobalConfigFieldsets($lang, $autorName, $autorEmail) { // set component name - $component = $this->componentCodeName; + $component = CFactory::_('Config')->component_code_name; // start building field set for config $this->configFieldSets[] = 'extensionsParams[] = '"check_in":"-1 day"'; } // set history control - if ($this->setTagHistory) + if (CFactory::_('Config')->get('set_tag_history', false)) { $this->configFieldSets[] = Indent::_(2) . "configFieldSets[] = Indent::_(3) . 'name="save_history"'; @@ -24555,7 +24490,7 @@ class Interpretation extends Fields ); // set if contributors were added $langCont = $lang . '_CONTRIBUTOR'; - if (isset($this->addContributors) && $this->addContributors + if (CFactory::_('Config')->get('add_contributors', false) && isset($this->componentData->contributors) && ArrayHelper::check( $this->componentData->contributors @@ -24805,7 +24740,7 @@ class Interpretation extends Fields ); } } - if ($this->addContributors + if (CFactory::_('Config')->get('add_contributors', false) || $this->componentData->emptycontributors == 1) { // setup lang @@ -24875,7 +24810,7 @@ class Interpretation extends Fields public function setUikitConfigFieldsets($lang) { - if ($this->uikit > 0) + if (CFactory::_('Config')->uikit > 0) { // main lang prefix $lang = $lang . ''; @@ -24887,7 +24822,7 @@ class Interpretation extends Fields $this->configFieldSets[] = Indent::_(2) . 'description="' . $lang . '_UIKIT_DESC">'; // set tab lang - if (1 == $this->uikit) + if (1 == CFactory::_('Config')->uikit) { CFactory::_('Language')->set( CFactory::_('Config')->lang_target, $lang . '_UIKIT_LABEL', "Uikit2 Settings" @@ -24897,7 +24832,7 @@ class Interpretation extends Fields for developing fast and powerful web interfaces. For more info visit https://getuikit.com/v2/" ); } - elseif (2 == $this->uikit) + elseif (2 == CFactory::_('Config')->uikit) { CFactory::_('Language')->set( CFactory::_('Config')->lang_target, $lang . '_UIKIT_LABEL', @@ -24908,7 +24843,7 @@ for developing fast and powerful web interfaces. For more info visit version 2 or version 3" ); } - elseif (3 == $this->uikit) + elseif (3 == CFactory::_('Config')->uikit) { CFactory::_('Language')->set( CFactory::_('Config')->lang_target, $lang . '_UIKIT_LABEL', "Uikit3 Settings" @@ -24920,7 +24855,7 @@ for developing fast and powerful web interfaces. For more info visit uikit) + if (2 == CFactory::_('Config')->uikit) { // set field lang CFactory::_('Language')->set( @@ -24995,7 +24930,7 @@ for developing fast and powerful web interfaces. For more info visit configFieldSets[] = Indent::_(3) . '"'; - if (2 == $this->uikit || 1 == $this->uikit) + if (2 == CFactory::_('Config')->uikit || 1 == CFactory::_('Config')->uikit) { $this->configFieldSets[] = Indent::_(3) . 'extensionsParams[] = '"uikit_min":""'; - if (2 == $this->uikit || 1 == $this->uikit) + if (2 == CFactory::_('Config')->uikit || 1 == CFactory::_('Config')->uikit) { // set field lang CFactory::_('Language')->set( @@ -25068,7 +25003,7 @@ for developing fast and powerful web interfaces. For more info visit configFieldSets[] = Indent::_(3) . 'class="btn-group btn-group-yesno"'; - if (2 == $this->uikit) + if (2 == CFactory::_('Config')->uikit) { $this->configFieldSets[] = Indent::_(3) . 'showon="uikit_version:2"'; @@ -25926,7 +25861,7 @@ function vdm_dkim() { public function setGooglechartConfigFieldsets($lang) { - if ($this->googlechart) + if (CFactory::_('Config')->get('google_chart', false)) { $this->configFieldSets[] = PHP_EOL . Indent::_(1) . "configFieldSets[] = Indent::_(2) @@ -26845,10 +26780,15 @@ function vdm_dkim() { $this->componentGlobal = array(); $this->permissionViews = array(); + // Get the default fields + $default_fields = CFactory::_('Config')->default_fields; + + // for plugin event TODO change event api signatures + $component_context = CFactory::_('Config')->component_context; // Trigger Event: jcb_ce_onBeforeBuildAccessSections CFactory::_('Event')->trigger( 'jcb_ce_onBeforeBuildAccessSections', - array(&$this->componentContext, &$this) + array(&$component_context, &$this) ); $this->componentHead[] = '
'; @@ -26859,7 +26799,7 @@ function vdm_dkim() { . ''; $this->componentHead[] = Indent::_(2) . ''; - if ($this->addEximport) + if (CFactory::_('Config')->get('add_eximport', false)) { $exportTitle = $this->langPrefix . '_' . StringHelper::safe('Export Data', 'U'); @@ -26931,7 +26871,7 @@ function vdm_dkim() { $this->componentHead[] = Indent::_(2) . ''; // set the Joomla fields - if ($this->setJoomlaFields) + if (CFactory::_('Config')->get('set_joomla_fields', false)) { $this->componentHead[] = Indent::_(2) . ' '; @@ -27124,12 +27064,10 @@ function vdm_dkim() { $view['settings']->name_list ); // add custom tab permissions if found - if (isset($this->customTabs[$nameView]) - && ArrayHelper::check( - $this->customTabs[$nameView] - )) + if (($tabs_ = CFactory::_('Registry')->get('builder.custom_tabs.' . $nameView, null)) !== null + && ArrayHelper::check($tabs_)) { - foreach ($this->customTabs[$nameView] as $_customTab) + foreach ($tabs_ as $_customTab) { if (isset($_customTab['permission']) && $_customTab['permission'] == 1) @@ -27245,9 +27183,9 @@ function vdm_dkim() { $view['settings']->permissions[] = $fieldView; } - // insure that no default field get loaded + // ensure that no default field get loaded if (!in_array( - $fieldName, $this->defaultFields + $fieldName, $default_fields )) { // make sure the array is set @@ -27285,7 +27223,7 @@ function vdm_dkim() { // Trigger Event: jcb_ce_onAfterBuildAccessSections CFactory::_('Event')->trigger( 'jcb_ce_onAfterBuildAccessSections', - array(&$this->componentContext, &$this) + array(&$component_context, &$this) ); // set the views permissions now @@ -27331,9 +27269,10 @@ function vdm_dkim() { $character_length = (int) MathHelper::bc( 'mul', $this->accessSize, 20, 0 ); - $this->accessWorseCase = (int) MathHelper::bc( + // set worse case + CFactory::_('Config')->set('access_worse_case', (int) MathHelper::bc( 'mul', $character_length, 8, 0 - ); + )); } // return the build @@ -27895,35 +27834,26 @@ function vdm_dkim() { public function getModLibCode(&$module) { $setter = ''; - if (isset($this->libManager[$module->key][$module->code_name]) - && ArrayHelper::check( - $this->libManager[$module->key][$module->code_name] - )) + if (($data_ = CFactory::_('Registry')->extract('builder.library_manager.' . + $module->key . '.' . $module->code_name)) !== null) { $setter .= '//' . Line::_(__Line__, __Class__) . 'get the document object'; $setter .= PHP_EOL . '$document = JFactory::getDocument();'; - foreach ( - $this->libManager[$module->key][$module->code_name] as $id => - $true - ) + foreach ($data_ as $id => $true) { - if (isset($this->libraries[$id]) - && ObjectHelper::check( - $this->libraries[$id] - ) - && isset($this->libraries[$id]->document) + // get the library + $library = CFactory::_('Registry')->get("builder.libraries.$id", null); + if (is_object($library) + && isset($library->document) && StringHelper::check( - $this->libraries[$id]->document + $library->document )) { - $setter .= PHP_EOL . $this->libraries[$id]->document; + $setter .= PHP_EOL . $library->document; } - elseif (isset($this->libraries[$id]) - && ObjectHelper::check( - $this->libraries[$id] - ) - && isset($this->libraries[$id]->how)) + elseif (is_object($library) + && isset($library->how)) { $setter .= $this->setLibraryDocument($id); } @@ -28012,7 +27942,7 @@ function vdm_dkim() { // Trigger Event: jcb_ce_onBeforeBuildModuleLang CFactory::_('Event')->trigger( 'jcb_ce_onBeforeBuildModuleLang', - array(&$this->componentContext, &$module, + array(&$component_context, &$module, &$langContent, &$module->lang_prefix, &$module->official_name) ); // get other languages @@ -28031,10 +27961,12 @@ function vdm_dkim() { $this->purgeLanuageStrings($values, $module->id, 'modules'); $total = count($values); unset($values); + // for plugin event TODO change event api signatures + $component_context = CFactory::_('Config')->component_context; // Trigger Event: jcb_ce_onBeforeBuildModuleLangFiles CFactory::_('Event')->trigger( 'jcb_ce_onBeforeBuildModuleLangFiles', - array(&$this->componentContext, &$module, + array(&$component_context, &$module, &$this->languages['modules'], &$this->langTag) ); @@ -28215,10 +28147,10 @@ function vdm_dkim() { $xml .= PHP_EOL . Indent::_(1) . 'component_code_name . '/models/rules"'; $xml .= PHP_EOL . Indent::_(2) . 'addfieldpath="/administrator/components/com_' - . $this->componentCodeName . '/models/fields"'; + . CFactory::_('Config')->component_code_name . '/models/fields"'; $xml .= PHP_EOL . Indent::_(1) . '>'; } else @@ -28399,10 +28331,11 @@ function vdm_dkim() { { // for plugin event TODO change event api signatures $langContent = CFactory::_('Language')->getTarget($plugin->key); + $component_context = CFactory::_('Config')->component_context; // Trigger Event: jcb_ce_onBeforeBuildPluginLang CFactory::_('Event')->trigger( 'jcb_ce_onBeforeBuildPluginLang', - array(&$this->componentContext, &$plugin, + array(&$component_context, &$plugin, &$langContent, &$plugin->lang_prefix, &$plugin->official_name) ); @@ -28425,7 +28358,7 @@ function vdm_dkim() { // Trigger Event: jcb_ce_onBeforeBuildPluginLangFiles CFactory::_('Event')->trigger( 'jcb_ce_onBeforeBuildPluginLangFiles', - array(&$this->componentContext, &$plugin, + array(&$component_context, &$plugin, &$this->languages['plugins'], &$this->langTag) ); @@ -28614,10 +28547,10 @@ function vdm_dkim() { $xml .= PHP_EOL . Indent::_(1) . 'component_code_name . '/models/rules"'; $xml .= PHP_EOL . Indent::_(2) . 'addfieldpath="/administrator/components/com_' - . $this->componentCodeName . '/models/fields"'; + . CFactory::_('Config')->component_code_name . '/models/fields"'; $xml .= PHP_EOL . Indent::_(1) . '>'; } else diff --git a/admin/helpers/compiler/f_Infusion.php b/admin/helpers/compiler/f_Infusion.php index 075028cca..5720c8a31 100644 --- a/admin/helpers/compiler/f_Infusion.php +++ b/admin/helpers/compiler/f_Infusion.php @@ -82,10 +82,11 @@ class Infusion extends Interpretation $placeholders = CFactory::_('Placeholder')->active; $fileContentStatic = CFactory::_('Content')->active; $fileContentDynamic = CFactory::_('Content')->_active; + $component_context = CFactory::_('Config')->component_context; // Trigger Event: jcb_ce_onBeforeBuildFilesContent CFactory::_('Event')->trigger( 'jcb_ce_onBeforeBuildFilesContent', - array(&$this->componentContext, &$this->componentData, + array(&$component_context, &$this->componentData, &$fileContentStatic, &$fileContentDynamic, &$placeholders, &$this->hhh) ); @@ -365,7 +366,7 @@ class Infusion extends Interpretation // Trigger Event: jcb_ce_onBeforeBuildAdminEditViewContent CFactory::_('Event')->trigger( 'jcb_ce_onBeforeBuildAdminEditViewContent', - array(&$this->componentContext, &$view, + array(&$component_context, &$view, &$nameSingleCode, &$nameListCode, &$fileContentStatic, @@ -579,7 +580,7 @@ class Infusion extends Interpretation // Trigger Event: jcb_ce_onAfterBuildAdminEditViewContent CFactory::_('Event')->trigger( 'jcb_ce_onAfterBuildAdminEditViewContent', - array(&$this->componentContext, &$view, + array(&$component_context, &$view, &$nameSingleCode, &$nameListCode, &$fileContentStatic, @@ -606,7 +607,7 @@ class Infusion extends Interpretation // Trigger Event: jcb_ce_onBeforeBuildAdminListViewContent CFactory::_('Event')->trigger( 'jcb_ce_onBeforeBuildAdminListViewContent', - array(&$this->componentContext, &$view, + array(&$component_context, &$view, &$nameSingleCode, &$nameListCode, &$fileContentStatic, @@ -876,7 +877,7 @@ class Infusion extends Interpretation // Trigger Event: jcb_ce_onAfterBuildAdminListViewContent CFactory::_('Event')->trigger( 'jcb_ce_onAfterBuildAdminListViewContent', - array(&$this->componentContext, &$view, + array(&$component_context, &$view, &$nameSingleCode, &$nameListCode, &$fileContentStatic, @@ -1021,7 +1022,7 @@ class Infusion extends Interpretation // Trigger Event: jcb_ce_onAfterBuildAdminViewContent CFactory::_('Event')->trigger( 'jcb_ce_onAfterBuildAdminViewContent', - array(&$this->componentContext, &$view, + array(&$component_context, &$view, &$nameSingleCode, &$nameListCode, &$fileContentStatic, @@ -1088,7 +1089,7 @@ class Infusion extends Interpretation // Trigger Event: jcb_ce_onBeforeBuildCustomAdminViewContent CFactory::_('Event')->trigger( 'jcb_ce_onBeforeBuildCustomAdminViewContent', - array(&$this->componentContext, &$view, + array(&$component_context, &$view, &$view['settings']->code, &$fileContentStatic, &$fileContentDynamic[$view['settings']->code], @@ -1255,7 +1256,7 @@ class Infusion extends Interpretation // Trigger Event: jcb_ce_onAfterBuildCustomAdminViewContent CFactory::_('Event')->trigger( 'jcb_ce_onAfterBuildCustomAdminViewContent', - array(&$this->componentContext, &$view, + array(&$component_context, &$view, &$view['settings']->code, &$fileContentStatic, &$fileContentDynamic[$view['settings']->code], @@ -1364,7 +1365,7 @@ class Infusion extends Interpretation } // add import - if (isset($this->addEximport) && $this->addEximport) + if (CFactory::_('Config')->get('add_eximport', false)) { // setup import files $target = array('admin' => 'import'); @@ -1384,7 +1385,7 @@ class Infusion extends Interpretation } // ensure that the ajax model and controller is set if needed - if (isset($this->addAjax) && $this->addAjax) + if (CFactory::_('Config')->get('add_ajax', false)) { // setup Ajax files $target = array('admin' => 'ajax'); @@ -1399,7 +1400,7 @@ class Infusion extends Interpretation } // ensure that the site ajax model and controller is set if needed - if (isset($this->addSiteAjax) && $this->addSiteAjax) + if (CFactory::_('Config')->get('add_site_ajax', false)) { // setup Ajax files $target = array('site' => 'ajax'); @@ -1486,7 +1487,7 @@ class Infusion extends Interpretation // Trigger Event: jcb_ce_onBeforeBuildSiteViewContent CFactory::_('Event')->trigger( 'jcb_ce_onBeforeBuildSiteViewContent', - array(&$this->componentContext, &$view, + array(&$component_context, &$view, &$view['settings']->code, &$fileContentStatic, &$fileContentDynamic[$view['settings']->code], @@ -1680,7 +1681,7 @@ class Infusion extends Interpretation // Trigger Event: jcb_ce_onAfterBuildSiteViewContent CFactory::_('Event')->trigger( 'jcb_ce_onAfterBuildSiteViewContent', - array(&$this->componentContext, &$view, + array(&$component_context, &$view, &$view['settings']->code, &$fileContentStatic, &$fileContentDynamic[$view['settings']->code], @@ -1817,7 +1818,7 @@ class Infusion extends Interpretation // Trigger Event: jcb_ce_onBeforeInfuseModuleData CFactory::_('Event')->trigger( 'jcb_ce_onBeforeInfuseModuleData', - array(&$this->componentContext, &$module, &$this) + array(&$component_context, &$module, &$this) ); CFactory::_('Config')->build_target = $module->key; CFactory::_('Config')->lang_target = $module->key; @@ -1870,7 +1871,7 @@ class Infusion extends Interpretation // Trigger Event: jcb_ce_onAfterInfuseModuleData CFactory::_('Event')->trigger( 'jcb_ce_onAfterInfuseModuleData', - array(&$this->componentContext, &$module, &$this) + array(&$component_context, &$module, &$this) ); } } @@ -1885,7 +1886,7 @@ class Infusion extends Interpretation // Trigger Event: jcb_ce_onBeforeInfusePluginData CFactory::_('Event')->trigger( 'jcb_ce_onBeforeInfusePluginData', - array(&$this->componentContext, &$plugin, &$this) + array(&$component_context, &$plugin, &$this) ); CFactory::_('Config')->build_target = $plugin->key; CFactory::_('Config')->lang_target = $plugin->key; @@ -1927,7 +1928,7 @@ class Infusion extends Interpretation // Trigger Event: jcb_ce_onAfterInfusePluginData CFactory::_('Event')->trigger( 'jcb_ce_onAfterInfusePluginData', - array(&$this->componentContext, &$plugin, &$this) + array(&$component_context, &$plugin, &$this) ); } } @@ -1944,7 +1945,7 @@ class Infusion extends Interpretation // Trigger Event: jcb_ce_onAfterBuildFilesContent CFactory::_('Event')->trigger( 'jcb_ce_onAfterBuildFilesContent', - array(&$this->componentContext, &$this->componentData, + array(&$component_context, &$this->componentData, &$fileContentStatic, &$this->fileContentDynamic, &$placeholders, &$this->hhh) ); @@ -2099,10 +2100,12 @@ class Infusion extends Interpretation $this->purgeLanuageStrings($values, CFactory::_('Config')->component_id); // path to INI file $getPAth = $this->templatePath . '/en-GB.com_admin.ini'; + // for plugin event TODO change event api signatures + $component_context = CFactory::_('Config')->component_context; // Trigger Event: jcb_ce_onBeforeBuildAllLangFiles CFactory::_('Event')->trigger( 'jcb_ce_onBeforeBuildAllLangFiles', - array(&$this->componentContext, &$this->languages['components'], + array(&$component_context, &$this->languages['components'], &$this->langTag) ); // for plugin event TODO change event api signatures diff --git a/admin/sql/install.mysql.utf8.sql b/admin/sql/install.mysql.utf8.sql index 33e76ec24..0158cfa2d 100644 --- a/admin/sql/install.mysql.utf8.sql +++ b/admin/sql/install.mysql.utf8.sql @@ -2213,7 +2213,7 @@ INSERT INTO `#__componentbuilder_field` (`id`, `add_css_view`, `add_css_views`, (199, '', '', '', '', '', '', '', '', 255, '', 'VARCHAR', 2, '', '', 'Name', 'NOT NULL', '', 24, '\"\"', 1, '2015-03-19 17:30:59', '2022-09-21 10:17:10', 8, '', 4, '5d3d34dd-4876-4c6a-86ab-b4e162f22c08'), (203, '', '', '', '', '', '', '', '', 1, '', 'INT', '', '', '', 'Not Required', 'NOT NULL', '', 9, '\"\"', 1, '2015-05-08 16:19:16', '2020-02-27 20:17:33', 13, '', 19, 'da5e6901-6958-40e5-a4f5-6822d6fe57ac'), (280, '', '', '', '', '', '', '', '', 255, '', 'VARCHAR', '', '', '', 'Website', 'NOT NULL', '', 27, '\"\"', 1, '2015-04-08 00:36:16', '2018-07-08 00:11:05', 2, '', 105, '6c3a6983-d1bf-4e5e-9e99-deea00b0cefd'), -(682, '', '', '', '', '', '', '', '', 1, '', 'TINYINT', 2, '', '', 'Add More', 'NOT NULL', '', 17, '\"\"', 1, '2015-08-05 01:18:20', '2018-03-30 09:30:45', 4, '', 196, 'a66389aa-2323-4f44-8c23-ff44969639be'), +(682, '', '', '', '', '', '', '', '', 1, '', 'TINYINT', 2, '', '', 'Add More', 'NOT NULL', '', 17, '\"\"', 1, '2015-08-05 01:18:20', '2023-01-20 11:15:45', 7, '', 196, 'a66389aa-2323-4f44-8c23-ff44969639be'), (1011, '', '', '', '', '', '', 'Other', '0000-00-00', '', '', 'DATE', '', '', '', 'Date of Birth', 'NOT NULL', '', 1, '\"\"', 1, '2015-12-07 01:47:32', '2018-08-03 09:56:07', 4, '', 649, 'cb2bdf20-8800-407b-a4f6-250152a0bdfb'); -- diff --git a/componentbuilder.xml b/componentbuilder.xml index c2c1075dd..4d49ed153 100644 --- a/componentbuilder.xml +++ b/componentbuilder.xml @@ -1,7 +1,7 @@ COM_COMPONENTBUILDER - 8th January, 2023 + 15th January, 2023 Llewellyn van der Merwe joomla@vdm.io https://dev.vdm.io diff --git a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Abstraction/BaseConfig.php b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Abstraction/BaseConfig.php index 438c931e0..0d9b2074b 100644 --- a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Abstraction/BaseConfig.php +++ b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Abstraction/BaseConfig.php @@ -32,7 +32,7 @@ abstract class BaseConfig extends JoomlaRegistry * @var Input * @since 3.2.0 */ - protected $input; + protected Input $input; /** * The Params @@ -66,12 +66,12 @@ abstract class BaseConfig extends JoomlaRegistry /** * setting any config value * - * @param String $key The value's key/path name + * @param string $key The value's key/path name * @param mixed $value Optional default value, returned if the internal value is null. * * @since 3.2.0 */ - public function __set($key, $value) + public function __set(string $key, $value) { $this->set($key, $value); } @@ -79,12 +79,12 @@ abstract class BaseConfig extends JoomlaRegistry /** * getting any valid value * - * @param String $key The value's key/path name + * @param string $key The value's key/path name * * @since 3.2.0 * @throws \InvalidArgumentException If $key is not a valid function name. */ - public function __get($key) + public function __get(string $key) { // check if it has been set if (($value = $this->get($key, '__N0T_S3T_Y3T_')) !== '__N0T_S3T_Y3T_') @@ -98,7 +98,7 @@ abstract class BaseConfig extends JoomlaRegistry /** * Get a config value. * - * @param string $path Registry path (e.g. joomla.content.showauthor) + * @param string $path Registry path (e.g. joomla_content_showauthor) * @param mixed $default Optional default value, returned if the internal value is null. * * @return mixed Value of entry or null @@ -117,7 +117,7 @@ abstract class BaseConfig extends JoomlaRegistry } elseif (method_exists($this, $method)) { - $value = $this->{$method}(); + $value = $this->{$method}($default); $this->set($path, $value); diff --git a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Config.php b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Config.php index 429463b4a..4cfd8f9fa 100644 --- a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Config.php +++ b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Config.php @@ -12,6 +12,8 @@ namespace VDM\Joomla\Componentbuilder\Compiler; +use Joomla\Registry\Registry as JoomlaRegistry; +use Joomla\CMS\Factory as JoomlaFactory; use VDM\Joomla\Utilities\GetHelper; use VDM\Joomla\Utilities\StringHelper; use VDM\Joomla\Componentbuilder\Abstraction\BaseConfig; @@ -20,10 +22,85 @@ use VDM\Joomla\Componentbuilder\Abstraction\BaseConfig; /** * Compiler Configurations * + * All these functions are accessed via the direct name without the get: + * example: $this->component_code_name calls: $this->getComponentcodename() + * + * All values once called are cached, yet can be updated directly: + * example: $this->component_code_name = 'new_code_name'; // be warned! + * * @since 3.2.0 */ class Config extends BaseConfig { + /** + * The Global Joomla Configuration + * + * @var JoomlaRegistry + * @since 3.2.0 + */ + protected JoomlaRegistry $config; + + /** + * Constructor + * + * @param Input|null $input Input + * @param Registry|null $params The component parameters + * @param Registry|null $config The Joomla configuration + * + * @throws \Exception + * @since 3.2.0 + */ + public function __construct(?Input $input = null, ?JoomlaRegistry $params = null, ?JoomlaRegistry $config = null) + { + parent::__construct($input, $params); + + $this->config = $config ?: JoomlaFactory::getConfig(); + } + + /** + * get add contributors switch + * + * @return bool Add contributors switch + * @since 3.2.0 + */ + protected function getAddcontributors(): bool + { + return false; // default is false + } + + /** + * get Add Ajax Switch + * + * @return bool Add Ajax Switch + * @since 3.2.0 + */ + protected function getAddajax(): bool + { + return false; // default is false + } + + /** + * get Add Site Ajax Switch + * + * @return bool Add Site Ajax Switch + * @since 3.2.0 + */ + protected function getAddsiteajax(): bool + { + return false; // default is false + } + + /** + * get add eximport + * + * @return bool add eximport switch + * @since 3.2.0 + */ + protected function getAddeximport(): bool + { + return false; // default is false + } + /** * get posted component id * @@ -35,6 +112,17 @@ class Config extends BaseConfig return $this->input->post->get('component_id', 0, 'INT'); } + /** + * get component version + * + * @return string Component version + * @since 3.2.0 + */ + protected function getComponentversion(): string + { + return '1.0.0'; + } + /** * get components code name * @@ -84,6 +172,20 @@ class Config extends BaseConfig return $this->input->post->get('joomla_version', 3, 'INT'); } + /** + * get Joomla versions + * + * @return array Joomla versions + * @since 3.2.0 + */ + protected function getJoomlaversions(): array + { + return [ + 3 => ['folder_key' => 3, 'xml_version' => 3.9], // only joomla 3 + 3.10 => ['folder_key' => 3, 'xml_version' => 4.0] // legacy joomla 4 + ]; + } + /** * get posted Joomla version name * @@ -95,6 +197,17 @@ class Config extends BaseConfig return StringHelper::safe($this->joomla_version); } + /** + * set joomla fields + * + * @return bool set joomla fields + * @since 3.2.0 + */ + protected function getSetjoomlafields(): bool + { + return false; + } + /** * get indentation value * @@ -138,15 +251,12 @@ class Config extends BaseConfig { // get posted value $value = $this->input->post->get('debug_line_nr', 2, 'INT'); - - // get active value - $add = ($value == 0) ? false : ( - ($value == 1) ? true : ( - ((int) GetHelper::var('joomla_component', $this->component_id, 'id', 'debug_linenr' ) == 1) ? true : false - ) - ); - - return $add; + // get global value + if ($value > 1) + { + return (int) GetHelper::var('joomla_component', $this->component_id, 'id', 'debug_linenr'); + } + return $value; } /** @@ -157,12 +267,11 @@ class Config extends BaseConfig */ protected function getMinify(): int { + // get posted value $minify = $this->input->post->get('minify', 2, 'INT'); // if value is 2 use global value - $minify = ($minify != 2) ? $minify : $this->params->get('minify', 0); - - return $minify; + return ($minify != 2) ? $minify : $this->params->get('minify', 0); } /** @@ -173,16 +282,14 @@ class Config extends BaseConfig */ protected function getRemovelinebreaks(): bool { - $value = 2; // 2 is global (use the components value) TODO: get from post - - // get active value - $remove = ($value == 0) ? false : ( - ($value == 1) ? true : ( - ((int) GetHelper::var('joomla_component', $this->component_id, 'id', 'remove_line_breaks' ) == 1) ? true : false - ) - ); - - return $remove; + // get posted value + $value = $this->input->post->get('remove_line_breaks', 2, 'INT'); + // get global + if ($value > 1) + { + return (bool) GetHelper::var('joomla_component', $this->component_id, 'id', 'remove_line_breaks'); + } + return (bool) $value; } /** @@ -197,6 +304,30 @@ class Config extends BaseConfig return \extension_loaded('Tidy'); } + /** + * add tidy warning + * + * @return bool Set tidy warning + * @since 3.2.0 + */ + protected function getSettidywarning(): bool + { + // add warning once + return true; + } + + /** + * get history tag switch + * + * @return bool get history tag switch + * @since 3.2.0 + */ + protected function getSettaghistory(): bool + { + // add warning once + return true; + } + /** * get language tag * @@ -206,7 +337,7 @@ class Config extends BaseConfig protected function getLangtag(): string { // get the global language - return $this->params->get('language', 'en-GB'); + return $this->params->get('language', 'en-GB'); } /** @@ -275,11 +406,36 @@ class Config extends BaseConfig protected function getFieldbuildertype(): int { // get the field type builder - return $this->params->get( + return $this->params->get( 'compiler_field_builder_type', 2 ); } + /** + * get default fields + * + * @return array The default fields + * @since 3.2.0 + */ + protected function getDefaultfields(): array + { + // get the field type builder + return ['created', 'created_by', 'modified', 'modified_by', 'published', + 'ordering', 'access', 'version', 'hits', 'id']; + } + + /** + * get temporary path + * + * @return string The temporary path + * @since 3.2.0 + */ + protected function getTmppath(): string + { + // get the temporary path + return $this->config->get('tmp_path'); + } + /** * get compiler path * @@ -289,7 +445,7 @@ class Config extends BaseConfig protected function getCompilerpath(): string { // get the compiler path - return $this->params->get( + return $this->params->get( 'compiler_folder_path', JPATH_COMPONENT_ADMINISTRATOR . '/compiler' ); @@ -304,7 +460,19 @@ class Config extends BaseConfig protected function getJcbpowerspath(): string { // get jcb powers path - return $this->params->get('jcb_powers_path', 'libraries/jcb_powers'); + return $this->params->get('jcb_powers_path', 'libraries/jcb_powers'); + } + + /** + * get bom path + * + * @return string The bom path + * @since 3.2.0 + */ + protected function getBompath(): string + { + // get default bom path + return $this->compiler_path . '/default.txt'; } /** @@ -321,12 +489,50 @@ class Config extends BaseConfig ); // get component value - $add = (($add_assets_table_fix = (int) GetHelper::var( + return (($add_assets_table_fix = (int) GetHelper::var( 'joomla_component', $this->component_id, 'id', 'assets_table_fix' )) == 3) ? $global : $add_assets_table_fix; + } - return $add; + /** + * get switch to add assets table name fix + * + * @return bool Switch number to add assets table name fix + * @since 3.2.0 + */ + protected function getAddassetstablenamefix(): bool + { + // get global is false + return false; + } + + /** + * get access worse case size + * + * @return int access worse case size + * @since 3.2.0 + */ + protected function getAccessworsecase(): int + { + // we start at zero + return 0; + } + + /** + * get mysql table keys + * + * @return array + * @since 3.2.0 + */ + protected function getMysqltablekeys(): array + { + return [ + 'engine' => ['default' => 'MyISAM'], + 'charset' => ['default' => 'utf8'], + 'collate' => ['default' => 'utf8_general_ci'], + 'row_format' => ['default' => ''] + ]; } /** @@ -339,15 +545,12 @@ class Config extends BaseConfig { // get posted value $value = $this->input->post->get('add_placeholders', 2, 'INT'); - - // get active value - $add = ($value == 0) ? false : ( - ($value == 1) ? true : ( - ((int) GetHelper::var('joomla_component', $this->component_id, 'id', 'add_placeholders' ) == 1) ? true : false - ) - ); - - return $add; + // get global value + if ($value > 1) + { + return (bool) GetHelper::var('joomla_component', $this->component_id, 'id', 'add_placeholders'); + } + return (bool) $value; } /** @@ -360,15 +563,12 @@ class Config extends BaseConfig { // get posted value $value = $this->input->post->get('powers', 2, 'INT'); - - // get active value - $add = ($value == 0) ? false : ( - ($value == 1) ? true : ( - ((int) GetHelper::var('joomla_component', $this->component_id, 'id', 'add_powers' ) == 1) ? true : false - ) - ); - - return $add; + // get global value + if ($value > 1) + { + return (bool) GetHelper::var('joomla_component', $this->component_id, 'id', 'add_powers'); + } + return (bool) $value; } /** @@ -384,6 +584,17 @@ class Config extends BaseConfig return 'admin'; } + /** + * get encryption types + * + * @return array encryption types + * @since 3.2.0 + */ + protected function getCryptiontypes(): array + { + return ['basic', 'medium', 'whmcs', 'expert']; + } + /** * get basic encryption switch * @@ -438,6 +649,50 @@ class Config extends BaseConfig { return true; } + + /** + * The Uikit switch + * + * @return int Switch to control the adding uikit + * @since 3.2.0 + */ + protected function getUikit(): int + { + return 0; // default its not added + } + + /** + * The google chart switch + * + * @return bool Switch to control the adding googlechart + * @since 3.2.0 + */ + protected function getGooglechart(): bool + { + return false; // default its not added + } + + /** + * The footable switch + * + * @return bool Switch to control the adding footable + * @since 3.2.0 + */ + protected function getFootable(): bool + { + return false; // default its not added + } + + /** + * The footable version + * + * @return int Switch to control the adding footable + * @since 3.2.0 + */ + protected function getFootableversion(): int + { + return 2; // default is version 2 + } }