Release of v3.2.4-alpha4
Fix database default fields to allow NULL. #1169. Fix the power list field to allow search. #1167. Remove Demo component from JCB v3 and added Hello Word component as demo in JCB v3.
This commit is contained in:
parent
6c2f52f59f
commit
5a1ad16c9e
10
CHANGELOG.md
10
CHANGELOG.md
@ -1,13 +1,17 @@
|
||||
# v3.2.4-alpha3
|
||||
# v3.2.4-alpha4
|
||||
|
||||
- Fix usergrouplist compiler triggers. #1100
|
||||
- Fix database default fields to allow NULL. #1169
|
||||
- Fix the power list field to allow search. #1167
|
||||
- Remove Demo component from JCB v3 and added Hello Word component as demo in JCB v3.
|
||||
|
||||
# v3.2.4-alpha
|
||||
|
||||
- Add push option to powers area
|
||||
- Fix library save as copy error. #1162
|
||||
- Fix the error when no components exists. #1164
|
||||
- Fix search page error due to File class.
|
||||
- Fix search page error due to File class.
|
||||
- Fix usergrouplist compiler triggers. #1100
|
||||
- Add field type power integration [init, reset, push]
|
||||
|
||||
# v3.2.3
|
||||
|
||||
|
12
README.md
12
README.md
@ -9,7 +9,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 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.2.4-alpha3) 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.2.4-alpha4) 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)
|
||||
|
||||
@ -144,14 +144,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*: 23rd August, 2024
|
||||
+ *Version*: 3.2.4-alpha3
|
||||
+ *Last Build*: 18th September, 2024
|
||||
+ *Version*: 3.2.4-alpha4
|
||||
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
|
||||
+ *Line count*: **840006**
|
||||
+ *Line count*: **848150**
|
||||
+ *Field count*: **2098**
|
||||
+ *File count*: **5722**
|
||||
+ *Folder count*: **500**
|
||||
+ *File count*: **5778**
|
||||
+ *Folder count*: **505**
|
||||
|
||||
> This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](https://www.joomlacomponentbuilder.com).
|
||||
> Developed by [Llewellyn van der Merwe](mailto:joomla@vdm.io)
|
||||
|
@ -9,7 +9,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 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.2.4-alpha3) 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.2.4-alpha4) 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)
|
||||
|
||||
@ -144,14 +144,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*: 23rd August, 2024
|
||||
+ *Version*: 3.2.4-alpha3
|
||||
+ *Last Build*: 18th September, 2024
|
||||
+ *Version*: 3.2.4-alpha4
|
||||
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
|
||||
+ *Line count*: **840006**
|
||||
+ *Line count*: **848150**
|
||||
+ *Field count*: **2098**
|
||||
+ *File count*: **5722**
|
||||
+ *Folder count*: **500**
|
||||
+ *File count*: **5778**
|
||||
+ *Folder count*: **505**
|
||||
|
||||
> This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](https://www.joomlacomponentbuilder.com).
|
||||
> Developed by [Llewellyn van der Merwe](mailto:joomla@vdm.io)
|
||||
|
@ -52,7 +52,23 @@ class ###View###Controller extends FormController
|
||||
* @var string
|
||||
* @since 1.6
|
||||
*/
|
||||
protected $view_list = '###views###';###ADMIN_CUSTOM_BUTTONS_CONTROLLER###
|
||||
protected $view_list = '###views###';
|
||||
|
||||
/**
|
||||
* Referral value
|
||||
*
|
||||
* @var string
|
||||
* @since 5.0
|
||||
*/
|
||||
protected string $ref;
|
||||
|
||||
/**
|
||||
* Referral ID value
|
||||
*
|
||||
* @var int
|
||||
* @since 5.0
|
||||
*/
|
||||
protected int $refid;###ADMIN_CUSTOM_BUTTONS_CONTROLLER###
|
||||
|
||||
/**
|
||||
* Method override to check if you can add a new record.
|
||||
|
@ -94,18 +94,23 @@ class ComponentbuilderControllerFieldtype extends FormController
|
||||
}
|
||||
elseif($user->authorise('fieldtype.reset', 'com_componentbuilder'))
|
||||
{
|
||||
if (FieldtypeFactory::_('Joomla.Fieldtype.Remote.Get')->reset([$guid]))
|
||||
{
|
||||
// set success message
|
||||
$message = '<h1>'.Text::_('COM_COMPONENTBUILDER_SUCCESS').'</h1>';
|
||||
$message .= '<p>'.Text::_('COM_COMPONENTBUILDER_THE_JOOMLA_FIELD_TYPE_HAS_SUCCESSFULLY_BEEN_RESET').'</p>';
|
||||
$status = 'success';
|
||||
$success = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
try {
|
||||
if (FieldtypeFactory::_('Joomla.Fieldtype.Remote.Get')->reset([$guid]))
|
||||
{
|
||||
// set success message
|
||||
$message = '<h1>'.Text::_('COM_COMPONENTBUILDER_SUCCESS').'</h1>';
|
||||
$message .= '<p>'.Text::_('COM_COMPONENTBUILDER_THE_JOOMLA_FIELD_TYPE_HAS_SUCCESSFULLY_BEEN_RESET').'</p>';
|
||||
$status = 'success';
|
||||
$success = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_RESET_FAILED') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THE_RESET_OF_THIS_JOOMLA_FIELD_TYPE_HAS_FAILED') . '</p>';
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_RESET_FAILED') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THE_RESET_OF_THIS_JOOMLA_FIELD_TYPE_HAS_FAILED') . '</p>';
|
||||
$message .= '<p>' . \htmlspecialchars($e->getMessage()) . '</p>';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -94,18 +94,23 @@ class ComponentbuilderControllerJoomla_power extends FormController
|
||||
}
|
||||
elseif($user->authorise('joomla_power.reset', 'com_componentbuilder'))
|
||||
{
|
||||
if (JoomlaPowerFactory::_('Joomla.Power.Remote.Get')->reset([$guid]))
|
||||
{
|
||||
// set success message
|
||||
$message = '<h1>'.Text::_('COM_COMPONENTBUILDER_SUCCESS').'</h1>';
|
||||
$message .= '<p>'.Text::_('COM_COMPONENTBUILDER_THE_JOOMLA_POWER_HAS_SUCCESSFULLY_BEEN_RESET').'</p>';
|
||||
$status = 'success';
|
||||
$success = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
try {
|
||||
if (JoomlaPowerFactory::_('Joomla.Power.Remote.Get')->reset([$guid]))
|
||||
{
|
||||
// set success message
|
||||
$message = '<h1>'.Text::_('COM_COMPONENTBUILDER_SUCCESS').'</h1>';
|
||||
$message .= '<p>'.Text::_('COM_COMPONENTBUILDER_THE_JOOMLA_POWER_HAS_SUCCESSFULLY_BEEN_RESET').'</p>';
|
||||
$status = 'success';
|
||||
$success = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_RESET_FAILED') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THE_RESET_OF_THIS_JOOMLA_POWER_HAS_FAILED') . '</p>';
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_RESET_FAILED') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THE_RESET_OF_THIS_JOOMLA_POWER_HAS_FAILED') . '</p>';
|
||||
$message .= '<p>' . \htmlspecialchars($e->getMessage()) . '</p>';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -94,18 +94,23 @@ class ComponentbuilderControllerPower extends FormController
|
||||
}
|
||||
elseif($user->authorise('power.reset', 'com_componentbuilder'))
|
||||
{
|
||||
if (PowerFactory::_('Power.Remote.Get')->reset([$guid]))
|
||||
{
|
||||
// set success message
|
||||
$message = '<h1>'.Text::_('COM_COMPONENTBUILDER_SUCCESS').'</h1>';
|
||||
$message .= '<p>'.Text::_('COM_COMPONENTBUILDER_THE_POWER_HAS_SUCCESSFULLY_BEEN_RESET').'</p>';
|
||||
$status = 'success';
|
||||
$success = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
try {
|
||||
if (PowerFactory::_('Power.Remote.Get')->reset([$guid]))
|
||||
{
|
||||
// set success message
|
||||
$message = '<h1>'.Text::_('COM_COMPONENTBUILDER_SUCCESS').'</h1>';
|
||||
$message .= '<p>'.Text::_('COM_COMPONENTBUILDER_THE_POWER_HAS_SUCCESSFULLY_BEEN_RESET').'</p>';
|
||||
$status = 'success';
|
||||
$success = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_RESET_FAILED') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THE_RESET_OF_THIS_POWER_HAS_FAILED') . '</p>';
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_RESET_FAILED') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THE_RESET_OF_THIS_POWER_HAS_FAILED') . '</p>';
|
||||
$message .= '<p>' . \htmlspecialchars($e->getMessage()) . '</p>';
|
||||
}
|
||||
}
|
||||
|
||||
|
16
admin/custom/dynamicDownloadController.php
Normal file
16
admin/custom/dynamicDownloadController.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @version 2.0.0 - September 03, 2014
|
||||
* @package Component Builder
|
||||
* @author Llewellyn van de Merwe <http://www.vdm.io>
|
||||
* @copyright Copyright (C) 2014. All Rights Reserved
|
||||
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
*
|
||||
**/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
?>
|
||||
###BOM###
|
||||
[CUSTOMCODE=dynamicDownloadController]
|
@ -5416,7 +5416,6 @@ abstract class ComponentbuilderHelper
|
||||
$d = DateTime::createFromFormat($format, $date);
|
||||
return $d && $d->format($format) == $date;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The subform layouts
|
||||
|
@ -1360,6 +1360,7 @@ COM_COMPONENTBUILDER_BULK_UPDATE_ALL_DIVERGED_SNIPPETS="Bulk Update All Diverged
|
||||
COM_COMPONENTBUILDER_BULK_UPDATE_ALL_OUT_DATED_SNIPPETS="Bulk Update All Out Dated Snippets"
|
||||
COM_COMPONENTBUILDER_BUTTON_TO_CREATE_S_WILL_SHOW_ONCE_S_IS_SAVED_FOR_THE_FIRST_TIME="Button to create %s will show once %s is saved for the first time."
|
||||
COM_COMPONENTBUILDER_CANCEL="Cancel"
|
||||
COM_COMPONENTBUILDER_CAN_NOT_SAVE_USER_WITHOUT_EMAIL_VALUE="Can not save user without email value."
|
||||
COM_COMPONENTBUILDER_CHAIN="Chain"
|
||||
COM_COMPONENTBUILDER_CHECK_YOUR_OWNER_DETAILS_IT_HAS_NOT_BEEN_SET_OPEN_THE_JCB_GLOBAL_OPTIONS_GO_TO_THE_COMPANY_TAB_AND_ADD_THE_CORRECT_COMPANY_DETAILS_THERE="Check your owner details, it has not been set. Open the JCB Global Options, go to the Company tab and add the correct company details there."
|
||||
COM_COMPONENTBUILDER_CLASS_EXTENDINGS="Class Extendings"
|
||||
@ -5866,7 +5867,7 @@ COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PUBLISHING="Publishing"
|
||||
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_README="Readme"
|
||||
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_README_LABEL="README.md"
|
||||
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_REMOVE_LINE_BREAKS_DESCRIPTION="Should we remove all line breaks ("\r", "\n") from all language strings in this component."
|
||||
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_REMOVE_LINE_BREAKS_LABEL="Remove line breaks<br /><small>from language strings</small>"
|
||||
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_REMOVE_LINE_BREAKS_LABEL="Remove line breaks<br /><small>from language strings<br>This switch will be removed since it must always be true for J4+.</small>"
|
||||
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_SALES_SERVER_DESCRIPTION="Select your sales server for this component"
|
||||
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_SALES_SERVER_LABEL="Sales Server"
|
||||
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Joomla Component to customise the alias."
|
||||
@ -7487,7 +7488,7 @@ COM_COMPONENTBUILDER_LIBRARY_NOTE_NO_BEHAVIOUR_THREE_DESCRIPTION="There is no be
|
||||
COM_COMPONENTBUILDER_LIBRARY_NOTE_NO_BEHAVIOUR_THREE_LABEL="No Behaviour"
|
||||
COM_COMPONENTBUILDER_LIBRARY_NOTE_NO_BEHAVIOUR_TWO_DESCRIPTION="There is no behaviour set for this library. This means JCB will not add any files unless you custom code it in somewhere."
|
||||
COM_COMPONENTBUILDER_LIBRARY_NOTE_NO_BEHAVIOUR_TWO_LABEL="No Behaviour"
|
||||
COM_COMPONENTBUILDER_LIBRARY_NOTE_YES_BEHAVIOUR_LIBRARY_DESCRIPTION="We are working on this feature it is not yet ready, but soon enough you will be able to build real Joomla library integration here."
|
||||
COM_COMPONENTBUILDER_LIBRARY_NOTE_YES_BEHAVIOUR_LIBRARY_DESCRIPTION="To effectively integrate a PHP library into your component, leverage the [Powers] Area within JCB. This feature empowers you to seamlessly incorporate Composer packages as well as standard PHP class structures into your component, ensuring a robust and maintainable solution."
|
||||
COM_COMPONENTBUILDER_LIBRARY_NOTE_YES_BEHAVIOUR_LIBRARY_LABEL="Set Behaviour"
|
||||
COM_COMPONENTBUILDER_LIBRARY_NOTE_YES_BEHAVIOUR_ONE_DESCRIPTION="All the library files linked to this library will always be added to a view if linked to the view."
|
||||
COM_COMPONENTBUILDER_LIBRARY_NOTE_YES_BEHAVIOUR_ONE_LABEL="Set Behaviour"
|
||||
@ -7999,7 +8000,7 @@ COM_COMPONENTBUILDER_REPOSITORY_GUID_DESCRIPTION="Globally Unique Identifier"
|
||||
COM_COMPONENTBUILDER_REPOSITORY_GUID_HINT="Auto Generated"
|
||||
COM_COMPONENTBUILDER_REPOSITORY_GUID_LABEL="GUID"
|
||||
COM_COMPONENTBUILDER_REPOSITORY_ID="Id"
|
||||
COM_COMPONENTBUILDER_REPOSITORY_JOOMLA_FIELD_TYPE="Joomla Field Type"
|
||||
COM_COMPONENTBUILDER_REPOSITORY_JOOMLA_FIELD_TYPES="Joomla Field Types"
|
||||
COM_COMPONENTBUILDER_REPOSITORY_JOOMLA_POWER="Joomla Power"
|
||||
COM_COMPONENTBUILDER_REPOSITORY_MODIFIED_BY_DESC="The last user that modified this Repository."
|
||||
COM_COMPONENTBUILDER_REPOSITORY_MODIFIED_BY_LABEL="Modified By"
|
||||
@ -9246,9 +9247,12 @@ COM_COMPONENTBUILDER_UPDATE_ALL="Update All"
|
||||
COM_COMPONENTBUILDER_UPDATE_ALL_DIVERGED_SNIPPETS="Update All Diverged Snippets"
|
||||
COM_COMPONENTBUILDER_UPDATE_ALL_ITEMS_FOUND_WITH_THIS_DATABASE_SEARCH_WITH_THE_REPLACE_VALUE="Update all items found with this database search, with the replace value."
|
||||
COM_COMPONENTBUILDER_UPDATE_ALL_OUT_DATED_SNIPPETS="Update All Out Dated Snippets"
|
||||
COM_COMPONENTBUILDER_UPDATE_OF_USER_S_S_FAILEDS="Update of user %s (%s) failed!%s"
|
||||
COM_COMPONENTBUILDER_UP_TO_DATE="Up to date"
|
||||
COM_COMPONENTBUILDER_USAGE="Usage"
|
||||
COM_COMPONENTBUILDER_USED_IN="Used in"
|
||||
COM_COMPONENTBUILDER_USER_CREATION_FAILED="User creation failed!"
|
||||
COM_COMPONENTBUILDER_USER_S_S_CREATION_FAILEDS="User %s (%s) creation failed!%s"
|
||||
COM_COMPONENTBUILDER_USE_BATCH="Use Batch"
|
||||
COM_COMPONENTBUILDER_USE_BATCH_DESC="Allows users in this group to use batch copy/update method."
|
||||
COM_COMPONENTBUILDER_USE_KEY="Use Key"
|
||||
|
@ -18,12 +18,28 @@ use Joomla\CMS\HTML\HTMLHelper as Html;
|
||||
use Joomla\CMS\Layout\LayoutHelper;
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
|
||||
$table_id = (isset($displayData['id'])) ? $displayData['id'] : StringHelper::random(7);
|
||||
$name = (isset($displayData['name'])) ? $displayData['name'] : false;
|
||||
$table_class = (isset($displayData['table_class'])) ? $displayData['table_class'] : 'uk-table';
|
||||
$table_container_class = (isset($displayData['table_container_class'])) ? $displayData['table_container_class'] : 'uk-overflow-auto';
|
||||
$headers = (isset($displayData['headers'])) ? $displayData['headers'] : [Text::_('COM_COMPONENTBUILDER_NO'), Text::_('COM_COMPONENTBUILDER_HEADERS'), Text::_('COM_COMPONENTBUILDER_FOUND')];
|
||||
$items = (isset($displayData['items'])) ? $displayData['items'] : 6;
|
||||
// Extract all keys from $displayData as individual variables.
|
||||
extract($displayData);
|
||||
|
||||
// Assign default values for variables that might not be present in $displayData.
|
||||
|
||||
// The 'table_id' parameter, defaulting to a randomly generated value if not set or is null.
|
||||
$table_id = $id ?? StringHelper::random(7);
|
||||
|
||||
// The 'name' parameter, defaulting to false if not set or is null.
|
||||
$name ??= false;
|
||||
|
||||
// The 'table_class' parameter, defaulting to 'uk-table' if not set or is null.
|
||||
$table_class ??= 'uk-table';
|
||||
|
||||
// The 'table_container_class' parameter, defaulting to 'uk-overflow-auto' if not set or is null.
|
||||
$table_container_class ??= 'uk-overflow-auto';
|
||||
|
||||
// The 'headers' parameter, defaulting to an array of default header values if not set or is null.
|
||||
$headers ??= [Text::_('COM_COMPONENTBUILDER_NO'), Text::_('COM_COMPONENTBUILDER_HEADERS'), Text::_('COM_COMPONENTBUILDER_FOUND')];
|
||||
|
||||
// The 'items' parameter, defaulting to 6 if not set or is null.
|
||||
$items ??= 6;
|
||||
|
||||
?>
|
||||
<div class="<?php echo $$table_container_class; ?>">
|
||||
|
@ -40,9 +40,9 @@ class JFormFieldNamespaces extends JFormFieldList
|
||||
protected function getOptions()
|
||||
{
|
||||
// Get the user object.
|
||||
$user = JFactory::getUser();
|
||||
$user = Factory::getUser();
|
||||
// Get the databse object.
|
||||
$db = JFactory::getDBO();
|
||||
$db = Factory::getDBO();
|
||||
$query = $db->getQuery(true);
|
||||
$query->select($db->quoteName(array('a.guid','a.name','a.namespace','a.type','a.power_version'),array('guid','use_name','namespace','type','version')));
|
||||
$query->from($db->quoteName('#__componentbuilder_power', 'a'));
|
||||
@ -60,7 +60,7 @@ class JFormFieldNamespaces extends JFormFieldList
|
||||
}
|
||||
}
|
||||
// get the input
|
||||
$jinput = JFactory::getApplication()->input;
|
||||
$jinput = Factory::getApplication()->input;
|
||||
// get the id
|
||||
$power_id = $jinput->getInt('id', 0);
|
||||
// if we have an id we remove all classes of the same namespace and name
|
||||
@ -74,17 +74,17 @@ class JFormFieldNamespaces extends JFormFieldList
|
||||
// if none was found, we add this to set an alternative to set custom
|
||||
if (!$items)
|
||||
{
|
||||
$options[] = JHtml::_('select.option', '', JText::_('COM_COMPONENTBUILDER_NONE_FOUND'));
|
||||
$options[] = Html::_('select.option', '', Text::_('COM_COMPONENTBUILDER_NONE_FOUND'));
|
||||
}
|
||||
if ($items)
|
||||
{
|
||||
if ($this->multiple === false)
|
||||
{
|
||||
$options[] = JHtml::_('select.option', '', JText::_('COM_COMPONENTBUILDER_SELECT_AN_OPTION'));
|
||||
$options[] = Html::_('select.option', '', Text::_('COM_COMPONENTBUILDER_SELECT_AN_OPTION'));
|
||||
}
|
||||
foreach($items as $item)
|
||||
{
|
||||
$options[] = JHtml::_('select.option', $item->guid, str_replace('.','\\', $item->namespace) . ' [' . $item->use_name . '] (v' . $item->version . ' - ' . $item->type . ')');
|
||||
$options[] = Html::_('select.option', $item->guid, str_replace('.','\\', $item->namespace) . ' [' . $item->use_name . '] (v' . $item->version . ' - ' . $item->type . ')');
|
||||
}
|
||||
}
|
||||
return $options;
|
||||
|
@ -141,6 +141,7 @@
|
||||
label="COM_COMPONENTBUILDER_CUSTOM_CODE_TYPE_LABEL"
|
||||
description="COM_COMPONENTBUILDER_CUSTOM_CODE_TYPE_DESCRIPTION"
|
||||
class="btn-group btn-group-yesno"
|
||||
default="0"
|
||||
required="true">
|
||||
<!-- Option Set. -->
|
||||
<option value="1">
|
||||
|
@ -284,7 +284,7 @@
|
||||
label="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_REMOVE_LINE_BREAKS_LABEL"
|
||||
description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_REMOVE_LINE_BREAKS_DESCRIPTION"
|
||||
class="btn-group btn-group-yesno"
|
||||
default="0"
|
||||
default="1"
|
||||
required="true">
|
||||
<!-- Option Set. -->
|
||||
<option value="1">
|
||||
|
@ -235,10 +235,10 @@
|
||||
label="COM_COMPONENTBUILDER_POWER_NAMESPACE_LABEL"
|
||||
layout="joomla.form.field.subform.repeatable-table"
|
||||
multiple="true"
|
||||
buttons="add,remove,move"
|
||||
buttons="add,remove"
|
||||
icon="list"
|
||||
max="30"
|
||||
min="1"
|
||||
min="0"
|
||||
nested_depth="1">
|
||||
<form hidden="true" name="list_namespace_modal" repeat="true">
|
||||
<!-- Use Field. Type: Text. (joomla) -->
|
||||
@ -493,7 +493,8 @@
|
||||
type="namespaces"
|
||||
name="use"
|
||||
label="COM_COMPONENTBUILDER_POWER_USE_LABEL"
|
||||
class="list_class span12"
|
||||
class="span12"
|
||||
layout="joomla.form.field.list-fancy-select"
|
||||
multiple="false"
|
||||
default="0"
|
||||
button="false"
|
||||
|
@ -156,7 +156,7 @@
|
||||
<option value="2">
|
||||
COM_COMPONENTBUILDER_REPOSITORY_JOOMLA_POWER</option>
|
||||
<option value="3">
|
||||
COM_COMPONENTBUILDER_REPOSITORY_JOOMLA_FIELD_TYPE</option>
|
||||
COM_COMPONENTBUILDER_REPOSITORY_JOOMLA_FIELD_TYPES</option>
|
||||
</field>
|
||||
<!-- Type Field. Type: List. (joomla) -->
|
||||
<field
|
||||
@ -261,9 +261,9 @@
|
||||
label="COM_COMPONENTBUILDER_REPOSITORY_ACCESS_REPO_LABEL"
|
||||
description="COM_COMPONENTBUILDER_REPOSITORY_ACCESS_REPO_DESCRIPTION"
|
||||
class="btn-group btn-group-yesno"
|
||||
default="">
|
||||
default="0">
|
||||
<!-- Option Set. -->
|
||||
<option value="">
|
||||
<option value="0">
|
||||
COM_COMPONENTBUILDER_REPOSITORY_GLOBAL</option>
|
||||
<option value="1">
|
||||
COM_COMPONENTBUILDER_REPOSITORY_OVERRIDE</option>
|
||||
|
@ -200,7 +200,7 @@ class ComponentbuilderModelRepositories extends ListModel
|
||||
0 => 'COM_COMPONENTBUILDER_REPOSITORY_SELECT_AN_OPTION',
|
||||
1 => 'COM_COMPONENTBUILDER_REPOSITORY_SUPER_POWER',
|
||||
2 => 'COM_COMPONENTBUILDER_REPOSITORY_JOOMLA_POWER',
|
||||
3 => 'COM_COMPONENTBUILDER_REPOSITORY_JOOMLA_FIELD_TYPE'
|
||||
3 => 'COM_COMPONENTBUILDER_REPOSITORY_JOOMLA_FIELD_TYPES'
|
||||
);
|
||||
// Now check if value is found in this array
|
||||
if (isset($targetArray[$value]) && StringHelper::check($targetArray[$value]))
|
||||
|
File diff suppressed because one or more lines are too long
@ -1,15 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension type="component" version="3.10" method="upgrade">
|
||||
<name>COM_COMPONENTBUILDER</name>
|
||||
<creationDate>23rd August, 2024</creationDate>
|
||||
<creationDate>18th September, 2024</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.2.4-alpha3</version>
|
||||
<version>3.2.4-alpha4</version>
|
||||
<description><![CDATA[
|
||||
<h1>Component Builder (v.3.2.4-alpha3)</h1>
|
||||
<h1>Component Builder (v.3.2.4-alpha4)</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.
|
||||
|
||||
|
@ -187,7 +187,7 @@
|
||||
<version>3.2.4-alpha</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.2.4-alpha3.zip</downloadurl>
|
||||
<downloadurl type="full" format="zip">https://git.vdm.dev/api/v1/repos/joomla/pkg-component-builder/archive/v3.2.4-alpha4.zip</downloadurl>
|
||||
</downloads>
|
||||
<tags>
|
||||
<tag>alpha</tag>
|
||||
@ -202,10 +202,10 @@
|
||||
<element>pkg_component_builder</element>
|
||||
<type>package</type>
|
||||
<client>site</client>
|
||||
<version>3.2.4-alpha3</version>
|
||||
<version>3.2.4-alpha4</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.2.4-alpha3.zip</downloadurl>
|
||||
<downloadurl type="full" format="zip">https://git.vdm.dev/api/v1/repos/joomla/pkg-component-builder/archive/v3.2.4-alpha4.zip</downloadurl>
|
||||
</downloads>
|
||||
<tags>
|
||||
<tag>alpha</tag>
|
||||
|
@ -24,7 +24,7 @@ use VDM\Joomla\FOF\Encrypt\Randvalinterface;
|
||||
*
|
||||
* @package FrameworkOnFramework
|
||||
* @since 1.0
|
||||
* @deprecated Use phpseclib/phpseclib version 3 Instead.
|
||||
* @deprecated Use phpseclib/phpseclib version 3 Instead.
|
||||
*/
|
||||
class Randval implements Randvalinterface
|
||||
{
|
||||
|
@ -65,7 +65,7 @@ abstract class BaseTable implements Tableinterface
|
||||
'db' => [
|
||||
'type' => 'INT(10) unsigned',
|
||||
'default' => '0',
|
||||
'null_switch' => 'NOT NULL',
|
||||
'null_switch' => 'NULL',
|
||||
'comment' => 'FK to the #__assets table.'
|
||||
]
|
||||
],
|
||||
@ -80,7 +80,7 @@ abstract class BaseTable implements Tableinterface
|
||||
'db' => [
|
||||
'type' => 'INT(11)',
|
||||
'default' => '0',
|
||||
'null_switch' => 'NOT NULL'
|
||||
'null_switch' => 'NULL'
|
||||
]
|
||||
],
|
||||
'published' => [
|
||||
@ -94,7 +94,7 @@ abstract class BaseTable implements Tableinterface
|
||||
'db' => [
|
||||
'type' => 'TINYINT(3)',
|
||||
'default' => '1',
|
||||
'null_switch' => 'NOT NULL',
|
||||
'null_switch' => 'NULL',
|
||||
'key' => true,
|
||||
'key_name' => 'state'
|
||||
]
|
||||
@ -110,7 +110,7 @@ abstract class BaseTable implements Tableinterface
|
||||
'db' => [
|
||||
'type' => 'INT(10) unsigned',
|
||||
'default' => '0',
|
||||
'null_switch' => 'NOT NULL',
|
||||
'null_switch' => 'NULL',
|
||||
'key' => true,
|
||||
'key_name' => 'modifiedby'
|
||||
]
|
||||
@ -126,7 +126,7 @@ abstract class BaseTable implements Tableinterface
|
||||
'db' => [
|
||||
'type' => 'DATETIME',
|
||||
'default' => '0000-00-00 00:00:00',
|
||||
'null_switch' => 'NOT NULL'
|
||||
'null_switch' => 'NULL'
|
||||
]
|
||||
],
|
||||
'created_by' => [
|
||||
@ -140,7 +140,7 @@ abstract class BaseTable implements Tableinterface
|
||||
'db' => [
|
||||
'type' => 'INT(10) unsigned',
|
||||
'default' => '0',
|
||||
'null_switch' => 'NOT NULL',
|
||||
'null_switch' => 'NULL',
|
||||
'key' => true,
|
||||
'key_name' => 'createdby'
|
||||
]
|
||||
@ -156,7 +156,7 @@ abstract class BaseTable implements Tableinterface
|
||||
'db' => [
|
||||
'type' => 'DATETIME',
|
||||
'default' => '0000-00-00 00:00:00',
|
||||
'null_switch' => 'NOT NULL'
|
||||
'null_switch' => 'NULL'
|
||||
]
|
||||
],
|
||||
'checked_out' => [
|
||||
@ -170,7 +170,7 @@ abstract class BaseTable implements Tableinterface
|
||||
'db' => [
|
||||
'type' => 'INT(10) unsigned',
|
||||
'default' => '0',
|
||||
'null_switch' => 'NOT NULL',
|
||||
'null_switch' => 'NULL',
|
||||
'key' => true,
|
||||
'key_name' => 'checkout'
|
||||
]
|
||||
@ -186,7 +186,7 @@ abstract class BaseTable implements Tableinterface
|
||||
'db' => [
|
||||
'type' => 'DATETIME',
|
||||
'default' => '0000-00-00 00:00:00',
|
||||
'null_switch' => 'NOT NULL'
|
||||
'null_switch' => 'NULL'
|
||||
]
|
||||
],
|
||||
'hits' => [
|
||||
@ -200,7 +200,7 @@ abstract class BaseTable implements Tableinterface
|
||||
'db' => [
|
||||
'type' => 'INT(10) unsigned',
|
||||
'default' => '0',
|
||||
'null_switch' => 'NOT NULL'
|
||||
'null_switch' => 'NULL'
|
||||
]
|
||||
],
|
||||
'version' => [
|
||||
@ -214,7 +214,7 @@ abstract class BaseTable implements Tableinterface
|
||||
'db' => [
|
||||
'type' => 'INT(10) unsigned',
|
||||
'default' => '1',
|
||||
'null_switch' => 'NOT NULL'
|
||||
'null_switch' => 'NULL'
|
||||
]
|
||||
],
|
||||
'params' => [
|
||||
|
@ -118,7 +118,7 @@ abstract class Model implements ModelInterface
|
||||
* @return array|null
|
||||
* @since 3.2.2
|
||||
*/
|
||||
public function values(?array $items = null, string $field, ?string $table = null): ?array
|
||||
public function values(?array $items, string $field, ?string $table = null): ?array
|
||||
{
|
||||
// check if this is a valid table
|
||||
if (ArrayHelper::check($items))
|
||||
|
@ -0,0 +1,127 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @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\Compiler\Architecture\JoomlaFive\ComHelperClass;
|
||||
|
||||
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Indent;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Line;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Architecture\ComHelperClass\CreateUserInterface;
|
||||
|
||||
|
||||
/**
|
||||
* Helper Class Create User Class for Joomla 5
|
||||
*
|
||||
* @since 5.0.2
|
||||
*/
|
||||
final class CreateUser implements CreateUserInterface
|
||||
{
|
||||
/**
|
||||
* Generates the method definition for creating or updating a user based on the provided parameters.
|
||||
*
|
||||
* This method returns a string representation of a PHP function that includes various
|
||||
* steps for handling user creation and updates, depending on the mode (site registration or admin registration).
|
||||
*
|
||||
* @param $add Determines whether to generate the user creation method or not.
|
||||
* If true, the method will be generated and returned as a string.
|
||||
*
|
||||
* @return string The generated method code as a string if $add is true.
|
||||
* Returns an empty string if $add is false.
|
||||
*/
|
||||
public function get($add): string
|
||||
{
|
||||
if ($add)
|
||||
{
|
||||
$method = [];
|
||||
$method[] = PHP_EOL . PHP_EOL . Indent::_(1) . "/**";
|
||||
$method[] = Indent::_(1) . " * Save user details by either creating a new user or updating an existing user.";
|
||||
$method[] = Indent::_(1) . " *";
|
||||
$method[] = Indent::_(1)
|
||||
. " * @param array \$credentials ['name' => string, 'username' => string, 'email' => string, 'password' => string, 'password2' => string]";
|
||||
$method[] = Indent::_(1) . " * @param int \$autologin";
|
||||
$method[] = Indent::_(1)
|
||||
. " * @param array \$params ['useractivation' => int, 'sendpassword' => int, 'allowUserRegistration' => int]";
|
||||
$method[] = Indent::_(1)
|
||||
. " * @param array \$mode 1 = Site Registrations; 0 = Admin Registration; 2 = Custom Helper Method Called registerUser";
|
||||
$method[] = Indent::_(1) . " *";
|
||||
$method[] = Indent::_(1) . " * @return int User ID on success";
|
||||
$method[] = Indent::_(1) . " *";
|
||||
$method[] = Indent::_(1) . " * @throws \InvalidArgumentException If required credentials are missing.";
|
||||
$method[] = Indent::_(1) . " * @throws \RuntimeException If the user update or creation fails.";
|
||||
$method[] = Indent::_(1) . " * @throws Super__"."_1c10a5f1_204d_4f17_ad9f_0e0684f2030d___Power If the user is not found.";
|
||||
$method[] = Indent::_(1) . " *";
|
||||
$method[] = Indent::_(1) . " * @since 3.0.0";
|
||||
$method[] = Indent::_(1) . " * @deprecated 4.3 Use Super__"."_7832a726_87b6_4e95_887e_7b725d3fab8f___Power::create(\$credentials, \$autologin, \$params, \$mode);";
|
||||
$method[] = Indent::_(1) . " */";
|
||||
$method[] = Indent::_(1)
|
||||
. "public static function createUser(\$credentials, \$autologin = 0,";
|
||||
$method[] = Indent::_(2) . "\$params = [";
|
||||
$method[] = Indent::_(3)
|
||||
. "'useractivation' => 0, 'sendpassword' => 1";
|
||||
$method[] = Indent::_(2) . "], \$mode = 1";
|
||||
$method[] = Indent::_(1) . ")";
|
||||
$method[] = Indent::_(1) . "{";
|
||||
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Create a user with the UserHelper class (Super---7832a726_87b6_4e95_887e_7b725d3fab8f---Power)";
|
||||
$method[] = Indent::_(2)
|
||||
. "return Super__"."_7832a726_87b6_4e95_887e_7b725d3fab8f___Power::create(\$credentials, \$autologin, \$params, \$mode);";
|
||||
$method[] = Indent::_(1) . "}";
|
||||
|
||||
$method[] = PHP_EOL . PHP_EOL . Indent::_(1) . "/**";
|
||||
$method[] = Indent::_(1) . " * Update the given component params.";
|
||||
$method[] = Indent::_(1) . " *";
|
||||
$method[] = Indent::_(1) . " * @param string|null \$option The optional extension element name.";
|
||||
$method[] = Indent::_(1) . " * @param string \$target The parameter name to be updated.";
|
||||
$method[] = Indent::_(1) . " * @param mixed \$value The value to set for the parameter.";
|
||||
$method[] = Indent::_(1) . " *";
|
||||
$method[] = Indent::_(1) . " * @since 3.0.0";
|
||||
$method[] = Indent::_(1) . " * @deprecated 4.3 Use Super__"."_640b5352_fb09_425f_a26e_cd44eda03f15___Power::setParams(\$target, \$value, \$option);";
|
||||
$method[] = Indent::_(1) . " */";
|
||||
$method[] = PHP_EOL . Indent::_(1)
|
||||
. "public static function setParams(\$option, \$target, \$value)";
|
||||
$method[] = Indent::_(1) . "{";
|
||||
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Sets a parameter value for the given target in the specified option's params";
|
||||
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
|
||||
. " (Super---640b5352_fb09_425f_a26e_cd44eda03f15---Power)";
|
||||
$method[] = Indent::_(2)
|
||||
. "return Super__"."_640b5352_fb09_425f_a26e_cd44eda03f15___Power::setParams(\$target, \$value, \$option);";
|
||||
$method[] = Indent::_(1) . "}";
|
||||
|
||||
$method[] = PHP_EOL . Indent::_(1) . "/**";
|
||||
$method[] = Indent::_(1) . " * Update user details";
|
||||
$method[] = Indent::_(1) . " *";
|
||||
$method[] = Indent::_(1) . " * @param array \$userDetails Array containing user details to be updated";
|
||||
$method[] = Indent::_(1) . " *";
|
||||
$method[] = Indent::_(1) . " * @return int Updated user ID on success.";
|
||||
$method[] = Indent::_(1) . " *";
|
||||
$method[] = Indent::_(1) . " * @throws \RuntimeException If user update fails.";
|
||||
$method[] = Indent::_(1) . " *";
|
||||
$method[] = Indent::_(1) . " * @since 3.0.0";
|
||||
$method[] = Indent::_(1) . " * @deprecated 4.3 Use Super__"."_7832a726_87b6_4e95_887e_7b725d3fab8f___Power::update(\$userDetails);";
|
||||
$method[] = Indent::_(1) . " */";
|
||||
$method[] = Indent::_(1)
|
||||
. "public static function updateUser(\$userDetails): int";
|
||||
$method[] = Indent::_(1) . "{";
|
||||
$method[] = Indent::_(2)
|
||||
. "//" . Line::_(__Line__, __Class__)
|
||||
. " Update user details with the UserHelper class (Super---7832a726_87b6_4e95_887e_7b725d3fab8f---Power)";
|
||||
$method[] = Indent::_(2) . "return Super__"."_7832a726_87b6_4e95_887e_7b725d3fab8f___Power::update(\$userDetails);";
|
||||
$method[] = Indent::_(1) . "}";
|
||||
|
||||
// return the help method
|
||||
return implode(PHP_EOL, $method);
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
@ -155,7 +155,7 @@ final class Extension implements ExtensionInterface
|
||||
$counter = 0;
|
||||
foreach ($methods as $method)
|
||||
{
|
||||
if ($method['access'] === 'public' && !$method['static'] && !$method['abstract'])
|
||||
if ($this->validEventName($method))
|
||||
{
|
||||
$events[$method['name']] = Indent::_(3) . "'{$method['name']}' => '{$method['name']}'";
|
||||
|
||||
@ -191,6 +191,37 @@ final class Extension implements ExtensionInterface
|
||||
return implode(PHP_EOL, $method);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates if a method name is a valid event name for a Joomla plugin.
|
||||
*
|
||||
* The method must meet the following criteria:
|
||||
* - It must be public, not static, and not abstract.
|
||||
* - It must not be a magic method (i.e., should not start with '__').
|
||||
*
|
||||
* @param array $method The method details, including 'name', 'access', 'static', and 'abstract'.
|
||||
*
|
||||
* @return bool Returns true if the method is a valid event name, otherwise false.
|
||||
*
|
||||
* @since 5.0.2
|
||||
*/
|
||||
protected function validEventName(array $method): bool
|
||||
{
|
||||
// Check if the method is public, static, and not abstract
|
||||
if ($method['access'] !== 'public' || $method['static'] || $method['abstract'])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if the method is a magic method (starts with '__')
|
||||
if (substr($method['name'], 0, 2) === '__')
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// If all checks pass, the method is a valid event name
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the getSubscribedEvents is set
|
||||
*
|
||||
|
@ -0,0 +1,125 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @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\Compiler\Architecture\JoomlaFour\ComHelperClass;
|
||||
|
||||
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Indent;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Line;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Architecture\ComHelperClass\CreateUserInterface;
|
||||
|
||||
|
||||
/**
|
||||
* Helper Class Create User Class for Joomla 4
|
||||
*
|
||||
* @since 5.0.2
|
||||
*/
|
||||
final class CreateUser implements CreateUserInterface
|
||||
{
|
||||
/**
|
||||
* Generates the method definition for creating or updating a user based on the provided parameters.
|
||||
*
|
||||
* This method returns a string representation of a PHP function that includes various
|
||||
* steps for handling user creation and updates, depending on the mode (site registration or admin registration).
|
||||
*
|
||||
* @param $add Determines whether to generate the user creation method or not.
|
||||
* If true, the method will be generated and returned as a string.
|
||||
*
|
||||
* @return string The generated method code as a string if $add is true.
|
||||
* Returns an empty string if $add is false.
|
||||
*/
|
||||
public function get($add): string
|
||||
{
|
||||
if ($add)
|
||||
{
|
||||
$method = [];
|
||||
$method[] = PHP_EOL . PHP_EOL . Indent::_(1) . "/**";
|
||||
$method[] = Indent::_(1) . " * Save user details by either creating a new user or updating an existing user.";
|
||||
$method[] = Indent::_(1) . " *";
|
||||
$method[] = Indent::_(1)
|
||||
. " * @param array \$credentials ['name' => string, 'username' => string, 'email' => string, 'password' => string, 'password2' => string]";
|
||||
$method[] = Indent::_(1) . " * @param int \$autologin";
|
||||
$method[] = Indent::_(1)
|
||||
. " * @param array \$params ['useractivation' => int, 'sendpassword' => int, 'allowUserRegistration' => int]";
|
||||
$method[] = Indent::_(1)
|
||||
. " * @param array \$mode 1 = Site Registrations; 0 = Admin Registration; 2 = Custom Helper Method Called registerUser";
|
||||
$method[] = Indent::_(1) . " *";
|
||||
$method[] = Indent::_(1) . " * @return int User ID on success";
|
||||
$method[] = Indent::_(1) . " *";
|
||||
$method[] = Indent::_(1) . " * @throws \InvalidArgumentException If required credentials are missing.";
|
||||
$method[] = Indent::_(1) . " * @throws \RuntimeException If the user update or creation fails.";
|
||||
$method[] = Indent::_(1) . " * @throws Super__"."_1c10a5f1_204d_4f17_ad9f_0e0684f2030d___Power If the user is not found.";
|
||||
$method[] = Indent::_(1) . " *";
|
||||
$method[] = Indent::_(1) . " * @since 3.0.0";
|
||||
$method[] = Indent::_(1) . " * @deprecated 4.3 Use Super__"."_7832a726_87b6_4e95_887e_7b725d3fab8f___Power::create(\$credentials, \$autologin, \$params, \$mode);";
|
||||
$method[] = Indent::_(1) . " */";
|
||||
$method[] = Indent::_(1)
|
||||
. "public static function createUser(\$credentials, \$autologin = 0,";
|
||||
$method[] = Indent::_(2) . "\$params = [";
|
||||
$method[] = Indent::_(3)
|
||||
. "'useractivation' => 0, 'sendpassword' => 1";
|
||||
$method[] = Indent::_(2) . "], \$mode = 1";
|
||||
$method[] = Indent::_(1) . ")";
|
||||
$method[] = Indent::_(1) . "{";
|
||||
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Create a user with the UserHelper class";
|
||||
$method[] = Indent::_(2)
|
||||
. "return Super__"."_7832a726_87b6_4e95_887e_7b725d3fab8f___Power::create(\$credentials, \$autologin, \$params, \$mode);";
|
||||
$method[] = Indent::_(1) . "}";
|
||||
|
||||
$method[] = PHP_EOL . PHP_EOL . Indent::_(1) . "/**";
|
||||
$method[] = Indent::_(1) . " * Update the given component params.";
|
||||
$method[] = Indent::_(1) . " *";
|
||||
$method[] = Indent::_(1) . " * @param string|null \$option The optional extension element name.";
|
||||
$method[] = Indent::_(1) . " * @param string \$target The parameter name to be updated.";
|
||||
$method[] = Indent::_(1) . " * @param mixed \$value The value to set for the parameter.";
|
||||
$method[] = Indent::_(1) . " *";
|
||||
$method[] = Indent::_(1) . " * @since 3.0.0";
|
||||
$method[] = Indent::_(1) . " * @deprecated 4.3 Use Super__"."_640b5352_fb09_425f_a26e_cd44eda03f15___Power::setParams(\$target, \$value, \$option);";
|
||||
$method[] = Indent::_(1) . " */";
|
||||
$method[] = PHP_EOL . Indent::_(1)
|
||||
. "public static function setParams(\$option, \$target, \$value)";
|
||||
$method[] = Indent::_(1) . "{";
|
||||
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Sets a parameter value for the given target in the specified option's params";
|
||||
$method[] = Indent::_(2)
|
||||
. "return Super__"."_640b5352_fb09_425f_a26e_cd44eda03f15___Power::setParams(\$target, \$value, \$option);";
|
||||
$method[] = Indent::_(1) . "}";
|
||||
|
||||
$method[] = PHP_EOL . Indent::_(1) . "/**";
|
||||
$method[] = Indent::_(1) . " * Update user details";
|
||||
$method[] = Indent::_(1) . " *";
|
||||
$method[] = Indent::_(1) . " * @param array \$userDetails Array containing user details to be updated";
|
||||
$method[] = Indent::_(1) . " *";
|
||||
$method[] = Indent::_(1) . " * @return int Updated user ID on success.";
|
||||
$method[] = Indent::_(1) . " *";
|
||||
$method[] = Indent::_(1) . " * @throws \RuntimeException If user update fails.";
|
||||
$method[] = Indent::_(1) . " *";
|
||||
$method[] = Indent::_(1) . " * @since 3.0.0";
|
||||
$method[] = Indent::_(1) . " * @deprecated 4.3 Use Super__"."_7832a726_87b6_4e95_887e_7b725d3fab8f___Power::update(\$userDetails);";
|
||||
$method[] = Indent::_(1) . " */";
|
||||
$method[] = Indent::_(1)
|
||||
. "public static function updateUser(\$userDetails): int";
|
||||
$method[] = Indent::_(1) . "{";
|
||||
$method[] = Indent::_(2)
|
||||
. "//" . Line::_(__Line__, __Class__)
|
||||
. " Update user details with the UserHelper class";
|
||||
$method[] = Indent::_(2) . "return Super__"."_7832a726_87b6_4e95_887e_7b725d3fab8f___Power::update(\$userDetails);";
|
||||
$method[] = Indent::_(1) . "}";
|
||||
|
||||
// return the help method
|
||||
return implode(PHP_EOL, $method);
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
@ -155,7 +155,7 @@ final class Extension implements ExtensionInterface
|
||||
$counter = 0;
|
||||
foreach ($methods as $method)
|
||||
{
|
||||
if ($method['access'] === 'public' && !$method['static'] && !$method['abstract'])
|
||||
if ($this->validEventName($method))
|
||||
{
|
||||
$events[$method['name']] = Indent::_(3) . "'{$method['name']}' => '{$method['name']}'";
|
||||
|
||||
@ -191,6 +191,37 @@ final class Extension implements ExtensionInterface
|
||||
return implode(PHP_EOL, $method);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates if a method name is a valid event name for a Joomla plugin.
|
||||
*
|
||||
* The method must meet the following criteria:
|
||||
* - It must be public, not static, and not abstract.
|
||||
* - It must not be a magic method (i.e., should not start with '__').
|
||||
*
|
||||
* @param array $method The method details, including 'name', 'access', 'static', and 'abstract'.
|
||||
*
|
||||
* @return bool Returns true if the method is a valid event name, otherwise false.
|
||||
*
|
||||
* @since 5.0.2
|
||||
*/
|
||||
protected function validEventName(array $method): bool
|
||||
{
|
||||
// Check if the method is public, static, and not abstract
|
||||
if ($method['access'] !== 'public' || $method['static'] || $method['abstract'])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if the method is a magic method (starts with '__')
|
||||
if (substr($method['name'], 0, 2) === '__')
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// If all checks pass, the method is a valid event name
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the getSubscribedEvents is set
|
||||
*
|
||||
|
@ -0,0 +1,366 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @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\Compiler\Architecture\JoomlaThree\ComHelperClass;
|
||||
|
||||
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Indent;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Line;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Architecture\ComHelperClass\CreateUserInterface;
|
||||
|
||||
|
||||
/**
|
||||
* Helper Class Create User Class for Joomla 3
|
||||
*
|
||||
* @since 5.0.2
|
||||
*/
|
||||
final class CreateUser implements CreateUserInterface
|
||||
{
|
||||
/**
|
||||
* Generates the method definition for creating or updating a user based on the provided parameters.
|
||||
*
|
||||
* This method returns a string representation of a PHP function that includes various
|
||||
* steps for handling user creation and updates, depending on the mode (site registration or admin registration).
|
||||
*
|
||||
* @param $add Determines whether to generate the user creation method or not.
|
||||
* If true, the method will be generated and returned as a string.
|
||||
*
|
||||
* @return string The generated method code as a string if $add is true.
|
||||
* Returns an empty string if $add is false.
|
||||
*/
|
||||
public function get($add): string
|
||||
{
|
||||
if ($add)
|
||||
{
|
||||
$method = [];
|
||||
$method[] = PHP_EOL . PHP_EOL . Indent::_(1) . "/**";
|
||||
$method[] = Indent::_(1) . " * Greate user and update given table";
|
||||
$method[] = Indent::_(1) . " *";
|
||||
$method[] = Indent::_(1)
|
||||
. " * @param array \$credentials Array('name' => string, 'username' => string, 'email' => string, 'password' => string, 'password2' => string)";
|
||||
$method[] = Indent::_(1) . " * @param int \$autologin";
|
||||
$method[] = Indent::_(1)
|
||||
. " * @param array \$params Array('useractivation' => int, 'sendpassword' => int, 'allowUserRegistration' => int)";
|
||||
$method[] = Indent::_(1)
|
||||
. " * @param array \$mode 1 = Site Registrations; 0 = Admin Registration; 2 = Custom Helper Method Called registerUser";
|
||||
$method[] = Indent::_(1) . " *";
|
||||
$method[] = Indent::_(1)
|
||||
. " * @return int|Error User ID on success, or an error.";
|
||||
$method[] = Indent::_(1) . " */";
|
||||
$method[] = Indent::_(1)
|
||||
. "public static function createUser(\$credentials, \$autologin = 0,";
|
||||
$method[] = Indent::_(2) . "\$params = array(";
|
||||
$method[] = Indent::_(3)
|
||||
. "'useractivation' => 0, 'sendpassword' => 1";
|
||||
$method[] = Indent::_(2) . "), \$mode = 1";
|
||||
$method[] = Indent::_(1) . ")";
|
||||
$method[] = Indent::_(1) . "{";
|
||||
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Override mode";
|
||||
$method[] = Indent::_(2)
|
||||
. "if (\$mode == 2 && method_exists(__CLASS__, 'registerUser'))";
|
||||
$method[] = Indent::_(2) . "{";
|
||||
$method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Update params";
|
||||
$method[] = Indent::_(3) . "\$params['autologin'] = \$autologin;";
|
||||
$method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Now Register User";
|
||||
$method[] = Indent::_(3)
|
||||
. "return self::registerUser(\$credentials, \$params);";
|
||||
$method[] = Indent::_(2) . "}";
|
||||
$method[] = Indent::_(2) . "elseif (\$mode == 2)";
|
||||
$method[] = Indent::_(2) . "{";
|
||||
$method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Fallback to Site Registrations";
|
||||
$method[] = Indent::_(3) . "\$mode = 1;";
|
||||
$method[] = Indent::_(2) . "}";
|
||||
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
|
||||
. " load the user component language files if there is an error.";
|
||||
$method[] = Indent::_(2) . "\$lang = Factory::getLanguage();";
|
||||
$method[] = Indent::_(2) . "\$extension = 'com_users';";
|
||||
$method[] = Indent::_(2) . "\$base_dir = JPATH_SITE;";
|
||||
$method[] = Indent::_(2) . "\$language_tag = '" . CFactory::_('Config')->get('lang_tag', 'en-GB')
|
||||
. "';";
|
||||
$method[] = Indent::_(2) . "\$reload = true;";
|
||||
$method[] = Indent::_(2)
|
||||
. "\$lang->load(\$extension, \$base_dir, \$language_tag, \$reload);";
|
||||
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Load the correct user model.";
|
||||
$method[] = Indent::_(2) . "if (\$mode == 1) //" . Line::_(
|
||||
__LINE__,__CLASS__
|
||||
)
|
||||
. " 1 = Site Registrations";
|
||||
$method[] = Indent::_(2) . "{";
|
||||
$method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Load the user site-registration model";
|
||||
$method[] = Indent::_(3)
|
||||
. "\$model = self::getModel('registration', \$base_dir . '/components/' . \$extension, 'Users');";
|
||||
$method[] = Indent::_(2) . "}";
|
||||
$method[] = Indent::_(2) . "else //" . Line::_(__Line__, __Class__)
|
||||
. " 0 = Admin Registration";
|
||||
$method[] = Indent::_(2) . "{";
|
||||
$method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Load the backend-user model";
|
||||
$method[] = Indent::_(3)
|
||||
. "\$model = self::getModel('user', JPATH_ADMINISTRATOR . '/components/' . \$extension, 'Users');";
|
||||
$method[] = Indent::_(2) . "}";
|
||||
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Check if we have params/config";
|
||||
$method[] = Indent::_(2) . "if (Super_" . "__0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check(\$params))";
|
||||
$method[] = Indent::_(2) . "{";
|
||||
$method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Make changes to user config";
|
||||
$method[] = Indent::_(3)
|
||||
. "foreach (\$params as \$param => \$set)";
|
||||
$method[] = Indent::_(3) . "{";
|
||||
$method[] = Indent::_(4) . "//" . Line::_(__Line__, __Class__)
|
||||
. " If you know of a better path, let me know";
|
||||
$method[] = Indent::_(4)
|
||||
. "\$params[\$param] = self::setParams(\$extension, \$param, \$set);";
|
||||
$method[] = Indent::_(3) . "}";
|
||||
$method[] = Indent::_(2) . "}";
|
||||
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Set username to email if not set";
|
||||
$method[] = Indent::_(2)
|
||||
. "if (!isset(\$credentials['username']) || !Super_" . "__1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check(\$credentials['username']))";
|
||||
$method[] = Indent::_(2) . "{";
|
||||
$method[] = Indent::_(3)
|
||||
. "\$credentials['username'] = \$credentials['email'];";
|
||||
$method[] = Indent::_(2) . "}";
|
||||
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Lineup new user data array";
|
||||
$method[] = Indent::_(2) . "\$data = array(";
|
||||
$method[] = Indent::_(3)
|
||||
. "'username' => \$credentials['username'],";
|
||||
$method[] = Indent::_(3) . "'name' => \$credentials['name'],";
|
||||
$method[] = Indent::_(3) . "'block' => 0 );";
|
||||
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Added details based on mode";
|
||||
$method[] = Indent::_(2) . "if (\$mode == 1) //" . Line::_(
|
||||
__LINE__,__CLASS__
|
||||
)
|
||||
. " 1 = Site-registration mode";
|
||||
$method[] = Indent::_(2) . "{";
|
||||
$method[] = Indent::_(3)
|
||||
. "\$data['email1'] = \$credentials['email'];";
|
||||
$method[] = Indent::_(2) . "}";
|
||||
$method[] = Indent::_(2) . "else //" . Line::_(__Line__, __Class__)
|
||||
. " 0 = Admin-registration mode";
|
||||
$method[] = Indent::_(2) . "{";
|
||||
$method[] = Indent::_(3)
|
||||
. "\$data['email'] = \$credentials['email'];";
|
||||
$method[] = Indent::_(3)
|
||||
. "\$data['registerDate'] = Factory::getDate()->toSql();";
|
||||
$method[] = Indent::_(2) . "}";
|
||||
|
||||
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Check if password was set";
|
||||
$method[] = Indent::_(2)
|
||||
. "if (\$mode == 1 && (!isset(\$credentials['password']) || !isset(\$credentials['password2']) || !Super_" . "__1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check(\$credentials['password']) || !Super_" . "__1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check(\$credentials['password2'])))";
|
||||
$method[] = Indent::_(2) . "{";
|
||||
$method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Set random password when empty password was submitted,";
|
||||
$method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__)
|
||||
. " when using the 1 = site-registration mode";
|
||||
$method[] = Indent::_(3)
|
||||
. "\$credentials['password'] = self::randomkey(8);";
|
||||
$method[] = Indent::_(3)
|
||||
. "\$credentials['password2'] = \$credentials['password'];";
|
||||
$method[] = Indent::_(2) . "}";
|
||||
|
||||
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Now Add password if set";
|
||||
$method[] = Indent::_(2)
|
||||
. "if (isset(\$credentials['password']) && isset(\$credentials['password2']) && Super_" . "__1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check(\$credentials['password']) && Super_" . "__1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check(\$credentials['password2']))";
|
||||
$method[] = Indent::_(2) . "{";
|
||||
$method[] = Indent::_(3) . "if (\$mode == 1) //" . Line::_(
|
||||
__LINE__,__CLASS__
|
||||
)
|
||||
. " 1 = Site-registration mode";
|
||||
$method[] = Indent::_(3) . "{";
|
||||
$method[] = Indent::_(4)
|
||||
. "\$data['password1'] = \$credentials['password'];";
|
||||
$method[] = Indent::_(3) . "}";
|
||||
$method[] = Indent::_(3) . "else //" . Line::_(__Line__, __Class__) |