Converts compiler to move component get methods to the powers area.

This commit is contained in:
Llewellyn van der Merwe 2023-01-15 10:42:19 +02:00
parent e8abe8e3cf
commit f44f385159
Signed by: Llewellyn
GPG Key ID: A9201372263741E7
12 changed files with 1446 additions and 1346 deletions

View File

@ -140,11 +140,11 @@ TODO
+ *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io) + *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io)
+ *Name*: [Component Builder](https://git.vdm.dev/joomla/Component-Builder) + *Name*: [Component Builder](https://git.vdm.dev/joomla/Component-Builder)
+ *First Build*: 30th April, 2015 + *First Build*: 30th April, 2015
+ *Last Build*: 8th January, 2023 + *Last Build*: 15th January, 2023
+ *Version*: 3.1.13 + *Version*: 3.1.13
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved. + *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt + *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **344993** + *Line count*: **345248**
+ *Field count*: **2009** + *Field count*: **2009**
+ *File count*: **2240** + *File count*: **2240**
+ *Folder count*: **399** + *Folder count*: **399**

View File

@ -140,11 +140,11 @@ TODO
+ *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io) + *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io)
+ *Name*: [Component Builder](https://git.vdm.dev/joomla/Component-Builder) + *Name*: [Component Builder](https://git.vdm.dev/joomla/Component-Builder)
+ *First Build*: 30th April, 2015 + *First Build*: 30th April, 2015
+ *Last Build*: 8th January, 2023 + *Last Build*: 15th January, 2023
+ *Version*: 3.1.13 + *Version*: 3.1.13
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved. + *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt + *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **344993** + *Line count*: **345248**
+ *Field count*: **2009** + *Field count*: **2009**
+ *File count*: **2240** + *File count*: **2240**
+ *Folder count*: **399** + *Folder count*: **399**

View File

@ -120,10 +120,12 @@ class Compiler extends Infusion
); );
$this->writeFile($xmlPath, $componentXML); $this->writeFile($xmlPath, $componentXML);
} }
// for plugin event TODO change event api signatures
$component_context = CFactory::_('Config')->component_context;
// Trigger Event: jcb_ce_onBeforeUpdateFiles // Trigger Event: jcb_ce_onBeforeUpdateFiles
CFactory::_('Event')->trigger( CFactory::_('Event')->trigger(
'jcb_ce_onBeforeUpdateFiles', 'jcb_ce_onBeforeUpdateFiles',
array(&$this->componentContext, &$this) array(&$component_context, &$this)
); );
// now update the files // now update the files
if (!$this->updateFiles()) if (!$this->updateFiles())
@ -133,7 +135,7 @@ class Compiler extends Infusion
// Trigger Event: jcb_ce_onBeforeGetCustomCode // Trigger Event: jcb_ce_onBeforeGetCustomCode
CFactory::_('Event')->trigger( CFactory::_('Event')->trigger(
'jcb_ce_onBeforeGetCustomCode', 'jcb_ce_onBeforeGetCustomCode',
array(&$this->componentContext, &$this) array(&$component_context, &$this)
); );
// now insert into the new files // now insert into the new files
if (CFactory::_('Customcode')->get()) if (CFactory::_('Customcode')->get())
@ -141,7 +143,7 @@ class Compiler extends Infusion
// Trigger Event: jcb_ce_onBeforeAddCustomCode // Trigger Event: jcb_ce_onBeforeAddCustomCode
CFactory::_('Event')->trigger( CFactory::_('Event')->trigger(
'jcb_ce_onBeforeAddCustomCode', 'jcb_ce_onBeforeAddCustomCode',
array(&$this->componentContext, &$this) array(&$component_context, &$this)
); );
$this->addCustomCode(); $this->addCustomCode();
@ -149,7 +151,7 @@ class Compiler extends Infusion
// Trigger Event: jcb_ce_onBeforeSetLangFileData // Trigger Event: jcb_ce_onBeforeSetLangFileData
CFactory::_('Event')->trigger( CFactory::_('Event')->trigger(
'jcb_ce_onBeforeSetLangFileData', 'jcb_ce_onBeforeSetLangFileData',
array(&$this->componentContext, &$this) array(&$component_context, &$this)
); );
// set the lang data now // set the lang data now
$this->setLangFileData(); $this->setLangFileData();
@ -216,13 +218,15 @@ class Compiler extends Infusion
$message_fix['sql'] = JText::_( $message_fix['sql'] = JText::_(
'The <b>SQL</b> 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.' 'The <b>SQL</b> 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 // set assets table rules column notice
if (CFactory::_('Config')->add_assets_table_fix) if ($add_assets_table_fix)
{ {
$this->app->enqueueMessage( $this->app->enqueueMessage(
JText::_('<hr /><h3>Assets Table Notice</h3>'), 'Notice' JText::_('<hr /><h3>Assets Table Notice</h3>'), 'Notice'
); );
$asset_table_fix_type = (CFactory::_('Config')->add_assets_table_fix == 2) $asset_table_fix_type = ($add_assets_table_fix == 2)
? 'intelligent' : 'sql'; ? 'intelligent' : 'sql';
$this->app->enqueueMessage( $this->app->enqueueMessage(
JText::sprintf( JText::sprintf(
@ -241,13 +245,13 @@ class Compiler extends Infusion
$this->app->enqueueMessage( $this->app->enqueueMessage(
JText::sprintf( 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 <b>%s</b> characters, and yet the Joomla default is only <b>varchar(5120)</b>. JCB has three option to resolve this issue, first <b>use less permissions</b> in your component, second use the <b>SQL</b> fix, or the <b>intelligent</b> fix. %s %s', '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 <b>%s</b> characters, and yet the Joomla default is only <b>varchar(5120)</b>. JCB has three option to resolve this issue, first <b>use less permissions</b> in your component, second use the <b>SQL</b> fix, or the <b>intelligent</b> fix. %s %s',
$this->accessWorseCase, $message_fix['intelligent'], CFactory::_('Config')->access_worse_case, $message_fix['intelligent'],
$message_fix['sql'] $message_fix['sql']
), 'Warning' ), 'Warning'
); );
} }
// set assets table name column warning if not set // 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 // only add if not already added
if ($this->accessSize < 30) if ($this->accessSize < 30)
@ -381,7 +385,7 @@ class Compiler extends Infusion
&& ArrayHelper::check($this->newFiles['dynamic'])) && ArrayHelper::check($this->newFiles['dynamic']))
{ {
// get the bom file // get the bom file
$bom = FileHelper::getContent($this->bomPath); $bom = FileHelper::getContent(CFactory::_('Config')->bom_path);
// first we do the static files // first we do the static files
foreach ($this->newFiles['static'] as $static) foreach ($this->newFiles['static'] as $static)
{ {
@ -624,10 +628,12 @@ class Compiler extends Infusion
*/ */
protected function setFileContent(&$name, &$path, &$bom, $view = null) 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 // Trigger Event: jcb_ce_onBeforeSetFileContent
CFactory::_('Event')->trigger( CFactory::_('Event')->trigger(
'jcb_ce_onBeforeSetFileContent', 'jcb_ce_onBeforeSetFileContent',
array(&$this->componentContext, &$name, &$path, &$bom, &$view) array(&$component_context, &$name, &$path, &$bom, &$view)
); );
// set the file name // set the file name
CFactory::_('Content')->set('FILENAME', $name); CFactory::_('Content')->set('FILENAME', $name);
@ -642,7 +648,7 @@ class Compiler extends Infusion
// Trigger Event: jcb_ce_onGetFileContents // Trigger Event: jcb_ce_onGetFileContents
CFactory::_('Event')->trigger( CFactory::_('Event')->trigger(
'jcb_ce_onGetFileContents', 'jcb_ce_onGetFileContents',
array(&$this->componentContext, &$string, &$name, &$path, &$bom, array(&$component_context, &$string, &$name, &$path, &$bom,
&$view) &$view)
); );
// see if we should add a BOM // see if we should add a BOM
@ -670,7 +676,7 @@ class Compiler extends Infusion
// Trigger Event: jcb_ce_onBeforeSetFileContent // Trigger Event: jcb_ce_onBeforeSetFileContent
CFactory::_('Event')->trigger( CFactory::_('Event')->trigger(
'jcb_ce_onBeforeWriteFileContent', 'jcb_ce_onBeforeWriteFileContent',
array(&$this->componentContext, &$answer, &$name, &$path, &$bom, array(&$component_context, &$answer, &$name, &$path, &$bom,
&$view) &$view)
); );
// add answer back to file // add answer back to file
@ -939,10 +945,12 @@ class Compiler extends Infusion
$repoFullPath = $this->repoPath . '/com_' $repoFullPath = $this->repoPath . '/com_'
. $this->componentData->sales_name . '__joomla_' . $this->componentData->sales_name . '__joomla_'
. CFactory::_('Config')->get('version', 3); . CFactory::_('Config')->get('version', 3);
// for plugin event TODO change event api signatures
$component_context = CFactory::_('Config')->component_context;
// Trigger Event: jcb_ce_onBeforeUpdateRepo // Trigger Event: jcb_ce_onBeforeUpdateRepo
CFactory::_('Event')->trigger( CFactory::_('Event')->trigger(
'jcb_ce_onBeforeUpdateRepo', 'jcb_ce_onBeforeUpdateRepo',
array(&$this->componentContext, &$this->componentPath, array(&$component_context, &$this->componentPath,
&$repoFullPath, &$this->componentData) &$repoFullPath, &$this->componentData)
); );
// remove old data // remove old data
@ -952,7 +960,7 @@ class Compiler extends Infusion
// Trigger Event: jcb_ce_onAfterUpdateRepo // Trigger Event: jcb_ce_onAfterUpdateRepo
CFactory::_('Event')->trigger( CFactory::_('Event')->trigger(
'jcb_ce_onAfterUpdateRepo', 'jcb_ce_onAfterUpdateRepo',
array(&$this->componentContext, &$this->componentPath, array(&$component_context, &$this->componentPath,
&$repoFullPath, &$this->componentData) &$repoFullPath, &$this->componentData)
); );
@ -1040,10 +1048,12 @@ class Compiler extends Infusion
// the name of the zip file to create // the name of the zip file to create
$this->filepath['component'] = $this->tempPath . '/' $this->filepath['component'] = $this->tempPath . '/'
. $this->filepath['component-folder'] . '.zip'; . $this->filepath['component-folder'] . '.zip';
// for plugin event TODO change event api signatures
$component_context = CFactory::_('Config')->component_context;
// Trigger Event: jcb_ce_onBeforeZipComponent // Trigger Event: jcb_ce_onBeforeZipComponent
CFactory::_('Event')->trigger( CFactory::_('Event')->trigger(
'jcb_ce_onBeforeZipComponent', 'jcb_ce_onBeforeZipComponent',
array(&$this->componentContext, &$this->componentPath, array(&$component_context, &$this->componentPath,
&$this->filepath['component'], &$this->tempPath, &$this->filepath['component'], &$this->tempPath,
&$this->componentFolderName, &$this->componentData) &$this->componentFolderName, &$this->componentData)
); );
@ -1057,7 +1067,7 @@ class Compiler extends Infusion
{ {
// Trigger Event: jcb_ce_onBeforeBackupZip // Trigger Event: jcb_ce_onBeforeBackupZip
CFactory::_('Event')->trigger( CFactory::_('Event')->trigger(
'jcb_ce_onBeforeBackupZip', array(&$this->componentContext, 'jcb_ce_onBeforeBackupZip', array(&$component_context,
&$this->filepath['component'], &$this->filepath['component'],
&$this->tempPath, &$this->tempPath,
&$this->backupPath, &$this->backupPath,
@ -1080,7 +1090,7 @@ class Compiler extends Infusion
// Trigger Event: jcb_ce_onBeforeMoveToServer // Trigger Event: jcb_ce_onBeforeMoveToServer
CFactory::_('Event')->trigger( CFactory::_('Event')->trigger(
'jcb_ce_onBeforeMoveToServer', 'jcb_ce_onBeforeMoveToServer',
array(&$this->componentContext, array(&$component_context,
&$this->filepath['component'], &$this->tempPath, &$this->filepath['component'], &$this->tempPath,
&$this->componentSalesName, &$this->componentData) &$this->componentSalesName, &$this->componentData)
); );
@ -1096,7 +1106,7 @@ class Compiler extends Infusion
// Trigger Event: jcb_ce_onAfterZipComponent // Trigger Event: jcb_ce_onAfterZipComponent
CFactory::_('Event')->trigger( CFactory::_('Event')->trigger(
'jcb_ce_onAfterZipComponent', 'jcb_ce_onAfterZipComponent',
array(&$this->componentContext, &$this->filepath['component'], array(&$component_context, &$this->filepath['component'],
&$this->tempPath, &$this->componentFolderName, &$this->tempPath, &$this->componentFolderName,
&$this->componentData) &$this->componentData)
); );

File diff suppressed because it is too large Load Diff

View File

@ -431,10 +431,12 @@ class Structure extends Get
$this->buildPlugins(); $this->buildPlugins();
// set the Joomla Version Data // set the Joomla Version Data
$this->joomlaVersionData = $this->setJoomlaVersionData(); $this->joomlaVersionData = $this->setJoomlaVersionData();
// for plugin event TODO change event api signatures
$component_context = CFactory::_('Config')->component_context;
// Trigger Event: jcb_ce_onAfterSetJoomlaVersionData // Trigger Event: jcb_ce_onAfterSetJoomlaVersionData
CFactory::_('Event')->trigger( CFactory::_('Event')->trigger(
'jcb_ce_onAfterSetJoomlaVersionData', 'jcb_ce_onAfterSetJoomlaVersionData',
array(&$this->componentContext, &$this->joomlaVersionData) array(&$component_context, &$this->joomlaVersionData)
); );
// set the dashboard // set the dashboard
$this->setDynamicDashboard(); $this->setDynamicDashboard();
@ -472,10 +474,11 @@ class Structure extends Get
{ {
// for plugin event TODO change event api signatures // for plugin event TODO change event api signatures
$this->powers = CFactory::_('Power')->active; $this->powers = CFactory::_('Power')->active;
$component_context = CFactory::_('Config')->component_context;
// Trigger Event: jcb_ce_onBeforeSetModules // Trigger Event: jcb_ce_onBeforeSetModules
CFactory::_('Event')->trigger( CFactory::_('Event')->trigger(
'jcb_ce_onBeforeBuildPowers', 'jcb_ce_onBeforeBuildPowers',
array(&$this->componentContext, &$this->powers) array(&$component_context, &$this->powers)
); );
// for plugin event TODO change event api signatures // for plugin event TODO change event api signatures
CFactory::_('Power')->active = $this->powers; CFactory::_('Power')->active = $this->powers;
@ -590,10 +593,12 @@ class Structure extends Get
{ {
if (ArrayHelper::check($this->joomlaModules)) if (ArrayHelper::check($this->joomlaModules))
{ {
// for plugin event TODO change event api signatures
$component_context = CFactory::_('Config')->component_context;
// Trigger Event: jcb_ce_onBeforeSetModules // Trigger Event: jcb_ce_onBeforeSetModules
CFactory::_('Event')->trigger( CFactory::_('Event')->trigger(
'jcb_ce_onBeforeBuildModules', 'jcb_ce_onBeforeBuildModules',
array(&$this->componentContext, &$this->joomlaModules) array(&$component_context, &$this->joomlaModules)
); );
foreach ($this->joomlaModules as $module) foreach ($this->joomlaModules as $module)
{ {
@ -877,7 +882,7 @@ class Structure extends Get
$xml = '<?xml version="1.0" encoding="utf-8"?>'; $xml = '<?xml version="1.0" encoding="utf-8"?>';
$xml .= PHP_EOL . '<!--' . Line::_(__Line__, __Class__) $xml .= PHP_EOL . '<!--' . Line::_(__Line__, __Class__)
. ' default paths of ' . $file . ' default paths of ' . $file
. ' form points to ' . $this->componentCodeName . ' form points to ' . CFactory::_('Config')->component_code_name
. ' -->'; . ' -->';
// search if we must add the component path // search if we must add the component path
$add_component_path = false; $add_component_path = false;
@ -1171,10 +1176,12 @@ class Structure extends Get
{ {
if (ArrayHelper::check($this->joomlaPlugins)) if (ArrayHelper::check($this->joomlaPlugins))
{ {
// for plugin event TODO change event api signatures
$component_context = CFactory::_('Config')->component_context;
// Trigger Event: jcb_ce_onBeforeSetPlugins // Trigger Event: jcb_ce_onBeforeSetPlugins
CFactory::_('Event')->trigger( CFactory::_('Event')->trigger(
'jcb_ce_onBeforeBuildPlugins', 'jcb_ce_onBeforeBuildPlugins',
array(&$this->componentContext, &$this->joomlaPlugins) array(&$component_context, &$this->joomlaPlugins)
); );
foreach ($this->joomlaPlugins as $plugin) foreach ($this->joomlaPlugins as $plugin)
{ {
@ -1585,12 +1592,14 @@ class Structure extends Get
*/ */
private function setLibraries() 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 // Trigger Event: jcb_ce_onBeforeSetLibraries
CFactory::_('Event')->trigger( CFactory::_('Event')->trigger(
'jcb_ce_onBeforeSetLibraries', 'jcb_ce_onBeforeSetLibraries',
array(&$this->componentContext, &$this->libraries) array(&$component_context, &$libraries_)
); );
// creat the main component folder // creat the main component folder
if (!Folder::exists($this->componentPath)) if (!Folder::exists($this->componentPath))
@ -1602,7 +1611,7 @@ class Structure extends Get
} }
// create media path if not set // create media path if not set
$this->createFolder($this->componentPath . '/media'); $this->createFolder($this->componentPath . '/media');
foreach ($this->libraries as $id => &$library) foreach ($libraries_ as $id => &$library)
{ {
if (ObjectHelper::check($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 // add custom folders
if ((isset($this->componentData->folders) if ((isset($this->componentData->folders)
&& ArrayHelper::check( && ArrayHelper::check(
$this->componentData->folders $this->componentData->folders
)) )) || $add_eximport || $uikit || $footable)
|| $this->addEximport
|| $this->uikit
|| $this->footable)
{ {
if ($this->addEximport) if ($add_eximport)
{ {
// move the import view folder in place // move the import view folder in place
$importView = array('folder' => 'importViews', $this->componentData->folders[] = array('folder' => 'importViews',
'path' => 'admin/views/import', 'path' => 'admin/views/import',
'rename' => 1); 'rename' => 1);
$this->componentData->folders[] = $importView;
// move the phpspreadsheet Folder (TODO we must move this to a library package) // move the phpspreadsheet Folder (TODO we must move this to a library package)
$PHPExcel $this->componentData->folders[] = array('folderpath' => 'JPATH_LIBRARIES/phpspreadsheet/vendor',
= array('folderpath' => 'JPATH_LIBRARIES/phpspreadsheet/vendor',
'path' => '/libraries/phpspreadsheet/', 'path' => '/libraries/phpspreadsheet/',
'rename' => 0); '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 // move the UIKIT Folder into place
$uikit = array('folder' => 'uikit-v2', $this->componentData->folders[] = array('folder' => 'uikit-v2',
'path' => 'media', 'path' => 'media',
'rename' => 0); '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 // move the UIKIT-3 Folder into place
$uikit = array('folder' => 'uikit-v3', $this->componentData->folders[] = array('folder' => 'uikit-v3',
'path' => 'media', 'path' => 'media',
'rename' => 0); 'rename' => 0);
$this->componentData->folders[] = $uikit;
} }
if ($this->footable
&& (!isset($this->footableVersion) // set footable
|| 2 == $this->footableVersion)) $footable_version = CFactory::_('Config')->get('footable_version', 2);
if ($footable && 2 == $footable_version)
{ {
// move the footable folder into place // move the footable folder into place
$footable = array('folder' => 'footable-v2', $this->componentData->folders[] = array('folder' => 'footable-v2',
'path' => 'media', 'path' => 'media',
'rename' => 0); 'rename' => 0);
$this->componentData->folders[] = $footable;
} }
elseif ($this->footable && 3 == $this->footableVersion) elseif ($footable && 3 == $footable_version)
{ {
// move the footable folder into place // move the footable folder into place
$footable = array('folder' => 'footable-v3', $this->componentData->folders[] = array('folder' => 'footable-v3',
'path' => 'media', 'path' => 'media',
'rename' => 0); 'rename' => 0);
$this->componentData->folders[] = $footable;
} }
// pointer tracker // pointer tracker
@ -3021,25 +3029,23 @@ class Structure extends Get
unset($this->componentData->folders); unset($this->componentData->folders);
unset($custom); unset($custom);
} }
// get the google chart switch
$google_chart = CFactory::_('Config')->get('google_chart', false);
// add custom files // add custom files
if ((isset($this->componentData->files) if ((isset($this->componentData->files)
&& ArrayHelper::check( && ArrayHelper::check(
$this->componentData->files $this->componentData->files
)) )) || $google_chart)
|| $this->googlechart)
{ {
if ($this->googlechart) if ($google_chart)
{ {
// move the google chart files // move the google chart files
$googleChart = array('file' => 'google.jsapi.js', $this->componentData->files[] = array('file' => 'google.jsapi.js',
'path' => 'media/js', 'path' => 'media/js',
'rename' => 0); 'rename' => 0);
$this->componentData->files[] = $googleChart; $this->componentData->files[] = array('file' => 'chartbuilder.php',
$googleChart
= array('file' => 'chartbuilder.php',
'path' => 'admin/helpers', 'path' => 'admin/helpers',
'rename' => 0); 'rename' => 0);
$this->componentData->files[] = $googleChart;
} }
// pointer tracker // pointer tracker

View File

@ -608,10 +608,11 @@ class Fields extends Structure
$dbkey = 'g'; $dbkey = 'g';
// for plugin event TODO change event api signatures // for plugin event TODO change event api signatures
$placeholders = CFactory::_('Placeholder')->active; $placeholders = CFactory::_('Placeholder')->active;
$component_context = CFactory::_('Config')->component_context;
// Trigger Event: jcb_ce_onBeforeBuildFields // Trigger Event: jcb_ce_onBeforeBuildFields
CFactory::_('Event')->trigger( CFactory::_('Event')->trigger(
'jcb_ce_onBeforeBuildFields', 'jcb_ce_onBeforeBuildFields',
array(&$this->componentContext, &$dynamicFields, &$readOnly, array(&$component_context, &$dynamicFields, &$readOnly,
&$dbkey, &$view, &$component, &$nameSingleCode, &$dbkey, &$view, &$component, &$nameSingleCode,
&$nameListCode, &$placeholders, &$langView, &$nameListCode, &$placeholders, &$langView,
&$langViews) &$langViews)
@ -631,7 +632,7 @@ class Fields extends Structure
// Trigger Event: jcb_ce_onAfterBuildFields // Trigger Event: jcb_ce_onAfterBuildFields
CFactory::_('Event')->trigger( CFactory::_('Event')->trigger(
'jcb_ce_onAfterBuildFields', 'jcb_ce_onAfterBuildFields',
array(&$this->componentContext, &$dynamicFields, &$readOnly, array(&$component_context, &$dynamicFields, &$readOnly,
&$dbkey, &$view, &$component, &$nameSingleCode, &$dbkey, &$view, &$component, &$nameSingleCode,
&$nameListCode, &$placeholders, &$langView, &$nameListCode, &$placeholders, &$langView,
&$langViews) &$langViews)
@ -1025,10 +1026,11 @@ class Fields extends Structure
$dbkey = 'g'; $dbkey = 'g';
// for plugin event TODO change event api signatures // for plugin event TODO change event api signatures
$placeholders = CFactory::_('Placeholder')->active; $placeholders = CFactory::_('Placeholder')->active;
$component_context = CFactory::_('Config')->component_context;
// Trigger Event: jcb_ce_onBeforeBuildFields // Trigger Event: jcb_ce_onBeforeBuildFields
CFactory::_('Event')->trigger( CFactory::_('Event')->trigger(
'jcb_ce_onBeforeBuildFields', 'jcb_ce_onBeforeBuildFields',
array(&$this->componentContext, &$dynamicFieldsXML, &$readOnlyXML, array(&$component_context, &$dynamicFieldsXML, &$readOnlyXML,
&$dbkey, &$view, &$component, &$nameSingleCode, &$dbkey, &$view, &$component, &$nameSingleCode,
&$nameListCode, &$placeholders, &$langView, &$nameListCode, &$placeholders, &$langView,
&$langViews) &$langViews)
@ -1048,7 +1050,7 @@ class Fields extends Structure
// Trigger Event: jcb_ce_onAfterBuildFields // Trigger Event: jcb_ce_onAfterBuildFields
CFactory::_('Event')->trigger( CFactory::_('Event')->trigger(
'jcb_ce_onAfterBuildFields', 'jcb_ce_onAfterBuildFields',
array(&$this->componentContext, &$dynamicFieldsXML, &$readOnlyXML, array(&$component_context, &$dynamicFieldsXML, &$readOnlyXML,
&$dbkey, &$view, &$component, &$nameSingleCode, &$dbkey, &$view, &$component, &$nameSingleCode,
&$nameListCode, &$placeholders, &$langView, &$nameListCode, &$placeholders, &$langView,
&$langViews) &$langViews)
@ -3947,6 +3949,8 @@ class Fields extends Structure
$field['order_edit'] $field['order_edit']
= $this->zeroOrderFix[$nameSingleCode][(int) $field['tab']]; = $this->zeroOrderFix[$nameSingleCode][(int) $field['tab']];
} }
// get the default fields
$default_fields = CFactory::_('Config')->default_fields;
// now build the layout // now build the layout
if (StringHelper::check($tabName) if (StringHelper::check($tabName)
&& strtolower($tabName) != 'publishing') && strtolower($tabName) != 'publishing')
@ -3971,7 +3975,7 @@ class Fields extends Structure
= $name; = $name;
} }
// check if default fields were over written // check if default fields were over written
if (in_array($name, $this->defaultFields)) if (in_array($name, $default_fields))
{ {
// just to eliminate // just to eliminate
$this->movedPublishingFields[$nameSingleCode][$name] = $name; $this->movedPublishingFields[$nameSingleCode][$name] = $name;
@ -3979,7 +3983,7 @@ class Fields extends Structure
} }
elseif ($tabName === 'publishing' || $tabName === 'Publishing') 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']])) if (isset($this->newPublishingFields[$nameSingleCode][(int) $field['alignment']][(int) $field['order_edit']]))
{ {
@ -4021,7 +4025,7 @@ class Fields extends Structure
= $name; = $name;
} }
// check if default fields were over written // check if default fields were over written
if (in_array($name, $this->defaultFields)) if (in_array($name, $default_fields))
{ {
// just to eliminate // just to eliminate
$this->movedPublishingFields[$nameSingleCode][$name] = $name; $this->movedPublishingFields[$nameSingleCode][$name] = $name;
@ -4045,12 +4049,10 @@ class Fields extends Structure
$decode = array('json', 'base64', 'basic_encryption', $decode = array('json', 'base64', 'basic_encryption',
'whmcs_encryption', 'medium_encryption', 'expert_mode'); 'whmcs_encryption', 'medium_encryption', 'expert_mode');
$textareas = array('textarea', 'editor'); $textareas = array('textarea', 'editor');
if (isset($this->siteFields[$view][$field]) if (($site_fields = CFactory::_('Registry')->
&& ArrayHelper::check( extract('builder.site_fields.' . $view . '.' . $field)) !== null)
$this->siteFields[$view][$field]
))
{ {
foreach ($this->siteFields[$view][$field] as $codeString => $array) foreach ($site_fields as $codeString => $site_field)
{ {
// get the code array // get the code array
$codeArray = explode('___', (string) $codeString); $codeArray = explode('___', (string) $codeString);
@ -4059,40 +4061,40 @@ class Fields extends Structure
// set the decoding methods // set the decoding methods
if (in_array($set, $decode)) if (in_array($set, $decode))
{ {
if (isset($this->siteFieldData['decode'][$array['site']][$code][$array['as']][$array['key']]) if (isset($this->siteFieldData['decode'][$site_field->site][$code][$site_field->as][$site_field->key])
&& isset($this->siteFieldData['decode'][$array['site']][$code][$array['as']][$array['key']]['decode'])) && isset($this->siteFieldData['decode'][$site_field->site][$code][$site_field->as][$site_field->key]['decode']))
{ {
if (!in_array( if (!in_array(
$set, $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; = $set;
} }
} }
else else
{ {
$this->siteFieldData['decode'][$array['site']][$code][$array['as']][$array['key']] $this->siteFieldData['decode'][$site_field->site][$code][$site_field->as][$site_field->key]
= array('decode' => array($set), = array('decode' => [$set],
'type' => $type, 'type' => $type,
'admin_view' => $view); 'admin_view' => $view);
} }
} }
// set the uikit checker // set the uikit checker
if ((2 == $this->uikit || 1 == $this->uikit) if ((2 == CFactory::_('Config')->uikit || 1 == CFactory::_('Config')->uikit)
&& in_array( && in_array(
$type, $textareas $type, $textareas
)) ))
{ {
$this->siteFieldData['uikit'][$array['site']][$code][$array['as']][$array['key']] $this->siteFieldData['uikit'][$site_field->site][$code][$site_field->as][$site_field->key]
= $array; = (array) $site_field;
} }
// set the textareas checker // set the textareas checker
if (in_array($type, $textareas)) if (in_array($type, $textareas))
{ {
$this->siteFieldData['textareas'][$array['site']][$code][$array['as']][$array['key']] $this->siteFieldData['textareas'][$site_field->site][$code][$site_field->as][$site_field->key]
= $array; = (array) $site_field;
} }
} }
} }
@ -4863,10 +4865,12 @@ class Fields extends Structure
} }
$this->intFieldsBuilder[$nameSingleCode] .= ',"' . $name . '"'; $this->intFieldsBuilder[$nameSingleCode] .= ',"' . $name . '"';
} }
// Get the default fields
$default_fields = CFactory::_('Config')->default_fields;
// set all dynamic field of this view // set all dynamic field of this view
if ($dbSwitch && $typeName != 'category' && $typeName != 'repeatable' if ($dbSwitch && $typeName != 'category' && $typeName != 'repeatable'
&& $typeName != 'subform' && $typeName != 'subform'
&& !in_array($name, $this->defaultFields)) && !in_array($name, $default_fields))
{ {
if (!isset($this->dynamicfieldsBuilder[$nameSingleCode])) if (!isset($this->dynamicfieldsBuilder[$nameSingleCode]))
{ {
@ -5188,8 +5192,8 @@ class Fields extends Structure
// add the language only for new filter option // add the language only for new filter option
$filter_name_asc_lang = ''; $filter_name_asc_lang = '';
$filter_name_desc_lang = ''; $filter_name_desc_lang = '';
if (isset($this->adminFilterType[$nameListCode]) if (CFactory::_('Registry')->
&& $this->adminFilterType[$nameListCode] == 2) get('builder.admin_filter_type.' . $nameListCode, 1) == 2)
{ {
// set the language strings for ascending // set the language strings for ascending
$filter_name_asc = $listFieldName . ' ascending'; $filter_name_asc = $listFieldName . ' ascending';
@ -5248,8 +5252,8 @@ class Fields extends Structure
); );
// add the language only for new filter option // add the language only for new filter option
$filter_name_select_lang = ''; $filter_name_select_lang = '';
if (isset($this->adminFilterType[$nameListCode]) if (CFactory::_('Registry')->
&& $this->adminFilterType[$nameListCode] == 2) get('builder.admin_filter_type.' . $nameListCode, 1) == 2)
{ {
// set the language strings for selection // set the language strings for selection
$filter_name_select = 'Select ' . $listFieldName; $filter_name_select = 'Select ' . $listFieldName;
@ -5734,8 +5738,8 @@ class Fields extends Structure
public function setFieldFilterSet(&$nameSingleCode, &$nameListCode) public function setFieldFilterSet(&$nameSingleCode, &$nameListCode)
{ {
// check if this is the above/new filter option // check if this is the above/new filter option
if (isset($this->adminFilterType[$nameListCode]) if (CFactory::_('Registry')->
&& $this->adminFilterType[$nameListCode] == 2) get('builder.admin_filter_type.' . $nameListCode, 1) == 2)
{ {
// we first create the file // we first create the file
$target = array('admin' => 'filter_' . $nameListCode); $target = array('admin' => 'filter_' . $nameListCode);
@ -5930,8 +5934,8 @@ class Fields extends Structure
public function setFieldFilterListSet(&$nameSingleCode, &$nameListCode) public function setFieldFilterListSet(&$nameSingleCode, &$nameListCode)
{ {
// check if this is the above/new filter option // check if this is the above/new filter option
if (isset($this->adminFilterType[$nameListCode]) if (CFactory::_('Registry')->
&& $this->adminFilterType[$nameListCode] == 2) get('builder.admin_filter_type.' . $nameListCode, 1) == 2)
{ {
// keep track of all fields already added // keep track of all fields already added
$donelist = array('ordering' => true, 'id' => true); $donelist = array('ordering' => true, 'id' => true);
@ -6437,11 +6441,11 @@ class Fields extends Structure
return $this->xmlIndent((string) $tidy, ' ', 8, true, false); return $this->xmlIndent((string) $tidy, ' ', 8, true, false);
} }
// set tidy waring atleast once // set tidy waring only once
elseif (!$this->setTidyWarning) elseif (CFactory::_('Config')->set_tidy_warning)
{ {
// set the warning only once // set the warning only once
$this->setTidyWarning = true; CFactory::_('Config')->set('set_tidy_warning', false);
// now set the warning // now set the warning
$this->app->enqueueMessage( $this->app->enqueueMessage(
JText::_('<hr /><h3>Tidy Error</h3>'), 'Error' JText::_('<hr /><h3>Tidy Error</h3>'), 'Error'

File diff suppressed because it is too large Load Diff

View File

@ -82,10 +82,11 @@ class Infusion extends Interpretation
$placeholders = CFactory::_('Placeholder')->active; $placeholders = CFactory::_('Placeholder')->active;
$fileContentStatic = CFactory::_('Content')->active; $fileContentStatic = CFactory::_('Content')->active;
$fileContentDynamic = CFactory::_('Content')->_active; $fileContentDynamic = CFactory::_('Content')->_active;
$component_context = CFactory::_('Config')->component_context;
// Trigger Event: jcb_ce_onBeforeBuildFilesContent // Trigger Event: jcb_ce_onBeforeBuildFilesContent
CFactory::_('Event')->trigger( CFactory::_('Event')->trigger(
'jcb_ce_onBeforeBuildFilesContent', 'jcb_ce_onBeforeBuildFilesContent',
array(&$this->componentContext, &$this->componentData, array(&$component_context, &$this->componentData,
&$fileContentStatic, &$fileContentDynamic, &$fileContentStatic, &$fileContentDynamic,
&$placeholders, &$this->hhh) &$placeholders, &$this->hhh)
); );
@ -365,7 +366,7 @@ class Infusion extends Interpretation
// Trigger Event: jcb_ce_onBeforeBuildAdminEditViewContent // Trigger Event: jcb_ce_onBeforeBuildAdminEditViewContent
CFactory::_('Event')->trigger( CFactory::_('Event')->trigger(
'jcb_ce_onBeforeBuildAdminEditViewContent', 'jcb_ce_onBeforeBuildAdminEditViewContent',
array(&$this->componentContext, &$view, array(&$component_context, &$view,
&$nameSingleCode, &$nameSingleCode,
&$nameListCode, &$nameListCode,
&$fileContentStatic, &$fileContentStatic,
@ -579,7 +580,7 @@ class Infusion extends Interpretation
// Trigger Event: jcb_ce_onAfterBuildAdminEditViewContent // Trigger Event: jcb_ce_onAfterBuildAdminEditViewContent
CFactory::_('Event')->trigger( CFactory::_('Event')->trigger(
'jcb_ce_onAfterBuildAdminEditViewContent', 'jcb_ce_onAfterBuildAdminEditViewContent',
array(&$this->componentContext, &$view, array(&$component_context, &$view,
&$nameSingleCode, &$nameSingleCode,
&$nameListCode, &$nameListCode,
&$fileContentStatic, &$fileContentStatic,
@ -606,7 +607,7 @@ class Infusion extends Interpretation
// Trigger Event: jcb_ce_onBeforeBuildAdminListViewContent // Trigger Event: jcb_ce_onBeforeBuildAdminListViewContent
CFactory::_('Event')->trigger( CFactory::_('Event')->trigger(
'jcb_ce_onBeforeBuildAdminListViewContent', 'jcb_ce_onBeforeBuildAdminListViewContent',
array(&$this->componentContext, &$view, array(&$component_context, &$view,
&$nameSingleCode, &$nameSingleCode,
&$nameListCode, &$nameListCode,
&$fileContentStatic, &$fileContentStatic,
@ -876,7 +877,7 @@ class Infusion extends Interpretation
// Trigger Event: jcb_ce_onAfterBuildAdminListViewContent // Trigger Event: jcb_ce_onAfterBuildAdminListViewContent
CFactory::_('Event')->trigger( CFactory::_('Event')->trigger(
'jcb_ce_onAfterBuildAdminListViewContent', 'jcb_ce_onAfterBuildAdminListViewContent',
array(&$this->componentContext, &$view, array(&$component_context, &$view,
&$nameSingleCode, &$nameSingleCode,
&$nameListCode, &$nameListCode,
&$fileContentStatic, &$fileContentStatic,
@ -1021,7 +1022,7 @@ class Infusion extends Interpretation
// Trigger Event: jcb_ce_onAfterBuildAdminViewContent // Trigger Event: jcb_ce_onAfterBuildAdminViewContent
CFactory::_('Event')->trigger( CFactory::_('Event')->trigger(
'jcb_ce_onAfterBuildAdminViewContent', 'jcb_ce_onAfterBuildAdminViewContent',
array(&$this->componentContext, &$view, array(&$component_context, &$view,
&$nameSingleCode, &$nameSingleCode,
&$nameListCode, &$nameListCode,
&$fileContentStatic, &$fileContentStatic,
@ -1088,7 +1089,7 @@ class Infusion extends Interpretation
// Trigger Event: jcb_ce_onBeforeBuildCustomAdminViewContent // Trigger Event: jcb_ce_onBeforeBuildCustomAdminViewContent
CFactory::_('Event')->trigger( CFactory::_('Event')->trigger(
'jcb_ce_onBeforeBuildCustomAdminViewContent', 'jcb_ce_onBeforeBuildCustomAdminViewContent',
array(&$this->componentContext, &$view, array(&$component_context, &$view,
&$view['settings']->code, &$view['settings']->code,
&$fileContentStatic, &$fileContentStatic,
&$fileContentDynamic[$view['settings']->code], &$fileContentDynamic[$view['settings']->code],
@ -1255,7 +1256,7 @@ class Infusion extends Interpretation
// Trigger Event: jcb_ce_onAfterBuildCustomAdminViewContent // Trigger Event: jcb_ce_onAfterBuildCustomAdminViewContent
CFactory::_('Event')->trigger( CFactory::_('Event')->trigger(
'jcb_ce_onAfterBuildCustomAdminViewContent', 'jcb_ce_onAfterBuildCustomAdminViewContent',
array(&$this->componentContext, &$view, array(&$component_context, &$view,
&$view['settings']->code, &$view['settings']->code,
&$fileContentStatic, &$fileContentStatic,
&$fileContentDynamic[$view['settings']->code], &$fileContentDynamic[$view['settings']->code],
@ -1364,7 +1365,7 @@ class Infusion extends Interpretation
} }
// add import // add import
if (isset($this->addEximport) && $this->addEximport) if (CFactory::_('Config')->get('add_eximport', false))
{ {
// setup import files // setup import files
$target = array('admin' => 'import'); $target = array('admin' => 'import');
@ -1384,7 +1385,7 @@ class Infusion extends Interpretation
} }
// ensure that the ajax model and controller is set if needed // 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 // setup Ajax files
$target = array('admin' => 'ajax'); $target = array('admin' => 'ajax');
@ -1399,7 +1400,7 @@ class Infusion extends Interpretation
} }
// ensure that the site ajax model and controller is set if needed // 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 // setup Ajax files
$target = array('site' => 'ajax'); $target = array('site' => 'ajax');
@ -1486,7 +1487,7 @@ class Infusion extends Interpretation
// Trigger Event: jcb_ce_onBeforeBuildSiteViewContent // Trigger Event: jcb_ce_onBeforeBuildSiteViewContent
CFactory::_('Event')->trigger( CFactory::_('Event')->trigger(
'jcb_ce_onBeforeBuildSiteViewContent', 'jcb_ce_onBeforeBuildSiteViewContent',
array(&$this->componentContext, &$view, array(&$component_context, &$view,
&$view['settings']->code, &$view['settings']->code,
&$fileContentStatic, &$fileContentStatic,
&$fileContentDynamic[$view['settings']->code], &$fileContentDynamic[$view['settings']->code],
@ -1680,7 +1681,7 @@ class Infusion extends Interpretation
// Trigger Event: jcb_ce_onAfterBuildSiteViewContent // Trigger Event: jcb_ce_onAfterBuildSiteViewContent
CFactory::_('Event')->trigger( CFactory::_('Event')->trigger(
'jcb_ce_onAfterBuildSiteViewContent', 'jcb_ce_onAfterBuildSiteViewContent',
array(&$this->componentContext, &$view, array(&$component_context, &$view,
&$view['settings']->code, &$view['settings']->code,
&$fileContentStatic, &$fileContentStatic,
&$fileContentDynamic[$view['settings']->code], &$fileContentDynamic[$view['settings']->code],
@ -1817,7 +1818,7 @@ class Infusion extends Interpretation
// Trigger Event: jcb_ce_onBeforeInfuseModuleData // Trigger Event: jcb_ce_onBeforeInfuseModuleData
CFactory::_('Event')->trigger( CFactory::_('Event')->trigger(
'jcb_ce_onBeforeInfuseModuleData', 'jcb_ce_onBeforeInfuseModuleData',
array(&$this->componentContext, &$module, &$this) array(&$component_context, &$module, &$this)
); );
CFactory::_('Config')->build_target = $module->key; CFactory::_('Config')->build_target = $module->key;
CFactory::_('Config')->lang_target = $module->key; CFactory::_('Config')->lang_target = $module->key;
@ -1870,7 +1871,7 @@ class Infusion extends Interpretation
// Trigger Event: jcb_ce_onAfterInfuseModuleData // Trigger Event: jcb_ce_onAfterInfuseModuleData
CFactory::_('Event')->trigger( CFactory::_('Event')->trigger(
'jcb_ce_onAfterInfuseModuleData', '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 // Trigger Event: jcb_ce_onBeforeInfusePluginData
CFactory::_('Event')->trigger( CFactory::_('Event')->trigger(
'jcb_ce_onBeforeInfusePluginData', 'jcb_ce_onBeforeInfusePluginData',
array(&$this->componentContext, &$plugin, &$this) array(&$component_context, &$plugin, &$this)
); );
CFactory::_('Config')->build_target = $plugin->key; CFactory::_('Config')->build_target = $plugin->key;
CFactory::_('Config')->lang_target = $plugin->key; CFactory::_('Config')->lang_target = $plugin->key;
@ -1927,7 +1928,7 @@ class Infusion extends Interpretation
// Trigger Event: jcb_ce_onAfterInfusePluginData // Trigger Event: jcb_ce_onAfterInfusePluginData
CFactory::_('Event')->trigger( CFactory::_('Event')->trigger(
'jcb_ce_onAfterInfusePluginData', '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 // Trigger Event: jcb_ce_onAfterBuildFilesContent
CFactory::_('Event')->trigger( CFactory::_('Event')->trigger(
'jcb_ce_onAfterBuildFilesContent', 'jcb_ce_onAfterBuildFilesContent',
array(&$this->componentContext, &$this->componentData, array(&$component_context, &$this->componentData,
&$fileContentStatic, &$this->fileContentDynamic, &$fileContentStatic, &$this->fileContentDynamic,
&$placeholders, &$this->hhh) &$placeholders, &$this->hhh)
); );
@ -2099,10 +2100,12 @@ class Infusion extends Interpretation
$this->purgeLanuageStrings($values, CFactory::_('Config')->component_id); $this->purgeLanuageStrings($values, CFactory::_('Config')->component_id);
// path to INI file // path to INI file
$getPAth = $this->templatePath . '/en-GB.com_admin.ini'; $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 // Trigger Event: jcb_ce_onBeforeBuildAllLangFiles
CFactory::_('Event')->trigger( CFactory::_('Event')->trigger(
'jcb_ce_onBeforeBuildAllLangFiles', 'jcb_ce_onBeforeBuildAllLangFiles',
array(&$this->componentContext, &$this->languages['components'], array(&$component_context, &$this->languages['components'],
&$this->langTag) &$this->langTag)
); );
// for plugin event TODO change event api signatures // for plugin event TODO change event api signatures

View File

@ -2213,7 +2213,7 @@ INSERT INTO `#__componentbuilder_field` (`id`, `add_css_view`, `add_css_views`,
(199, '', '', '', '', '', '', '', '', 255, '', 'VARCHAR', 2, '', '', 'Name', 'NOT NULL', '', 24, '\"<field\\r\\n\\ttype=\\\"text\\\" \\r\\n\\tname=\\\"name\\\" \\r\\n\\tlabel=\\\"Name\\\" \\r\\n\\tsize=\\\"40\\\" \\r\\n\\tmaxlength=\\\"150\\\" \\r\\n\\tdescription=\\\"Enter Name Here\\\" \\r\\n\\tclass=\\\"text_area\\\" \\r\\n\\treadonly=\\\"false\\\" \\r\\n\\tdisabled=\\\"false\\\" \\r\\n\\trequired=\\\"true\\\"\\r\\n\\tfilter=\\\"STRING\\\" \\r\\n\\tmessage=\\\"Error! Please add name here.\\\" \\r\\n\\thint=\\\"Name Here\\\" \\r\\n\\/>\"', 1, '2015-03-19 17:30:59', '2022-09-21 10:17:10', 8, '', 4, '5d3d34dd-4876-4c6a-86ab-b4e162f22c08'), (199, '', '', '', '', '', '', '', '', 255, '', 'VARCHAR', 2, '', '', 'Name', 'NOT NULL', '', 24, '\"<field\\r\\n\\ttype=\\\"text\\\" \\r\\n\\tname=\\\"name\\\" \\r\\n\\tlabel=\\\"Name\\\" \\r\\n\\tsize=\\\"40\\\" \\r\\n\\tmaxlength=\\\"150\\\" \\r\\n\\tdescription=\\\"Enter Name Here\\\" \\r\\n\\tclass=\\\"text_area\\\" \\r\\n\\treadonly=\\\"false\\\" \\r\\n\\tdisabled=\\\"false\\\" \\r\\n\\trequired=\\\"true\\\"\\r\\n\\tfilter=\\\"STRING\\\" \\r\\n\\tmessage=\\\"Error! Please add name here.\\\" \\r\\n\\thint=\\\"Name Here\\\" \\r\\n\\/>\"', 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, '\"<field\\n\\ttype=\\\"hidden\\\"\\n\\tname=\\\"not_required\\\"\\n\\tdefault=\\\"\\u4e00_\\u4e00\\\"\\n\\/>\"', 1, '2015-05-08 16:19:16', '2020-02-27 20:17:33', 13, '', 19, 'da5e6901-6958-40e5-a4f5-6822d6fe57ac'), (203, '', '', '', '', '', '', '', '', 1, '', 'INT', '', '', '', 'Not Required', 'NOT NULL', '', 9, '\"<field\\n\\ttype=\\\"hidden\\\"\\n\\tname=\\\"not_required\\\"\\n\\tdefault=\\\"\\u4e00_\\u4e00\\\"\\n\\/>\"', 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, '\"<field\\n\\ttype=\\\"url\\\"\\n\\tname=\\\"website\\\"\\n\\tlabel=\\\"Website\\\"\\n\\tsize=\\\"60\\\"\\n\\tmaxlength=\\\"150\\\"\\n\\tdescription=\\\"Enter website address\\\"\\n\\tclass=\\\"text_area\\\"\\n\\tfilter=\\\"url\\\"\\n\\tvalidated=\\\"url\\\"\\n\\tmessage=\\\"Error! Please add website here.\\\"\\n\\thint=\\\"http:\\/\\/www.example.com\\\"\\n\\tscheme=\\\"http,https\\\"\\n\\/>\"', 1, '2015-04-08 00:36:16', '2018-07-08 00:11:05', 2, '', 105, '6c3a6983-d1bf-4e5e-9e99-deea00b0cefd'), (280, '', '', '', '', '', '', '', '', 255, '', 'VARCHAR', '', '', '', 'Website', 'NOT NULL', '', 27, '\"<field\\n\\ttype=\\\"url\\\"\\n\\tname=\\\"website\\\"\\n\\tlabel=\\\"Website\\\"\\n\\tsize=\\\"60\\\"\\n\\tmaxlength=\\\"150\\\"\\n\\tdescription=\\\"Enter website address\\\"\\n\\tclass=\\\"text_area\\\"\\n\\tfilter=\\\"url\\\"\\n\\tvalidated=\\\"url\\\"\\n\\tmessage=\\\"Error! Please add website here.\\\"\\n\\thint=\\\"http:\\/\\/www.example.com\\\"\\n\\tscheme=\\\"http,https\\\"\\n\\/>\"', 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, '\"<field \\r\\n\\ttype=\\\"radio\\\" \\r\\n\\tname=\\\"add\\\" \\r\\n\\tlabel=\\\"Add More\\\" \\r\\n\\tdescription=\\\"\\\" \\r\\n\\tclass=\\\"btn-group btn-group-yesno\\\" \\r\\n\\toption=\\\"1|Yes,0|No\\\" \\r\\n\\tdefault=\\\"0\\\" \\r\\n\\trequired=\\\"true\\\" \\r\\n\\/>\"', 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, '\"<field\\n\\ttype=\\\"radio\\\"\\n\\tname=\\\"add\\\"\\n\\tlabel=\\\"Add More\\\"\\n\\tdescription=\\\"\\\"\\n\\tclass=\\\"btn-group btn-group-yesno\\\"\\n\\toption=\\\"1|Yes,0|No\\\"\\n\\tdefault=\\\"0\\\"\\n\\trequired=\\\"true\\\"\\n\\/>\"', 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, '\"<field\\n\\ttype=\\\"calendar\\\"\\n\\tname=\\\"dateofbirth\\\"\\n\\tlabel=\\\"Date of Birth\\\"\\n\\tdefault=\\\"1970-01-01\\\"\\n\\tdescription=\\\"Your date of birth\\\"\\n\\tformat=\\\"%Y-%m-%d\\\"\\n\\tminyear=\\\"-120\\\"\\n\\tmaxyear=\\\"-1\\\"\\n\\tfilter=\\\"STRING\\\"\\n\\ttodaybutton=\\\"false\\\"\\n\\trequired=\\\"true\\\"\\n\\/>\"', 1, '2015-12-07 01:47:32', '2018-08-03 09:56:07', 4, '', 649, 'cb2bdf20-8800-407b-a4f6-250152a0bdfb'); (1011, '', '', '', '', '', '', 'Other', '0000-00-00', '', '', 'DATE', '', '', '', 'Date of Birth', 'NOT NULL', '', 1, '\"<field\\n\\ttype=\\\"calendar\\\"\\n\\tname=\\\"dateofbirth\\\"\\n\\tlabel=\\\"Date of Birth\\\"\\n\\tdefault=\\\"1970-01-01\\\"\\n\\tdescription=\\\"Your date of birth\\\"\\n\\tformat=\\\"%Y-%m-%d\\\"\\n\\tminyear=\\\"-120\\\"\\n\\tmaxyear=\\\"-1\\\"\\n\\tfilter=\\\"STRING\\\"\\n\\ttodaybutton=\\\"false\\\"\\n\\trequired=\\\"true\\\"\\n\\/>\"', 1, '2015-12-07 01:47:32', '2018-08-03 09:56:07', 4, '', 649, 'cb2bdf20-8800-407b-a4f6-250152a0bdfb');
-- --

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="4" method="upgrade"> <extension type="component" version="4" method="upgrade">
<name>COM_COMPONENTBUILDER</name> <name>COM_COMPONENTBUILDER</name>
<creationDate>8th January, 2023</creationDate> <creationDate>15th January, 2023</creationDate>
<author>Llewellyn van der Merwe</author> <author>Llewellyn van der Merwe</author>
<authorEmail>joomla@vdm.io</authorEmail> <authorEmail>joomla@vdm.io</authorEmail>
<authorUrl>https://dev.vdm.io</authorUrl> <authorUrl>https://dev.vdm.io</authorUrl>

View File

@ -32,7 +32,7 @@ abstract class BaseConfig extends JoomlaRegistry
* @var Input * @var Input
* @since 3.2.0 * @since 3.2.0
*/ */
protected $input; protected Input $input;
/** /**
* The Params * The Params
@ -66,12 +66,12 @@ abstract class BaseConfig extends JoomlaRegistry
/** /**
* setting any config value * 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. * @param mixed $value Optional default value, returned if the internal value is null.
* *
* @since 3.2.0 * @since 3.2.0
*/ */
public function __set($key, $value) public function __set(string $key, $value)
{ {
$this->set($key, $value); $this->set($key, $value);
} }
@ -79,12 +79,12 @@ abstract class BaseConfig extends JoomlaRegistry
/** /**
* getting any valid value * 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 * @since 3.2.0
* @throws \InvalidArgumentException If $key is not a valid function name. * @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 // check if it has been set
if (($value = $this->get($key, '__N0T_S3T_Y3T_')) !== '__N0T_S3T_Y3T_') if (($value = $this->get($key, '__N0T_S3T_Y3T_')) !== '__N0T_S3T_Y3T_')
@ -98,7 +98,7 @@ abstract class BaseConfig extends JoomlaRegistry
/** /**
* Get a config value. * 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. * @param mixed $default Optional default value, returned if the internal value is null.
* *
* @return mixed Value of entry or null * @return mixed Value of entry or null
@ -117,7 +117,7 @@ abstract class BaseConfig extends JoomlaRegistry
} }
elseif (method_exists($this, $method)) elseif (method_exists($this, $method))
{ {
$value = $this->{$method}(); $value = $this->{$method}($default);
$this->set($path, $value); $this->set($path, $value);

View File

@ -12,6 +12,8 @@
namespace VDM\Joomla\Componentbuilder\Compiler; 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\GetHelper;
use VDM\Joomla\Utilities\StringHelper; use VDM\Joomla\Utilities\StringHelper;
use VDM\Joomla\Componentbuilder\Abstraction\BaseConfig; use VDM\Joomla\Componentbuilder\Abstraction\BaseConfig;
@ -20,10 +22,85 @@ use VDM\Joomla\Componentbuilder\Abstraction\BaseConfig;
/** /**
* Compiler Configurations * 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 * @since 3.2.0
*/ */
class Config extends BaseConfig 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 * get posted component id
* *
@ -35,6 +112,17 @@ class Config extends BaseConfig
return $this->input->post->get('component_id', 0, 'INT'); 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 * get components code name
* *
@ -84,6 +172,20 @@ class Config extends BaseConfig
return $this->input->post->get('joomla_version', 3, 'INT'); 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 * get posted Joomla version name
* *
@ -95,6 +197,17 @@ class Config extends BaseConfig
return StringHelper::safe($this->joomla_version); 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 * get indentation value
* *
@ -138,15 +251,12 @@ class Config extends BaseConfig
{ {
// get posted value // get posted value
$value = $this->input->post->get('debug_line_nr', 2, 'INT'); $value = $this->input->post->get('debug_line_nr', 2, 'INT');
// get global value
// get active value if ($value > 1)
$add = ($value == 0) ? false : ( {
($value == 1) ? true : ( return (int) GetHelper::var('joomla_component', $this->component_id, 'id', 'debug_linenr');
((int) GetHelper::var('joomla_component', $this->component_id, 'id', 'debug_linenr' ) == 1) ? true : false }
) return $value;
);
return $add;
} }
/** /**
@ -157,12 +267,11 @@ class Config extends BaseConfig
*/ */
protected function getMinify(): int protected function getMinify(): int
{ {
// get posted value
$minify = $this->input->post->get('minify', 2, 'INT'); $minify = $this->input->post->get('minify', 2, 'INT');
// if value is 2 use global value // if value is 2 use global value
$minify = ($minify != 2) ? $minify : $this->params->get('minify', 0); return ($minify != 2) ? $minify : $this->params->get('minify', 0);
return $minify;
} }
/** /**
@ -173,16 +282,14 @@ class Config extends BaseConfig
*/ */
protected function getRemovelinebreaks(): bool protected function getRemovelinebreaks(): bool
{ {
$value = 2; // 2 is global (use the components value) TODO: get from post // get posted value
$value = $this->input->post->get('remove_line_breaks', 2, 'INT');
// get active value // get global
$remove = ($value == 0) ? false : ( if ($value > 1)
($value == 1) ? true : ( {
((int) GetHelper::var('joomla_component', $this->component_id, 'id', 'remove_line_breaks' ) == 1) ? true : false return (bool) GetHelper::var('joomla_component', $this->component_id, 'id', 'remove_line_breaks');
) }
); return (bool) $value;
return $remove;
} }
/** /**
@ -197,6 +304,30 @@ class Config extends BaseConfig
return \extension_loaded('Tidy'); 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 * get language tag
* *
@ -280,6 +411,31 @@ class Config extends BaseConfig
); );
} }
/**
* 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 * get compiler path
* *
@ -307,6 +463,18 @@ class Config extends BaseConfig
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';
}
/** /**
* get switch to add assets table fix * get switch to add assets table fix
* *
@ -321,12 +489,50 @@ class Config extends BaseConfig
); );
// get component value // 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', 'joomla_component', $this->component_id, 'id',
'assets_table_fix' 'assets_table_fix'
)) == 3) ? $global : $add_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 // get posted value
$value = $this->input->post->get('add_placeholders', 2, 'INT'); $value = $this->input->post->get('add_placeholders', 2, 'INT');
// get global value
// get active value if ($value > 1)
$add = ($value == 0) ? false : ( {
($value == 1) ? true : ( return (bool) GetHelper::var('joomla_component', $this->component_id, 'id', 'add_placeholders');
((int) GetHelper::var('joomla_component', $this->component_id, 'id', 'add_placeholders' ) == 1) ? true : false }
) return (bool) $value;
);
return $add;
} }
/** /**
@ -360,15 +563,12 @@ class Config extends BaseConfig
{ {
// get posted value // get posted value
$value = $this->input->post->get('powers', 2, 'INT'); $value = $this->input->post->get('powers', 2, 'INT');
// get global value
// get active value if ($value > 1)
$add = ($value == 0) ? false : ( {
($value == 1) ? true : ( return (bool) GetHelper::var('joomla_component', $this->component_id, 'id', 'add_powers');
((int) GetHelper::var('joomla_component', $this->component_id, 'id', 'add_powers' ) == 1) ? true : false }
) return (bool) $value;
);
return $add;
} }
/** /**
@ -384,6 +584,17 @@ class Config extends BaseConfig
return 'admin'; 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 * get basic encryption switch
* *
@ -439,5 +650,49 @@ class Config extends BaseConfig
return true; 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
}
} }