Initial move of configuration to its own class and factory. #951

This commit is contained in:
Llewellyn van der Merwe 2022-08-21 19:21:03 +02:00
parent e7500b76eb
commit f8ac247377
Signed by: Llewellyn
GPG Key ID: A9201372263741E7
17 changed files with 885 additions and 466 deletions

View File

@ -140,13 +140,13 @@ 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*: 20th August, 2022
+ *Last Build*: 21st August, 2022
+ *Version*: 3.1.5
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **311846**
+ *Line count*: **312270**
+ *Field count*: **2002**
+ *File count*: **2055**
+ *File count*: **2057**
+ *Folder count*: **351**
> This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](http://joomlacomponentbuilder.com).

View File

@ -140,13 +140,13 @@ 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*: 20th August, 2022
+ *Last Build*: 21st August, 2022
+ *Version*: 3.1.5
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **311846**
+ *Line count*: **312270**
+ *Field count*: **2002**
+ *File count*: **2055**
+ *File count*: **2057**
+ *Folder count*: **351**
> This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](http://joomlacomponentbuilder.com).

View File

@ -20,6 +20,7 @@ use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use VDM\Joomla\Utilities\FileHelper;
use VDM\Joomla\Utilities\MathHelper;
use VDM\Joomla\Componentbuilder\Factory\Compiler\Config;
// Use the component builder autoloader
ComponentbuilderHelper::autoLoader();
@ -183,7 +184,7 @@ class Compiler extends Infusion
'because more then %s% of the strings have been translated.',
$this->percentageLanguageAdd
);
if ($this->debugLinenr)
if (Config::get('debug_line_nr', false))
{
$whyAddedLang = JText::_(
'because the debugging mode is on. (debug line numbers)'
@ -214,12 +215,12 @@ class Compiler extends Infusion
'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.'
);
// set assets table rules column notice
if ($this->addAssetsTableFix)
if (Config::get('add_assets_table_fix'))
{
$this->app->enqueueMessage(
JText::_('<hr /><h3>Assets Table Notice</h3>'), 'Notice'
);
$asset_table_fix_type = ($this->addAssetsTableFix == 2)
$asset_table_fix_type = (Config::get('add_assets_table_fix') == 2)
? 'intelligent' : 'sql';
$this->app->enqueueMessage(
JText::sprintf(
@ -244,7 +245,7 @@ class Compiler extends Infusion
);
}
// set assets table name column warning if not set
if (!$this->addAssetsTableFix && $this->addAssetsTableNameFix)
if (!Config::get('add_assets_table_fix') && $this->addAssetsTableNameFix)
{
// only add if not already added
if ($this->accessSize < 30)
@ -322,7 +323,7 @@ class Compiler extends Infusion
// add the mismatching issues
foreach ($mismatch as $string)
{
$constant = $this->langPrefix . '_'
$constant = Config::get('lang_prefix') . '_'
. StringHelper::safe($string, 'U');
$this->app->enqueueMessage(
JText::sprintf(
@ -374,7 +375,7 @@ class Compiler extends Infusion
*/
private function setLine($nr)
{
if ($this->debugLinenr)
if (Config::get('debug_line_nr', false))
{
return ' [Compiler ' . $nr . ']';
}
@ -994,7 +995,7 @@ class Compiler extends Infusion
// set the repo path
$repoFullPath = $this->repoPath . '/com_'
. $this->componentData->sales_name . '__joomla_'
. $this->joomlaVersion;
. Config::get('version', 3);
// Trigger Event: jcb_ce_onBeforeUpdateRepo
$this->triggerEvent(
'jcb_ce_onBeforeUpdateRepo',
@ -1025,7 +1026,7 @@ class Compiler extends Infusion
// set the repo path
$repoFullPath = $this->repoPath . '/'
. $module->folder_name . '__joomla_'
. $this->joomlaVersion;
. Config::get('version', 3);
// Trigger Event: jcb_ce_onBeforeUpdateRepo
$this->triggerEvent(
'jcb_ce_onBeforeUpdateRepo',
@ -1062,7 +1063,7 @@ class Compiler extends Infusion
// set the repo path
$repoFullPath = $this->repoPath . '/'
. $plugin->folder_name . '__joomla_'
. $this->joomlaVersion;
. Config::get('version', 3);
// Trigger Event: jcb_ce_onBeforeUpdateRepo
$this->triggerEvent(
'jcb_ce_onBeforeUpdateRepo',

View File

@ -27,6 +27,7 @@ use VDM\Joomla\Utilities\String\TypeHelper;
use VDM\Joomla\Utilities\String\ClassfunctionHelper;
use VDM\Joomla\Utilities\String\NamespaceHelper;
use VDM\Joomla\Utilities\String\PluginHelper;
use VDM\Joomla\Componentbuilder\Factory\Compiler\Config;
/**
* Get class as the main compilers class
@ -38,6 +39,7 @@ class Get
* The Joomla Version
*
* @var string
* @deprecated 4.0 Use Config::get('version');
*/
public $joomlaVersion;
@ -118,6 +120,7 @@ class Get
* The Compiler Path
*
* @var object
* @deprecated 4.0 Use Config::get('compiler_path');
*/
public $compilerPath;
@ -125,6 +128,7 @@ class Get
* The JCB Powers Path
*
* @var object
* @deprecated 4.0 Use Config::get('jcb_powers_path');
*/
public $jcbPowersPath;
@ -132,6 +136,7 @@ class Get
* Switch to add assets table fix
*
* @var int
* @deprecated 4.0 Use Config::get('add_assets_table_fix');
*/
public $addAssetsTableFix = 1;
@ -153,6 +158,7 @@ class Get
* Switch to add custom code placeholders
*
* @var bool
* @deprecated 4.0 Use Config::get('add_placeholders');
*/
public $addPlaceholders = false;
@ -160,6 +166,7 @@ class Get
* Switch to remove line breaks from language strings
*
* @var bool
* @deprecated 4.0 Use Config::get('remove_line_breaks');
*/
public $removeLineBreaks = false;
@ -188,6 +195,7 @@ class Get
* The Switch to add Powers data
*
* @var boolean
* @deprecated 4.0 Use Config::get('add_power');
*/
public $addPower;
@ -334,6 +342,7 @@ class Get
* The line numbers Switch
*
* @var boolean
* @deprecated 4.0 Use Config::get('debug_line_nr');
*/
public $debugLinenr = false;
@ -348,6 +357,7 @@ class Get
* The Placholder Language prefix
*
* @var string
* @deprecated 4.0 Use Config::get('lang_prefix');
*/
public $langPrefix;
@ -371,6 +381,7 @@ class Get
* The Main Languages
*
* @var string
* @deprecated 4.0 Use Config::get('lang_tag');
*/
public $langTag = 'en-GB';
@ -427,13 +438,23 @@ class Get
* The Component Code Name
*
* @var string
* @deprecated 4.0 Use Config::get('component_code_name');
*/
public $componentCodeName;
/**
* The Component Context
*
* @var string
* @deprecated 4.0 Use Config::get('component_context');
*/
public $componentContext;
/**
* The Component Code Name Length
*
* @var int
* @deprecated 4.0 Use Config::get('component_code_name_length');
*/
public $componentCodeNameLength;
@ -441,6 +462,7 @@ class Get
* The Component ID
*
* @var int
* @deprecated 4.0 Use Config::get('component_id');
*/
public $componentID;
@ -668,6 +690,7 @@ class Get
* 2 = SimpleXMLElement
*
* @var int
* @deprecated 4.0 Use Config::get('field_builder_type');
*/
public $fieldBuilderType;
@ -880,6 +903,7 @@ class Get
* Is minify Enabled
*
* @var int
* @deprecated 4.0 Use Config::get('minify');
*/
public $minify = 0;
@ -887,6 +911,7 @@ class Get
* Is Tidy Enabled
*
* @var bool
* @deprecated 4.0 Use Config::get('tidy');
*/
public $tidy = false;
@ -928,8 +953,6 @@ class Get
* Constructor
*/
public function __construct($config = array())
{
if (isset($config) && count($config))
{
// we do not yet have this set as an option
$config['remove_line_breaks']
@ -956,25 +979,24 @@ class Get
}
// Trigger Event: jcb_ce_onBeforeGet
$this->triggerEvent('jcb_ce_onBeforeGet', array(&$config, &$this));
// set the Joomla version
$this->joomlaVersion = $config['version'];
// set the minfy switch of the JavaScript
$this->minify = (isset($config['minify']) && $config['minify'] != 2)
? $config['minify'] : $this->params->get('minify', 0);
// set the global language
$this->langTag = $this->params->get('language', $this->langTag);
// load the global config
Config::init($config);
// set the Joomla version @deprecated
$this->joomlaVersion = Config::get('version', 3);
// set the minfy switch of the JavaScript @deprecated
$this->minify = Config::get('minify', 0);
// set the global language @deprecated @deprecated
$this->langTag = Config::get('lang_tag', 'en-GB');
// also set the helper class langTag (for safeStrings)
ComponentbuilderHelper::$langTag = $this->langTag;
ComponentbuilderHelper::$langTag = Config::get('lang_tag', 'en-GB');
// setup the main language array
$this->languages['components'][$this->langTag] = array();
// check if we have Tidy enabled
$this->tidy = extension_loaded('Tidy');
// set the field type builder
$this->fieldBuilderType = $this->params->get(
'compiler_field_builder_type', 2
);
$this->languages['components'][Config::get('lang_tag', 'en-GB')] = array();
// check if we have Tidy enabled @deprecated
$this->tidy = Config::get('tidy', false);
// set the field type builder @deprecated
$this->fieldBuilderType = Config::get('field_builder_type', 2);
// check the field builder type logic
if (!$this->tidy && $this->fieldBuilderType == 2)
if (!Config::get('tidy', false) && Config::get('field_builder_type', 2) == 2)
{
// we do not have the tidy extension set fall back to StringManipulation
$this->fieldBuilderType = 1;
@ -988,78 +1010,31 @@ class Get
), 'Notice'
);
}
// load the compiler path
$this->compilerPath = $this->params->get(
'compiler_folder_path',
JPATH_COMPONENT_ADMINISTRATOR . '/compiler'
);
// load the jcb powers path
$this->jcbPowersPath = $this->params->get(
'jcb_powers_path',
'libraries/jcb_powers');
// set the component ID
$this->componentID = (int) $config['component'];
// set this components code name
if ($name_code = GetHelper::var(
'joomla_component', $this->componentID, 'id', 'name_code'
))
{
// set lang prefix
$this->langPrefix = 'COM_' . StringHelper::safe(
$name_code, 'U'
);
// set component code name
$this->componentCodeName = StringHelper::safe(
$name_code
);
// set component context
$this->componentContext = $this->componentCodeName . '.'
. $this->componentID;
// set the component name length
$this->componentCodeNameLength = strlen(
$this->componentCodeName
);
// add assets table fix
$global = (int) $this->params->get(
'assets_table_fix', 1
);
$this->addAssetsTableFix = (($add_assets_table_fix
= (int) GetHelper::var(
'joomla_component', $this->componentID, 'id',
'assets_table_fix'
)) == 3) ? $global : $add_assets_table_fix;
// set if language strings line breaks should be removed
$global = ((int) GetHelper::var(
'joomla_component', $this->componentID, 'id',
'remove_line_breaks'
) == 1) ? true : false;
$this->removeLineBreaks = ((int) $config['remove_line_breaks']
== 0)
? false
: (((int) $config['remove_line_breaks'] == 1) ? true
: $global);
// set if placeholders should be added to customcode
$global = ((int) GetHelper::var(
'joomla_component', $this->componentID, 'id',
'add_placeholders'
) == 1) ? true : false;
$this->addPlaceholders = ((int) $config['placeholders'] == 0)
? false
: (((int) $config['placeholders'] == 1) ? true : $global);
// set if line numbers should be added to comments
$global = ((int) GetHelper::var(
'joomla_component', $this->componentID, 'id',
'debug_linenr'
) == 1) ? true : false;
$this->debugLinenr = ((int) $config['debuglinenr'] == 0) ? false
: (((int) $config['debuglinenr'] == 1) ? true : $global);
// set if powers should be added to component (default is true)
$global = ((int) GetHelper::var(
'joomla_component', $this->componentID, 'id',
'add_powers'
) == 1) ? true : false;
$this->addPower = (isset($config['powers']) && (int) $config['powers'] == 0)
? false : ((isset($config['powers']) && (int) $config['powers'] == 1) ? true : $global);
Config::set('field_builder_type', $this->fieldBuilderType);
// load the compiler path @deprecated
$this->compilerPath = Config::get('compiler_path', JPATH_COMPONENT_ADMINISTRATOR . '/compiler');
// load the jcb powers path @deprecated
$this->jcbPowersPath = Config::get('jcb_powers_path', 'libraries/jcb_powers');
// set the component ID @deprecated
$this->componentID = Config::get('component_id');
// set lang prefix @deprecated
$this->langPrefix = Config::get('lang_prefix');
// set component code name @deprecated
$this->componentCodeName = Config::get('component_code_name');
// set component context @deprecated
$this->componentContext = Config::get('component_context');
// set the component name length @deprecated
$this->componentCodeNameLength = Config::get('component_code_name_length');
// add assets table fix @deprecated
$this->addAssetsTableFix = Config::get('add_assets_table_fix');
// set if language strings line breaks should be removed @deprecated
$this->removeLineBreaks = Config::get('remove_line_breaks');
// set if placeholders should be added to customcode @deprecated
$this->addPlaceholders = Config::get('add_placeholders', false);
// set if line numbers should be added to comments @deprecated
$this->debugLinenr = Config::get('debug_line_nr', false);
// set if powers should be added to component (default is true) @deprecated
$this->addPower = Config::get('add_power', true);
// set the current user
$this->user = JFactory::getUser();
// Get a db connection.
@ -1130,10 +1105,6 @@ class Get
return true;
}
}
return false;
}
/**
* Set the tab/space
@ -1159,7 +1130,7 @@ class Get
*/
private function setLine($nr)
{
if ($this->debugLinenr)
if (Config::get('debug_line_nr', false))
{
return ' [Get ' . $nr . ']';
}
@ -1231,14 +1202,14 @@ class Get
}
// set component place holders
$bucket[$this->hhh . 'component' . $this->hhh]
= $this->componentCodeName;
= Config::get('component_code_name');
$bucket[$this->hhh . 'Component' . $this->hhh]
= StringHelper::safe(
$this->componentCodeName, 'F'
Config::get('component_code_name'), 'F'
);
$bucket[$this->hhh . 'COMPONENT' . $this->hhh]
= StringHelper::safe(
$this->componentCodeName, 'U'
Config::get('component_code_name'), 'U'
);
$bucket[$this->bbb . 'component' . $this->ddd] = $bucket[$this->hhh
. 'component' . $this->hhh];
@ -1246,12 +1217,12 @@ class Get
. 'Component' . $this->hhh];
$bucket[$this->bbb . 'COMPONENT' . $this->ddd] = $bucket[$this->hhh
. 'COMPONENT' . $this->hhh];
$bucket[$this->hhh . 'LANG_PREFIX' . $this->hhh] = $this->langPrefix;
$bucket[$this->hhh . 'LANG_PREFIX' . $this->hhh] = Config::get('lang_prefix');
$bucket[$this->bbb . 'LANG_PREFIX' . $this->ddd] = $bucket[$this->hhh
. 'LANG_PREFIX' . $this->hhh];
// get the current components overides
if (($_placeholders = GetHelper::var(
'component_placeholders', $this->componentID,
'component_placeholders', Config::get('component_id'),
'joomla_component', 'addplaceholders'
)) !== false
&& JsonHelper::check($_placeholders))
@ -1336,7 +1307,7 @@ class Get
);
}
$query->where(
$this->db->quoteName('a.id') . ' = ' . (int) $this->componentID
$this->db->quoteName('a.id') . ' = ' . (int) Config::get('component_id')
);
// Trigger Event: jcb_ce_onBeforeQueryComponentData
@ -1365,36 +1336,36 @@ class Get
'val' => (int) $component->addadmin_views_id,
'key' => 'id'),
'addconfig' => array('table' => 'component_config',
'val' => (int) $this->componentID,
'val' => (int) Config::get('component_id'),
'key' => 'joomla_component'),
'addcustom_admin_views' => array('table' => 'component_custom_admin_views',
'val' => (int) $this->componentID,
'val' => (int) Config::get('component_id'),
'key' => 'joomla_component'),
'addcustommenus' => array('table' => 'component_custom_admin_menus',
'val' => (int) $this->componentID,
'val' => (int) Config::get('component_id'),
'key' => 'joomla_component'),
'addfiles' => array('table' => 'component_files_folders',
'val' => (int) $this->componentID,
'val' => (int) Config::get('component_id'),
'key' => 'joomla_component'),
'addfolders' => array('table' => 'component_files_folders',
'val' => (int) $this->componentID,
'val' => (int) Config::get('component_id'),
'key' => 'joomla_component'),
'addsite_views' => array('table' => 'component_site_views',
'val' => (int) $this->componentID,
'val' => (int) Config::get('component_id'),
'key' => 'joomla_component'),
'dashboard_tab' => array('table' => 'component_dashboard',
'val' => (int) $this->componentID,
'val' => (int) Config::get('component_id'),
'key' => 'joomla_component'),
'sql_tweak' => array('table' => 'component_mysql_tweaks',
'val' => (int) $this->componentID,
'val' => (int) Config::get('component_id'),
'key' => 'joomla_component'),
'version_update' => array('table' => 'component_updates',
'val' => (int) $this->componentID,
'val' => (int) Config::get('component_id'),
'key' => 'joomla_component')
),
'table' => 'joomla_component',
'key' => 'id',
'val' => (int) $this->componentID
'val' => (int) Config::get('component_id')
);
// repeatable fields to update
$searchRepeatables = array(
@ -1793,7 +1764,7 @@ class Get
'component_admin_views', $component->addadmin_views_id
);
$old_component = $this->getHistoryWatch(
'joomla_component', $this->componentID
'joomla_component', Config::get('component_id')
);
if ($old_component || $old_admin_views)
{
@ -1834,7 +1805,7 @@ class Get
// set GUI mapper
$guiMapper = array('table' => 'joomla_component',
'id' => (int) $this->componentID,
'id' => (int) Config::get('component_id'),
'field' => 'javascript', 'type' => 'js');
// add_javascript
@ -2044,11 +2015,11 @@ class Get
// bom
if (StringHelper::check($component->bom))
{
$this->bomPath = $this->compilerPath . '/' . $component->bom;
$this->bomPath = Config::get('compiler_path', JPATH_COMPONENT_ADMINISTRATOR . '/compiler') . '/' . $component->bom;
}
else
{
$this->bomPath = $this->compilerPath . '/default.txt';
$this->bomPath = Config::get('compiler_path', JPATH_COMPONENT_ADMINISTRATOR . '/compiler') . '/default.txt';
}
unset($component->bom);
// README
@ -2228,10 +2199,10 @@ class Get
{
if ($addPrefix
&& !isset(
$this->langContent[$target][$this->langPrefix . '_' . $language]
$this->langContent[$target][Config::get('lang_prefix') . '_' . $language]
))
{
$this->langContent[$target][$this->langPrefix . '_' . $language]
$this->langContent[$target][Config::get('lang_prefix') . '_' . $language]
= $this->fixLangString($string);
}
elseif (!isset($this->langContent[$target][$language]))
@ -2252,7 +2223,7 @@ class Get
*/
public function fixLangString(&$string)
{
if ($this->removeLineBreaks)
if (Config::get('remove_line_breaks'))
{
return trim(str_replace(array(PHP_EOL, "\r", "\n"), '', $string));
}
@ -2353,7 +2324,7 @@ class Get
}
// check the length of the view name (+5 for com_ and _)
$name_length = $this->componentCodeNameLength + strlen(
$name_length = Config::get('component_code_name_length') + strlen(
$view->name_single_code
) + 5;
// when the name is larger then 49 we need to add the assets table name fix
@ -2475,7 +2446,7 @@ class Get
$tab['name']
)) ? $tab['name'] : 'Tab';
// set lang
$tab['lang'] = $this->langPrefix . '_'
$tab['lang'] = Config::get('lang_prefix') . '_'
. StringHelper::safe(
$tab['view'], 'U'
) . '_' . StringHelper::safe(
@ -3013,7 +2984,7 @@ class Get
// confirm it should really make the over ride
if ('default' !== $check_column_name)
{
$column_name_lang = $this->langPrefix . '_'
$column_name_lang = Config::get('lang_prefix') . '_'
. StringHelper::safe(
$view->name_list_code, 'U'
) . '_'
@ -5843,7 +5814,7 @@ class Get
// remove watch
if (isset($version_note['component'])
&& ($key = array_search(
$this->componentID, $version_note['component']
Config::get('component_id'), $version_note['component']
)) !== false)
{
// last version that was used to build/compile
@ -5859,9 +5830,9 @@ class Get
break;
case 1:
// add watch
if (!in_array($this->componentID, $version_note['component']))
if (!in_array(Config::get('component_id'), $version_note['component']))
{
$version_note['component'][] = $this->componentID;
$version_note['component'][] = Config::get('component_id');
}
else
{
@ -6713,7 +6684,7 @@ class Get
return false;
}
// build lang key
$keyLang = $this->langPrefix . '_' . StringHelper::safe(
$keyLang = Config::get('lang_prefix') . '_' . StringHelper::safe(
$string, 'U'
);
// set the language string
@ -6751,7 +6722,7 @@ class Get
elseif ('view' === $type)
{
$view = $this->getViewTableName($asset);
$table = '#__' . $this->componentCodeName . '_' . $view;
$table = '#__' . Config::get('component_code_name') . '_' . $view;
$queryName = $view;
}
// just get all values from table if * is found
@ -8027,7 +7998,7 @@ class Get
$counterUpdate = 0;
$today = JFactory::getDate()->toSql();
foreach (
$this->languages[$target][$this->langTag] as $area => $placeholders
$this->languages[$target][Config::get('lang_tag', 'en-GB')] as $area => $placeholders
)
{
foreach ($placeholders as $placeholder => $string)
@ -8638,7 +8609,7 @@ class Get
*/
public function getPower($guid, $build = 0)
{
if (($this->addPower || $build == 1) && $this->setPower($guid))
if ((Config::get('add_power', true) || $build == 1) && $this->setPower($guid))
{
return $this->powers[$guid];
}
@ -8799,7 +8770,7 @@ class Get
}, $src_array));
}
// now we set the paths
$power->path_jcb = $this->jcbPowersPath;
$power->path_jcb = Config::get('jcb_powers_path', 'libraries/jcb_powers');
$power->path_parent = $power->path_jcb . '/' . $prefix_folder;
$power->path = $power->path_parent . '/src' . $sub_folder;
}
@ -8815,7 +8786,14 @@ class Get
{
$use = array_values(array_map(function ($u) use(&$as) {
// track the AS options
if (empty($u['as']))
{
$as[$u['use']] = 'default';
}
else
{
$as[$u['use']] = (string) $u['as'];
}
// return the guid
return $u['use'];
}, $power->use_selection));
@ -9056,7 +9034,7 @@ class Get
protected function getModuleIDs()
{
if (($addjoomla_modules = GetHelper::var(
'component_modules', $this->componentID, 'joomla_component',
'component_modules', Config::get('component_id'), 'joomla_component',
'addjoomla_modules'
)) !== false)
{
@ -9156,7 +9134,7 @@ class Get
// tweak system to set stuff to the module domain
$_backup_target = $this->target;
$_backup_lang = $this->lang;
$_backup_langPrefix = $this->langPrefix;
$_backup_langPrefix = Config::get('lang_prefix');
// set some keys
$module->target_type = 'M0dU|3';
$module->key = $module->id . '_' . $module->target_type;
@ -9178,7 +9156,6 @@ class Get
// default is site area
$module->target_client = 'site';
}
unset($module->target);
// set GUI mapper
$guiMapper = array('table' => 'joomla_module',
'id' => (int) $id, 'type' => 'php');
@ -9191,14 +9168,17 @@ class Get
= ClassfunctionHelper::safe(
$module->name
);
// alias of code name
$module->class_name = $module->code_name;
// set official name
$module->official_name = StringHelper::safe(
$module->name, 'W'
);
// set langPrefix
$this->langPrefix = 'MOD_' . strtoupper($module->code_name);
Config::set('lang_prefix', $this->langPrefix);
// set lang prefix
$module->lang_prefix = $this->langPrefix;
$module->lang_prefix = Config::get('lang_prefix');
// set module class name
$module->class_helper_name = 'Mod' . ucfirst($module->code_name)
. 'Helper';
@ -9213,14 +9193,14 @@ class Get
// set the zip name
$module->zip_name = $module->folder_name . '_v' . str_replace(
'.', '_', $module->module_version
) . '__J' . $this->joomlaVersion;
) . '__J' . Config::get('version', 3);
// set module file name
$module->file_name = $module->folder_name;
// set module context
$module->context = $module->file_name . '.' . $module->id;
// set official_name lang strings
$this->setLangContent(
$module->key, $this->langPrefix, $module->official_name
$module->key, Config::get('lang_prefix'), $module->official_name
);
// set some placeholder for this module
$this->placeholders[$this->bbb . 'Module_name' . $this->ddd]
@ -9860,6 +9840,7 @@ class Get
$this->target = $_backup_target;
$this->lang = $_backup_lang;
$this->langPrefix = $_backup_langPrefix;
Config::set('lang_prefix', $_backup_langPrefix);
unset(
$this->placeholders[$this->bbb . 'Module_name' . $this->ddd]
@ -9894,7 +9875,7 @@ class Get
{
$xml = '<?xml version="1.0" encoding="utf-8"?>';
$xml .= PHP_EOL . '<extension type="module" version="'
. $this->joomlaVersions[$this->joomlaVersion]['xml_version'] . '" client="'
. $this->joomlaVersions[Config::get('version', 3)]['xml_version'] . '" client="'
. $module->target_client . '" method="upgrade">';
$xml .= PHP_EOL . $this->_t(1) . '<name>' . $module->lang_prefix
. '</name>';
@ -9969,7 +9950,7 @@ class Get
protected function getPluginIDs()
{
if (($addjoomla_plugins = GetHelper::var(
'component_plugins', $this->componentID, 'joomla_component',
'component_plugins', Config::get('component_id'), 'joomla_component',
'addjoomla_plugins'
)) !== false)
{
@ -10159,7 +10140,7 @@ class Get
// tweak system to set stuff to the plugin domain
$_backup_target = $this->target;
$_backup_lang = $this->lang;
$_backup_langPrefix = $this->langPrefix;
$_backup_langPrefix = Config::get('lang_prefix');
// set some keys
$plugin->target_type = 'P|uG!n';
$plugin->key = $plugin->id . '_' . $plugin->target_type;
@ -10193,8 +10174,9 @@ class Get
$plugin->code_name,
$plugin->group
);
Config::set('lang_prefix', $this->langPrefix);
// set lang prefix
$plugin->lang_prefix = $this->langPrefix;
$plugin->lang_prefix = Config::get('lang_prefix');
// set plugin class name
$plugin->class_name
= PluginHelper::safeClassName(
@ -10216,14 +10198,14 @@ class Get
// set the zip name
$plugin->zip_name = $plugin->folder_name . '_v' . str_replace(
'.', '_', $plugin->plugin_version
) . '__J' . $this->joomlaVersion;
) . '__J' . Config::get('version', 3);
// set plugin file name
$plugin->file_name = strtolower($plugin->code_name);
// set plugin context
$plugin->context = $plugin->folder_name . '.' . $plugin->id;
// set official_name lang strings
$this->setLangContent(
$plugin->key, $this->langPrefix, $plugin->official_name
$plugin->key, Config::get('lang_prefix'), $plugin->official_name
);
// set some placeholder for this plugin
$this->placeholders[$this->bbb . 'Plugin_name' . $this->ddd]
@ -10764,6 +10746,7 @@ class Get
$this->target = $_backup_target;
$this->lang = $_backup_lang;
$this->langPrefix = $_backup_langPrefix;
Config::set('lang_prefix', $_backup_langPrefix);
unset(
$this->placeholders[$this->bbb . 'Plugin_name' . $this->ddd]
@ -10818,7 +10801,7 @@ class Get
{
$xml = '<?xml version="1.0" encoding="utf-8"?>';
$xml .= PHP_EOL . '<extension type="plugin" version="'
. $this->joomlaVersions[$this->joomlaVersion]['xml_version'] . '" group="'
. $this->joomlaVersions[Config::get('version', 3)]['xml_version'] . '" group="'
. strtolower($plugin->group) . '" method="upgrade">';
$xml .= PHP_EOL . $this->_t(1) . '<name>' . $plugin->lang_prefix
. '</name>';
@ -10971,16 +10954,16 @@ class Get
$this->globalPlaceholders
);
$placeholders[StringHelper::safe(
$this->componentCodeName, 'F'
Config::get('component_code_name'), 'F'
) . 'Helper::']
= $this->bbb
. 'Component' . $this->ddd . 'Helper::';
$placeholders['COM_' . StringHelper::safe(
$this->componentCodeName, 'U'
Config::get('component_code_name'), 'U'
)]
= 'COM_' . $this->bbb
. 'COMPONENT' . $this->ddd;
$placeholders['com_' . $this->componentCodeName] = 'com_' . $this->bbb
$placeholders['com_' . Config::get('component_code_name')] = 'com_' . $this->bbb
. 'component' . $this->ddd;
// putt the last first
$placeholders = array_reverse($placeholders, true);
@ -11326,7 +11309,7 @@ class Get
); // 'comment_type'
$this->newCustomCode[$pointer[$targetKey]][]
= $this->db->quote(
(int) $this->componentID
(int) Config::get('component_id')
); // 'component'
$this->newCustomCode[$pointer[$targetKey]][]
= $this->db->quote(
@ -11383,7 +11366,7 @@ class Get
. $this->db->quote($commentType);
$this->existingCustomCode[$pointer[$targetKey]]['fields'][]
= $this->db->quoteName('component') . ' = '
. $this->db->quote($this->componentID);
. $this->db->quote(Config::get('component_id'));
$this->existingCustomCode[$pointer[$targetKey]]['fields'][]
= $this->db->quoteName('from_line') . ' = '
. $this->db->quote($lineNumber);
@ -11557,7 +11540,7 @@ class Get
{
if (StringHelper::check($string))
{
if ($this->addPlaceholders
if (Config::get('add_placeholders', false)
&& $this->canAddGuiCodePlaceholder(
$string
)
@ -11893,15 +11876,16 @@ class Get
if (strpos($target, 'module') !== false)
{
// backup lang prefix
$_tmp_lang_prefix = $this->langPrefix;
$_tmp_lang_prefix = Config::get('lang_prefix');
// set the new lang prefix
$this->langPrefix = strtoupper(
str_replace('module', 'mod', $target)
);
Config::set('lang_prefix', $this->langPrefix);
// now set the lang
if (isset($this->langKeys[$this->langPrefix]))
if (isset($this->langKeys[Config::get('lang_prefix')]))
{
$this->lang = $this->langKeys[$this->langPrefix];
$this->lang = $this->langKeys[Config::get('lang_prefix')];
}
else
{
@ -11911,15 +11895,16 @@ class Get
elseif (strpos($target, 'plugin') !== false)
{
// backup lang prefix
$_tmp_lang_prefix = $this->langPrefix;
$_tmp_lang_prefix = Config::get('lang_prefix');
// set the new lang prefix
$this->langPrefix = strtoupper(
str_replace('plugin', 'plg', $target)
);
Config::set('lang_prefix', $this->langPrefix);
// now set the lang
if (isset($this->langKeys[$this->langPrefix]))
if (isset($this->langKeys[Config::get('lang_prefix')]))
{
$this->lang = $this->langKeys[$this->langPrefix];
$this->lang = $this->langKeys[Config::get('lang_prefix')];
}
else
{
@ -11956,7 +11941,7 @@ class Get
continue;
}
// build lang key
$keyLang = $this->langPrefix . '_' . $_keyLang;
$keyLang = Config::get('lang_prefix') . '_' . $_keyLang;
// set lang content string
$this->setLangContent($this->lang, $keyLang, $lang);
// reverse the placeholders
@ -11979,6 +11964,7 @@ class Get
if (isset($_tmp_lang_prefix))
{
$this->langPrefix = $_tmp_lang_prefix;
Config::set('lang_prefix', $_tmp_lang_prefix);
}
}
@ -12072,7 +12058,7 @@ class Get
{
case 11:
//***[REPLACED$$$$]***//**1**/
if ($this->addPlaceholders === true)
if (Config::get('add_placeholders', false) === true)
{
return array(
'start' => '/***[REPLACED$$$$]***//**' . $id . '**/',
@ -12087,7 +12073,7 @@ class Get
break;
case 12:
//***[INSERTED$$$$]***//**1**/
if ($this->addPlaceholders === true)
if (Config::get('add_placeholders', false) === true)
{
return array(
'start' => '/***[INSERTED$$$$]***//**' . $id . '**/',
@ -12102,7 +12088,7 @@ class Get
break;
case 21:
//<!--[REPLACED$$$$]--><!--1-->
if ($this->addPlaceholders === true)
if (Config::get('add_placeholders', false) === true)
{
return array(
'start' => '<!--[REPLACED$$$$]--><!--' . $id . '-->',
@ -12117,7 +12103,7 @@ class Get
break;
case 22:
//<!--[INSERTED$$$$]--><!--1-->
if ($this->addPlaceholders === true)
if (Config::get('add_placeholders', false) === true)
{
return array(
'start' => '<!--[INSERTED$$$$]--><!--' . $id . '-->',
@ -12152,15 +12138,15 @@ class Get
$localPaths = array();
// admin path
$localPaths['admin'] = JPATH_ADMINISTRATOR . '/components/com_'
. $this->componentCodeName;
. Config::get('component_code_name');
// site path
$localPaths['site'] = JPATH_ROOT . '/components/com_'
. $this->componentCodeName;
. Config::get('component_code_name');
// media path
$localPaths['media'] = JPATH_ROOT . '/media/com_'
. $this->componentCodeName;
. Config::get('component_code_name');
// power path
$localPaths['power'] = JPATH_ROOT . '/' . $this->jcbPowersPath;
$localPaths['power'] = JPATH_ROOT . '/' . Config::get('jcb_powers_path', 'libraries/jcb_powers');
// lets also go over the REPOS (TODO)
// Painfull but we need to folder paths for the linked modules
if (($module_ids = $this->getModuleIDs()) !== false)

View File

@ -20,6 +20,7 @@ use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use VDM\Joomla\Utilities\GetHelper;
use VDM\Joomla\Utilities\FileHelper;
use VDM\Joomla\Componentbuilder\Factory\Compiler\Config;
/**
@ -403,22 +404,22 @@ class Structure extends Get
// run global updater
ComponentbuilderHelper::runGlobalUpdater();
// set the template path
$this->templatePath = $this->compilerPath . '/joomla_'
. $this->joomlaVersions[$this->joomlaVersion]['folder_key'];
$this->templatePath = Config::get('compiler_path', JPATH_COMPONENT_ADMINISTRATOR . '/compiler') . '/joomla_'
. $this->joomlaVersions[Config::get('version', 3)]['folder_key'];
// set some default names
$this->componentSalesName = 'com_'
. $this->componentData->sales_name . '__J'
. $this->joomlaVersion;
. Config::get('version', 3);
$this->componentBackupName = 'com_'
. $this->componentData->sales_name . '_v' . str_replace(
'.', '_', $this->componentData->component_version
) . '__J' . $this->joomlaVersion;
) . '__J' . Config::get('version', 3);
$this->componentFolderName = 'com_'
. $this->componentData->name_code . '_v' . str_replace(
'.', '_', $this->componentData->component_version
) . '__J' . $this->joomlaVersion;
) . '__J' . Config::get('version', 3);
// set component folder path
$this->componentPath = $this->compilerPath . '/'
$this->componentPath = Config::get('compiler_path', JPATH_COMPONENT_ADMINISTRATOR . '/compiler') . '/'
. $this->componentFolderName;
// set the template path for custom
$this->templatePathCustom = $this->params->get(
@ -475,7 +476,7 @@ class Structure extends Get
*/
private function setLine($nr)
{
if ($this->debugLinenr)
if (Config::get('debug_line_nr', false))
{
return ' [Structure ' . $nr . ']';
}
@ -618,7 +619,7 @@ class Structure extends Get
))
{
// module path
$module->folder_path = $this->compilerPath . '/'
$module->folder_path = Config::get('compiler_path', JPATH_COMPONENT_ADMINISTRATOR . '/compiler') . '/'
. $module->folder_name;
// set the module paths
$this->dynamicPaths[$module->key] = $module->folder_path;
@ -920,11 +921,11 @@ class Structure extends Get
$xml .= PHP_EOL . '<form';
$xml .= PHP_EOL . $this->_t(1)
. 'addrulepath="/administrator/components/com_'
. $this->componentCodeName
. Config::get('component_code_name')
. '/models/rules"';
$xml .= PHP_EOL . $this->_t(1)
. 'addfieldpath="/administrator/components/com_'
. $this->componentCodeName
. Config::get('component_code_name')
. '/models/fields"';
$xml .= PHP_EOL . '>';
}
@ -1095,7 +1096,7 @@ class Structure extends Get
$this->createFolder($module->folder_path . '/language');
// also create the lang tag folder
$this->createFolder(
$module->folder_path . '/language/' . $this->langTag
$module->folder_path . '/language/' . Config::get('lang_tag', 'en-GB')
);
// check if this lib has files
if (isset($module->files)
@ -1199,7 +1200,7 @@ class Structure extends Get
))
{
// plugin path
$plugin->folder_path = $this->compilerPath . '/'
$plugin->folder_path = Config::get('compiler_path', JPATH_COMPONENT_ADMINISTRATOR . '/compiler') . '/'
. $plugin->folder_name;
// set the plugin paths
$this->dynamicPaths[$plugin->key] = $plugin->folder_path;
@ -1300,7 +1301,7 @@ class Structure extends Get
$xml = '<?xml version="1.0" encoding="utf-8"?>';
$xml .= PHP_EOL . '<!--' . $this->setLine(__LINE__)
. ' default paths of ' . $file
. ' form points to ' . $this->componentCodeName
. ' form points to ' . Config::get('component_code_name')
. ' -->';
// search if we must add the component path
$add_component_path = false;
@ -1329,11 +1330,11 @@ class Structure extends Get
$xml .= PHP_EOL . '<form';
$xml .= PHP_EOL . $this->_t(1)
. 'addrulepath="/administrator/components/com_'
. $this->componentCodeName
. Config::get('component_code_name')
. '/models/rules"';
$xml .= PHP_EOL . $this->_t(1)
. 'addfieldpath="/administrator/components/com_'
. $this->componentCodeName
. Config::get('component_code_name')
. '/models/fields"';
$xml .= PHP_EOL . '>';
}
@ -1486,7 +1487,7 @@ class Structure extends Get
$this->createFolder($plugin->folder_path . '/language');
// also creat the lang tag folder path
$this->createFolder(
$plugin->folder_path . '/language/' . $this->langTag
$plugin->folder_path . '/language/' . Config::get('lang_tag', 'en-GB')
);
// check if this lib has files
if (isset($plugin->files)
@ -2071,7 +2072,7 @@ class Structure extends Get
$this->joomlaVersionData->move->static
))
{
$codeName = $this->componentCodeName;
$codeName = Config::get('component_code_name');
// TODO needs more looking at this must be dynamic actually
$this->notNew[] = 'LICENSE.txt';
// do license check
@ -2879,7 +2880,7 @@ class Structure extends Get
private function setJoomlaVersionData()
{
// option to load other settings
$custom_settings = $this->templatePath . '/settings_' . $this->componentCodeName . '.json';
$custom_settings = $this->templatePath . '/settings_' . Config::get('component_code_name') . '.json';
// set the version data
if (File::exists($custom_settings))
{

View File

@ -18,6 +18,7 @@ use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use VDM\Joomla\Utilities\GetHelper;
use VDM\Joomla\Utilities\String\FieldHelper;
use VDM\Joomla\Componentbuilder\Factory\Compiler\Config;
/**
* Compiler class
@ -378,7 +379,7 @@ class Fields extends Structure
*/
private function setLine($nr)
{
if ($this->debugLinenr)
if (Config::get('debug_line_nr', false))
{
return ' [Fields ' . $nr . ']';
}
@ -415,9 +416,9 @@ class Fields extends Structure
$this->accessBuilder[$nameSingleCode] = $nameListCode;
}
// main lang prefix
$langView = $this->langPrefix . '_'
$langView = Config::get('lang_prefix') . '_'
. $this->placeholders[$this->hhh . 'VIEW' . $this->hhh];
$langViews = $this->langPrefix . '_'
$langViews = Config::get('lang_prefix') . '_'
. $this->placeholders[$this->hhh . 'VIEWS' . $this->hhh];
// set default lang
$this->setLangContent(
@ -570,7 +571,7 @@ class Fields extends Structure
. $view['settings']->name_single . " to customise the alias."
);
// check what type of field builder to use
if ($this->fieldBuilderType == 1)
if (Config::get('field_builder_type', 2) == 1)
{
// build field set using string manipulation
return $this->stringFieldSet(
@ -1586,7 +1587,7 @@ class Fields extends Structure
&$nameSingleCode, &$nameListCode, &$placeholders, &$dbkey, $build
) {
// set default return
if ($this->fieldBuilderType == 1)
if (Config::get('field_builder_type', 2) == 1)
{
// string manipulation
$dynamicField = '';
@ -1831,7 +1832,7 @@ class Fields extends Structure
) {
// check the field builder type
$xmlField = '';
if ($this->fieldBuilderType == 1)
if (Config::get('field_builder_type', 2) == 1)
{
// string manipulation
$xmlField = $this->setDynamicField(
@ -1891,7 +1892,7 @@ class Fields extends Structure
// count the dynamic fields created
$this->fieldCount++;
// check what type of field builder to use
if ($this->fieldBuilderType == 1)
if (Config::get('field_builder_type', 2) == 1)
{
// build field set using string manipulation
return $this->stringSetField(
@ -4962,7 +4963,7 @@ class Fields extends Structure
// if they left out the extension for some reason
if (!StringHelper::check($_extension))
{
$_extension = 'com_' . $this->componentCodeName . '.'
$_extension = 'com_' . Config::get('component_code_name') . '.'
. $otherView;
}
// check the context (does our target match)
@ -5168,7 +5169,7 @@ class Fields extends Structure
= $options;
}
// main lang filter prefix
$lang_filter_ = $this->langPrefix . '_FILTER_';
$lang_filter_ = Config::get('lang_prefix') . '_FILTER_';
// build the sort values
if ($dbSwitch && (isset($field['sort']) && $field['sort'] == 1)
&& ($listSwitch || $listJoin)
@ -5359,10 +5360,10 @@ class Fields extends Structure
$data['custom']['component']
)) ? StringHelper::safe(
$data['custom']['component']
) : 'com_' . $this->componentCodeName,
) : 'com_' . Config::get('component_code_name'),
// set the generic values
$this->bbb . 'component'
. $this->ddd => $this->componentCodeName,
. $this->ddd => Config::get('component_code_name'),
$this->bbb . 'Component'
. $this->ddd => $this->fileContentStatic[$this->hhh
. 'Component' . $this->hhh],
@ -5622,7 +5623,7 @@ class Fields extends Structure
// temp holder for name
$tempName = $data['custom']['label'] . ' Group';
// set lang
$groupLangName = $this->langPrefix . '_'
$groupLangName = Config::get('lang_prefix') . '_'
. FieldHelper::safe(
$tempName, true
);
@ -5751,14 +5752,14 @@ class Fields extends Structure
$target, 'filter'
);
// the search language string
$lang_search = $this->langPrefix . '_FILTER_SEARCH';
$lang_search = Config::get('lang_prefix') . '_FILTER_SEARCH';
// and to translation
$this->setLangContent(
$this->lang, $lang_search, 'Search'
. StringHelper::safe($nameListCode, 'w')
);
// the search description language string
$lang_search_desc = $this->langPrefix . '_FILTER_SEARCH_'
$lang_search_desc = Config::get('lang_prefix') . '_FILTER_SEARCH_'
. strtoupper($nameListCode);
// and to translation
$this->setLangContent(
@ -5784,13 +5785,13 @@ class Fields extends Structure
if (!isset($this->fieldsNames[$nameSingleCode]['published']))
{
// the published language string
$lang_published = $this->langPrefix . '_FILTER_PUBLISHED';
$lang_published = Config::get('lang_prefix') . '_FILTER_PUBLISHED';
// and to translation
$this->setLangContent(
$this->lang, $lang_published, 'Status'
);
// the published description language string
$lang_published_desc = $this->langPrefix . '_FILTER_PUBLISHED_'
$lang_published_desc = Config::get('lang_prefix') . '_FILTER_PUBLISHED_'
. strtoupper($nameListCode);
// and to translation
$this->setLangContent(
@ -6134,7 +6135,7 @@ class Fields extends Structure
&& StringHelper::check($fieldData['views']))
{
// set local component
$local_component = "com_" . $this->componentCodeName;
$local_component = "com_" . Config::get('component_code_name');
// check that the component value is set
if (!isset($fieldData['component'])
|| !StringHelper::check(
@ -6316,7 +6317,7 @@ class Fields extends Structure
. " build Create button";
$addButton[] = $this->_t(4)
. "\$button[] = '<a id=\"'.\$button_code_name.'Create\" class=\"btn btn-small btn-success hasTooltip\" title=\"'.JText:"
. ":sprintf('" . $this->langPrefix
. ":sprintf('" . Config::get('lang_prefix')
. "_CREATE_NEW_S', \$button_label).'\" style=\"border-radius: 0px 4px 4px 0px; padding: 4px 4px 4px 7px;\"";
$addButton[] = $this->_t(5) . "href=\"index.php?option="
. $fieldData['component'] . "&amp;view=" . $fieldData['view']
@ -6352,7 +6353,7 @@ class Fields extends Structure
. " build edit button";
$addButton[] = $this->_t(4)
. "\$button[] = '<a id=\"'.\$button_code_name.'Edit\" class=\"btn btn-small hasTooltip\" title=\"'.JText:"
. ":sprintf('" . $this->langPrefix
. ":sprintf('" . Config::get('lang_prefix')
. "_EDIT_S', \$button_label).'\" style=\"display: none; padding: 4px 4px 4px 7px;\" href=\"#\" >";
$addButton[] = $this->_t(5)
. "<span class=\"icon-edit\"></span></a>';";
@ -6443,7 +6444,7 @@ class Fields extends Structure
$dom->getElementsByTagName($nodename)->item(0)
);
// make sure Tidy is enabled
if ($this->tidy)
if (Config::get('tidy', false))
{
$tidy = new Tidy();
$tidy->parseString(

View File

@ -21,6 +21,7 @@ use VDM\Joomla\Utilities\ObjectHelper;
use VDM\Joomla\Utilities\GetHelper;
use VDM\Joomla\Utilities\FileHelper;
use VDM\Joomla\Utilities\MathHelper;
use VDM\Joomla\Componentbuilder\Factory\Compiler\Config;
/**
* Compiler class
@ -265,7 +266,7 @@ class Interpretation extends Fields
*/
private function setLine($nr)
{
if ($this->debugLinenr)
if (Config::get('debug_line_nr', false))
{
return ' [Interpretation ' . $nr . ']';
}
@ -282,7 +283,7 @@ class Interpretation extends Fields
&& $this->componentData->add_email_helper)
{
// set email helper in place with component name
$component = $this->componentCodeName;
$component = Config::get('component_code_name');
$Component = $this->fileContentStatic[$this->hhh . 'Component'
. $this->hhh];
$target = array('admin' => 'emailer');
@ -455,7 +456,7 @@ class Interpretation extends Fields
$bool[] = $this->_t(2) . "//" . $this->setLine(__LINE__)
. " Get the global params";
$bool[] = $this->_t(2) . "\$params = JComponentHelper::getParams('com_"
. $this->componentCodeName . "', true);";
. Config::get('component_code_name') . "', true);";
$bool[] = $this->_t(2)
. "\$whmcs_key = \$params->get('whmcs_key', null);";
$bool[] = $this->_t(2) . "if (\$whmcs_key)";
@ -464,7 +465,7 @@ class Interpretation extends Fields
. " load the file";
$bool[] = $this->_t(3)
. "JLoader::import( 'whmcs', JPATH_ADMINISTRATOR .'/components/com_"
. $this->componentCodeName . "');";
. Config::get('component_code_name') . "');";
$bool[] = $this->_t(3) . "\$the = new WHMCS(\$whmcs_key);";
$bool[] = $this->_t(3) . "\$this->" . $globalbool . " = \$the->_is;";
$bool[] = $this->_t(3) . "return \$this->" . $globalbool . ";";
@ -495,7 +496,7 @@ class Interpretation extends Fields
. " Get the global params";
$helper[] = $this->_t(2)
. "\$params = JComponentHelper::getParams('com_"
. $this->componentCodeName . "', true);";
. Config::get('component_code_name') . "', true);";
$helper[] = $this->_t(2)
. "\$whmcs_key = \$params->get('whmcs_key', null);";
$helper[] = $this->_t(2) . "if (\$whmcs_key)";
@ -504,7 +505,7 @@ class Interpretation extends Fields
. " load the file";
$helper[] = $this->_t(3)
. "JLoader::import( 'whmcs', JPATH_ADMINISTRATOR .'/components/com_"
. $this->componentCodeName . "');";
. Config::get('component_code_name') . "');";
$helper[] = $this->_t(3) . "\$the = new WHMCS(\$whmcs_key);";
$helper[] = $this->_t(3) . "return \$the->_is;";
$helper[] = $this->_t(2) . "}";
@ -884,7 +885,7 @@ class Interpretation extends Fields
= PHP_EOL . $this->_t(3) . "<filename>whmcs.php</filename>";
}
// get component name
$component = $this->componentCodeName;
$component = Config::get('component_code_name');
// set the getCryptKey function to the helper class
$function = array();
// start building the getCryptKey function/class method
@ -1191,7 +1192,7 @@ class Interpretation extends Fields
$updateServer[] = PHP_EOL . $this->_t(1) . "<updateservers>";
$updateServer[] = $this->_t(2)
. '<server type="extension" enabled="1" element="com_'
. $this->componentCodeName . '" name="'
. Config::get('component_code_name') . '" name="'
. $this->fileContentStatic[$this->hhh . 'Component_name'
. $this->hhh] . '">' . $this->componentData->update_server_url
. '</server>';
@ -1220,14 +1221,14 @@ class Interpretation extends Fields
}
// update the joomla component table
$newJ = array();
$newJ['id'] = (int) $this->componentID;
$newJ['id'] = (int) Config::get('component_id');
$newJ['component_version']
= $this->componentData->component_version;
// update the component with the new dynamic SQL
$modelJ = ComponentbuilderHelper::getModel('joomla_component');
$modelJ->save($newJ); // <-- to insure the history is also updated
// reset the watch here
$this->getHistoryWatch('joomla_component', $this->componentID);
$this->getHistoryWatch('joomla_component', Config::get('component_id'));
// update the component update table
$newU = array();
@ -1238,7 +1239,7 @@ class Interpretation extends Fields
}
else
{
$newU['joomla_component'] = (int) $this->componentID;
$newU['joomla_component'] = (int) Config::get('component_id');
}
$newU['version_update'] = json_encode($buket);
// update the component with the new dynamic SQL
@ -1378,7 +1379,7 @@ class Interpretation extends Fields
&& $this->componentData->update_server_target != 3)
{
// we set the defaults
$u_element = 'com_' . $this->componentCodeName;
$u_element = 'com_' . Config::get('component_code_name');
$u_server_type = 'component';
$u_state = 'stable';
$u_target_version = '3.*';
@ -1515,7 +1516,7 @@ class Interpretation extends Fields
$help[] = $this->_t(2) . "\$query = \$db->getQuery(true);";
$help[] = $this->_t(2)
. "\$query->select(array('a.id','a.groups','a.target','a.type','a.article','a.url'));";
$help[] = $this->_t(2) . "\$query->from('#__" . $this->componentCodeName
$help[] = $this->_t(2) . "\$query->from('#__" . Config::get('component_code_name')
. "_help_document AS a');";
$help[] = $this->_t(2) . "\$query->where('a." . $target
. " = '.\$db->quote(\$view));";
@ -1586,7 +1587,7 @@ class Interpretation extends Fields
$help[] = $this->_t(1) . "{";
$help[] = $this->_t(2) . "\$token = JSession::getFormToken();";
$help[] = $this->_t(2) . "return 'index.php?option=com_"
. $this->componentCodeName
. Config::get('component_code_name')
. "&task=help.getText&id=' . (int) \$id . '&token=' . \$token;";
$help[] = $this->_t(1) . "}";
@ -1938,7 +1939,7 @@ class Interpretation extends Fields
$method[] = $this->_t(2) . "\$lang = JFactory::getLanguage();";
$method[] = $this->_t(2) . "\$extension = 'com_users';";
$method[] = $this->_t(2) . "\$base_dir = JPATH_SITE;";
$method[] = $this->_t(2) . "\$language_tag = '" . $this->langTag
$method[] = $this->_t(2) . "\$language_tag = '" . Config::get('lang_tag', 'en-GB')
. "';";
$method[] = $this->_t(2) . "\$reload = true;";
$method[] = $this->_t(2)
@ -2157,7 +2158,7 @@ class Interpretation extends Fields
$method[] = $this->_t(2) . "\$lang = JFactory::getLanguage();";
$method[] = $this->_t(2) . "\$extension = 'com_users';";
$method[] = $this->_t(2) . "\$base_dir = JPATH_ADMINISTRATOR;";
$method[] = $this->_t(2) . "\$language_tag = '" . $this->langTag
$method[] = $this->_t(2) . "\$language_tag = '" . Config::get('lang_tag', 'en-GB')
. "';";
$method[] = $this->_t(2) . "\$reload = true;";
$method[] = $this->_t(2)
@ -2224,7 +2225,7 @@ class Interpretation extends Fields
{
// set the lang
$lang = StringHelper::safe(
'com_' . $this->componentCodeName . '_menu_'
'com_' . Config::get('component_code_name') . '_menu_'
. $nameSingleCode,
'U'
);
@ -2274,7 +2275,7 @@ class Interpretation extends Fields
{
// set the lang
$lang = StringHelper::safe(
'com_' . $this->componentCodeName . '_menu_'
'com_' . Config::get('component_code_name') . '_menu_'
. $view['settings']->code, 'U'
);
$this->setLangContent(
@ -2306,10 +2307,10 @@ class Interpretation extends Fields
$xml .= PHP_EOL . $this->_t(2) . '<fieldset name="request"';
$xml .= PHP_EOL . $this->_t(3)
. 'addrulepath="/administrator/components/com_'
. $this->componentCodeName . '/models/rules"';
. Config::get('component_code_name') . '/models/rules"';
$xml .= PHP_EOL . $this->_t(3)
. 'addfieldpath="/administrator/components/com_'
. $this->componentCodeName . '/models/fields">';
. Config::get('component_code_name') . '/models/fields">';
if (isset($this->hasIdRequest[$view['settings']->code])
&& ArrayHelper::check(
$this->hasIdRequest[$view['settings']->code]
@ -2360,10 +2361,10 @@ class Interpretation extends Fields
. $this->hhh] . '"';
$xml .= PHP_EOL . $this->_t(3)
. 'addrulepath="/administrator/components/com_'
. $this->componentCodeName . '/models/rules"';
. Config::get('component_code_name') . '/models/rules"';
$xml .= PHP_EOL . $this->_t(3)
. 'addfieldpath="/administrator/components/com_'
. $this->componentCodeName . '/models/fields">';
. Config::get('component_code_name') . '/models/fields">';
$xml .= implode($this->_t(3), $params);
$xml .= PHP_EOL . $this->_t(2) . '</fieldset>';
$xml .= PHP_EOL . $this->_t(1) . '</fields>';
@ -2921,7 +2922,7 @@ class Interpretation extends Fields
. $this->hhh];
// set context
$context = (isset($get['context'])) ? $get['context'] : $code;
$context = 'com_' . $this->componentCodeName . '.' . $context;
$context = 'com_' . Config::get('component_code_name') . '.' . $context;
// load parms builder only once
$params = false;
foreach ($checker as $field => $array)
@ -3595,7 +3596,7 @@ class Interpretation extends Fields
)
. " redirect away to the default view if no access allowed.";
$redirectString = "JRoute::_('index.php?option=com_"
. $this->componentCodeName . "&view="
. Config::get('component_code_name') . "&view="
. $this->fileContentStatic[$this->hhh . 'SITE_DEFAULT_VIEW'
. $this->hhh] . "')";
}
@ -3611,7 +3612,7 @@ class Interpretation extends Fields
) . " check if this user has permission to access item";
$accessCheck[] = $this->_t(2) . "if (!" . $userString
. "->authorise('site." . $view['settings']->code
. ".access', 'com_" . $this->componentCodeName . "'))";
. ".access', 'com_" . Config::get('component_code_name') . "'))";
$accessCheck[] = $this->_t(2) . "{";
$accessCheck[] = $this->_t(3)
. "\$app = JFactory::getApplication();";
@ -3779,7 +3780,7 @@ class Interpretation extends Fields
. 'SITE_DEFAULT_VIEW' . $this->hhh] != $code)
{
$redirectString = "JRoute::_('index.php?option=com_"
. $this->componentCodeName . "&view="
. Config::get('component_code_name') . "&view="
. $this->fileContentStatic[$this->hhh
. 'SITE_DEFAULT_VIEW' . $this->hhh] . "')";
}
@ -3794,7 +3795,7 @@ class Interpretation extends Fields
{
$getItem .= PHP_EOL . $this->_t(1) . $tab . $this->_t(2)
. "\$app->redirect('index.php?option=com_"
. $this->componentCodeName . "');";
. Config::get('component_code_name') . "');";
}
$getItem .= PHP_EOL . $this->_t(1) . $tab . $this->_t(2)
. "return false;";
@ -4078,7 +4079,7 @@ class Interpretation extends Fields
. $this->setLine(__LINE__) . " Get the global params";
$main .= PHP_EOL . $this->_t(2)
. "\$globalParams = JComponentHelper::getParams('com_"
. $this->componentCodeName . "', true);";
. Config::get('component_code_name') . "', true);";
// set php before listquery
if (isset($view->add_php_getlistquery)
&& $view->add_php_getlistquery == 1
@ -5291,7 +5292,7 @@ class Interpretation extends Fields
{
// TODO the onContentPrepare already gets triggered on the fields of its relation
// $method .= PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) . " onContentPrepare Event Trigger.";
// $method .= PHP_EOL . $this->_t(2) . "\$dispatcher->trigger('onContentPrepare', array ('com_" . $this->componentCodeName . ".article', &\$this->item, &\$this->params, 0));";
// $method .= PHP_EOL . $this->_t(2) . "\$dispatcher->trigger('onContentPrepare', array ('com_" . Config::get('component_code_name') . ".article', &\$this->item, &\$this->params, 0));";
}
else
{
@ -5301,7 +5302,7 @@ class Interpretation extends Fields
$method .= PHP_EOL . $this->_t(3)
. "\$results = \$dispatcher->trigger('"
. $plugin_event . "', array('com_"
. $this->componentCodeName . "."
. Config::get('component_code_name') . "."
. $view['settings']->context
. "', &\$this->item, &\$params, 0));";
$method .= PHP_EOL . $this->_t(3)
@ -5675,7 +5676,7 @@ class Interpretation extends Fields
. "if (\$this->user->authorise('"
. $viewCodeName
. "." . $keyCode . "', 'com_"
. $this->componentCodeName . "'))";
. Config::get('component_code_name') . "'))";
}
else
{
@ -5714,7 +5715,7 @@ class Interpretation extends Fields
1
) . $tab . "if (\$this->user->authorise('"
. $viewCodeName . "." . $keyCode . "', 'com_"
. $this->componentCodeName . "'))";
. Config::get('component_code_name') . "'))";
$this->onlyFunctionButton[$viewsCodeName][]
= $this->_t(
1
@ -5748,7 +5749,7 @@ class Interpretation extends Fields
. "if (\$this->user->authorise('"
. $viewCodeName
. "." . $keyCode . "', 'com_"
. $this->componentCodeName . "'))";
. Config::get('component_code_name') . "'))";
$buttons[] = $this->_t(1) . $tab . $this->_t(1)
. "{";
$buttons[] = $this->_t(1) . $tab . $this->_t(2)
@ -5984,13 +5985,13 @@ class Interpretation extends Fields
// set path
if ('site' === $this->target)
{
$path = '/components/com_' . $this->componentCodeName
$path = '/components/com_' . Config::get('component_code_name')
. '/assets/js/' . $view['settings']->code . '.js';
}
else
{
$path = '/administrator/components/com_'
. $this->componentCodeName . '/assets/js/'
. Config::get('component_code_name') . '/assets/js/'
. $view['settings']->code . '.js';
}
// add script to file
@ -6218,7 +6219,7 @@ class Interpretation extends Fields
. " load the google chart js.";
$chart[] = $this->_t(2)
. "JHtml::_('script', 'media/com_"
. $this->componentCodeName . "/js/google.jsapi.js', ['version' => 'auto']);";
. Config::get('component_code_name') . "/js/google.jsapi.js', ['version' => 'auto']);";
$chart[] = $this->_t(2)
. "\$this->document->addScript('https://canvg.googlecode.com/svn/trunk/rgbcolor.js', ['version' => 'auto']);";
$chart[] = $this->_t(2)
@ -6267,7 +6268,7 @@ class Interpretation extends Fields
$setter .= PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__)
. " Initialize the header checker.";
$setter .= PHP_EOL . $this->_t(2) . "\$HeaderCheck = new "
. $this->componentCodeName . "HeaderCheck;";
. Config::get('component_code_name') . "HeaderCheck;";
}
// check if this view should get libraries
if (isset($this->libManager[$this->target][$code])
@ -6553,7 +6554,7 @@ class Interpretation extends Fields
&& strpos($root, '/site/') === false)
{
return str_replace(
'/media/', '/media/com_' . $this->componentCodeName . '/', $root
'/media/', '/media/com_' . Config::get('component_code_name') . '/', $root
);
}
elseif (strpos($root, '/media/') === false
@ -6562,7 +6563,7 @@ class Interpretation extends Fields
{
return str_replace(
'/admin/',
'/administrator/components/com_' . $this->componentCodeName
'/administrator/components/com_' . Config::get('component_code_name')
. '/', $root
);
}
@ -6571,7 +6572,7 @@ class Interpretation extends Fields
&& strpos($root, '/site/') !== false)
{
return str_replace(
'/site/', '/components/com_' . $this->componentCodeName . '/',
'/site/', '/components/com_' . Config::get('component_code_name') . '/',
$root
);
}
@ -6627,7 +6628,7 @@ class Interpretation extends Fields
$setter .= PHP_EOL . $tabV . $this->_t(2) . "{";
$setter .= PHP_EOL . $tabV . $this->_t(3)
. "JHtml::_('stylesheet', 'media/com_"
. $this->componentCodeName
. Config::get('component_code_name')
. "/uikit-v2/css/uikit'.\$style.\$size.'.css', ['version' => 'auto']);";
$setter .= PHP_EOL . $tabV . $this->_t(2) . "}";
$setter .= PHP_EOL . $tabV . $this->_t(2) . "//" . $this->setLine(
@ -6638,7 +6639,7 @@ class Interpretation extends Fields
$setter .= PHP_EOL . $tabV . $this->_t(2) . "{";
$setter .= PHP_EOL . $tabV . $this->_t(3)
. "JHtml::_('script', 'media/com_"
. $this->componentCodeName
. Config::get('component_code_name')
. "/uikit-v2/js/uikit'.\$size.'.js', ['version' => 'auto']);";
$setter .= PHP_EOL . $tabV . $this->_t(2) . "}";
}
@ -6726,7 +6727,7 @@ class Interpretation extends Fields
) . " check if the CSS file exists.";
$setter .= PHP_EOL . $tabV . $this->_t(5)
. "if (File::exists(JPATH_ROOT.'/media/com_"
. $this->componentCodeName
. Config::get('component_code_name')
. "/uikit-v2/css/components/'.\$name.\$style.\$size.'.css'))";
$setter .= PHP_EOL . $tabV . $this->_t(5) . "{";
$setter .= PHP_EOL . $tabV . $this->_t(6) . "//" . $this->setLine(
@ -6734,7 +6735,7 @@ class Interpretation extends Fields
) . " load the css.";
$setter .= PHP_EOL . $tabV . $this->_t(6)
. "JHtml::_('stylesheet', 'media/com_"
. $this->componentCodeName
. Config::get('component_code_name')
. "/uikit-v2/css/components/'.\$name.\$style.\$size.'.css', ['version' => 'auto']);";
$setter .= PHP_EOL . $tabV . $this->_t(5) . "}";
$setter .= PHP_EOL . $tabV . $this->_t(5) . "//" . $this->setLine(
@ -6742,7 +6743,7 @@ class Interpretation extends Fields
) . " check if the JavaScript file exists.";
$setter .= PHP_EOL . $tabV . $this->_t(5)
. "if (File::exists(JPATH_ROOT.'/media/com_"
. $this->componentCodeName
. Config::get('component_code_name')
. "/uikit-v2/js/components/'.\$name.\$size.'.js'))";
$setter .= PHP_EOL . $tabV . $this->_t(5) . "{";
$setter .= PHP_EOL . $tabV . $this->_t(6) . "//" . $this->setLine(
@ -6750,7 +6751,7 @@ class Interpretation extends Fields
) . " load the js.";
$setter .= PHP_EOL . $tabV . $this->_t(6)
. "JHtml::_('script', 'media/com_"
. $this->componentCodeName
. Config::get('component_code_name')
. "/uikit-v2/js/components/'.\$name.\$size.'.js', ['version' => 'auto'], ['type' => 'text/javascript', 'async' => 'async']);";
$setter .= PHP_EOL . $tabV . $this->_t(5) . "}";
$setter .= PHP_EOL . $tabV . $this->_t(4) . "}";
@ -6788,7 +6789,7 @@ class Interpretation extends Fields
) . " check if the CSS file exists.";
$setter .= PHP_EOL . $tabV . $this->_t(5)
. "if (File::exists(JPATH_ROOT.'/media/com_"
. $this->componentCodeName
. Config::get('component_code_name')
. "/uikit-v2/css/components/'.\$name.\$style.\$size.'.css'))";
$setter .= PHP_EOL . $tabV . $this->_t(5) . "{";
$setter .= PHP_EOL . $tabV . $this->_t(6) . "//" . $this->setLine(
@ -6796,7 +6797,7 @@ class Interpretation extends Fields
) . " load the css.";
$setter .= PHP_EOL . $tabV . $this->_t(6)
. "JHtml::_('stylesheet', 'media/com_"
. $this->componentCodeName
. Config::get('component_code_name')
. "/uikit-v2/css/components/'.\$name.\$style.\$size.'.css', ['version' => 'auto']);";
$setter .= PHP_EOL . $tabV . $this->_t(5) . "}";
$setter .= PHP_EOL . $tabV . $this->_t(5) . "//" . $this->setLine(
@ -6804,7 +6805,7 @@ class Interpretation extends Fields
) . " check if the JavaScript file exists.";
$setter .= PHP_EOL . $tabV . $this->_t(5)
. "if (File::exists(JPATH_ROOT.'/media/com_"
. $this->componentCodeName
. Config::get('component_code_name')
. "/uikit-v2/js/components/'.\$name.\$size.'.js'))";
$setter .= PHP_EOL . $tabV . $this->_t(5) . "{";
$setter .= PHP_EOL . $tabV . $this->_t(6) . "//" . $this->setLine(
@ -6812,7 +6813,7 @@ class Interpretation extends Fields
) . " load the js.";
$setter .= PHP_EOL . $tabV . $this->_t(6)
. "JHtml::_('script', 'media/com_"
. $this->componentCodeName
. Config::get('component_code_name')
. "/uikit-v2/js/components/'.\$name.\$size.'.js', ['version' => 'auto'], ['type' => 'text/javascript', 'async' => 'async']);";
$setter .= PHP_EOL . $tabV . $this->_t(5) . "}";
$setter .= PHP_EOL . $tabV . $this->_t(4) . "}";
@ -6841,7 +6842,7 @@ class Interpretation extends Fields
$setter .= PHP_EOL . $tabV . $this->_t(2) . "{";
$setter .= PHP_EOL . $tabV . $this->_t(3)
. "JHtml::_('stylesheet', 'media/com_"
. $this->componentCodeName
. Config::get('component_code_name')
. "/uikit-v3/css/uikit'.\$size.'.css', ['version' => 'auto']);";
$setter .= PHP_EOL . $tabV . $this->_t(2) . "}";
$setter .= PHP_EOL . $tabV . $this->_t(2) . "//" . $this->setLine(
@ -6852,11 +6853,11 @@ class Interpretation extends Fields
$setter .= PHP_EOL . $tabV . $this->_t(2) . "{";
$setter .= PHP_EOL . $tabV . $this->_t(3)
. "JHtml::_('script', 'media/com_"
. $this->componentCodeName
. Config::get('component_code_name')
. "/uikit-v3/js/uikit'.\$size.'.js', ['version' => 'auto']);";
$setter .= PHP_EOL . $tabV . $this->_t(3)
. "JHtml::_('script', 'media/com_"
. $this->componentCodeName
. Config::get('component_code_name')
. "/uikit-v3/js/uikit-icons'.\$size.'.js', ['version' => 'auto']);";
$setter .= PHP_EOL . $tabV . $this->_t(2) . "}";
if (2 == $this->uikit)
@ -7066,7 +7067,7 @@ class Interpretation extends Fields
if ('site' === $this->target)
{
return '<form action="<?php echo JRoute::_(\'index.php?option=com_'
. $this->componentCodeName
. Config::get('component_code_name')
. '\'); ?>" method="post" name="adminForm" id="adminForm">'
. PHP_EOL;
}
@ -7075,14 +7076,14 @@ class Interpretation extends Fields
if ($gettype == 2)
{
return '<form action="<?php echo JRoute::_(\'index.php?option=com_'
. $this->componentCodeName . '&view=' . $view
. Config::get('component_code_name') . '&view=' . $view
. '\'); ?>" method="post" name="adminForm" id="adminForm" class="form-validate" enctype="multipart/form-data">'
. PHP_EOL;
}
else
{
return '<form action="<?php echo JRoute::_(\'index.php?option=com_'
. $this->componentCodeName . '&view=' . $view
. Config::get('component_code_name') . '&view=' . $view
. '\' . $urlId); ?>" method="post" name="adminForm" id="adminForm" class="form-validate" enctype="multipart/form-data">'
. PHP_EOL;
}
@ -7557,7 +7558,7 @@ class Interpretation extends Fields
// get component name
$Component = $this->fileContentStatic[$this->hhh . 'Component'
. $this->hhh];
$component = $this->componentCodeName;
$component = Config::get('component_code_name');
// check if there was script added before modeling of data
$script .= $this->getCustomScriptBuilder(
'php_before_save', $view, PHP_EOL . PHP_EOL
@ -7756,7 +7757,7 @@ class Interpretation extends Fields
// reset
$oserver = "";
// set component name
$component = $this->componentCodeName;
$component = Config::get('component_code_name');
// add the tags observer
if (isset($this->tagsBuilder[$view])
&& StringHelper::check($this->tagsBuilder[$view]))
@ -7805,7 +7806,7 @@ class Interpretation extends Fields
))
{
// set component name
$component = $this->componentCodeName;
$component = Config::get('component_code_name');
// reset
$dbStuff = array();
// start loading the content type data
@ -7932,7 +7933,7 @@ class Interpretation extends Fields
$script = $this->setComponentToContentTypes('install');
// set the component name
$component = $this->componentCodeName;
$component = Config::get('component_code_name');
// add the assets table update for permissions rules
if (isset($this->assetsRules)
@ -8064,7 +8065,7 @@ class Interpretation extends Fields
. $this->fileContentStatic[$this->hhh . 'Component_name'
. $this->hhh] . '">';
$script .= PHP_EOL . $this->_t(4) . '<img src="components/com_'
. $this->componentCodeName . '/assets/images/vdm-component.'
. Config::get('component_code_name') . '/assets/images/vdm-component.'
. $this->componentImageType . '"/>';
$script .= PHP_EOL . $this->_t(4) . '</a>';
$script .= PHP_EOL . $this->_t(4) . "<h3>Upgrade to Version "
@ -8091,7 +8092,7 @@ class Interpretation extends Fields
$this->uninstallScriptBuilder
))
{
$component = $this->componentCodeName;
$component = Config::get('component_code_name');
// start loading the data to delet
$script .= PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__)
. " Get Application object";
@ -8574,7 +8575,7 @@ class Interpretation extends Fields
// column size is varchar(5120)
// check if we should add the intelligent fix treatment for the assets table
if ($this->addAssetsTableFix == 2)
if (Config::get('add_assets_table_fix') == 2)
{
// get the type we will convert to
$data_type = ($this->accessWorseCase > 64000) ? "MEDIUMTEXT"
@ -8621,7 +8622,7 @@ class Interpretation extends Fields
protected function getAssetsTableIntelligentUninstall()
{
// check if we should add the intelligent uninstall treatment for the assets table
if ($this->addAssetsTableFix == 2)
if (Config::get('add_assets_table_fix') == 2)
{
// the if statement about $rule_length
$codeIF = "\$rule_length < 5120";
@ -9000,7 +9001,7 @@ class Interpretation extends Fields
$routeHelper[] = $this->_t(3) . "//" . $this->setLine(__LINE__)
. " Create the link";
$routeHelper[] = $this->_t(3) . "\$link = 'index.php?option=com_"
. $this->componentCodeName . "&view=" . $nameSingleCode
. Config::get('component_code_name') . "&view=" . $nameSingleCode
. "&id='. \$id;";
$routeHelper[] = $this->_t(2) . "}";
$routeHelper[] = $this->_t(2) . "else";
@ -9014,7 +9015,7 @@ class Interpretation extends Fields
$routeHelper[] = $this->_t(3) . "//" . $this->setLine(__LINE__)
. " Create the link but don't add the id.";
$routeHelper[] = $this->_t(3) . "\$link = 'index.php?option=com_"
. $this->componentCodeName . "&view=" . $nameSingleCode
. Config::get('component_code_name') . "&view=" . $nameSingleCode
. "';";
$routeHelper[] = $this->_t(2) . "}";
if ('category' != $nameSingleCode
@ -9024,7 +9025,7 @@ class Interpretation extends Fields
$routeHelper[] = $this->_t(2) . "{";
$routeHelper[] = $this->_t(3)
. "\$categories = JCategories::getInstance('"
. $this->componentCodeName . "." . $nameListCode . "');";
. Config::get('component_code_name') . "." . $nameListCode . "');";
$routeHelper[] = $this->_t(3)
. "\$category = \$categories->get(\$catid);";
$routeHelper[] = $this->_t(3) . "if (\$category)";
@ -9120,7 +9121,7 @@ class Interpretation extends Fields
if (isset($get['selection']['table']))
{
$viewTable = str_replace(
'#__' . $this->componentCodeName . '_', '',
'#__' . Config::get('component_code_name') . '_', '',
$get['selection']['table']
);
}
@ -9977,7 +9978,7 @@ class Interpretation extends Fields
$fixUnique[] = $this->_t(4) . "}";
$fixUnique[] = PHP_EOL . $this->_t(4)
. "\$table = JTable::getInstance('" . $nameSingleCode . "', '"
. $this->componentCodeName . "Table');";
. Config::get('component_code_name') . "Table');";
if ($setCategory && count($titles) == 1)
{
$fixUnique[] = PHP_EOL . $this->_t(4)
@ -10701,7 +10702,7 @@ class Interpretation extends Fields
// also check if the developer will allow this
// the access actions length must be checked before this
// only add this option if set to SQL fix
if ($this->addAssetsTableFix == 1)
if (Config::get('add_assets_table_fix') == 1)
{
// 400 actions worse case is larger the 65535 characters
if ($this->accessSize > 400)
@ -10718,7 +10719,7 @@ class Interpretation extends Fields
. "ALTER TABLE `#__assets` CHANGE `rules` `rules` MEDIUMTEXT NOT NULL COMMENT 'JSON encoded access control. Enlarged to MEDIUMTEXT by JCB';";
}
// smaller then 400 makes TEXT large enough
elseif ($this->addAssetsTableFix == 1)
elseif (Config::get('add_assets_table_fix') == 1)
{
$db .= PHP_EOL;
$db .= PHP_EOL . '--';
@ -10737,7 +10738,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 ($this->addAssetsTableFix && $this->addAssetsTableNameFix)
if (Config::get('add_assets_table_fix') && $this->addAssetsTableNameFix)
{
$db .= PHP_EOL;
$db .= PHP_EOL . '--';
@ -10786,7 +10787,7 @@ class Interpretation extends Fields
// check if this component used larger rules
// now revert them back on uninstall
// only add this option if set to SQL fix
if ($this->addAssetsTableFix == 1)
if (Config::get('add_assets_table_fix') == 1)
{
// https://github.com/joomla/joomla-cms/blob/3.10.0-alpha3/installation/sql/mysql/joomla.sql#L22
// Checked 1st December 2020 (let us know if this changes)
@ -10805,7 +10806,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 ($this->addAssetsTableFix == 1 && $this->addAssetsTableNameFix)
if (Config::get('add_assets_table_fix') == 1 && $this->addAssetsTableNameFix)
{
// 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)
@ -11102,7 +11103,7 @@ class Interpretation extends Fields
// sort the strings
ksort($this->langContent['admin']);
// load to global languages
$this->languages['components'][$this->langTag]['admin']
$this->languages['components'][Config::get('lang_tag', 'en-GB')]['admin']
= $this->langContent['admin'];
// remove tmp array
unset($this->langContent['admin']);
@ -11197,7 +11198,7 @@ class Interpretation extends Fields
// sort the strings
ksort($this->langContent['site']);
// load to global languages
$this->languages['components'][$this->langTag]['site']
$this->languages['components'][Config::get('lang_tag', 'en-GB')]['site']
= $this->langContent['site'];
// remove tmp array
unset($this->langContent['site']);
@ -11254,7 +11255,7 @@ class Interpretation extends Fields
// sort strings
ksort($this->langContent['sitesys']);
// load to global languages
$this->languages['components'][$this->langTag]['sitesys']
$this->languages['components'][Config::get('lang_tag', 'en-GB')]['sitesys']
= $this->langContent['sitesys'];
// remove tmp array
unset($this->langContent['sitesys']);
@ -11300,7 +11301,7 @@ class Interpretation extends Fields
// sort strings
ksort($this->langContent['adminsys']);
// load to global languages
$this->languages['components'][$this->langTag]['adminsys']
$this->languages['components'][Config::get('lang_tag', 'en-GB')]['adminsys']
= $this->langContent['adminsys'];
// remove tmp array
unset($this->langContent['adminsys']);
@ -16972,7 +16973,7 @@ class Interpretation extends Fields
= '';
}
// minfy the script
if ($this->minify && isset($list_fileScript)
if (Config::get('minify', 0) && isset($list_fileScript)
&& StringHelper::check($list_fileScript))
{
// minify the fielScript javscript
@ -16981,7 +16982,7 @@ class Interpretation extends Fields
$list_fileScript = $minifier->minify();
}
// minfy the script
if ($this->minify && isset($fileScript)
if (Config::get('minify', 0) && isset($fileScript)
&& StringHelper::check($fileScript))
{
// minify the fielScript javscript
@ -16990,7 +16991,7 @@ class Interpretation extends Fields
$fileScript = $minifier->minify();
}
// minfy the script
if ($this->minify && isset($footerScript)
if (Config::get('minify', 0) && isset($footerScript)
&& StringHelper::check($footerScript))
{
// minify the footerScript javscript
@ -27688,6 +27689,7 @@ function vdm_dkim() {
// since we have less than 30 actions
// we do not need the fix for this component
$this->addAssetsTableFix = 0;
Config::set('add_assets_table_fix', $this->addAssetsTableFix);
}
else
{
@ -28389,8 +28391,8 @@ function vdm_dkim() {
$this->multiLangString = $this->getMultiLangStrings($values);
// start the modules language bucket (must rest every time)
$this->languages['modules'] = array();
$this->languages['modules'][$this->langTag] = array();
$this->languages['modules'][$this->langTag]['all']
$this->languages['modules'][Config::get('lang_tag', 'en-GB')] = array();
$this->languages['modules'][Config::get('lang_tag', 'en-GB')]['all']
= $this->langContent[$module->key];
unset($this->langContent[$module->key]);
// update insert the current lang in to DB
@ -28774,8 +28776,8 @@ function vdm_dkim() {
$this->multiLangString = $this->getMultiLangStrings($values);
// start the plugins language bucket (must rest every time)
$this->languages['plugins'] = array();
$this->languages['plugins'][$this->langTag] = array();
$this->languages['plugins'][$this->langTag]['all']
$this->languages['plugins'][Config::get('lang_tag', 'en-GB')] = array();
$this->languages['plugins'][Config::get('lang_tag', 'en-GB')]['all']
= $this->langContent[$plugin->key];
unset($this->langContent[$plugin->key]);
// update insert the current lang in to DB
@ -29176,11 +29178,11 @@ function vdm_dkim() {
// don't add the ending comma on last value
if ($size == $counter)
{
$autoloadMethod[] = $this->_t($tab_space) . $this->_t(2) . "'$this->jcbPowersPath/$base_dir' => '" . implode('\\\\', $prefix) . "'";
$autoloadMethod[] = $this->_t($tab_space) . $this->_t(2) . "'" . Config::get('jcb_powers_path', 'libraries/jcb_powers') . "/$base_dir' => '" . implode('\\\\', $prefix) . "'";
}
else
{
$autoloadMethod[] = $this->_t($tab_space) . $this->_t(2) . "'$this->jcbPowersPath/$base_dir' => '" . implode('\\\\', $prefix) . "',";
$autoloadMethod[] = $this->_t($tab_space) . $this->_t(2) . "'" . Config::get('jcb_powers_path', 'libraries/jcb_powers') . "/$base_dir' => '" . implode('\\\\', $prefix) . "',";
}
$counter++;
}
@ -29281,8 +29283,8 @@ function vdm_dkim() {
&$file_name
)
{
// only log messages for none $this->langTag translations
if ($this->langTag !== $tag)
// only log messages for none Config::get('lang_tag', 'en-GB') translations
if (Config::get('lang_tag', 'en-GB') !== $tag)
{
$langStringNr = count($languageStrings);
$langStringSum = MathHelper::bc(
@ -29295,7 +29297,7 @@ function vdm_dkim() {
. $tag . ' translated)'
: '(strings ' . $tag . ' translated)';
// force load if debug lines are added
if (!$this->debugLinenr)
if (!Config::get('debug_line_nr', false))
{
// check if we should install this translation
if ($percentage < $this->percentageLanguageAdd)
@ -29303,7 +29305,7 @@ function vdm_dkim() {
// dont add
$this->langNot[$file_name] = '<b>'
. $total . '</b>(total '
. $this->langTag . ' strings) only <b>'
. Config::get('lang_tag', 'en-GB') . ' strings) only <b>'
. $langStringNr . '</b>' . $stringNAme
. ' = ' . $percentage;
@ -29313,7 +29315,7 @@ function vdm_dkim() {
// show if it was added as well
$this->langSet[$file_name] = '<b>'
. $total . '</b>(total '
. $this->langTag . ' strings) and <b>'
. Config::get('lang_tag', 'en-GB') . ' strings) and <b>'
. $langStringNr . '</b>' . $stringNAme . ' = '
. $percentage;
}

View File

@ -20,6 +20,7 @@ use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use VDM\Joomla\Utilities\FileHelper;
use VDM\Joomla\Componentbuilder\Extension\InstallScript;
use VDM\Joomla\Componentbuilder\Factory\Compiler\Config;
/**
* Infusion class
@ -55,7 +56,7 @@ class Infusion extends Interpretation
*/
private function setLine($nr)
{
if ($this->debugLinenr)
if (Config::get('debug_line_nr', false))
{
return ' [Infusion ' . $nr . ']';
}
@ -189,7 +190,7 @@ class Infusion extends Interpretation
// set the joomla target xml version
$this->fileContentStatic[$this->hhh . 'XMLVERSION' . $this->hhh]
= $this->joomlaVersions[$this->joomlaVersion]['xml_version'];
= $this->joomlaVersions[Config::get('version', 3)]['xml_version'];
// Component_name
$this->fileContentStatic[$this->hhh . 'Component_name' . $this->hhh]
@ -440,7 +441,7 @@ class Infusion extends Interpretation
$this->fileContentDynamic[$nameSingleCode][$this->hhh
. 'FIELDSETS' . $this->hhh]
= $this->setFieldSet(
$view, $this->componentCodeName,
$view, Config::get('component_code_name'),
$nameSingleCode,
$nameListCode
);
@ -774,7 +775,7 @@ class Infusion extends Interpretation
. 'AUTOCHECKIN' . $this->hhh]
= $this->setAutoCheckin(
$nameSingleCode,
$this->componentCodeName
Config::get('component_code_name')
);
// CHECKINCALL <<<DYNAMIC>>>
$this->fileContentDynamic[$nameListCode][$this->hhh
@ -1038,7 +1039,7 @@ class Infusion extends Interpretation
&& StringHelper::check($footerScript))
{
// only minfy if no php is added to the footer script
if ($this->minify
if (Config::get('minify', 0)
&& strpos($footerScript, '<?php') === false)
{
// minfy the script
@ -1333,12 +1334,12 @@ class Infusion extends Interpretation
// add to lang array
$this->setLangContent(
$this->lang,
$this->langPrefix . '_' . $view['settings']->CODE,
Config::get('lang_prefix') . '_' . $view['settings']->CODE,
$view['settings']->name
);
$this->setLangContent(
$this->lang,
$this->langPrefix . '_' . $view['settings']->CODE
Config::get('lang_prefix') . '_' . $view['settings']->CODE
. '_DESC', $view['settings']->description
);
// ICOMOON <<<DYNAMIC>>>
@ -1677,47 +1678,47 @@ class Infusion extends Interpretation
// DASHBOARDVIEW
$this->fileContentStatic[$this->hhh . 'DASHBOARDVIEW'
. $this->hhh]
= $this->componentCodeName;
= Config::get('component_code_name');
// DASHBOARDICONS
$this->fileContentDynamic[$this->componentCodeName][$this->hhh
$this->fileContentDynamic[Config::get('component_code_name')][$this->hhh
. 'DASHBOARDICONS' . $this->hhh]
= $this->setDashboardIcons();
// DASHBOARDICONACCESS
$this->fileContentDynamic[$this->componentCodeName][$this->hhh
$this->fileContentDynamic[Config::get('component_code_name')][$this->hhh
. 'DASHBOARDICONACCESS' . $this->hhh]
= $this->setDashboardIconAccess();
// DASH_MODEL_METHODS
$this->fileContentDynamic[$this->componentCodeName][$this->hhh
$this->fileContentDynamic[Config::get('component_code_name')][$this->hhh
. 'DASH_MODEL_METHODS' . $this->hhh]
= $this->setDashboardModelMethods();
// DASH_GET_CUSTOM_DATA
$this->fileContentDynamic[$this->componentCodeName][$this->hhh
$this->fileContentDynamic[Config::get('component_code_name')][$this->hhh
. 'DASH_GET_CUSTOM_DATA' . $this->hhh]
= $this->setDashboardGetCustomData();
// DASH_DISPLAY_DATA
$this->fileContentDynamic[$this->componentCodeName][$this->hhh
$this->fileContentDynamic[Config::get('component_code_name')][$this->hhh
. 'DASH_DISPLAY_DATA' . $this->hhh]
= $this->setDashboardDisplayData();
// DASH_VIEW_HEADER
$this->fileContentDynamic[$this->componentCodeName][$this->hhh
$this->fileContentDynamic[Config::get('component_code_name')][$this->hhh
. 'DASH_VIEW_HEADER' . $this->hhh]
= $this->setFileHeader('dashboard.view', 'dashboard');
// DASH_VIEW_HTML_HEADER
$this->fileContentDynamic[$this->componentCodeName][$this->hhh
$this->fileContentDynamic[Config::get('component_code_name')][$this->hhh
. 'DASH_VIEW_HTML_HEADER' . $this->hhh]
= $this->setFileHeader('dashboard.view.html', 'dashboard');
// DASH_MODEL_HEADER
$this->fileContentDynamic[$this->componentCodeName][$this->hhh
$this->fileContentDynamic[Config::get('component_code_name')][$this->hhh
. 'DASH_MODEL_HEADER' . $this->hhh]
= $this->setFileHeader('dashboard.model', 'dashboard');
// DASH_CONTROLLER_HEADER
$this->fileContentDynamic[$this->componentCodeName][$this->hhh
$this->fileContentDynamic[Config::get('component_code_name')][$this->hhh
. 'DASH_CONTROLLER_HEADER' . $this->hhh]
= $this->setFileHeader('dashboard.controller', 'dashboard');
}
@ -2018,12 +2019,12 @@ class Infusion extends Interpretation
// add to lang array
$this->setLangContent(
'site',
$this->langPrefix . '_' . $view['settings']->CODE,
Config::get('lang_prefix') . '_' . $view['settings']->CODE,
$view['settings']->name
);
$this->setLangContent(
'site',
$this->langPrefix . '_' . $view['settings']->CODE
Config::get('lang_prefix') . '_' . $view['settings']->CODE
. '_DESC', $view['settings']->description
);
// SITE_CUSTOM_METHODS <<<DYNAMIC>>>
@ -2351,7 +2352,7 @@ class Infusion extends Interpretation
// tweak system to set stuff to the module domain
$_backup_target = $this->target;
$_backup_lang = $this->lang;
$_backup_langPrefix = $this->langPrefix;
$_backup_langPrefix = Config::get('lang_prefix');
// infuse module data if set
if (ArrayHelper::check($this->joomlaModules))
{
@ -2367,6 +2368,7 @@ class Infusion extends Interpretation
$this->target = $module->key;
$this->lang = $module->key;
$this->langPrefix = $module->lang_prefix;
Config::set('lang_prefix', $module->lang_prefix);
// MODCODE
$this->fileContentDynamic[$module->key][$this->hhh
. 'MODCODE' . $this->hhh]
@ -2394,7 +2396,7 @@ class Infusion extends Interpretation
// INSTALLCLASS
$this->fileContentDynamic[$module->key][$this->hhh
. 'INSTALLCLASS' . $this->hhh]
= (new InstallScript($module, ['debug' => $this->debugLinenr]))->get();
= (new InstallScript($module))->get();
}
// FIELDSET
if (isset($module->form_files)
@ -2446,6 +2448,7 @@ class Infusion extends Interpretation
$this->target = $plugin->key;
$this->lang = $plugin->key;
$this->langPrefix = $plugin->lang_prefix;
Config::set('lang_prefix', $plugin->lang_prefix);
// MAINCLASS
$this->fileContentDynamic[$plugin->key][$this->hhh
. 'MAINCLASS' . $this->hhh]
@ -2456,7 +2459,7 @@ class Infusion extends Interpretation
// INSTALLCLASS
$this->fileContentDynamic[$plugin->key][$this->hhh
. 'INSTALLCLASS' . $this->hhh]
= (new InstallScript($plugin, ['debug' => $this->debugLinenr]))->get();
= (new InstallScript($plugin))->get();
}
// FIELDSET
if (isset($plugin->form_files)
@ -2497,6 +2500,7 @@ class Infusion extends Interpretation
$this->target = $_backup_target;
$this->lang = $_backup_lang;
$this->langPrefix = $_backup_langPrefix;
Config::set('lang_prefix', $_backup_langPrefix);
// Trigger Event: jcb_ce_onAfterBuildFilesContent
$this->triggerEvent(
'jcb_ce_onAfterBuildFilesContent',
@ -2649,20 +2653,20 @@ class Infusion extends Interpretation
if ($this->setLangAdmin())
{
$values[] = array_values(
$this->languages['components'][$this->langTag]['admin']
$this->languages['components'][Config::get('lang_tag', 'en-GB')]['admin']
);
$mainLangLoader['admin'] = count(
$this->languages['components'][$this->langTag]['admin']
$this->languages['components'][Config::get('lang_tag', 'en-GB')]['admin']
);
}
// check the admin system lang is set
if ($this->setLangAdminSys())
{
$values[] = array_values(
$this->languages['components'][$this->langTag]['adminsys']
$this->languages['components'][Config::get('lang_tag', 'en-GB')]['adminsys']
);
$mainLangLoader['adminsys'] = count(
$this->languages['components'][$this->langTag]['adminsys']
$this->languages['components'][Config::get('lang_tag', 'en-GB')]['adminsys']
);
}
// check the site lang is set
@ -2670,10 +2674,10 @@ class Infusion extends Interpretation
&& $this->setLangSite())
{
$values[] = array_values(
$this->languages['components'][$this->langTag]['site']
$this->languages['components'][Config::get('lang_tag', 'en-GB')]['site']
);
$mainLangLoader['site'] = count(
$this->languages['components'][$this->langTag]['site']
$this->languages['components'][Config::get('lang_tag', 'en-GB')]['site']
);
}
// check the site system lang is set
@ -2681,19 +2685,19 @@ class Infusion extends Interpretation
&& $this->setLangSiteSys())
{
$values[] = array_values(
$this->languages['components'][$this->langTag]['sitesys']
$this->languages['components'][Config::get('lang_tag', 'en-GB')]['sitesys']
);
$mainLangLoader['sitesys'] = count(
$this->languages['components'][$this->langTag]['sitesys']
$this->languages['components'][Config::get('lang_tag', 'en-GB')]['sitesys']
);
}
$values = array_unique(ArrayHelper::merge($values));
// get the other lang strings if there is any
$this->multiLangString = $this->getMultiLangStrings($values);
// update insert the current lang in to DB
$this->setLangPlaceholders($values, $this->componentID);
$this->setLangPlaceholders($values, Config::get('component_id'));
// remove old unused language strings
$this->purgeLanuageStrings($values, $this->componentID);
$this->purgeLanuageStrings($values, Config::get('component_id'));
// path to INI file
$getPAth = $this->templatePath . '/en-GB.com_admin.ini';
// Trigger Event: jcb_ce_onBeforeBuildAllLangFiles
@ -2730,7 +2734,7 @@ class Infusion extends Interpretation
$t = '.sys';
}
// build the file name
$file_name = $tag . '.com_' . $this->componentCodeName . $t
$file_name = $tag . '.com_' . Config::get('component_code_name') . $t
. '.ini';
// check if language should be added
if ($this->shouldLanguageBeAdded(
@ -2796,7 +2800,7 @@ class Infusion extends Interpretation
= implode(PHP_EOL . $this->_t(2), $langXML['site']);
}
// build xml path
$xmlPath = $this->componentPath . '/' . $this->componentCodeName
$xmlPath = $this->componentPath . '/' . Config::get('component_code_name')
. '.xml';
// get the content in xml
$componentXML = FileHelper::getContent(

View File

@ -297,8 +297,8 @@
type="text"
name="implements_custom"
label="COM_COMPONENTBUILDER_POWER_IMPLEMENTS_CUSTOM_LABEL"
size="10"
maxlength="50"
size="50"
maxlength="150"
description="COM_COMPONENTBUILDER_POWER_IMPLEMENTS_CUSTOM_DESCRIPTION"
class="text_area span12"
filter="STRING"

File diff suppressed because one or more lines are too long

View File

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

View File

@ -0,0 +1,178 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Componentbuilder\Compiler;
use Joomla\Registry\Registry;
use VDM\Joomla\Utilities\Component\Helper;
use VDM\Joomla\Utilities\GetHelper;
use VDM\Joomla\Utilities\StringHelper;
/**
* Compiler Configurations Registry
*
* @since 3.1.6
*/
class Config extends Registry implements \JsonSerializable, \ArrayAccess, \IteratorAggregate, \Countable
{
/**
* The Params
*
* @var Registry
* @since 3.1.6
*/
protected Registry $params;
/**
* Constructor
*
* @param array $config The data to bind to the new Config object.
* @param Registry $params The component parameters
*
* @since 3.1.6
*/
public function __construct(array $config, ?Registry $params = null)
{
// Set the params
$this->params = $params ?: Helper::getParams('com_componentbuilder');
// Instantiate the internal data object.
$this->data = new \stdClass;
// Load the config to the data object
$this->bindData($this->data, $this->modelConfig($config));
}
/**
* model the configuration data array
*
* @param array $config The data to bind to the new Config object.
*
* @return array
* @since 3.1.6
*/
protected function modelConfig(array $config): array
{
// we do not yet have this set as an option
$config['remove_line_breaks']
= 2; // 2 is global (use the components value)
// set the minfy switch of the JavaScript
$config['minify'] = (isset($config['minify']) && $config['minify'] != 2)
? $config['minify'] : $this->params->get('minify', 0);
// set the global language
$config['lang_tag'] = $this->params->get('language', 'en-GB');
// check if we have Tidy enabled
$config['tidy'] = extension_loaded('Tidy');
// set the field type builder
$config['field_builder_type'] = $this->params->get(
'compiler_field_builder_type', 2
);
// load the compiler path
$config['compiler_path'] = $this->params->get(
'compiler_folder_path',
JPATH_COMPONENT_ADMINISTRATOR . '/compiler'
);
// load the jcb powers path
$config['jcb_powers_path'] = $this->params->get(
'jcb_powers_path',
'libraries/jcb_powers');
// set the component ID
$config['component_id'] = (int)$config['component'];
// TODO set up stream correctly
unset($config['component']);
// set this components code name
if ($name_code = GetHelper::var(
'joomla_component', $config['component_id'], 'id', 'name_code'
)) {
// set lang prefix
$config['lang_prefix'] = 'COM_' . StringHelper::safe(
$name_code, 'U'
);
// set component code name
$config['component_code_name'] = StringHelper::safe(
$name_code
);
// set component context
$config['component_context'] = $config['component_code_name'] . '.'
. $config['component_id'];
// set the component name length
$config['component_code_name_length'] = strlen(
$config['component_code_name']
);
// add assets table fix
$global = (int)$this->params->get(
'assets_table_fix', 1
);
$config['add_assets_table_fix'] = (($add_assets_table_fix
= (int)GetHelper::var(
'joomla_component', $config['component_id'], 'id',
'assets_table_fix'
)) == 3) ? $global : $add_assets_table_fix;
// set if language strings line breaks should be removed
$global = ((int)GetHelper::var(
'joomla_component', $config['component_id'], 'id',
'remove_line_breaks'
) == 1) ? true : false;
$config['remove_line_breaks'] = ((int)$config['remove_line_breaks']
== 0)
? false
: (((int)$config['remove_line_breaks'] == 1) ? true
: $global);
// set if placeholders should be added to customcode
$global = ((int)GetHelper::var(
'joomla_component', $config['component_id'], 'id',
'add_placeholders'
) == 1) ? true : false;
$config['add_placeholders'] = ((int)$config['placeholders'] == 0)
? false
: (((int)$config['placeholders'] == 1) ? true : $global);
// TODO set up stream correctly
unset($config['placeholders']);
// set if line numbers should be added to comments
$global = ((int)GetHelper::var(
'joomla_component', $config['component_id'], 'id',
'debug_linenr'
) == 1) ? true : false;
$config['debug_line_nr'] = ((int)$config['debuglinenr'] == 0) ? false
: (((int)$config['debuglinenr'] == 1) ? true : $global);
// set if powers should be added to component (default is true)
$global = ((int)GetHelper::var(
'joomla_component', $config['component_id'], 'id',
'add_powers'
) == 1) ? true : false;
$config['add_power'] = (isset($config['powers']) && (int)$config['powers'] == 0)
? false : ((isset($config['powers']) && (int)$config['powers'] == 1) ? true : $global);
// TODO set up stream correctly
unset($config['powers']);
}
return $config;
}
}

View File

@ -131,14 +131,8 @@ class InstallScript
* Constructor
* @since 3.1.5
*/
public function __construct(object $extension, ?array $config = null)
public function __construct(object $extension)
{
// check if we have the debug switch TODO - move to global registry - singleton
if (isset($config['debug']))
{
$this->debug = $config['debug'];
}
// loop over methods and types
foreach ($this->methods as $method)
{

View File

@ -0,0 +1,257 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Componentbuilder\Factory\Compiler;
use Joomla\CMS\Factory;
use Joomla\Registry\Registry;
use VDM\Joomla\Componentbuilder\Compiler\Config as CompilerConfig;
use VDM\Joomla\Utilities\ArrayHelper;
/**
* Factory to load the compiler config
*/
abstract class Config
{
/**
* Global Config object
*
* @var CompilerConfig
* @since 3.1.6
**/
protected static $CompilerConfig = null;
/**
* Get a value.
*
* @param string $path Registry path (e.g. version)
* @param mixed $default Optional default value, returned if the internal value is null.
*
* @return mixed Value of entry or null
*
* @since 3.1.6
*/
public static function get(string $path, $default = null)
{
// check that if we already have config registry set
if (!self::$CompilerConfig)
{
// create config registry
self::$CompilerConfig = self::create();
}
// return the value or default if none is found
return self::$CompilerConfig->get($path, $default);
}
/**
* Check if a registry path exists.
*
* @param string $path Registry path (e.g. guid.main.0.path)
*
* @return boolean
*
* @since 3.1.6
*/
public static function exists($path)
{
// check that if we already have config registry set
if (!self::$CompilerConfig)
{
// create config registry
self::$CompilerConfig = self::create();
}
// check if exists
return self::$CompilerConfig->exists($path);
}
/**
* Method to extract a sub-registry from path
*
* @param string $path Registry path (e.g. guid.main)
*
* @return Registry Registry object (empty if no data is present)
*
* @since 3.1.6
*/
public function extract($path)
{
if (!self::exists($path))
{
// create config registry
return new Registry();
}
return self::$CompilerConfig->extract($path);
}
/**
* Gets this object represented as an ArrayIterator.
*
* This allows the data properties to be accessed via a foreach statement.
*
* @return \ArrayIterator This object represented as an ArrayIterator.
*
* @see IteratorAggregate::getIterator()
* @since 3.1.6
*/
#[\ReturnTypeWillChange]
public static function getIterator()
{
// check that if we already have config registry set
if (!self::$CompilerConfig)
{
// create config registry
self::$CompilerConfig = self::create();
}
return self::$CompilerConfig->getIterator();
}
/**
* Set a registry value.
*
* @param string $path Registry Path (e.g. guid.main.0.url)
* @param mixed $value Value of entry
* @param string $separator The key separator
*
* @return mixed The value of the that has been set.
*
* @since 3.1.6
*/
public static function set($path, $value, $separator = null)
{
// check that if we already have config registry set
if (!self::$CompilerConfig)
{
// create config registry
self::$CompilerConfig = self::create();
}
self::$CompilerConfig->set($path, $value, $separator);
}
/**
* Delete a registry value
*
* @param string $path Registry Path (e.g. guid.main.0.url)
*
* @return mixed The value of the removed node or null if not set
*
* @since 3.1.6
*/
public static function remove($path)
{
// check that if we already have config registry set
if (!self::$CompilerConfig)
{
// create config registry
self::$CompilerConfig = self::create();
}
// remove the actual value
return self::$CompilerConfig->remove($path);
}
/**
* Transforms a namespace to an array
*
* @return array An associative array holding the namespace data
*
* @since 3.1.6
*/
public static function toArray()
{
// check that if we already have config registry set
if (!self::$CompilerConfig)
{
// create config registry
self::$CompilerConfig = self::create();
}
return self::$CompilerConfig->toArray();
}
/**
* Transforms a namespace to an object
*
* @return object An an object holding the namespace data
*
* @since 3.1.6
*/
public static function toObject()
{
// check that if we already have config registry set
if (!self::$CompilerConfig)
{
// create config registry
self::$CompilerConfig = self::create();
}
return self::$CompilerConfig->toObject();
}
/**
* Initialize a CompilerConfig object if id does not exist.
*
* Returns the global {@link CompilerConfig} object, only creating it if it doesn't already exist.
*
* @param array $config The data to bind to the new Config object.
*
*
* @return CompilerConfig object
*
* @see Session
* @since 3.1.6
**/
public static function init($config = null): CompilerConfig
{
if (!self::$CompilerConfig)
{
self::$CompilerConfig = self::create($config);
}
return self::$CompilerConfig;
}
/**
* Create a CompilerConfig object
*
* @param array $config The data to bind to the new Config object.
*
* @return CompilerConfig object
* @since 3.1.6
* @throws \Exception
**/
protected static function create($config = null): CompilerConfig
{
// get the session
$session = Factory::getSession();
// check if we have config
if (ArrayHelper::check($config))
{
// save for later should we call this out of scope
$session->set('Componentbuilder.Compiler.Config', $config);
}
// if not found try loading it from the session
elseif (($config = $session->get('Componentbuilder.Compiler.Config', false)) === false)
{
throw new \Exception('Compiler configuration not found.');
}
return new CompilerConfig($config);
}
}

View File

@ -12,6 +12,9 @@
namespace VDM\Joomla\Componentbuilder;
use VDM\Joomla\Componentbuilder\Factory\Compiler\Config;
/**
* Add line comment
*
@ -19,14 +22,6 @@ namespace VDM\Joomla\Componentbuilder;
*/
trait Line
{
/**
* The debug switch
*
* @var bool
* @since 3.1.5
*/
protected bool $debug = false;
/**
* Set the line number in comments
*
@ -37,7 +32,7 @@ trait Line
*/
private function setLine(int $nr): string
{
if ($this->debug)
if (Config::get('debug_line_nr', false))
{
return ' [' . get_called_class() . ' ' . $nr . ']';
}