From 9fcc5c393023e1eb7c0187b89c9f3415517e397d Mon Sep 17 00:00:00 2001 From: Llewellyn van der Merwe Date: Mon, 26 Aug 2019 08:54:16 +0200 Subject: [PATCH] Fixed gh-467 so that the XML build of fields will work correctly with the new groupedlist field type. Added placeholders to class comments. --- README.md | 8 ++++---- admin/README.txt | 8 ++++---- admin/helpers/compiler/a_Get.php | 22 +++++++++++++++++++--- admin/helpers/compiler/c_Fields.php | 2 +- admin/helpers/componentbuilder.php | 7 ++++++- componentbuilder.xml | 2 +- site/helpers/componentbuilder.php | 7 ++++++- 7 files changed, 41 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 9b3d55b92..bd6f26bfb 100644 --- a/README.md +++ b/README.md @@ -146,14 +146,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*: 22nd August, 2019 ++ *Last Build*: 26th August, 2019 + *Version*: 2.10.0 + *Copyright*: Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + *License*: GNU General Public License version 2 or later; see LICENSE.txt -+ *Line count*: **247612** ++ *Line count*: **247882** + *Field count*: **1343** -+ *File count*: **1604** -+ *Folder count*: **250** ++ *File count*: **1608** ++ *Folder count*: **253** > 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) diff --git a/admin/README.txt b/admin/README.txt index 9b3d55b92..bd6f26bfb 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -146,14 +146,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*: 22nd August, 2019 ++ *Last Build*: 26th August, 2019 + *Version*: 2.10.0 + *Copyright*: Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + *License*: GNU General Public License version 2 or later; see LICENSE.txt -+ *Line count*: **247612** ++ *Line count*: **247882** + *Field count*: **1343** -+ *File count*: **1604** -+ *Folder count*: **250** ++ *File count*: **1608** ++ *Folder count*: **253** > 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) diff --git a/admin/helpers/compiler/a_Get.php b/admin/helpers/compiler/a_Get.php index dd9e8069a..57e3ca85a 100644 --- a/admin/helpers/compiler/a_Get.php +++ b/admin/helpers/compiler/a_Get.php @@ -862,7 +862,7 @@ class Get end($version); $key = key($version); // just increment the last - $version[$key] ++; + $version[$key]++; // set the old version $this->componentData->old_component_version = $this->componentData->component_version; // set the new version, and set update switch @@ -5695,8 +5695,8 @@ class Get /** * 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 + * @param string $key The main string for placeholder key + * @param array $values The values to add * * @return void */ @@ -6283,6 +6283,14 @@ class Get $plugin->file_name = strtolower($plugin->code_name); // set official_name lang strings $this->setLangContent($plugin->key, $this->langPrefix, $plugin->official_name); + // set some placeholder for this plugin + $this->placeholders[$this->bbb . 'Plugin_name' . $this->ddd] = $plugin->official_name; + $this->placeholders[$this->bbb . 'Plugin' . $this->ddd] = ucfirst($plugin->code_name); + $this->placeholders[$this->bbb . 'plugin' . $this->ddd] = strtolower($plugin->code_name); + $this->placeholders[$this->bbb . 'Plugin_group' . $this->ddd] = ucfirst($plugin->group); + $this->placeholders[$this->bbb . 'plugin_group' . $this->ddd] = strtolower($plugin->group); + $this->placeholders[$this->bbb . 'plugin.version' . $this->ddd] = $plugin->plugin_version; + $this->placeholders[$this->bbb . 'plugin_version' . $this->ddd] = str_replace('.', '_', $plugin->plugin_version); // set description (TODO) add description field to plugin if (!isset($plugin->description) || !ComponentbuilderHelper::checkString($plugin->description)) { @@ -6592,6 +6600,14 @@ class Get $this->lang = $_backup_lang; $this->langPrefix = $_backup_langPrefix; + unset($this->placeholders[$this->bbb . 'Plugin_name' . $this->ddd]); + unset($this->placeholders[$this->bbb . 'Plugin' . $this->ddd]); + unset($this->placeholders[$this->bbb . 'plugin' . $this->ddd]); + unset($this->placeholders[$this->bbb . 'Plugin_group' . $this->ddd]); + unset($this->placeholders[$this->bbb . 'plugin_group' . $this->ddd]); + unset($this->placeholders[$this->bbb . 'plugin.version' . $this->ddd]); + unset($this->placeholders[$this->bbb . 'plugin_version' . $this->ddd]); + $this->joomlaPlugins[$id] = $plugin; return true; diff --git a/admin/helpers/compiler/c_Fields.php b/admin/helpers/compiler/c_Fields.php index 2ccffe31f..21c502cc8 100644 --- a/admin/helpers/compiler/c_Fields.php +++ b/admin/helpers/compiler/c_Fields.php @@ -1800,7 +1800,7 @@ class Fields extends Structure foreach ($grouped_[$key_][$_id] as $option_) { - $groupOptionXML = $groupXML->fieldXML->addChild('option'); + $groupOptionXML = $groupXML->addChild('option'); $groupOptionXML->addAttribute('value', $option_['value']); $groupOptionXML[] = $option_['text']; } diff --git a/admin/helpers/componentbuilder.php b/admin/helpers/componentbuilder.php index bcc867e8f..3bb805bba 100644 --- a/admin/helpers/componentbuilder.php +++ b/admin/helpers/componentbuilder.php @@ -361,7 +361,9 @@ abstract class ComponentbuilderHelper { // set the correct order ksort($comment); - return implode(PHP_EOL, $comment); + $replace = array('Foo' => '[[[Plugin_name]]]', '[PACKAGE_NAME]' => '[[[Plugin]]]', '1.0.0' => '[[[plugin.version]]]', '1.0' => '[[[plugin.version]]]'); + // now update with JCB placeholders + return str_replace(array_keys($replace), array_values($replace), implode(PHP_EOL, $comment)); } } } @@ -5213,6 +5215,9 @@ abstract class ComponentbuilderHelper && ($timestamp <= PHP_INT_MAX) && ($timestamp >= ~PHP_INT_MAX); } + + + // Privacy integration with Joomla Privacy suite /** * Load the Component xml manifest. diff --git a/componentbuilder.xml b/componentbuilder.xml index 4615f355f..5196535ee 100644 --- a/componentbuilder.xml +++ b/componentbuilder.xml @@ -1,7 +1,7 @@ COM_COMPONENTBUILDER - 22nd August, 2019 + 26th August, 2019 Llewellyn van der Merwe llewellyn@joomlacomponentbuilder.com http://www.joomlacomponentbuilder.com diff --git a/site/helpers/componentbuilder.php b/site/helpers/componentbuilder.php index 7eba89ca4..a36a0c130 100644 --- a/site/helpers/componentbuilder.php +++ b/site/helpers/componentbuilder.php @@ -361,7 +361,9 @@ abstract class ComponentbuilderHelper { // set the correct order ksort($comment); - return implode(PHP_EOL, $comment); + $replace = array('Foo' => '[[[Plugin_name]]]', '[PACKAGE_NAME]' => '[[[Plugin]]]', '1.0.0' => '[[[plugin.version]]]', '1.0' => '[[[plugin.version]]]'); + // now update with JCB placeholders + return str_replace(array_keys($replace), array_values($replace), implode(PHP_EOL, $comment)); } } } @@ -5213,6 +5215,9 @@ abstract class ComponentbuilderHelper && ($timestamp <= PHP_INT_MAX) && ($timestamp >= ~PHP_INT_MAX); } + + + // Privacy integration with Joomla Privacy suite public static function jsonToString($value, $sperator = ", ", $table = null, $id = 'id', $name = 'name')