Adds interfaces to many classes.

This commit is contained in:
Llewellyn van der Merwe 2022-09-03 12:48:53 +02:00
parent 0512af0f33
commit 4a32d3d50e
Signed by: Llewellyn
GPG Key ID: A9201372263741E7
34 changed files with 613 additions and 128 deletions

View File

@ -140,14 +140,14 @@ 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*: 2nd September, 2022 + *Last Build*: 3rd September, 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*: **321348** + *Line count*: **321830**
+ *Field count*: **2002** + *Field count*: **2002**
+ *File count*: **2094** + *File count*: **2107**
+ *Folder count*: **360** + *Folder count*: **363**
> 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).
> Developed by [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) > Developed by [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)

View File

@ -140,14 +140,14 @@ 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*: 2nd September, 2022 + *Last Build*: 3rd September, 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*: **321348** + *Line count*: **321830**
+ *Field count*: **2002** + *Field count*: **2002**
+ *File count*: **2094** + *File count*: **2107**
+ *Folder count*: **360** + *Folder count*: **363**
> 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).
> Developed by [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) > Developed by [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)

View File

@ -138,7 +138,7 @@ class Compiler extends Infusion
array(&$this->componentContext, &$this) array(&$this->componentContext, &$this)
); );
// now insert into the new files // now insert into the new files
if (CFactory::_('Customcode')->load()) if (CFactory::_('Customcode')->get())
{ {
// Trigger Event: jcb_ce_onBeforeAddCustomCode // Trigger Event: jcb_ce_onBeforeAddCustomCode
CFactory::_J('Event')->trigger( CFactory::_J('Event')->trigger(
@ -667,7 +667,7 @@ class Compiler extends Infusion
// check if this file needs extra care :) // check if this file needs extra care :)
if (isset($this->updateFileContent[$path])) if (isset($this->updateFileContent[$path]))
{ {
$answer = CFactory::_('Customcode')->add($answer); $answer = CFactory::_('Customcode')->update($answer);
} }
// Trigger Event: jcb_ce_onBeforeSetFileContent // Trigger Event: jcb_ce_onBeforeSetFileContent
CFactory::_J('Event')->trigger( CFactory::_J('Event')->trigger(

View File

@ -1931,7 +1931,7 @@ class Get
// README // README
if ($component->addreadme) if ($component->addreadme)
{ {
$component->readme = CFactory::_('Customcode')->add( $component->readme = CFactory::_('Customcode')->update(
base64_decode($component->readme) base64_decode($component->readme)
); );
} }
@ -1951,7 +1951,7 @@ class Get
{ {
$component->dashboard_tab = array_map( $component->dashboard_tab = array_map(
function ($array) { function ($array) {
$array['html'] = CFactory::_('Customcode')->add($array['html']); $array['html'] = CFactory::_('Customcode')->update($array['html']);
return $array; return $array;
}, array_values($component->dashboard_tab) }, array_values($component->dashboard_tab)
@ -1969,7 +1969,7 @@ class Get
{ {
// load the php for the dashboard model // load the php for the dashboard model
$component->php_dashboard_methods = CFactory::_('Customcode.Gui')->set( $component->php_dashboard_methods = CFactory::_('Customcode.Gui')->set(
CFactory::_('Customcode')->add( CFactory::_('Customcode')->update(
base64_decode($component->php_dashboard_methods) base64_decode($component->php_dashboard_methods)
), ),
array( array(
@ -2336,7 +2336,7 @@ class Get
$tab['view'] = $view->name_single_code; $tab['view'] = $view->name_single_code;
// load the dynamic data // load the dynamic data
$tab['html'] = CFactory::_('Placeholder')->update( $tab['html'] = CFactory::_('Placeholder')->update(
CFactory::_('Customcode')->add($tab['html']), CFactory::_('Customcode')->update($tab['html']),
CFactory::_('Placeholder')->active CFactory::_('Placeholder')->active
); );
// set the tab name // set the tab name
@ -2609,7 +2609,7 @@ class Get
$tmpfield['settings'] = new stdClass(); $tmpfield['settings'] = new stdClass();
// convert the xml json string to normal string // convert the xml json string to normal string
$tmpfield['settings']->xml $tmpfield['settings']->xml
= CFactory::_('Customcode')->add( = CFactory::_('Customcode')->update(
json_decode( json_decode(
$field['settings']->history->xml $field['settings']->history->xml
) )
@ -2841,7 +2841,7 @@ class Get
$relationsValue['set'] $relationsValue['set']
)) ))
{ {
$relationsValue['set'] = CFactory::_('Customcode')->add( $relationsValue['set'] = CFactory::_('Customcode')->update(
$relationsValue['set'] $relationsValue['set']
); );
} }
@ -3045,7 +3045,7 @@ class Get
$guiMapper['field'] = $button_code_field; $guiMapper['field'] = $button_code_field;
$view->{$button_code_field} $view->{$button_code_field}
= CFactory::_('Customcode.Gui')->set( = CFactory::_('Customcode.Gui')->set(
CFactory::_('Customcode')->add( CFactory::_('Customcode')->update(
base64_decode($view->{$button_code_field}) base64_decode($view->{$button_code_field})
), ),
$guiMapper $guiMapper
@ -3370,7 +3370,7 @@ class Get
// set the default data // set the default data
$view->default = CFactory::_('Customcode.Gui')->set( $view->default = CFactory::_('Customcode.Gui')->set(
CFactory::_('Customcode')->add(base64_decode($view->default)), CFactory::_('Customcode')->update(base64_decode($view->default)),
$guiMapper $guiMapper
); );
// load context if not set // load context if not set
@ -3491,7 +3491,7 @@ class Get
// set field // set field
$guiMapper['field'] = $scripter; $guiMapper['field'] = $scripter;
$view->$scripter = CFactory::_('Customcode.Gui')->set( $view->$scripter = CFactory::_('Customcode.Gui')->set(
CFactory::_('Customcode')->add( CFactory::_('Customcode')->update(
base64_decode($view->$scripter) base64_decode($view->$scripter)
), ),
$guiMapper $guiMapper
@ -3499,7 +3499,7 @@ class Get
} }
else else
{ {
$view->$scripter = CFactory::_('Customcode')->add( $view->$scripter = CFactory::_('Customcode')->update(
base64_decode($view->$scripter) base64_decode($view->$scripter)
); );
} }
@ -3631,7 +3631,7 @@ class Get
// set field // set field
$guiMapper['field'] = $button_code_field; $guiMapper['field'] = $button_code_field;
$view->{$button_code_field} = CFactory::_('Customcode.Gui')->set( $view->{$button_code_field} = CFactory::_('Customcode.Gui')->set(
CFactory::_('Customcode')->add( CFactory::_('Customcode')->update(
base64_decode($view->{$button_code_field}) base64_decode($view->{$button_code_field})
), ),
$guiMapper $guiMapper
@ -3735,7 +3735,7 @@ class Get
); );
// load the values form params // load the values form params
$field->xml = CFactory::_('Customcode')->add(json_decode($field->xml)); $field->xml = CFactory::_('Customcode')->update(json_decode($field->xml));
// check if we have validate (validation rule set) // check if we have validate (validation rule set)
$validationRule = GetHelper::between( $validationRule = GetHelper::between(
@ -3774,7 +3774,7 @@ class Get
$this->validationRules[$validationRule] $this->validationRules[$validationRule]
= CFactory::_('Customcode.Gui')->set( = CFactory::_('Customcode.Gui')->set(
CFactory::_('Placeholder')->update( CFactory::_('Placeholder')->update(
CFactory::_('Customcode')->add( CFactory::_('Customcode')->update(
base64_decode( base64_decode(
$this->validationRules[$validationRule] $this->validationRules[$validationRule]
) )
@ -3853,7 +3853,7 @@ class Get
); );
$field->initiator_save = explode( $field->initiator_save = explode(
PHP_EOL, CFactory::_('Placeholder')->update( PHP_EOL, CFactory::_('Placeholder')->update(
CFactory::_('Customcode')->add( CFactory::_('Customcode')->update(
base64_decode( base64_decode(
$field->initiator_on_save_model $field->initiator_on_save_model
) )
@ -3870,7 +3870,7 @@ class Get
); );
$field->initiator_get = explode( $field->initiator_get = explode(
PHP_EOL, CFactory::_('Placeholder')->update( PHP_EOL, CFactory::_('Placeholder')->update(
CFactory::_('Customcode')->add( CFactory::_('Customcode')->update(
base64_decode( base64_decode(
$field->initiator_on_get_model $field->initiator_on_get_model
) )
@ -3881,14 +3881,14 @@ class Get
// set the field modeling // set the field modeling
$field->model_field['save'] = explode( $field->model_field['save'] = explode(
PHP_EOL, CFactory::_('Placeholder')->update( PHP_EOL, CFactory::_('Placeholder')->update(
CFactory::_('Customcode')->add( CFactory::_('Customcode')->update(
base64_decode($field->on_save_model_field) base64_decode($field->on_save_model_field)
), CFactory::_('Placeholder')->active ), CFactory::_('Placeholder')->active
) )
); );
$field->model_field['get'] = explode( $field->model_field['get'] = explode(
PHP_EOL, CFactory::_('Placeholder')->update( PHP_EOL, CFactory::_('Placeholder')->update(
CFactory::_('Customcode')->add( CFactory::_('Customcode')->update(
base64_decode($field->on_get_model_field) base64_decode($field->on_get_model_field)
), CFactory::_('Placeholder')->active ), CFactory::_('Placeholder')->active
) )
@ -4618,7 +4618,7 @@ class Get
$guiMapper['field'] = 'php_calculation'; $guiMapper['field'] = 'php_calculation';
$result->php_calculation $result->php_calculation
= CFactory::_('Customcode.Gui')->set( = CFactory::_('Customcode.Gui')->set(
CFactory::_('Customcode')->add( CFactory::_('Customcode')->update(
base64_decode($result->php_calculation) base64_decode($result->php_calculation)
), ),
$guiMapper $guiMapper
@ -4636,7 +4636,7 @@ class Get
$guiMapper['field'] = 'php_router_parse'; $guiMapper['field'] = 'php_router_parse';
$result->php_router_parse $result->php_router_parse
= CFactory::_('Customcode.Gui')->set( = CFactory::_('Customcode.Gui')->set(
CFactory::_('Customcode')->add( CFactory::_('Customcode')->update(
base64_decode($result->php_router_parse) base64_decode($result->php_router_parse)
), ),
$guiMapper $guiMapper
@ -4692,7 +4692,7 @@ class Get
// only for custom gets // only for custom gets
$result->{$script} $result->{$script}
= CFactory::_('Customcode.Gui')->set( = CFactory::_('Customcode.Gui')->set(
CFactory::_('Customcode')->add( CFactory::_('Customcode')->update(
base64_decode($result->{$script}) base64_decode($result->{$script})
), ),
$guiMapper $guiMapper
@ -4761,7 +4761,7 @@ class Get
// get the custom query // get the custom query
$customQueryString $customQueryString
= CFactory::_('Customcode.Gui')->set( = CFactory::_('Customcode.Gui')->set(
CFactory::_('Customcode')->add( CFactory::_('Customcode')->update(
base64_decode($result->php_custom_get) base64_decode($result->php_custom_get)
), ),
$guiMapper $guiMapper
@ -5029,7 +5029,7 @@ class Get
= $operatorArray[$option2['operator']]; = $operatorArray[$option2['operator']];
$option2['state_key'] $option2['state_key']
= CFactory::_('Placeholder')->update( = CFactory::_('Placeholder')->update(
CFactory::_('Customcode')->add( CFactory::_('Customcode')->update(
$option2['state_key'] $option2['state_key']
), CFactory::_('Placeholder')->active ), CFactory::_('Placeholder')->active
); );
@ -5844,7 +5844,7 @@ class Get
&& StringHelper::check($row->php_view)) && StringHelper::check($row->php_view))
{ {
$php_view = CFactory::_('Customcode.Gui')->set( $php_view = CFactory::_('Customcode.Gui')->set(
CFactory::_('Customcode')->add(base64_decode($row->php_view)), CFactory::_('Customcode')->update(base64_decode($row->php_view)),
array( array(
'table' => $table, 'table' => $table,
'field' => 'php_view', 'field' => 'php_view',
@ -5853,7 +5853,7 @@ class Get
); );
} }
$contnent = CFactory::_('Customcode.Gui')->set( $contnent = CFactory::_('Customcode.Gui')->set(
CFactory::_('Customcode')->add(base64_decode($row->{$table})), CFactory::_('Customcode')->update(base64_decode($row->{$table})),
array( array(
'table' => $table, 'table' => $table,
'field' => $table, 'field' => $table,
@ -6231,7 +6231,7 @@ class Get
)) ))
{ {
$library->document = CFactory::_('Customcode.Gui')->set( $library->document = CFactory::_('Customcode.Gui')->set(
CFactory::_('Customcode')->add( CFactory::_('Customcode')->update(
base64_decode($library->php_setdocument) base64_decode($library->php_setdocument)
), ),
array( array(
@ -6873,11 +6873,11 @@ class Get
* dynamic build values if it gets broken * dynamic build values if it gets broken
* *
* @return string * @return string
* @deprecated 3.3 Use CFactory::_('Customcode')->add($string, $debug); * @deprecated 3.3 Use CFactory::_('Customcode')->update($string, $debug);
*/ */
public function setDynamicValues($string, $debug = 0) public function setDynamicValues($string, $debug = 0)
{ {
return CFactory::_('Customcode')->add($string, $debug); return CFactory::_('Customcode')->update($string, $debug);
} }
/** /**
@ -7564,11 +7564,11 @@ class Get
* @param int $debug The switch to debug the update * @param int $debug The switch to debug the update
* *
* @return void * @return void
* @deprecated 3.3 Use CFactory::_('Customcode')->load($ids, $setLang, $debug); * @deprecated 3.3 Use CFactory::_('Customcode')->get($ids, $setLang, $debug);
*/ */
public function getCustomCode(?array $ids = null, bool $setLang = true, int $debug = 0) public function getCustomCode(?array $ids = null, bool $setLang = true, int $debug = 0)
{ {
CFactory::_('Customcode')->load($ids, $setLang, $debug); CFactory::_('Customcode')->get($ids, $setLang, $debug);
} }
/** /**
@ -7766,7 +7766,7 @@ class Get
'id' => (int) $id, 'type' => 'php'); 'id' => (int) $id, 'type' => 'php');
// update the name if it has dynamic values // update the name if it has dynamic values
$module->name = CFactory::_('Placeholder')->update( $module->name = CFactory::_('Placeholder')->update(
CFactory::_('Customcode')->add($module->name), CFactory::_('Placeholder')->active CFactory::_('Customcode')->update($module->name), CFactory::_('Placeholder')->active
); );
// set safe class function name // set safe class function name
$module->code_name $module->code_name
@ -7835,7 +7835,7 @@ class Get
else else
{ {
$module->description = CFactory::_('Placeholder')->update( $module->description = CFactory::_('Placeholder')->update(
CFactory::_('Customcode')->add($module->description), CFactory::_('Customcode')->update($module->description),
CFactory::_('Placeholder')->active CFactory::_('Placeholder')->active
); );
CFactory::_('Language')->set( CFactory::_('Language')->set(
@ -7864,7 +7864,7 @@ class Get
if ($module->addreadme == 1 && !empty($module->readme)) if ($module->addreadme == 1 && !empty($module->readme))
{ {
$module->readme = CFactory::_('Placeholder')->update( $module->readme = CFactory::_('Placeholder')->update(
CFactory::_('Customcode')->add(base64_decode($module->readme)), CFactory::_('Customcode')->update(base64_decode($module->readme)),
CFactory::_('Placeholder')->active CFactory::_('Placeholder')->active
); );
} }
@ -7904,7 +7904,7 @@ class Get
$module->class_helper_header = PHP_EOL $module->class_helper_header = PHP_EOL
. CFactory::_('Customcode.Gui')->set( . CFactory::_('Customcode.Gui')->set(
CFactory::_('Placeholder')->update( CFactory::_('Placeholder')->update(
CFactory::_('Customcode')->add( CFactory::_('Customcode')->update(
base64_decode( base64_decode(
$module->class_helper_header $module->class_helper_header
) )
@ -7923,7 +7923,7 @@ class Get
// base64 Decode code // base64 Decode code
$module->class_helper_code = CFactory::_('Customcode.Gui')->set( $module->class_helper_code = CFactory::_('Customcode.Gui')->set(
CFactory::_('Placeholder')->update( CFactory::_('Placeholder')->update(
CFactory::_('Customcode')->add( CFactory::_('Customcode')->update(
base64_decode($module->class_helper_code) base64_decode($module->class_helper_code)
), CFactory::_('Placeholder')->active ), CFactory::_('Placeholder')->active
), ),
@ -7953,7 +7953,7 @@ class Get
$guiMapper['field'] = 'mod_code'; $guiMapper['field'] = 'mod_code';
$module->mod_code = CFactory::_('Customcode.Gui')->set( $module->mod_code = CFactory::_('Customcode.Gui')->set(
CFactory::_('Placeholder')->update( CFactory::_('Placeholder')->update(
CFactory::_('Customcode')->add( CFactory::_('Customcode')->update(
base64_decode($module->mod_code) base64_decode($module->mod_code)
), CFactory::_('Placeholder')->active ), CFactory::_('Placeholder')->active
), ),
@ -7981,7 +7981,7 @@ class Get
$guiMapper['field'] = 'default_header'; $guiMapper['field'] = 'default_header';
$module->default_header = CFactory::_('Customcode.Gui')->set( $module->default_header = CFactory::_('Customcode.Gui')->set(
CFactory::_('Placeholder')->update( CFactory::_('Placeholder')->update(
CFactory::_('Customcode')->add( CFactory::_('Customcode')->update(
base64_decode($module->default_header) base64_decode($module->default_header)
), CFactory::_('Placeholder')->active ), CFactory::_('Placeholder')->active
), ),
@ -8001,7 +8001,7 @@ class Get
$guiMapper['type'] = 'html'; $guiMapper['type'] = 'html';
$module->default = CFactory::_('Customcode.Gui')->set( $module->default = CFactory::_('Customcode.Gui')->set(
CFactory::_('Placeholder')->update( CFactory::_('Placeholder')->update(
CFactory::_('Customcode')->add( CFactory::_('Customcode')->update(
base64_decode($module->default) base64_decode($module->default)
), CFactory::_('Placeholder')->active ), CFactory::_('Placeholder')->active
), ),
@ -8348,7 +8348,7 @@ class Get
$module->{$scriptMethod . '_' . $scriptType} $module->{$scriptMethod . '_' . $scriptType}
= CFactory::_('Customcode.Gui')->set( = CFactory::_('Customcode.Gui')->set(
CFactory::_('Placeholder')->update( CFactory::_('Placeholder')->update(
CFactory::_('Customcode')->add( CFactory::_('Customcode')->update(
base64_decode( base64_decode(
$module->{$scriptMethod . '_' $module->{$scriptMethod . '_'
. $scriptType} . $scriptType}
@ -8373,7 +8373,7 @@ class Get
&& StringHelper::check($module->sql)) && StringHelper::check($module->sql))
{ {
$module->sql = CFactory::_('Placeholder')->update( $module->sql = CFactory::_('Placeholder')->update(
CFactory::_('Customcode')->add(base64_decode($module->sql)), CFactory::_('Customcode')->update(base64_decode($module->sql)),
CFactory::_('Placeholder')->active CFactory::_('Placeholder')->active
); );
} }
@ -8389,7 +8389,7 @@ class Get
)) ))
{ {
$module->sql_uninstall = CFactory::_('Placeholder')->update( $module->sql_uninstall = CFactory::_('Placeholder')->update(
CFactory::_('Customcode')->add( CFactory::_('Customcode')->update(
base64_decode($module->sql_uninstall) base64_decode($module->sql_uninstall)
), CFactory::_('Placeholder')->active ), CFactory::_('Placeholder')->active
); );
@ -8406,7 +8406,7 @@ class Get
)) ))
{ {
$module->update_server_url = CFactory::_('Placeholder')->update( $module->update_server_url = CFactory::_('Placeholder')->update(
CFactory::_('Customcode')->add($module->update_server_url), CFactory::_('Customcode')->update($module->update_server_url),
CFactory::_('Placeholder')->active CFactory::_('Placeholder')->active
); );
} }
@ -8683,7 +8683,7 @@ class Get
'id' => (int) $id, 'type' => 'php'); 'id' => (int) $id, 'type' => 'php');
// update the name if it has dynamic values // update the name if it has dynamic values
$plugin->name = CFactory::_('Placeholder')->update( $plugin->name = CFactory::_('Placeholder')->update(
CFactory::_('Customcode')->add($plugin->name), CFactory::_('Placeholder')->active CFactory::_('Customcode')->update($plugin->name), CFactory::_('Placeholder')->active
); );
// update the name if it has dynamic values // update the name if it has dynamic values
$plugin->code_name $plugin->code_name
@ -8775,7 +8775,7 @@ class Get
else else
{ {
$plugin->description = CFactory::_('Placeholder')->update( $plugin->description = CFactory::_('Placeholder')->update(
CFactory::_('Customcode')->add($plugin->description), CFactory::_('Customcode')->update($plugin->description),
CFactory::_('Placeholder')->active CFactory::_('Placeholder')->active
); );
CFactory::_('Language')->set( CFactory::_('Language')->set(
@ -8807,7 +8807,7 @@ class Get
if ($plugin->addreadme == 1 && !empty($plugin->readme)) if ($plugin->addreadme == 1 && !empty($plugin->readme))
{ {
$plugin->readme = CFactory::_('Placeholder')->update( $plugin->readme = CFactory::_('Placeholder')->update(
CFactory::_('Customcode')->add(base64_decode($plugin->readme)), CFactory::_('Customcode')->update(base64_decode($plugin->readme)),
CFactory::_('Placeholder')->active CFactory::_('Placeholder')->active
); );
} }
@ -8824,7 +8824,7 @@ class Get
// base64 Decode main_class_code. // base64 Decode main_class_code.
$plugin->main_class_code = CFactory::_('Customcode.Gui')->set( $plugin->main_class_code = CFactory::_('Customcode.Gui')->set(
CFactory::_('Placeholder')->update( CFactory::_('Placeholder')->update(
CFactory::_('Customcode')->add( CFactory::_('Customcode')->update(
base64_decode($plugin->main_class_code) base64_decode($plugin->main_class_code)
), CFactory::_('Placeholder')->active ), CFactory::_('Placeholder')->active
), ),
@ -8839,7 +8839,7 @@ class Get
// base64 Decode head. // base64 Decode head.
$plugin->head = CFactory::_('Customcode.Gui')->set( $plugin->head = CFactory::_('Customcode.Gui')->set(
CFactory::_('Placeholder')->update( CFactory::_('Placeholder')->update(
CFactory::_('Customcode')->add( CFactory::_('Customcode')->update(
base64_decode($plugin->head) base64_decode($plugin->head)
), CFactory::_('Placeholder')->active ), CFactory::_('Placeholder')->active
), ),
@ -8851,7 +8851,7 @@ class Get
// base64 Decode head. // base64 Decode head.
$plugin->head = CFactory::_('Customcode.Gui')->set( $plugin->head = CFactory::_('Customcode.Gui')->set(
CFactory::_('Placeholder')->update( CFactory::_('Placeholder')->update(
CFactory::_('Customcode')->add( CFactory::_('Customcode')->update(
base64_decode($plugin->class_head) base64_decode($plugin->class_head)
), CFactory::_('Placeholder')->active ), CFactory::_('Placeholder')->active
), ),
@ -8869,7 +8869,7 @@ class Get
// base64 Decode comment. // base64 Decode comment.
$plugin->comment = CFactory::_('Customcode.Gui')->set( $plugin->comment = CFactory::_('Customcode.Gui')->set(
CFactory::_('Placeholder')->update( CFactory::_('Placeholder')->update(
CFactory::_('Customcode')->add( CFactory::_('Customcode')->update(
base64_decode($plugin->comment) base64_decode($plugin->comment)
), CFactory::_('Placeholder')->active ), CFactory::_('Placeholder')->active
), ),
@ -9175,7 +9175,7 @@ class Get
$plugin->{$scriptMethod . '_' . $scriptType} $plugin->{$scriptMethod . '_' . $scriptType}
= CFactory::_('Customcode.Gui')->set( = CFactory::_('Customcode.Gui')->set(
CFactory::_('Placeholder')->update( CFactory::_('Placeholder')->update(
CFactory::_('Customcode')->add( CFactory::_('Customcode')->update(
base64_decode( base64_decode(
$plugin->{$scriptMethod . '_' $plugin->{$scriptMethod . '_'
. $scriptType} . $scriptType}
@ -9200,7 +9200,7 @@ class Get
&& StringHelper::check($plugin->sql)) && StringHelper::check($plugin->sql))
{ {
$plugin->sql = CFactory::_('Placeholder')->update( $plugin->sql = CFactory::_('Placeholder')->update(
CFactory::_('Customcode')->add(base64_decode($plugin->sql)), CFactory::_('Customcode')->update(base64_decode($plugin->sql)),
CFactory::_('Placeholder')->active CFactory::_('Placeholder')->active
); );
} }
@ -9216,7 +9216,7 @@ class Get
)) ))
{ {
$plugin->sql_uninstall = CFactory::_('Placeholder')->update( $plugin->sql_uninstall = CFactory::_('Placeholder')->update(
CFactory::_('Customcode')->add( CFactory::_('Customcode')->update(
base64_decode($plugin->sql_uninstall) base64_decode($plugin->sql_uninstall)
), CFactory::_('Placeholder')->active ), CFactory::_('Placeholder')->active
); );
@ -9233,7 +9233,7 @@ class Get
)) ))
{ {
$plugin->update_server_url = CFactory::_('Placeholder')->update( $plugin->update_server_url = CFactory::_('Placeholder')->update(
CFactory::_('Customcode')->add($plugin->update_server_url), CFactory::_('Customcode')->update($plugin->update_server_url),
CFactory::_('Placeholder')->active CFactory::_('Placeholder')->active
); );
} }

View File

@ -4210,7 +4210,7 @@ class Fields extends Structure
); );
// load the php for the custom field file // load the php for the custom field file
$fieldAttributes['custom'][$phpKey][$phpLine] $fieldAttributes['custom'][$phpKey][$phpLine]
= CFactory::_('Customcode')->add( = CFactory::_('Customcode')->update(
ComponentbuilderHelper::openValidBase64( ComponentbuilderHelper::openValidBase64(
GetHelper::between( GetHelper::between(
$field['settings']->xml, $field['settings']->xml,
@ -4504,7 +4504,7 @@ class Fields extends Structure
)) !== $confirmation) )) !== $confirmation)
{ {
$fieldAttributes['custom'][$phpKey][$phpLine] $fieldAttributes['custom'][$phpKey][$phpLine]
= CFactory::_('Customcode')->add( = CFactory::_('Customcode')->update(
ComponentbuilderHelper::openValidBase64($value) ComponentbuilderHelper::openValidBase64($value)
); );
} }

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>2nd September, 2022</creationDate> <creationDate>3rd September, 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

@ -20,6 +20,7 @@ use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Componentbuilder\Compiler\Factory as Compiler; use VDM\Joomla\Componentbuilder\Compiler\Factory as Compiler;
use VDM\Joomla\Componentbuilder\Compiler\Config; use VDM\Joomla\Componentbuilder\Compiler\Config;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Placefix; use VDM\Joomla\Componentbuilder\Compiler\Utilities\Placefix;
use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Component\PlaceholderInterface;
/** /**
@ -27,12 +28,12 @@ use VDM\Joomla\Componentbuilder\Compiler\Utilities\Placefix;
* *
* @since 3.2.0 * @since 3.2.0
*/ */
class Placeholder class Placeholder implements PlaceholderInterface
{ {
/** /**
* Placeholders * Placeholders
* *
* @var arraya * @var array
* @since 3.2.0 * @since 3.2.0
**/ **/
protected $placeholders = null; protected $placeholders = null;

View File

@ -22,6 +22,7 @@ use VDM\Joomla\Componentbuilder\Compiler\Placeholder;
use VDM\Joomla\Componentbuilder\Compiler\Language\Extractor; use VDM\Joomla\Componentbuilder\Compiler\Language\Extractor;
use VDM\Joomla\Componentbuilder\Compiler\Customcode\External; use VDM\Joomla\Componentbuilder\Compiler\Customcode\External;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Placefix; use VDM\Joomla\Componentbuilder\Compiler\Utilities\Placefix;
use VDM\Joomla\Componentbuilder\Compiler\Interfaces\CustomcodeInterface;
/** /**
@ -29,7 +30,7 @@ use VDM\Joomla\Componentbuilder\Compiler\Utilities\Placefix;
* *
* @since 3.2.0 * @since 3.2.0
*/ */
class Customcode class Customcode implements CustomcodeInterface
{ {
/** /**
* The function name memory ids * The function name memory ids
@ -122,7 +123,7 @@ class Customcode
* *
* @param Config|null $config The compiler config object. * @param Config|null $config The compiler config object.
* @param Placeholder|null $placeholder The compiler placeholder object. * @param Placeholder|null $placeholder The compiler placeholder object.
* @param Extract|null $extractor The compiler language extractor object. * @param Extractor|null $extractor The compiler language extractor object.
* @param External|null $external The compiler external custom code object. * @param External|null $external The compiler external custom code object.
* @param \JDatabaseDriver $db The Database Driver object. * @param \JDatabaseDriver $db The Database Driver object.
* *
@ -139,7 +140,7 @@ class Customcode
} }
/** /**
* Set the **ALL** dynamic values in a strings here * Update **ALL** dynamic values in a strings here
* *
* @param string $string The content to check * @param string $string The content to check
* @param int $debug The switch to debug the update * @param int $debug The switch to debug the update
@ -149,7 +150,7 @@ class Customcode
* @return string * @return string
* @since 3.2.0 * @since 3.2.0
*/ */
public function add(string $string, int $debug = 0): string public function update(string $string, int $debug = 0): string
{ {
if (StringHelper::check($string)) if (StringHelper::check($string))
{ {
@ -169,7 +170,7 @@ class Customcode
} }
/** /**
* We start set the custom code data & can load it in to string * Set the custom code data & can load it in to string
* *
* @param string $string The content to check * @param string $string The content to check
* @param int $debug The switch to debug the update * @param int $debug The switch to debug the update
@ -212,9 +213,7 @@ class Customcode
$id = (int) $key; $id = (int) $key;
} }
elseif (StringHelper::check($key) elseif (StringHelper::check($key)
&& strpos( && strpos($key, '+') === false)
$key, '+'
) === false)
{ {
$getFuncName = trim($key); $getFuncName = trim($key);
if (!isset($this->functionNameMemory[$getFuncName])) if (!isset($this->functionNameMemory[$getFuncName]))
@ -276,7 +275,7 @@ class Customcode
{ {
if (strpos($array[1], ',') !== false) if (strpos($array[1], ',') !== false)
{ {
// update the function values with the custom code key placholdres (this allow the use of [] + and , in the values) // update the function values with the custom code key placeholders (this allow the use of [] + and , in the values)
$this->data[$id]['args'][$key] $this->data[$id]['args'][$key]
= array_map( = array_map(
function ($_key) { function ($_key) {
@ -328,7 +327,7 @@ class Customcode
// insure we add the langs to both site and admin // insure we add the langs to both site and admin
$this->config->lang_target = 'both'; $this->config->lang_target = 'both';
// now load the code to memory // now load the code to memory
$loaded = $this->load($bucket, false, $debug); $loaded = $this->get($bucket, false, $debug);
// revert lang to current setting // revert lang to current setting
$this->config->lang_target = $_tmpLang; $this->config->lang_target = $_tmpLang;
} }
@ -364,7 +363,7 @@ class Customcode
* @return bool * @return bool
* @since 3.2.0 * @since 3.2.0
*/ */
public function load(?array $ids = null, bool $setLang = true, $debug = 0): bool public function get(?array $ids = null, bool $setLang = true, $debug = 0): bool
{ {
// should the result be stored in memory // should the result be stored in memory
$loadInMemory = false; $loadInMemory = false;
@ -375,7 +374,7 @@ class Customcode
); );
if (ArrayHelper::check($ids)) if (ArrayHelper::check($ids))
{ {
if ($idArray = $this->check($ids)) if (($idArray = $this->check($ids)) !== false)
{ {
$query->select( $query->select(
$this->db->quoteName( $this->db->quoteName(
@ -434,7 +433,8 @@ class Customcode
$customCode['code'] = $this->external->set( $customCode['code'] = $this->external->set(
$customCode['code'] $customCode['code']
); );
// set the lang only if needed
// set the lang only if needed (we do the other later when we add it to the correct position)
if ($setLang) if ($setLang)
{ {
$customCode['code'] = $this->extractor->engine( $customCode['code'] = $this->extractor->engine(
@ -448,6 +448,7 @@ class Customcode
$customCode['code'], $debug, $nr $customCode['code'], $debug, $nr
); );
} }
// build the hash array // build the hash array
if (isset($customCode['hashtarget'])) if (isset($customCode['hashtarget']))
{ {
@ -456,20 +457,18 @@ class Customcode
); );
// is this a replace code, set end has array // is this a replace code, set end has array
if ($customCode['type'] == 1 if ($customCode['type'] == 1
&& strpos( && strpos($customCode['hashendtarget'], '__') !== false)
$customCode['hashendtarget'], '__'
) !== false)
{ {
$customCode['hashendtarget'] = explode( $customCode['hashendtarget'] = explode(
"__", $customCode['hashendtarget'] "__", $customCode['hashendtarget']
); );
// NOW see if this is an end of page target (TODO not sure if the string is always d41d8cd98f00b204e9800998ecf8427e) // NOW see if this is an end of page target (TODO not sure if the string is always d41d8cd98f00b204e9800998ecf8427e)
// I know this fix is not air-tight, but it should work as the value of an empty line when md5'ed is ^^^^ // I know this fix is not air-tight, but it should work as the value of an empty line when md5'ed is ^^^^
// Then if the line number is only >>>one<<< it is almost always end of the page. // Then if the line number is only >>>one<<< it is almost always end of the page.
// So I am using those two values to detect end of page replace ending, to avoid mismatching the ending target hash. // So I am using those two values to detect end of page replace ending, to avoid mismatching the ending target hash.
if ($customCode['hashendtarget'][0] == 1 if ($customCode['hashendtarget'][0] == 1
&& 'd41d8cd98f00b204e9800998ecf8427e' && 'd41d8cd98f00b204e9800998ecf8427e' === $customCode['hashendtarget'][1])
=== $customCode['hashendtarget'][1])
{ {
// unset since this will force the replacement unto end of page. // unset since this will force the replacement unto end of page.
unset($customCode['hashendtarget']); unset($customCode['hashendtarget']);
@ -477,11 +476,14 @@ class Customcode
} }
} }
} }
// load this code into memory if needed // load this code into memory if needed
if ($loadInMemory === true) if ($loadInMemory === true)
{ {
$this->memory = $this->memory + $bucket; $this->memory = $this->memory + $bucket;
} }
// add to active set
$this->active = array_merge($this->active, $bucket); $this->active = array_merge($this->active, $bucket);
return true; return true;
@ -500,7 +502,7 @@ class Customcode
* @return string on success * @return string on success
* @since 3.2.0 * @since 3.2.0
*/ */
protected function insert(array $ids, string $string, int $debug = 0) protected function insert(array $ids, string $string, int $debug = 0): string
{ {
$code = array(); $code = array();
// load the code // load the code

View File

@ -19,6 +19,7 @@ use VDM\Joomla\Componentbuilder\Compiler\Placeholder;
use VDM\Joomla\Componentbuilder\Compiler\Customcode\Gui; use VDM\Joomla\Componentbuilder\Compiler\Customcode\Gui;
use VDM\Joomla\Componentbuilder\Compiler\Customcode\Hash; use VDM\Joomla\Componentbuilder\Compiler\Customcode\Hash;
use VDM\Joomla\Componentbuilder\Compiler\Customcode\LockBase; use VDM\Joomla\Componentbuilder\Compiler\Customcode\LockBase;
use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Customcode\DispenserInterface;
/** /**
@ -26,7 +27,7 @@ use VDM\Joomla\Componentbuilder\Compiler\Customcode\LockBase;
* *
* @since 3.2.0 * @since 3.2.0
*/ */
class Dispenser class Dispenser implements DispenserInterface
{ {
/** /**
* Customcode Dispenser Hub * Customcode Dispenser Hub
@ -159,7 +160,7 @@ class Dispenser
// prep the script string // prep the script string
if ($base64 && $dynamic) if ($base64 && $dynamic)
{ {
$script = $this->customcode->add(base64_decode($script)); $script = $this->customcode->update(base64_decode($script));
} }
elseif ($base64) elseif ($base64)
{ {
@ -167,7 +168,7 @@ class Dispenser
} }
elseif ($dynamic) // this does not happen (just incase) elseif ($dynamic) // this does not happen (just incase)
{ {
$script = $this->customcode->add($script); $script = $this->customcode->update($script);
} }
// check if we still have a string // check if we still have a string
if (StringHelper::check($script)) if (StringHelper::check($script))

View File

@ -23,6 +23,7 @@ use VDM\Joomla\Utilities\GetHelper;
use VDM\Joomla\Utilities\FileHelper; use VDM\Joomla\Utilities\FileHelper;
use VDM\Joomla\Componentbuilder\Compiler\Factory as Compiler; use VDM\Joomla\Componentbuilder\Compiler\Factory as Compiler;
use VDM\Joomla\Componentbuilder\Compiler\Placeholder; use VDM\Joomla\Componentbuilder\Compiler\Placeholder;
use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Customcode\ExternalInterface;
/** /**
@ -30,7 +31,7 @@ use VDM\Joomla\Componentbuilder\Compiler\Placeholder;
* *
* @since 3.2.0 * @since 3.2.0
*/ */
class External class External implements ExternalInterface
{ {
/** /**
* The external code/string to be added * The external code/string to be added

View File

@ -27,6 +27,7 @@ use VDM\Joomla\Componentbuilder\Compiler\Placeholder\Reverse;
use VDM\Joomla\Componentbuilder\Compiler\Component\Placeholder; use VDM\Joomla\Componentbuilder\Compiler\Component\Placeholder;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Placefix; use VDM\Joomla\Componentbuilder\Compiler\Utilities\Placefix;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Path; use VDM\Joomla\Componentbuilder\Compiler\Utilities\Path;
use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Customcode\ExtractorInterface;
/** /**
@ -66,7 +67,7 @@ use VDM\Joomla\Componentbuilder\Compiler\Utilities\Path;
* *
* @since 3.2.0 * @since 3.2.0
*/ */
class Extractor class Extractor implements ExtractorInterface
{ {
/** /**
* The placeholder keys * The placeholder keys

View File

@ -273,7 +273,7 @@ class Paths
$module = $this->db->loadObject(); $module = $this->db->loadObject();
// update the name if it has dynamic values // update the name if it has dynamic values
$module->name = $this->placeholder->update( $module->name = $this->placeholder->update(
$this->customcode->add($module->name), $this->customcode->update($module->name),
$this->componentPlaceholder $this->componentPlaceholder
); );
@ -397,7 +397,7 @@ class Paths
// update the name if it has dynamic values // update the name if it has dynamic values
$plugin->name = $this->placeholder->update( $plugin->name = $this->placeholder->update(
$this->customcode->add($plugin->name), $this->customcode->update($plugin->name),
$this->componentPlaceholder $this->componentPlaceholder
); );

View File

@ -23,6 +23,7 @@ use VDM\Joomla\Utilities\String\FieldHelper;
use VDM\Joomla\Componentbuilder\Compiler\Factory as Compiler; use VDM\Joomla\Componentbuilder\Compiler\Factory as Compiler;
use VDM\Joomla\Componentbuilder\Compiler\Config; use VDM\Joomla\Componentbuilder\Compiler\Config;
use VDM\Joomla\Componentbuilder\Compiler\Placeholder\Reverse; use VDM\Joomla\Componentbuilder\Compiler\Placeholder\Reverse;
use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Customcode\GuiInterface;
/** /**
@ -30,7 +31,7 @@ use VDM\Joomla\Componentbuilder\Compiler\Placeholder\Reverse;
* *
* @since 3.2.0 * @since 3.2.0
*/ */
class Gui class Gui implements GuiInterface
{ {
/** /**
* Compiler Config * Compiler Config

View File

@ -46,7 +46,7 @@ class Hash
} }
/** /**
* Set the the MD5 hashed string or file or string * Set the MD5 hashed string or file or string
* *
* @param string $script The code string * @param string $script The code string
* *

View File

@ -16,6 +16,7 @@ use VDM\Joomla\Utilities\GetHelper;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Indent; use VDM\Joomla\Componentbuilder\Compiler\Utilities\Indent;
use VDM\Joomla\Componentbuilder\Compiler\Factory as Compiler; use VDM\Joomla\Componentbuilder\Compiler\Factory as Compiler;
use VDM\Joomla\Componentbuilder\Compiler\Placeholder; use VDM\Joomla\Componentbuilder\Compiler\Placeholder;
use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Customcode\LockBaseInterface;
/** /**
@ -23,7 +24,7 @@ use VDM\Joomla\Componentbuilder\Compiler\Placeholder;
* *
* @since 3.2.0 * @since 3.2.0
*/ */
class LockBase class LockBase implements LockBaseInterface
{ {
/** /**
* Compiler Placeholder * Compiler Placeholder

View File

@ -12,7 +12,7 @@
namespace VDM\Joomla\Componentbuilder\Compiler\Extension\JoomlaThree; namespace VDM\Joomla\Componentbuilder\Compiler\Extension\JoomlaThree;
use VDM\Joomla\Componentbuilder\Compiler\Interfaces\InstallInterface; use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Extension\InstallInterface;
use VDM\Joomla\Utilities\ArrayHelper; use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\StringHelper; use VDM\Joomla\Utilities\StringHelper;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Line; use VDM\Joomla\Componentbuilder\Compiler\Utilities\Line;

View File

@ -0,0 +1,29 @@
<?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\Interfaces\Component;
/**
* Component Placeholder Interface
*/
interface PlaceholderInterface
{
/**
* get all System Placeholders
*
* @return array The global placeholders
*
* @since 3.2.0
*/
public function get();
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,60 @@
<?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\Interfaces\Customcode;
/**
* Customcode Dispenser Interface
*/
interface DispenserInterface
{
/**
* Set the script for the customcode dispenser
*
* @param string $script The script
* @param string $first The first key
* @param string|null $second The second key (if not set we use only first key)
* @param string|null $third The third key (if not set we use only first and second key)
* @param array $config The config options
* @param bool $base64 The switch to decode base64 the script
* default: true
* @param bool $dynamic The switch to dynamic update the script
* default: true
* @param bool $add The switch to add to exiting instead of replace
* default: false
*
* @return bool true on success
* @since 3.2.0
*/
public function set(&$script, string $first, ?string $second = null, ?string $third = null,
array $config = array(), bool $base64 = true, bool $dynamic = true, bool $add = false): bool;
/**
* Get the script from the customcode dispenser
*
* @param string $first The first key
* @param string $second The second key
* @param string $prefix The prefix to add in front of the script if found
* @param string|null $note The switch/note to add to the script
* @param bool $unset The switch to unset the value if found
* @param mixed|null $default The switch/string to use as default return if script not found
* @param string $suffix The suffix to add after the script if found
*
* @return mixed The string/script if found or the default value if not found
*
* @since 3.2.0
*/
public function get(string $first, string $second, string $prefix = '', ?string $note = null,
bool $unset = false, $default = null, string $suffix = '');
}

View File

@ -0,0 +1,31 @@
<?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\Interfaces\Customcode;
/**
* Customcode External Interface
*/
interface ExternalInterface
{
/**
* Set the external code string & load it in to string
*
* @param string $string The content to check
* @param int $debug The switch to debug the update
*
* @return string
* @since 3.2.0
*/
public function set(string $string, int $debug = 0): string;
}

View File

@ -0,0 +1,28 @@
<?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\Interfaces\Customcode;
/**
* Customcode Extractor Interface
*/
interface ExtractorInterface
{
/**
* get the custom code from the local files
*
* @return void
* @since 3.2.0
*/
public function run();
}

View File

@ -0,0 +1,44 @@
<?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\Interfaces\Customcode;
/**
* Customcode Gui Interface
*/
interface GuiInterface
{
/**
* Set the JCB GUI code placeholder
*
* @param string $string The code string
* @param array $config The placeholder config values
*
* @return string
* @since 3.2.0
*/
public function set(string $string, array $config): string;
/**
* search a file for gui code blocks that were updated in the IDE
*
* @param string $file The file path to search
* @param array $placeholders The values to replace in the code being stored
* @param string $today The date for today
* @param string $target The target path type
*
* @return void
* @since 3.2.0
*/
public function search(string &$file, array &$placeholders, string &$today, string &$target);
}

View File

@ -0,0 +1,30 @@
<?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\Interfaces\Customcode;
/**
* Customcode LockBase Interface
*/
interface LockBaseInterface
{
/**
* Set a string as bsae64 (basic)
*
* @param string $script The code string
*
* @return string
* @since 3.2.0
*/
public function set(string $script): string;
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,59 @@
<?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\Interfaces;
/**
* Compiler Customcode Interface
*
* @since 3.2.0
*/
interface CustomcodeInterface
{
/**
* Update **ALL** dynamic values in a strings here
*
* @param string $string The content to check
* @param int $debug The switch to debug the update
* We can now at any time debug the
* dynamic build values if it gets broken
*
* @return string
* @since 3.2.0
*/
public function update(string $string, int $debug = 0): string;
/**
* Set the custom code data & can load it in to string
*
* @param string $string The content to check
* @param int $debug The switch to debug the update
* @param int|null $not The not switch
*
* @return string
* @since 3.2.0
*/
public function set(string $string, int $debug = 0, ?int $not = null): string;
/**
* Load the custom code from the system
*
* @param array|null $ids The custom code ides if known
* @param bool $setLang The set lang switch
* @param int $debug The switch to debug the update
*
* @return bool
* @since 3.2.0
*/
public function get(?array $ids = null, bool $setLang = true, $debug = 0): bool;
}

View File

@ -9,7 +9,7 @@
* @license GNU General Public License version 2 or later; see LICENSE.txt * @license GNU General Public License version 2 or later; see LICENSE.txt
*/ */
namespace VDM\Joomla\Componentbuilder\Compiler\Interfaces; namespace VDM\Joomla\Componentbuilder\Compiler\Interfaces\Extension;
/** /**

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,89 @@
<?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\Interfaces;
/**
* Compiler Language Interface
*
* @since 3.2.0
*/
interface LanguageInterface
{
/**
* Get the language string key
*
* @param string $string The plan text string (English)
*
* @return string The key language string (all uppercase)
* @since 3.2.0
*/
public function key($string): string;
/**
* check if the language string exist
*
* @param string $target The target area for the language string
* @param string|null $language The language key string
*
* @return bool
* @since 3.2.0
*/
public function exist(string $target, ?string $language = null): bool;
/**
* get the language string
*
* @param string $target The target area for the language string
* @param string|null $language The language key string
*
* @return Mixed The language string found or empty string if none is found
* @since 3.2.0
*/
public function get(string $target, string $language): string;
/**
* get target array
*
* @param string $target The target area for the language string
*
* @return array The target array or empty array if none is found
* @since 3.2.0
*/
public function getTarget(string $target): array;
/**
* set target array
*
* @param string $target The target area for the language string
* @param array|null $content The language content string
*
* @return void
* @since 3.2.0
*/
public function setTarget(string $target, ?array $content);
/**
* set the language content values to language content array
*
* @param string $target The target area for the language string
* @param string $language The language key string
* @param string $string The language string
* @param bool $addPrefix The switch to add langPrefix
*
* @return void
* @since 3.2.0
*/
public function set(string $target, string $language, string $string, bool $addPrefix = false);
}

View File

@ -0,0 +1,72 @@
<?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\Interfaces;
/**
* Compiler Placeholder Interface
*
* @since 3.2.0
*/
interface PlaceholderInterface
{
/**
* Set a type of placeholder with set of values
*
* @param string $key The main string for placeholder key
* @param array $values The values to add
*
* @return void
* @since 3.2.0
*/
public function setType(string $key, array $values);
/**
* Remove a type of placeholder by main key
*
* @param string $key The main string for placeholder key
*
* @return void
* @since 3.2.0
*/
public function clearType(string $key);
/**
* Update the data with the placeholders
*
* @param string $data The actual data
* @param array $placeholder The placeholders
* @param int $action The action to use
*
* THE ACTION OPTIONS ARE
* 1 -> Just replace (default)
* 2 -> Check if data string has placeholders
* 3 -> Remove placeholders not in data string
*
* @return string
* @since 3.2.0
*/
public function update(string $data, array &$placeholder, int $action = 1): string;
/**
* return the placeholders for inserted and replaced code
*
* @param int $type The type of placement
* @param int|null $id The code id in the system
*
* @return array with start and end keys
* @since 3.2.0
*/
public function keys(int $type, ?int $id = null): array;
}

View File

@ -0,0 +1,43 @@
<?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\Interfaces;
/**
* Compiler Power Interface
*
* @since 3.2.0
*/
interface PowerInterface
{
/**
* load all the powers linked to this component
*
* @param array $guids The global unique ids of the linked powers
*
* @return void
* @since 3.2.0
*/
public function load(array $guids);
/**
* Get a power
*
* @param string $guid The global unique id of the power
* @param int $build Force build switch (to override global switch)
*
* @return mixed
* @since 3.2.0
*/
public function get(string $guid, int $build = 0);
}

View File

@ -16,6 +16,7 @@ use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\StringHelper; use VDM\Joomla\Utilities\StringHelper;
use VDM\Joomla\Componentbuilder\Compiler\Factory as Compiler; use VDM\Joomla\Componentbuilder\Compiler\Factory as Compiler;
use VDM\Joomla\Componentbuilder\Compiler\Config; use VDM\Joomla\Componentbuilder\Compiler\Config;
use VDM\Joomla\Componentbuilder\Compiler\Interfaces\LanguageInterface;
/** /**
@ -23,7 +24,7 @@ use VDM\Joomla\Componentbuilder\Compiler\Config;
* *
* @since 3.2.0 * @since 3.2.0
*/ */
class Language class Language implements LanguageInterface
{ {
/** /**
* The language content * The language content

View File

@ -18,6 +18,7 @@ use VDM\Joomla\Utilities\GetHelper;
use VDM\Joomla\Componentbuilder\Compiler\Factory as Compiler; use VDM\Joomla\Componentbuilder\Compiler\Factory as Compiler;
use VDM\Joomla\Componentbuilder\Compiler\Config; use VDM\Joomla\Componentbuilder\Compiler\Config;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Placefix; use VDM\Joomla\Componentbuilder\Compiler\Utilities\Placefix;
use VDM\Joomla\Componentbuilder\Compiler\Interfaces\PlaceholderInterface;
/** /**
@ -25,7 +26,7 @@ use VDM\Joomla\Componentbuilder\Compiler\Utilities\Placefix;
* *
* @since 3.2.0 * @since 3.2.0
*/ */
class Placeholder class Placeholder implements PlaceholderInterface
{ {
/** /**
* The active placeholders * The active placeholders
@ -181,10 +182,10 @@ class Placeholder
* @param int $type The type of placement * @param int $type The type of placement
* @param int|null $id The code id in the system * @param int|null $id The code id in the system
* *
* @return array on success * @return array with start and end keys
* @since 3.2.0 * @since 3.2.0
*/ */
public function keys(int $type, ?int $id = null) public function keys(int $type, ?int $id = null): array
{ {
switch ($type) switch ($type)
{ {
@ -200,10 +201,6 @@ class Placeholder
'end' => '/***[/REPLACED$$$$]***/' 'end' => '/***[/REPLACED$$$$]***/'
]; ];
} }
else
{
return [ 'start' => "", 'end' => ""];
}
break; break;
case 12: case 12:
//***[INSERTED$$$$]***//**1**/ //***[INSERTED$$$$]***//**1**/
@ -214,10 +211,6 @@ class Placeholder
'end' => '/***[/INSERTED$$$$]***/' 'end' => '/***[/INSERTED$$$$]***/'
]; ];
} }
else
{
return [ 'start' => "", 'end' => ""];
}
break; break;
case 21: case 21:
//<!--[REPLACED$$$$]--><!--1--> //<!--[REPLACED$$$$]--><!--1-->
@ -228,10 +221,6 @@ class Placeholder
'end' => '<!--[/REPLACED$$$$]-->' 'end' => '<!--[/REPLACED$$$$]-->'
]; ];
} }
else
{
return [ 'start' => "", 'end' => ""];
}
break; break;
case 22: case 22:
//<!--[INSERTED$$$$]--><!--1--> //<!--[INSERTED$$$$]--><!--1-->
@ -242,10 +231,6 @@ class Placeholder
'end' => '<!--[/INSERTED$$$$]-->' 'end' => '<!--[/INSERTED$$$$]-->'
]; ];
} }
else
{
return [ 'start' => "", 'end' => ""];
}
break; break;
case 33: case 33:
return ['start' => Placefix::h(), 'end' => Placefix::h()]; return ['start' => Placefix::h(), 'end' => Placefix::h()];
@ -255,8 +240,9 @@ class Placeholder
break; break;
} }
return false; return [ 'start' => "", 'end' => ""];
} }
} }

View File

@ -26,6 +26,7 @@ use VDM\Joomla\Componentbuilder\Compiler\Config;
use VDM\Joomla\Componentbuilder\Compiler\Placeholder; use VDM\Joomla\Componentbuilder\Compiler\Placeholder;
use VDM\Joomla\Componentbuilder\Compiler\Customcode; use VDM\Joomla\Componentbuilder\Compiler\Customcode;
use VDM\Joomla\Componentbuilder\Compiler\Customcode\Gui; use VDM\Joomla\Componentbuilder\Compiler\Customcode\Gui;
use VDM\Joomla\Componentbuilder\Compiler\Interfaces\PowerInterface;
/** /**
@ -33,7 +34,7 @@ use VDM\Joomla\Componentbuilder\Compiler\Customcode\Gui;
* *
* @since 3.2.0 * @since 3.2.0
*/ */
class Power class Power implements PowerInterface
{ {
/** /**
* All loaded powers * All loaded powers
@ -207,7 +208,7 @@ class Power
$this->active[$guid]->key = $this->active[$guid]->id . '_' . $this->active[$guid]->target_type; $this->active[$guid]->key = $this->active[$guid]->id . '_' . $this->active[$guid]->target_type;
// now set the name // now set the name
$this->active[$guid]->name = $this->placeholder->update( $this->active[$guid]->name = $this->placeholder->update(
$this->customcode->add($this->active[$guid]->name), $this->customcode->update($this->active[$guid]->name),
$this->placeholder->active $this->placeholder->active
); );
// now set the code_name and class name // now set the code_name and class name
@ -382,7 +383,7 @@ class Power
&& StringHelper::check($this->active[$guid]->implements_custom)) && StringHelper::check($this->active[$guid]->implements_custom))
{ {
$this->active[$guid]->implement_names[] = $this->placeholder->update( $this->active[$guid]->implement_names[] = $this->placeholder->update(
$this->customcode->add($this->active[$guid]->implements_custom), $this->customcode->update($this->active[$guid]->implements_custom),
$this->placeholder->active $this->placeholder->active
); );
// just add this once // just add this once
@ -409,7 +410,7 @@ class Power
&& StringHelper::check($this->active[$guid]->extends_custom)) && StringHelper::check($this->active[$guid]->extends_custom))
{ {
$this->active[$guid]->extends_name = $this->placeholder->update( $this->active[$guid]->extends_name = $this->placeholder->update(
$this->customcode->add($this->active[$guid]->extends_custom), $this->customcode->update($this->active[$guid]->extends_custom),
$this->placeholder->active $this->placeholder->active
); );
// just add once // just add once
@ -437,7 +438,7 @@ class Power
// base64 Decode code // base64 Decode code
$this->active[$guid]->head = $this->gui->set( $this->active[$guid]->head = $this->gui->set(
$this->placeholder->update( $this->placeholder->update(
$this->customcode->add( $this->customcode->update(
base64_decode( base64_decode(
$this->active[$guid]->head $this->active[$guid]->head
) )
@ -472,7 +473,7 @@ class Power
} }
// now set the description // now set the description
$this->active[$guid]->description = (StringHelper::check($this->active[$guid]->description)) ? $this->placeholder->update( $this->active[$guid]->description = (StringHelper::check($this->active[$guid]->description)) ? $this->placeholder->update(
$this->customcode->add($this->active[$guid]->description), $this->customcode->update($this->active[$guid]->description),
$this->placeholder->active $this->placeholder->active
) : ''; ) : '';
// add the main code if set // add the main code if set
@ -483,7 +484,7 @@ class Power
// base64 Decode code // base64 Decode code
$this->active[$guid]->main_class_code = $this->gui->set( $this->active[$guid]->main_class_code = $this->gui->set(
$this->placeholder->update( $this->placeholder->update(
$this->customcode->add( $this->customcode->update(
base64_decode( base64_decode(
$this->active[$guid]->main_class_code $this->active[$guid]->main_class_code
) )

View File

@ -15,6 +15,7 @@ namespace VDM\Joomla\Componentbuilder\Compiler\Service;
use Joomla\DI\Container; use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface; use Joomla\DI\ServiceProviderInterface;
use VDM\Joomla\Componentbuilder\Compiler\Customcode as CompilerCustomcode; use VDM\Joomla\Componentbuilder\Compiler\Customcode as CompilerCustomcode;
use VDM\Joomla\Componentbuilder\Compiler\Interfaces\CustomcodeInterface;
use VDM\Joomla\Componentbuilder\Compiler\Customcode\External; use VDM\Joomla\Componentbuilder\Compiler\Customcode\External;
use VDM\Joomla\Componentbuilder\Compiler\Customcode\Gui; use VDM\Joomla\Componentbuilder\Compiler\Customcode\Gui;
use VDM\Joomla\Componentbuilder\Compiler\Customcode\Hash; use VDM\Joomla\Componentbuilder\Compiler\Customcode\Hash;
@ -71,10 +72,10 @@ class Customcode implements ServiceProviderInterface
* *
* @param Container $container The DI container. * @param Container $container The DI container.
* *
* @return CompilerCustomcode * @return CustomcodeInterface
* @since 3.2.0 * @since 3.2.0
*/ */
public function getCustomcode(Container $container): CompilerCustomcode public function getCustomcode(Container $container): CustomcodeInterface
{ {
return new CompilerCustomcode( return new CompilerCustomcode(
$container->get('Config'), $container->get('Config'),