Added some more events to compiler. Added new helper method to make safeClassFunctionName.

This commit is contained in:
Llewellyn van der Merwe 2019-07-07 00:29:35 +02:00
parent 504abe4751
commit 3497104f41
No known key found for this signature in database
GPG Key ID: CAD7B16D27AF28C5
9 changed files with 66 additions and 18 deletions

View File

@ -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! 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) > 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) + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder) + *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
+ *First Build*: 30th April, 2015 + *First Build*: 30th April, 2015
+ *Last Build*: 5th July, 2019 + *Last Build*: 6th July, 2019
+ *Version*: 2.9.20 + *Version*: 2.9.21
+ *Copyright*: Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + *Copyright*: Copyright (C) 2015 - 2019 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*: **211567** + *Line count*: **211603**
+ *Field count*: **1143** + *Field count*: **1143**
+ *File count*: **1346** + *File count*: **1346**
+ *Folder count*: **209** + *Folder count*: **209**

View File

@ -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! 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) > 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) + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder) + *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
+ *First Build*: 30th April, 2015 + *First Build*: 30th April, 2015
+ *Last Build*: 5th July, 2019 + *Last Build*: 6th July, 2019
+ *Version*: 2.9.20 + *Version*: 2.9.21
+ *Copyright*: Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + *Copyright*: Copyright (C) 2015 - 2019 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*: **211567** + *Line count*: **211603**
+ *Field count*: **1143** + *Field count*: **1143**
+ *File count*: **1346** + *File count*: **1346**
+ *Folder count*: **209** + *Folder count*: **209**

View File

@ -459,20 +459,28 @@ class Compiler extends Infusion
{ {
// set the repo path // set the repo path
$repoFullPath = $this->repoPath . '/com_' . $this->componentData->sales_name . '__joomla_' . $this->joomlaVersion; $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 // remove old data
$this->removeFolder($repoFullPath, $this->componentData->toignore); $this->removeFolder($repoFullPath, $this->componentData->toignore);
// set the new data // set the new data
JFolder::copy($this->componentPath, $repoFullPath, '', true); 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 // the name of the zip file to create
$this->filepath = $this->tempPath . '/' . $this->componentFolderName . '.zip'; $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 //create the zip file
if (ComponentbuilderHelper::zip($this->componentPath, $this->filepath)) 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) 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); JFile::copy($this->filepath, $this->backupPath);
} }
@ -482,10 +490,14 @@ class Compiler extends Infusion
// make sure we have the correct file // make sure we have the correct file
if (isset($this->componentData->sales_server)) 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 // move to server
ComponentbuilderHelper::moveToServer($this->filepath, $this->componentSalesName . '.zip', (int) $this->componentData->sales_server, $this->componentData->sales_server_protocol); 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 // remove the component folder since we are done
if ($this->removeFolder($this->componentPath)) if ($this->removeFolder($this->componentPath))
{ {

View File

@ -124,6 +124,24 @@ abstract class ComponentbuilderHelper
'JPATH_THEMES' => JPATH_THEMES '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 * The field builder switch
**/ **/

View File

@ -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_COMPONENT_FILES_FOLDERS_LABEL="Adding Custom Files & Folder"
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_CROWDIN_DESCRIPTION="<div class='alert alert-warning'> COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_CROWDIN_DESCRIPTION="<div class='alert alert-warning'>
<h4>Feature not ready?</h4> <h4>Feature not ready?</h4>
<p>We are still working on this integration, so it is not fully ready. Hopefully with the next update.</p> <p>We are still working on this integration, so it is not fully ready.</p>
</div> </div>
<div id='crowdin_information_box'> <div id='crowdin_information_box'>
<div class='alert alert-info'> <div class='alert alert-info'>

View File

@ -1,15 +1,15 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.2" method="upgrade"> <extension type="component" version="3.2" method="upgrade">
<name>COM_COMPONENTBUILDER</name> <name>COM_COMPONENTBUILDER</name>
<creationDate>5th July, 2019</creationDate> <creationDate>6th July, 2019</creationDate>
<author>Llewellyn van der Merwe</author> <author>Llewellyn van der Merwe</author>
<authorEmail>llewellyn@joomlacomponentbuilder.com</authorEmail> <authorEmail>llewellyn@joomlacomponentbuilder.com</authorEmail>
<authorUrl>http://www.joomlacomponentbuilder.com</authorUrl> <authorUrl>http://www.joomlacomponentbuilder.com</authorUrl>
<copyright>Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved.</copyright> <copyright>Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license> <license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<version>2.9.20</version> <version>2.9.21</version>
<description><![CDATA[ <description><![CDATA[
<h1>Component Builder (v.2.9.20)</h1> <h1>Component Builder (v.2.9.21)</h1>
<div style="clear: both;"></div> <div style="clear: both;"></div>
<p>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. <p>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.

View File

@ -687,7 +687,7 @@
<version>2.9.19</version> <version>2.9.19</version>
<infourl title="Component Builder!">http://www.joomlacomponentbuilder.com</infourl> <infourl title="Component Builder!">http://www.joomlacomponentbuilder.com</infourl>
<downloads> <downloads>
<downloadurl type="full" format="zip">https://github.com/vdm-io/Joomla-Component-Builder/releases/download/v2.9.20/JCB_v2.9.20.zip</downloadurl> <downloadurl type="full" format="zip">https://github.com/vdm-io/Joomla-Component-Builder/releases/download/v2.9.21/JCB_v2.9.21.zip</downloadurl>
</downloads> </downloads>
<tags> <tags>
<tag>stable</tag> <tag>stable</tag>
@ -701,10 +701,10 @@
<description>Builds Complex Joomla Components</description> <description>Builds Complex Joomla Components</description>
<element>com_componentbuilder</element> <element>com_componentbuilder</element>
<type>component</type> <type>component</type>
<version>2.9.20</version> <version>2.9.21</version>
<infourl title="Component Builder!">http://www.joomlacomponentbuilder.com</infourl> <infourl title="Component Builder!">http://www.joomlacomponentbuilder.com</infourl>
<downloads> <downloads>
<downloadurl type="full" format="zip">https://github.com/vdm-io/Joomla-Component-Builder/releases/download/v2.9.20/JCB_v2.9.20.zip</downloadurl> <downloadurl type="full" format="zip">https://github.com/vdm-io/Joomla-Component-Builder/releases/download/v2.9.21/JCB_v2.9.21.zip</downloadurl>
</downloads> </downloads>
<tags> <tags>
<tag>stable</tag> <tag>stable</tag>

View File

@ -5426,7 +5426,7 @@ class com_componentbuilderInstallerScript
echo '<a target="_blank" href="http://www.joomlacomponentbuilder.com" title="Component Builder"> echo '<a target="_blank" href="http://www.joomlacomponentbuilder.com" title="Component Builder">
<img src="components/com_componentbuilder/assets/images/vdm-component.jpg"/> <img src="components/com_componentbuilder/assets/images/vdm-component.jpg"/>
</a> </a>
<h3>Upgrade to Version 2.9.20 Was Successful! Let us know if anything is not working as expected.</h3>'; <h3>Upgrade to Version 2.9.21 Was Successful! Let us know if anything is not working as expected.</h3>';
} }
} }

View File

@ -124,6 +124,24 @@ abstract class ComponentbuilderHelper
'JPATH_THEMES' => JPATH_THEMES '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 * The field builder switch
**/ **/