From 3497104f41b76643c7226f05bf146dfdc6676d6d Mon Sep 17 00:00:00 2001 From: Llewellyn van der Merwe Date: Sun, 7 Jul 2019 00:29:35 +0200 Subject: [PATCH] Added some more events to compiler. Added new helper method to make safeClassFunctionName. --- README.md | 8 ++++---- admin/README.txt | 8 ++++---- admin/helpers/compiler.php | 16 ++++++++++++++-- admin/helpers/componentbuilder.php | 18 ++++++++++++++++++ .../en-GB/en-GB.com_componentbuilder.ini | 2 +- componentbuilder.xml | 6 +++--- componentbuilder_update_server.xml | 6 +++--- script.php | 2 +- site/helpers/componentbuilder.php | 18 ++++++++++++++++++ 9 files changed, 66 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 90f348def..d62f0765e 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ The Component Builder for [Joomla](https://extensions.joomla.org/extension/compo Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will safe you lots of time and money. A real must have! -You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.9.20) with **ALL** its features and **ALL** concepts totally open-source and free! +You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.9.21) with **ALL** its features and **ALL** concepts totally open-source and free! > Watch Quick Build of a Hello World component in [JCB on Youtube](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45) @@ -146,11 +146,11 @@ 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*: 5th July, 2019 -+ *Version*: 2.9.20 ++ *Last Build*: 6th July, 2019 ++ *Version*: 2.9.21 + *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*: **211567** ++ *Line count*: **211603** + *Field count*: **1143** + *File count*: **1346** + *Folder count*: **209** diff --git a/admin/README.txt b/admin/README.txt index 90f348def..d62f0765e 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -12,7 +12,7 @@ The Component Builder for [Joomla](https://extensions.joomla.org/extension/compo Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will safe you lots of time and money. A real must have! -You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.9.20) with **ALL** its features and **ALL** concepts totally open-source and free! +You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.9.21) with **ALL** its features and **ALL** concepts totally open-source and free! > Watch Quick Build of a Hello World component in [JCB on Youtube](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45) @@ -146,11 +146,11 @@ 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*: 5th July, 2019 -+ *Version*: 2.9.20 ++ *Last Build*: 6th July, 2019 ++ *Version*: 2.9.21 + *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*: **211567** ++ *Line count*: **211603** + *Field count*: **1143** + *File count*: **1346** + *Folder count*: **209** diff --git a/admin/helpers/compiler.php b/admin/helpers/compiler.php index 94a26fdbb..695c72aaa 100644 --- a/admin/helpers/compiler.php +++ b/admin/helpers/compiler.php @@ -459,20 +459,28 @@ class Compiler extends Infusion { // set the repo path $repoFullPath = $this->repoPath . '/com_' . $this->componentData->sales_name . '__joomla_' . $this->joomlaVersion; + // Trigger Event: jcb_ce_onBeforeUpdateRepo + $this->triggerEvent('jcb_ce_onBeforeUpdateRepo', array(&$this->componentContext, &$this->componentPath, &$repoFullPath, &$this->componentData)); // remove old data $this->removeFolder($repoFullPath, $this->componentData->toignore); // set the new data JFolder::copy($this->componentPath, $repoFullPath, '', true); + // Trigger Event: jcb_ce_onAfterUpdateRepo + $this->triggerEvent('jcb_ce_onAfterUpdateRepo', array(&$this->componentContext, &$this->componentPath, &$repoFullPath, &$this->componentData)); } // the name of the zip file to create $this->filepath = $this->tempPath . '/' . $this->componentFolderName . '.zip'; - + // Trigger Event: jcb_ce_onBeforeZipComponent + $this->triggerEvent('jcb_ce_onBeforeZipComponent', array(&$this->componentContext, &$this->componentPath, &$this->filepath, &$this->tempPath, &$this->componentFolderName, &$this->componentData)); //create the zip file if (ComponentbuilderHelper::zip($this->componentPath, $this->filepath)) { - // now move to backup if zip was made and backup is requered + // now move to backup if zip was made and backup is required if ($this->backupPath && $this->dynamicIntegration) { + // Trigger Event: jcb_ce_onBeforeBackupZip + $this->triggerEvent('jcb_ce_onBeforeBackupZip', array(&$this->componentContext, &$this->filepath, &$this->tempPath, &$this->backupPath, &$this->componentData)); + // copy the zip to backup path JFile::copy($this->filepath, $this->backupPath); } @@ -482,10 +490,14 @@ class Compiler extends Infusion // make sure we have the correct file if (isset($this->componentData->sales_server)) { + // Trigger Event: jcb_ce_onBeforeMoveToServer + $this->triggerEvent('jcb_ce_onBeforeMoveToServer', array(&$this->componentContext, &$this->filepath, &$this->tempPath, &$this->componentSalesName, &$this->componentData)); // move to server ComponentbuilderHelper::moveToServer($this->filepath, $this->componentSalesName . '.zip', (int) $this->componentData->sales_server, $this->componentData->sales_server_protocol); } } + // Trigger Event: jcb_ce_onAfterZipComponent + $this->triggerEvent('jcb_ce_onAfterZipComponent', array(&$this->componentContext, &$this->filepath, &$this->tempPath, &$this->componentFolderName, &$this->componentData)); // remove the component folder since we are done if ($this->removeFolder($this->componentPath)) { diff --git a/admin/helpers/componentbuilder.php b/admin/helpers/componentbuilder.php index 3c8160c6f..67182ca26 100644 --- a/admin/helpers/componentbuilder.php +++ b/admin/helpers/componentbuilder.php @@ -124,6 +124,24 @@ abstract class ComponentbuilderHelper 'JPATH_THEMES' => JPATH_THEMES ); + /** + * Making class or function name safe + * + * @input string The name you would like to make safe + * + * @returns string on success + **/ + public static function safeClassFunctionName($name) + { + // remove numbers if the first character is a number + if (is_numeric(substr($name, 0, 1))) + { + $name = self::replaceNumbers($name); + } + // remove all spaces and strange characters + return trim(reg_replace("/[^A-Za-z0-9]/", '', $name)); + } + /** * The field builder switch **/ diff --git a/admin/language/en-GB/en-GB.com_componentbuilder.ini b/admin/language/en-GB/en-GB.com_componentbuilder.ini index b01a19532..3968e9ea5 100644 --- a/admin/language/en-GB/en-GB.com_componentbuilder.ini +++ b/admin/language/en-GB/en-GB.com_componentbuilder.ini @@ -5257,7 +5257,7 @@ COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_COMPONENT_FILES_FOLDERS_DESCRIPTION=" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_COMPONENT_FILES_FOLDERS_LABEL="Adding Custom Files & Folder" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_CROWDIN_DESCRIPTION="

Feature not ready?

-

We are still working on this integration, so it is not fully ready. Hopefully with the next update.

+

We are still working on this integration, so it is not fully ready.

diff --git a/componentbuilder.xml b/componentbuilder.xml index 683e656ef..91d56596e 100644 --- a/componentbuilder.xml +++ b/componentbuilder.xml @@ -1,15 +1,15 @@ COM_COMPONENTBUILDER - 5th July, 2019 + 6th July, 2019 Llewellyn van der Merwe llewellyn@joomlacomponentbuilder.com http://www.joomlacomponentbuilder.com Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. GNU General Public License version 2 or later; see LICENSE.txt - 2.9.20 + 2.9.21 Component Builder (v.2.9.20) +

Component Builder (v.2.9.21)

The Component Builder for [Joomla](https://extensions.joomla.org/extension/component-builder/) is highly advanced tool that is truly able to build extremely complex components in a fraction of the time. diff --git a/componentbuilder_update_server.xml b/componentbuilder_update_server.xml index fabcca403..6b51e4d31 100644 --- a/componentbuilder_update_server.xml +++ b/componentbuilder_update_server.xml @@ -687,7 +687,7 @@ 2.9.19 http://www.joomlacomponentbuilder.com - https://github.com/vdm-io/Joomla-Component-Builder/releases/download/v2.9.20/JCB_v2.9.20.zip + https://github.com/vdm-io/Joomla-Component-Builder/releases/download/v2.9.21/JCB_v2.9.21.zip stable @@ -701,10 +701,10 @@ Builds Complex Joomla Components com_componentbuilder component - 2.9.20 + 2.9.21 http://www.joomlacomponentbuilder.com - https://github.com/vdm-io/Joomla-Component-Builder/releases/download/v2.9.20/JCB_v2.9.20.zip + https://github.com/vdm-io/Joomla-Component-Builder/releases/download/v2.9.21/JCB_v2.9.21.zip stable diff --git a/script.php b/script.php index d093920ee..ddd8f71d3 100644 --- a/script.php +++ b/script.php @@ -5426,7 +5426,7 @@ class com_componentbuilderInstallerScript echo ' -

Upgrade to Version 2.9.20 Was Successful! Let us know if anything is not working as expected.

'; +

Upgrade to Version 2.9.21 Was Successful! Let us know if anything is not working as expected.

'; } } diff --git a/site/helpers/componentbuilder.php b/site/helpers/componentbuilder.php index 44c142113..2b4801c52 100644 --- a/site/helpers/componentbuilder.php +++ b/site/helpers/componentbuilder.php @@ -124,6 +124,24 @@ abstract class ComponentbuilderHelper 'JPATH_THEMES' => JPATH_THEMES ); + /** + * Making class or function name safe + * + * @input string The name you would like to make safe + * + * @returns string on success + **/ + public static function safeClassFunctionName($name) + { + // remove numbers if the first character is a number + if (is_numeric(substr($name, 0, 1))) + { + $name = self::replaceNumbers($name); + } + // remove all spaces and strange characters + return trim(reg_replace("/[^A-Za-z0-9]/", '', $name)); + } + /** * The field builder switch **/