Added events to the new module and plugin translation areas. Updated the fieldtypes to have more info on the showon property.
This commit is contained in:
parent
230834057a
commit
ad8717a47d
@ -144,14 +144,14 @@ TODO
|
||||
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
|
||||
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
|
||||
+ *First Build*: 30th April, 2015
|
||||
+ *Last Build*: 28th March, 2020
|
||||
+ *Last Build*: 3rd April, 2020
|
||||
+ *Version*: 2.10.13
|
||||
+ *Copyright*: Copyright (C) 2015 - 2020 Vast Development Method. All rights reserved.
|
||||
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
|
||||
+ *Line count*: **280177**
|
||||
+ *Field count*: **1512**
|
||||
+ *Line count*: **280662**
|
||||
+ *Field count*: **1514**
|
||||
+ *File count*: **1771**
|
||||
+ *Folder count*: **296**
|
||||
+ *Folder count*: **287**
|
||||
|
||||
> 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)
|
||||
|
@ -144,14 +144,14 @@ TODO
|
||||
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
|
||||
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
|
||||
+ *First Build*: 30th April, 2015
|
||||
+ *Last Build*: 28th March, 2020
|
||||
+ *Last Build*: 3rd April, 2020
|
||||
+ *Version*: 2.10.13
|
||||
+ *Copyright*: Copyright (C) 2015 - 2020 Vast Development Method. All rights reserved.
|
||||
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
|
||||
+ *Line count*: **280177**
|
||||
+ *Field count*: **1512**
|
||||
+ *Line count*: **280662**
|
||||
+ *Field count*: **1514**
|
||||
+ *File count*: **1771**
|
||||
+ *Folder count*: **296**
|
||||
+ *Folder count*: **287**
|
||||
|
||||
> 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)
|
||||
|
@ -25,7 +25,7 @@ class Compiler extends Infusion
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $tempPath;
|
||||
public $tempPath;
|
||||
|
||||
/**
|
||||
* The timer
|
||||
|
@ -1249,6 +1249,11 @@ class Get
|
||||
$component->system_name
|
||||
);
|
||||
|
||||
// set the component name_code
|
||||
$component->name_code = ComponentbuilderHelper::safeString(
|
||||
$component->name_code
|
||||
);
|
||||
|
||||
// ensure version naming is correct
|
||||
$this->component_version = preg_replace(
|
||||
'/[^0-9.]+/', '', $component->component_version
|
||||
@ -1447,7 +1452,7 @@ class Get
|
||||
{
|
||||
$this->setJoomlaFields = true;
|
||||
}
|
||||
// has become a lacacy issue, can't remove this
|
||||
// has become a legacy issue, can't remove this
|
||||
$array['view'] = $array['adminview'];
|
||||
// get the admin settings/data
|
||||
$array['settings'] = $this->getAdminViewData(
|
||||
|
@ -25835,14 +25835,17 @@ function vdm_dkim() {
|
||||
// Trigger Event: jcb_ce_onBeforeBuildModuleLang
|
||||
$this->triggerEvent(
|
||||
'jcb_ce_onBeforeBuildModuleLang',
|
||||
array(&$module->context, &$this->langContent[$module->key],
|
||||
array(&$this->componentContext, &$module,
|
||||
&$this->langContent[$module->key],
|
||||
&$module->lang_prefix, &$module->official_name)
|
||||
);
|
||||
// get other languages
|
||||
$values = array_unique($this->langContent[$module->key]);
|
||||
// get the other lang strings if there is any
|
||||
$this->multiLangString = $this->getMultiLangStrings($values);
|
||||
// start the modules language bucket
|
||||
// start the modules language bucket (must rest every time)
|
||||
$this->languages['modules'] = array();
|
||||
$this->languages['modules'][$this->langTag] = array();
|
||||
$this->languages['modules'][$this->langTag]['all']
|
||||
= $this->langContent[$module->key];
|
||||
unset($this->langContent[$module->key]);
|
||||
@ -25855,7 +25858,8 @@ function vdm_dkim() {
|
||||
// Trigger Event: jcb_ce_onBeforeBuildModuleLangFiles
|
||||
$this->triggerEvent(
|
||||
'jcb_ce_onBeforeBuildModuleLangFiles',
|
||||
array(&$module->context, &$this->languages['modules'],
|
||||
array(&$this->componentContext, &$module,
|
||||
&$this->languages['modules'],
|
||||
&$this->langTag)
|
||||
);
|
||||
// now we insert the values into the files
|
||||
@ -25867,46 +25871,48 @@ function vdm_dkim() {
|
||||
$tag = trim($tag);
|
||||
foreach ($areas as $area => $languageStrings)
|
||||
{
|
||||
$file_name = $tag . '.' . $module->file_name . '.ini';
|
||||
// check if language should be added
|
||||
if (!$this->shouldLanguageBeAdded(
|
||||
$tag, $languageStrings, $total
|
||||
if ($this->shouldLanguageBeAdded(
|
||||
$tag, $languageStrings, $total,
|
||||
$file_name
|
||||
))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
$lang = array_map(
|
||||
function ($langstring, $placeholder) {
|
||||
return $placeholder . '="' . $langstring . '"';
|
||||
}, array_values($languageStrings),
|
||||
array_keys($languageStrings)
|
||||
);
|
||||
// set path
|
||||
$path = $module->folder_path . '/language/' . $tag;
|
||||
// create path if not exist
|
||||
if (!JFolder::exists($path))
|
||||
{
|
||||
JFolder::create($path);
|
||||
// count the folder created
|
||||
$this->folderCount++;
|
||||
}
|
||||
// add to language files (for now we add all to both TODO)
|
||||
$this->writeFile(
|
||||
$path . '/' . $tag . '.' . $module->file_name
|
||||
. '.ini',
|
||||
implode(PHP_EOL, $lang)
|
||||
);
|
||||
$this->writeFile(
|
||||
$path . '/' . $tag . '.' . $module->file_name
|
||||
. '.sys.ini',
|
||||
implode(PHP_EOL, $lang)
|
||||
);
|
||||
// set the line counter
|
||||
$this->lineCount = $this->lineCount + count(
|
||||
(array) $lang
|
||||
$lang = array_map(
|
||||
function ($langstring, $placeholder) {
|
||||
return $placeholder . '="' . $langstring
|
||||
. '"';
|
||||
}, array_values($languageStrings),
|
||||
array_keys($languageStrings)
|
||||
);
|
||||
unset($lang);
|
||||
// trigger to add language
|
||||
$addLang[$tag] = $tag;
|
||||
// set path
|
||||
$path = $module->folder_path . '/language/' . $tag
|
||||
. '/';
|
||||
// create path if not exist
|
||||
if (!JFolder::exists($path))
|
||||
{
|
||||
JFolder::create($path);
|
||||
// count the folder created
|
||||
$this->folderCount++;
|
||||
}
|
||||
// add to language files (for now we add all to both TODO)
|
||||
$this->writeFile(
|
||||
$path . $file_name,
|
||||
implode(PHP_EOL, $lang)
|
||||
);
|
||||
$this->writeFile(
|
||||
$path . $tag . '.' . $module->file_name
|
||||
. '.sys.ini',
|
||||
implode(PHP_EOL, $lang)
|
||||
);
|
||||
// set the line counter
|
||||
$this->lineCount = $this->lineCount + count(
|
||||
(array) $lang
|
||||
);
|
||||
unset($lang);
|
||||
// trigger to add language
|
||||
$addLang[$tag] = $tag;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -25995,7 +26001,7 @@ function vdm_dkim() {
|
||||
}
|
||||
}
|
||||
// add language folder
|
||||
if ($addLang)
|
||||
if (ComponentbuilderHelper::checkArray($addLang))
|
||||
{
|
||||
$xml .= PHP_EOL . $this->_t(2) . '<folder>language</folder>';
|
||||
}
|
||||
@ -26122,9 +26128,6 @@ function vdm_dkim() {
|
||||
|
||||
public function getPluginMainXML(&$plugin)
|
||||
{
|
||||
// set some defaults
|
||||
$view = '';
|
||||
$viewType = 0;
|
||||
// set the custom table key
|
||||
$dbkey = 'yy';
|
||||
// build the xml
|
||||
@ -26174,14 +26177,17 @@ function vdm_dkim() {
|
||||
// Trigger Event: jcb_ce_onBeforeBuildPluginLang
|
||||
$this->triggerEvent(
|
||||
'jcb_ce_onBeforeBuildPluginLang',
|
||||
array(&$plugin->context, &$this->langContent[$plugin->key],
|
||||
array(&$this->componentContext, &$plugin,
|
||||
&$this->langContent[$plugin->key],
|
||||
&$plugin->lang_prefix, &$plugin->official_name)
|
||||
);
|
||||
// get other languages
|
||||
$values = array_unique($this->langContent[$plugin->key]);
|
||||
// get the other lang strings if there is any
|
||||
$this->multiLangString = $this->getMultiLangStrings($values);
|
||||
// start the plugins language bucket
|
||||
// start the plugins language bucket (must rest every time)
|
||||
$this->languages['plugins'] = array();
|
||||
$this->languages['plugins'][$this->langTag] = array();
|
||||
$this->languages['plugins'][$this->langTag]['all']
|
||||
= $this->langContent[$plugin->key];
|
||||
unset($this->langContent[$plugin->key]);
|
||||
@ -26194,7 +26200,8 @@ function vdm_dkim() {
|
||||
// Trigger Event: jcb_ce_onBeforeBuildPluginLangFiles
|
||||
$this->triggerEvent(
|
||||
'jcb_ce_onBeforeBuildPluginLangFiles',
|
||||
array(&$plugin->context, &$this->languages['plugins'],
|
||||
array(&$this->componentContext, &$plugin,
|
||||
&$this->languages['plugins'],
|
||||
&$this->langTag)
|
||||
);
|
||||
// now we insert the values into the files
|
||||
@ -26206,47 +26213,53 @@ function vdm_dkim() {
|
||||
$tag = trim($tag);
|
||||
foreach ($areas as $area => $languageStrings)
|
||||
{
|
||||
$file_name = $tag . '.plg_' . strtolower($plugin->group)
|
||||
. '_'
|
||||
. strtolower($plugin->code_name) . '.ini';
|
||||
// check if language should be added
|
||||
if (!$this->shouldLanguageBeAdded(
|
||||
$tag, $languageStrings, $total
|
||||
if ($this->shouldLanguageBeAdded(
|
||||
$tag, $languageStrings, $total,
|
||||
$file_name
|
||||
))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
$lang = array_map(
|
||||
function ($langstring, $placeholder) {
|
||||
return $placeholder . '="' . $langstring . '"';
|
||||
}, array_values($languageStrings),
|
||||
array_keys($languageStrings)
|
||||
);
|
||||
// set path
|
||||
$path = $plugin->folder_path . '/language/' . $tag . '/'
|
||||
. $tag;
|
||||
// create path if not exist
|
||||
if (!JFolder::exists($path))
|
||||
{
|
||||
JFolder::create($path);
|
||||
// count the folder created
|
||||
$this->folderCount++;
|
||||
}
|
||||
// add to language file
|
||||
$this->writeFile(
|
||||
$path . '.plg_' . strtolower($plugin->group) . '_'
|
||||
. strtolower($plugin->code_name) . '.ini',
|
||||
implode(PHP_EOL, $lang)
|
||||
);
|
||||
$this->writeFile(
|
||||
$path . '.plg_' . strtolower($plugin->group) . '_'
|
||||
. strtolower($plugin->code_name) . '.sys.ini',
|
||||
implode(PHP_EOL, $lang)
|
||||
);
|
||||
// set the line counter
|
||||
$this->lineCount = $this->lineCount + count(
|
||||
(array) $lang
|
||||
$lang = array_map(
|
||||
function ($langstring, $placeholder) {
|
||||
return $placeholder . '="' . $langstring
|
||||
. '"';
|
||||
}, array_values($languageStrings),
|
||||
array_keys($languageStrings)
|
||||
);
|
||||
unset($lang);
|
||||
// trigger to add language
|
||||
$addLang[$tag] = $tag;
|
||||
// set path
|
||||
$path = $plugin->folder_path . '/language/' . $tag
|
||||
. '/';
|
||||
// create path if not exist
|
||||
if (!JFolder::exists($path))
|
||||
{
|
||||
JFolder::create($path);
|
||||
// count the folder created
|
||||
$this->folderCount++;
|
||||
}
|
||||
// add to language file
|
||||
$this->writeFile(
|
||||
$path . $file_name,
|
||||
implode(PHP_EOL, $lang)
|
||||
);
|
||||
$this->writeFile(
|
||||
$path . $tag . '.plg_' . strtolower(
|
||||
$plugin->group
|
||||
)
|
||||
. '_'
|
||||
. strtolower($plugin->code_name) . '.sys.ini',
|
||||
implode(PHP_EOL, $lang)
|
||||
);
|
||||
// set the line counter
|
||||
$this->lineCount = $this->lineCount + count(
|
||||
(array) $lang
|
||||
);
|
||||
unset($lang);
|
||||
// trigger to add language
|
||||
$addLang[$tag] = $tag;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -26338,7 +26351,7 @@ function vdm_dkim() {
|
||||
}
|
||||
}
|
||||
// add language folder
|
||||
if ($addLang)
|
||||
if (ComponentbuilderHelper::checkArray($addLang))
|
||||
{
|
||||
$xml .= PHP_EOL . $this->_t(2) . '<folder>language</folder>';
|
||||
}
|
||||
@ -26734,8 +26747,15 @@ function vdm_dkim() {
|
||||
return $script;
|
||||
}
|
||||
|
||||
public function shouldLanguageBeAdded(&$tag, &$languageStrings, &$total)
|
||||
{
|
||||
/**
|
||||
* check if a translation should be added
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
*/
|
||||
public function shouldLanguageBeAdded(&$tag, &$languageStrings, &$total,
|
||||
&$file_name
|
||||
) {
|
||||
// only log messages for none $this->langTag translations
|
||||
if ($this->langTag !== $tag)
|
||||
{
|
||||
@ -26756,7 +26776,7 @@ function vdm_dkim() {
|
||||
if ($percentage < $this->percentageLanguageAdd)
|
||||
{
|
||||
// dont add
|
||||
$this->langNot[$area . ' ' . $tag] = '<b>'
|
||||
$this->langNot[$file_name] = '<b>'
|
||||
. $total . '</b>(total '
|
||||
. $this->langTag . ' strings) only <b>'
|
||||
. $langStringNr . '</b>' . $stringNAme
|
||||
@ -26766,7 +26786,7 @@ function vdm_dkim() {
|
||||
}
|
||||
}
|
||||
// show if it was added as well
|
||||
$this->langSet[$area . ' ' . $tag] = '<b>'
|
||||
$this->langSet[$file_name] = '<b>'
|
||||
. $total . '</b>(total '
|
||||
. $this->langTag . ' strings) and <b>'
|
||||
. $langStringNr . '</b>' . $stringNAme . ' = '
|
||||
|
@ -1875,6 +1875,11 @@ class Infusion extends Interpretation
|
||||
{
|
||||
if (ComponentbuilderHelper::checkObject($module))
|
||||
{
|
||||
// Trigger Event: jcb_ce_onBeforeInfuseModuleData
|
||||
$this->triggerEvent(
|
||||
'jcb_ce_onBeforeInfuseModuleData',
|
||||
array(&$this->componentContext, &$module, $this)
|
||||
);
|
||||
$this->target = $module->key;
|
||||
$this->lang = $module->key;
|
||||
$this->langPrefix = $module->lang_prefix;
|
||||
@ -1934,6 +1939,11 @@ class Infusion extends Interpretation
|
||||
$this->fileContentDynamic[$module->key][$this->hhh
|
||||
. 'MAINXML' . $this->hhh]
|
||||
= $this->getModuleMainXML($module);
|
||||
// Trigger Event: jcb_ce_onAfterInfuseModuleData
|
||||
$this->triggerEvent(
|
||||
'jcb_ce_onAfterInfuseModuleData',
|
||||
array(&$this->componentContext, &$module, $this)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1944,6 +1954,11 @@ class Infusion extends Interpretation
|
||||
{
|
||||
if (ComponentbuilderHelper::checkObject($plugin))
|
||||
{
|
||||
// Trigger Event: jcb_ce_onBeforeInfusePluginData
|
||||
$this->triggerEvent(
|
||||
'jcb_ce_onBeforeInfusePluginData',
|
||||
array(&$this->componentContext, &$plugin, $this)
|
||||
);
|
||||
$this->target = $plugin->key;
|
||||
$this->lang = $plugin->key;
|
||||
$this->langPrefix = $plugin->lang_prefix;
|
||||
@ -1986,6 +2001,11 @@ class Infusion extends Interpretation
|
||||
$this->fileContentDynamic[$plugin->key][$this->hhh
|
||||
. 'MAINXML' . $this->hhh]
|
||||
= $this->getPluginMainXML($plugin);
|
||||
// Trigger Event: jcb_ce_onAfterInfusePluginData
|
||||
$this->triggerEvent(
|
||||
'jcb_ce_onAfterInfusePluginData',
|
||||
array(&$this->componentContext, &$plugin, $this)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2206,11 +2226,6 @@ class Infusion extends Interpretation
|
||||
$tag = trim($tag);
|
||||
foreach ($areas as $area => $languageStrings)
|
||||
{
|
||||
// check if language should be added
|
||||
if (!$this->shouldLanguageBeAdded($tag, $languageStrings, $mainLangLoader[$area]))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
// set naming convention
|
||||
$p = 'admin';
|
||||
$t = '';
|
||||
@ -2227,41 +2242,53 @@ class Infusion extends Interpretation
|
||||
{
|
||||
$t = '.sys';
|
||||
}
|
||||
// build the path to place the lang file
|
||||
$path = $this->componentPath . '/' . $p . '/language/'
|
||||
. $tag;
|
||||
if (!JFolder::exists($path))
|
||||
{
|
||||
JFolder::create($path);
|
||||
// count the folder created
|
||||
$this->folderCount++;
|
||||
}
|
||||
// build the file name
|
||||
$fileName = $tag . '.com_' . $this->componentCodeName . $t
|
||||
$file_name = $tag . '.com_' . $this->componentCodeName . $t
|
||||
. '.ini';
|
||||
// move the file to its place
|
||||
JFile::copy($getPAth, $path . '/' . $fileName);
|
||||
// count the file created
|
||||
$this->fileCount++;
|
||||
// add content to it
|
||||
$lang = array_map(
|
||||
function ($langstring, $placeholder) {
|
||||
return $placeholder . '="' . $langstring . '"';
|
||||
}, $languageStrings, array_keys($languageStrings)
|
||||
);
|
||||
// add to language file
|
||||
$this->writeFile(
|
||||
$path . '/' . $fileName, implode(PHP_EOL, $lang)
|
||||
);
|
||||
// set the line counter
|
||||
$this->lineCount = $this->lineCount + count((array) $lang);
|
||||
// build xml strings
|
||||
if (!isset($langXML[$p]))
|
||||
// check if language should be added
|
||||
if ($this->shouldLanguageBeAdded(
|
||||
$tag, $languageStrings, $mainLangLoader[$area],
|
||||
$file_name
|
||||
))
|
||||
{
|
||||
$langXML[$p] = array();
|
||||
// build the path to place the lang file
|
||||
$path = $this->componentPath . '/' . $p . '/language/'
|
||||
. $tag . '/';
|
||||
if (!JFolder::exists($path))
|
||||
{
|
||||
JFolder::create($path);
|
||||
// count the folder created
|
||||
$this->folderCount++;
|
||||
}
|
||||
// move the file to its place
|
||||
JFile::copy($getPAth, $path . $file_name);
|
||||
// count the file created
|
||||
$this->fileCount++;
|
||||
// add content to it
|
||||
$lang = array_map(
|
||||
function ($langstring, $placeholder) {
|
||||
return $placeholder . '="' . $langstring . '"';
|
||||
}, array_values($languageStrings),
|
||||
array_keys($languageStrings)
|
||||
);
|
||||
// add to language file
|
||||
$this->writeFile(
|
||||
$path . $file_name, implode(PHP_EOL, $lang)
|
||||
);
|
||||
// set the line counter
|
||||
$this->lineCount = $this->lineCount + count(
|
||||
(array) $lang
|
||||
);
|
||||
unset($lang);
|
||||
// build xml strings
|
||||
if (!isset($langXML[$p]))
|
||||
{
|
||||
$langXML[$p] = array();
|
||||
}
|
||||
$langXML[$p][] = '<language tag="' . $tag
|
||||
. '">language/'
|
||||
. $tag . '/' . $file_name . '</language>';
|
||||
}
|
||||
$langXML[$p][] = '<language tag="' . $tag . '">language/'
|
||||
. $tag . '/' . $fileName . '</language>';
|
||||
}
|
||||
}
|
||||
// load the lang xml
|
||||
|
@ -699,13 +699,13 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
|
||||
// the array of tables to store
|
||||
$tables = array(
|
||||
'validation_rule', 'fieldtype', 'field', 'admin_view', 'snippet', 'dynamic_get', 'custom_admin_view', 'site_view',
|
||||
'template', 'layout', 'joomla_component', 'language', 'language_translation', 'custom_code', 'placeholder', 'class_extends',
|
||||
'template', 'layout', 'joomla_component', 'language', 'custom_code', 'placeholder', 'class_extends',
|
||||
'joomla_module', 'joomla_module_files_folders_urls', 'joomla_module_updates',
|
||||
'joomla_plugin_group', 'class_property', 'class_method', 'joomla_plugin', 'joomla_plugin_files_folders_urls', 'joomla_plugin_updates',
|
||||
'admin_fields', 'admin_fields_conditions', 'admin_fields_relations', 'admin_custom_tabs', 'component_admin_views',
|
||||
'component_site_views', 'component_custom_admin_views', 'component_updates', 'component_mysql_tweaks',
|
||||
'component_custom_admin_menus', 'component_config', 'component_dashboard', 'component_files_folders',
|
||||
'component_placeholders', 'component_modules', 'component_plugins'
|
||||
'component_placeholders', 'component_modules', 'component_plugins', 'language_translation'
|
||||
);
|
||||
// get prefix
|
||||
$prefix = $this->_db->getPrefix();
|
||||
@ -786,6 +786,8 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
|
||||
if ($table === 'language_translation')
|
||||
{
|
||||
$item->localComponents = $local->components;
|
||||
$item->localModules = $local->modules;
|
||||
$item->localPlugins = $local->plugins;
|
||||
$item->localTranslation = $local->translation;
|
||||
}
|
||||
// make sure we have the correct ID set
|
||||
@ -2192,40 +2194,49 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
|
||||
$item = $this->setNewID($item, 'component', 'joomla_component', $type);
|
||||
break;
|
||||
case 'language_translation':
|
||||
// update the component ID where needed
|
||||
$item = $this->setNewID($item, 'component', 'joomla_component', $type);
|
||||
// load the local components if found
|
||||
if (isset($item->localComponents) && ComponentbuilderHelper::checkJson($item->localComponents))
|
||||
$langKeys = array(
|
||||
array('target' => 'components', 'parent' => 'joomla_component', 'local' => 'localComponents'),
|
||||
array('target' => 'modules', 'parent' => 'joomla_module', 'local' => 'localModules'),
|
||||
array('target' => 'plugins', 'parent' => 'joomla_plugin', 'local' => 'localPlugins')
|
||||
);
|
||||
// we have a few to check so we loop them
|
||||
foreach ($langKeys as $lang)
|
||||
{
|
||||
$components = array();
|
||||
if (isset($item->components) && ComponentbuilderHelper::checkJson($item->components))
|
||||
// update the target ID where needed
|
||||
$item = $this->setNewID($item, $lang['target'], 'joomla_component', $type);
|
||||
// load the local targets if found
|
||||
if (isset($item->{$lang['local']}) && ComponentbuilderHelper::checkJson($item->{$lang['local']}))
|
||||
{
|
||||
$components = json_decode($item->components, true);
|
||||
}
|
||||
$localComponents = json_decode($item->localComponents, true);
|
||||
foreach ($localComponents as $lid)
|
||||
{
|
||||
if (!is_numeric($lid))
|
||||
$targets = array();
|
||||
if (isset($item->{$lang['target']}) && ComponentbuilderHelper::checkJson($item->{$lang['target']}))
|
||||
{
|
||||
continue;
|
||||
$targets = json_decode($item->{$lang['target']}, true);
|
||||
}
|
||||
// add if not already there
|
||||
if (!in_array($lid, $components))
|
||||
$localComponents = json_decode($item->{$lang['local']}, true);
|
||||
foreach ($localComponents as $lid)
|
||||
{
|
||||
$components[] = $lid;
|
||||
if (!is_numeric($lid))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
// add if not already there
|
||||
if (!in_array($lid, $targets))
|
||||
{
|
||||
$targets[] = $lid;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// remove the localComponents
|
||||
if (isset($item->localComponents))
|
||||
{
|
||||
unset($item->localComponents);
|
||||
}
|
||||
// load it back
|
||||
if (isset($components) && ComponentbuilderHelper::checkArray($components))
|
||||
{
|
||||
// remove the localComponents
|
||||
if (isset($item->{$lang['local']}))
|
||||
{
|
||||
unset($item->{$lang['local']});
|
||||
}
|
||||
// load it back
|
||||
$item->components = json_encode(array_values($components), JSON_FORCE_OBJECT);
|
||||
if (isset($targets) && ComponentbuilderHelper::checkArray($targets))
|
||||
{
|
||||
// load it back
|
||||
$item->{$lang['target']} = json_encode(array_values($targets), JSON_FORCE_OBJECT);
|
||||
}
|
||||
}
|
||||
// merge the translations where needed
|
||||
if (isset($item->translation) && isset($item->localTranslation)
|
||||
|
@ -966,6 +966,8 @@ class ComponentbuilderModelJoomla_components extends JModelList
|
||||
$this->setData('field', $this->getValues($item->fields, 'subform++', 'fields.field'), 'id');
|
||||
// add dynamic gets
|
||||
$this->setSmartIDs($item->custom_get, 'dynamic_get');
|
||||
// set module language strings
|
||||
$this->setLanguageTranslation($item->id, 'modules');
|
||||
}
|
||||
// actions to take if table is joomla_plugin
|
||||
if ('joomla_plugin' === $table)
|
||||
@ -982,6 +984,8 @@ class ComponentbuilderModelJoomla_components extends JModelList
|
||||
$this->setData('class_property', $this->getValues($item->property_selection, 'subform', 'property'), 'id');
|
||||
// add class_method
|
||||
$this->setData('class_method', $this->getValues($item->method_selection, 'subform', 'method'), 'id');
|
||||
// set plugin language strings
|
||||
$this->setLanguageTranslation($item->id, 'plugins');
|
||||
}
|
||||
// actions to take if table is joomla_plugin_group
|
||||
if ('joomla_plugin_group' === $table)
|
||||
@ -1664,7 +1668,7 @@ class ComponentbuilderModelJoomla_components extends JModelList
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
protected function setLanguageTranslation(&$id)
|
||||
protected function setLanguageTranslation(&$id, $target = 'components')
|
||||
{
|
||||
// Create a new query object.
|
||||
$query = $this->_db->getQuery(true);
|
||||
@ -1695,10 +1699,10 @@ class ComponentbuilderModelJoomla_components extends JModelList
|
||||
}
|
||||
foreach ($items as $item)
|
||||
{
|
||||
if (!isset($this->smartBox['language_translation'][$item->id]) && ComponentbuilderHelper::checkJson($item->components))
|
||||
if (!isset($this->smartBox['language_translation'][$item->id]) && ComponentbuilderHelper::checkJson($item->{$target}))
|
||||
{
|
||||
$components = json_decode($item->components, true);
|
||||
if (in_array($id, $components))
|
||||
$targets = json_decode($item->{$target}, true);
|
||||
if (in_array($id, $targets))
|
||||
{
|
||||
// load to global object
|
||||
$this->smartBox['language_translation'][$item->id] = $item;
|
||||
|
File diff suppressed because one or more lines are too long
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension type="component" version="3.2" method="upgrade">
|
||||
<name>COM_COMPONENTBUILDER</name>
|
||||
<creationDate>28th March, 2020</creationDate>
|
||||
<creationDate>3rd April, 2020</creationDate>
|
||||
<author>Llewellyn van der Merwe</author>
|
||||
<authorEmail>llewellyn@joomlacomponentbuilder.com</authorEmail>
|
||||
<authorUrl>http://www.joomlacomponentbuilder.com</authorUrl>
|
||||
|
Loading…
Reference in New Issue
Block a user