Compare commits

..

6 Commits

24 changed files with 730 additions and 369 deletions

6
.github/SUPPORT.md vendored
View File

@ -17,11 +17,11 @@ We have started a [**JCB forum**][forum] where you can post questions, about how
[Tutorials]: https://www.youtube.com/playlist?list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE
[HelloWorld]: https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45
[Wiki]: https://github.com/vdm-io/Joomla-Component-Builder/wiki
[Wiki]: https://git.vdm.dev/joomla/Component-Builder/wiki
[forum]: https://vdm.bz/jcb-forum
[Security]: http://joomlacomponentbuilder.com/report-security-issues
[Complaint]: http://joomlacomponentbuilder.com/community-complaint
[Issue]: https://github.com/vdm-io/Joomla-Component-Builder/issues
[Issue]: https://git.vdm.dev/joomla/Component-Builder/issues
[VDM]: https://www.vdm.io/joomla-component-builder
[guidelines]: https://github.com/vdm-io/Joomla-Component-Builder/blob/master/.github/CONTRIBUTING.md
[guidelines]: https://git.vdm.dev/joomla/Component-Builder/src/branch/master/.github/CONTRIBUTING.md

View File

@ -20,7 +20,7 @@
"author_url": "https://io.vdm.dev/",
"description": "The Joomla Component Builder Package that bundles JCB Component and all the plugins and features available into one package for easy install and update of your JCB system.",
"version_id": "com_componentbuilder",
"update_servers": "https://git.vdm.dev/joomla/Component-Builder/raw/branch/staging/componentbuilder_update_server.xml"
"update_servers": "https://git.vdm.dev/joomla/Component-Builder/raw/branch/master/componentbuilder_update_server.xml"
},
"repository": {
"owner": "joomla",

View File

@ -3,13 +3,13 @@
This is a [Joomla 3.x](https://extensions.joomla.org/extension/component-builder/) component. [__See In Action__](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45)
![Component Builder image](https://git.vdm.dev/joomla/Component-Builder/raw/branch/staging/admin/assets/images/vdm-component.jpg "The Component Builder")
![Component Builder image](https://git.vdm.dev/joomla/Component-Builder/raw/branch/master/admin/assets/images/jcb-banner.jpg "The Component Builder")
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.
Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will save you lots of time and money. A real must have!
You can install it quite easily and with no limitations. On [gitea](https://git.vdm.dev/joomla/Component-Builder/tags) is the latest release (3.1.2) with **ALL** its features and **ALL** concepts totally open-source and free!
You can install it quite easily and with no limitations. On [gitea](https://git.vdm.dev/joomla/Component-Builder/tags) is the latest release (3.1.5) 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)
@ -108,11 +108,11 @@ Where can you get support and help?
+ [Community Complaint](http://joomlacomponentbuilder.com/community-complaint)
+ [Open Issue On Gitea](https://git.vdm.dev/joomla/Component-Builder/issues) ^^
Since [JCB](http://joomlacomponentbuilder.com) has [become a community](https://git.vdm.dev/joomla/Component-Builder/src/branch/staging/.github/SUPPORT.md) project [VDM.io](https://www.vdm.io/) is **no longer solely responsible** for support.
Since [JCB](http://joomlacomponentbuilder.com) has [become a community](https://git.vdm.dev/joomla/Component-Builder/src/branch/master/.github/SUPPORT.md) project [VDM.io](https://www.vdm.io/) is **no longer solely responsible** for support.
We have started a [**JCB forum**](https://vdm.bz/jcb-forum) where you can post questions, about how things work, or if you need some kind of help in relation to your development of your components.
^^ Then if you run into any issues, related to the [JCB](http://joomlacomponentbuilder.com) code, like bugs, **start by searching** the (*open & closed*) issues over on Gitea, and if the issue has not been mentioned before, **then only** open a new issue, following the [community guidelines](https://git.vdm.dev/joomla/Component-Builder/src/branch/staging/.github/CONTRIBUTING.md).
^^ Then if you run into any issues, related to the [JCB](https://git.vdm.dev/joomla/Component-Builder/issues) code, like bugs, **start by searching** the (*open & closed*) issues over on [Gitea](https://git.vdm.dev/joomla/Component-Builder/issues), and if the issue has not been mentioned before, **then only** open a new issue, following the [community guidelines](https://git.vdm.dev/joomla/Component-Builder/src/branch/master/.github/CONTRIBUTING.md).
WHY GIVE IT AWAY LIKE THIS?
====================
@ -140,14 +140,14 @@ TODO
+ *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io)
+ *Name*: [Component Builder](https://git.vdm.dev/joomla/Component-Builder)
+ *First Build*: 30th April, 2015
+ *Last Build*: 9th July, 2022
+ *Version*: 3.1.2
+ *Last Build*: 20th August, 2022
+ *Version*: 3.1.5
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **311259**
+ *Line count*: **311846**
+ *Field count*: **2002**
+ *File count*: **2049**
+ *Folder count*: **349**
+ *File count*: **2055**
+ *Folder count*: **351**
> 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)

View File

@ -3,13 +3,13 @@
This is a [Joomla 3.x](https://extensions.joomla.org/extension/component-builder/) component. [__See In Action__](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45)
![Component Builder image](https://git.vdm.dev/joomla/Component-Builder/raw/branch/staging/admin/assets/images/vdm-component.jpg "The Component Builder")
![Component Builder image](https://git.vdm.dev/joomla/Component-Builder/raw/branch/master/admin/assets/images/jcb-banner.jpg "The Component Builder")
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.
Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will save you lots of time and money. A real must have!
You can install it quite easily and with no limitations. On [gitea](https://git.vdm.dev/joomla/Component-Builder/tags) is the latest release (3.1.2) with **ALL** its features and **ALL** concepts totally open-source and free!
You can install it quite easily and with no limitations. On [gitea](https://git.vdm.dev/joomla/Component-Builder/tags) is the latest release (3.1.5) 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)
@ -108,11 +108,11 @@ Where can you get support and help?
+ [Community Complaint](http://joomlacomponentbuilder.com/community-complaint)
+ [Open Issue On Gitea](https://git.vdm.dev/joomla/Component-Builder/issues) ^^
Since [JCB](http://joomlacomponentbuilder.com) has [become a community](https://git.vdm.dev/joomla/Component-Builder/src/branch/staging/.github/SUPPORT.md) project [VDM.io](https://www.vdm.io/) is **no longer solely responsible** for support.
Since [JCB](http://joomlacomponentbuilder.com) has [become a community](https://git.vdm.dev/joomla/Component-Builder/src/branch/master/.github/SUPPORT.md) project [VDM.io](https://www.vdm.io/) is **no longer solely responsible** for support.
We have started a [**JCB forum**](https://vdm.bz/jcb-forum) where you can post questions, about how things work, or if you need some kind of help in relation to your development of your components.
^^ Then if you run into any issues, related to the [JCB](http://joomlacomponentbuilder.com) code, like bugs, **start by searching** the (*open & closed*) issues over on Gitea, and if the issue has not been mentioned before, **then only** open a new issue, following the [community guidelines](https://git.vdm.dev/joomla/Component-Builder/src/branch/staging/.github/CONTRIBUTING.md).
^^ Then if you run into any issues, related to the [JCB](https://git.vdm.dev/joomla/Component-Builder/issues) code, like bugs, **start by searching** the (*open & closed*) issues over on [Gitea](https://git.vdm.dev/joomla/Component-Builder/issues), and if the issue has not been mentioned before, **then only** open a new issue, following the [community guidelines](https://git.vdm.dev/joomla/Component-Builder/src/branch/master/.github/CONTRIBUTING.md).
WHY GIVE IT AWAY LIKE THIS?
====================
@ -140,14 +140,14 @@ TODO
+ *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io)
+ *Name*: [Component Builder](https://git.vdm.dev/joomla/Component-Builder)
+ *First Build*: 30th April, 2015
+ *Last Build*: 9th July, 2022
+ *Version*: 3.1.2
+ *Last Build*: 20th August, 2022
+ *Version*: 3.1.5
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **311259**
+ *Line count*: **311846**
+ *Field count*: **2002**
+ *File count*: **2049**
+ *Folder count*: **349**
+ *File count*: **2055**
+ *Folder count*: **351**
> 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)

Binary file not shown.

After

Width:  |  Height:  |  Size: 207 KiB

View File

@ -20,7 +20,7 @@ defined('_JEXEC') or die('Restricted access');
?>
<img alt="<?php echo JText::_('COM_###COMPONENT###'); ?>" src="components/com_###component###/assets/images/vdm-component.###COMP_IMAGE_TYPE###">
<ul class="list-striped">
<li><b><?php echo JText::_('COM_###COMPONENT###_VERSION'); ?>:</b> <?php echo $this->manifest->version; ?>&nbsp;&nbsp;<span class="update-notice"></span></li>
<li><b><?php echo JText::_('COM_###COMPONENT###_VERSION'); ?>:</b> <?php echo $this->manifest->version; ?>&nbsp;&nbsp;<span class="update-notice" id="component-update-notice"></span></li>
<li><b><?php echo JText::_('COM_###COMPONENT###_DATE'); ?>:</b> <?php echo $this->manifest->creationDate; ?></li>
<li><b><?php echo JText::_('COM_###COMPONENT###_AUTHOR'); ?>:</b> <a href="mailto:<?php echo $this->manifest->authorEmail; ?>"><?php echo $this->manifest->author; ?></a></li>
<li><b><?php echo JText::_('COM_###COMPONENT###_WEBSITE'); ?>:</b> <a href="<?php echo $this->manifest->authorUrl; ?>" target="_blank"><?php echo $this->manifest->authorUrl; ?></a></li>

View File

@ -35,6 +35,7 @@ class ComponentbuilderControllerAjax extends BaseController
$this->registerTask('getComponentDetails', 'ajax');
$this->registerTask('getCronPath', 'ajax');
$this->registerTask('getWiki', 'ajax');
$this->registerTask('getVersion', 'ajax');
$this->registerTask('getJCBpackageInfo', 'ajax');
$this->registerTask('getCrowdinDetails', 'ajax');
$this->registerTask('getModuleCode', 'ajax');
@ -295,6 +296,47 @@ class ComponentbuilderControllerAjax extends BaseController
}
}
break;
case 'getVersion':
try
{
$versionValue = $jinput->get('version', NULL, 'INT');
if($versionValue && $user->id != 0)
{
$result = $this->getModel('ajax')->getVersion($versionValue);
}
else
{
$result = false;
}
if($callback)
{
echo $callback . "(".json_encode($result).");";
}
elseif($returnRaw)
{
echo json_encode($result);
}
else
{
echo "(".json_encode($result).");";
}
}
catch(Exception $e)
{
if($callback)
{
echo $callback."(".json_encode($e).");";
}
elseif($returnRaw)
{
echo json_encode($e);
}
else
{
echo "(".json_encode($e).");";
}
}
break;
case 'getJCBpackageInfo':
try
{

View File

@ -29271,227 +29271,6 @@ function vdm_dkim() {
);
}
public function getExtensionInstallClass(&$extension)
{
// yes we are adding it
$script = PHP_EOL . '/**';
$script .= PHP_EOL . ' * ' . $extension->official_name
. ' script file.';
$script .= PHP_EOL . ' *';
$script .= PHP_EOL . ' * @package ' . $extension->class_name;
$script .= PHP_EOL . ' */';
$script .= PHP_EOL . 'class ' . $extension->installer_class_name;
$script .= PHP_EOL . '{';
// set constructor
if (isset($extension->add_php_script_construct)
&& $extension->add_php_script_construct == 1
&& StringHelper::check(
$extension->php_script_construct
))
{
$script .= $this->setInstallMethodScript(
'construct', $extension->php_script_construct
);
}
// add PHP in extension install
$addScriptMethods = array('php_preflight', 'php_postflight',
'php_method');
$addScriptTypes = array('install', 'update', 'uninstall',
'discover_install');
// set some buckets for sorting
$function_install = array();
$function_update = array();
$function_uninstall = array();
$has_php_preflight = false;
$function_php_preflight = array('install' => array(),
'uninstall' => array(),
'discover_install' => array(),
'update' => array());
$has_php_postflight = false;
$function_php_postflight = array('install' => array(),
'uninstall' => array(),
'discover_install' => array(),
'update' => array());
// the function sorter
foreach ($addScriptMethods as $scriptMethod)
{
foreach ($addScriptTypes as $scriptType)
{
if (isset(
$extension->{'add_' . $scriptMethod . '_' . $scriptType}
)
&& $extension->{'add_' . $scriptMethod . '_' . $scriptType}
== 1
&& StringHelper::check(
$extension->{$scriptMethod . '_' . $scriptType}
))
{
// add to the main methods
if ('php_method' === $scriptMethod)
{
${'function_' . $scriptType}[]
= $extension->{$scriptMethod . '_' . $scriptType};
}
else
{
${'function_' . $scriptMethod}[$scriptType][]
= $extension->{$scriptMethod
. '_' . $scriptType};
${'has_' . $scriptMethod} = true;
}
}
}
}
// now add the install script.
if (ArrayHelper::check($function_install))
{
$script .= $this->setInstallMethodScript(
'install', $function_install
);
}
// now add the update script.
if (ArrayHelper::check($function_update))
{
$script .= $this->setInstallMethodScript(
'update', $function_update
);
}
// now add the uninstall script.
if (ArrayHelper::check($function_uninstall))
{
$script .= $this->setInstallMethodScript(
'uninstall', $function_uninstall
);
}
// now add the preflight script.
if ($has_php_preflight)
{
$script .= $this->setInstallMethodScript(
'preflight', $function_php_preflight
);
}
// now add the postflight script.
if ($has_php_postflight)
{
$script .= $this->setInstallMethodScript(
'postflight', $function_php_postflight
);
}
$script .= PHP_EOL . '}' . PHP_EOL;
return $script;
}
protected function setInstallMethodScript($function_name, &$scripts)
{
$script = '';
// build function
switch ($function_name)
{
case 'install':
case 'update':
case 'uninstall':
// the main function types
$script = PHP_EOL . PHP_EOL . $this->_t(1) . '/**';
$script .= PHP_EOL . $this->_t(1) . ' * Called on '
. $function_name;
$script .= PHP_EOL . $this->_t(1) . ' *';
$script .= PHP_EOL . $this->_t(1)
. ' * @param JAdapterInstance $adapter The object responsible for running this script';
$script .= PHP_EOL . $this->_t(1) . ' *';
$script .= PHP_EOL . $this->_t(1)
. ' * @return boolean True on success';
$script .= PHP_EOL . $this->_t(1) . ' */';
$script .= PHP_EOL . $this->_t(1) . 'public function '
. $function_name . '(JAdapterInstance $adapter)';
$script .= PHP_EOL . $this->_t(1) . '{';
$script .= PHP_EOL . implode(PHP_EOL . PHP_EOL, $scripts);
// return true
if ('uninstall' !== $function_name)
{
$script .= PHP_EOL . $this->_t(2) . 'return true;';
}
break;
case 'preflight':
case 'postflight':
// the pre/post function types
$script = PHP_EOL . PHP_EOL . $this->_t(1) . '/**';
$script .= PHP_EOL . $this->_t(1)
. ' * Called before any type of action';
$script .= PHP_EOL . $this->_t(1) . ' *';
$script .= PHP_EOL . $this->_t(1)
. ' * @param string $route Which action is happening (install|uninstall|discover_install|update)';
$script .= PHP_EOL . $this->_t(1)
. ' * @param JAdapterInstance $adapter The object responsible for running this script';
$script .= PHP_EOL . $this->_t(1) . ' *';
$script .= PHP_EOL . $this->_t(1)
. ' * @return boolean True on success';
$script .= PHP_EOL . $this->_t(1) . ' */';
$script .= PHP_EOL . $this->_t(1) . 'public function '
. $function_name . '($route, JAdapterInstance $adapter)';
$script .= PHP_EOL . $this->_t(1) . '{';
$script .= PHP_EOL . $this->_t(2) . '//' . $this->setLine(
__LINE__
) . ' get application';
$script .= PHP_EOL . $this->_t(2)
. '$app = JFactory::getApplication();' . PHP_EOL;
// add the default version check (TODO) must make this dynamic
if ('preflight' === $function_name)
{
$script .= PHP_EOL . $this->_t(2) . '//' . $this->setLine(
__LINE__
) . ' the default for both install and update';
$script .= PHP_EOL . $this->_t(2)
. '$jversion = new JVersion();';
$script .= PHP_EOL . $this->_t(2)
. "if (!\$jversion->isCompatible('3.8.0'))";
$script .= PHP_EOL . $this->_t(2) . '{';
$script .= PHP_EOL . $this->_t(3)
. "\$app->enqueueMessage('Please upgrade to at least Joomla! 3.8.0 before continuing!', 'error');";
$script .= PHP_EOL . $this->_t(3) . 'return false;';
$script .= PHP_EOL . $this->_t(2) . '}' . PHP_EOL;
}
// now add the scripts
foreach ($scripts as $route => $_script)
{
if (ArrayHelper::check($_script))
{
// set the if and script
$script .= PHP_EOL . $this->_t(2) . "if ('" . $route
. "' === \$route)";
$script .= PHP_EOL . $this->_t(2) . '{';
$script .= PHP_EOL . implode(
PHP_EOL . PHP_EOL, $_script
);
$script .= PHP_EOL . $this->_t(2) . '}' . PHP_EOL;
}
}
// return true
$script .= PHP_EOL . $this->_t(2) . 'return true;';
break;
case 'construct':
// the __construct script
$script = PHP_EOL . PHP_EOL . $this->_t(1) . '/**';
$script .= PHP_EOL . $this->_t(1) . ' * Constructor';
$script .= PHP_EOL . $this->_t(1) . ' *';
$script .= PHP_EOL . $this->_t(1)
. ' * @param JAdapterInstance $adapter The object responsible for running this script';
$script .= PHP_EOL . $this->_t(1) . ' */';
$script .= PHP_EOL . $this->_t(1)
. 'public function __construct(JAdapterInstance $adapter)';
$script .= PHP_EOL . $this->_t(1) . '{';
$script .= PHP_EOL . $scripts;
break;
default:
// oops error
return '';
}
// close the function
$script .= PHP_EOL . $this->_t(1) . '}';
return $script;
}
/**
* check if a translation should be added
*

View File

@ -19,6 +19,7 @@ use VDM\Joomla\Utilities\StringHelper;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use VDM\Joomla\Utilities\FileHelper;
use VDM\Joomla\Componentbuilder\Extension\InstallScript;
/**
* Infusion class
@ -2393,7 +2394,7 @@ class Infusion extends Interpretation
// INSTALLCLASS
$this->fileContentDynamic[$module->key][$this->hhh
. 'INSTALLCLASS' . $this->hhh]
= $this->getExtensionInstallClass($module);
= (new InstallScript($module, ['debug' => $this->debugLinenr]))->get();
}
// FIELDSET
if (isset($module->form_files)
@ -2455,7 +2456,7 @@ class Infusion extends Interpretation
// INSTALLCLASS
$this->fileContentDynamic[$plugin->key][$this->hhh
. 'INSTALLCLASS' . $this->hhh]
= $this->getExtensionInstallClass($plugin);
= (new InstallScript($plugin, ['debug' => $this->debugLinenr]))->get();
}
// FIELDSET
if (isset($plugin->form_files)

View File

@ -5483,7 +5483,7 @@ COM_COMPONENTBUILDER_GET_SNIPPETS_TEMPLATES_BUTTON_ACCESS_DESC="Allows the users
COM_COMPONENTBUILDER_GET_THE_SNIPPET_FROM_GITHUB_AND_INSTALL_IT_LOCALLY="Get the snippet from gitHub and install it locally"
COM_COMPONENTBUILDER_GET_THE_SNIPPET_FROM_GITHUB_AND_UPDATE_THE_LOCAL_VERSION="Get the snippet from gitHub and update the local version"
COM_COMPONENTBUILDER_GET_TOKEN="Get Token"
COM_COMPONENTBUILDER_GET_TOKEN_FROM_VDM_FOR_UPDATES_AND_ADD_IT_TO_YOUR_GLOBAL_OPTIONS="Get token from VDM for updates, and add it to your global options"
COM_COMPONENTBUILDER_GET_TOKEN_FROM_VDM_TO_GET_UPDATE_NOTICE_AND_ADD_IT_TO_YOUR_GLOBAL_OPTIONS="Get token from VDM to get update notice, and add it to your global options."
COM_COMPONENTBUILDER_GLOBAL="Global"
COM_COMPONENTBUILDER_GLUECODE="Glue/Code"
COM_COMPONENTBUILDER_GREAT_THIS_FUNCTION_NAME_WILL_WORK="Great, this function name will work!"
@ -7810,7 +7810,7 @@ COM_COMPONENTBUILDER_OPTIONS="Options"
COM_COMPONENTBUILDER_ORDER_BEFORE="Order Before"
COM_COMPONENTBUILDER_ORDER_IN_EDIT="Order in Edit"
COM_COMPONENTBUILDER_ORDER_IN_LIST_VIEWS="Order in list views"
COM_COMPONENTBUILDER_OUT_OF_DATE="Out of Date"
COM_COMPONENTBUILDER_OUT_OF_DATE="Out of date"
COM_COMPONENTBUILDER_OWNER_DETAILS_WAS_SET="Owner details was set"
COM_COMPONENTBUILDER_OWNER_S="Owner: %s"
COM_COMPONENTBUILDER_PACKAGE="Package"
@ -8117,6 +8117,7 @@ COM_COMPONENTBUILDER_PROPERTY_VALUE="Property Value"
COM_COMPONENTBUILDER_PUBLIC_ACCESS="Public Access"
COM_COMPONENTBUILDER_PUBLISHED="Published"
COM_COMPONENTBUILDER_PUBLISHING="Publishing"
COM_COMPONENTBUILDER_README="Readme"
COM_COMPONENTBUILDER_READY_TO_COMPILE_A_COMPONENT="Ready to compile a component"
COM_COMPONENTBUILDER_REFRESH="Refresh"
COM_COMPONENTBUILDER_REMOVE="Remove"
@ -9347,6 +9348,7 @@ COM_COMPONENTBUILDER_WE_DID_NOT_CHECK_THE_SNIPPET_IT_SELF_TO_SEE_IF_IT_CHANGED_W
COM_COMPONENTBUILDER_WE_FAILED_TO_MOVE_BSB="We failed to move <b>%s</b>!"
COM_COMPONENTBUILDER_WE_SUCCESSFULLY_MOVED_BSB="We successfully moved <b>%s</b>!"
COM_COMPONENTBUILDER_WHILE_WE_DOWNLOAD_ALL_TWENTY_SIX_COMPILER_GIF_ANIMATIONS_RANDOMLY_USED_IN_THE_COMPILER_GUI_DURING_COMPILATION="While we download all 26 compiler GIF animations randomly used in the compiler GUI during compilation"
COM_COMPONENTBUILDER_WIKI="Wiki"
COM_COMPONENTBUILDER_YES="Yes"
COM_COMPONENTBUILDER_YOUR_DATA_IS_ENCRYPTED_WITH_A_AES_ONE_HUNDRED_AND_TWENTY_EIGHT_BIT_ENCRYPTION_USING_THE_ABOVE_THIRTY_TWO_CHARACTER_KEY="Your data is encrypted with a AES 128 bit encryption using the above 32 character key."
COM_COMPONENTBUILDER_YOUR_DATA_IS_ENCRYPTED_WITH_A_AES_ONE_HUNDRED_AND_TWENTY_EIGHT_BIT_ENCRYPTION_USING_THE_ABOVE_THIRTY_TWO_CHARACTER_KEY_WITHOUT_THIS_KEY_IT_WILL_TAKE_THE_CURRENT_TECHNOLOGY_WITH_A_BRUTE_FORCE_ATTACK_METHOD_MORE_THEN_A_HREFHTTPRANDOMIZECOMHOWLONGTOHACKPASS_TARGET_BLANK_TITLEHOW_LONG_TO_HACK_PASSSEVEN_HUNDRED_ZERO_ZERO_ZERO_ZERO_ZERO_ZERO_ZERO_ZERO_ZERO_ZEROA_YEARS_TO_CRACK_THEORETICALLY_UNLESS_THEY_HAVE_THIS_KEY_ABOVE_SO_DO_KEEP_IT_SAFE="Your data is encrypted with a AES 128 bit encryption using the above 32 character key. Without this key it will take the current technology with a brute force attack method more then <a href="http://random-ize.com/how-long-to-hack-pass/" target="_blank" title="How long to hack pass">700 000 000 000 000 000 000 000 000 000 000</a> years to crack theoretically. Unless they have this key above, so do keep it safe."

View File

@ -305,15 +305,15 @@ class ComponentbuilderModelAjax extends ListModel
}
catch (DomainException $e)
{
return $this->getTokenFromVDM($e->getMessage());
return $this->getTokenForWiki($e->getMessage());
}
catch (InvalidArgumentException $e)
{
return $this->getTokenFromVDM($e->getMessage());
return $this->getTokenForWiki($e->getMessage());
}
catch (Exception $e)
{
return $this->getTokenFromVDM($e->getMessage());
return $this->getTokenForWiki($e->getMessage());
}
// get the html
@ -322,10 +322,10 @@ class ComponentbuilderModelAjax extends ListModel
return ['page' => $page];
}
return $this->getTokenFromVDM();
return $this->getTokenForWiki();
}
protected function getTokenFromVDM($message = null)
protected function getTokenForWiki($message = null)
{
if ($message)
{
@ -333,7 +333,94 @@ class ComponentbuilderModelAjax extends ListModel
}
return ['error' => JText::_('COM_COMPONENTBUILDER_THE_WIKI_CAN_ONLY_BE_LOADED_WHEN_YOUR_JCB_SYSTEM_HAS_INTERNET_CONNECTION')];
}
}
public function getVersion($version = null)
{
// get the token if set
$token = JComponentHelper::getParams('com_componentbuilder')->get('gitea_token', false);
// only add if token is set
if ($token)
{
// setup a registry
$options = new Registry;
$options->set('access.token', $token);
// get the gitea http
try
{
// get gitea object
$gitea = new Gitea($options);
// get a list of all the repos tags
$tags = $gitea->repo->getListTags('joomla', 'Component-Builder');
}
catch (DomainException $e)
{
return $this->getTokenForVersion($e->getMessage());
}
catch (InvalidArgumentException $e)
{
return $this->getTokenForVersion($e->getMessage());
}
catch (Exception $e)
{
return $this->getTokenForVersion($e->getMessage());
}
// do we have tags returned
if (isset($tags[0]) && isset($tags[0]->name))
{
// get the version
$manifest = ComponentbuilderHelper::manifest();
$local_version = (string) $manifest->version;
$current_version = trim($tags[0]->name, 'vV');
// now check if this version is out dated
if ($current_version === $local_version)
{
return ['notice' => '<small><span style="color:green;"><span class="icon-shield"></span>' . JText::_('COM_COMPONENTBUILDER_UP_TO_DATE') . '</span></small>'];
}
else
{
// check if this is beta version
$current_array = array_map(function ($v) { return (int) $v; }, (array) explode('.', $current_version));
$local_array = array_map(function ($v) { return (int) $v; }, (array) explode('.', $local_version));
if (($local_array[0] > $current_array[0]) ||
($local_array[0] == $current_array[0] && $local_array[1] > $current_array[1]) ||
($local_array[0] == $current_array[0] && $local_array[1] == $current_array[1] && $local_array[2] > $current_array[2]))
{
return ['notice' => '<small><span style="color:#F7B033;"><span class="icon-wrench"></span>' . JText::_('COM_COMPONENTBUILDER_BETA_RELEASE') . '</span></small>'];
}
else
{
// download link of the latest version
$download = "https://git.vdm.dev/api/v1/repos/joomla/pkg-component-builder/archive/" . $tags[0]->name . ".zip?access_token=" . $token;
return ['notice' => '<small><span style="color:red;"><span class="icon-warning-circle"></span>' . JText::_('COM_COMPONENTBUILDER_OUT_OF_DATE') . '!</span> <a style="color:green;" href="' .
$download . '" title="' . JText::_('COM_COMPONENTBUILDER_YOU_CAN_DIRECTLY_DOWNLOAD_THE_LATEST_UPDATE_OR_USE_THE_JOOMLA_UPDATE_AREA') . '">' . JText::_('COM_COMPONENTBUILDER_DOWNLOAD_UPDATE') . '!</a></small>'];
}
}
}
}
return $this->getTokenForVersion();
}
protected function getTokenForVersion($message = null)
{
// the URL
$url = 'https://git.vdm.dev/user/settings/applications';
// create link
$a = '<small><a style="color:#F7B033;" href="' . $url . '" title="';
$a_ = '">';
$_a = '</a></small>';
if ($message)
{
return ['error' => $a . $message . $a_ . JText::_('COM_COMPONENTBUILDER_GET_TOKEN') . $_a];
}
return ['error' => $a . JText::_('COM_COMPONENTBUILDER_GET_TOKEN_FROM_VDM_TO_GET_UPDATE_NOTICE_AND_ADD_IT_TO_YOUR_GLOBAL_OPTIONS') . $a_ . JText::_('COM_COMPONENTBUILDER_GET_TOKEN') . $_a];
}
// Used in joomla_module
public function getModuleCode($data)

View File

@ -416,90 +416,26 @@ class ComponentbuilderModelComponentbuilder extends ListModel
$call_url = JUri::base() . 'index.php?option=com_componentbuilder&task=ajax.getWiki&format=json&raw=true&' . JSession::getFormToken() . '=1&name=Home';
$document = JFactory::getDocument();
$document->addScriptDeclaration('
fetch("' . $call_url . '").then((response) => {
if (response.ok) {
return response.json();
}
}).then((result) => {
if (typeof result.page !== "undefined") {
document.getElementById("wiki-md").innerHTML = result.page;
} else if (typeof result.error !== "undefined") {
document.getElementById("wiki-md-error").innerHTML = result.error
}
});');
function getWikiPage(){
fetch("' . $call_url . '").then((response) => {
if (response.ok) {
return response.json();
}
}).then((result) => {
if (typeof result.page !== "undefined") {
document.getElementById("wiki-md").innerHTML = result.page;
} else if (typeof result.error !== "undefined") {
document.getElementById("wiki-md-error").innerHTML = result.error
}
});
}
setTimeout(getWikiPage, 1000);');
return '<div id="wiki-md"><small>'.JText::_('COM_COMPONENTBUILDER_THE_WIKI_IS_LOADING').'.<span class="loading-dots">.</span></small></div><div id="wiki-md-error" style="color: red"></div>';
}
public function getGitea()
{
// get the document
$document = JFactory::getDocument();
// get the token if set
$token = JComponentHelper::getParams('com_componentbuilder')->get('gitea_token', false);
// only add if token is set
if ($token)
{
// setup a registry
$options = new Registry;
$options->set('access.token', $token);
// get the gitea http
try
{
// get gitea object
$gitea = new Gitea($options);
// get a list of all the repos tags
$tags = $gitea->repo->getListTags('joomla', 'Component-Builder');
}
catch (DomainException $m)
{
$token = false;
}
// get the document to load the scripts
if ($token && isset($tags[0]) && isset($tags[0]->name))
{
// download link of the latest version
$download = "https://git.vdm.dev/api/v1/repos/joomla/Component-Builder/archive/" . $tags[0]->name . ".zip?access_token=" . $token;
// load the JavaScript to the page
$document->addScriptDeclaration('
jQuery(document).ready(function () {
var activeVersion = "' . trim($tags[0]->name, 'vV') . '";
if (activeVersion === manifest.version) {
// local version is in sync with latest release
jQuery(".update-notice").html("<small><span style=\'color:green;\'><span class=\'icon-shield\'></span>' . JText::_('COM_COMPONENTBUILDER_UP_TO_DATE') . '</span></small>");
} else {
// split versions in to array
var activeVersionArray = activeVersion.split(".");
var localVersionArray = manifest.version.split(".");
if ((+localVersionArray[0] > +activeVersionArray[0]) ||
(+localVersionArray[0] == +activeVersionArray[0] && +localVersionArray[1] > +activeVersionArray[1]) ||
(+localVersionArray[0] == +activeVersionArray[0] && +localVersionArray[1] == +activeVersionArray[1] && +localVersionArray[2] > +activeVersionArray[2])) {
// local version head latest release
jQuery(".update-notice").html("<small><span style=\'color:#F7B033;\'><span class=\'icon-wrench\'></span>' . JText::_('COM_COMPONENTBUILDER_BETA_RELEASE') . '</span></small>");
} else {
// local version behind latest release
jQuery(".update-notice").html("<small><span style=\'color:red;\'><span class=\'icon-warning-circle\'></span>' . JText::_('COM_COMPONENTBUILDER_OUT_OF_DATE') . '</span> <a style=\'color:green;\' href=\'' .
$download . '\' title=\'' . JText::_('COM_COMPONENTBUILDER_YOU_CAN_DIRECTLY_DOWNLOAD_THE_LATEST_UPDATE_OR_USE_THE_JOOMLA_UPDATE_AREA') . '\'>' .
JText::_('COM_COMPONENTBUILDER_DOWNLOAD_UPDATE') . '!</a></small>");
}
}
});');
return;
}
}
// the URL
$url = 'https://git.vdm.dev/user/settings/applications';
// give a notice to get the token
$document->addScriptDeclaration(
'jQuery(document).ready(function () {jQuery(".update-notice").html("<small><a style=\'color:#F7B033;\' href=\'' .
$url . '\' title=\'' . JText::_('COM_COMPONENTBUILDER_GET_TOKEN_FROM_VDM_FOR_UPDATES_AND_ADD_IT_TO_YOUR_GLOBAL_OPTIONS') . '\'>' .
JText::_('COM_COMPONENTBUILDER_GET_TOKEN') . '!</a></small>");});'
);
}
public function getNoticeboard()
{
// get the document to load the scripts
@ -590,5 +526,28 @@ jQuery(document).ready( function($) {
});');
return '<div id="readme-md"><small>'.JText::_('COM_COMPONENTBUILDER_THE_README_IS_LOADING').'.<span class="loading-dots">.</span></small></div>';
}
}
public function getVersion()
{
// the call URL
$call_url = JUri::base() . 'index.php?option=com_componentbuilder&task=ajax.getVersion&format=json&raw=true&' . JSession::getFormToken() . '=1&version=1';
$document = JFactory::getDocument();
$document->addScriptDeclaration('
function getComponentVersionStatus() {
fetch("' . $call_url . '").then((response) => {
if (response.ok) {
return response.json();
}
}).then((result) => {
if (typeof result.notice !== "undefined") {
document.getElementById("component-update-notice").innerHTML = result.notice;
} else if (typeof result.error !== "undefined") {
document.getElementById("component-update-notice").innerHTML = result.error;
}
});
}
setTimeout(getComponentVersionStatus, 800);');
}
}

File diff suppressed because one or more lines are too long

View File

@ -38,58 +38,50 @@ defined('_JEXEC') or die('Restricted access');
</div>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php echo JHtml::_('bootstrap.addTab', 'cpanel_tab', 'wiki', JText::_('Wiki', true)); ?>
<?php echo JHtml::_('bootstrap.addTab', 'cpanel_tab', 'wiki', JText::_('COM_COMPONENTBUILDER_WIKI', true)); ?>
<div class="row-fluid">
<div class="span12">
<div class="span10">
<?php echo JHtml::_('bootstrap.startAccordion', 'wiki_accordian', array('active' => 'wiki_one')); ?>
<?php echo JHtml::_('bootstrap.addSlide', 'wiki_accordian', 'Tutorials', 'wiki_one'); ?>
<?php echo $this->loadTemplate('wiki_tutorials');?>
<?php echo JHtml::_('bootstrap.endSlide'); ?>
<?php echo JHtml::_('bootstrap.endAccordion'); ?>
</div>
<div class="span2">
<?php echo ComponentbuilderHelper::getDynamicContent('banner', '160-600'); ?>
</div>
</div>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php echo JHtml::_('bootstrap.addTab', 'cpanel_tab', 'notice_board', JText::_('Notice Board', true)); ?>
<?php echo JHtml::_('bootstrap.addTab', 'cpanel_tab', 'notice_board', JText::_('COM_COMPONENTBUILDER_NOTICE_BOARD', true)); ?>
<div class="row-fluid">
<div class="span12">
<div class="span10">
<?php echo JHtml::_('bootstrap.startAccordion', 'notice_board_accordian', array('active' => 'notice_board_one')); ?>
<?php echo JHtml::_('bootstrap.addSlide', 'notice_board_accordian', 'Vast Development Method', 'notice_board_one'); ?>
<?php echo $this->loadTemplate('notice_board_vast_development_method');?>
<?php echo JHtml::_('bootstrap.endSlide'); ?>
<?php echo JHtml::_('bootstrap.endAccordion'); ?>
</div>
<div class="span2">
<?php echo ComponentbuilderHelper::getDynamicContent('banner', '160-600'); ?>
</div>
</div>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php echo JHtml::_('bootstrap.addTab', 'cpanel_tab', 'readme', JText::_('Readme', true)); ?>
<?php echo JHtml::_('bootstrap.addTab', 'cpanel_tab', 'readme', JText::_('COM_COMPONENTBUILDER_README', true)); ?>
<div class="row-fluid">
<div class="span12">
<div class="span10">
<?php echo JHtml::_('bootstrap.startAccordion', 'readme_accordian', array('active' => 'readme_one')); ?>
<?php echo JHtml::_('bootstrap.addSlide', 'readme_accordian', 'Information', 'readme_one'); ?>
<?php echo $this->loadTemplate('readme_information');?>
<?php echo JHtml::_('bootstrap.endSlide'); ?>
<?php echo JHtml::_('bootstrap.endAccordion'); ?>
</div>
</div>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php echo JHtml::_('bootstrap.addTab', 'cpanel_tab', 'notice_board', JText::_('COM_COMPONENTBUILDER_NOTICE_BOARD', true)); ?>
<div class="row-fluid">
<div class="span10">
<?php echo JHtml::_('bootstrap.startAccordion', 'notice_board_accordian', array('active' => 'notice_board_one')); ?>
<?php echo JHtml::_('bootstrap.addSlide', 'notice_board_accordian', 'Vast Development Method', 'notice_board_one'); ?>
<?php echo $this->loadTemplate('notice_board_vast_development_method');?>
<?php echo JHtml::_('bootstrap.endSlide'); ?>
<?php echo JHtml::_('bootstrap.addSlide', 'notice_board_accordian', 'JCB Pro Membership', 'notice_board_two'); ?>
<?php echo $this->loadTemplate('notice_board_jcb_pro_membership');?>
<?php echo JHtml::_('bootstrap.endSlide'); ?>
<?php echo JHtml::_('bootstrap.endAccordion'); ?>
</div>
<div class="span2">
<?php echo ComponentbuilderHelper::getDynamicContent('banner', '160-600'); ?>
</div>
</div>
</div>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php echo JHtml::_('bootstrap.endTabSet'); ?>

View File

@ -15,7 +15,7 @@ defined('_JEXEC') or die('Restricted access');
?>
<img alt="<?php echo JText::_('COM_COMPONENTBUILDER'); ?>" src="components/com_componentbuilder/assets/images/vdm-component.jpg">
<ul class="list-striped">
<li><b><?php echo JText::_('COM_COMPONENTBUILDER_VERSION'); ?>:</b> <?php echo $this->manifest->version; ?>&nbsp;&nbsp;<span class="update-notice"></span></li>
<li><b><?php echo JText::_('COM_COMPONENTBUILDER_VERSION'); ?>:</b> <?php echo $this->manifest->version; ?>&nbsp;&nbsp;<span class="update-notice" id="component-update-notice"></span></li>
<li><b><?php echo JText::_('COM_COMPONENTBUILDER_DATE'); ?>:</b> <?php echo $this->manifest->creationDate; ?></li>
<li><b><?php echo JText::_('COM_COMPONENTBUILDER_AUTHOR'); ?>:</b> <a href="mailto:<?php echo $this->manifest->authorEmail; ?>"><?php echo $this->manifest->author; ?></a></li>
<li><b><?php echo JText::_('COM_COMPONENTBUILDER_WEBSITE'); ?>:</b> <a href="<?php echo $this->manifest->authorUrl; ?>" target="_blank"><?php echo $this->manifest->authorUrl; ?></a></li>

View File

@ -29,9 +29,9 @@ class ComponentbuilderViewComponentbuilder extends JViewLegacy
$this->icons = $this->get('Icons');
$this->contributors = ComponentbuilderHelper::getContributors();
$this->wiki = $this->get('Wiki');
$this->gitea = $this->get('Gitea');
$this->noticeboard = $this->get('Noticeboard');
$this->readme = $this->get('Readme');
$this->version = $this->get('Version');
// get the manifest details of the component
$this->manifest = ComponentbuilderHelper::manifest();

View File

@ -1,15 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="4" method="upgrade">
<name>COM_COMPONENTBUILDER</name>
<creationDate>9th July, 2022</creationDate>
<creationDate>20th August, 2022</creationDate>
<author>Llewellyn van der Merwe</author>
<authorEmail>joomla@vdm.io</authorEmail>
<authorUrl>https://dev.vdm.io</authorUrl>
<copyright>Copyright (C) 2015 Vast Development Method. All rights reserved.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<version>3.1.2</version>
<version>3.1.5</version>
<description><![CDATA[
<h1>Component Builder (v.3.1.2)</h1>
<h1>Component Builder (v.3.1.5)</h1>
<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.
@ -120,6 +120,6 @@ Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/compo
</administration>
<updateservers>
<server type="extension" enabled="1" element="com_componentbuilder" name="Component Builder">https://git.vdm.dev/joomla/Component-Builder/raw/branch/staging/componentbuilder_update_server.xml</server>
<server type="extension" enabled="1" element="com_componentbuilder" name="Component Builder">https://git.vdm.dev/joomla/Component-Builder/raw/branch/master/componentbuilder_update_server.xml</server>
</updateservers>
</extension>

View File

@ -1079,10 +1079,10 @@
<element>pkg_component_builder</element>
<type>package</type>
<client>site</client>
<version>3.1.2</version>
<version>3.1.5</version>
<infourl title="Component Builder!">https://dev.vdm.io</infourl>
<downloads>
<downloadurl type="full" format="zip">https://git.vdm.dev/api/v1/repos/joomla/pkg-component-builder/archive/v3.1.2.zip</downloadurl>
<downloadurl type="full" format="zip">https://git.vdm.dev/api/v1/repos/joomla/pkg-component-builder/archive/v3.1.5.zip</downloadurl>
</downloads>
<tags>
<tag>stable</tag>

View File

@ -0,0 +1,394 @@
<?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\Extension;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\StringHelper;
use VDM\Joomla\Componentbuilder\Line;
use VDM\Joomla\Componentbuilder\Tab;
/**
* Loading the Extension Installation Script Class
*
* @since 3.1.5
*/
class InstallScript
{
/**
* The Line numbering Methods
*
* @since 3.1.5
*/
use Line;
/**
* The Tab Adding Method
*
* @since 3.1.5
*/
use Tab;
/**
* The extension
*
* @var object
* @since 3.1.5
*/
protected object $extension;
/**
* The methods
*
* @var array
* @since 3.1.5
*/
protected array $methods = ['php_script', 'php_preflight', 'php_postflight', 'php_method'];
/**
* The types
*
* @var array
* @since 3.1.5
*/
protected array $types = ['construct', 'install', 'update', 'uninstall', 'discover_install'];
/**
* The construct bucket
*
* @var array
* @since 3.1.5
*/
protected array $construct = [];
/**
* The install bucket
*
* @var array
* @since 3.1.5
*/
protected array $install = [];
/**
* The update bucket
*
* @var array
* @since 3.1.5
*/
protected array $update = [];
/**
* The uninstall bucket
*
* @var array
* @since 3.1.5
*/
protected array $uninstall = [];
/**
* The preflight switch
*
* @var bool
* @since 3.1.5
*/
protected bool $preflightActive = false;
/**
* The preflight bucket
*
* @var array
* @since 3.1.5
*/
protected array $preflightBucket = ['install' => [], 'uninstall' => [], 'discover_install' => [], 'update' => []];
/**
* The postflight switch
*
* @var bool
* @since 3.1.5
*/
protected bool $postflightActive = false;
/**
* The postflight bucket
*
* @var array
* @since 3.1.5
*/
protected array $postflightBucket = ['install' => [], 'uninstall' => [], 'discover_install' => [], 'update' => []];
/**
* Constructor
* @since 3.1.5
*/
public function __construct(object $extension, ?array $config = null)
{
// check if we have the debug switch TODO - move to global registry - singleton
if (isset($config['debug']))
{
$this->debug = $config['debug'];
}
// loop over methods and types
foreach ($this->methods as $method)
{
foreach ($this->types as $type)
{
if (isset($extension->{'add_' . $method . '_' . $type})
&& $extension->{'add_' . $method . '_' . $type} == 1
&& StringHelper::check(
$extension->{$method . '_' . $type}
))
{
// add to the main methods
if ('php_method' === $method || 'php_script' === $method)
{
$this->{$type}[] = $extension->{$method . '_' . $type};
}
else
{
// get the flight key
$flight = str_replace('php_', '', $method);
// load the script to our bucket
$this->{$flight . 'Bucket'}[$type][] = $extension->{$method . '_' . $type};
// show that the method is active
$this->{$flight . 'Active'} = true;
}
}
}
}
$this->extension = $extension;
}
/**
* get install script
*
* @return string
* @since 3.1.5
*/
public function get(): string
{
// return the class
return $this->build();
}
/**
* build the install class
*
* @return string
* @since 3.1.5
*/
protected function build(): string
{
// start build
$script = $this->head();
// load constructor if set
$script .= $this->construct();
// load install method if set
$script .= $this->main('install');
// load update method if set
$script .= $this->main('update');
// load uninstall method if set
$script .= $this->main('uninstall');
// load preflight method if set
$script .= $this->flight('preflight');
// load postflight method if set
$script .= $this->flight('postflight');
// close the class
$script .= PHP_EOL . '}' . PHP_EOL;
return $script;
}
/**
* get install script head
*
* @return string
* @since 3.1.5
*/
protected function head(): string
{
// get the extension
$extension = $this->extension;
// start build
$script = PHP_EOL . '/**';
$script .= PHP_EOL . ' * ' . $extension->official_name
. ' script file.';
$script .= PHP_EOL . ' *';
$script .= PHP_EOL . ' * @package ' . $extension->class_name;
$script .= PHP_EOL . ' */';
$script .= PHP_EOL . 'class ' . $extension->installer_class_name;
$script .= PHP_EOL . '{';
return $script;
}
/**
* get constructor
*
* @return string
* @since 3.1.5
*/
protected function construct(): string
{
// return empty string if not set
if (!ArrayHelper::check($this->construct))
{
return '';
}
// the __construct script
$script = PHP_EOL . PHP_EOL . $this->_t(1) . '/**';
$script .= PHP_EOL . $this->_t(1) . ' * Constructor';
$script .= PHP_EOL . $this->_t(1) . ' *';
$script .= PHP_EOL . $this->_t(1)
. ' * @param Joomla\CMS\Installer\InstallerAdapter $adapter The object responsible for running this script';
$script .= PHP_EOL . $this->_t(1) . ' */';
$script .= PHP_EOL . $this->_t(1)
. 'public function __construct($adapter)';
$script .= PHP_EOL . $this->_t(1) . '{';
$script .= PHP_EOL . implode(PHP_EOL . PHP_EOL, $this->construct);
// close the function
$script .= PHP_EOL . $this->_t(1) . '}';
return $script;
}
/**
* build main methods
*
* @param string $name the method being called
*
* @return string
* @since 3.1.5
*/
protected function main(string $name): string
{
// return empty string if not set
if (!ArrayHelper::check($this->{$name}))
{
return '';
}
// load the install method
$script = PHP_EOL . PHP_EOL . $this->_t(1) . '/**';
$script .= PHP_EOL . $this->_t(1) . " * Called on $name";
$script .= PHP_EOL . $this->_t(1) . ' *';
$script .= PHP_EOL . $this->_t(1)
. ' * @param Joomla\CMS\Installer\InstallerAdapter $adapter The object responsible for running this script';
$script .= PHP_EOL . $this->_t(1) . ' *';
$script .= PHP_EOL . $this->_t(1)
. ' * @return boolean True on success';
$script .= PHP_EOL . $this->_t(1) . ' */';
$script .= PHP_EOL . $this->_t(1) . 'public function '
. $name . '($adapter)';
$script .= PHP_EOL . $this->_t(1) . '{';
$script .= PHP_EOL . implode(PHP_EOL . PHP_EOL, $this->{$name});
// return true
if ('uninstall' !== $name)
{
$script .= PHP_EOL . $this->_t(2) . 'return true;';
}
// close the function
$script .= PHP_EOL . $this->_t(1) . '}';
return $script;
}
/**
* build flight methods
*
* @param string $name the method being called
*
* @return string
* @since 3.1.5
*/
protected function flight(string $name): string
{
// return empty string if not set
if (empty($this->{$name . 'Active'}))
{
return '';
}
// the pre/post function types
$script = PHP_EOL . PHP_EOL . $this->_t(1) . '/**';
$script .= PHP_EOL . $this->_t(1)
. ' * Called before any type of action';
$script .= PHP_EOL . $this->_t(1) . ' *';
$script .= PHP_EOL . $this->_t(1)
. ' * @param string $route Which action is happening (install|uninstall|discover_install|update)';
$script .= PHP_EOL . $this->_t(1)
. ' * @param Joomla\CMS\Installer\InstallerAdapter $adapter The object responsible for running this script';
$script .= PHP_EOL . $this->_t(1) . ' *';
$script .= PHP_EOL . $this->_t(1)
. ' * @return boolean True on success';
$script .= PHP_EOL . $this->_t(1) . ' */';
$script .= PHP_EOL . $this->_t(1) . 'public function '
. $name . '($route, $adapter)';
$script .= PHP_EOL . $this->_t(1) . '{';
$script .= PHP_EOL . $this->_t(2) . '//' . $this->setLine(
__LINE__
) . ' get application';
$script .= PHP_EOL . $this->_t(2)
. '$app = JFactory::getApplication();' . PHP_EOL;
// add the default version check (TODO) must make this dynamic
if ('preflight' === $name)
{
$script .= PHP_EOL . $this->_t(2) . '//' . $this->setLine(
__LINE__
) . ' the default for both install and update';
$script .= PHP_EOL . $this->_t(2)
. '$jversion = new JVersion();';
$script .= PHP_EOL . $this->_t(2)
. "if (!\$jversion->isCompatible('3.8.0'))";
$script .= PHP_EOL . $this->_t(2) . '{';
$script .= PHP_EOL . $this->_t(3)
. "\$app->enqueueMessage('Please upgrade to at least Joomla! 3.8.0 before continuing!', 'error');";
$script .= PHP_EOL . $this->_t(3) . 'return false;';
$script .= PHP_EOL . $this->_t(2) . '}' . PHP_EOL;
}
// now add the scripts
foreach ($this->{$name . 'Bucket'} as $route => $_script)
{
if (ArrayHelper::check($_script))
{
// set the if and script
$script .= PHP_EOL . $this->_t(2) . "if ('" . $route
. "' === \$route)";
$script .= PHP_EOL . $this->_t(2) . '{';
$script .= PHP_EOL . implode(
PHP_EOL . PHP_EOL, $_script
);
$script .= PHP_EOL . $this->_t(2) . '}' . PHP_EOL;
}
}
// return true
$script .= PHP_EOL . $this->_t(2) . 'return true;';
// close the function
$script .= PHP_EOL . $this->_t(1) . '}';
return $script;
}
}

View File

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

View File

@ -0,0 +1,48 @@
<?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;
/**
* Add line comment
*
* @since 3.1.5
*/
trait Line
{
/**
* The debug switch
*
* @var bool
* @since 3.1.5
*/
protected bool $debug = false;
/**
* Set the line number in comments
*
* @param int $nr The line number
*
* @return string
* @since 3.1.5
*/
private function setLine(int $nr): string
{
if ($this->debug)
{
return ' [' . get_called_class() . ' ' . $nr . ']';
}
return '';
}
}

View File

@ -0,0 +1,58 @@
<?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;
/**
* Adds Tabs
*
* @since 3.1.5
*/
trait Tab
{
/**
* Tab/spacer bucket (to speed-up the build)
*
* @var array
* @since 3.1.5
*/
protected $tabSpacerBucket = array();
/**
* Set tab/spacer
*
* @var string
* @since 3.1.5
*/
protected $tabSpacer = "\t";
/**
* Set the tab/space
*
* @param int $nr The number of tag/space
*
* @return string
* @since 3.1.5
*/
public function _t(int $nr) : string
{
// check if we already have the string
if (!isset($this->tabSpacerBucket[$nr]))
{
// get the string
$this->tabSpacerBucket[$nr] = str_repeat($this->tabSpacer, (int) $nr);
}
// return stored string
return $this->tabSpacerBucket[$nr];
}
}

View File

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

View File

@ -9422,7 +9422,7 @@ class com_componentbuilderInstallerScript
echo '<a target="_blank" href="https://dev.vdm.io" title="Component Builder">
<img src="components/com_componentbuilder/assets/images/vdm-component.jpg"/>
</a>
<h3>Upgrade to Version 3.1.2 Was Successful! Let us know if anything is not working as expected.</h3>';
<h3>Upgrade to Version 3.1.5 Was Successful! Let us know if anything is not working as expected.</h3>';
// Set db if not set already.
if (!isset($db))