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) + *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io)
+ *Name*: [Component Builder](https://git.vdm.dev/joomla/Component-Builder) + *Name*: [Component Builder](https://git.vdm.dev/joomla/Component-Builder)
+ *First Build*: 30th April, 2015 + *First Build*: 30th April, 2015
+ *Last Build*: 20th August, 2022 + *Last Build*: 21st August, 2022
+ *Version*: 3.1.5 + *Version*: 3.1.5
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved. + *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt + *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **311846** + *Line count*: **312270**
+ *Field count*: **2002** + *Field count*: **2002**
+ *File count*: **2055** + *File count*: **2057**
+ *Folder count*: **351** + *Folder count*: **351**
> This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](http://joomlacomponentbuilder.com). > 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) + *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io)
+ *Name*: [Component Builder](https://git.vdm.dev/joomla/Component-Builder) + *Name*: [Component Builder](https://git.vdm.dev/joomla/Component-Builder)
+ *First Build*: 30th April, 2015 + *First Build*: 30th April, 2015
+ *Last Build*: 20th August, 2022 + *Last Build*: 21st August, 2022
+ *Version*: 3.1.5 + *Version*: 3.1.5
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved. + *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt + *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **311846** + *Line count*: **312270**
+ *Field count*: **2002** + *Field count*: **2002**
+ *File count*: **2055** + *File count*: **2057**
+ *Folder count*: **351** + *Folder count*: **351**
> This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](http://joomlacomponentbuilder.com). > 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\ObjectHelper;
use VDM\Joomla\Utilities\FileHelper; use VDM\Joomla\Utilities\FileHelper;
use VDM\Joomla\Utilities\MathHelper; use VDM\Joomla\Utilities\MathHelper;
use VDM\Joomla\Componentbuilder\Factory\Compiler\Config;
// Use the component builder autoloader // Use the component builder autoloader
ComponentbuilderHelper::autoLoader(); ComponentbuilderHelper::autoLoader();
@ -183,7 +184,7 @@ class Compiler extends Infusion
'because more then %s% of the strings have been translated.', 'because more then %s% of the strings have been translated.',
$this->percentageLanguageAdd $this->percentageLanguageAdd
); );
if ($this->debugLinenr) if (Config::get('debug_line_nr', false))
{ {
$whyAddedLang = JText::_( $whyAddedLang = JText::_(
'because the debugging mode is on. (debug line numbers)' '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.' '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 // set assets table rules column notice
if ($this->addAssetsTableFix) if (Config::get('add_assets_table_fix'))
{ {
$this->app->enqueueMessage( $this->app->enqueueMessage(
JText::_('<hr /><h3>Assets Table Notice</h3>'), 'Notice' JText::_('<hr /><h3>Assets Table Notice</h3>'), 'Notice'
); );
$asset_table_fix_type = ($this->addAssetsTableFix == 2) $asset_table_fix_type = (Config::get('add_assets_table_fix') == 2)
? 'intelligent' : 'sql'; ? 'intelligent' : 'sql';
$this->app->enqueueMessage( $this->app->enqueueMessage(
JText::sprintf( JText::sprintf(
@ -244,7 +245,7 @@ class Compiler extends Infusion
); );
} }
// set assets table name column warning if not set // 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 // only add if not already added
if ($this->accessSize < 30) if ($this->accessSize < 30)
@ -322,7 +323,7 @@ class Compiler extends Infusion
// add the mismatching issues // add the mismatching issues
foreach ($mismatch as $string) foreach ($mismatch as $string)
{ {
$constant = $this->langPrefix . '_' $constant = Config::get('lang_prefix') . '_'
. StringHelper::safe($string, 'U'); . StringHelper::safe($string, 'U');
$this->app->enqueueMessage( $this->app->enqueueMessage(
JText::sprintf( JText::sprintf(
@ -374,7 +375,7 @@ class Compiler extends Infusion
*/ */
private function setLine($nr) private function setLine($nr)
{ {
if ($this->debugLinenr) if (Config::get('debug_line_nr', false))
{ {
return ' [Compiler ' . $nr . ']'; return ' [Compiler ' . $nr . ']';
} }
@ -994,7 +995,7 @@ class Compiler extends Infusion
// set the repo path // set the repo path
$repoFullPath = $this->repoPath . '/com_' $repoFullPath = $this->repoPath . '/com_'
. $this->componentData->sales_name . '__joomla_' . $this->componentData->sales_name . '__joomla_'
. $this->joomlaVersion; . Config::get('version', 3);
// Trigger Event: jcb_ce_onBeforeUpdateRepo // Trigger Event: jcb_ce_onBeforeUpdateRepo
$this->triggerEvent( $this->triggerEvent(
'jcb_ce_onBeforeUpdateRepo', 'jcb_ce_onBeforeUpdateRepo',
@ -1025,7 +1026,7 @@ class Compiler extends Infusion
// set the repo path // set the repo path
$repoFullPath = $this->repoPath . '/' $repoFullPath = $this->repoPath . '/'
. $module->folder_name . '__joomla_' . $module->folder_name . '__joomla_'
. $this->joomlaVersion; . Config::get('version', 3);
// Trigger Event: jcb_ce_onBeforeUpdateRepo // Trigger Event: jcb_ce_onBeforeUpdateRepo
$this->triggerEvent( $this->triggerEvent(
'jcb_ce_onBeforeUpdateRepo', 'jcb_ce_onBeforeUpdateRepo',
@ -1062,7 +1063,7 @@ class Compiler extends Infusion
// set the repo path // set the repo path
$repoFullPath = $this->repoPath . '/' $repoFullPath = $this->repoPath . '/'
. $plugin->folder_name . '__joomla_' . $plugin->folder_name . '__joomla_'
. $this->joomlaVersion; . Config::get('version', 3);
// Trigger Event: jcb_ce_onBeforeUpdateRepo // Trigger Event: jcb_ce_onBeforeUpdateRepo
$this->triggerEvent( $this->triggerEvent(
'jcb_ce_onBeforeUpdateRepo', '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\ClassfunctionHelper;
use VDM\Joomla\Utilities\String\NamespaceHelper; use VDM\Joomla\Utilities\String\NamespaceHelper;
use VDM\Joomla\Utilities\String\PluginHelper; use VDM\Joomla\Utilities\String\PluginHelper;
use VDM\Joomla\Componentbuilder\Factory\Compiler\Config;
/** /**
* Get class as the main compilers class * Get class as the main compilers class
@ -38,6 +39,7 @@ class Get
* The Joomla Version * The Joomla Version
* *
* @var string * @var string
* @deprecated 4.0 Use Config::get('version');
*/ */
public $joomlaVersion; public $joomlaVersion;
@ -118,6 +120,7 @@ class Get
* The Compiler Path * The Compiler Path
* *
* @var object * @var object
* @deprecated 4.0 Use Config::get('compiler_path');
*/ */
public $compilerPath; public $compilerPath;
@ -125,6 +128,7 @@ class Get
* The JCB Powers Path * The JCB Powers Path
* *
* @var object * @var object
* @deprecated 4.0 Use Config::get('jcb_powers_path');
*/ */
public $jcbPowersPath; public $jcbPowersPath;
@ -132,6 +136,7 @@ class Get
* Switch to add assets table fix * Switch to add assets table fix
* *
* @var int * @var int
* @deprecated 4.0 Use Config::get('add_assets_table_fix');
*/ */
public $addAssetsTableFix = 1; public $addAssetsTableFix = 1;
@ -153,6 +158,7 @@ class Get
* Switch to add custom code placeholders * Switch to add custom code placeholders
* *
* @var bool * @var bool
* @deprecated 4.0 Use Config::get('add_placeholders');
*/ */
public $addPlaceholders = false; public $addPlaceholders = false;
@ -160,6 +166,7 @@ class Get
* Switch to remove line breaks from language strings * Switch to remove line breaks from language strings
* *
* @var bool * @var bool
* @deprecated 4.0 Use Config::get('remove_line_breaks');
*/ */
public $removeLineBreaks = false; public $removeLineBreaks = false;
@ -188,6 +195,7 @@ class Get
* The Switch to add Powers data * The Switch to add Powers data
* *
* @var boolean * @var boolean
* @deprecated 4.0 Use Config::get('add_power');
*/ */
public $addPower; public $addPower;
@ -334,6 +342,7 @@ class Get
* The line numbers Switch * The line numbers Switch
* *
* @var boolean * @var boolean
* @deprecated 4.0 Use Config::get('debug_line_nr');
*/ */
public $debugLinenr = false; public $debugLinenr = false;
@ -348,6 +357,7 @@ class Get
* The Placholder Language prefix * The Placholder Language prefix
* *
* @var string * @var string
* @deprecated 4.0 Use Config::get('lang_prefix');
*/ */
public $langPrefix; public $langPrefix;
@ -371,6 +381,7 @@ class Get
* The Main Languages * The Main Languages
* *
* @var string * @var string
* @deprecated 4.0 Use Config::get('lang_tag');
*/ */
public $langTag = 'en-GB'; public $langTag = 'en-GB';
@ -427,13 +438,23 @@ class Get
* The Component Code Name * The Component Code Name
* *
* @var string * @var string
* @deprecated 4.0 Use Config::get('component_code_name');
*/ */
public $componentCodeName; public $componentCodeName;
/**
* The Component Context
*
* @var string
* @deprecated 4.0 Use Config::get('component_context');
*/
public $componentContext;
/** /**
* The Component Code Name Length * The Component Code Name Length
* *
* @var int * @var int
* @deprecated 4.0 Use Config::get('component_code_name_length');
*/ */
public $componentCodeNameLength; public $componentCodeNameLength;
@ -441,6 +462,7 @@ class Get
* The Component ID * The Component ID
* *
* @var int * @var int
* @deprecated 4.0 Use Config::get('component_id');
*/ */
public $componentID; public $componentID;
@ -668,6 +690,7 @@ class Get
* 2 = SimpleXMLElement * 2 = SimpleXMLElement
* *
* @var int * @var int
* @deprecated 4.0 Use Config::get('field_builder_type');
*/ */
public $fieldBuilderType; public $fieldBuilderType;
@ -880,6 +903,7 @@ class Get
* Is minify Enabled * Is minify Enabled
* *
* @var int * @var int
* @deprecated 4.0 Use Config::get('minify');
*/ */
public $minify = 0; public $minify = 0;
@ -887,6 +911,7 @@ class Get
* Is Tidy Enabled * Is Tidy Enabled
* *
* @var bool * @var bool
* @deprecated 4.0 Use Config::get('tidy');
*/ */
public $tidy = false; public $tidy = false;
@ -929,210 +954,156 @@ class Get
*/ */
public function __construct($config = array()) public function __construct($config = array())
{ {
if (isset($config) && count($config)) // we do not yet have this set as an option
$config['remove_line_breaks']
= 2; // 2 is global (use the components value)
// load application
$this->app = JFactory::getApplication();
// Set the params
$this->params = JComponentHelper::getParams('com_componentbuilder');
// get active plugins
if (($plugins = $this->params->get('compiler_plugin', false))
!== false)
{ {
// we do not yet have this set as an option foreach ($plugins as $plugin)
$config['remove_line_breaks']
= 2; // 2 is global (use the components value)
// load application
$this->app = JFactory::getApplication();
// Set the params
$this->params = JComponentHelper::getParams('com_componentbuilder');
// get active plugins
if (($plugins = $this->params->get('compiler_plugin', false))
!== false)
{ {
foreach ($plugins as $plugin) // get possible plugins
if (\JPluginHelper::isEnabled('extension', $plugin))
{ {
// get possible plugins // Import the appropriate plugin group.
if (\JPluginHelper::isEnabled('extension', $plugin)) \JPluginHelper::importPlugin('extension', $plugin);
{ // activate events
// Import the appropriate plugin group. $this->active_plugins = true;
\JPluginHelper::importPlugin('extension', $plugin);
// activate events
$this->active_plugins = true;
}
} }
} }
// 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);
// also set the helper class langTag (for safeStrings)
ComponentbuilderHelper::$langTag = $this->langTag;
// 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
);
// check the field builder type logic
if (!$this->tidy && $this->fieldBuilderType == 2)
{
// we do not have the tidy extension set fall back to StringManipulation
$this->fieldBuilderType = 1;
// load the sugestion to use string manipulation
$this->app->enqueueMessage(
JText::_('<hr /><h3>Field Notice</h3>'), 'Notice'
);
$this->app->enqueueMessage(
JText::_(
'Since you do not have <b>Tidy</b> extentsion setup on your system, we could not use the SimpleXMLElement class. We instead used <b>string manipulation</b> to build all your fields, this is a faster method, you must inspect the xml files in your component package to see if you are satisfied with the result.<br />You can make this method your default by opening the global options of JCB and under the <b>Global</b> tab set the <b>Field Builder Type</b> to string manipulation.'
), '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);
// set the current user
$this->user = JFactory::getUser();
// Get a db connection.
$this->db = JFactory::getDbo();
// get global placeholders
$this->globalPlaceholders = $this->getGlobalPlaceholders();
// check if this component is installed on the current website
if ($paths = $this->getLocalInstallPaths())
{
// start Automatic import of custom code
$today = JFactory::getDate()->toSql();
// get the custom code from installed files
$this->customCodeFactory($paths, $today);
}
// Trigger Event: jcb_ce_onBeforeGetComponentData
$this->triggerEvent(
'jcb_ce_onBeforeGetComponentData',
array(&$this->componentContext, &$this)
);
// get the component data
$this->componentData = $this->getComponentData();
// Trigger Event: jcb_ce_onAfterGetComponentData
$this->triggerEvent(
'jcb_ce_onAfterGetComponentData',
array(&$this->componentContext, &$this)
);
// make sure we have a version
if (strpos($this->componentData->component_version, '.')
=== false)
{
$this->componentData->component_version = '1.0.0';
}
// update the version
if (!isset($this->componentData->old_component_version)
&& (ArrayHelper::check($this->addSQL)
|| ArrayHelper::check(
$this->updateSQL
)))
{
// set the new version
$version = (array) explode(
'.', $this->componentData->component_version
);
// get last key
end($version);
$key = key($version);
// just increment the last
$version[$key]++;
// set the old version
$this->componentData->old_component_version
= $this->componentData->component_version;
// set the new version, and set update switch
$this->componentData->component_version = implode(
'.', $version
);
}
// get powers *+*+*+*+*+*+*+*PRO
$this->getPowers($this->linkedPowers);
// set the percentage when a language can be added
$this->percentageLanguageAdd = (int) $this->params->get(
'percentagelanguageadd', 50
);
// Trigger Event: jcb_ce_onBeforeGet
$this->triggerEvent(
'jcb_ce_onAfterGet', array(&$this->componentContext, &$this)
);
return true;
}
} }
// Trigger Event: jcb_ce_onBeforeGet
$this->triggerEvent('jcb_ce_onBeforeGet', array(&$config, &$this));
// 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 = Config::get('lang_tag', 'en-GB');
// setup the main language array
$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 (!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;
// load the sugestion to use string manipulation
$this->app->enqueueMessage(
JText::_('<hr /><h3>Field Notice</h3>'), 'Notice'
);
$this->app->enqueueMessage(
JText::_(
'Since you do not have <b>Tidy</b> extentsion setup on your system, we could not use the SimpleXMLElement class. We instead used <b>string manipulation</b> to build all your fields, this is a faster method, you must inspect the xml files in your component package to see if you are satisfied with the result.<br />You can make this method your default by opening the global options of JCB and under the <b>Global</b> tab set the <b>Field Builder Type</b> to string manipulation.'
), 'Notice'
);
}
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.
$this->db = JFactory::getDbo();
// get global placeholders
$this->globalPlaceholders = $this->getGlobalPlaceholders();
// check if this component is installed on the current website
if ($paths = $this->getLocalInstallPaths())
{
// start Automatic import of custom code
$today = JFactory::getDate()->toSql();
// get the custom code from installed files
$this->customCodeFactory($paths, $today);
}
// Trigger Event: jcb_ce_onBeforeGetComponentData
$this->triggerEvent(
'jcb_ce_onBeforeGetComponentData',
array(&$this->componentContext, &$this)
);
// get the component data
$this->componentData = $this->getComponentData();
// Trigger Event: jcb_ce_onAfterGetComponentData
$this->triggerEvent(
'jcb_ce_onAfterGetComponentData',
array(&$this->componentContext, &$this)
);
// make sure we have a version
if (strpos($this->componentData->component_version, '.')
=== false)
{
$this->componentData->component_version = '1.0.0';
}
// update the version
if (!isset($this->componentData->old_component_version)
&& (ArrayHelper::check($this->addSQL)
|| ArrayHelper::check(
$this->updateSQL
)))
{
// set the new version
$version = (array) explode(
'.', $this->componentData->component_version
);
// get last key
end($version);
$key = key($version);
// just increment the last
$version[$key]++;
// set the old version
$this->componentData->old_component_version
= $this->componentData->component_version;
// set the new version, and set update switch
$this->componentData->component_version = implode(
'.', $version
);
}
// get powers *+*+*+*+*+*+*+*PRO
$this->getPowers($this->linkedPowers);
// set the percentage when a language can be added
$this->percentageLanguageAdd = (int) $this->params->get(
'percentagelanguageadd', 50
);
return false; // Trigger Event: jcb_ce_onBeforeGet
$this->triggerEvent(
'jcb_ce_onAfterGet', array(&$this->componentContext, &$this)
);
return true;
} }
/** /**
@ -1159,7 +1130,7 @@ class Get
*/ */
private function setLine($nr) private function setLine($nr)
{ {
if ($this->debugLinenr) if (Config::get('debug_line_nr', false))
{ {
return ' [Get ' . $nr . ']'; return ' [Get ' . $nr . ']';
} }
@ -1231,14 +1202,14 @@ class Get
} }
// set component place holders // set component place holders
$bucket[$this->hhh . 'component' . $this->hhh] $bucket[$this->hhh . 'component' . $this->hhh]
= $this->componentCodeName; = Config::get('component_code_name');
$bucket[$this->hhh . 'Component' . $this->hhh] $bucket[$this->hhh . 'Component' . $this->hhh]
= StringHelper::safe( = StringHelper::safe(
$this->componentCodeName, 'F' Config::get('component_code_name'), 'F'
); );
$bucket[$this->hhh . 'COMPONENT' . $this->hhh] $bucket[$this->hhh . 'COMPONENT' . $this->hhh]
= StringHelper::safe( = StringHelper::safe(
$this->componentCodeName, 'U' Config::get('component_code_name'), 'U'
); );
$bucket[$this->bbb . 'component' . $this->ddd] = $bucket[$this->hhh $bucket[$this->bbb . 'component' . $this->ddd] = $bucket[$this->hhh
. 'component' . $this->hhh]; . 'component' . $this->hhh];
@ -1246,12 +1217,12 @@ class Get
. 'Component' . $this->hhh]; . 'Component' . $this->hhh];
$bucket[$this->bbb . 'COMPONENT' . $this->ddd] = $bucket[$this->hhh $bucket[$this->bbb . 'COMPONENT' . $this->ddd] = $bucket[$this->hhh
. 'COMPONENT' . $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 $bucket[$this->bbb . 'LANG_PREFIX' . $this->ddd] = $bucket[$this->hhh
. 'LANG_PREFIX' . $this->hhh]; . 'LANG_PREFIX' . $this->hhh];
// get the current components overides // get the current components overides
if (($_placeholders = GetHelper::var( if (($_placeholders = GetHelper::var(
'component_placeholders', $this->componentID, 'component_placeholders', Config::get('component_id'),
'joomla_component', 'addplaceholders' 'joomla_component', 'addplaceholders'
)) !== false )) !== false
&& JsonHelper::check($_placeholders)) && JsonHelper::check($_placeholders))
@ -1336,7 +1307,7 @@ class Get
); );
} }
$query->where( $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 // Trigger Event: jcb_ce_onBeforeQueryComponentData
@ -1365,36 +1336,36 @@ class Get
'val' => (int) $component->addadmin_views_id, 'val' => (int) $component->addadmin_views_id,
'key' => 'id'), 'key' => 'id'),
'addconfig' => array('table' => 'component_config', 'addconfig' => array('table' => 'component_config',
'val' => (int) $this->componentID, 'val' => (int) Config::get('component_id'),
'key' => 'joomla_component'), 'key' => 'joomla_component'),
'addcustom_admin_views' => array('table' => 'component_custom_admin_views', 'addcustom_admin_views' => array('table' => 'component_custom_admin_views',
'val' => (int) $this->componentID, 'val' => (int) Config::get('component_id'),
'key' => 'joomla_component'), 'key' => 'joomla_component'),
'addcustommenus' => array('table' => 'component_custom_admin_menus', 'addcustommenus' => array('table' => 'component_custom_admin_menus',
'val' => (int) $this->componentID, 'val' => (int) Config::get('component_id'),
'key' => 'joomla_component'), 'key' => 'joomla_component'),
'addfiles' => array('table' => 'component_files_folders', 'addfiles' => array('table' => 'component_files_folders',
'val' => (int) $this->componentID, 'val' => (int) Config::get('component_id'),
'key' => 'joomla_component'), 'key' => 'joomla_component'),
'addfolders' => array('table' => 'component_files_folders', 'addfolders' => array('table' => 'component_files_folders',
'val' => (int) $this->componentID, 'val' => (int) Config::get('component_id'),
'key' => 'joomla_component'), 'key' => 'joomla_component'),
'addsite_views' => array('table' => 'component_site_views', 'addsite_views' => array('table' => 'component_site_views',
'val' => (int) $this->componentID, 'val' => (int) Config::get('component_id'),
'key' => 'joomla_component'), 'key' => 'joomla_component'),
'dashboard_tab' => array('table' => 'component_dashboard', 'dashboard_tab' => array('table' => 'component_dashboard',
'val' => (int) $this->componentID, 'val' => (int) Config::get('component_id'),
'key' => 'joomla_component'), 'key' => 'joomla_component'),
'sql_tweak' => array('table' => 'component_mysql_tweaks', 'sql_tweak' => array('table' => 'component_mysql_tweaks',
'val' => (int) $this->componentID, 'val' => (int) Config::get('component_id'),
'key' => 'joomla_component'), 'key' => 'joomla_component'),
'version_update' => array('table' => 'component_updates', 'version_update' => array('table' => 'component_updates',
'val' => (int) $this->componentID, 'val' => (int) Config::get('component_id'),
'key' => 'joomla_component') 'key' => 'joomla_component')
), ),
'table' => 'joomla_component', 'table' => 'joomla_component',
'key' => 'id', 'key' => 'id',
'val' => (int) $this->componentID 'val' => (int) Config::get('component_id')
); );
// repeatable fields to update // repeatable fields to update
$searchRepeatables = array( $searchRepeatables = array(
@ -1793,7 +1764,7 @@ class Get
'component_admin_views', $component->addadmin_views_id 'component_admin_views', $component->addadmin_views_id
); );
$old_component = $this->getHistoryWatch( $old_component = $this->getHistoryWatch(
'joomla_component', $this->componentID 'joomla_component', Config::get('component_id')
); );
if ($old_component || $old_admin_views) if ($old_component || $old_admin_views)
{ {
@ -1834,7 +1805,7 @@ class Get
// set GUI mapper // set GUI mapper
$guiMapper = array('table' => 'joomla_component', $guiMapper = array('table' => 'joomla_component',
'id' => (int) $this->componentID, 'id' => (int) Config::get('component_id'),
'field' => 'javascript', 'type' => 'js'); 'field' => 'javascript', 'type' => 'js');
// add_javascript // add_javascript
@ -2044,11 +2015,11 @@ class Get
// bom // bom
if (StringHelper::check($component->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 else
{ {
$this->bomPath = $this->compilerPath . '/default.txt'; $this->bomPath = Config::get('compiler_path', JPATH_COMPONENT_ADMINISTRATOR . '/compiler') . '/default.txt';
} }
unset($component->bom); unset($component->bom);
// README // README
@ -2228,10 +2199,10 @@ class Get
{ {
if ($addPrefix if ($addPrefix
&& !isset( && !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); = $this->fixLangString($string);
} }
elseif (!isset($this->langContent[$target][$language])) elseif (!isset($this->langContent[$target][$language]))
@ -2252,7 +2223,7 @@ class Get
*/ */
public function fixLangString(&$string) public function fixLangString(&$string)
{ {
if ($this->removeLineBreaks) if (Config::get('remove_line_breaks'))
{ {
return trim(str_replace(array(PHP_EOL, "\r", "\n"), '', $string)); 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 _) // 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 $view->name_single_code
) + 5; ) + 5;
// when the name is larger then 49 we need to add the assets table name fix // 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['name'] : 'Tab'; )) ? $tab['name'] : 'Tab';
// set lang // set lang
$tab['lang'] = $this->langPrefix . '_' $tab['lang'] = Config::get('lang_prefix') . '_'
. StringHelper::safe( . StringHelper::safe(
$tab['view'], 'U' $tab['view'], 'U'
) . '_' . StringHelper::safe( ) . '_' . StringHelper::safe(
@ -3013,7 +2984,7 @@ class Get
// confirm it should really make the over ride // confirm it should really make the over ride
if ('default' !== $check_column_name) if ('default' !== $check_column_name)
{ {
$column_name_lang = $this->langPrefix . '_' $column_name_lang = Config::get('lang_prefix') . '_'
. StringHelper::safe( . StringHelper::safe(
$view->name_list_code, 'U' $view->name_list_code, 'U'
) . '_' ) . '_'
@ -5843,7 +5814,7 @@ class Get
// remove watch // remove watch
if (isset($version_note['component']) if (isset($version_note['component'])
&& ($key = array_search( && ($key = array_search(
$this->componentID, $version_note['component'] Config::get('component_id'), $version_note['component']
)) !== false) )) !== false)
{ {
// last version that was used to build/compile // last version that was used to build/compile
@ -5859,9 +5830,9 @@ class Get
break; break;
case 1: case 1:
// add watch // 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 else
{ {
@ -6713,7 +6684,7 @@ class Get
return false; return false;
} }
// build lang key // build lang key
$keyLang = $this->langPrefix . '_' . StringHelper::safe( $keyLang = Config::get('lang_prefix') . '_' . StringHelper::safe(
$string, 'U' $string, 'U'
); );
// set the language string // set the language string
@ -6751,7 +6722,7 @@ class Get
elseif ('view' === $type) elseif ('view' === $type)
{ {
$view = $this->getViewTableName($asset); $view = $this->getViewTableName($asset);
$table = '#__' . $this->componentCodeName . '_' . $view; $table = '#__' . Config::get('component_code_name') . '_' . $view;
$queryName = $view; $queryName = $view;
} }
// just get all values from table if * is found // just get all values from table if * is found
@ -8027,7 +7998,7 @@ class Get
$counterUpdate = 0; $counterUpdate = 0;
$today = JFactory::getDate()->toSql(); $today = JFactory::getDate()->toSql();
foreach ( 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) foreach ($placeholders as $placeholder => $string)
@ -8638,7 +8609,7 @@ class Get
*/ */
public function getPower($guid, $build = 0) 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]; return $this->powers[$guid];
} }
@ -8799,7 +8770,7 @@ class Get
}, $src_array)); }, $src_array));
} }
// now we set the paths // 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_parent = $power->path_jcb . '/' . $prefix_folder;
$power->path = $power->path_parent . '/src' . $sub_folder; $power->path = $power->path_parent . '/src' . $sub_folder;
} }
@ -8815,7 +8786,14 @@ class Get
{ {
$use = array_values(array_map(function ($u) use(&$as) { $use = array_values(array_map(function ($u) use(&$as) {
// track the AS options // track the AS options
$as[$u['use']] = (string) $u['as']; if (empty($u['as']))
{
$as[$u['use']] = 'default';
}
else
{
$as[$u['use']] = (string) $u['as'];
}
// return the guid // return the guid
return $u['use']; return $u['use'];
}, $power->use_selection)); }, $power->use_selection));
@ -9056,7 +9034,7 @@ class Get
protected function getModuleIDs() protected function getModuleIDs()
{ {
if (($addjoomla_modules = GetHelper::var( if (($addjoomla_modules = GetHelper::var(
'component_modules', $this->componentID, 'joomla_component', 'component_modules', Config::get('component_id'), 'joomla_component',
'addjoomla_modules' 'addjoomla_modules'
)) !== false) )) !== false)
{ {
@ -9156,7 +9134,7 @@ class Get
// tweak system to set stuff to the module domain // tweak system to set stuff to the module domain
$_backup_target = $this->target; $_backup_target = $this->target;
$_backup_lang = $this->lang; $_backup_lang = $this->lang;
$_backup_langPrefix = $this->langPrefix; $_backup_langPrefix = Config::get('lang_prefix');
// set some keys // set some keys
$module->target_type = 'M0dU|3'; $module->target_type = 'M0dU|3';
$module->key = $module->id . '_' . $module->target_type; $module->key = $module->id . '_' . $module->target_type;
@ -9178,7 +9156,6 @@ class Get
// default is site area // default is site area
$module->target_client = 'site'; $module->target_client = 'site';
} }
unset($module->target);
// set GUI mapper // set GUI mapper
$guiMapper = array('table' => 'joomla_module', $guiMapper = array('table' => 'joomla_module',
'id' => (int) $id, 'type' => 'php'); 'id' => (int) $id, 'type' => 'php');
@ -9191,14 +9168,17 @@ class Get
= ClassfunctionHelper::safe( = ClassfunctionHelper::safe(
$module->name $module->name
); );
// alias of code name
$module->class_name = $module->code_name;
// set official name // set official name
$module->official_name = StringHelper::safe( $module->official_name = StringHelper::safe(
$module->name, 'W' $module->name, 'W'
); );
// set langPrefix // set langPrefix
$this->langPrefix = 'MOD_' . strtoupper($module->code_name); $this->langPrefix = 'MOD_' . strtoupper($module->code_name);
Config::set('lang_prefix', $this->langPrefix);
// set lang prefix // set lang prefix
$module->lang_prefix = $this->langPrefix; $module->lang_prefix = Config::get('lang_prefix');
// set module class name // set module class name
$module->class_helper_name = 'Mod' . ucfirst($module->code_name) $module->class_helper_name = 'Mod' . ucfirst($module->code_name)
. 'Helper'; . 'Helper';
@ -9213,14 +9193,14 @@ class Get
// set the zip name // set the zip name
$module->zip_name = $module->folder_name . '_v' . str_replace( $module->zip_name = $module->folder_name . '_v' . str_replace(
'.', '_', $module->module_version '.', '_', $module->module_version
) . '__J' . $this->joomlaVersion; ) . '__J' . Config::get('version', 3);
// set module file name // set module file name
$module->file_name = $module->folder_name; $module->file_name = $module->folder_name;
// set module context // set module context
$module->context = $module->file_name . '.' . $module->id; $module->context = $module->file_name . '.' . $module->id;
// set official_name lang strings // set official_name lang strings
$this->setLangContent( $this->setLangContent(
$module->key, $this->langPrefix, $module->official_name $module->key, Config::get('lang_prefix'), $module->official_name
); );
// set some placeholder for this module // set some placeholder for this module
$this->placeholders[$this->bbb . 'Module_name' . $this->ddd] $this->placeholders[$this->bbb . 'Module_name' . $this->ddd]
@ -9860,6 +9840,7 @@ class Get
$this->target = $_backup_target; $this->target = $_backup_target;
$this->lang = $_backup_lang; $this->lang = $_backup_lang;
$this->langPrefix = $_backup_langPrefix; $this->langPrefix = $_backup_langPrefix;
Config::set('lang_prefix', $_backup_langPrefix);
unset( unset(
$this->placeholders[$this->bbb . 'Module_name' . $this->ddd] $this->placeholders[$this->bbb . 'Module_name' . $this->ddd]
@ -9894,7 +9875,7 @@ class Get
{ {
$xml = '<?xml version="1.0" encoding="utf-8"?>'; $xml = '<?xml version="1.0" encoding="utf-8"?>';
$xml .= PHP_EOL . '<extension type="module" version="' $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">'; . $module->target_client . '" method="upgrade">';
$xml .= PHP_EOL . $this->_t(1) . '<name>' . $module->lang_prefix $xml .= PHP_EOL . $this->_t(1) . '<name>' . $module->lang_prefix
. '</name>'; . '</name>';
@ -9969,7 +9950,7 @@ class Get
protected function getPluginIDs() protected function getPluginIDs()
{ {
if (($addjoomla_plugins = GetHelper::var( if (($addjoomla_plugins = GetHelper::var(
'component_plugins', $this->componentID, 'joomla_component', 'component_plugins', Config::get('component_id'), 'joomla_component',
'addjoomla_plugins' 'addjoomla_plugins'
)) !== false) )) !== false)
{ {
@ -10159,7 +10140,7 @@ class Get
// tweak system to set stuff to the plugin domain // tweak system to set stuff to the plugin domain
$_backup_target = $this->target; $_backup_target = $this->target;
$_backup_lang = $this->lang; $_backup_lang = $this->lang;
$_backup_langPrefix = $this->langPrefix; $_backup_langPrefix = Config::get('lang_prefix');
// set some keys // set some keys
$plugin->target_type = 'P|uG!n'; $plugin->target_type = 'P|uG!n';
$plugin->key = $plugin->id . '_' . $plugin->target_type; $plugin->key = $plugin->id . '_' . $plugin->target_type;
@ -10193,8 +10174,9 @@ class Get
$plugin->code_name, $plugin->code_name,
$plugin->group $plugin->group
); );
Config::set('lang_prefix', $this->langPrefix);
// set lang prefix // set lang prefix
$plugin->lang_prefix = $this->langPrefix; $plugin->lang_prefix = Config::get('lang_prefix');
// set plugin class name // set plugin class name
$plugin->class_name $plugin->class_name
= PluginHelper::safeClassName( = PluginHelper::safeClassName(
@ -10216,14 +10198,14 @@ class Get
// set the zip name // set the zip name
$plugin->zip_name = $plugin->folder_name . '_v' . str_replace( $plugin->zip_name = $plugin->folder_name . '_v' . str_replace(
'.', '_', $plugin->plugin_version '.', '_', $plugin->plugin_version
) . '__J' . $this->joomlaVersion; ) . '__J' . Config::get('version', 3);
// set plugin file name // set plugin file name
$plugin->file_name = strtolower($plugin->code_name); $plugin->file_name = strtolower($plugin->code_name);
// set plugin context // set plugin context
$plugin->context = $plugin->folder_name . '.' . $plugin->id; $plugin->context = $plugin->folder_name . '.' . $plugin->id;
// set official_name lang strings // set official_name lang strings
$this->setLangContent( $this->setLangContent(
$plugin->key, $this->langPrefix, $plugin->official_name $plugin->key, Config::get('lang_prefix'), $plugin->official_name
); );
// set some placeholder for this plugin // set some placeholder for this plugin
$this->placeholders[$this->bbb . 'Plugin_name' . $this->ddd] $this->placeholders[$this->bbb . 'Plugin_name' . $this->ddd]
@ -10764,6 +10746,7 @@ class Get
$this->target = $_backup_target; $this->target = $_backup_target;
$this->lang = $_backup_lang; $this->lang = $_backup_lang;
$this->langPrefix = $_backup_langPrefix; $this->langPrefix = $_backup_langPrefix;
Config::set('lang_prefix', $_backup_langPrefix);
unset( unset(
$this->placeholders[$this->bbb . 'Plugin_name' . $this->ddd] $this->placeholders[$this->bbb . 'Plugin_name' . $this->ddd]
@ -10818,7 +10801,7 @@ class Get
{ {
$xml = '<?xml version="1.0" encoding="utf-8"?>'; $xml = '<?xml version="1.0" encoding="utf-8"?>';
$xml .= PHP_EOL . '<extension type="plugin" version="' $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">'; . strtolower($plugin->group) . '" method="upgrade">';
$xml .= PHP_EOL . $this->_t(1) . '<name>' . $plugin->lang_prefix $xml .= PHP_EOL . $this->_t(1) . '<name>' . $plugin->lang_prefix
. '</name>'; . '</name>';
@ -10971,16 +10954,16 @@ class Get
$this->globalPlaceholders $this->globalPlaceholders
); );
$placeholders[StringHelper::safe( $placeholders[StringHelper::safe(
$this->componentCodeName, 'F' Config::get('component_code_name'), 'F'
) . 'Helper::'] ) . 'Helper::']
= $this->bbb = $this->bbb
. 'Component' . $this->ddd . 'Helper::'; . 'Component' . $this->ddd . 'Helper::';
$placeholders['COM_' . StringHelper::safe( $placeholders['COM_' . StringHelper::safe(
$this->componentCodeName, 'U' Config::get('component_code_name'), 'U'
)] )]
= 'COM_' . $this->bbb = 'COM_' . $this->bbb
. 'COMPONENT' . $this->ddd; . 'COMPONENT' . $this->ddd;
$placeholders['com_' . $this->componentCodeName] = 'com_' . $this->bbb $placeholders['com_' . Config::get('component_code_name')] = 'com_' . $this->bbb
. 'component' . $this->ddd; . 'component' . $this->ddd;
// putt the last first // putt the last first
$placeholders = array_reverse($placeholders, true); $placeholders = array_reverse($placeholders, true);
@ -11326,7 +11309,7 @@ class Get
); // 'comment_type' ); // 'comment_type'
$this->newCustomCode[$pointer[$targetKey]][] $this->newCustomCode[$pointer[$targetKey]][]
= $this->db->quote( = $this->db->quote(
(int) $this->componentID (int) Config::get('component_id')
); // 'component' ); // 'component'
$this->newCustomCode[$pointer[$targetKey]][] $this->newCustomCode[$pointer[$targetKey]][]
= $this->db->quote( = $this->db->quote(
@ -11383,7 +11366,7 @@ class Get
. $this->db->quote($commentType); . $this->db->quote($commentType);
$this->existingCustomCode[$pointer[$targetKey]]['fields'][] $this->existingCustomCode[$pointer[$targetKey]]['fields'][]
= $this->db->quoteName('component') . ' = ' = $this->db->quoteName('component') . ' = '
. $this->db->quote($this->componentID); . $this->db->quote(Config::get('component_id'));
$this->existingCustomCode[$pointer[$targetKey]]['fields'][] $this->existingCustomCode[$pointer[$targetKey]]['fields'][]
= $this->db->quoteName('from_line') . ' = ' = $this->db->quoteName('from_line') . ' = '
. $this->db->quote($lineNumber); . $this->db->quote($lineNumber);
@ -11557,7 +11540,7 @@ class Get
{ {
if (StringHelper::check($string)) if (StringHelper::check($string))
{ {
if ($this->addPlaceholders if (Config::get('add_placeholders', false)
&& $this->canAddGuiCodePlaceholder( && $this->canAddGuiCodePlaceholder(
$string $string
) )
@ -11893,15 +11876,16 @@ class Get
if (strpos($target, 'module') !== false) if (strpos($target, 'module') !== false)
{ {
// backup lang prefix // backup lang prefix
$_tmp_lang_prefix = $this->langPrefix; $_tmp_lang_prefix = Config::get('lang_prefix');
// set the new lang prefix // set the new lang prefix
$this->langPrefix = strtoupper( $this->langPrefix = strtoupper(
str_replace('module', 'mod', $target) str_replace('module', 'mod', $target)
); );
Config::set('lang_prefix', $this->langPrefix);
// now set the lang // 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 else
{ {
@ -11911,15 +11895,16 @@ class Get
elseif (strpos($target, 'plugin') !== false) elseif (strpos($target, 'plugin') !== false)
{ {
// backup lang prefix // backup lang prefix
$_tmp_lang_prefix = $this->langPrefix; $_tmp_lang_prefix = Config::get('lang_prefix');
// set the new lang prefix // set the new lang prefix
$this->langPrefix = strtoupper( $this->langPrefix = strtoupper(
str_replace('plugin', 'plg', $target) str_replace('plugin', 'plg', $target)
); );
Config::set('lang_prefix', $this->langPrefix);
// now set the lang // 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 else
{ {
@ -11956,7 +11941,7 @@ class Get
continue; continue;
} }
// build lang key // build lang key
$keyLang = $this->langPrefix . '_' . $_keyLang; $keyLang = Config::get('lang_prefix') . '_' . $_keyLang;
// set lang content string // set lang content string
$this->setLangContent($this->lang, $keyLang, $lang); $this->setLangContent($this->lang, $keyLang, $lang);
// reverse the placeholders // reverse the placeholders
@ -11979,6 +11964,7 @@ class Get
if (isset($_tmp_lang_prefix)) if (isset($_tmp_lang_prefix))
{ {
$this->langPrefix = $_tmp_lang_prefix; $this->langPrefix = $_tmp_lang_prefix;
Config::set('lang_prefix', $_tmp_lang_prefix);
} }
} }
@ -12072,7 +12058,7 @@ class Get
{ {
case 11: case 11:
//***[REPLACED$$$$]***//**1**/ //***[REPLACED$$$$]***//**1**/
if ($this->addPlaceholders === true) if (Config::get('add_placeholders', false) === true)
{ {
return array( return array(
'start' => '/***[REPLACED$$$$]***//**' . $id . '**/', 'start' => '/***[REPLACED$$$$]***//**' . $id . '**/',
@ -12087,7 +12073,7 @@ class Get
break; break;
case 12: case 12:
//***[INSERTED$$$$]***//**1**/ //***[INSERTED$$$$]***//**1**/
if ($this->addPlaceholders === true) if (Config::get('add_placeholders', false) === true)
{ {
return array( return array(
'start' => '/***[INSERTED$$$$]***//**' . $id . '**/', 'start' => '/***[INSERTED$$$$]***//**' . $id . '**/',
@ -12102,7 +12088,7 @@ class Get
break; break;
case 21: case 21:
//<!--[REPLACED$$$$]--><!--1--> //<!--[REPLACED$$$$]--><!--1-->
if ($this->addPlaceholders === true) if (Config::get('add_placeholders', false) === true)
{ {
return array( return array(
'start' => '<!--[REPLACED$$$$]--><!--' . $id . '-->', 'start' => '<!--[REPLACED$$$$]--><!--' . $id . '-->',
@ -12117,7 +12103,7 @@ class Get
break; break;
case 22: case 22:
//<!--[INSERTED$$$$]--><!--1--> //<!--[INSERTED$$$$]--><!--1-->
if ($this->addPlaceholders === true) if (Config::get('add_placeholders', false) === true)
{ {
return array( return array(
'start' => '<!--[INSERTED$$$$]--><!--' . $id . '-->', 'start' => '<!--[INSERTED$$$$]--><!--' . $id . '-->',
@ -12152,15 +12138,15 @@ class Get
$localPaths = array(); $localPaths = array();
// admin path // admin path
$localPaths['admin'] = JPATH_ADMINISTRATOR . '/components/com_' $localPaths['admin'] = JPATH_ADMINISTRATOR . '/components/com_'
. $this->componentCodeName; . Config::get('component_code_name');
// site path // site path
$localPaths['site'] = JPATH_ROOT . '/components/com_' $localPaths['site'] = JPATH_ROOT . '/components/com_'
. $this->componentCodeName; . Config::get('component_code_name');
// media path // media path
$localPaths['media'] = JPATH_ROOT . '/media/com_' $localPaths['media'] = JPATH_ROOT . '/media/com_'
. $this->componentCodeName; . Config::get('component_code_name');
// power path // 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) // lets also go over the REPOS (TODO)
// Painfull but we need to folder paths for the linked modules // Painfull but we need to folder paths for the linked modules
if (($module_ids = $this->getModuleIDs()) !== false) 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\ObjectHelper;
use VDM\Joomla\Utilities\GetHelper; use VDM\Joomla\Utilities\GetHelper;
use VDM\Joomla\Utilities\FileHelper; use VDM\Joomla\Utilities\FileHelper;
use VDM\Joomla\Componentbuilder\Factory\Compiler\Config;
/** /**
@ -403,22 +404,22 @@ class Structure extends Get
// run global updater // run global updater
ComponentbuilderHelper::runGlobalUpdater(); ComponentbuilderHelper::runGlobalUpdater();
// set the template path // set the template path
$this->templatePath = $this->compilerPath . '/joomla_' $this->templatePath = Config::get('compiler_path', JPATH_COMPONENT_ADMINISTRATOR . '/compiler') . '/joomla_'
. $this->joomlaVersions[$this->joomlaVersion]['folder_key']; . $this->joomlaVersions[Config::get('version', 3)]['folder_key'];
// set some default names // set some default names
$this->componentSalesName = 'com_' $this->componentSalesName = 'com_'
. $this->componentData->sales_name . '__J' . $this->componentData->sales_name . '__J'
. $this->joomlaVersion; . Config::get('version', 3);
$this->componentBackupName = 'com_' $this->componentBackupName = 'com_'
. $this->componentData->sales_name . '_v' . str_replace( . $this->componentData->sales_name . '_v' . str_replace(
'.', '_', $this->componentData->component_version '.', '_', $this->componentData->component_version
) . '__J' . $this->joomlaVersion; ) . '__J' . Config::get('version', 3);
$this->componentFolderName = 'com_' $this->componentFolderName = 'com_'
. $this->componentData->name_code . '_v' . str_replace( . $this->componentData->name_code . '_v' . str_replace(
'.', '_', $this->componentData->component_version '.', '_', $this->componentData->component_version
) . '__J' . $this->joomlaVersion; ) . '__J' . Config::get('version', 3);
// set component folder path // set component folder path
$this->componentPath = $this->compilerPath . '/' $this->componentPath = Config::get('compiler_path', JPATH_COMPONENT_ADMINISTRATOR . '/compiler') . '/'
. $this->componentFolderName; . $this->componentFolderName;
// set the template path for custom // set the template path for custom
$this->templatePathCustom = $this->params->get( $this->templatePathCustom = $this->params->get(
@ -475,7 +476,7 @@ class Structure extends Get
*/ */
private function setLine($nr) private function setLine($nr)
{ {
if ($this->debugLinenr) if (Config::get('debug_line_nr', false))
{ {
return ' [Structure ' . $nr . ']'; return ' [Structure ' . $nr . ']';
} }
@ -618,7 +619,7 @@ class Structure extends Get
)) ))
{ {
// module path // module path
$module->folder_path = $this->compilerPath . '/' $module->folder_path = Config::get('compiler_path', JPATH_COMPONENT_ADMINISTRATOR . '/compiler') . '/'
. $module->folder_name; . $module->folder_name;
// set the module paths // set the module paths
$this->dynamicPaths[$module->key] = $module->folder_path; $this->dynamicPaths[$module->key] = $module->folder_path;
@ -920,11 +921,11 @@ class Structure extends Get
$xml .= PHP_EOL . '<form'; $xml .= PHP_EOL . '<form';
$xml .= PHP_EOL . $this->_t(1) $xml .= PHP_EOL . $this->_t(1)
. 'addrulepath="/administrator/components/com_' . 'addrulepath="/administrator/components/com_'
. $this->componentCodeName . Config::get('component_code_name')
. '/models/rules"'; . '/models/rules"';
$xml .= PHP_EOL . $this->_t(1) $xml .= PHP_EOL . $this->_t(1)
. 'addfieldpath="/administrator/components/com_' . 'addfieldpath="/administrator/components/com_'
. $this->componentCodeName . Config::get('component_code_name')
. '/models/fields"'; . '/models/fields"';
$xml .= PHP_EOL . '>'; $xml .= PHP_EOL . '>';
} }
@ -1095,7 +1096,7 @@ class Structure extends Get
$this->createFolder($module->folder_path . '/language'); $this->createFolder($module->folder_path . '/language');
// also create the lang tag folder // also create the lang tag folder
$this->createFolder( $this->createFolder(
$module->folder_path . '/language/' . $this->langTag $module->folder_path . '/language/' . Config::get('lang_tag', 'en-GB')
); );
// check if this lib has files // check if this lib has files
if (isset($module->files) if (isset($module->files)
@ -1199,7 +1200,7 @@ class Structure extends Get
)) ))
{ {
// plugin path // plugin path
$plugin->folder_path = $this->compilerPath . '/' $plugin->folder_path = Config::get('compiler_path', JPATH_COMPONENT_ADMINISTRATOR . '/compiler') . '/'
. $plugin->folder_name; . $plugin->folder_name;
// set the plugin paths // set the plugin paths
$this->dynamicPaths[$plugin->key] = $plugin->folder_path; $this->dynamicPaths[$plugin->key] = $plugin->folder_path;
@ -1300,7 +1301,7 @@ class Structure extends Get
$xml = '<?xml version="1.0" encoding="utf-8"?>'; $xml = '<?xml version="1.0" encoding="utf-8"?>';
$xml .= PHP_EOL . '<!--' . $this->setLine(__LINE__) $xml .= PHP_EOL . '<!--' . $this->setLine(__LINE__)
. ' default paths of ' . $file . ' 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 // search if we must add the component path
$add_component_path = false; $add_component_path = false;
@ -1329,11 +1330,11 @@ class Structure extends Get
$xml .= PHP_EOL . '<form'; $xml .= PHP_EOL . '<form';
$xml .= PHP_EOL . $this->_t(1) $xml .= PHP_EOL . $this->_t(1)
. 'addrulepath="/administrator/components/com_' . 'addrulepath="/administrator/components/com_'
. $this->componentCodeName . Config::get('component_code_name')
. '/models/rules"'; . '/models/rules"';
$xml .= PHP_EOL . $this->_t(1) $xml .= PHP_EOL . $this->_t(1)
. 'addfieldpath="/administrator/components/com_' . 'addfieldpath="/administrator/components/com_'
. $this->componentCodeName . Config::get('component_code_name')
. '/models/fields"'; . '/models/fields"';
$xml .= PHP_EOL . '>'; $xml .= PHP_EOL . '>';
} }
@ -1486,7 +1487,7 @@ class Structure extends Get
$this->createFolder($plugin->folder_path . '/language'); $this->createFolder($plugin->folder_path . '/language');
// also creat the lang tag folder path // also creat the lang tag folder path
$this->createFolder( $this->createFolder(
$plugin->folder_path . '/language/' . $this->langTag $plugin->folder_path . '/language/' . Config::get('lang_tag', 'en-GB')
); );
// check if this lib has files // check if this lib has files
if (isset($plugin->files) if (isset($plugin->files)
@ -2071,7 +2072,7 @@ class Structure extends Get
$this->joomlaVersionData->move->static $this->joomlaVersionData->move->static
)) ))
{ {
$codeName = $this->componentCodeName; $codeName = Config::get('component_code_name');
// TODO needs more looking at this must be dynamic actually // TODO needs more looking at this must be dynamic actually
$this->notNew[] = 'LICENSE.txt'; $this->notNew[] = 'LICENSE.txt';
// do license check // do license check
@ -2879,7 +2880,7 @@ class Structure extends Get
private function setJoomlaVersionData() private function setJoomlaVersionData()
{ {
// option to load other settings // 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 // set the version data
if (File::exists($custom_settings)) 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\ObjectHelper;
use VDM\Joomla\Utilities\GetHelper; use VDM\Joomla\Utilities\GetHelper;
use VDM\Joomla\Utilities\String\FieldHelper; use VDM\Joomla\Utilities\String\FieldHelper;
use VDM\Joomla\Componentbuilder\Factory\Compiler\Config;
/** /**
* Compiler class * Compiler class
@ -378,7 +379,7 @@ class Fields extends Structure
*/ */
private function setLine($nr) private function setLine($nr)
{ {
if ($this->debugLinenr) if (Config::get('debug_line_nr', false))
{ {
return ' [Fields ' . $nr . ']'; return ' [Fields ' . $nr . ']';
} }
@ -415,9 +416,9 @@ class Fields extends Structure
$this->accessBuilder[$nameSingleCode] = $nameListCode; $this->accessBuilder[$nameSingleCode] = $nameListCode;
} }
// main lang prefix // main lang prefix
$langView = $this->langPrefix . '_' $langView = Config::get('lang_prefix') . '_'
. $this->placeholders[$this->hhh . 'VIEW' . $this->hhh]; . $this->placeholders[$this->hhh . 'VIEW' . $this->hhh];
$langViews = $this->langPrefix . '_' $langViews = Config::get('lang_prefix') . '_'
. $this->placeholders[$this->hhh . 'VIEWS' . $this->hhh]; . $this->placeholders[$this->hhh . 'VIEWS' . $this->hhh];
// set default lang // set default lang
$this->setLangContent( $this->setLangContent(
@ -570,7 +571,7 @@ class Fields extends Structure
. $view['settings']->name_single . " to customise the alias." . $view['settings']->name_single . " to customise the alias."
); );
// check what type of field builder to use // 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 // build field set using string manipulation
return $this->stringFieldSet( return $this->stringFieldSet(
@ -1586,7 +1587,7 @@ class Fields extends Structure
&$nameSingleCode, &$nameListCode, &$placeholders, &$dbkey, $build &$nameSingleCode, &$nameListCode, &$placeholders, &$dbkey, $build
) { ) {
// set default return // set default return
if ($this->fieldBuilderType == 1) if (Config::get('field_builder_type', 2) == 1)
{ {
// string manipulation // string manipulation
$dynamicField = ''; $dynamicField = '';
@ -1831,7 +1832,7 @@ class Fields extends Structure
) { ) {
// check the field builder type // check the field builder type
$xmlField = ''; $xmlField = '';
if ($this->fieldBuilderType == 1) if (Config::get('field_builder_type', 2) == 1)
{ {
// string manipulation // string manipulation
$xmlField = $this->setDynamicField( $xmlField = $this->setDynamicField(
@ -1891,7 +1892,7 @@ class Fields extends Structure
// count the dynamic fields created // count the dynamic fields created
$this->fieldCount++; $this->fieldCount++;
// check what type of field builder to use // 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 // build field set using string manipulation
return $this->stringSetField( return $this->stringSetField(
@ -4962,7 +4963,7 @@ class Fields extends Structure
// if they left out the extension for some reason // if they left out the extension for some reason
if (!StringHelper::check($_extension)) if (!StringHelper::check($_extension))
{ {
$_extension = 'com_' . $this->componentCodeName . '.' $_extension = 'com_' . Config::get('component_code_name') . '.'
. $otherView; . $otherView;
} }
// check the context (does our target match) // check the context (does our target match)
@ -5168,7 +5169,7 @@ class Fields extends Structure
= $options; = $options;
} }
// main lang filter prefix // main lang filter prefix
$lang_filter_ = $this->langPrefix . '_FILTER_'; $lang_filter_ = Config::get('lang_prefix') . '_FILTER_';
// build the sort values // build the sort values
if ($dbSwitch && (isset($field['sort']) && $field['sort'] == 1) if ($dbSwitch && (isset($field['sort']) && $field['sort'] == 1)
&& ($listSwitch || $listJoin) && ($listSwitch || $listJoin)
@ -5359,10 +5360,10 @@ class Fields extends Structure
$data['custom']['component'] $data['custom']['component']
)) ? StringHelper::safe( )) ? StringHelper::safe(
$data['custom']['component'] $data['custom']['component']
) : 'com_' . $this->componentCodeName, ) : 'com_' . Config::get('component_code_name'),
// set the generic values // set the generic values
$this->bbb . 'component' $this->bbb . 'component'
. $this->ddd => $this->componentCodeName, . $this->ddd => Config::get('component_code_name'),
$this->bbb . 'Component' $this->bbb . 'Component'
. $this->ddd => $this->fileContentStatic[$this->hhh . $this->ddd => $this->fileContentStatic[$this->hhh
. 'Component' . $this->hhh], . 'Component' . $this->hhh],
@ -5622,7 +5623,7 @@ class Fields extends Structure
// temp holder for name // temp holder for name
$tempName = $data['custom']['label'] . ' Group'; $tempName = $data['custom']['label'] . ' Group';
// set lang // set lang
$groupLangName = $this->langPrefix . '_' $groupLangName = Config::get('lang_prefix') . '_'
. FieldHelper::safe( . FieldHelper::safe(
$tempName, true $tempName, true
); );
@ -5751,14 +5752,14 @@ class Fields extends Structure
$target, 'filter' $target, 'filter'
); );
// the search language string // the search language string
$lang_search = $this->langPrefix . '_FILTER_SEARCH'; $lang_search = Config::get('lang_prefix') . '_FILTER_SEARCH';
// and to translation // and to translation
$this->setLangContent( $this->setLangContent(
$this->lang, $lang_search, 'Search' $this->lang, $lang_search, 'Search'
. StringHelper::safe($nameListCode, 'w') . StringHelper::safe($nameListCode, 'w')
); );
// the search description language string // the search description language string
$lang_search_desc = $this->langPrefix . '_FILTER_SEARCH_' $lang_search_desc = Config::get('lang_prefix') . '_FILTER_SEARCH_'
. strtoupper($nameListCode); . strtoupper($nameListCode);
// and to translation // and to translation
$this->setLangContent( $this->setLangContent(
@ -5784,13 +5785,13 @@ class Fields extends Structure
if (!isset($this->fieldsNames[$nameSingleCode]['published'])) if (!isset($this->fieldsNames[$nameSingleCode]['published']))
{ {
// the published language string // the published language string
$lang_published = $this->langPrefix . '_FILTER_PUBLISHED'; $lang_published = Config::get('lang_prefix') . '_FILTER_PUBLISHED';
// and to translation // and to translation
$this->setLangContent( $this->setLangContent(
$this->lang, $lang_published, 'Status' $this->lang, $lang_published, 'Status'
); );
// the published description language string // the published description language string
$lang_published_desc = $this->langPrefix . '_FILTER_PUBLISHED_' $lang_published_desc = Config::get('lang_prefix') . '_FILTER_PUBLISHED_'
. strtoupper($nameListCode); . strtoupper($nameListCode);
// and to translation // and to translation
$this->setLangContent( $this->setLangContent(
@ -6134,7 +6135,7 @@ class Fields extends Structure
&& StringHelper::check($fieldData['views'])) && StringHelper::check($fieldData['views']))
{ {
// set local component // set local component
$local_component = "com_" . $this->componentCodeName; $local_component = "com_" . Config::get('component_code_name');
// check that the component value is set // check that the component value is set
if (!isset($fieldData['component']) if (!isset($fieldData['component'])
|| !StringHelper::check( || !StringHelper::check(
@ -6316,7 +6317,7 @@ class Fields extends Structure
. " build Create button"; . " build Create button";
$addButton[] = $this->_t(4) $addButton[] = $this->_t(4)
. "\$button[] = '<a id=\"'.\$button_code_name.'Create\" class=\"btn btn-small btn-success hasTooltip\" title=\"'.JText:" . "\$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;\""; . "_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=" $addButton[] = $this->_t(5) . "href=\"index.php?option="
. $fieldData['component'] . "&amp;view=" . $fieldData['view'] . $fieldData['component'] . "&amp;view=" . $fieldData['view']
@ -6352,7 +6353,7 @@ class Fields extends Structure
. " build edit button"; . " build edit button";
$addButton[] = $this->_t(4) $addButton[] = $this->_t(4)
. "\$button[] = '<a id=\"'.\$button_code_name.'Edit\" class=\"btn btn-small hasTooltip\" title=\"'.JText:" . "\$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=\"#\" >"; . "_EDIT_S', \$button_label).'\" style=\"display: none; padding: 4px 4px 4px 7px;\" href=\"#\" >";
$addButton[] = $this->_t(5) $addButton[] = $this->_t(5)
. "<span class=\"icon-edit\"></span></a>';"; . "<span class=\"icon-edit\"></span></a>';";
@ -6443,7 +6444,7 @@ class Fields extends Structure
$dom->getElementsByTagName($nodename)->item(0) $dom->getElementsByTagName($nodename)->item(0)
); );
// make sure Tidy is enabled // make sure Tidy is enabled
if ($this->tidy) if (Config::get('tidy', false))
{ {
$tidy = new Tidy(); $tidy = new Tidy();
$tidy->parseString( $tidy->parseString(

View File

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

View File

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

View File

@ -297,8 +297,8 @@
type="text" type="text"
name="implements_custom" name="implements_custom"
label="COM_COMPONENTBUILDER_POWER_IMPLEMENTS_CUSTOM_LABEL" label="COM_COMPONENTBUILDER_POWER_IMPLEMENTS_CUSTOM_LABEL"
size="10" size="50"
maxlength="50" maxlength="150"
description="COM_COMPONENTBUILDER_POWER_IMPLEMENTS_CUSTOM_DESCRIPTION" description="COM_COMPONENTBUILDER_POWER_IMPLEMENTS_CUSTOM_DESCRIPTION"
class="text_area span12" class="text_area span12"
filter="STRING" 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"?> <?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="4" method="upgrade"> <extension type="component" version="4" method="upgrade">
<name>COM_COMPONENTBUILDER</name> <name>COM_COMPONENTBUILDER</name>
<creationDate>20th August, 2022</creationDate> <creationDate>21st August, 2022</creationDate>
<author>Llewellyn van der Merwe</author> <author>Llewellyn van der Merwe</author>
<authorEmail>joomla@vdm.io</authorEmail> <authorEmail>joomla@vdm.io</authorEmail>
<authorUrl>https://dev.vdm.io</authorUrl> <authorUrl>https://dev.vdm.io</authorUrl>

View File

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